wcxplugin.pas 6.8 KB

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