| 1 |
{ Contents of file wcxhead.pas } |
| 2 |
{ It contains definitions of error codes, flags and callbacks } |
| 3 |
{ Ver. 2.20 with Unicode support } |
| 4 |
|
| 5 |
unit WcxPlugin; |
| 6 |
|
| 7 |
interface |
| 8 |
|
| 9 |
const {Error codes returned to calling application} |
| 10 |
E_SUCCESS= 0; {Success} |
| 11 |
E_END_ARCHIVE= 10; {No more files in archive} |
| 12 |
E_NO_MEMORY= 11; {Not enough memory} |
| 13 |
E_BAD_DATA= 12; {Data is bad} |
| 14 |
E_BAD_ARCHIVE= 13; {CRC error in archive data} |
| 15 |
E_UNKNOWN_FORMAT= 14; {Archive format unknown} |
| 16 |
E_EOPEN= 15; {Cannot open existing file} |
| 17 |
E_ECREATE= 16; {Cannot create file} |
| 18 |
E_ECLOSE= 17; {Error closing file} |
| 19 |
E_EREAD= 18; {Error reading from file} |
| 20 |
E_EWRITE= 19; {Error writing to file} |
| 21 |
E_SMALL_BUF= 20; {Buffer too small} |
| 22 |
E_EABORTED= 21; {Function aborted by user} |
| 23 |
E_NO_FILES= 22; {No files found} |
| 24 |
E_TOO_MANY_FILES= 23; {Too many files to pack} |
| 25 |
E_NOT_SUPPORTED= 24; {Function not supported} |
| 26 |
|
| 27 |
E_HANDLED= -32769; {Handled error} |
| 28 |
E_UNKNOWN= +32768; {Unknown error} |
| 29 |
|
| 30 |
{Unpacking flags} |
| 31 |
PK_OM_LIST= 0; |
| 32 |
PK_OM_EXTRACT= 1; |
| 33 |
|
| 34 |
{Flags for ProcessFile} |
| 35 |
PK_SKIP= 0; {Skip file (no unpacking)} |
| 36 |
PK_TEST= 1; {Test file integrity} |
| 37 |
PK_EXTRACT= 2; {Extract file to disk} |
| 38 |
|
| 39 |
{Flags passed through ChangeVolProc} |
| 40 |
PK_VOL_ASK= 0; {Ask user for location of next volume} |
| 41 |
PK_VOL_NOTIFY= 1; {Notify app that next volume will be unpacked} |
| 42 |
|
| 43 |
{Packing flags} |
| 44 |
|
| 45 |
{For PackFiles} |
| 46 |
PK_PACK_MOVE_FILES= 1; {Delete original after packing} |
| 47 |
PK_PACK_SAVE_PATHS= 2; {Save path names of files} |
| 48 |
PK_PACK_ENCRYPT= 4; {Ask user for password, then encrypt} |
| 49 |
|
| 50 |
|
| 51 |
{Returned by GetPackCaps} |
| 52 |
PK_CAPS_NEW= 1; {Can create new archives} |
| 53 |
PK_CAPS_MODIFY= 2; {Can modify exisiting archives} |
| 54 |
PK_CAPS_MULTIPLE= 4; {Archive can contain multiple files} |
| 55 |
PK_CAPS_DELETE= 8; {Can delete files} |
| 56 |
PK_CAPS_OPTIONS= 16; {Supports the options dialogbox} |
| 57 |
PK_CAPS_MEMPACK= 32; {Supports packing in memory} |
| 58 |
PK_CAPS_BY_CONTENT= 64; {Detect archive type by content} |
| 59 |
PK_CAPS_SEARCHTEXT= 128; {Allow searching for text in archives} |
| 60 |
{ created with this plugin} |
| 61 |
PK_CAPS_HIDE= 256; { Show as normal files (hide packer icon) } |
| 62 |
{ open with Ctrl+PgDn, not Enter } |
| 63 |
PK_CAPS_ENCRYPT= 512; { Plugin supports PK_PACK_ENCRYPT option } |
| 64 |
|
| 65 |
BACKGROUND_UNPACK=1; { Which operations are thread-safe? } |
| 66 |
BACKGROUND_PACK=2; |
| 67 |
BACKGROUND_MEMPACK=4; { For tar.pluginext in background } |
| 68 |
|
| 69 |
{Flags for packing in memory} |
| 70 |
MEM_OPTIONS_WANTHEADERS=1; {Return archive headers with packed data} |
| 71 |
|
| 72 |
{Errors returned by PackToMem} |
| 73 |
MEMPACK_OK= 0; {Function call finished OK, but there is more data} |
| 74 |
MEMPACK_DONE= 1; {Function call finished OK, there is no more data} |
| 75 |
|
| 76 |
{Flags for PkCryptProc callback} |
| 77 |
PK_CRYPT_SAVE_PASSWORD=1; |
| 78 |
PK_CRYPT_LOAD_PASSWORD=2; |
| 79 |
PK_CRYPT_LOAD_PASSWORD_NO_UI=3; { Load password only if master password has already been entered!} |
| 80 |
PK_CRYPT_COPY_PASSWORD=4; { Copy encrypted password to new archive name} |
| 81 |
PK_CRYPT_MOVE_PASSWORD=5; { Move password when renaming an archive} |
| 82 |
PK_CRYPT_DELETE_PASSWORD=6; { Delete password} |
| 83 |
|
| 84 |
PK_CRYPTOPT_MASTERPASS_SET = 1; // The user already has a master password defined |
| 85 |
|
| 86 |
{ THeaderData Flags } |
| 87 |
RHDF_ENCRYPTED = $04; { File encrypted with password } |
| 88 |
|
| 89 |
type |
| 90 |
{ Unsigned integer with pointer size } |
| 91 |
TArcHandle = {$IFDEF CPU64}QWord{$ELSE}LongWord{$ENDIF}; |
| 92 |
{$IFNDEF LCL} |
| 93 |
HWND = type PtrUInt; // Defined as in LCL |
| 94 |
{$ENDIF} |
| 95 |
|
| 96 |
const |
| 97 |
wcxInvalidHandle = TArcHandle(-1); |
| 98 |
|
| 99 |
{ For compatibility with Delphi use $IFDEF's to set calling convention } |
| 100 |
|
| 101 |
type |
| 102 |
{Definition of callback functions called by the DLL} |
| 103 |
{Ask to swap disk for multi-volume archive} |
| 104 |
PChangeVolProc=^TChangeVolProc; |
| 105 |
TChangeVolProc=function(ArcName:pchar;Mode:longint):longint; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; |
| 106 |
PChangeVolProcW=^TChangeVolProcW; |
| 107 |
TChangeVolProcW=function(ArcName:pwidechar;Mode:longint):longint; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; |
| 108 |
{Notify that data is processed - used for progress dialog} |
| 109 |
PProcessDataProc=^TProcessDataProc; |
| 110 |
TProcessDataProc=function(FileName:pchar;Size:longint):longint; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; |
| 111 |
PProcessDataProcW=^TProcessDataProcW; |
| 112 |
TProcessDataProcW=function(FileName:pwidechar;Size:longint):longint; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; |
| 113 |
PPkCryptProc = ^TPkCryptProc; |
| 114 |
TPkCryptProc = function(CryptoNr: Integer; Mode: Integer; ArchiveName, |
| 115 |
Password: PAnsiChar; MaxLen: Integer): Integer; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; |
| 116 |
PPkCryptProcW = ^TPkCryptProcW; |
| 117 |
TPkCryptProcW = function(CryptoNr: Integer; Mode: Integer; ArchiveName, |
| 118 |
Password: PWideChar; MaxLen: Integer): Integer; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; |
| 119 |
|
| 120 |
type |
| 121 |
PHeaderData = ^THeaderData; |
| 122 |
THeaderData=packed record |
| 123 |
ArcName:array [0..259] of char; |
| 124 |
FileName:array [0..259] of char; |
| 125 |
Flags, |
| 126 |
PackSize, |
| 127 |
UnpSize, |
| 128 |
HostOS, |
| 129 |
FileCRC, |
| 130 |
FileTime, |
| 131 |
UnpVer, |
| 132 |
Method, |
| 133 |
FileAttr:longint; |
| 134 |
CmtBuf:pchar; |
| 135 |
CmtBufSize, |
| 136 |
CmtSize, |
| 137 |
CmtState:longint; |
| 138 |
end; |
| 139 |
|
| 140 |
PHeaderDataEx = ^THeaderDataEx; |
| 141 |
THeaderDataEx=packed record |
| 142 |
ArcName:array [0..1023] of char; |
| 143 |
FileName:array [0..1023] of char; |
| 144 |
Flags:longint; |
| 145 |
PackSize, |
| 146 |
PackSizeHigh, |
| 147 |
UnpSize, |
| 148 |
UnpSizeHigh:longword; |
| 149 |
HostOS, |
| 150 |
FileCRC, |
| 151 |
FileTime, |
| 152 |
UnpVer, |
| 153 |
Method, |
| 154 |
FileAttr:longint; |
| 155 |
CmtBuf:pchar; |
| 156 |
CmtBufSize, |
| 157 |
CmtSize, |
| 158 |
CmtState:longint; |
| 159 |
Reserved:array[0..1023] of char; |
| 160 |
end; |
| 161 |
|
| 162 |
PHeaderDataExW=^THeaderDataExW; |
| 163 |
THeaderDataExW=packed record |
| 164 |
ArcName:array [0..1023] of widechar; |
| 165 |
FileName:array [0..1023] of widechar; |
| 166 |
Flags:longint; |
| 167 |
PackSize, |
| 168 |
PackSizeHigh, |
| 169 |
UnpSize, |
| 170 |
UnpSizeHigh:longword; |
| 171 |
HostOS, |
| 172 |
FileCRC, |
| 173 |
FileTime, |
| 174 |
UnpVer, |
| 175 |
Method, |
| 176 |
FileAttr:longint; |
| 177 |
CmtBuf:pchar; |
| 178 |
CmtBufSize, |
| 179 |
CmtSize, |
| 180 |
CmtState:longint; |
| 181 |
Reserved:array[0..1023] of char; |
| 182 |
MfileTime: UInt64; |
| 183 |
end; |
| 184 |
|
| 185 |
tOpenArchiveData=packed record |
| 186 |
ArcName:pchar; |
| 187 |
OpenMode, |
| 188 |
OpenResult:longint; |
| 189 |
CmtBuf:pchar; |
| 190 |
CmtBufSize, |
| 191 |
CmtSize, |
| 192 |
CmtState:longint; |
| 193 |
end; |
| 194 |
|
| 195 |
tOpenArchiveDataW=packed record |
| 196 |
ArcName:pwidechar; |
| 197 |
OpenMode, |
| 198 |
OpenResult:longint; |
| 199 |
CmtBuf:pwidechar; |
| 200 |
CmtBufSize, |
| 201 |
CmtSize, |
| 202 |
CmtState:longint; |
| 203 |
end; |
| 204 |
|
| 205 |
tPackDefaultParamStruct=record |
| 206 |
size, |
| 207 |
PluginInterfaceVersionLow, |
| 208 |
PluginInterfaceVersionHi:longint; |
| 209 |
DefaultIniName:array[0..259] of char; |
| 210 |
end; |
| 211 |
pPackDefaultParamStruct=^tPackDefaultParamStruct; |
| 212 |
|
| 213 |
implementation |
| 214 |
|
| 215 |
end. |
| 216 |
|
| 217 |
|