ReactOS  0.4.13-dev-563-g0561610
cabinet.h
Go to the documentation of this file.
1 /*
2  * cabinet.h
3  *
4  * Copyright 2002 Greg Turner
5  * Copyright 2005 Gerold Jens Wucherpfennig
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 #ifndef __WINE_CABINET_H
22 #define __WINE_CABINET_H
23 
24 #include <stdarg.h>
25 
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winnt.h"
29 #include "fdi.h"
30 #include "fci.h"
31 
32 /* from msvcrt/sys/stat.h */
33 #define _S_IWRITE 0x0080
34 #define _S_IREAD 0x0100
35 
36 /* from msvcrt/fcntl.h */
37 #define _O_RDONLY 0
38 #define _O_WRONLY 1
39 #define _O_RDWR 2
40 #define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR)
41 #define _O_APPEND 0x0008
42 #define _O_RANDOM 0x0010
43 #define _O_SEQUENTIAL 0x0020
44 #define _O_TEMPORARY 0x0040
45 #define _O_NOINHERIT 0x0080
46 #define _O_CREAT 0x0100
47 #define _O_TRUNC 0x0200
48 #define _O_EXCL 0x0400
49 #define _O_SHORT_LIVED 0x1000
50 #define _O_TEXT 0x4000
51 #define _O_BINARY 0x8000
52 
53 #define CAB_SPLITMAX (10)
54 
55 #define CAB_SEARCH_SIZE (32*1024)
56 
57 typedef unsigned char cab_UBYTE; /* 8 bits */
58 typedef UINT16 cab_UWORD; /* 16 bits */
59 typedef UINT32 cab_ULONG; /* 32 bits */
60 typedef INT32 cab_LONG; /* 32 bits */
61 
62 typedef UINT32 cab_off_t;
63 
64 /* number of bits in a ULONG */
65 #define CAB_ULONG_BITS (sizeof(cab_ULONG) * 8) /* CHAR_BIT */
66 
67 /* structure offsets */
68 #define cfhead_Signature (0x00)
69 #define cfhead_CabinetSize (0x08)
70 #define cfhead_FileOffset (0x10)
71 #define cfhead_MinorVersion (0x18)
72 #define cfhead_MajorVersion (0x19)
73 #define cfhead_NumFolders (0x1A)
74 #define cfhead_NumFiles (0x1C)
75 #define cfhead_Flags (0x1E)
76 #define cfhead_SetID (0x20)
77 #define cfhead_CabinetIndex (0x22)
78 #define cfhead_SIZEOF (0x24)
79 #define cfheadext_HeaderReserved (0x00)
80 #define cfheadext_FolderReserved (0x02)
81 #define cfheadext_DataReserved (0x03)
82 #define cfheadext_SIZEOF (0x04)
83 #define cffold_DataOffset (0x00)
84 #define cffold_NumBlocks (0x04)
85 #define cffold_CompType (0x06)
86 #define cffold_SIZEOF (0x08)
87 #define cffile_UncompressedSize (0x00)
88 #define cffile_FolderOffset (0x04)
89 #define cffile_FolderIndex (0x08)
90 #define cffile_Date (0x0A)
91 #define cffile_Time (0x0C)
92 #define cffile_Attribs (0x0E)
93 #define cffile_SIZEOF (0x10)
94 #define cfdata_CheckSum (0x00)
95 #define cfdata_CompressedSize (0x04)
96 #define cfdata_UncompressedSize (0x06)
97 #define cfdata_SIZEOF (0x08)
98 
99 /* flags */
100 #define cffoldCOMPTYPE_MASK (0x000f)
101 #define cffoldCOMPTYPE_NONE (0x0000)
102 #define cffoldCOMPTYPE_MSZIP (0x0001)
103 #define cffoldCOMPTYPE_QUANTUM (0x0002)
104 #define cffoldCOMPTYPE_LZX (0x0003)
105 #define cfheadPREV_CABINET (0x0001)
106 #define cfheadNEXT_CABINET (0x0002)
107 #define cfheadRESERVE_PRESENT (0x0004)
108 #define cffileCONTINUED_FROM_PREV (0xFFFD)
109 #define cffileCONTINUED_TO_NEXT (0xFFFE)
110 #define cffileCONTINUED_PREV_AND_NEXT (0xFFFF)
111 #define cffile_A_RDONLY (0x01)
112 #define cffile_A_HIDDEN (0x02)
113 #define cffile_A_SYSTEM (0x04)
114 #define cffile_A_ARCH (0x20)
115 #define cffile_A_EXEC (0x40)
116 #define cffile_A_NAME_IS_UTF (0x80)
117 
118 /****************************************************************************/
119 /* our archiver information / state */
120 
121 /* MSZIP stuff */
122 #define ZIPWSIZE 0x8000 /* window size */
123 #define ZIPLBITS 9 /* bits in base literal/length lookup table */
124 #define ZIPDBITS 6 /* bits in base distance lookup table */
125 #define ZIPBMAX 16 /* maximum bit length of any code */
126 #define ZIPN_MAX 288 /* maximum number of codes in any set */
127 
128 struct Ziphuft {
129  cab_UBYTE e; /* number of extra bits or operation */
130  cab_UBYTE b; /* number of bits in this code or subcode */
131  union {
132  cab_UWORD n; /* literal, length base, or distance base */
133  struct Ziphuft *t; /* pointer to next level of table */
134  } v;
135 };
136 
137 struct ZIPstate {
138  cab_ULONG window_posn; /* current offset within the window */
139  cab_ULONG bb; /* bit buffer */
140  cab_ULONG bk; /* bits in bit buffer */
141  cab_ULONG ll[288+32]; /* literal/length and distance code lengths */
142  cab_ULONG c[ZIPBMAX+1]; /* bit length count table */
143  cab_LONG lx[ZIPBMAX+1]; /* memory for l[-1..ZIPBMAX-1] */
144  struct Ziphuft *u[ZIPBMAX]; /* table stack */
145  cab_ULONG v[ZIPN_MAX]; /* values in order of bit length */
146  cab_ULONG x[ZIPBMAX+1]; /* bit offsets, then code stack */
147  cab_UBYTE *inpos;
148 };
149 
150 /* Quantum stuff */
151 
152 struct QTMmodelsym {
154 };
155 
156 struct QTMmodel {
158  struct QTMmodelsym *syms;
160 };
161 
162 struct QTMstate {
163  cab_UBYTE *window; /* the actual decoding window */
164  cab_ULONG window_size; /* window size (1Kb through 2Mb) */
165  cab_ULONG actual_size; /* window size when it was first allocated */
166  cab_ULONG window_posn; /* current offset within the window */
167 
168  struct QTMmodel model7;
169  struct QTMmodelsym m7sym[7+1];
170 
171  struct QTMmodel model4, model5, model6pos, model6len;
172  struct QTMmodelsym m4sym[0x18 + 1];
173  struct QTMmodelsym m5sym[0x24 + 1];
174  struct QTMmodelsym m6psym[0x2a + 1], m6lsym[0x1b + 1];
175 
176  struct QTMmodel model00, model40, model80, modelC0;
177  struct QTMmodelsym m00sym[0x40 + 1], m40sym[0x40 + 1];
178  struct QTMmodelsym m80sym[0x40 + 1], mC0sym[0x40 + 1];
179 };
180 
181 /* LZX stuff */
182 
183 /* some constants defined by the LZX specification */
184 #define LZX_MIN_MATCH (2)
185 #define LZX_MAX_MATCH (257)
186 #define LZX_NUM_CHARS (256)
187 #define LZX_BLOCKTYPE_INVALID (0) /* also blocktypes 4-7 invalid */
188 #define LZX_BLOCKTYPE_VERBATIM (1)
189 #define LZX_BLOCKTYPE_ALIGNED (2)
190 #define LZX_BLOCKTYPE_UNCOMPRESSED (3)
191 #define LZX_PRETREE_NUM_ELEMENTS (20)
192 #define LZX_ALIGNED_NUM_ELEMENTS (8) /* aligned offset tree #elements */
193 #define LZX_NUM_PRIMARY_LENGTHS (7) /* this one missing from spec! */
194 #define LZX_NUM_SECONDARY_LENGTHS (249) /* length tree #elements */
195 
196 /* LZX huffman defines: tweak tablebits as desired */
197 #define LZX_PRETREE_MAXSYMBOLS (LZX_PRETREE_NUM_ELEMENTS)
198 #define LZX_PRETREE_TABLEBITS (6)
199 #define LZX_MAINTREE_MAXSYMBOLS (LZX_NUM_CHARS + 50*8)
200 #define LZX_MAINTREE_TABLEBITS (12)
201 #define LZX_LENGTH_MAXSYMBOLS (LZX_NUM_SECONDARY_LENGTHS+1)
202 #define LZX_LENGTH_TABLEBITS (12)
203 #define LZX_ALIGNED_MAXSYMBOLS (LZX_ALIGNED_NUM_ELEMENTS)
204 #define LZX_ALIGNED_TABLEBITS (7)
205 
206 #define LZX_LENTABLE_SAFETY (64) /* we allow length table decoding overruns */
207 
208 #define LZX_DECLARE_TABLE(tbl) \
209  cab_UWORD tbl##_table[(1<<LZX_##tbl##_TABLEBITS) + (LZX_##tbl##_MAXSYMBOLS<<1)];\
210  cab_UBYTE tbl##_len [LZX_##tbl##_MAXSYMBOLS + LZX_LENTABLE_SAFETY]
211 
212 struct LZXstate {
213  cab_UBYTE *window; /* the actual decoding window */
214  cab_ULONG window_size; /* window size (32Kb through 2Mb) */
215  cab_ULONG actual_size; /* window size when it was first allocated */
216  cab_ULONG window_posn; /* current offset within the window */
217  cab_ULONG R0, R1, R2; /* for the LRU offset system */
218  cab_UWORD main_elements; /* number of main tree elements */
219  int header_read; /* have we started decoding at all yet? */
220  cab_UWORD block_type; /* type of this block */
221  cab_ULONG block_length; /* uncompressed length of this block */
222  cab_ULONG block_remaining; /* uncompressed bytes still left to decode */
223  cab_ULONG frames_read; /* the number of CFDATA blocks processed */
224  cab_LONG intel_filesize; /* magic header value used for transform */
225  cab_LONG intel_curpos; /* current offset in transform space */
226  int intel_started; /* have we seen any translatable data yet? */
227 
228  LZX_DECLARE_TABLE(PRETREE);
229  LZX_DECLARE_TABLE(MAINTREE);
232 };
233 
234 struct lzx_bits {
236  int bl;
238 };
239 
240 /* CAB data blocks are <= 32768 bytes in uncompressed form. Uncompressed
241  * blocks have zero growth. MSZIP guarantees that it won't grow above
242  * uncompressed size by more than 12 bytes. LZX guarantees it won't grow
243  * more than 6144 bytes.
244  */
245 #define CAB_BLOCKMAX (32768)
246 #define CAB_INPUTMAX (CAB_BLOCKMAX+6144)
247 
248 struct cab_file {
249  struct cab_file *next; /* next file in sequence */
250  struct cab_folder *folder; /* folder that contains this file */
251  LPCSTR filename; /* output name of file */
252  HANDLE fh; /* open file handle or NULL */
253  cab_ULONG length; /* uncompressed length of file */
254  cab_ULONG offset; /* uncompressed offset in folder */
255  cab_UWORD index; /* magic index number of folder */
256  cab_UWORD time, date, attribs; /* MS-DOS time/date/attributes */
257 };
258 
259 
260 struct cab_folder {
261  struct cab_folder *next;
262  struct cabinet *cab[CAB_SPLITMAX]; /* cabinet(s) this folder spans */
263  cab_off_t offset[CAB_SPLITMAX]; /* offset to data blocks */
264  cab_UWORD comp_type; /* compression format/window size */
265  cab_ULONG comp_size; /* compressed size of folder */
266  cab_UBYTE num_splits; /* number of split blocks + 1 */
267  cab_UWORD num_blocks; /* total number of blocks */
268  struct cab_file *contfile; /* the first split file */
269 };
270 
271 struct cabinet {
272  struct cabinet *next; /* for making a list of cabinets */
273  LPCSTR filename; /* input name of cabinet */
274  HANDLE *fh; /* open file handle or NULL */
275  cab_off_t filelen; /* length of cabinet file */
276  cab_off_t blocks_off; /* offset to data blocks in file */
277  struct cabinet *prevcab, *nextcab; /* multipart cabinet chains */
278  char *prevname, *nextname; /* and their filenames */
279  char *previnfo, *nextinfo; /* and their visible names */
280  struct cab_folder *folders; /* first folder in this cabinet */
281  struct cab_file *files; /* first file in this cabinet */
282  cab_UBYTE block_resv; /* reserved space in datablocks */
283  cab_UBYTE flags; /* header flags */
284 };
285 
286 typedef struct cds_forward {
287  struct cab_folder *current; /* current folder we're extracting from */
288  cab_ULONG offset; /* uncompressed offset within folder */
289  cab_UBYTE *outpos; /* (high level) start of data to use up */
290  cab_UWORD outlen; /* (high level) amount of data to use up */
291  cab_UWORD split; /* at which split in current folder? */
292  int (*decompress)(int, int, struct cds_forward *); /* chosen compress fn */
293  cab_UBYTE inbuf[CAB_INPUTMAX+2]; /* +2 for lzx bitbuffer overflows! */
299  union {
300  struct ZIPstate zip;
301  struct QTMstate qtm;
302  struct LZXstate lzx;
303  } methods;
305 
306 /*
307  * the rest of these are somewhat kludgy macros which are shared between fdi.c
308  * and cabextract.c.
309  */
310 
311 /* Bitstream reading macros (Quantum / normal byte order)
312  *
313  * Q_INIT_BITSTREAM should be used first to set up the system
314  * Q_READ_BITS(var,n) takes N bits from the buffer and puts them in var.
315  * unlike LZX, this can loop several times to get the
316  * requisite number of bits.
317  * Q_FILL_BUFFER adds more data to the bit buffer, if there is room
318  * for another 16 bits.
319  * Q_PEEK_BITS(n) extracts (without removing) N bits from the bit
320  * buffer
321  * Q_REMOVE_BITS(n) removes N bits from the bit buffer
322  *
323  * These bit access routines work by using the area beyond the MSB and the
324  * LSB as a free source of zeroes. This avoids having to mask any bits.
325  * So we have to know the bit width of the bitbuffer variable. This is
326  * defined as ULONG_BITS.
327  *
328  * ULONG_BITS should be at least 16 bits. Unlike LZX's Huffman decoding,
329  * Quantum's arithmetic decoding only needs 1 bit at a time, it doesn't
330  * need an assured number. Retrieving larger bitstrings can be done with
331  * multiple reads and fills of the bitbuffer. The code should work fine
332  * for machines where ULONG >= 32 bits.
333  *
334  * Also note that Quantum reads bytes in normal order; LZX is in
335  * little-endian order.
336  */
337 
338 #define Q_INIT_BITSTREAM do { bitsleft = 0; bitbuf = 0; } while (0)
339 
340 #define Q_FILL_BUFFER do { \
341  if (bitsleft <= (CAB_ULONG_BITS - 16)) { \
342  bitbuf |= ((inpos[0]<<8)|inpos[1]) << (CAB_ULONG_BITS-16 - bitsleft); \
343  bitsleft += 16; inpos += 2; \
344  } \
345 } while (0)
346 
347 #define Q_PEEK_BITS(n) (bitbuf >> (CAB_ULONG_BITS - (n)))
348 #define Q_REMOVE_BITS(n) ((bitbuf <<= (n)), (bitsleft -= (n)))
349 
350 #define Q_READ_BITS(v,n) do { \
351  (v) = 0; \
352  for (bitsneed = (n); bitsneed; bitsneed -= bitrun) { \
353  Q_FILL_BUFFER; \
354  bitrun = (bitsneed > bitsleft) ? bitsleft : bitsneed; \
355  (v) = ((v) << bitrun) | Q_PEEK_BITS(bitrun); \
356  Q_REMOVE_BITS(bitrun); \
357  } \
358 } while (0)
359 
360 #define Q_MENTRIES(model) (QTM(model).entries)
361 #define Q_MSYM(model,symidx) (QTM(model).syms[(symidx)].sym)
362 #define Q_MSYMFREQ(model,symidx) (QTM(model).syms[(symidx)].cumfreq)
363 
364 /* GET_SYMBOL(model, var) fetches the next symbol from the stated model
365  * and puts it in var. it may need to read the bitstream to do this.
366  */
367 #define GET_SYMBOL(m, var) do { \
368  range = ((H - L) & 0xFFFF) + 1; \
369  symf = ((((C - L + 1) * Q_MSYMFREQ(m,0)) - 1) / range) & 0xFFFF; \
370  \
371  for (i=1; i < Q_MENTRIES(m); i++) { \
372  if (Q_MSYMFREQ(m,i) <= symf) break; \
373  } \
374  (var) = Q_MSYM(m,i-1); \
375  \
376  range = (H - L) + 1; \
377  H = L + ((Q_MSYMFREQ(m,i-1) * range) / Q_MSYMFREQ(m,0)) - 1; \
378  L = L + ((Q_MSYMFREQ(m,i) * range) / Q_MSYMFREQ(m,0)); \
379  while (1) { \
380  if ((L & 0x8000) != (H & 0x8000)) { \
381  if ((L & 0x4000) && !(H & 0x4000)) { \
382  /* underflow case */ \
383  C ^= 0x4000; L &= 0x3FFF; H |= 0x4000; \
384  } \
385  else break; \
386  } \
387  L <<= 1; H = (H << 1) | 1; \
388  Q_FILL_BUFFER; \
389  C = (C << 1) | Q_PEEK_BITS(1); \
390  Q_REMOVE_BITS(1); \
391  } \
392  \
393  QTMupdatemodel(&(QTM(m)), i); \
394 } while (0)
395 
396 /* Bitstream reading macros (LZX / intel little-endian byte order)
397  *
398  * INIT_BITSTREAM should be used first to set up the system
399  * READ_BITS(var,n) takes N bits from the buffer and puts them in var
400  *
401  * ENSURE_BITS(n) ensures there are at least N bits in the bit buffer.
402  * it can guarantee up to 17 bits (i.e. it can read in
403  * 16 new bits when there is down to 1 bit in the buffer,
404  * and it can read 32 bits when there are 0 bits in the
405  * buffer).
406  * PEEK_BITS(n) extracts (without removing) N bits from the bit buffer
407  * REMOVE_BITS(n) removes N bits from the bit buffer
408  *
409  * These bit access routines work by using the area beyond the MSB and the
410  * LSB as a free source of zeroes. This avoids having to mask any bits.
411  * So we have to know the bit width of the bitbuffer variable.
412  */
413 
414 #define INIT_BITSTREAM do { bitsleft = 0; bitbuf = 0; } while (0)
415 
416 /* Quantum reads bytes in normal order; LZX is little-endian order */
417 #define ENSURE_BITS(n) \
418  while (bitsleft < (n)) { \
419  bitbuf |= ((inpos[1]<<8)|inpos[0]) << (CAB_ULONG_BITS-16 - bitsleft); \
420  bitsleft += 16; inpos+=2; \
421  }
422 
423 #define PEEK_BITS(n) (bitbuf >> (CAB_ULONG_BITS - (n)))
424 #define REMOVE_BITS(n) ((bitbuf <<= (n)), (bitsleft -= (n)))
425 
426 #define READ_BITS(v,n) do { \
427  if (n) { \
428  ENSURE_BITS(n); \
429  (v) = PEEK_BITS(n); \
430  REMOVE_BITS(n); \
431  } \
432  else { \
433  (v) = 0; \
434  } \
435 } while (0)
436 
437 /* Huffman macros */
438 
439 #define TABLEBITS(tbl) (LZX_##tbl##_TABLEBITS)
440 #define MAXSYMBOLS(tbl) (LZX_##tbl##_MAXSYMBOLS)
441 #define SYMTABLE(tbl) (LZX(tbl##_table))
442 #define LENTABLE(tbl) (LZX(tbl##_len))
443 
444 /* BUILD_TABLE(tablename) builds a huffman lookup table from code lengths.
445  * In reality, it just calls make_decode_table() with the appropriate
446  * values - they're all fixed by some #defines anyway, so there's no point
447  * writing each call out in full by hand.
448  */
449 #define BUILD_TABLE(tbl) \
450  if (make_decode_table( \
451  MAXSYMBOLS(tbl), TABLEBITS(tbl), LENTABLE(tbl), SYMTABLE(tbl) \
452  )) { return DECR_ILLEGALDATA; }
453 
454 /* READ_HUFFSYM(tablename, var) decodes one huffman symbol from the
455  * bitstream using the stated table and puts it in var.
456  */
457 #define READ_HUFFSYM(tbl,var) do { \
458  ENSURE_BITS(16); \
459  hufftbl = SYMTABLE(tbl); \
460  if ((i = hufftbl[PEEK_BITS(TABLEBITS(tbl))]) >= MAXSYMBOLS(tbl)) { \
461  j = 1 << (CAB_ULONG_BITS - TABLEBITS(tbl)); \
462  do { \
463  j >>= 1; i <<= 1; i |= (bitbuf & j) ? 1 : 0; \
464  if (!j) { return DECR_ILLEGALDATA; } \
465  } while ((i = hufftbl[i]) >= MAXSYMBOLS(tbl)); \
466  } \
467  j = LENTABLE(tbl)[(var) = i]; \
468  REMOVE_BITS(j); \
469 } while (0)
470 
471 /* READ_LENGTHS(tablename, first, last) reads in code lengths for symbols
472  * first to last in the given table. The code lengths are stored in their
473  * own special LZX way.
474  */
475 #define READ_LENGTHS(tbl,first,last,fn) do { \
476  lb.bb = bitbuf; lb.bl = bitsleft; lb.ip = inpos; \
477  if (fn(LENTABLE(tbl),(first),(last),&lb,decomp_state)) { \
478  return DECR_ILLEGALDATA; \
479  } \
480  bitbuf = lb.bb; bitsleft = lb.bl; inpos = lb.ip; \
481 } while (0)
482 
483 /* Tables for deflate from PKZIP's appnote.txt. */
484 
485 #define THOSE_ZIP_CONSTS \
486 static const cab_UBYTE Zipborder[] = /* Order of the bit length code lengths */ \
487 { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; \
488 static const cab_UWORD Zipcplens[] = /* Copy lengths for literal codes 257..285 */ \
489 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, \
490  59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; \
491 static const cab_UWORD Zipcplext[] = /* Extra bits for literal codes 257..285 */ \
492 { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, \
493  4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ \
494 static const cab_UWORD Zipcpdist[] = /* Copy offsets for distance codes 0..29 */ \
495 { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, \
496 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; \
497 static const cab_UWORD Zipcpdext[] = /* Extra bits for distance codes */ \
498 { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, \
499 10, 11, 11, 12, 12, 13, 13}; \
500 /* And'ing with Zipmask[n] masks the lower n bits */ \
501 static const cab_UWORD Zipmask[17] = { \
502  0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, \
503  0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff \
504 }
505 
506 /* SESSION Operation */
507 #define EXTRACT_FILLFILELIST 0x00000001
508 #define EXTRACT_EXTRACTFILES 0x00000002
509 
510 struct FILELIST{
511  LPSTR FileName;
512  struct FILELIST *next;
513  BOOL DoExtract;
514 };
515 
516 typedef struct {
517  INT FileSize;
518  ERF Error;
519  struct FILELIST *FileList;
520  INT FileCount;
521  INT Operation;
523  CHAR CurrentFile[MAX_PATH];
525  struct FILELIST *FilterList;
526 } SESSION;
527 
528 #endif /* __WINE_CABINET_H */
struct cab_folder * folders
Definition: cabinet.h:280
cab_UBYTE q_length_extra[27]
Definition: cabinet.h:295
cab_UWORD num_blocks
Definition: cabinet.h:267
#define ALIGNED(a)
Definition: optimize.h:190
struct cabinet * next
Definition: cabinet.h:272
#define CAB_INPUTMAX
Definition: cabinet.h:246
cab_ULONG window_size
Definition: cabinet.h:214
cab_ULONG offset
Definition: cabinet.h:254
LIST_ENTRY FilterList
Definition: Filter.c:24
struct QTMmodelsym m00sym[0x40+1]
Definition: cabinet.h:177
struct cabinet * prevcab
Definition: cabinet.h:277
#define ZIPBMAX
Definition: cabinet.h:125
struct QTMmodel model00 model40 model80 modelC0
Definition: cabinet.h:176
cab_UBYTE outbuf[CAB_BLOCKMAX]
Definition: cabinet.h:294
cab_UWORD block_type
Definition: cabinet.h:220
struct QTMmodelsym m5sym[0x24+1]
Definition: cabinet.h:173
struct cabinet * nextcab
Definition: cabinet.h:277
struct cab_folder * next
Definition: cabinet.h:261
cab_LONG intel_filesize
Definition: cabinet.h:224
cab_UWORD cumfreq
Definition: cabinet.h:153
cab_ULONG window_size
Definition: cabinet.h:164
char CHAR
Definition: xmlstorage.h:175
vector< FileInfo > FileList
Definition: DriveVolume.h:63
struct QTMmodelsym m40sym[0x40+1]
Definition: cabinet.h:177
struct cds_forward cab_decomp_state
cab_UBYTE extra_bits[51]
Definition: cabinet.h:298
cab_ULONG bk
Definition: mszip.h:67
GLintptr offset
Definition: glext.h:5920
PULONG FileCount
Definition: SfcGetFiles.c:18
cab_UBYTE q_extra_bits[42]
Definition: cabinet.h:295
cab_ULONG length
Definition: cabinet.h:253
struct QTMmodelsym * syms
Definition: cabinet.h:158
cab_ULONG q_position_base[42]
Definition: cabinet.h:296
cab_ULONG R2
Definition: cabinet.h:217
#define ZIPN_MAX
Definition: cabinet.h:126
struct QTMmodelsym m4sym[0x18+1]
Definition: cabinet.h:172
cab_ULONG R0
Definition: cabinet.h:217
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
cab_UWORD time
Definition: cabinet.h:256
cab_UBYTE flags
Definition: cabinet.h:283
char * previnfo
Definition: cabinet.h:279
struct cab_folder * folder
Definition: cabinet.h:250
char * LPSTR
Definition: xmlstorage.h:182
cab_ULONG bb
Definition: cabinet.h:235
UINT16 cab_UWORD
Definition: mszip.h:26
cab_ULONG frames_read
Definition: cabinet.h:223
int32_t INT
Definition: typedefs.h:56
cab_UBYTE * window
Definition: cabinet.h:213
cab_UWORD comp_type
Definition: cabinet.h:264
Definition: mszip.h:64
cab_ULONG comp_size
Definition: cabinet.h:265
struct QTMmodelsym m80sym[0x40+1]
Definition: cabinet.h:178
cab_ULONG window_posn
Definition: mszip.h:65
cab_UWORD main_elements
Definition: cabinet.h:218
cab_ULONG bb
Definition: mszip.h:66
#define CAB_SPLITMAX
Definition: cabinet.h:53
INT32 cab_LONG
Definition: cabinet.h:60
cab_UBYTE e
Definition: mszip.h:56
cab_LONG intel_curpos
Definition: cabinet.h:225
INT32 cab_LONG
Definition: mszip.h:28
unsigned int UINT32
unsigned int BOOL
Definition: ntddk_ex.h:94
UINT32 cab_ULONG
Definition: mszip.h:27
cab_UBYTE * outpos
Definition: cabinet.h:289
Definition: fci.h:44
cab_ULONG lzx_position_base[51]
Definition: cabinet.h:297
int header_read
Definition: cabinet.h:219
char * prevname
Definition: cabinet.h:278
cab_UWORD split
Definition: cabinet.h:291
cab_UBYTE * window
Definition: cabinet.h:163
Definition: inflate.h:48
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
HANDLE fh
Definition: cabinet.h:252
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL DoExtract
Definition: files.c:526
cab_UBYTE num_splits
Definition: cabinet.h:266
char * nextname
Definition: cabinet.h:278
cab_ULONG ll[288+32]
Definition: mszip.h:68
cab_UBYTE * ip
Definition: cabinet.h:237
struct cab_file * next
Definition: cabinet.h:249
struct ZIPstate zip
Definition: cabinet.h:300
Definition: mszip.h:55
struct Ziphuft * u[ZIPBMAX]
Definition: mszip.h:71
cab_UBYTE b
Definition: mszip.h:57
UINT32 cab_ULONG
Definition: cabinet.h:59
cab_ULONG block_length
Definition: cabinet.h:221
#define MAX_PATH
Definition: compat.h:26
const GLubyte * c
Definition: glext.h:8905
cab_UWORD sym
Definition: cabinet.h:153
Definition: files.c:529
unsigned char cab_UBYTE
Definition: cabinet.h:57
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2875
UINT16 cab_UWORD
Definition: cabinet.h:58
BOOL Error
Definition: chkdsk.c:66
struct Ziphuft * t
Definition: mszip.h:60
cab_UBYTE q_length_base[27]
Definition: cabinet.h:295
cab_ULONG window_posn
Definition: cabinet.h:166
cab_LONG lx[ZIPBMAX+1]
Definition: mszip.h:70
cab_UBYTE * inpos
Definition: mszip.h:74
struct FILELIST * next
Definition: files.c:525
unsigned char cab_UBYTE
Definition: mszip.h:25
cab_UWORD attribs
Definition: cabinet.h:256
struct QTMmodel model4 model5 model6pos model6len
Definition: cabinet.h:171
cab_UWORD date
Definition: cabinet.h:256
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
struct cabinet * cab[CAB_SPLITMAX]
Definition: cabinet.h:262
int intel_started
Definition: cabinet.h:226
struct QTMmodelsym m6lsym[0x1b+1]
Definition: cabinet.h:174
int shiftsleft
Definition: cabinet.h:157
UINT32 cab_off_t
Definition: cabinet.h:62
struct QTMstate qtm
Definition: cabinet.h:301
cab_UBYTE block_resv
Definition: cabinet.h:282
LZX_DECLARE_TABLE(PRETREE)
LPCSTR filename
Definition: cabinet.h:251
int entries
Definition: cabinet.h:157
LPSTR FileName
Definition: files.c:524
struct QTMmodelsym m7sym[7+1]
Definition: cabinet.h:169
cab_ULONG window_posn
Definition: cabinet.h:216
cab_ULONG offset
Definition: cabinet.h:288
const GLdouble * v
Definition: gl.h:2040
cab_ULONG actual_size
Definition: cabinet.h:215
struct LZXstate lzx
Definition: cabinet.h:302
union Ziphuft::@243 v
cab_UWORD tabloc[256]
Definition: cabinet.h:159
LPCSTR filename
Definition: cabinet.h:273
cab_UWORD index
Definition: cabinet.h:255
struct cab_folder * current
Definition: cabinet.h:287
unsigned short UINT16
struct QTMmodelsym mC0sym[0x40+1]
Definition: cabinet.h:178
struct cab_file * files
Definition: cabinet.h:281
struct QTMmodel model7
Definition: cabinet.h:168
cab_UWORD outlen
Definition: cabinet.h:290
union cds_forward::@315 methods
cab_ULONG R1
Definition: cabinet.h:217
int(* decompress)(int, int, struct cds_forward *)
Definition: cabinet.h:292
struct QTMmodelsym m6psym[0x2a+1]
Definition: cabinet.h:174
signed int INT32
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
int bl
Definition: cabinet.h:236
#define CAB_BLOCKMAX
Definition: cabinet.h:245
cab_ULONG actual_size
Definition: cabinet.h:165
struct cab_file * contfile
Definition: cabinet.h:268
cab_off_t blocks_off
Definition: cabinet.h:276
HANDLE * fh
Definition: cabinet.h:274
cab_off_t filelen
Definition: cabinet.h:275
cab_ULONG block_remaining
Definition: cabinet.h:222
cab_UBYTE inbuf[CAB_INPUTMAX+2]
Definition: cabinet.h:293
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
char * nextinfo
Definition: cabinet.h:279
cab_UWORD n
Definition: mszip.h:59