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