ReactOS  0.4.13-dev-73-gcfe54aa
fdi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002 Patrik Stridvall
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #ifndef __WINE_FDI_H
20 #define __WINE_FDI_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* defined(__cplusplus) */
25 
26 #include <pshpack4.h>
27 
28 #ifndef INCLUDED_TYPES_FCI_FDI
29 #define INCLUDED_TYPES_FCI_FDI 1
30 
31 /***********************************************************************
32  * Common FCI/TDI declarations
33  */
34 
35 typedef ULONG CHECKSUM;
36 
37 typedef ULONG UOFF;
38 typedef ULONG COFF;
39 
40 /**********************************************************************/
41 
42 typedef struct {
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 */
46 } ERF, *PERF;
47 
48 /**********************************************************************/
49 
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
56 
57 /**********************************************************************/
58 
59 typedef unsigned short TCOMP;
60 
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 */
67 
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 */
72 
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 */
77 
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 */
82 
83 #define tcompMASK_RESERVED 0xE000 /* Reserved bits (high 3 bits) */
84 
85 /**********************************************************************/
86 
87 #define CompressionTypeFromTCOMP(tc) \
88  ((tc) & tcompMASK_TYPE)
89 
90 #define CompressionLevelFromTCOMP(tc) \
91  (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
92 
93 #define CompressionMemoryFromTCOMP(tc) \
94  (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
95 
96 #define TCOMPfromTypeLevelMemory(t, l, m) \
97  (((m) << tcompSHIFT_QUANTUM_MEM ) | \
98  ((l) << tcompSHIFT_QUANTUM_LEVEL) | \
99  ( t ))
100 
101 #define LZXCompressionWindowFromTCOMP(tc) \
102  (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
103 
104 #define TCOMPfromLZXWindow(w) \
105  (((w) << tcompSHIFT_LZX_WINDOW) | \
106  ( tcompTYPE_LZX ))
107 
108 #endif /* !defined(INCLUDED_TYPES_FCI_FDI) */
109 
110 /***********************************************************************
111  * FDI declarations
112  */
113 
114 typedef enum {
127 } FDIERROR;
128 
129 /**********************************************************************/
130 
131 #ifndef _A_NAME_IS_UTF
132 #define _A_NAME_IS_UTF 0x80
133 #endif
134 
135 #ifndef _A_EXEC
136 #define _A_EXEC 0x40
137 #endif
138 
139 /**********************************************************************/
140 
141 typedef void *HFDI;
142 
143 /**********************************************************************/
144 
145 typedef struct {
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 */
155 
156 /**********************************************************************/
157 
158 typedef enum {
159  fdidtNEW_CABINET, /* New cabinet */
160  fdidtNEW_FOLDER, /* New folder */
161  fdidtDECRYPT, /* Decrypt a data block */
163 
164 /**********************************************************************/
165 
166 typedef struct {
167  FDIDECRYPTTYPE fdidt; /* Command type (selects union below) */
168 
169  void *pvUser; /* Decryption context */
170 
171  union {
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) */
177  } cabinet;
178 
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) */
183  } folder;
184 
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.
195  */
196  } decrypt;
197  } DUMMYUNIONNAME;
199 
200 /**********************************************************************/
201 
202 typedef void * (__cdecl *PFNALLOC)(ULONG cb);
203 #define FNALLOC(fn) void * __cdecl fn(ULONG cb)
204 
205 typedef void (__cdecl *PFNFREE)(void *pv);
206 #define FNFREE(fn) void __cdecl fn(void *pv)
207 
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)
210 
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)
213 
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)
216 
217 typedef int (__cdecl *PFNCLOSE)(INT_PTR hf);
218 #define FNCLOSE(fn) int __cdecl fn(INT_PTR hf)
219 
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)
222 
224 #define FNFDIDECRYPT(fn) int __cdecl fn(PFDIDECRYPT pfdid)
225 
226 typedef struct {
228  char *psz1;
229  char *psz2;
230  char *psz3; /* Points to a 256 character buffer */
231  void *pv; /* Value for client */
232 
234 
238 
239  USHORT setID; /* Cabinet set ID */
240  USHORT iCabinet; /* Cabinet number (0-based) */
241  USHORT iFolder; /* Folder number (0-based) */
242 
245 
246 typedef enum {
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 */
254 
256  PFDINOTIFICATION pfdin);
257 #define FNFDINOTIFY(fn) INT_PTR __cdecl fn(FDINOTIFICATIONTYPE fdint, \
258  PFDINOTIFICATION pfdin)
259 
260 #include <pshpack1.h>
261 
262 typedef struct {
263  char ach[2]; /* Set to { '*', '\0' } */
264  LONG cbFile; /* Required spill file size */
266 
267 #include <poppack.h>
268 
269 #define cpuUNKNOWN (-1) /* FDI does detection */
270 #define cpu80286 (0) /* '286 opcodes only */
271 #define cpu80386 (1) /* '386 opcodes used */
272 
273 /**********************************************************************/
274 
276  PFNCLOSE, PFNSEEK, int, PERF);
278 BOOL __cdecl FDICopy(HFDI, char *, char *, int, PFNFDINOTIFY,
279  PFNFDIDECRYPT, void *pvUser);
282 
283 /**********************************************************************/
284 
285 #include <poppack.h>
286 
287 #ifdef __cplusplus
288 } /* extern "C" */
289 #endif /* defined(__cplusplus) */
290 
291 #endif /* __WINE_FDI_H */
INT_PTR(__cdecl * PFNFDINOTIFY)(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
Definition: fdi.h:255
LONG cb
Definition: fdi.h:227
USHORT attribs
Definition: fdi.h:237
void * pvUser
Definition: fdi.h:169
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define __cdecl
Definition: accygwin.h:79
char * psz2
Definition: fdi.h:229
FDIDECRYPTTYPE
Definition: fdi.h:158
USHORT iFolder
Definition: fdi.h:182
BOOL hasprev
Definition: fdi.h:152
USHORT setID
Definition: fdi.h:149
int(__cdecl * PFNFDIDECRYPT)(PFDIDECRYPT pfdid)
Definition: fdi.h:223
void * pHeaderReserve
Definition: fdi.h:173
USHORT cFolders
Definition: fdi.h:147
void(__cdecl * PFNFREE)(void *pv)
Definition: fdi.h:205
USHORT cbHeaderReserve
Definition: fdi.h:174
USHORT time
Definition: fdi.h:236
int32_t INT_PTR
Definition: typedefs.h:62
ULONG UOFF
Definition: fdi.h:37
USHORT iFolder
Definition: fdi.h:241
#define DUMMYUNIONNAME
Definition: ntbasedef.h:32
LONG cbFile
Definition: fdi.h:264
HFDI __cdecl FDICreate(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF)
Definition: fdi.c:412
USHORT cbDataReserve
Definition: fdi.h:187
USHORT cFiles
Definition: fdi.h:148
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
FDINOTIFICATIONTYPE
Definition: fdi.h:246
USHORT cbPartial
Definition: fdi.h:191
Definition: fci.h:44
USHORT setID
Definition: fdi.h:239
int(__cdecl * PFNCLOSE)(INT_PTR hf)
Definition: fdi.h:217
char * psz1
Definition: fdi.h:228
LONG cbCabinet
Definition: fdi.h:146
struct CFFOLDER folder
Definition: fdi.c:110
INT_PTR(__cdecl * PFNOPEN)(char *pszFile, int oflag, int pmode)
Definition: fdi.h:208
USHORT cbData
Definition: fdi.h:189
UINT(__cdecl * PFNREAD)(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.h:211
BOOL __cdecl FDIIsCabinet(HFDI, INT_PTR, PFDICABINETINFO)
Definition: fdi.c:696
struct ERF * PERF
FDIERROR
Definition: fdi.h:114
char * psz3
Definition: fdi.h:230
int iCabinet
Definition: fdi.h:176
USHORT cbFolderReserve
Definition: fdi.h:181
unsigned short TCOMP
Definition: fdi.h:59
void * pDataReserve
Definition: fdi.h:186
struct FDIDECRYPT * PFDIDECRYPT
void * pbData
Definition: fdi.h:188
static DWORD cb
Definition: integrity.c:41
struct FDISPILLFILE * PFDISPILLFILE
ULONG COFF
Definition: fdi.h:38
USHORT date
Definition: fdi.h:235
FDIDECRYPTTYPE fdidt
Definition: fdi.h:167
void *(__cdecl * PFNALLOC)(ULONG cb)
Definition: fdi.h:202
LONG(__cdecl * PFNSEEK)(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.h:220
void * HFDI
Definition: fdi.h:141
INT_PTR hf
Definition: fdi.h:233
UINT(__cdecl * PFNWRITE)(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.h:214
USHORT iCabinet
Definition: fdi.h:240
struct FDINOTIFICATION * PFDINOTIFICATION
void * pFolderReserve
Definition: fdi.h:180
BOOL fSplit
Definition: fdi.h:190
ULONG CHECKSUM
Definition: fdi.h:35
USHORT setID
Definition: fdi.h:175
BOOL fReserve
Definition: fdi.h:151
unsigned short USHORT
Definition: pedump.c:61
unsigned int UINT
Definition: ndis.h:50
void * pv
Definition: fdi.h:231
USHORT iCabinet
Definition: fdi.h:150
BOOL __cdecl FDITruncateCabinet(HFDI, char *, USHORT)
Definition: fdi.c:2861
BOOL __cdecl FDIDestroy(HFDI)
Definition: fdi.c:2831
unsigned int ULONG
Definition: retypes.h:1
BOOL hasnext
Definition: fdi.h:153
struct FDICABINETINFO * PFDICABINETINFO
GLfixed fError
Definition: tritemp.h:488
BOOL __cdecl FDICopy(HFDI, char *, char *, int, PFNFDINOTIFY, PFNFDIDECRYPT, void *pvUser)
Definition: fdi.c:2431
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
FDIERROR fdie
Definition: fdi.h:243