ReactOS  0.4.15-dev-494-g1d8c567
cabinet.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS cabinet manager
4  * FILE: tools/cabman/cabinet.h
5  * PURPOSE: Cabinet definitions
6  */
7 
8 #pragma once
9 
10 #if defined(_WIN32)
11  #define WIN32_LEAN_AND_MEAN
12  #include <intrin.h>
13  #include <windows.h>
14 #else
15  #include <typedefs.h>
16  #include <unistd.h>
17 #endif
18 
19 #include <errno.h>
20 #include <fcntl.h>
21 #include <sys/types.h>
22 #include <time.h>
23 
24 #include <stdlib.h>
25 #include <stdio.h>
26 #include <string.h>
27 #include <limits.h>
28 
29 #ifndef PATH_MAX
30 #define PATH_MAX MAX_PATH
31 #endif
32 
33 #if defined(_WIN32)
34 #define DIR_SEPARATOR_CHAR '\\'
35 #define DIR_SEPARATOR_STRING "\\"
36 
37 #define strcasecmp _stricmp
38 #define strdup _strdup
39 #else
40 #define DIR_SEPARATOR_CHAR '/'
41 #define DIR_SEPARATOR_STRING "/"
42 #endif // _WIN32
43 
45 {
46  LONG size;
47  LONG currentPos = ftell(handle);
48 
49  if (fseek(handle, 0, SEEK_END) != 0)
50  return (LONG)-1;
51 
52  size = ftell(handle);
53  fseek(handle, 0, SEEK_SET);
54  return size;
55 }
56 
57 /* Debugging */
58 
59 #define NORMAL_MASK 0x000000FF
60 #define SPECIAL_MASK 0xFFFFFF00
61 #define MIN_TRACE 0x00000001
62 #define MID_TRACE 0x00000002
63 #define MAX_TRACE 0x00000003
64 
65 #define DEBUG_MEMORY 0x00000100
66 
67 #if DBG
68 
69 extern ULONG DebugTraceLevel;
70 
71 #undef DPRINT
72 #define DPRINT(_t_, _x_) \
73  if ((_t_ > NORMAL_MASK) \
74  ? (DebugTraceLevel & _t_) > NORMAL_MASK \
75  : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
76  printf("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
77  printf _x_ ; \
78  }
79 
80 #undef ASSERT
81 #define ASSERT(_b_) { \
82  if (!(_b_)) { \
83  printf("(%s:%d)(%s) ASSERTION: ", __FILE__, __LINE__, __FUNCTION__); \
84  printf(#_b_); \
85  exit(0); \
86  } \
87 }
88 
89 #else /* DBG */
90 
91 #undef DPRINT
92 #define DPRINT(_t_, _x_) do { } while(0)
93 
94 #undef ASSERT
95 #define ASSERT(_x_)
96 
97 #endif /* DBG */
98 
99 
100 /* Cabinet constants */
101 
102 #define CAB_SIGNATURE 0x4643534D // "MSCF"
103 #define CAB_VERSION 0x0103
104 #define CAB_BLOCKSIZE 32768
105 
106 #define CAB_COMP_MASK 0x00FF
107 #define CAB_COMP_NONE 0x0000
108 #define CAB_COMP_MSZIP 0x0001
109 #define CAB_COMP_QUANTUM 0x0002
110 #define CAB_COMP_LZX 0x0003
111 
112 #define CAB_FLAG_HASPREV 0x0001
113 #define CAB_FLAG_HASNEXT 0x0002
114 #define CAB_FLAG_RESERVE 0x0004
115 
116 #define CAB_ATTRIB_READONLY 0x0001
117 #define CAB_ATTRIB_HIDDEN 0x0002
118 #define CAB_ATTRIB_SYSTEM 0x0004
119 #define CAB_ATTRIB_VOLUME 0x0008
120 #define CAB_ATTRIB_DIRECTORY 0x0010
121 #define CAB_ATTRIB_ARCHIVE 0x0020
122 #define CAB_ATTRIB_EXECUTE 0x0040
123 #define CAB_ATTRIB_UTF_NAME 0x0080
124 
125 #define CAB_FILE_MAX_FOLDER 0xFFFC
126 #define CAB_FILE_CONTINUED 0xFFFD
127 #define CAB_FILE_SPLIT 0xFFFE
128 #define CAB_FILE_PREV_NEXT 0xFFFF
129 
130 
131 /* Cabinet structures */
132 
133 typedef struct _CFHEADER
134 {
135  ULONG Signature; // File signature 'MSCF' (CAB_SIGNATURE)
136  ULONG Reserved1; // Reserved field
137  ULONG CabinetSize; // Cabinet file size
138  ULONG Reserved2; // Reserved field
139  ULONG FileTableOffset; // Offset of first CFFILE
140  ULONG Reserved3; // Reserved field
141  USHORT Version; // Cabinet version (CAB_VERSION)
142  USHORT FolderCount; // Number of folders
143  USHORT FileCount; // Number of files
144  USHORT Flags; // Cabinet flags (CAB_FLAG_*)
145  USHORT SetID; // Cabinet set id
146  USHORT CabinetNumber; // Zero-based cabinet number
147 /* Optional fields (depends on Flags)
148  USHORT CabinetResSize // Per-cabinet reserved area size
149  char FolderResSize // Per-folder reserved area size
150  char FileResSize // Per-file reserved area size
151  char CabinetReserved[] // Per-cabinet reserved area
152  char CabinetPrev[] // Name of previous cabinet file
153  char DiskPrev[] // Name of previous disk
154  char CabinetNext[] // Name of next cabinet file
155  char DiskNext[] // Name of next disk
156  */
157 } CFHEADER, *PCFHEADER;
158 
159 
160 typedef struct _CFFOLDER
161 {
162  ULONG DataOffset; // Absolute offset of first CFDATA block in this folder
163  USHORT DataBlockCount; // Number of CFDATA blocks in this folder in this cabinet
164  USHORT CompressionType; // Type of compression used for all CFDATA blocks in this folder
165 /* Optional fields (depends on Flags)
166  char FolderReserved[] // Per-folder reserved area
167  */
168 } CFFOLDER, *PCFFOLDER;
169 
170 
171 typedef struct _CFFILE
172 {
173  ULONG FileSize; // Uncompressed file size in bytes
174  ULONG FileOffset; // Uncompressed offset of file in the folder
175  USHORT FileControlID; // File control ID (CAB_FILE_*)
176  USHORT FileDate; // File date stamp, as used by DOS
177  USHORT FileTime; // File time stamp, as used by DOS
178  USHORT Attributes; // File attributes (CAB_ATTRIB_*)
179  /* After this is the NULL terminated filename */
180 } CFFILE, *PCFFILE;
181 
182 
183 typedef struct _CFDATA
184 {
185  ULONG Checksum; // Checksum of CFDATA entry
186  USHORT CompSize; // Number of compressed bytes in this block
187  USHORT UncompSize; // Number of uncompressed bytes in this block
188 /* Optional fields (depends on Flags)
189  char DataReserved[] // Per-datablock reserved area
190  */
191 } CFDATA, *PCFDATA;
192 
193 typedef struct _CFDATA_NODE
194 {
197  ULONG ScratchFilePosition; // Absolute offset in scratch file
198  ULONG AbsoluteOffset; // Absolute offset in cabinet
199  ULONG UncompOffset; // Uncompressed offset in folder
202 
203 typedef struct _CFFOLDER_NODE
204 {
207  ULONG UncompOffset; // File size accumulator
209  ULONG TotalFolderSize; // Total size of folder in current disk
213  bool Commit; // true if the folder should be committed
214  bool Delete; // true if marked for deletion
217 
218 typedef struct _CFFILE_NODE
219 {
223  char* FileName;
224  PCFDATA_NODE DataBlock; // First data block of file. NULL if not known
225  bool Commit; // true if the file data should be committed
226  bool Delete; // true if marked for deletion
227  PCFFOLDER_NODE FolderNode; // Folder this file belong to
229 
230 typedef struct _SEARCH_CRITERIA
231 {
232  struct _SEARCH_CRITERIA *Next; // Pointer to next search criteria
233  struct _SEARCH_CRITERIA *Prev; // Pointer to previous search criteria
234  char* Search; // The actual search criteria
236 
237 typedef struct _CAB_SEARCH
238 {
239  PCFFILE_NODE Next; // Pointer to next node
240  PCFFILE File; // Pointer to current CFFILE
241  char* FileName; // Current filename
243 
244 
245 /* Constants */
246 
247 /* Status codes */
248 #define CAB_STATUS_SUCCESS 0x00000000
249 #define CAB_STATUS_FAILURE 0x00000001
250 #define CAB_STATUS_NOMEMORY 0x00000002
251 #define CAB_STATUS_CANNOT_OPEN 0x00000003
252 #define CAB_STATUS_CANNOT_CREATE 0x00000004
253 #define CAB_STATUS_CANNOT_READ 0x00000005
254 #define CAB_STATUS_CANNOT_WRITE 0x00000006
255 #define CAB_STATUS_FILE_EXISTS 0x00000007
256 #define CAB_STATUS_INVALID_CAB 0x00000008
257 #define CAB_STATUS_NOFILE 0x00000009
258 #define CAB_STATUS_UNSUPPCOMP 0x0000000A
259 
260 
261 
262 /* Codecs */
263 
265 {
266 public:
267  /* Default constructor */
268  CCABCodec() {};
269  /* Default destructor */
270  virtual ~CCABCodec() {};
271  /* Compresses a data block */
272  virtual ULONG Compress(void* OutputBuffer,
273  void* InputBuffer,
274  ULONG InputLength,
275  PULONG OutputLength) = 0;
276  /* Uncompresses a data block */
277  virtual ULONG Uncompress(void* OutputBuffer,
278  void* InputBuffer,
279  ULONG InputLength,
280  PULONG OutputLength) = 0;
281 };
282 
283 
284 /* Codec status codes */
285 #define CS_SUCCESS 0x0000 /* All data consumed */
286 #define CS_NOMEMORY 0x0001 /* Not enough free memory */
287 #define CS_BADSTREAM 0x0002 /* Bad data stream */
288 
289 
290 /* Codec indentifiers */
291 #define CAB_CODEC_RAW 0x00
292 #define CAB_CODEC_LZX 0x01
293 #define CAB_CODEC_MSZIP 0x02
294 
295 
296 
297 /* Classes */
298 
299 #ifndef CAB_READ_ONLY
300 
302 {
303 public:
304  /* Default constructor */
305  CCFDATAStorage();
306  /* Default destructor */
307  virtual ~CCFDATAStorage();
308  ULONG Create();
309  ULONG Destroy();
310  ULONG Truncate();
311  ULONG Position();
315 private:
318 };
319 
320 #endif /* CAB_READ_ONLY */
321 
322 class CCabinet
323 {
324 public:
325  /* Default constructor */
326  CCabinet();
327  /* Default destructor */
328  virtual ~CCabinet();
329  /* Determines if a character is a separator */
330  bool IsSeparator(char Char);
331  /* Replaces \ or / with the one used be the host environment */
332  char* ConvertPath(char* Path, bool Allocate);
333  /* Returns a pointer to the filename part of a fully qualified filename */
334  char* GetFileName(char* Path);
335  /* Removes a filename from a fully qualified filename */
336  void RemoveFileName(char* Path);
337  /* Normalizes a path */
338  bool NormalizePath(char* Path, ULONG Length);
339  /* Returns name of cabinet file */
340  char* GetCabinetName();
341  /* Sets the name of the cabinet file */
342  void SetCabinetName(char* FileName);
343  /* Sets destination path for extracted files */
344  void SetDestinationPath(char* DestinationPath);
345  /* Sets cabinet reserved file */
346  bool SetCabinetReservedFile(char* FileName);
347  /* Returns cabinet reserved file */
348  char* GetCabinetReservedFile();
349  /* Returns destination path */
350  char* GetDestinationPath();
351  /* Returns zero-based current disk number */
353  /* Opens the current cabinet file */
354  ULONG Open();
355  /* Closes the current open cabinet file */
356  void Close();
357  /* Locates the first file in the current cabinet file that matches a search criteria */
358  ULONG FindFirst(PCAB_SEARCH Search);
359  /* Locates the next file in the current cabinet file */
360  ULONG FindNext(PCAB_SEARCH Search);
361  /* Extracts a file from the current cabinet file */
362  ULONG ExtractFile(char* FileName);
363  /* Select codec engine to use */
364  void SelectCodec(LONG Id);
365  /* Returns whether a codec engine is selected */
366  bool IsCodecSelected();
367  /* Adds a search criteria for adding files to a simple cabinet, displaying files in a cabinet or extracting them */
368  ULONG AddSearchCriteria(char* SearchCriteria);
369  /* Destroys the search criteria list */
370  void DestroySearchCriteria();
371  /* Returns whether we have search criteria */
372  bool HasSearchCriteria();
373 
374 #ifndef CAB_READ_ONLY
375  /* Creates a simple cabinet based on the search criteria data */
376  bool CreateSimpleCabinet();
377  /* Sets the codec to use for compression (based on a string value) */
378  bool SetCompressionCodec(char* CodecName);
379  /* Creates a new cabinet file */
380  ULONG NewCabinet();
381  /* Forces a new disk to be created */
382  ULONG NewDisk();
383  /* Forces a new folder to be created */
384  ULONG NewFolder();
385  /* Writes a file to scratch storage */
387  /* Forces the current disk to be written */
388  ULONG WriteDisk(ULONG MoreDisks);
389  /* Commits the current disk */
390  ULONG CommitDisk(ULONG MoreDisks);
391  /* Closes the current disk */
392  ULONG CloseDisk();
393  /* Closes the current cabinet */
395  /* Adds a file to the current disk */
396  ULONG AddFile(char* FileName);
397  /* Sets the maximum size of the current disk */
398  void SetMaxDiskSize(ULONG Size);
399 #endif /* CAB_READ_ONLY */
400 
401  /* Default event handlers */
402 
403  /* Handler called when a file is about to be overridden */
404  virtual bool OnOverwrite(PCFFILE Entry, char* FileName);
405  /* Handler called when a file is about to be extracted */
406  virtual void OnExtract(PCFFILE Entry, char* FileName);
407  /* Handler called when a new disk is to be processed */
408  virtual void OnDiskChange(char* CabinetName, char* DiskLabel);
409 #ifndef CAB_READ_ONLY
410  /* Handler called when a file is about to be added */
411  virtual void OnAdd(PCFFILE Entry, char* FileName);
412  /* Handler called when a cabinet need a name */
413  virtual bool OnCabinetName(ULONG Number, char* Name);
414  /* Handler called when a disk needs a label */
415  virtual bool OnDiskLabel(ULONG Number, char* Label);
416 #endif /* CAB_READ_ONLY */
417 private:
421  ULONG ReadString(char* String, LONG MaxLength);
423  ULONG ReadDataBlocks(PCFFOLDER_NODE FolderNode);
427  void DestroyDataNodes(PCFFOLDER_NODE FolderNode);
428  void DestroyFileNodes();
430  void DestroyFolderNodes();
432  ULONG ComputeChecksum(void* Buffer, ULONG Size, ULONG Seed);
434  bool MatchFileNamePattern(char* FileName, char* Pattern);
435 #ifndef CAB_READ_ONLY
437  ULONG WriteCabinetHeader(bool MoreDisks);
445 #if !defined(_WIN32)
446  void ConvertDateAndTime(time_t* Time, PUSHORT DosDate, PUSHORT DosTime);
447 #endif
448 #endif /* CAB_READ_ONLY */
449  ULONG CurrentDiskNumber; // Zero based disk number
450  char CabinetName[256]; // Filename of current cabinet
451  char CabinetPrev[256]; // Filename of previous cabinet
452  char DiskPrev[256]; // Label of cabinet in file CabinetPrev
453  char CabinetNext[256]; // Filename of next cabinet
454  char DiskNext[256]; // Label of cabinet in file CabinetNext
455  ULONG TotalHeaderSize; // Size of header and optional fields
456  ULONG NextFieldsSize; // Size of next cabinet name and next disk label
457  ULONG TotalFolderSize; // Size of all folder entries
458  ULONG TotalFileSize; // Size of all file entries
459  ULONG FolderUncompSize; // Uncompressed size of folder
460  ULONG BytesLeftInBlock; // Number of bytes left in current block
467  bool FileOpen;
483  void* InputBuffer;
484  void* CurrentIBuffer; // Current offset in input buffer
485  ULONG CurrentIBufferSize; // Bytes left in input buffer
487  ULONG TotalCompSize; // Total size of current CFDATA block
488  void* CurrentOBuffer; // Current offset in output buffer
489  ULONG CurrentOBufferSize; // Bytes left in output buffer
492  ULONG LastFileOffset; // Uncompressed offset of last extracted file
493 #ifndef CAB_READ_ONLY
494  ULONG LastBlockStart; // Uncompressed offset of last block in folder
497  ULONG PrevCabinetNumber; // Previous cabinet number (where split file starts)
500 
505  bool BlockIsSplit; // true if current data block is split
506  ULONG NextFolderNumber; // Zero based folder number
507 #endif /* CAB_READ_ONLY */
508 };
509 
510 /* EOF */
PCFDATA_NODE DataListTail
Definition: cabinet.h:211
void SetDestinationPath(char *DestinationPath)
Definition: cabinet.cxx:272
struct _CFFOLDER_NODE CFFOLDER_NODE
PCFFILE_NODE FileListTail
Definition: cabinet.h:477
ULONG DataReserved
Definition: cabinet.h:471
struct _CFFOLDER * PCFFOLDER
Definition: cabinet.h:13
ULONG LocateFile(char *FileName, PCFFILE_NODE *File)
Definition: cabinet.cxx:2002
ULONG FindFirst(PCAB_SEARCH Search)
Definition: cabinet.cxx:638
void DestroyDataNodes(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2318
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
struct _CFFOLDER_NODE * Prev
Definition: cabinet.h:206
ULONG LastFileOffset
Definition: cabinet.h:492
virtual void OnAdd(PCFFILE Entry, char *FileName)
Definition: cabinet.cxx:1888
bool ContinueFile
Definition: cabinet.h:503
FILE * FileHandle
Definition: cabinet.h:466
USHORT FileDate
Definition: cabinet.c:119
ULONG Index
Definition: cabinet.h:212
PSEARCH_CRITERIA CriteriaListHead
Definition: cabinet.h:478
struct _CFHEADER * PCFHEADER
Definition: cabinet.h:12
ULONG BytesLeftInCabinet
Definition: cabinet.h:490
ULONG AddFile(char *FileName)
Definition: cabinet.cxx:1613
char * GetCabinetName()
Definition: cabinet.cxx:250
ULONG CloseCabinet()
Definition: cabinet.cxx:1575
ULONG NewCabinet()
Definition: cabinet.cxx:1148
CFFILE File
Definition: cabinet.h:222
ULONG ScratchFilePosition
Definition: cabinet.h:197
PCFDATA_NODE DataListHead
Definition: cabinet.h:210
char CabinetReservedFile[PATH_MAX]
Definition: cabinet.h:463
ULONG DiskSize
Definition: cabinet.h:496
ULONG GetAttributesOnFile(PCFFILE_NODE File)
Definition: cabinet.cxx:3141
ULONG WriteFileToScratchStorage(PCFFILE_NODE FileNode)
Definition: cabinet.cxx:1288
PCFFOLDER_NODE FolderListHead
Definition: cabinet.h:472
#define PATH_MAX
Definition: cabinet.h:30
virtual ~CCabinet()
Definition: cabinet.cxx:111
ULONG WriteCabinetHeader(bool MoreDisks)
Definition: cabinet.cxx:2693
virtual ULONG Compress(void *OutputBuffer, void *InputBuffer, ULONG InputLength, PULONG OutputLength)=0
ULONG Seek(LONG Position)
CCABCodec * Codec
Definition: cabinet.h:480
CFFOLDER Folder
Definition: cabinet.h:215
virtual void OnExtract(PCFFILE Entry, char *FileName)
Definition: cabinet.cxx:1862
struct _CAB_SEARCH * PCAB_SEARCH
USHORT Version
Definition: cabinet.c:86
virtual ~CCFDATAStorage()
virtual ~CCABCodec()
Definition: cabinet.h:270
ULONG SetAttributesOnFile(char *FileName, USHORT FileAttributes)
Definition: cabinet.cxx:3195
ULONG NextFieldsSize
Definition: cabinet.h:456
bool IsCodecSelected()
Definition: cabinet.cxx:1099
struct _CFFILE_NODE * Next
Definition: cabinet.h:220
PCFFOLDER_NODE LocateFolderNode(ULONG Index)
Definition: cabinet.cxx:1929
USHORT FileTime
Definition: cabinet.c:120
struct _CFFOLDER_NODE * Next
Definition: cabinet.h:205
ULONG Reserved3
Definition: cabinet.c:85
static WCHAR String[]
Definition: stringtable.c:55
PCFFOLDER_NODE FolderListTail
Definition: cabinet.h:473
char * GetCabinetReservedFile()
Definition: cabinet.cxx:449
bool CreateNewFolder
Definition: cabinet.h:499
bool SetCompressionCodec(char *CodecName)
Definition: cabinet.cxx:361
ULONG ComputeChecksum(void *Buffer, ULONG Size, ULONG Seed)
Definition: cabinet.cxx:2472
ULONG Signature
Definition: cabinet.c:80
struct _CFDATA * PCFDATA
Definition: cabinet.h:15
void * OutputBuffer
Definition: cabinet.h:486
PCFFOLDER_NODE FolderNode
Definition: cabinet.h:227
CFDATA Data
Definition: cabinet.h:200
bool ReuseBlock
Definition: cabinet.h:461
_In_opt_ PALLOCATE_FUNCTION Allocate
Definition: exfuncs.h:814
struct _CFHEADER CFHEADER
PCFDATA_NODE CurrentDataNode
Definition: cabinet.h:475
CHAR InputBuffer[80]
Definition: conmgr.c:33
DWORD Id
ULONG MaxDiskSize
Definition: cabinet.h:495
ULONG CurrentOBufferSize
Definition: cabinet.h:489
struct _CFFOLDER CFFOLDER
void DestroyFolderNodes()
Definition: cabinet.cxx:2408
ULONG LastBlockStart
Definition: cabinet.h:494
char * FileName
Definition: cabinet.h:223
PCFDATA_NODE NewDataNode(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2288
bool SetCabinetReservedFile(char *FileName)
Definition: cabinet.cxx:392
ULONG ReadFileTable()
Definition: cabinet.cxx:2102
ULONG GetFileTimes(FILE *FileHandle, PCFFILE_NODE File)
Definition: cabinet.cxx:3099
USHORT Attributes
Definition: cabinet.c:121
PCFFILE_NODE Next
Definition: cabinet.h:239
ULONG Checksum
Definition: cabinet.c:128
long LONG
Definition: pedump.c:60
char * GetFileName(char *Path)
Definition: cabinet.cxx:183
bool CodecSelected
Definition: cabinet.h:482
Definition: fci.c:82
FILE * FileHandle
Definition: cabinet.h:317
void RemoveFileName(char *Path)
Definition: cabinet.cxx:204
struct _SEARCH_CRITERIA * Next
Definition: cabinet.h:232
USHORT FileCount
Definition: cabinet.c:88
CCFDATAStorage * ScratchFile
Definition: cabinet.h:501
ULONG Open()
Definition: cabinet.cxx:471
void SetMaxDiskSize(ULONG Size)
Definition: cabinet.cxx:1832
virtual bool OnDiskLabel(ULONG Number, char *Label)
Definition: cabinet.cxx:1900
ULONG CommitDisk(ULONG MoreDisks)
Definition: cabinet.cxx:1488
Definition: fci.c:101
USHORT CompSize
Definition: cabinet.c:129
char DiskPrev[256]
Definition: cabinet.h:452
struct _SEARCH_CRITERIA * PSEARCH_CRITERIA
struct _CFDATA_NODE * Prev
Definition: cabinet.h:196
ULONG CabinetReserved
Definition: cabinet.h:469
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
char DiskNext[256]
Definition: cabinet.h:454
bool Commit
Definition: cabinet.h:225
PCFDATA_NODE DataBlock
Definition: cabinet.h:224
char CabinetPrev[256]
Definition: cabinet.h:451
PCFFOLDER_NODE NewFolderNode()
Definition: cabinet.cxx:2228
struct _CAB_SEARCH CAB_SEARCH
FILE * SourceFile
Definition: cabinet.h:502
Definition: bufpool.h:45
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG FileAttributes
Definition: fltkernel.h:1230
USHORT FolderCount
Definition: cabinet.c:87
struct _CFFILE_NODE CFFILE_NODE
USHORT CabinetNumber
Definition: cabinet.c:91
ULONG DebugTraceLevel
Definition: ndis.c:13
struct _CFFILE_NODE * PCFFILE_NODE
#define SEEK_SET
Definition: jmemansi.c:26
char * Search
Definition: cabinet.h:234
GLsizeiptr size
Definition: glext.h:5919
struct _CFDATA CFDATA
ULONG ReadBlock(PCFDATA Data, void *Buffer, PULONG BytesRead)
LONG CodecId
Definition: cabinet.h:481
void * InputBuffer
Definition: cabinet.h:483
struct _CFFOLDER_NODE * PCFFOLDER_NODE
ULONG ReadBlock(void *Buffer, ULONG Size, PULONG BytesRead)
Definition: cabinet.cxx:2531
ULONG WriteFolderEntries()
Definition: cabinet.cxx:2834
struct _SEARCH_CRITERIA SEARCH_CRITERIA
void DestroySearchCriteria()
Definition: cabinet.cxx:327
bool FileOpen
Definition: cabinet.h:467
static const UCHAR Index[8]
Definition: usbohci.c:18
struct _CFFILE * PCFFILE
Definition: cabinet.h:14
void ConvertDateAndTime(time_t *Time, PUSHORT DosDate, PUSHORT DosTime)
Definition: cabinet.cxx:3067
void DestroyDeletedFolderNodes()
Definition: cabinet.cxx:2429
Definition: fci.c:89
bool BlockIsSplit
Definition: cabinet.h:505
ULONG BytesLeftInBlock
Definition: cabinet.h:460
ULONG UncompOffset
Definition: cabinet.h:207
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ULONG AddSearchCriteria(char *SearchCriteria)
Definition: cabinet.cxx:285
ULONG NewFolder()
Definition: cabinet.cxx:1243
ULONG FolderUncompSize
Definition: cabinet.h:459
USHORT CompressionType
Definition: cabinet.c:108
USHORT SetID
Definition: cabinet.c:90
char CabinetNext[256]
Definition: cabinet.h:453
ULONG ReadDataBlocks(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2163
ULONG ExtractFile(char *FileName)
Definition: cabinet.cxx:739
ULONG FindNext(PCAB_SEARCH Search)
Definition: cabinet.cxx:653
void DestroyDeletedFileNodes()
Definition: cabinet.cxx:2362
void SelectCodec(LONG Id)
Definition: cabinet.cxx:1109
ULONG Reserved1
Definition: cabinet.c:81
ULONG TotalBytesLeft
Definition: cabinet.h:504
ULONG CurrentIBufferSize
Definition: cabinet.h:485
char FullName[PATH_MAX]
Definition: cabinet.h:316
USHORT DataBlockCount
Definition: cabinet.c:107
ULONG TotalFolderSize
Definition: cabinet.h:457
ULONG AbsoluteOffset
Definition: cabinet.h:208
ULONG ReadString(char *String, LONG MaxLength)
Definition: cabinet.cxx:2047
ULONG FileOffset
Definition: cabinet.c:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
USHORT Flags
Definition: cabinet.c:89
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
ULONG WriteFileEntries()
Definition: cabinet.cxx:2866
ULONG FolderReserved
Definition: cabinet.h:470
struct _SEARCH_CRITERIA * Prev
Definition: cabinet.h:233
char * GetDestinationPath()
Definition: cabinet.cxx:381
ULONG AbsoluteOffset
Definition: cabinet.h:198
void DestroyFileNodes()
Definition: cabinet.cxx:2340
void * CurrentOBuffer
Definition: cabinet.h:488
void * CurrentIBuffer
Definition: cabinet.h:484
CCABCodec()
Definition: cabinet.h:268
bool RestartSearch
Definition: cabinet.h:491
ULONG NextFolderNumber
Definition: cabinet.h:506
ULONG TotalCompSize
Definition: cabinet.h:487
char DestPath[PATH_MAX]
Definition: cabinet.h:462
PRTL_UNICODE_STRING_BUFFER Path
ULONG CurrentDiskNumber
Definition: cabinet.h:449
ULONG CabinetReservedFileSize
Definition: cabinet.h:465
bool Delete
Definition: cabinet.h:226
char CabinetName[256]
Definition: cabinet.h:450
bool HasSearchCriteria()
Definition: cabinet.cxx:351
__kernel_time_t time_t
Definition: linux.h:252
unsigned short USHORT
Definition: pedump.c:61
char * FileName
Definition: cabinet.h:241
ULONG UncompOffset
Definition: cabinet.h:199
ULONG CabinetSize
Definition: cabinet.c:82
PCFFILE_NODE FileListHead
Definition: cabinet.h:476
unsigned int * PULONG
Definition: retypes.h:1
ULONG WriteBlock(PCFDATA Data, void *Buffer, PULONG BytesWritten)
ULONG PrevCabinetNumber
Definition: cabinet.h:497
ULONG GetAbsoluteOffset(PCFFILE_NODE File)
Definition: cabinet.cxx:1961
struct _CFFILE CFFILE
ULONG NewDisk()
Definition: cabinet.cxx:1219
Definition: fci.c:65
USHORT UncompSize
Definition: cabinet.c:130
bool NormalizePath(char *Path, ULONG Length)
Definition: cabinet.cxx:225
PCFFILE_NODE NewFileNode()
Definition: cabinet.cxx:2258
PCFFOLDER_NODE CurrentFolderNode
Definition: cabinet.h:474
char * ConvertPath(char *Path, bool Allocate)
Definition: cabinet.cxx:142
PCFFILE File
Definition: cabinet.h:79
virtual bool OnOverwrite(PCFFILE Entry, char *FileName)
Definition: cabinet.cxx:1847
virtual ULONG Uncompress(void *OutputBuffer, void *InputBuffer, ULONG InputLength, PULONG OutputLength)=0
bool CreateSimpleCabinet()
Definition: cabinet.cxx:1684
void * CabinetReservedFileBuffer
Definition: cabinet.h:464
bool IsSeparator(char Char)
Definition: cabinet.cxx:127
virtual void OnDiskChange(char *CabinetName, char *DiskLabel)
Definition: cabinet.cxx:1874
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
unsigned int ULONG
Definition: retypes.h:1
void Close()
Definition: cabinet.cxx:625
#define SEEK_END
Definition: cabinet.c:27
ULONG TotalFolderSize
Definition: cabinet.h:209
PWCHAR Label
Definition: format.c:70
PSEARCH_CRITERIA CriteriaListTail
Definition: cabinet.h:479
ULONG WriteDataBlock()
Definition: cabinet.cxx:2978
virtual bool OnCabinetName(ULONG Number, char *Name)
Definition: cabinet.cxx:1914
ULONG FileSize
Definition: cabinet.c:116
struct _CFDATA_NODE CFDATA_NODE
Definition: File.h:15
bool CreateNewDisk
Definition: cabinet.h:498
bool MatchFileNamePattern(char *FileName, char *Pattern)
Definition: cabinet.cxx:2551
ULONG FileTableOffset
Definition: cabinet.c:84
ULONG TotalFileSize
Definition: cabinet.h:458
ULONG CloseDisk()
Definition: cabinet.cxx:1557
ULONG GetCurrentDiskNumber()
Definition: cabinet.cxx:460
void SetCabinetName(char *FileName)
Definition: cabinet.cxx:261
ULONG InitCabinetHeader()
Definition: cabinet.cxx:2614
struct _CFFILE_NODE * Prev
Definition: cabinet.h:221
struct _CFDATA_NODE * PCFDATA_NODE
unsigned short * PUSHORT
Definition: retypes.h:2
static PLARGE_INTEGER Time
Definition: time.c:105
base of all file and directory entries
Definition: entries.h:82
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
CFHEADER CABHeader
Definition: cabinet.h:468
LONG GetSizeOfFile(FILE *handle)
Definition: cabinet.h:44
ULONG WriteDisk(ULONG MoreDisks)
Definition: cabinet.cxx:1402
ULONG TotalHeaderSize
Definition: cabinet.h:455
struct _CFDATA_NODE * Next
Definition: cabinet.h:195
ULONG CommitDataBlocks(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2926
CCabinet()
Definition: cabinet.cxx:70
ULONG Reserved2
Definition: cabinet.c:83
ULONG DataOffset
Definition: cabinet.c:106
USHORT FileControlID
Definition: blue.h:90