Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef INCLUDED_TYPES_FCI_FDI
      7 #define INCLUDED_TYPES_FCI_FDI 1
      8 
      9 #ifdef __cplusplus
     10 extern "C" {
     11 #endif
     12 
     13 #ifndef HUGE
     14 #define HUGE
     15 #endif
     16 
     17 #ifndef FAR
     18 #define FAR
     19 #endif
     20 
     21 #ifndef DIAMONDAPI
     22 #define DIAMONDAPI __cdecl
     23 #endif
     24 
     25 #ifndef _WIN64
     26 #include <pshpack4.h>
     27 #endif
     28 
     29 #ifndef BASETYPES
     30 #define BASETYPES
     31   typedef unsigned __LONG32 ULONG;
     32   typedef ULONG *PULONG;
     33   typedef unsigned short USHORT;
     34   typedef USHORT *PUSHORT;
     35   typedef unsigned char UCHAR;
     36   typedef UCHAR *PUCHAR;
     37   typedef char *PSZ;
     38 #endif
     39 
     40 #if !defined(_INC_WINDOWS) && !defined(_WINDOWS_)
     41   typedef int WINBOOL;
     42   typedef unsigned char BYTE;
     43   typedef unsigned int UINT;
     44 #endif
     45 
     46   typedef unsigned __LONG32 CHECKSUM;
     47 
     48   typedef unsigned __LONG32 UOFF;
     49   typedef unsigned __LONG32 COFF;
     50 
     51 #ifndef TRUE
     52 #define TRUE 1
     53 #endif
     54 
     55 #ifndef FALSE
     56 #define FALSE 0
     57 #endif
     58 
     59 #ifndef NULL
     60 #define NULL 0
     61 #endif
     62 
     63   typedef struct {
     64     int erfOper;
     65     int erfType;
     66     WINBOOL fError;
     67   } ERF;
     68 
     69   typedef ERF *PERF;
     70 
     71 #define STATIC static
     72 
     73 #define CB_MAX_CHUNK 32768U
     74 #define CB_MAX_DISK __MSABI_LONG(0x7fffffff)
     75 #define CB_MAX_FILENAME 256
     76 #define CB_MAX_CABINET_NAME 256
     77 #define CB_MAX_CAB_PATH 256
     78 #define CB_MAX_DISK_NAME 256
     79 
     80   typedef unsigned short TCOMP;
     81 
     82 #define tcompMASK_TYPE 0x000F
     83 #define tcompTYPE_NONE 0x0000
     84 #define tcompTYPE_MSZIP 0x0001
     85 #define tcompTYPE_QUANTUM 0x0002
     86 #define tcompTYPE_LZX 0x0003
     87 #define tcompBAD 0x000F
     88 
     89 #define tcompMASK_LZX_WINDOW 0x1F00
     90 #define tcompLZX_WINDOW_LO 0x0F00
     91 #define tcompLZX_WINDOW_HI 0x1500
     92 #define tcompSHIFT_LZX_WINDOW 8
     93 
     94 #define tcompMASK_QUANTUM_LEVEL 0x00F0
     95 #define tcompQUANTUM_LEVEL_LO 0x0010
     96 #define tcompQUANTUM_LEVEL_HI 0x0070
     97 #define tcompSHIFT_QUANTUM_LEVEL 4
     98 
     99 #define tcompMASK_QUANTUM_MEM 0x1F00
    100 #define tcompQUANTUM_MEM_LO 0x0A00
    101 #define tcompQUANTUM_MEM_HI 0x1500
    102 #define tcompSHIFT_QUANTUM_MEM 8
    103 
    104 #define tcompMASK_RESERVED 0xE000
    105 #define CompressionTypeFromTCOMP(tc) ((tc) & tcompMASK_TYPE)
    106 #define CompressionLevelFromTCOMP(tc) (((tc) & tcompMASK_QUANTUM_LEVEL) >> tcompSHIFT_QUANTUM_LEVEL)
    107 #define CompressionMemoryFromTCOMP(tc) (((tc) & tcompMASK_QUANTUM_MEM) >> tcompSHIFT_QUANTUM_MEM)
    108 #define TCOMPfromTypeLevelMemory(t,l,m) (((m) << tcompSHIFT_QUANTUM_MEM) | ((l) << tcompSHIFT_QUANTUM_LEVEL) | (t))
    109 #define LZXCompressionWindowFromTCOMP(tc) (((tc) & tcompMASK_LZX_WINDOW) >> tcompSHIFT_LZX_WINDOW)
    110 #define TCOMPfromLZXWindow(w) (((w) << tcompSHIFT_LZX_WINDOW) | (tcompTYPE_LZX))
    111 
    112 #ifndef _WIN64
    113 #include <poppack.h>
    114 #endif
    115 
    116 #ifdef __cplusplus
    117 }
    118 #endif
    119 #endif
    120 
    121 #include <basetsd.h>
    122 
    123 #ifndef INCLUDED_FDI
    124 #define INCLUDED_FDI 1
    125 
    126 #ifdef __cplusplus
    127 extern "C" {
    128 #endif
    129 
    130 #ifndef _WIN64
    131 #pragma pack(4)
    132 #endif
    133 
    134   typedef enum {
    135     FDIERROR_NONE,FDIERROR_CABINET_NOT_FOUND,FDIERROR_NOT_A_CABINET,FDIERROR_UNKNOWN_CABINET_VERSION,FDIERROR_CORRUPT_CABINET,FDIERROR_ALLOC_FAIL,
    136     FDIERROR_BAD_COMPR_TYPE,FDIERROR_MDI_FAIL,FDIERROR_TARGET_FILE,FDIERROR_RESERVE_MISMATCH,FDIERROR_WRONG_CABINET,FDIERROR_USER_ABORT
    137   } FDIERROR;
    138 
    139 #ifndef _A_NAME_IS_UTF
    140 #define _A_NAME_IS_UTF 0x80
    141 #endif
    142 
    143 #ifndef _A_EXEC
    144 #define _A_EXEC 0x40
    145 #endif
    146 
    147   typedef void *HFDI;
    148 
    149   typedef struct {
    150     __LONG32 cbCabinet;
    151     USHORT cFolders;
    152     USHORT cFiles;
    153     USHORT setID;
    154     USHORT iCabinet;
    155     WINBOOL fReserve;
    156     WINBOOL hasprev;
    157     WINBOOL hasnext;
    158   } FDICABINETINFO;
    159 
    160   typedef FDICABINETINFO *PFDICABINETINFO;
    161 
    162   typedef enum {
    163     fdidtNEW_CABINET,fdidtNEW_FOLDER,fdidtDECRYPT
    164   } FDIDECRYPTTYPE;
    165 
    166   typedef struct {
    167     FDIDECRYPTTYPE fdidt;
    168     void *pvUser;
    169     __C89_NAMELESS union {
    170       struct {
    171 	void *pHeaderReserve;
    172 	USHORT cbHeaderReserve;
    173 	USHORT setID;
    174 	int iCabinet;
    175       } cabinet;
    176       struct {
    177 	void *pFolderReserve;
    178 	USHORT cbFolderReserve;
    179 	USHORT iFolder;
    180       } folder;
    181 
    182       struct {
    183 	void *pDataReserve;
    184 	USHORT cbDataReserve;
    185 	void *pbData;
    186 	USHORT cbData;
    187 	WINBOOL fSplit;
    188 	USHORT cbPartial;
    189 
    190       } decrypt;
    191     };
    192   } FDIDECRYPT;
    193 
    194   typedef FDIDECRYPT *PFDIDECRYPT;
    195 
    196   typedef void *(DIAMONDAPI *PFNALLOC)(ULONG cb);
    197 #define FNALLOC(fn) void *DIAMONDAPI fn(ULONG cb)
    198 
    199   typedef void (DIAMONDAPI *PFNFREE)(void *pv);
    200 #define FNFREE(fn) void DIAMONDAPI fn(void *pv)
    201 
    202   typedef INT_PTR (DIAMONDAPI *PFNOPEN) (char *pszFile,int oflag,int pmode);
    203   typedef UINT (DIAMONDAPI *PFNREAD) (INT_PTR hf,void *pv,UINT cb);
    204   typedef UINT (DIAMONDAPI *PFNWRITE)(INT_PTR hf,void *pv,UINT cb);
    205   typedef int (DIAMONDAPI *PFNCLOSE)(INT_PTR hf);
    206   typedef __LONG32 (DIAMONDAPI *PFNSEEK) (INT_PTR hf,__LONG32 dist,int seektype);
    207 
    208 #define FNOPEN(fn) INT_PTR DIAMONDAPI fn(char *pszFile,int oflag,int pmode)
    209 #define FNREAD(fn) UINT DIAMONDAPI fn(INT_PTR hf,void *pv,UINT cb)
    210 #define FNWRITE(fn) UINT DIAMONDAPI fn(INT_PTR hf,void *pv,UINT cb)
    211 #define FNCLOSE(fn) int DIAMONDAPI fn(INT_PTR hf)
    212 #define FNSEEK(fn) __LONG32 DIAMONDAPI fn(INT_PTR hf,__LONG32 dist,int seektype)
    213 
    214   typedef int (DIAMONDAPI *PFNFDIDECRYPT)(PFDIDECRYPT pfdid);
    215 #define FNFDIDECRYPT(fn) int DIAMONDAPI fn(PFDIDECRYPT pfdid)
    216 
    217   typedef struct {
    218     __LONG32 cb;
    219     char *psz1;
    220     char *psz2;
    221     char *psz3;
    222     void *pv;
    223     INT_PTR hf;
    224     USHORT date;
    225     USHORT time;
    226     USHORT attribs;
    227     USHORT setID;
    228     USHORT iCabinet;
    229     USHORT iFolder;
    230     FDIERROR fdie;
    231   } FDINOTIFICATION,*PFDINOTIFICATION;
    232 
    233   typedef enum {
    234     fdintCABINET_INFO,fdintPARTIAL_FILE,fdintCOPY_FILE,fdintCLOSE_FILE_INFO,fdintNEXT_CABINET,fdintENUMERATE
    235   } FDINOTIFICATIONTYPE;
    236 
    237   typedef INT_PTR (DIAMONDAPI *PFNFDINOTIFY)(FDINOTIFICATIONTYPE fdint,PFDINOTIFICATION pfdin);
    238 
    239 #define FNFDINOTIFY(fn) INT_PTR DIAMONDAPI fn(FDINOTIFICATIONTYPE fdint,PFDINOTIFICATION pfdin)
    240 
    241 #ifndef _WIN64
    242 #pragma pack (1)
    243 #endif
    244 
    245   typedef struct {
    246     char ach[2];
    247     __LONG32 cbFile;
    248   } FDISPILLFILE;
    249 
    250   typedef FDISPILLFILE *PFDISPILLFILE;
    251 
    252 #ifndef _WIN64
    253 #pragma pack ()
    254 #endif
    255 
    256 #define cpuUNKNOWN (-1)
    257 #define cpu80286 (0)
    258 #define cpu80386 (1)
    259 
    260   HFDI DIAMONDAPI FDICreate(PFNALLOC pfnalloc,PFNFREE pfnfree,PFNOPEN pfnopen,PFNREAD pfnread,PFNWRITE pfnwrite,PFNCLOSE pfnclose,PFNSEEK pfnseek,int cpuType,PERF perf);
    261   WINBOOL DIAMONDAPI FDIIsCabinet(HFDI hfdi,INT_PTR hf,PFDICABINETINFO pfdici);
    262   WINBOOL DIAMONDAPI FDICopy(HFDI hfdi,char *pszCabinet,char *pszCabPath,int flags,PFNFDINOTIFY pfnfdin,PFNFDIDECRYPT pfnfdid,void *pvUser);
    263   WINBOOL DIAMONDAPI FDIDestroy(HFDI hfdi);
    264   WINBOOL DIAMONDAPI FDITruncateCabinet(HFDI hfdi,char *pszCabinetName,USHORT iFolderToDelete);
    265 
    266 #ifndef _WIN64
    267 #pragma pack()
    268 #endif
    269 
    270 #ifdef __cplusplus
    271 }
    272 #endif
    273 #endif
    274