gdiplus: Add tests for preset blend accessors.
[wine/multimedia.git] / include / fdi.h
blobf36baaf40d1694d4cd97d5d94e110447b2f2ba2a
1 /*
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
19 #ifndef __WINE_FDI_H
20 #define __WINE_FDI_H
22 #include <basetsd.h>
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* defined(__cplusplus) */
28 #include <pshpack4.h>
30 #ifndef INCLUDED_TYPES_FCI_FDI
31 #define INCLUDED_TYPES_FCI_FDI 1
33 /***********************************************************************
34 * Common FCI/TDI declarations
37 typedef ULONG CHECKSUM;
39 typedef ULONG UOFF;
40 typedef ULONG COFF;
42 /**********************************************************************/
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;
50 /**********************************************************************/
52 #define CB_MAX_CHUNK 32768U
53 #define CB_MAX_DISK __MSABI_LONG(0x7fffffff)
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
59 /**********************************************************************/
61 typedef unsigned short TCOMP;
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 */
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 */
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 */
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 */
85 #define tcompMASK_RESERVED 0xE000 /* Reserved bits (high 3 bits) */
87 /**********************************************************************/
89 #define CompressionTypeFromTCOMP(tc) \
90 ((tc) & tcompMASK_TYPE)
92 #define CompressionLevelFromTCOMP(tc) \
93 (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
95 #define CompressionMemoryFromTCOMP(tc) \
96 (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
98 #define TCOMPfromTypeLevelMemory(t, l, m) \
99 (((m) << tcompSHIFT_QUANTUM_MEM ) | \
100 ((l) << tcompSHIFT_QUANTUM_LEVEL) | \
101 ( t ))
103 #define LZXCompressionWindowFromTCOMP(tc) \
104 (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
106 #define TCOMPfromLZXWindow(w) \
107 (((w) << tcompSHIFT_LZX_WINDOW) | \
108 ( tcompTYPE_LZX ))
110 #endif /* !defined(INCLUDED_TYPES_FCI_FDI) */
112 /***********************************************************************
113 * FDI declarations
116 typedef enum {
117 FDIERROR_NONE,
118 FDIERROR_CABINET_NOT_FOUND,
119 FDIERROR_NOT_A_CABINET,
120 FDIERROR_UNKNOWN_CABINET_VERSION,
121 FDIERROR_CORRUPT_CABINET,
122 FDIERROR_ALLOC_FAIL,
123 FDIERROR_BAD_COMPR_TYPE,
124 FDIERROR_MDI_FAIL,
125 FDIERROR_TARGET_FILE,
126 FDIERROR_RESERVE_MISMATCH,
127 FDIERROR_WRONG_CABINET,
128 FDIERROR_USER_ABORT,
129 } FDIERROR;
131 /**********************************************************************/
133 #ifndef _A_NAME_IS_UTF
134 #define _A_NAME_IS_UTF 0x80
135 #endif
137 #ifndef _A_EXEC
138 #define _A_EXEC 0x40
139 #endif
141 /**********************************************************************/
143 typedef void *HFDI;
145 /**********************************************************************/
147 typedef struct {
148 LONG cbCabinet; /* Total length of cabinet file */
149 USHORT cFolders; /* Count of folders in cabinet */
150 USHORT cFiles; /* Count of files in cabinet */
151 USHORT setID; /* Cabinet set ID */
152 USHORT iCabinet; /* Cabinet number in set (0 based) */
153 BOOL fReserve; /* TRUE => RESERVE present in cabinet */
154 BOOL hasprev; /* TRUE => Cabinet is chained prev */
155 BOOL hasnext; /* TRUE => Cabinet is chained next */
156 } FDICABINETINFO, *PFDICABINETINFO; /* pfdici */
158 /**********************************************************************/
160 typedef enum {
161 fdidtNEW_CABINET, /* New cabinet */
162 fdidtNEW_FOLDER, /* New folder */
163 fdidtDECRYPT, /* Decrypt a data block */
164 } FDIDECRYPTTYPE;
166 /**********************************************************************/
168 typedef struct {
169 FDIDECRYPTTYPE fdidt; /* Command type (selects union below) */
171 void *pvUser; /* Decryption context */
173 union {
174 struct { /* fdidtNEW_CABINET */
175 void *pHeaderReserve; /* RESERVE section from CFHEADER */
176 USHORT cbHeaderReserve; /* Size of pHeaderReserve */
177 USHORT setID; /* Cabinet set ID */
178 int iCabinet; /* Cabinet number in set (0 based) */
179 } cabinet;
181 struct { /* fdidtNEW_FOLDER */
182 void *pFolderReserve; /* RESERVE section from CFFOLDER */
183 USHORT cbFolderReserve; /* Size of pFolderReserve */
184 USHORT iFolder; /* Folder number in cabinet (0 based) */
185 } folder;
187 struct { /* fdidtDECRYPT */
188 void *pDataReserve; /* RESERVE section from CFDATA */
189 USHORT cbDataReserve; /* Size of pDataReserve */
190 void *pbData; /* Data buffer */
191 USHORT cbData; /* Size of data buffer */
192 BOOL fSplit; /* TRUE if this is a split data block */
193 USHORT cbPartial; /* 0 if this is not a split block, or
194 * the first piece of a split block;
195 * Greater than 0 if this is the
196 * second piece of a split block.
198 } decrypt;
199 } DUMMYUNIONNAME;
200 } FDIDECRYPT, *PFDIDECRYPT;
202 /**********************************************************************/
204 typedef void * (__cdecl *PFNALLOC)(ULONG cb);
205 #define FNALLOC(fn) void * __cdecl fn(ULONG cb)
207 typedef void (__cdecl *PFNFREE)(void *pv);
208 #define FNFREE(fn) void __cdecl fn(void *pv)
210 typedef INT_PTR (__cdecl *PFNOPEN) (char *pszFile, int oflag, int pmode);
211 #define FNOPEN(fn) INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode)
213 typedef UINT (__cdecl *PFNREAD) (INT_PTR hf, void *pv, UINT cb);
214 #define FNREAD(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
216 typedef UINT (__cdecl *PFNWRITE)(INT_PTR hf, void *pv, UINT cb);
217 #define FNWRITE(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
219 typedef int (__cdecl *PFNCLOSE)(INT_PTR hf);
220 #define FNCLOSE(fn) int __cdecl fn(INT_PTR hf)
222 typedef LONG (__cdecl *PFNSEEK) (INT_PTR hf, LONG dist, int seektype);
223 #define FNSEEK(fn) LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype)
225 typedef int (__cdecl *PFNFDIDECRYPT)(PFDIDECRYPT pfdid);
226 #define FNFDIDECRYPT(fn) int __cdecl fn(PFDIDECRYPT pfdid)
228 typedef struct {
229 LONG cb;
230 char *psz1;
231 char *psz2;
232 char *psz3; /* Points to a 256 character buffer */
233 void *pv; /* Value for client */
235 INT_PTR hf;
237 USHORT date;
238 USHORT time;
239 USHORT attribs;
241 USHORT setID; /* Cabinet set ID */
242 USHORT iCabinet; /* Cabinet number (0-based) */
243 USHORT iFolder; /* Folder number (0-based) */
245 FDIERROR fdie;
246 } FDINOTIFICATION, *PFDINOTIFICATION;
248 typedef enum {
249 fdintCABINET_INFO, /* General information about cabinet */
250 fdintPARTIAL_FILE, /* First file in cabinet is continuation */
251 fdintCOPY_FILE, /* File to be copied */
252 fdintCLOSE_FILE_INFO, /* Close the file, set relevant info */
253 fdintNEXT_CABINET, /* File continued to next cabinet */
254 fdintENUMERATE, /* Enumeration status */
255 } FDINOTIFICATIONTYPE;
257 typedef INT_PTR (__cdecl *PFNFDINOTIFY)(FDINOTIFICATIONTYPE fdint,
258 PFDINOTIFICATION pfdin);
259 #define FNFDINOTIFY(fn) INT_PTR __cdecl fn(FDINOTIFICATIONTYPE fdint, \
260 PFDINOTIFICATION pfdin)
262 #include <pshpack1.h>
264 typedef struct {
265 char ach[2]; /* Set to { '*', '\0' } */
266 LONG cbFile; /* Required spill file size */
267 } FDISPILLFILE, *PFDISPILLFILE;
269 #include <poppack.h>
271 #define cpuUNKNOWN (-1) /* FDI does detection */
272 #define cpu80286 (0) /* '286 opcodes only */
273 #define cpu80386 (1) /* '386 opcodes used */
275 /**********************************************************************/
277 HFDI __cdecl FDICreate(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE,
278 PFNCLOSE, PFNSEEK, int, PERF);
279 BOOL __cdecl FDIIsCabinet(HFDI, INT_PTR, PFDICABINETINFO);
280 BOOL __cdecl FDICopy(HFDI, char *, char *, int, PFNFDINOTIFY,
281 PFNFDIDECRYPT, void *pvUser);
282 BOOL __cdecl FDIDestroy(HFDI);
283 BOOL __cdecl FDITruncateCabinet(HFDI, char *, USHORT);
285 /**********************************************************************/
287 #include <poppack.h>
289 #ifdef __cplusplus
290 } /* extern "C" */
291 #endif /* defined(__cplusplus) */
293 #endif /* __WINE_FDI_H */