ReactOS 0.4.15-dev-7788-g1ad9096
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#include <string>
29#include <list>
30
31#ifndef PATH_MAX
32#define PATH_MAX MAX_PATH
33#endif
34
35#if !defined(C_ASSERT)
36#define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
37#endif
38
39#if defined(_WIN32)
40#define DIR_SEPARATOR_CHAR '\\'
41#define DIR_SEPARATOR_STRING "\\"
42
43#define strcasecmp _stricmp
44#define strdup _strdup
45#else
46#define DIR_SEPARATOR_CHAR '/'
47#define DIR_SEPARATOR_STRING "/"
48#endif // _WIN32
49
51{
52 LONG size;
53 LONG currentPos = ftell(handle);
54
55 if (fseek(handle, 0, SEEK_END) != 0)
56 return (LONG)-1;
57
58 size = ftell(handle);
60 return size;
61}
62
63/* Debugging */
64
65#define NORMAL_MASK 0x000000FF
66#define SPECIAL_MASK 0xFFFFFF00
67#define MIN_TRACE 0x00000001
68#define MID_TRACE 0x00000002
69#define MAX_TRACE 0x00000003
70
71#define DEBUG_MEMORY 0x00000100
72
73#if DBG
74
76
77#undef DPRINT
78#define DPRINT(_t_, _x_) \
79 if ((_t_ > NORMAL_MASK) \
80 ? (DebugTraceLevel & _t_) > NORMAL_MASK \
81 : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
82 printf("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
83 printf _x_ ; \
84 }
85
86#undef ASSERT
87#define ASSERT(_b_) { \
88 if (!(_b_)) { \
89 printf("(%s:%d)(%s) ASSERTION: ", __FILE__, __LINE__, __FUNCTION__); \
90 printf(#_b_); \
91 exit(0); \
92 } \
93}
94
95#else /* DBG */
96
97#undef DPRINT
98#define DPRINT(_t_, _x_) do { } while(0)
99
100#undef ASSERT
101#define ASSERT(_x_)
102
103#endif /* DBG */
104
105
106/* Cabinet constants */
107
108#define CAB_SIGNATURE 0x4643534D // "MSCF"
109#define CAB_VERSION 0x0103
110#define CAB_BLOCKSIZE 32768
111
112#define CAB_COMP_MASK 0x00FF
113#define CAB_COMP_NONE 0x0000
114#define CAB_COMP_MSZIP 0x0001
115#define CAB_COMP_QUANTUM 0x0002
116#define CAB_COMP_LZX 0x0003
117
118#define CAB_FLAG_HASPREV 0x0001
119#define CAB_FLAG_HASNEXT 0x0002
120#define CAB_FLAG_RESERVE 0x0004
121
122#define CAB_ATTRIB_READONLY 0x0001
123#define CAB_ATTRIB_HIDDEN 0x0002
124#define CAB_ATTRIB_SYSTEM 0x0004
125#define CAB_ATTRIB_VOLUME 0x0008
126#define CAB_ATTRIB_DIRECTORY 0x0010
127#define CAB_ATTRIB_ARCHIVE 0x0020
128#define CAB_ATTRIB_EXECUTE 0x0040
129#define CAB_ATTRIB_UTF_NAME 0x0080
130
131#define CAB_FILE_MAX_FOLDER 0xFFFC
132#define CAB_FILE_CONTINUED 0xFFFD
133#define CAB_FILE_SPLIT 0xFFFE
134#define CAB_FILE_PREV_NEXT 0xFFFF
135
136
137/* Cabinet structures */
138
139typedef struct _CFHEADER
140{
141 ULONG Signature; // File signature 'MSCF' (CAB_SIGNATURE)
142 ULONG Reserved1; // Reserved field
143 ULONG CabinetSize; // Cabinet file size
144 ULONG Reserved2; // Reserved field
145 ULONG FileTableOffset; // Offset of first CFFILE
146 ULONG Reserved3; // Reserved field
147 USHORT Version; // Cabinet version (CAB_VERSION)
148 USHORT FolderCount; // Number of folders
149 USHORT FileCount; // Number of files
150 USHORT Flags; // Cabinet flags (CAB_FLAG_*)
151 USHORT SetID; // Cabinet set id
152 USHORT CabinetNumber; // Zero-based cabinet number
153/* Optional fields (depends on Flags)
154 USHORT CabinetResSize // Per-cabinet reserved area size
155 char FolderResSize // Per-folder reserved area size
156 char FileResSize // Per-file reserved area size
157 char CabinetReserved[] // Per-cabinet reserved area
158 char CabinetPrev[] // Name of previous cabinet file
159 char DiskPrev[] // Name of previous disk
160 char CabinetNext[] // Name of next cabinet file
161 char DiskNext[] // Name of next disk
162 */
164
165
166typedef struct _CFFOLDER
167{
168 ULONG DataOffset; // Absolute offset of first CFDATA block in this folder
169 USHORT DataBlockCount; // Number of CFDATA blocks in this folder in this cabinet
170 USHORT CompressionType; // Type of compression used for all CFDATA blocks in this folder
171/* Optional fields (depends on Flags)
172 char FolderReserved[] // Per-folder reserved area
173 */
175
176C_ASSERT(sizeof(CFFOLDER) == 8);
177
178
179typedef struct _CFFILE
180{
181 ULONG FileSize; // Uncompressed file size in bytes
182 ULONG FileOffset; // Uncompressed offset of file in the folder
183 USHORT FileControlID; // File control ID (CAB_FILE_*)
184 USHORT FileDate; // File date stamp, as used by DOS
185 USHORT FileTime; // File time stamp, as used by DOS
186 USHORT Attributes; // File attributes (CAB_ATTRIB_*)
187 /* After this is the NULL terminated filename */
189
190C_ASSERT(sizeof(CFFILE) == 16);
191
192typedef struct _CFDATA
193{
194 ULONG Checksum; // Checksum of CFDATA entry
195 USHORT CompSize; // Number of compressed bytes in this block
196 USHORT UncompSize; // Number of uncompressed bytes in this block
197/* Optional fields (depends on Flags)
198 char DataReserved[] // Per-datablock reserved area
199 */
201
202C_ASSERT(sizeof(CFDATA) == 8);
203
204/* Application structures */
205
206typedef struct _CFDATA_NODE
207{
208 ULONG ScratchFilePosition = 0; // Absolute offset in scratch file
209 ULONG AbsoluteOffset = 0; // Absolute offset in cabinet
210 ULONG UncompOffset = 0; // Uncompressed offset in folder
211 CFDATA Data = { 0 };
213
214typedef struct _CFFOLDER_NODE
215{
216 ULONG UncompOffset = 0; // File size accumulator
218 ULONG TotalFolderSize = 0; // Total size of folder in current disk
219 std::list<PCFDATA_NODE> DataList;
221 bool Commit = false; // true if the folder should be committed
222 bool Delete = false; // true if marked for deletion
225
226typedef struct _CFFILE_NODE
227{
228 CFFILE File = { 0 };
229 std::string FileName;
230 std::string TargetFolder;
231 PCFDATA_NODE DataBlock = nullptr; // First data block of file. NULL if not known
232 bool Commit = false; // true if the file data should be committed
233 bool Delete = false; // true if marked for deletion
234 PCFFOLDER_NODE FolderNode = nullptr; // Folder this file belong to
236
237typedef struct _SEARCH_CRITERIA
238{
239 std::string Search; // The actual search criteria
240 std::string TargetFolder; // The filename will be TargetFolder\file
242
243typedef struct _CAB_SEARCH
244{
245 std::list<PCFFILE_NODE>::iterator Next; // Pointer to next node
246 PCFFILE File = nullptr; // Pointer to current CFFILE
247 std::string FileName; // Current filename
249
250
251/* Constants */
252
253/* Status codes */
254#define CAB_STATUS_SUCCESS 0x00000000
255#define CAB_STATUS_FAILURE 0x00000001
256#define CAB_STATUS_NOMEMORY 0x00000002
257#define CAB_STATUS_CANNOT_OPEN 0x00000003
258#define CAB_STATUS_CANNOT_CREATE 0x00000004
259#define CAB_STATUS_CANNOT_READ 0x00000005
260#define CAB_STATUS_CANNOT_WRITE 0x00000006
261#define CAB_STATUS_FILE_EXISTS 0x00000007
262#define CAB_STATUS_INVALID_CAB 0x00000008
263#define CAB_STATUS_NOFILE 0x00000009
264#define CAB_STATUS_UNSUPPCOMP 0x0000000A
265
266
267
268/* Codecs */
269
271{
272public:
273 /* Default constructor */
275 /* Default destructor */
276 virtual ~CCABCodec() {};
277 /* Compresses a data block */
279 void* InputBuffer,
280 ULONG InputLength,
281 PULONG OutputLength) = 0;
282 /* Uncompresses a data block */
284 void* InputBuffer,
285 ULONG InputLength,
286 PULONG OutputLength) = 0;
287};
288
289
290/* Codec status codes */
291#define CS_SUCCESS 0x0000 /* All data consumed */
292#define CS_NOMEMORY 0x0001 /* Not enough free memory */
293#define CS_BADSTREAM 0x0002 /* Bad data stream */
294
295
296/* Codec indentifiers */
297#define CAB_CODEC_RAW 0x00
298#define CAB_CODEC_LZX 0x01
299#define CAB_CODEC_MSZIP 0x02
300
301
302
303/* Classes */
304
306{
307public:
308 /* Default constructor */
309 CCabinet();
310 /* Default destructor */
311 virtual ~CCabinet();
312 /* Determines if a character is a separator */
313 bool IsSeparator(char Char);
314 /* Replaces \ or / with the one used be the host environment */
315 void ConvertPath(std::string& Path);
316 /* Returns the filename part of a fully qualified filename */
317 std::string GetFileName(const std::string& Path);
318 /* Normalizes a path */
319 void NormalizePath(std::string& Path);
320 /* Returns name of cabinet file */
321 char* GetCabinetName();
322 /* Sets the name of the cabinet file */
323 void SetCabinetName(const char* FileName);
324 /* Sets destination path for extracted files */
325 void SetDestinationPath(const char* DestinationPath);
326 /* Sets cabinet reserved file */
327 bool SetCabinetReservedFile(const char* FileName);
328 /* Returns destination path */
329 const char* GetDestinationPath();
330 /* Returns zero-based current disk number */
332 /* Opens the current cabinet file */
333 ULONG Open();
334 /* Closes the current open cabinet file */
335 void Close();
336 /* Locates the first file in the current cabinet file that matches a search criteria */
338 /* Locates the next file in the current cabinet file */
339 ULONG FindNext(PCAB_SEARCH Search);
340 /* Extracts a file from the current cabinet file */
341 ULONG ExtractFile(const char* FileName);
342 /* Select codec engine to use */
343 void SelectCodec(LONG Id);
344 /* Returns whether a codec engine is selected */
345 bool IsCodecSelected();
346 /* Adds a search criteria for adding files to a simple cabinet, displaying files in a cabinet or extracting them */
347 ULONG AddSearchCriteria(const std::string& SearchCriteria, const std::string& TargetFolder);
348 /* Destroys the search criteria list */
350 /* Returns whether we have search criteria */
351 bool HasSearchCriteria();
352
354
355#ifndef CAB_READ_ONLY
356 /* Creates a simple cabinet based on the search criteria data */
357 bool CreateSimpleCabinet();
358 /* Sets the codec to use for compression (based on a string value) */
359 bool SetCompressionCodec(const char* CodecName);
360 /* Creates a new cabinet file */
362 /* Forces a new disk to be created */
363 ULONG NewDisk();
364 /* Forces a new folder to be created */
366 /* Writes a file to scratch storage */
368 /* Forces the current disk to be written */
369 ULONG WriteDisk(ULONG MoreDisks);
370 /* Commits the current disk */
371 ULONG CommitDisk(ULONG MoreDisks);
372 /* Closes the current disk */
374 /* Closes the current cabinet */
376 /* Adds a file to the current disk */
377 ULONG AddFile(const std::string& FileName, const std::string& TargetFolder);
378 /* Sets the maximum size of the current disk */
380#endif /* CAB_READ_ONLY */
381
382 /* Default event handlers */
383
384 /* Handler called when a file is about to be overridden */
385 virtual bool OnOverwrite(PCFFILE Entry, const char* FileName);
386 /* Handler called when a file is about to be extracted */
387 virtual void OnExtract(PCFFILE Entry, const char* FileName);
388 /* Handler called when a new disk is to be processed */
389 virtual void OnDiskChange(const char* CabinetName, const char* DiskLabel);
390
391 virtual void OnVerboseMessage(const char* Message);
392#ifndef CAB_READ_ONLY
393 /* Handler called when a file is about to be added */
394 virtual void OnAdd(PCFFILE Entry, const char* FileName);
395 /* Handler called when a cabinet need a name */
396 virtual bool OnCabinetName(ULONG Number, char* Name);
397 /* Handler called when a disk needs a label */
398 virtual bool OnDiskLabel(ULONG Number, char* Label);
399#endif /* CAB_READ_ONLY */
400private:
404 ULONG ReadString(char* String, LONG MaxLength);
410 void DestroyDataNodes(PCFFOLDER_NODE FolderNode);
411 void DestroyFileNodes();
413 void DestroyFolderNodes();
417 bool MatchFileNamePattern(const char* FileName, const char* Pattern);
418#ifndef CAB_READ_ONLY
420 ULONG WriteCabinetHeader(bool MoreDisks);
428#if !defined(_WIN32)
429 void ConvertDateAndTime(time_t* Time, PUSHORT DosDate, PUSHORT DosTime);
430#endif
431#endif /* CAB_READ_ONLY */
432 ULONG CurrentDiskNumber; // Zero based disk number
433 char CabinetName[256]; // Filename of current cabinet
434 char CabinetPrev[256]; // Filename of previous cabinet
435 char DiskPrev[256]; // Label of cabinet in file CabinetPrev
436 char CabinetNext[256]; // Filename of next cabinet
437 char DiskNext[256]; // Label of cabinet in file CabinetNext
438 ULONG TotalHeaderSize; // Size of header and optional fields
439 ULONG NextFieldsSize; // Size of next cabinet name and next disk label
440 ULONG TotalFolderSize; // Size of all folder entries
441 ULONG TotalFileSize; // Size of all file entries
442 ULONG FolderUncompSize; // Uncompressed size of folder
443 ULONG BytesLeftInBlock; // Number of bytes left in current block
445 std::string DestPath;
455 std::list<PCFFOLDER_NODE> FolderList;
458 std::list<PCFFILE_NODE> FileList;
459 std::list<PSEARCH_CRITERIA> CriteriaList;
464 void* CurrentIBuffer; // Current offset in input buffer
465 ULONG CurrentIBufferSize; // Bytes left in input buffer
467 ULONG TotalCompSize; // Total size of current CFDATA block
468 void* CurrentOBuffer; // Current offset in output buffer
469 ULONG CurrentOBufferSize; // Bytes left in output buffer
472 ULONG LastFileOffset; // Uncompressed offset of last extracted file
473#ifndef CAB_READ_ONLY
474 ULONG LastBlockStart; // Uncompressed offset of last block in folder
477 ULONG PrevCabinetNumber; // Previous cabinet number (where split file starts)
480
485 bool BlockIsSplit; // true if current data block is split
486 ULONG NextFolderNumber; // Zero based folder number
487#endif /* CAB_READ_ONLY */
488};
489
490/* EOF */
DWORD Id
PRTL_UNICODE_STRING_BUFFER Path
struct _CFDATA * PCFDATA
Definition: cabinet.h:15
struct _CAB_SEARCH * PCAB_SEARCH
struct _CFHEADER * PCFHEADER
Definition: cabinet.h:12
struct _CAB_SEARCH CAB_SEARCH
struct _CFFILE * PCFFILE
Definition: cabinet.h:14
struct _CFFOLDER * PCFFOLDER
Definition: cabinet.h:13
PWCHAR Label
Definition: format.c:70
#define SEEK_END
Definition: cabinet.c:29
Definition: bufpool.h:45
CCABCodec()
Definition: cabinet.h:274
virtual ~CCABCodec()
Definition: cabinet.h:276
virtual ULONG Compress(void *OutputBuffer, void *InputBuffer, ULONG InputLength, PULONG OutputLength)=0
virtual ULONG Uncompress(void *OutputBuffer, void *InputBuffer, ULONG InputLength, PULONG OutputLength)=0
std::string DestPath
Definition: cabinet.h:445
ULONG ReadFileTable()
Definition: cabinet.cxx:1983
void SetMaxDiskSize(ULONG Size)
Definition: cabinet.cxx:1720
ULONG GetAttributesOnFile(PCFFILE_NODE File)
Definition: cabinet.cxx:2914
void Close()
Definition: cabinet.cxx:538
bool FileOpen
Definition: cabinet.h:450
bool RestartSearch
Definition: cabinet.h:471
ULONG NextFolderNumber
Definition: cabinet.h:486
ULONG AddFile(const std::string &FileName, const std::string &TargetFolder)
Definition: cabinet.cxx:1515
ULONG CurrentIBufferSize
Definition: cabinet.h:465
void NormalizePath(std::string &Path)
Definition: cabinet.cxx:179
bool CreateNewDisk
Definition: cabinet.h:478
void DestroySearchCriteria()
Definition: cabinet.cxx:256
ULONG NewCabinet()
Definition: cabinet.cxx:1057
void SetDestinationPath(const char *DestinationPath)
Definition: cabinet.cxx:216
ULONG FolderUncompSize
Definition: cabinet.h:442
ULONG PrevCabinetNumber
Definition: cabinet.h:477
PCFFOLDER_NODE CurrentFolderNode
Definition: cabinet.h:456
std::string GetFileName(const std::string &Path)
Definition: cabinet.cxx:158
ULONG ComputeChecksum(void *Buffer, ULONG Size, ULONG Seed)
Definition: cabinet.cxx:2263
ULONG BytesLeftInBlock
Definition: cabinet.h:443
void DestroyFileNodes()
Definition: cabinet.cxx:2183
ULONG NextFieldsSize
Definition: cabinet.h:439
ULONG WriteFileEntries()
Definition: cabinet.cxx:2646
void DestroyDeletedFileNodes()
Definition: cabinet.cxx:2196
CFHEADER CABHeader
Definition: cabinet.h:451
ULONG ExtractFile(const char *FileName)
Definition: cabinet.cxx:648
char DiskNext[256]
Definition: cabinet.h:437
bool SetCabinetReservedFile(const char *FileName)
Definition: cabinet.cxx:319
bool CreateNewFolder
Definition: cabinet.h:479
void DestroyFolderNodes()
Definition: cabinet.cxx:2223
ULONG FindFirst(PCAB_SEARCH Search)
Definition: cabinet.cxx:551
void * OutputBuffer
Definition: cabinet.h:466
ULONG CommitDataBlocks(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2703
virtual void OnDiskChange(const char *CabinetName, const char *DiskLabel)
Definition: cabinet.cxx:1762
ULONG TotalFileSize
Definition: cabinet.h:441
void SetCabinetName(const char *FileName)
Definition: cabinet.cxx:205
PCFFILE_NODE NewFileNode()
Definition: cabinet.cxx:2126
PCFFOLDER_NODE NewFolderNode()
Definition: cabinet.cxx:2105
bool ContinueFile
Definition: cabinet.h:483
class CCFDATAStorage * ScratchFile
Definition: cabinet.h:481
ULONG InitCabinetHeader()
Definition: cabinet.cxx:2405
CCabinet()
Definition: cabinet.cxx:71
ULONG NewFolder()
Definition: cabinet.cxx:1152
std::list< PCFFOLDER_NODE > FolderList
Definition: cabinet.h:455
ULONG CurrentDiskNumber
Definition: cabinet.h:432
virtual void OnVerboseMessage(const char *Message)
Definition: cabinet.cxx:1773
void DestroyDeletedFolderNodes()
Definition: cabinet.cxx:2237
PCFDATA_NODE CurrentDataNode
Definition: cabinet.h:457
ULONG TotalHeaderSize
Definition: cabinet.h:438
bool HasSearchCriteria()
Definition: cabinet.cxx:268
bool SetCompressionCodec(const char *CodecName)
Definition: cabinet.cxx:288
bool MatchFileNamePattern(const char *FileName, const char *Pattern)
Definition: cabinet.cxx:2342
ULONG GetFileTimes(FILE *FileHandle, PCFFILE_NODE File)
Definition: cabinet.cxx:2872
bool ReuseBlock
Definition: cabinet.h:444
ULONG TotalCompSize
Definition: cabinet.h:467
bool CodecSelected
Definition: cabinet.h:462
std::list< PCFFILE_NODE > FileList
Definition: cabinet.h:458
virtual bool OnOverwrite(PCFFILE Entry, const char *FileName)
Definition: cabinet.cxx:1735
char DiskPrev[256]
Definition: cabinet.h:435
ULONG CurrentOBufferSize
Definition: cabinet.h:469
char CabinetPrev[256]
Definition: cabinet.h:434
bool IsCodecSelected()
Definition: cabinet.cxx:1008
bool BlockIsSplit
Definition: cabinet.h:485
ULONG TotalFolderSize
Definition: cabinet.h:440
void * CurrentIBuffer
Definition: cabinet.h:464
virtual void OnExtract(PCFFILE Entry, const char *FileName)
Definition: cabinet.cxx:1750
void ConvertDateAndTime(time_t *Time, PUSHORT DosDate, PUSHORT DosTime)
Definition: cabinet.cxx:2840
ULONG DiskSize
Definition: cabinet.h:476
ULONG GetAbsoluteOffset(PCFFILE_NODE File)
Definition: cabinet.cxx:1849
ULONG Open()
Definition: cabinet.cxx:387
PCFFOLDER_NODE LocateFolderNode(ULONG Index)
Definition: cabinet.cxx:1821
void DestroyDataNodes(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2168
void SelectCodec(LONG Id)
Definition: cabinet.cxx:1018
ULONG MaxDiskSize
Definition: cabinet.h:475
ULONG CloseDisk()
Definition: cabinet.cxx:1459
ULONG ReadBlock(void *Buffer, ULONG Size, PULONG BytesRead)
Definition: cabinet.cxx:2322
virtual void OnAdd(PCFFILE Entry, const char *FileName)
Definition: cabinet.cxx:1780
ULONG WriteCabinetHeader(bool MoreDisks)
Definition: cabinet.cxx:2484
void * CabinetReservedFileBuffer
Definition: cabinet.h:447
FILE * FileHandle
Definition: cabinet.h:449
const char * GetDestinationPath()
Definition: cabinet.cxx:308
ULONG FindNext(PCAB_SEARCH Search)
Definition: cabinet.cxx:566
ULONG CloseCabinet()
Definition: cabinet.cxx:1477
virtual ~CCabinet()
Definition: cabinet.cxx:103
ULONG BytesLeftInCabinet
Definition: cabinet.h:470
std::string CreateCabFilename(PCFFILE_NODE Node)
Definition: cabinet.cxx:278
void * CurrentOBuffer
Definition: cabinet.h:468
ULONG CabinetReservedFileSize
Definition: cabinet.h:448
void ConvertPath(std::string &Path)
Definition: cabinet.cxx:134
LONG CodecId
Definition: cabinet.h:461
char CabinetName[256]
Definition: cabinet.h:433
ULONG WriteDataBlock()
Definition: cabinet.cxx:2751
ULONG NewDisk()
Definition: cabinet.cxx:1128
std::list< PSEARCH_CRITERIA > CriteriaList
Definition: cabinet.h:459
ULONG LastFileOffset
Definition: cabinet.h:472
bool IsSeparator(char Char)
Definition: cabinet.cxx:119
ULONG CabinetReserved
Definition: cabinet.h:452
ULONG LastBlockStart
Definition: cabinet.h:474
ULONG CommitDisk(ULONG MoreDisks)
Definition: cabinet.cxx:1393
ULONG DataReserved
Definition: cabinet.h:454
ULONG GetCurrentDiskNumber()
Definition: cabinet.cxx:376
std::string CabinetReservedFile
Definition: cabinet.h:446
ULONG ReadDataBlocks(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2040
CCABCodec * Codec
Definition: cabinet.h:460
ULONG WriteDisk(ULONG MoreDisks)
Definition: cabinet.cxx:1311
ULONG TotalBytesLeft
Definition: cabinet.h:484
ULONG WriteFileToScratchStorage(PCFFILE_NODE FileNode)
Definition: cabinet.cxx:1197
ULONG ReadString(char *String, LONG MaxLength)
Definition: cabinet.cxx:1928
FILE * SourceFile
Definition: cabinet.h:482
PCFDATA_NODE NewDataNode(PCFFOLDER_NODE FolderNode)
Definition: cabinet.cxx:2147
ULONG SetAttributesOnFile(char *FileName, USHORT FileAttributes)
Definition: cabinet.cxx:2968
ULONG AddSearchCriteria(const std::string &SearchCriteria, const std::string &TargetFolder)
Definition: cabinet.cxx:228
virtual bool OnDiskLabel(ULONG Number, char *Label)
Definition: cabinet.cxx:1792
ULONG LocateFile(const char *FileName, PCFFILE_NODE *File)
Definition: cabinet.cxx:1885
char * GetCabinetName()
Definition: cabinet.cxx:194
bool CreateSimpleCabinet()
Definition: cabinet.cxx:1581
void * InputBuffer
Definition: cabinet.h:463
char CabinetNext[256]
Definition: cabinet.h:436
ULONG FolderReserved
Definition: cabinet.h:453
virtual bool OnCabinetName(ULONG Number, char *Name)
Definition: cabinet.cxx:1806
ULONG WriteFolderEntries()
Definition: cabinet.cxx:2618
Definition: File.h:16
static const WCHAR Message[]
Definition: register.c:74
__kernel_time_t time_t
Definition: linux.h:252
ULONG DebugTraceLevel
Definition: ndis.c:13
_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:1236
GLsizeiptr size
Definition: glext.h:5919
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
#define SEEK_SET
Definition: jmemansi.c:26
static PLARGE_INTEGER Time
Definition: time.c:105
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:207
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
struct _CFHEADER CFHEADER
struct _CFDATA_NODE * PCFDATA_NODE
struct _CFFOLDER_NODE CFFOLDER_NODE
struct _CFFOLDER CFFOLDER
struct _CFDATA CFDATA
struct _CFFOLDER_NODE * PCFFOLDER_NODE
#define C_ASSERT(expr)
Definition: cabinet.h:36
struct _SEARCH_CRITERIA * PSEARCH_CRITERIA
struct _CFDATA_NODE CFDATA_NODE
struct _CFFILE_NODE * PCFFILE_NODE
struct _CFFILE CFFILE
LONG GetSizeOfFile(FILE *handle)
Definition: cabinet.h:50
struct _SEARCH_CRITERIA SEARCH_CRITERIA
struct _CFFILE_NODE CFFILE_NODE
Definition: fci.c:101
Definition: fci.c:89
Definition: fci.c:82
base of all file and directory entries
Definition: entries.h:83
std::string FileName
Definition: cabinet.h:247
std::list< PCFFILE_NODE >::iterator Next
Definition: cabinet.h:245
ULONG AbsoluteOffset
Definition: cabinet.h:209
ULONG UncompOffset
Definition: cabinet.h:210
ULONG ScratchFilePosition
Definition: cabinet.h:208
USHORT CompSize
Definition: cabinet.c:131
USHORT UncompSize
Definition: cabinet.c:132
ULONG Checksum
Definition: cabinet.c:130
std::string TargetFolder
Definition: cabinet.h:230
std::string FileName
Definition: cabinet.h:229
bool Delete
Definition: cabinet.h:233
bool Commit
Definition: cabinet.h:232
PCFDATA_NODE DataBlock
Definition: cabinet.h:231
PCFFOLDER_NODE FolderNode
Definition: cabinet.h:234
USHORT FileControlID
Definition: cabinet.h:183
ULONG FileSize
Definition: cabinet.c:118
USHORT FileTime
Definition: cabinet.c:122
ULONG FileOffset
Definition: cabinet.c:119
USHORT FileDate
Definition: cabinet.c:121
USHORT Attributes
Definition: cabinet.c:123
ULONG UncompOffset
Definition: cabinet.h:216
ULONG TotalFolderSize
Definition: cabinet.h:218
std::list< PCFDATA_NODE > DataList
Definition: cabinet.h:219
ULONG AbsoluteOffset
Definition: cabinet.h:217
CFFOLDER Folder
Definition: cabinet.h:223
USHORT DataBlockCount
Definition: cabinet.c:109
USHORT CompressionType
Definition: cabinet.c:110
ULONG DataOffset
Definition: cabinet.c:108
USHORT Version
Definition: cabinet.c:88
USHORT SetID
Definition: cabinet.c:92
ULONG Reserved3
Definition: cabinet.c:87
ULONG Reserved1
Definition: cabinet.c:83
ULONG CabinetSize
Definition: cabinet.c:84
ULONG FileTableOffset
Definition: cabinet.c:86
USHORT FileCount
Definition: cabinet.c:90
USHORT FolderCount
Definition: cabinet.c:89
USHORT Flags
Definition: cabinet.c:91
USHORT CabinetNumber
Definition: cabinet.c:93
ULONG Signature
Definition: cabinet.c:82
ULONG Reserved2
Definition: cabinet.c:85
std::string TargetFolder
Definition: cabinet.h:240
std::string Search
Definition: cabinet.h:239
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
Definition: dlist.c:348
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953