ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

fdi.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2002 Patrik Stridvall
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #ifndef __WINE_FDI_H
00020 #define __WINE_FDI_H
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif /* defined(__cplusplus) */
00025 
00026 #include <pshpack4.h>
00027 
00028 #ifndef INCLUDED_TYPES_FCI_FDI
00029 #define INCLUDED_TYPES_FCI_FDI 1
00030 
00031 /***********************************************************************
00032  * Common FCI/TDI declarations
00033  */
00034 
00035 typedef ULONG CHECKSUM;
00036 
00037 typedef ULONG UOFF;
00038 typedef ULONG COFF;
00039 
00040 /**********************************************************************/
00041 
00042 typedef struct {
00043     int   erfOper;  /* FCI/FDI error code - see {FCI,FDI}ERROR_XXX for details. */
00044     int   erfType;  /* Optional error value filled in by FCI/FDI. */
00045     BOOL  fError;   /* TRUE => error present */
00046 } ERF, *PERF;
00047 
00048 /**********************************************************************/
00049 
00050 #define CB_MAX_CHUNK         32768U
00051 #define CB_MAX_DISK          0x7fffffffL
00052 #define CB_MAX_FILENAME      256
00053 #define CB_MAX_CABINET_NAME  256
00054 #define CB_MAX_CAB_PATH      256
00055 #define CB_MAX_DISK_NAME     256
00056 
00057 /**********************************************************************/
00058 
00059 typedef unsigned short TCOMP;
00060 
00061 #define tcompMASK_TYPE          0x000F  /* Mask for compression type */
00062 #define tcompTYPE_NONE          0x0000  /* No compression */
00063 #define tcompTYPE_MSZIP         0x0001  /* MSZIP */
00064 #define tcompTYPE_QUANTUM       0x0002  /* Quantum */
00065 #define tcompTYPE_LZX           0x0003  /* LZX */
00066 #define tcompBAD                0x000F  /* Unspecified compression type */
00067 
00068 #define tcompMASK_LZX_WINDOW    0x1F00  /* Mask for LZX Compression Memory */
00069 #define tcompLZX_WINDOW_LO      0x0F00  /* Lowest LZX Memory (15) */
00070 #define tcompLZX_WINDOW_HI      0x1500  /* Highest LZX Memory (21) */
00071 #define tcompSHIFT_LZX_WINDOW        8  /* Amount to shift over to get int */
00072 
00073 #define tcompMASK_QUANTUM_LEVEL 0x00F0  /* Mask for Quantum Compression Level */
00074 #define tcompQUANTUM_LEVEL_LO   0x0010  /* Lowest Quantum Level (1) */
00075 #define tcompQUANTUM_LEVEL_HI   0x0070  /* Highest Quantum Level (7) */
00076 #define tcompSHIFT_QUANTUM_LEVEL     4  /* Amount to shift over to get int */
00077 
00078 #define tcompMASK_QUANTUM_MEM   0x1F00  /* Mask for Quantum Compression Memory */
00079 #define tcompQUANTUM_MEM_LO     0x0A00  /* Lowest Quantum Memory (10) */
00080 #define tcompQUANTUM_MEM_HI     0x1500  /* Highest Quantum Memory (21) */
00081 #define tcompSHIFT_QUANTUM_MEM       8  /* Amount to shift over to get int */
00082 
00083 #define tcompMASK_RESERVED      0xE000  /* Reserved bits (high 3 bits) */
00084 
00085 /**********************************************************************/
00086 
00087 #define CompressionTypeFromTCOMP(tc) \
00088     ((tc) & tcompMASK_TYPE)
00089 
00090 #define CompressionLevelFromTCOMP(tc) \
00091     (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
00092 
00093 #define CompressionMemoryFromTCOMP(tc) \
00094     (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
00095 
00096 #define TCOMPfromTypeLevelMemory(t, l, m) \
00097     (((m) << tcompSHIFT_QUANTUM_MEM  ) | \
00098      ((l) << tcompSHIFT_QUANTUM_LEVEL) | \
00099      ( t                             ))
00100 
00101 #define LZXCompressionWindowFromTCOMP(tc) \
00102     (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
00103 
00104 #define TCOMPfromLZXWindow(w) \
00105     (((w) << tcompSHIFT_LZX_WINDOW) | \
00106      ( tcompTYPE_LZX              ))
00107 
00108 #endif /* !defined(INCLUDED_TYPES_FCI_FDI) */
00109 
00110 /***********************************************************************
00111  * FDI declarations
00112  */
00113 
00114 typedef enum {
00115     FDIERROR_NONE,
00116     FDIERROR_CABINET_NOT_FOUND,
00117     FDIERROR_NOT_A_CABINET,
00118     FDIERROR_UNKNOWN_CABINET_VERSION,
00119     FDIERROR_CORRUPT_CABINET,
00120     FDIERROR_ALLOC_FAIL,
00121     FDIERROR_BAD_COMPR_TYPE,
00122     FDIERROR_MDI_FAIL,
00123     FDIERROR_TARGET_FILE,
00124     FDIERROR_RESERVE_MISMATCH,
00125     FDIERROR_WRONG_CABINET,
00126     FDIERROR_USER_ABORT,
00127 } FDIERROR;
00128 
00129 /**********************************************************************/
00130 
00131 #ifndef _A_NAME_IS_UTF
00132 #define _A_NAME_IS_UTF  0x80
00133 #endif
00134 
00135 #ifndef _A_EXEC
00136 #define _A_EXEC         0x40
00137 #endif
00138 
00139 /**********************************************************************/
00140 
00141 typedef void *HFDI;
00142 
00143 /**********************************************************************/
00144 
00145 typedef struct {
00146     LONG    cbCabinet;  /* Total length of cabinet file */
00147     USHORT  cFolders;   /* Count of folders in cabinet */
00148     USHORT  cFiles;     /* Count of files in cabinet */
00149     USHORT  setID;      /* Cabinet set ID */
00150     USHORT  iCabinet;   /* Cabinet number in set (0 based) */
00151     BOOL    fReserve;   /* TRUE => RESERVE present in cabinet */
00152     BOOL    hasprev;    /* TRUE => Cabinet is chained prev */
00153     BOOL    hasnext;    /* TRUE => Cabinet is chained next */
00154 } FDICABINETINFO, *PFDICABINETINFO; /* pfdici */
00155 
00156 /**********************************************************************/
00157 
00158 typedef enum {
00159     fdidtNEW_CABINET,  /* New cabinet */
00160     fdidtNEW_FOLDER,   /* New folder */
00161     fdidtDECRYPT,      /* Decrypt a data block */
00162 } FDIDECRYPTTYPE;
00163 
00164 /**********************************************************************/
00165 
00166 typedef struct {
00167     FDIDECRYPTTYPE fdidt; /* Command type (selects union below) */
00168 
00169     void *pvUser; /* Decryption context */
00170 
00171     union {
00172         struct {                      /* fdidtNEW_CABINET */
00173         void   *pHeaderReserve;   /* RESERVE section from CFHEADER */
00174         USHORT  cbHeaderReserve;  /* Size of pHeaderReserve */
00175         USHORT  setID;            /* Cabinet set ID */
00176         int     iCabinet;         /* Cabinet number in set (0 based) */
00177         } cabinet;
00178 
00179         struct {                      /* fdidtNEW_FOLDER */
00180         void   *pFolderReserve;   /* RESERVE section from CFFOLDER */
00181         USHORT  cbFolderReserve;  /* Size of pFolderReserve */
00182         USHORT  iFolder;          /* Folder number in cabinet (0 based) */
00183         } folder;
00184 
00185         struct {                      /* fdidtDECRYPT */
00186         void   *pDataReserve;     /* RESERVE section from CFDATA */
00187         USHORT  cbDataReserve;    /* Size of pDataReserve */
00188         void   *pbData;           /* Data buffer */
00189         USHORT  cbData;           /* Size of data buffer */
00190         BOOL    fSplit;           /* TRUE if this is a split data block */
00191         USHORT  cbPartial;        /* 0 if this is not a split block, or
00192                        * the first piece of a split block;
00193                                        * Greater than 0 if this is the
00194                                        * second piece of a split block.
00195                                        */
00196         } decrypt;
00197     } DUMMYUNIONNAME;
00198 } FDIDECRYPT, *PFDIDECRYPT;
00199 
00200 /**********************************************************************/
00201 
00202 typedef void * (__cdecl *PFNALLOC)(ULONG cb);
00203 #define FNALLOC(fn) void * __cdecl fn(ULONG cb)
00204 
00205 typedef void (__cdecl *PFNFREE)(void *pv);
00206 #define FNFREE(fn) void __cdecl fn(void *pv)
00207 
00208 typedef INT_PTR (__cdecl *PFNOPEN) (char *pszFile, int oflag, int pmode);
00209 #define FNOPEN(fn) INT_PTR __cdecl fn(char *pszFile, int oflag, int pmode)
00210 
00211 typedef UINT (__cdecl *PFNREAD) (INT_PTR hf, void *pv, UINT cb);
00212 #define FNREAD(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
00213 
00214 typedef UINT (__cdecl *PFNWRITE)(INT_PTR hf, void *pv, UINT cb);
00215 #define FNWRITE(fn) UINT __cdecl fn(INT_PTR hf, void *pv, UINT cb)
00216 
00217 typedef int  (__cdecl *PFNCLOSE)(INT_PTR hf);
00218 #define FNCLOSE(fn) int __cdecl fn(INT_PTR hf)
00219 
00220 typedef LONG (__cdecl *PFNSEEK) (INT_PTR hf, LONG dist, int seektype);
00221 #define FNSEEK(fn) LONG __cdecl fn(INT_PTR hf, LONG dist, int seektype)
00222 
00223 typedef int (__cdecl *PFNFDIDECRYPT)(PFDIDECRYPT pfdid);
00224 #define FNFDIDECRYPT(fn) int __cdecl fn(PFDIDECRYPT pfdid)
00225 
00226 typedef struct {
00227     LONG  cb;
00228     char *psz1;
00229     char *psz2;
00230     char *psz3;  /* Points to a 256 character buffer */
00231     void *pv;    /* Value for client */
00232 
00233     INT_PTR hf;
00234 
00235     USHORT date;
00236     USHORT time;
00237     USHORT attribs;
00238 
00239     USHORT setID;     /* Cabinet set ID */
00240     USHORT iCabinet;  /* Cabinet number (0-based) */
00241     USHORT iFolder;   /* Folder number (0-based) */
00242 
00243     FDIERROR fdie;
00244 } FDINOTIFICATION, *PFDINOTIFICATION;
00245 
00246 typedef enum {
00247     fdintCABINET_INFO,     /* General information about cabinet */
00248     fdintPARTIAL_FILE,     /* First file in cabinet is continuation */
00249     fdintCOPY_FILE,        /* File to be copied */
00250     fdintCLOSE_FILE_INFO,  /* Close the file, set relevant info */
00251     fdintNEXT_CABINET,     /* File continued to next cabinet */
00252     fdintENUMERATE,        /* Enumeration status */
00253 } FDINOTIFICATIONTYPE;
00254 
00255 typedef INT_PTR (__cdecl *PFNFDINOTIFY)(FDINOTIFICATIONTYPE fdint,
00256                     PFDINOTIFICATION  pfdin);
00257 #define FNFDINOTIFY(fn) INT_PTR __cdecl fn(FDINOTIFICATIONTYPE fdint, \
00258                        PFDINOTIFICATION pfdin)
00259 
00260 #include <pshpack1.h>
00261 
00262 typedef struct {
00263     char ach[2];  /* Set to { '*', '\0' } */
00264     LONG cbFile;  /* Required spill file size */
00265 } FDISPILLFILE, *PFDISPILLFILE;
00266 
00267 #include <poppack.h>
00268 
00269 #define cpuUNKNOWN (-1)  /* FDI does detection */
00270 #define cpu80286   (0)   /* '286 opcodes only */
00271 #define cpu80386   (1)   /* '386 opcodes used */
00272 
00273 /**********************************************************************/
00274 
00275 HFDI __cdecl FDICreate(PFNALLOC, PFNFREE, PFNOPEN, PFNREAD, PFNWRITE,
00276                PFNCLOSE, PFNSEEK, int, PERF);
00277 BOOL __cdecl FDIIsCabinet(HFDI, INT_PTR, PFDICABINETINFO);
00278 BOOL __cdecl FDICopy(HFDI, char *, char *, int, PFNFDINOTIFY,
00279              PFNFDIDECRYPT, void *pvUser);
00280 BOOL __cdecl FDIDestroy(HFDI);
00281 BOOL __cdecl FDITruncateCabinet(HFDI, char *, USHORT);
00282 
00283 /**********************************************************************/
00284 
00285 #include <poppack.h>
00286 
00287 #ifdef __cplusplus
00288 } /* extern "C" */
00289 #endif /* defined(__cplusplus) */
00290 
00291 #endif  /* __WINE_FDI_H */

Generated on Sat May 26 2012 04:30:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.