Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencabinet.h
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS cabinet manager 00004 * FILE: apps/cabman/cabinet.h 00005 * PURPOSE: Cabinet definitions 00006 */ 00007 #pragma once 00008 00009 #include <string.h> 00010 00011 /* Cabinet constants */ 00012 00013 #define CAB_SIGNATURE 0x4643534D // "MSCF" 00014 #define CAB_VERSION 0x0103 00015 #define CAB_BLOCKSIZE 32768 00016 00017 #define CAB_COMP_MASK 0x00FF 00018 #define CAB_COMP_NONE 0x0000 00019 #define CAB_COMP_MSZIP 0x0001 00020 #define CAB_COMP_QUANTUM 0x0002 00021 #define CAB_COMP_LZX 0x0003 00022 00023 #define CAB_FLAG_HASPREV 0x0001 00024 #define CAB_FLAG_HASNEXT 0x0002 00025 #define CAB_FLAG_RESERVE 0x0004 00026 00027 #define CAB_ATTRIB_READONLY 0x0001 00028 #define CAB_ATTRIB_HIDDEN 0x0002 00029 #define CAB_ATTRIB_SYSTEM 0x0004 00030 #define CAB_ATTRIB_VOLUME 0x0008 00031 #define CAB_ATTRIB_DIRECTORY 0x0010 00032 #define CAB_ATTRIB_ARCHIVE 0x0020 00033 #define CAB_ATTRIB_EXECUTE 0x0040 00034 #define CAB_ATTRIB_UTF_NAME 0x0080 00035 00036 #define CAB_FILE_MAX_FOLDER 0xFFFC 00037 #define CAB_FILE_CONTINUED 0xFFFD 00038 #define CAB_FILE_SPLIT 0xFFFE 00039 #define CAB_FILE_PREV_NEXT 0xFFFF 00040 00041 00042 /* Cabinet structures */ 00043 00044 typedef struct _CFHEADER 00045 { 00046 ULONG Signature; // File signature 'MSCF' (CAB_SIGNATURE) 00047 ULONG Reserved1; // Reserved field 00048 ULONG CabinetSize; // Cabinet file size 00049 ULONG Reserved2; // Reserved field 00050 ULONG FileTableOffset; // Offset of first CFFILE 00051 ULONG Reserved3; // Reserved field 00052 WORD Version; // Cabinet version (CAB_VERSION) 00053 WORD FolderCount; // Number of folders 00054 WORD FileCount; // Number of files 00055 WORD Flags; // Cabinet flags (CAB_FLAG_*) 00056 WORD SetID; // Cabinet set id 00057 WORD CabinetNumber; // Zero-based cabinet number 00058 /* Optional fields (depends on Flags) 00059 WORD CabinetResSize // Per-cabinet reserved area size 00060 CHAR FolderResSize // Per-folder reserved area size 00061 CHAR FileResSize // Per-file reserved area size 00062 CHAR CabinetReserved[] // Per-cabinet reserved area 00063 CHAR CabinetPrev[] // Name of previous cabinet file 00064 CHAR DiskPrev[] // Name of previous disk 00065 CHAR CabinetNext[] // Name of next cabinet file 00066 CHAR DiskNext[] // Name of next disk 00067 */ 00068 } CFHEADER, *PCFHEADER; 00069 00070 00071 typedef struct _CFFOLDER 00072 { 00073 ULONG DataOffset; // Absolute offset of first CFDATA block in this folder 00074 WORD DataBlockCount; // Number of CFDATA blocks in this folder in this cabinet 00075 WORD CompressionType; // Type of compression used for all CFDATA blocks in this folder 00076 /* Optional fields (depends on Flags) 00077 CHAR FolderReserved[] // Per-folder reserved area 00078 */ 00079 } CFFOLDER, *PCFFOLDER; 00080 00081 00082 typedef struct _CFFILE 00083 { 00084 ULONG FileSize; // Uncompressed file size in bytes 00085 ULONG FileOffset; // Uncompressed offset of file in the folder 00086 WORD FolderIndex; // Index number of the folder that contains this file 00087 WORD FileDate; // File date stamp, as used by DOS 00088 WORD FileTime; // File time stamp, as used by DOS 00089 WORD Attributes; // File attributes (CAB_ATTRIB_*) 00090 CHAR FileName[ANYSIZE_ARRAY]; 00091 /* After this is the NULL terminated filename */ 00092 } CFFILE, *PCFFILE; 00093 00094 00095 typedef struct _CFDATA 00096 { 00097 ULONG Checksum; // Checksum of CFDATA entry 00098 WORD CompSize; // Number of compressed bytes in this block 00099 WORD UncompSize; // Number of uncompressed bytes in this block 00100 /* Optional fields (depends on Flags) 00101 CHAR DataReserved[] // Per-datablock reserved area 00102 */ 00103 } CFDATA, *PCFDATA; 00104 00105 typedef struct _CAB_SEARCH 00106 { 00107 WCHAR Search[MAX_PATH]; // Search criteria 00108 WCHAR Cabinet[MAX_PATH]; 00109 USHORT Index; 00110 PCFFILE File; // Pointer to current CFFILE 00111 PCFDATA CFData; 00112 ULONG Offset; 00113 } CAB_SEARCH, *PCAB_SEARCH; 00114 00115 00116 /* Constants */ 00117 00118 /* Status codes */ 00119 #define CAB_STATUS_SUCCESS 0x00000000 00120 #define CAB_STATUS_FAILURE 0x00000001 00121 #define CAB_STATUS_NOMEMORY 0x00000002 00122 #define CAB_STATUS_CANNOT_OPEN 0x00000003 00123 #define CAB_STATUS_CANNOT_CREATE 0x00000004 00124 #define CAB_STATUS_CANNOT_READ 0x00000005 00125 #define CAB_STATUS_CANNOT_WRITE 0x00000006 00126 #define CAB_STATUS_FILE_EXISTS 0x00000007 00127 #define CAB_STATUS_INVALID_CAB 0x00000008 00128 #define CAB_STATUS_NOFILE 0x00000009 00129 #define CAB_STATUS_UNSUPPCOMP 0x0000000A 00130 00131 00132 /* Codecs */ 00133 00134 /* Uncompresses a data block */ 00135 typedef ULONG (*PCABINET_CODEC_UNCOMPRESS)(PVOID OutputBuffer, 00136 PVOID InputBuffer, 00137 PLONG InputLength, 00138 PLONG OutputLength); 00139 00140 00141 /* Codec status codes */ 00142 #define CS_SUCCESS 0x0000 /* All data consumed */ 00143 #define CS_NOMEMORY 0x0001 /* Not enough free memory */ 00144 #define CS_BADSTREAM 0x0002 /* Bad data stream */ 00145 00146 /* Codec indentifiers */ 00147 #define CAB_CODEC_RAW 0x00 00148 #define CAB_CODEC_LZX 0x01 00149 #define CAB_CODEC_MSZIP 0x02 00150 00151 #define MSZIP_MAGIC 0x4B43 00152 00153 00154 00155 /* Event handler prototypes */ 00156 00157 typedef BOOL (*PCABINET_OVERWRITE)(PCFFILE File, 00158 PWCHAR FileName); 00159 00160 typedef VOID (*PCABINET_EXTRACT)(PCFFILE File, 00161 PWCHAR FileName); 00162 00163 typedef VOID (*PCABINET_DISK_CHANGE)(PWCHAR CabinetName, 00164 PWCHAR DiskLabel); 00165 00166 00167 00168 /* Classes */ 00169 00170 /* Default constructor */ 00171 VOID CabinetInitialize(VOID); 00172 /* Default destructor */ 00173 VOID CabinetCleanup(VOID); 00174 /* Returns a pointer to the filename part of a fully qualified filename */ 00175 PWCHAR CabinetGetFileName(PWCHAR Path); 00176 /* Removes a filename from a fully qualified filename */ 00177 VOID CabinetRemoveFileName(PWCHAR Path); 00178 /* Normalizes a path */ 00179 BOOL CabinetNormalizePath(PWCHAR Path, ULONG Length); 00180 /* Returns name of cabinet file */ 00181 PWCHAR CabinetGetCabinetName(VOID); 00182 /* Sets the name of the cabinet file */ 00183 VOID CabinetSetCabinetName(PWCHAR FileName); 00184 /* Sets destination path for extracted files */ 00185 VOID CabinetSetDestinationPath(PWCHAR DestinationPath); 00186 /* Returns destination path */ 00187 PWCHAR CabinetGetDestinationPath(VOID); 00188 /* Returns zero-based current disk number */ 00189 ULONG CabinetGetCurrentDiskNumber(VOID); 00190 /* Opens the current cabinet file */ 00191 ULONG CabinetOpen(VOID); 00192 /* Closes the current open cabinet file */ 00193 VOID CabinetClose(VOID); 00194 /* Locates the first file in the current cabinet file that matches a search criteria */ 00195 ULONG CabinetFindFirst(PWCHAR FileName, PCAB_SEARCH Search); 00196 /* Locates the next file that matches the current search criteria */ 00197 ULONG CabinetFindNext(PCAB_SEARCH Search); 00198 /* Locates the next file in the current cabinet file sequentially */ 00199 ULONG CabinetFindNextFileSequential(PWCHAR FileName, PCAB_SEARCH Search); 00200 /* Extracts a file from the current cabinet file */ 00201 ULONG CabinetExtractFile(PCAB_SEARCH Search); 00202 /* Select codec engine to use */ 00203 VOID CabinetSelectCodec(ULONG Id); 00204 /* Set event handlers */ 00205 VOID CabinetSetEventHandlers(PCABINET_OVERWRITE Overwrite, 00206 PCABINET_EXTRACT Extract, 00207 PCABINET_DISK_CHANGE DiskChange); 00208 /* Get pointer to cabinet reserved area. NULL if none */ 00209 PVOID CabinetGetCabinetReservedArea(PULONG Size); Generated on Sun May 27 2012 04:17:57 for ReactOS by
1.7.6.1
|