wcxplugin.h 6.1 KB

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