1 7z ANSI-C Decoder 9.35
\r
2 ----------------------
\r
4 7z ANSI-C provides 7z/LZMA decoding.
\r
5 7z ANSI-C version is simplified version ported from C++ code.
\r
7 LZMA is default and general compression method of 7z format
\r
8 in 7-Zip compression program (www.7-zip.org). LZMA provides high
\r
9 compression ratio and very fast decompression.
\r
15 7z ANSI-C Decoder is part of the LZMA SDK.
\r
16 LZMA SDK is written and placed in the public domain by Igor Pavlov.
\r
19 ---------------------
\r
21 7zDecode.* - Low level 7z decoding
\r
22 7zExtract.* - High level 7z decoding
\r
23 7zHeader.* - .7z format constants
\r
24 7zIn.* - .7z archive opening
\r
25 7zItem.* - .7z structures
\r
26 7zMain.c - Test application
\r
32 You can create .7z archive with 7z.exe, 7za.exe or 7zr.exe:
\r
34 7z.exe a archive.7z *.htm -r -mx -m0fb=255
\r
36 If you have big number of files in archive, and you need fast extracting,
\r
37 you can use partly-solid archives:
\r
39 7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K
\r
41 In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only
\r
42 512KB for extracting one file from such archive.
\r
45 Limitations of current version of 7z ANSI-C Decoder
\r
46 ---------------------------------------------------
\r
48 - It reads only "FileName", "Size", "LastWriteTime" and "CRC" information for each file in archive.
\r
49 - It supports only LZMA and Copy (no compression) methods with BCJ or BCJ2 filters.
\r
50 - It converts original UTF-16 Unicode file names to UTF-8 Unicode file names.
\r
52 These limitations will be fixed in future versions.
\r
55 Using 7z ANSI-C Decoder Test application:
\r
56 -----------------------------------------
\r
58 Usage: 7zDec <command> <archive_name>
\r
61 e: Extract files from archive
\r
62 l: List contents of archive
\r
63 t: Test integrity of archive
\r
69 lists contents of archive.7z
\r
73 extracts files from archive.7z to current folder.
\r
76 How to use .7z Decoder
\r
77 ----------------------
\r
82 7z Decoder uses two memory pools:
\r
85 Such scheme can allow you to avoid fragmentation of allocated blocks.
\r
88 Steps for using 7z decoder
\r
89 --------------------------
\r
91 Use code at 7zMain.c as example.
\r
93 1) Declare variables:
\r
94 inStream /* implements ILookInStream interface */
\r
95 CSzArEx db; /* 7z archive database structure */
\r
96 ISzAlloc allocImp; /* memory functions for main pool */
\r
97 ISzAlloc allocTempImp; /* memory functions for temporary pool */
\r
99 2) call CrcGenerateTable(); function to initialize CRC structures.
\r
101 3) call SzArEx_Init(&db); function to initialize db structures.
\r
103 4) call SzArEx_Open(&db, inStream, &allocMain, &allocTemp) to open archive
\r
105 This function opens archive "inStream" and reads headers to "db".
\r
106 All items in "db" will be allocated with "allocMain" functions.
\r
107 SzArEx_Open function allocates and frees temporary structures by "allocTemp" functions.
\r
109 5) List items or Extract items
\r
114 Use SzArEx_GetFileNameUtf16 function. Look example code in C\Util\7z\7zMain.c file.
\r
120 SZ_RESULT SzAr_Extract(
\r
121 CArchiveDatabaseEx *db,
\r
122 ILookInStream *inStream,
\r
123 UInt32 fileIndex, /* index of file */
\r
124 UInt32 *blockIndex, /* index of solid block */
\r
125 Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
\r
126 size_t *outBufferSize, /* buffer size for output buffer */
\r
127 size_t *offset, /* offset of stream for required file in *outBuffer */
\r
128 size_t *outSizeProcessed, /* size of file in *outBuffer */
\r
129 ISzAlloc *allocMain,
\r
130 ISzAlloc *allocTemp);
\r
132 If you need to decompress more than one file, you can send these values from previous call:
\r
136 You can consider "outBuffer" as cache of solid block. If your archive is solid,
\r
137 it will increase decompression speed.
\r
139 After decompressing you must free "outBuffer":
\r
140 allocImp.Free(outBuffer);
\r
142 6) call SzArEx_Free(&db, allocImp.Free) to free allocated items in "db".
\r
147 Memory requirements for .7z decoding
\r
148 ------------------------------------
\r
150 Memory usage for Archive opening:
\r
152 - Memory for uncompressed .7z headers
\r
153 - some other temporary blocks
\r
155 - Memory for database:
\r
156 Estimated size of one file structures in solid archive:
\r
157 - Size (4 or 8 Bytes)
\r
159 - LastWriteTime (8 bytes)
\r
160 - Some file information (4 bytes)
\r
161 - File Name (variable length) + pointer + allocation structures
\r
163 Memory usage for archive Decompressing:
\r
165 - Memory for LZMA decompressing structures
\r
167 - Memory for decompressed solid block
\r
168 - Memory for temprorary buffers, if BCJ2 fileter is used. Usually these
\r
169 temprorary buffers can be about 15% of solid block size.
\r
172 7z Decoder doesn't allocate memory for compressed blocks.
\r
173 Instead of this, you must allocate buffer with desired
\r
174 size before calling 7z Decoder. Use 7zMain.c as example.
\r
180 _SZ_ALLOC_DEBUG - define it if you want to debug alloc/free operations to stderr.
\r
185 http://www.7-zip.org
\r
186 http://www.7-zip.org/sdk.html
\r
187 http://www.7-zip.org/support.html
\r