1 /* 7z.h -- 7z interface
\r
2 2010-03-11 : Igor Pavlov : Public domain */
\r
11 #define k7zStartHeaderSize 0x20
\r
12 #define k7zSignatureSize 6
\r
13 extern Byte k7zSignature[k7zSignatureSize];
\r
14 #define k7zMajorVersion 0
\r
20 k7zIdArchiveProperties,
\r
21 k7zIdAdditionalStreamsInfo,
\r
22 k7zIdMainStreamsInfo,
\r
26 k7zIdSubStreamsInfo,
\r
30 k7zIdCodersUnpackSize,
\r
31 k7zIdNumUnpackStream,
\r
48 UInt32 NumInStreams;
\r
49 UInt32 NumOutStreams;
\r
54 void SzCoderInfo_Init(CSzCoderInfo *p);
\r
55 void SzCoderInfo_Free(CSzCoderInfo *p, ISzAlloc *alloc);
\r
65 CSzCoderInfo *Coders;
\r
66 CSzBindPair *BindPairs;
\r
67 UInt32 *PackStreams;
\r
68 UInt64 *UnpackSizes;
\r
70 UInt32 NumBindPairs;
\r
71 UInt32 NumPackStreams;
\r
72 int UnpackCRCDefined;
\r
75 UInt32 NumUnpackStreams;
\r
78 void SzFolder_Init(CSzFolder *p);
\r
79 UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
\r
80 int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex);
\r
81 UInt32 SzFolder_GetNumOutStreams(CSzFolder *p);
\r
82 UInt64 SzFolder_GetUnpackSize(CSzFolder *p);
\r
84 SRes SzFolder_Decode(const CSzFolder *folder, const UInt64 *packSizes,
\r
85 ILookInStream *stream, UInt64 startPos,
\r
86 Byte *outBuffer, size_t outSize, ISzAlloc *allocMain);
\r
96 CNtfsFileTime MTime;
\r
105 Byte AttribDefined;
\r
108 void SzFile_Init(CSzFileItem *p);
\r
113 Byte *PackCRCsDefined;
\r
115 CSzFolder *Folders;
\r
116 CSzFileItem *Files;
\r
117 UInt32 NumPackStreams;
\r
122 void SzAr_Init(CSzAr *p);
\r
123 void SzAr_Free(CSzAr *p, ISzAlloc *alloc);
\r
127 SzExtract extracts file from archive
\r
129 *outBuffer must be 0 before first call for each new archive.
\r
132 If you need to decompress more than one file, you can send
\r
133 these values from previous call:
\r
137 You can consider "*outBuffer" as cache of solid block. If your archive is solid,
\r
138 it will increase decompression speed.
\r
140 If you use external function, you can declare these 3 cache variables
\r
141 (blockIndex, outBuffer, outBufferSize) as static in that external function.
\r
143 Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
\r
150 UInt64 startPosAfterHeader;
\r
153 UInt32 *FolderStartPackStreamIndex;
\r
154 UInt64 *PackStreamStartPositions;
\r
155 UInt32 *FolderStartFileIndex;
\r
156 UInt32 *FileIndexToFolderIndexMap;
\r
158 size_t *FileNameOffsets; /* in 2-byte steps */
\r
159 CBuf FileNames; /* UTF-16-LE */
\r
162 void SzArEx_Init(CSzArEx *p);
\r
163 void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc);
\r
164 UInt64 SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder);
\r
165 int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, UInt64 *resSize);
\r
168 if dest == NULL, the return value specifies the required size of the buffer,
\r
169 in 16-bit characters, including the null-terminating character.
\r
170 if dest != NULL, the return value specifies the number of 16-bit characters that
\r
171 are written to the dest, including the null-terminating character. */
\r
173 size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest);
\r
175 SRes SzArEx_Extract(
\r
177 ILookInStream *inStream,
\r
178 UInt32 fileIndex, /* index of file */
\r
179 UInt32 *blockIndex, /* index of solid block */
\r
180 Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
\r
181 size_t *outBufferSize, /* buffer size for output buffer */
\r
182 size_t *offset, /* offset of stream for required file in *outBuffer */
\r
183 size_t *outSizeProcessed, /* size of file in *outBuffer */
\r
184 ISzAlloc *allocMain,
\r
185 ISzAlloc *allocTemp);
\r
189 SzArEx_Open Errors:
\r
190 SZ_ERROR_NO_ARCHIVE
\r
192 SZ_ERROR_UNSUPPORTED
\r
199 SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream, ISzAlloc *allocMain, ISzAlloc *allocTemp);
\r