ReactOS  0.4.13-dev-79-gcd489d8
fci.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_FCI_H
20 #define __WINE_FCI_H
21 
22 #include <basetsd.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* defined(__cplusplus) */
27 
28 #include <pshpack4.h>
29 
30 #ifndef INCLUDED_TYPES_FCI_FDI
31 #define INCLUDED_TYPES_FCI_FDI 1
32 
33 /***********************************************************************
34  * Common FCI/TDI declarations
35  */
36 
37 typedef ULONG CHECKSUM;
38 
39 typedef ULONG UOFF;
40 typedef ULONG COFF;
41 
42 /**********************************************************************/
43 
44 typedef struct {
45  int erfOper; /* FCI/FDI error code - see {FCI,FDI}ERROR_XXX for details. */
46  int erfType; /* Optional error value filled in by FCI/FDI. */
47  BOOL fError; /* TRUE => error present */
48 } ERF, *PERF;
49 
50 /**********************************************************************/
51 
52 #define CB_MAX_CHUNK 32768U
53 #define CB_MAX_DISK 0x7fffffffL
54 #define CB_MAX_FILENAME 256
55 #define CB_MAX_CABINET_NAME 256
56 #define CB_MAX_CAB_PATH 256
57 #define CB_MAX_DISK_NAME 256
58 
59 /**********************************************************************/
60 
61 typedef unsigned short TCOMP;
62 
63 #define tcompMASK_TYPE 0x000F /* Mask for compression type */
64 #define tcompTYPE_NONE 0x0000 /* No compression */
65 #define tcompTYPE_MSZIP 0x0001 /* MSZIP */
66 #define tcompTYPE_QUANTUM 0x0002 /* Quantum */
67 #define tcompTYPE_LZX 0x0003 /* LZX */
68 #define tcompBAD 0x000F /* Unspecified compression type */
69 
70 #define tcompMASK_LZX_WINDOW 0x1F00 /* Mask for LZX Compression Memory */
71 #define tcompLZX_WINDOW_LO 0x0F00 /* Lowest LZX Memory (15) */
72 #define tcompLZX_WINDOW_HI 0x1500 /* Highest LZX Memory (21) */
73 #define tcompSHIFT_LZX_WINDOW 8 /* Amount to shift over to get int */
74 
75 #define tcompMASK_QUANTUM_LEVEL 0x00F0 /* Mask for Quantum Compression Level */
76 #define tcompQUANTUM_LEVEL_LO 0x0010 /* Lowest Quantum Level (1) */
77 #define tcompQUANTUM_LEVEL_HI 0x0070 /* Highest Quantum Level (7) */
78 #define tcompSHIFT_QUANTUM_LEVEL 4 /* Amount to shift over to get int */
79 
80 #define tcompMASK_QUANTUM_MEM 0x1F00 /* Mask for Quantum Compression Memory */
81 #define tcompQUANTUM_MEM_LO 0x0A00 /* Lowest Quantum Memory (10) */
82 #define tcompQUANTUM_MEM_HI 0x1500 /* Highest Quantum Memory (21) */
83 #define tcompSHIFT_QUANTUM_MEM 8 /* Amount to shift over to get int */
84 
85 #define tcompMASK_RESERVED 0xE000 /* Reserved bits (high 3 bits) */
86 
87 /**********************************************************************/
88 
89 #define CompressionTypeFromTCOMP(tc) \
90  ((tc) & tcompMASK_TYPE)
91 
92 #define CompressionLevelFromTCOMP(tc) \
93  (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
94 
95 #define CompressionMemoryFromTCOMP(tc) \
96  (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
97 
98 #define TCOMPfromTypeLevelMemory(t, l, m) \
99  (((m) << tcompSHIFT_QUANTUM_MEM ) | \
100  ((l) << tcompSHIFT_QUANTUM_LEVEL) | \
101  ( t ))
102 
103 #define LZXCompressionWindowFromTCOMP(tc) \
104  (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
105 
106 #define TCOMPfromLZXWindow(w) \
107  (((w) << tcompSHIFT_LZX_WINDOW) | \
108  ( tcompTYPE_LZX ))
109 
110 #endif /* !defined(INCLUDED_TYPES_FCI_FDI) */
111 
112 /***********************************************************************
113  * FCI declarations
114  */
115 
116 typedef enum {
126 } FCIERROR;
127 
128 /**********************************************************************/
129 
130 #ifndef _A_NAME_IS_UTF
131 #define _A_NAME_IS_UTF 0x80
132 #endif
133 
134 #ifndef _A_EXEC
135 #define _A_EXEC 0x40
136 #endif
137 
138 /**********************************************************************/
139 
140 typedef void *HFCI;
141 
142 /**********************************************************************/
143 
144 typedef struct {
145  ULONG cb; /* Size available for cabinet on this media */
146  ULONG cbFolderThresh; /* Threshold for forcing a new Folder */
147 
148  UINT cbReserveCFHeader; /* Space to reserve in CFHEADER */
149  UINT cbReserveCFFolder; /* Space to reserve in CFFOLDER */
150  UINT cbReserveCFData; /* Space to reserve in CFDATA */
151  int iCab; /* Sequential numbers for cabinets */
152  int iDisk; /* Disk number */
153 #ifndef REMOVE_CHICAGO_M6_HACK
154  int fFailOnIncompressible; /* TRUE => Fail if a block is incompressible */
155 #endif
156 
157  USHORT setID; /* Cabinet set ID */
158 
159  char szDisk[CB_MAX_DISK_NAME]; /* Current disk name */
160  char szCab[CB_MAX_CABINET_NAME]; /* Current cabinet name */
161  char szCabPath[CB_MAX_CAB_PATH]; /* Path for creating cabinet */
162 } CCAB, *PCCAB;
163 
164 /**********************************************************************/
165 
166 typedef void * (__cdecl __WINE_ALLOC_SIZE(1) *PFNFCIALLOC)(ULONG cb);
167 #define FNFCIALLOC(fn) void * __cdecl fn(ULONG cb)
168 
169 typedef void (__cdecl *PFNFCIFREE)(void *memory);
170 #define FNFCIFREE(fn) void __cdecl fn(void *memory)
171 
172 typedef INT_PTR (__cdecl *PFNFCIOPEN) (char *pszFile, int oflag, int pmode, int *err, void *pv);
173 #define FNFCIOPEN(fn) INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode, int *err, void *pv)
174 
175 typedef UINT (__cdecl *PFNFCIREAD) (INT_PTR hf, void *memory, UINT cb, int *err, void *pv);
176 #define FNFCIREAD(fn) UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
177 
178 typedef UINT (__cdecl *PFNFCIWRITE)(INT_PTR hf, void *memory, UINT cb, int *err, void *pv);
179 #define FNFCIWRITE(fn) UINT __cdecl fn(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
180 
181 typedef int (__cdecl *PFNFCICLOSE)(INT_PTR hf, int *err, void *pv);
182 #define FNFCICLOSE(fn) int __cdecl fn(INT_PTR hf, int *err, void *pv)
183 
184 typedef LONG (__cdecl *PFNFCISEEK) (INT_PTR hf, LONG dist, int seektype, int *err, void *pv);
185 #define FNFCISEEK(fn) LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
186 
187 typedef int (__cdecl *PFNFCIDELETE) (char *pszFile, int *err, void *pv);
188 #define FNFCIDELETE(fn) int __cdecl fn(char *pszFile, int *err, void *pv)
189 
190 typedef BOOL (__cdecl *PFNFCIGETNEXTCABINET)(PCCAB pccab, ULONG cbPrevCab, void *pv);
191 #define FNFCIGETNEXTCABINET(fn) BOOL __cdecl fn(PCCAB pccab, \
192  ULONG cbPrevCab, \
193  void *pv)
194 
196  char *pszFile,
197  LONG cbFile,
198  BOOL fContinuation,
199  void *pv);
200 #define FNFCIFILEPLACED(fn) int __cdecl fn(PCCAB pccab, \
201  char *pszFile, \
202  LONG cbFile, \
203  BOOL fContinuation, \
204  void *pv)
205 
206 typedef INT_PTR (__cdecl *PFNFCIGETOPENINFO)(char *pszName,
207  USHORT *pdate,
208  USHORT *ptime,
209  USHORT *pattribs,
210  int *err,
211  void *pv);
212 #define FNFCIGETOPENINFO(fn) INT_PTR __cdecl fn(char *pszName, \
213  USHORT *pdate, \
214  USHORT *ptime, \
215  USHORT *pattribs, \
216  int *err, \
217  void *pv)
218 
219 #define statusFile 0 /* Add File to Folder callback */
220 #define statusFolder 1 /* Add Folder to Cabinet callback */
221 #define statusCabinet 2 /* Write out a completed cabinet callback */
222 
223 typedef LONG (__cdecl *PFNFCISTATUS)(UINT typeStatus,
224  ULONG cb1,
225  ULONG cb2,
226  void *pv);
227 #define FNFCISTATUS(fn) LONG __cdecl fn(UINT typeStatus, \
228  ULONG cb1, \
229  ULONG cb2, \
230  void *pv)
231 
232 typedef BOOL (__cdecl *PFNFCIGETTEMPFILE)(char *pszTempName,
233  int cbTempName,
234  void *pv);
235 #define FNFCIGETTEMPFILE(fn) BOOL __cdecl fn(char *pszTempName, \
236  int cbTempName, \
237  void *pv)
238 
239 /**********************************************************************/
240 
244  void *);
250 
251 /**********************************************************************/
252 
253 #include <poppack.h>
254 
255 #ifdef __cplusplus
256 } /* extern "C" */
257 #endif /* defined(__cplusplus) */
258 
259 #endif /* __WINE_FCI_H */
ULONG cbFolderThresh
Definition: fci.h:146
#define CB_MAX_CAB_PATH
Definition: fci.h:56
HFCI __cdecl FCICreate(PERF, PFNFCIFILEPLACED, PFNFCIALLOC, PFNFCIFREE, PFNFCIOPEN, PFNFCIREAD, PFNFCIWRITE, PFNFCICLOSE, PFNFCISEEK, PFNFCIDELETE, PFNFCIGETTEMPFILE, PCCAB, void *)
Definition: fci.c:998
struct CCAB * PCCAB
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
INT_PTR(__cdecl * PFNFCIGETOPENINFO)(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
Definition: fci.h:206
Definition: fci.h:144
void * HFCI
Definition: fci.h:140
int32_t INT_PTR
Definition: typedefs.h:62
int(__cdecl * PFNFCIFILEPLACED)(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: fci.h:195
ULONG UOFF
Definition: fci.h:39
#define BOOL
Definition: nt_native.h:43
UINT(__cdecl * PFNFCIWRITE)(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fci.h:178
static char memory[1024 *256]
Definition: process.c:116
void *__cdecl __WINE_ALLOC_SIZE(1) *PFNFCIALLOC)(ULONG cb)
Definition: fci.h:166
int iCab
Definition: fci.h:151
LONG(__cdecl * PFNFCISTATUS)(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: fci.h:223
UINT cbReserveCFHeader
Definition: fci.h:148
UINT(__cdecl * PFNFCIREAD)(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fci.h:175
unsigned int BOOL
Definition: ntddk_ex.h:94
INT_PTR(__cdecl * PFNFCIOPEN)(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: fci.h:172
long LONG
Definition: pedump.c:60
Definition: fci.h:44
BOOL __cdecl FCIFlushFolder(HFCI, PFNFCIGETNEXTCABINET, PFNFCISTATUS)
Definition: fci.c:1631
ULONG cb
Definition: fci.h:145
int iDisk
Definition: fci.h:152
int fFailOnIncompressible
Definition: fci.h:154
BOOL(__cdecl * PFNFCIGETNEXTCABINET)(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: fci.h:190
struct ERF * PERF
unsigned short TCOMP
Definition: fci.h:61
static DWORD cb
Definition: integrity.c:41
BOOL __cdecl FCIFlushCabinet(HFCI, BOOL, PFNFCIGETNEXTCABINET, PFNFCISTATUS)
Definition: fci.c:1675
ULONG COFF
Definition: fci.h:40
int erfOper
Definition: fci.h:45
#define err(...)
#define CB_MAX_DISK_NAME
Definition: fci.h:57
int erfType
Definition: fci.h:46
LONG(__cdecl * PFNFCISEEK)(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: fci.h:184
#define CB_MAX_CABINET_NAME
Definition: fci.h:55
ULONG CHECKSUM
Definition: fci.h:37
BOOL __cdecl FCIAddFile(HFCI, char *, char *, BOOL, PFNFCIGETNEXTCABINET, PFNFCISTATUS, PFNFCIGETOPENINFO, TCOMP)
Definition: fci.c:1397
unsigned short USHORT
Definition: pedump.c:61
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
USHORT setID
Definition: fci.h:157
unsigned int UINT
Definition: ndis.h:50
BOOL(__cdecl * PFNFCIGETTEMPFILE)(char *pszTempName, int cbTempName, void *pv)
Definition: fci.h:232
UINT cbReserveCFData
Definition: fci.h:150
UINT cbReserveCFFolder
Definition: fci.h:149
unsigned int ULONG
Definition: retypes.h:1
FCIERROR
Definition: fci.h:116
void(__cdecl * PFNFCIFREE)(void *memory)
Definition: fci.h:169
int(__cdecl * PFNFCICLOSE)(INT_PTR hf, int *err, void *pv)
Definition: fci.h:181
BOOL fError
Definition: fci.h:47
int(__cdecl * PFNFCIDELETE)(char *pszFile, int *err, void *pv)
Definition: fci.h:187
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31