ReactOS 0.4.15-dev-7931-gfd331f1
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
23extern "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
36
37typedef ULONG UOFF;
38typedef ULONG COFF;
39
40/**********************************************************************/
41
42typedef 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 */
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
59typedef 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
114typedef 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
141typedef void *HFDI;
142
143/**********************************************************************/
144
145typedef 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 */
155
156/**********************************************************************/
157
158typedef enum {
159 fdidtNEW_CABINET, /* New cabinet */
160 fdidtNEW_FOLDER, /* New folder */
161 fdidtDECRYPT, /* Decrypt a data block */
163
164/**********************************************************************/
165
166typedef 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) */
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) */
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;
199
200/**********************************************************************/
201
202typedef void * (__cdecl *PFNALLOC)(ULONG cb);
203#define FNALLOC(fn) void * __cdecl fn(ULONG cb)
204
205typedef void (__cdecl *PFNFREE)(void *pv);
206#define FNFREE(fn) void __cdecl fn(void *pv)
207
208typedef 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
211typedef 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
214typedef 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
218#define FNCLOSE(fn) int __cdecl fn(INT_PTR hf)
219
220typedef 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
226typedef 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
246typedef 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
262typedef 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);
278BOOL __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 */
#define __cdecl
Definition: accygwin.h:79
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
struct FDICABINETINFO * PFDICABINETINFO
struct ERF * PERF
unsigned short TCOMP
Definition: fdi.h:59
FDIERROR
Definition: fdi.h:114
@ FDIERROR_USER_ABORT
Definition: fdi.h:126
@ FDIERROR_CORRUPT_CABINET
Definition: fdi.h:119
@ FDIERROR_RESERVE_MISMATCH
Definition: fdi.h:124
@ FDIERROR_BAD_COMPR_TYPE
Definition: fdi.h:121
@ FDIERROR_UNKNOWN_CABINET_VERSION
Definition: fdi.h:118
@ FDIERROR_WRONG_CABINET
Definition: fdi.h:125
@ FDIERROR_NONE
Definition: fdi.h:115
@ FDIERROR_ALLOC_FAIL
Definition: fdi.h:120
@ FDIERROR_NOT_A_CABINET
Definition: fdi.h:117
@ FDIERROR_MDI_FAIL
Definition: fdi.h:122
@ FDIERROR_TARGET_FILE
Definition: fdi.h:123
@ FDIERROR_CABINET_NOT_FOUND
Definition: fdi.h:116
BOOL __cdecl FDICopy(HFDI, char *, char *, int, PFNFDINOTIFY, PFNFDIDECRYPT, void *pvUser)
Definition: fdi.c:2431
struct FDINOTIFICATION * PFDINOTIFICATION
UINT(__cdecl * PFNWRITE)(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.h:214
ULONG UOFF
Definition: fdi.h:37
BOOL __cdecl FDIIsCabinet(HFDI, INT_PTR, PFDICABINETINFO)
Definition: fdi.c:696
int(__cdecl * PFNCLOSE)(INT_PTR hf)
Definition: fdi.h:217
FDINOTIFICATIONTYPE
Definition: fdi.h:246
@ fdintCABINET_INFO
Definition: fdi.h:247
@ fdintCOPY_FILE
Definition: fdi.h:249
@ fdintPARTIAL_FILE
Definition: fdi.h:248
@ fdintCLOSE_FILE_INFO
Definition: fdi.h:250
@ fdintNEXT_CABINET
Definition: fdi.h:251
@ fdintENUMERATE
Definition: fdi.h:252
ULONG CHECKSUM
Definition: fdi.h:35
BOOL __cdecl FDITruncateCabinet(HFDI, char *, USHORT)
Definition: fdi.c:2861
struct FDIDECRYPT * PFDIDECRYPT
INT_PTR(__cdecl * PFNFDINOTIFY)(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
Definition: fdi.h:255
BOOL __cdecl FDIDestroy(HFDI)
Definition: fdi.c:2831
HFDI __cdecl FDICreate(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF)
Definition: fdi.c:412
UINT(__cdecl * PFNREAD)(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.h:211
void(__cdecl * PFNFREE)(void *pv)
Definition: fdi.h:205
ULONG COFF
Definition: fdi.h:38
FDIDECRYPTTYPE
Definition: fdi.h:158
@ fdidtNEW_CABINET
Definition: fdi.h:159
@ fdidtNEW_FOLDER
Definition: fdi.h:160
@ fdidtDECRYPT
Definition: fdi.h:161
void *(__cdecl * PFNALLOC)(ULONG cb)
Definition: fdi.h:202
INT_PTR(__cdecl * PFNOPEN)(char *pszFile, int oflag, int pmode)
Definition: fdi.h:208
LONG(__cdecl * PFNSEEK)(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.h:220
void * HFDI
Definition: fdi.h:141
struct FDISPILLFILE * PFDISPILLFILE
int(__cdecl * PFNFDIDECRYPT)(PFDIDECRYPT pfdid)
Definition: fdi.h:223
unsigned int BOOL
Definition: ntddk_ex.h:94
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
unsigned int UINT
Definition: ndis.h:50
#define DUMMYUNIONNAME
Definition: ntbasedef.h:32
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
Definition: fci.h:44
USHORT setID
Definition: fdi.h:149
BOOL hasprev
Definition: fdi.h:152
USHORT iCabinet
Definition: fdi.h:150
USHORT cFiles
Definition: fdi.h:148
USHORT cFolders
Definition: fdi.h:147
BOOL hasnext
Definition: fdi.h:153
BOOL fReserve
Definition: fdi.h:151
LONG cbCabinet
Definition: fdi.h:146
USHORT cbFolderReserve
Definition: fdi.h:181
USHORT cbDataReserve
Definition: fdi.h:187
FDIDECRYPTTYPE fdidt
Definition: fdi.h:167
int iCabinet
Definition: fdi.h:176
void * pDataReserve
Definition: fdi.h:186
void * pHeaderReserve
Definition: fdi.h:173
USHORT cbData
Definition: fdi.h:189
void * pvUser
Definition: fdi.h:169
USHORT cbHeaderReserve
Definition: fdi.h:174
void * pbData
Definition: fdi.h:188
USHORT iFolder
Definition: fdi.h:182
void * pFolderReserve
Definition: fdi.h:180
BOOL fSplit
Definition: fdi.h:190
USHORT cbPartial
Definition: fdi.h:191
USHORT setID
Definition: fdi.h:175
USHORT setID
Definition: fdi.h:239
USHORT iCabinet
Definition: fdi.h:240
char * psz3
Definition: fdi.h:230
char * psz2
Definition: fdi.h:229
USHORT time
Definition: fdi.h:236
void * pv
Definition: fdi.h:231
USHORT iFolder
Definition: fdi.h:241
INT_PTR hf
Definition: fdi.h:233
FDIERROR fdie
Definition: fdi.h:243
char * psz1
Definition: fdi.h:228
USHORT date
Definition: fdi.h:235
USHORT attribs
Definition: fdi.h:237
LONG cb
Definition: fdi.h:227
LONG cbFile
Definition: fdi.h:264
Definition: fci.c:116
GLfixed fError
Definition: tritemp.h:488
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t ULONG
Definition: typedefs.h:59