11 #define WIN32_LEAN_AND_MEAN
32#define PATH_MAX MAX_PATH
36#define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
40#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
44#define DIR_SEPARATOR_CHAR '\\'
45#define DIR_SEPARATOR_STRING "\\"
47#define snprintf _snprintf
48#define strcasecmp _stricmp
51#define DIR_SEPARATOR_CHAR '/'
52#define DIR_SEPARATOR_STRING "/"
70#define NORMAL_MASK 0x000000FF
71#define SPECIAL_MASK 0xFFFFFF00
72#define MIN_TRACE 0x00000001
73#define MID_TRACE 0x00000002
74#define MAX_TRACE 0x00000003
76#define DEBUG_MEMORY 0x00000100
83#define DPRINT(_t_, _x_) \
84 if ((_t_ > NORMAL_MASK) \
85 ? (DebugTraceLevel & _t_) > NORMAL_MASK \
86 : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
87 printf("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
92#define ASSERT(_b_) { \
94 printf("(%s:%d)(%s) ASSERTION: ", __FILE__, __LINE__, __FUNCTION__); \
103#define DPRINT(_t_, _x_) do { } while(0)
113#define CAB_SIGNATURE 0x4643534D
114#define CAB_VERSION 0x0103
115#define CAB_BLOCKSIZE 32768
117#define CAB_COMP_MASK 0x00FF
118#define CAB_COMP_NONE 0x0000
119#define CAB_COMP_MSZIP 0x0001
120#define CAB_COMP_QUANTUM 0x0002
121#define CAB_COMP_LZX 0x0003
123#define CAB_FLAG_HASPREV 0x0001
124#define CAB_FLAG_HASNEXT 0x0002
125#define CAB_FLAG_RESERVE 0x0004
127#define CAB_ATTRIB_READONLY 0x0001
128#define CAB_ATTRIB_HIDDEN 0x0002
129#define CAB_ATTRIB_SYSTEM 0x0004
130#define CAB_ATTRIB_VOLUME 0x0008
131#define CAB_ATTRIB_DIRECTORY 0x0010
132#define CAB_ATTRIB_ARCHIVE 0x0020
133#define CAB_ATTRIB_EXECUTE 0x0040
134#define CAB_ATTRIB_UTF_NAME 0x0080
136#define CAB_FILE_MAX_FOLDER 0xFFFC
137#define CAB_FILE_CONTINUED 0xFFFD
138#define CAB_FILE_SPLIT 0xFFFE
139#define CAB_FILE_PREV_NEXT 0xFFFF
250 std::list<PCFFILE_NODE>::iterator
Next;
259#define CAB_STATUS_SUCCESS 0x00000000
260#define CAB_STATUS_FAILURE 0x00000001
261#define CAB_STATUS_NOMEMORY 0x00000002
262#define CAB_STATUS_CANNOT_OPEN 0x00000003
263#define CAB_STATUS_CANNOT_CREATE 0x00000004
264#define CAB_STATUS_CANNOT_READ 0x00000005
265#define CAB_STATUS_CANNOT_WRITE 0x00000006
266#define CAB_STATUS_FILE_EXISTS 0x00000007
267#define CAB_STATUS_INVALID_CAB 0x00000008
268#define CAB_STATUS_NOFILE 0x00000009
269#define CAB_STATUS_UNSUPPCOMP 0x0000000A
296#define CS_SUCCESS 0x0000
297#define CS_NOMEMORY 0x0001
298#define CS_BADSTREAM 0x0002
302#define CAB_CODEC_RAW 0x00
303#define CAB_CODEC_LZX 0x01
304#define CAB_CODEC_MSZIP 0x02
PRTL_UNICODE_STRING_BUFFER Path
struct _CAB_SEARCH * PCAB_SEARCH
struct _CFHEADER * PCFHEADER
struct _CAB_SEARCH CAB_SEARCH
struct _CFFOLDER * PCFFOLDER
virtual ULONG Compress(void *OutputBuffer, void *InputBuffer, ULONG InputLength, PULONG OutputLength)=0
virtual ULONG Uncompress(void *OutputBuffer, void *InputBuffer, ULONG InputLength, PULONG OutputLength)=0
void SetMaxDiskSize(ULONG Size)
ULONG GetAttributesOnFile(PCFFILE_NODE File)
ULONG AddFile(const std::string &FileName, const std::string &TargetFolder)
void NormalizePath(std::string &Path)
void DestroySearchCriteria()
void SetDestinationPath(const char *DestinationPath)
PCFFOLDER_NODE CurrentFolderNode
std::string GetFileName(const std::string &Path)
ULONG ComputeChecksum(void *Buffer, ULONG Size, ULONG Seed)
void DestroyDeletedFileNodes()
ULONG ExtractFile(const char *FileName)
bool SetCabinetReservedFile(const char *FileName)
void DestroyFolderNodes()
ULONG FindFirst(PCAB_SEARCH Search)
ULONG CommitDataBlocks(PCFFOLDER_NODE FolderNode)
virtual void OnDiskChange(const char *CabinetName, const char *DiskLabel)
void SetCabinetName(const char *FileName)
PCFFILE_NODE NewFileNode()
PCFFOLDER_NODE NewFolderNode()
class CCFDATAStorage * ScratchFile
ULONG InitCabinetHeader()
std::list< PCFFOLDER_NODE > FolderList
virtual void OnVerboseMessage(const char *Message)
void DestroyDeletedFolderNodes()
PCFDATA_NODE CurrentDataNode
bool SetCompressionCodec(const char *CodecName)
bool MatchFileNamePattern(const char *FileName, const char *Pattern)
ULONG GetFileTimes(FILE *FileHandle, PCFFILE_NODE File)
std::list< PCFFILE_NODE > FileList
virtual bool OnOverwrite(PCFFILE Entry, const char *FileName)
virtual void OnExtract(PCFFILE Entry, const char *FileName)
void ConvertDateAndTime(time_t *Time, PUSHORT DosDate, PUSHORT DosTime)
ULONG GetAbsoluteOffset(PCFFILE_NODE File)
PCFFOLDER_NODE LocateFolderNode(ULONG Index)
void DestroyDataNodes(PCFFOLDER_NODE FolderNode)
void SelectCodec(LONG Id)
ULONG ReadBlock(void *Buffer, ULONG Size, PULONG BytesRead)
virtual void OnAdd(PCFFILE Entry, const char *FileName)
ULONG WriteCabinetHeader(bool MoreDisks)
void * CabinetReservedFileBuffer
const char * GetDestinationPath()
ULONG FindNext(PCAB_SEARCH Search)
std::string CreateCabFilename(PCFFILE_NODE Node)
ULONG CabinetReservedFileSize
void ConvertPath(std::string &Path)
std::list< PSEARCH_CRITERIA > CriteriaList
bool IsSeparator(char Char)
ULONG CommitDisk(ULONG MoreDisks)
ULONG GetCurrentDiskNumber()
std::string CabinetReservedFile
ULONG ReadDataBlocks(PCFFOLDER_NODE FolderNode)
ULONG WriteDisk(ULONG MoreDisks)
ULONG WriteFileToScratchStorage(PCFFILE_NODE FileNode)
ULONG ReadString(char *String, LONG MaxLength)
PCFDATA_NODE NewDataNode(PCFFOLDER_NODE FolderNode)
ULONG SetAttributesOnFile(char *FileName, USHORT FileAttributes)
ULONG AddSearchCriteria(const std::string &SearchCriteria, const std::string &TargetFolder)
virtual bool OnDiskLabel(ULONG Number, char *Label)
ULONG LocateFile(const char *FileName, PCFFILE_NODE *File)
bool CreateSimpleCabinet()
virtual bool OnCabinetName(ULONG Number, char *Name)
ULONG WriteFolderEntries()
static const WCHAR Message[]
_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
_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)
static PLARGE_INTEGER Time
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
base of all file and directory entries
std::list< PCFFILE_NODE >::iterator Next
ULONG ScratchFilePosition
PCFFOLDER_NODE FolderNode
std::list< PCFDATA_NODE > DataList
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_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
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer