2 * Copyright (C) 2002 Patrik Stridvall
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #endif /* defined(__cplusplus) */
28 #ifndef INCLUDED_TYPES_FCI_FDI
29 #define INCLUDED_TYPES_FCI_FDI 1
31 /***********************************************************************
32 * Common FCI/TDI declarations
35 typedef unsigned long CHECKSUM
;
37 typedef unsigned long UOFF
;
38 typedef unsigned long COFF
;
40 /**********************************************************************/
43 int erfOper
; /* FCI/FDI error code - see {FCI,FDI}ERROR_XXX for details. */
44 int erfType
; /* Optional error value filled in by FCI/FDI. */
45 BOOL fError
; /* TRUE => error present */
48 /**********************************************************************/
50 #define CB_MAX_CHUNK 32768U
51 #define CB_MAX_DISK 0x7fffffffL
52 #define CB_MAX_FILENAME 256
53 #define CB_MAX_CABINET_NAME 256
54 #define CB_MAX_CAB_PATH 256
55 #define CB_MAX_DISK_NAME 256
57 /**********************************************************************/
59 typedef unsigned short TCOMP
;
61 #define tcompMASK_TYPE 0x000F /* Mask for compression type */
62 #define tcompTYPE_NONE 0x0000 /* No compression */
63 #define tcompTYPE_MSZIP 0x0001 /* MSZIP */
64 #define tcompTYPE_QUANTUM 0x0002 /* Quantum */
65 #define tcompTYPE_LZX 0x0003 /* LZX */
66 #define tcompBAD 0x000F /* Unspecified compression type */
68 #define tcompMASK_LZX_WINDOW 0x1F00 /* Mask for LZX Compression Memory */
69 #define tcompLZX_WINDOW_LO 0x0F00 /* Lowest LZX Memory (15) */
70 #define tcompLZX_WINDOW_HI 0x1500 /* Highest LZX Memory (21) */
71 #define tcompSHIFT_LZX_WINDOW 8 /* Amount to shift over to get int */
73 #define tcompMASK_QUANTUM_LEVEL 0x00F0 /* Mask for Quantum Compression Level */
74 #define tcompQUANTUM_LEVEL_LO 0x0010 /* Lowest Quantum Level (1) */
75 #define tcompQUANTUM_LEVEL_HI 0x0070 /* Highest Quantum Level (7) */
76 #define tcompSHIFT_QUANTUM_LEVEL 4 /* Amount to shift over to get int */
78 #define tcompMASK_QUANTUM_MEM 0x1F00 /* Mask for Quantum Compression Memory */
79 #define tcompQUANTUM_MEM_LO 0x0A00 /* Lowest Quantum Memory (10) */
80 #define tcompQUANTUM_MEM_HI 0x1500 /* Highest Quantum Memory (21) */
81 #define tcompSHIFT_QUANTUM_MEM 8 /* Amount to shift over to get int */
83 #define tcompMASK_RESERVED 0xE000 /* Reserved bits (high 3 bits) */
85 /**********************************************************************/
87 #define CompressionTypeFromTCOMP(tc) \
88 ((tc) & tcompMASK_TYPE)
90 #define CompressionLevelFromTCOMP(tc) \
91 (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
93 #define CompressionMemoryFromTCOMP(tc) \
94 (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
96 #define TCOMPfromTypeLevelMemory(t, l, m) \
97 (((m) << tcompSHIFT_QUANTUM_MEM ) | \
98 ((l) << tcompSHIFT_QUANTUM_LEVEL) | \
101 #define LZXCompressionWindowFromTCOMP(tc) \
102 (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
104 #define TCOMPfromLZXWindow(w) \
105 (((w) << tcompSHIFT_LZX_WINDOW) | \
108 #endif /* !defined(INCLUDED_TYPES_FCI_FDI) */
110 /***********************************************************************
116 FDIERROR_CABINET_NOT_FOUND
,
117 FDIERROR_NOT_A_CABINET
,
118 FDIERROR_UNKNOWN_CABINET_VERSION
,
119 FDIERROR_CORRUPT_CABINET
,
121 FDIERROR_BAD_COMPR_TYPE
,
123 FDIERROR_TARGET_FILE
,
124 FDIERROR_RESERVE_MISMATCH
,
125 FDIERROR_WRONG_CABINET
,
129 /**********************************************************************/
131 #ifndef _A_NAME_IS_UTF
132 #define _A_NAME_IS_UTF 0x80
139 /**********************************************************************/
143 /**********************************************************************/
146 long cbCabinet
; /* Total length of cabinet file */
147 USHORT cFolders
; /* Count of folders in cabinet */
148 USHORT cFiles
; /* Count of files in cabinet */
149 USHORT setID
; /* Cabinet set ID */
150 USHORT iCabinet
; /* Cabinet number in set (0 based) */
151 BOOL fReserve
; /* TRUE => RESERVE present in cabinet */
152 BOOL hasprev
; /* TRUE => Cabinet is chained prev */
153 BOOL hasnext
; /* TRUE => Cabinet is chained next */
154 } FDICABINETINFO
, *PFDICABINETINFO
; /* pfdici */
156 /**********************************************************************/
159 fdidtNEW_CABINET
, /* New cabinet */
160 fdidtNEW_FOLDER
, /* New folder */
161 fdidtDECRYPT
, /* Decrypt a data block */
164 /**********************************************************************/
167 FDIDECRYPTTYPE fdidt
; /* Command type (selects union below) */
169 void *pvUser
; /* Decryption context */
172 struct { /* fdidtNEW_CABINET */
173 void *pHeaderReserve
; /* RESERVE section from CFHEADER */
174 USHORT cbHeaderReserve
; /* Size of pHeaderReserve */
175 USHORT setID
; /* Cabinet set ID */
176 int iCabinet
; /* Cabinet number in set (0 based) */
179 struct { /* fdidtNEW_FOLDER */
180 void *pFolderReserve
; /* RESERVE section from CFFOLDER */
181 USHORT cbFolderReserve
; /* Size of pFolderReserve */
182 USHORT iFolder
; /* Folder number in cabinet (0 based) */
185 struct { /* fdidtDECRYPT */
186 void *pDataReserve
; /* RESERVE section from CFDATA */
187 USHORT cbDataReserve
; /* Size of pDataReserve */
188 void *pbData
; /* Data buffer */
189 USHORT cbData
; /* Size of data buffer */
190 BOOL fSplit
; /* TRUE if this is a split data block */
191 USHORT cbPartial
; /* 0 if this is not a split block, or
192 * the first piece of a split block;
193 * Greater than 0 if this is the
194 * second piece of a split block.
198 } FDIDECRYPT
, *PFDIDECRYPT
;
200 /**********************************************************************/
202 typedef void * (__cdecl
*PFNALLOC
)(ULONG cb
);
203 #define FNALLOC(fn) void * __cdecl fn(ULONG cb)
205 typedef void (__cdecl
*PFNFREE
)(void *pv
);
206 #define FNFREE(fn) void __cdecl fn(void *pv)
208 typedef INT_PTR (__cdecl
*PFNOPEN
) (char *pszFile
, int oflag
, int pmode
);
209 #define FNOPEN(fn) INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode)
211 typedef UINT (__cdecl
*PFNREAD
) (INT_PTR hf
, void *pv
, UINT cb
);
212 #define FNREAD(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
214 typedef UINT (__cdecl
*PFNWRITE
)(INT_PTR hf
, void *pv
, UINT cb
);
215 #define FNWRITE(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
217 typedef int (__cdecl
*PFNCLOSE
)(INT_PTR hf
);
218 #define FNCLOSE(fn) int __cdecl fn(INT_PTR hf)
220 typedef long (__cdecl
*PFNSEEK
) (INT_PTR hf
, long dist
, int seektype
);
221 #define FNSEEK(fn) long __cdecl fn(INT_PTR hf, long dist, int seektype)
223 typedef int (__cdecl
*PFNFDIDECRYPT
)(PFDIDECRYPT pfdid
);
224 #define FNFDIDECRYPT(fn) int __cdecl fn(PFDIDECRYPT pfdid)
230 char *psz3
; /* Points to a 256 character buffer */
231 void *pv
; /* Value for client */
239 USHORT setID
; /* Cabinet set ID */
240 USHORT iCabinet
; /* Cabinet number (0-based) */
241 USHORT iFolder
; /* Folder number (0-based) */
244 } FDINOTIFICATION
, *PFDINOTIFICATION
;
247 fdintCABINET_INFO
, /* General information about cabinet */
248 fdintPARTIAL_FILE
, /* First file in cabinet is continuation */
249 fdintCOPY_FILE
, /* File to be copied */
250 fdintCLOSE_FILE_INFO
, /* Close the file, set relevant info */
251 fdintNEXT_CABINET
, /* File continued to next cabinet */
252 fdintENUMERATE
, /* Enumeration status */
253 } FDINOTIFICATIONTYPE
;
255 typedef INT_PTR (__cdecl
*PFNFDINOTIFY
)(FDINOTIFICATIONTYPE fdint
,
256 PFDINOTIFICATION pfdin
);
257 #define FNFDINOTIFY(fn) INT_PTR __cdecl fn(FDINOTIFICATIONTYPE fdint, \
258 PFDINOTIFICATION pfdin)
260 #include <pshpack1.h>
263 char ach
[2]; /* Set to { '*', '\0' } */
264 long cbFile
; /* Required spill file size */
265 } FDISPILLFILE
, *PFDISPILLFILE
;
269 #define cpuUNKNOWN (-1) /* FDI does detection */
270 #define cpu80286 (0) /* '286 opcodes only */
271 #define cpu80386 (1) /* '386 opcodes used */
273 /**********************************************************************/
275 HFDI __cdecl
FDICreate(PFNALLOC
, PFNFREE
, PFNOPEN
, PFNREAD
, PFNWRITE
,
276 PFNCLOSE
, PFNSEEK
, int, PERF
);
277 BOOL __cdecl
FDIIsCabinet(HFDI
, INT_PTR
, PFDICABINETINFO
);
278 BOOL __cdecl
FDICopy(HFDI
, char *, char *, int, PFNFDINOTIFY
,
279 PFNFDIDECRYPT
, void *pvUser
);
280 BOOL __cdecl
FDIDestroy(HFDI
);
281 BOOL __cdecl
FDITruncateCabinet(HFDI
, char *, USHORT
);
283 /**********************************************************************/
289 #endif /* defined(__cplusplus) */
291 #endif /* __WINE_FDI_H */