| 1 |
#include "common.h" |
| 2 |
|
| 3 |
/* Contents of file wcxhead.h */ |
| 4 |
/* It contains definitions of error codes, flags and callbacks */ |
| 5 |
|
| 6 |
/* Error codes returned to calling application */ |
| 7 |
#define E_SUCCESS 0 /* Success */ |
| 8 |
#define E_END_ARCHIVE 10 /* No more files in archive */ |
| 9 |
#define E_NO_MEMORY 11 /* Not enough memory */ |
| 10 |
#define E_BAD_DATA 12 /* Data is bad */ |
| 11 |
#define E_BAD_ARCHIVE 13 /* CRC error in archive data */ |
| 12 |
#define E_UNKNOWN_FORMAT 14 /* Archive format unknown */ |
| 13 |
#define E_EOPEN 15 /* Cannot open existing file */ |
| 14 |
#define E_ECREATE 16 /* Cannot create file */ |
| 15 |
#define E_ECLOSE 17 /* Error closing file */ |
| 16 |
#define E_EREAD 18 /* Error reading from file */ |
| 17 |
#define E_EWRITE 19 /* Error writing to file */ |
| 18 |
#define E_SMALL_BUF 20 /* Buffer too small */ |
| 19 |
#define E_EABORTED 21 /* Function aborted by user */ |
| 20 |
#define E_NO_FILES 22 /* No files found */ |
| 21 |
#define E_TOO_MANY_FILES 23 /* Too many files to pack */ |
| 22 |
#define E_NOT_SUPPORTED 24 /* Function not supported */ |
| 23 |
|
| 24 |
/* flags for unpacking */ |
| 25 |
#define PK_OM_LIST 0 |
| 26 |
#define PK_OM_EXTRACT 1 |
| 27 |
|
| 28 |
/* flags for ProcessFile */ |
| 29 |
#define PK_SKIP 0 /* Skip this file */ |
| 30 |
#define PK_TEST 1 /* Test file integrity */ |
| 31 |
#define PK_EXTRACT 2 /* Extract to disk */ |
| 32 |
|
| 33 |
/* Flags passed through ChangeVolProc */ |
| 34 |
#define PK_VOL_ASK 0 /* Ask user for location of next volume */ |
| 35 |
#define PK_VOL_NOTIFY 1 /* Notify app that next volume will be unpacked */ |
| 36 |
|
| 37 |
/* Flags for packing */ |
| 38 |
|
| 39 |
/* For PackFiles */ |
| 40 |
#define PK_PACK_MOVE_FILES 1 /* Delete original after packing */ |
| 41 |
#define PK_PACK_SAVE_PATHS 2 /* Save path names of files */ |
| 42 |
#define PK_PACK_ENCRYPT 4 /* Ask user for password, then encrypt */ |
| 43 |
|
| 44 |
/* Returned by GetPackCaps */ |
| 45 |
#define PK_CAPS_NEW 1 /* Can create new archives */ |
| 46 |
#define PK_CAPS_MODIFY 2 /* Can modify exisiting archives */ |
| 47 |
#define PK_CAPS_MULTIPLE 4 /* Archive can contain multiple files */ |
| 48 |
#define PK_CAPS_DELETE 8 /* Can delete files */ |
| 49 |
#define PK_CAPS_OPTIONS 16 /* Has options dialog */ |
| 50 |
#define PK_CAPS_MEMPACK 32 /* Supports packing in memory */ |
| 51 |
#define PK_CAPS_BY_CONTENT 64 /* Detect archive type by content */ |
| 52 |
#define PK_CAPS_SEARCHTEXT 128 /* Allow searching for text in archives */ |
| 53 |
/* created with this plugin} */ |
| 54 |
#define PK_CAPS_HIDE 256 /* Show as normal files (hide packer */ |
| 55 |
/* icon), open with Ctrl+PgDn, not Enter*/ |
| 56 |
#define PK_CAPS_ENCRYPT 512 /* Plugin supports PK_PACK_ENCRYPT option*/ |
| 57 |
|
| 58 |
/* Flags for packing in memory */ |
| 59 |
#define MEM_OPTIONS_WANTHEADERS 1 /* Return archive headers with packed data */ |
| 60 |
|
| 61 |
/* Errors returned by PackToMem */ |
| 62 |
#define MEMPACK_OK 0 /* Function call finished OK, but there is more data */ |
| 63 |
#define MEMPACK_DONE 1 /* Function call finished OK, there is no more data */ |
| 64 |
|
| 65 |
#define PK_CRYPT_SAVE_PASSWORD 1 |
| 66 |
#define PK_CRYPT_LOAD_PASSWORD 2 |
| 67 |
#define PK_CRYPT_LOAD_PASSWORD_NO_UI 3 // Load password only if master password has already been entered! |
| 68 |
#define PK_CRYPT_COPY_PASSWORD 4 // Copy encrypted password to new archive name |
| 69 |
#define PK_CRYPT_MOVE_PASSWORD 5 // Move password when renaming an archive |
| 70 |
#define PK_CRYPT_DELETE_PASSWORD 6 // Delete password |
| 71 |
|
| 72 |
#define PK_CRYPTOPT_MASTERPASS_SET 1 // The user already has a master password defined |
| 73 |
|
| 74 |
/* tHeaderData Flags */ |
| 75 |
#define RHDF_ENCRYPTED 0x04 // File encrypted with password |
| 76 |
|
| 77 |
typedef struct { |
| 78 |
char ArcName[260]; |
| 79 |
char FileName[260]; |
| 80 |
int Flags; |
| 81 |
int PackSize; |
| 82 |
int UnpSize; |
| 83 |
int HostOS; |
| 84 |
int FileCRC; |
| 85 |
int FileTime; |
| 86 |
int UnpVer; |
| 87 |
int Method; |
| 88 |
int FileAttr; |
| 89 |
char* CmtBuf; |
| 90 |
int CmtBufSize; |
| 91 |
int CmtSize; |
| 92 |
int CmtState; |
| 93 |
} tHeaderData; |
| 94 |
|
| 95 |
typedef struct { |
| 96 |
char ArcName[1024]; |
| 97 |
char FileName[1024]; |
| 98 |
int Flags; |
| 99 |
unsigned int PackSize; |
| 100 |
unsigned int PackSizeHigh; |
| 101 |
unsigned int UnpSize; |
| 102 |
unsigned int UnpSizeHigh; |
| 103 |
int HostOS; |
| 104 |
int FileCRC; |
| 105 |
int FileTime; |
| 106 |
int UnpVer; |
| 107 |
int Method; |
| 108 |
int FileAttr; |
| 109 |
char* CmtBuf; |
| 110 |
int CmtBufSize; |
| 111 |
int CmtSize; |
| 112 |
int CmtState; |
| 113 |
char Reserved[1024]; |
| 114 |
} tHeaderDataEx; |
| 115 |
|
| 116 |
typedef struct { |
| 117 |
WCHAR ArcName[1024]; |
| 118 |
WCHAR FileName[1024]; |
| 119 |
int Flags; |
| 120 |
unsigned int PackSize; |
| 121 |
unsigned int PackSizeHigh; |
| 122 |
unsigned int UnpSize; |
| 123 |
unsigned int UnpSizeHigh; |
| 124 |
int HostOS; |
| 125 |
int FileCRC; |
| 126 |
int FileTime; |
| 127 |
int UnpVer; |
| 128 |
int Method; |
| 129 |
int FileAttr; |
| 130 |
char* CmtBuf; |
| 131 |
int CmtBufSize; |
| 132 |
int CmtSize; |
| 133 |
int CmtState; |
| 134 |
char Reserved[1024]; |
| 135 |
uint64_t MfileTime; |
| 136 |
} tHeaderDataExW; |
| 137 |
|
| 138 |
typedef struct { |
| 139 |
char* ArcName; |
| 140 |
int OpenMode; |
| 141 |
int OpenResult; |
| 142 |
char* CmtBuf; |
| 143 |
int CmtBufSize; |
| 144 |
int CmtSize; |
| 145 |
int CmtState; |
| 146 |
} tOpenArchiveData; |
| 147 |
|
| 148 |
typedef struct { |
| 149 |
WCHAR* ArcName; |
| 150 |
int OpenMode; |
| 151 |
int OpenResult; |
| 152 |
WCHAR* CmtBuf; |
| 153 |
int CmtBufSize; |
| 154 |
int CmtSize; |
| 155 |
int CmtState; |
| 156 |
} tOpenArchiveDataW; |
| 157 |
|
| 158 |
typedef struct { |
| 159 |
int size; |
| 160 |
DWORD PluginInterfaceVersionLow; |
| 161 |
DWORD PluginInterfaceVersionHi; |
| 162 |
char DefaultIniName[MAX_PATH]; |
| 163 |
} PackDefaultParamStruct; |
| 164 |
|
| 165 |
/* Definition of callback functions called by the DLL |
| 166 |
Ask to swap disk for multi-volume archive */ |
| 167 |
typedef int (DCPCALL *tChangeVolProc)(char *ArcName,int Mode); |
| 168 |
typedef int (DCPCALL *tChangeVolProcW)(WCHAR *ArcName,int Mode); |
| 169 |
/* Notify that data is processed - used for progress dialog */ |
| 170 |
typedef int (DCPCALL *tProcessDataProc)(char *FileName,int Size); |
| 171 |
typedef int (DCPCALL *tProcessDataProcW)(WCHAR *FileName,int Size); |
| 172 |
typedef int (DCPCALL *tPkCryptProc)(int CryptoNr,int Mode, |
| 173 |
char* ArchiveName,char* Password,int maxlen); |
| 174 |
typedef int (DCPCALL *tPkCryptProcW)(int CryptoNr,int Mode, |
| 175 |
WCHAR* ArchiveName,WCHAR* Password,int maxlen); |
| 176 |
|
| 177 |
|