1
0

dll.hpp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #ifndef _UNRAR_DLL_
  2. #define _UNRAR_DLL_
  3. #pragma pack(push, 1)
  4. #define ERAR_SUCCESS 0
  5. #define ERAR_END_ARCHIVE 10
  6. #define ERAR_NO_MEMORY 11
  7. #define ERAR_BAD_DATA 12
  8. #define ERAR_BAD_ARCHIVE 13
  9. #define ERAR_UNKNOWN_FORMAT 14
  10. #define ERAR_EOPEN 15
  11. #define ERAR_ECREATE 16
  12. #define ERAR_ECLOSE 17
  13. #define ERAR_EREAD 18
  14. #define ERAR_EWRITE 19
  15. #define ERAR_SMALL_BUF 20
  16. #define ERAR_UNKNOWN 21
  17. #define ERAR_MISSING_PASSWORD 22
  18. #define ERAR_EREFERENCE 23
  19. #define ERAR_BAD_PASSWORD 24
  20. #define RAR_OM_LIST 0
  21. #define RAR_OM_EXTRACT 1
  22. #define RAR_OM_LIST_INCSPLIT 2
  23. #define RAR_SKIP 0
  24. #define RAR_TEST 1
  25. #define RAR_EXTRACT 2
  26. #define RAR_VOL_ASK 0
  27. #define RAR_VOL_NOTIFY 1
  28. #define RAR_DLL_VERSION 8
  29. #define RAR_HASH_NONE 0
  30. #define RAR_HASH_CRC32 1
  31. #define RAR_HASH_BLAKE2 2
  32. #ifdef _UNIX
  33. #define CALLBACK
  34. #define PASCAL
  35. #define LONG long
  36. #define HANDLE void *
  37. #define LPARAM long
  38. #define UINT unsigned int
  39. #endif
  40. #define RHDF_SPLITBEFORE 0x01
  41. #define RHDF_SPLITAFTER 0x02
  42. #define RHDF_ENCRYPTED 0x04
  43. #define RHDF_SOLID 0x10
  44. #define RHDF_DIRECTORY 0x20
  45. struct RARHeaderData
  46. {
  47. char ArcName[260];
  48. char FileName[260];
  49. unsigned int Flags;
  50. unsigned int PackSize;
  51. unsigned int UnpSize;
  52. unsigned int HostOS;
  53. unsigned int FileCRC;
  54. unsigned int FileTime;
  55. unsigned int UnpVer;
  56. unsigned int Method;
  57. unsigned int FileAttr;
  58. char *CmtBuf;
  59. unsigned int CmtBufSize;
  60. unsigned int CmtSize;
  61. unsigned int CmtState;
  62. };
  63. struct RARHeaderDataEx
  64. {
  65. char ArcName[1024];
  66. wchar_t ArcNameW[1024];
  67. char FileName[1024];
  68. wchar_t FileNameW[1024];
  69. unsigned int Flags;
  70. unsigned int PackSize;
  71. unsigned int PackSizeHigh;
  72. unsigned int UnpSize;
  73. unsigned int UnpSizeHigh;
  74. unsigned int HostOS;
  75. unsigned int FileCRC;
  76. unsigned int FileTime;
  77. unsigned int UnpVer;
  78. unsigned int Method;
  79. unsigned int FileAttr;
  80. char *CmtBuf;
  81. unsigned int CmtBufSize;
  82. unsigned int CmtSize;
  83. unsigned int CmtState;
  84. unsigned int DictSize;
  85. unsigned int HashType;
  86. char Hash[32];
  87. unsigned int RedirType;
  88. wchar_t *RedirName;
  89. unsigned int RedirNameSize;
  90. unsigned int DirTarget;
  91. unsigned int MtimeLow;
  92. unsigned int MtimeHigh;
  93. unsigned int CtimeLow;
  94. unsigned int CtimeHigh;
  95. unsigned int AtimeLow;
  96. unsigned int AtimeHigh;
  97. unsigned int Reserved[988];
  98. };
  99. struct RAROpenArchiveData
  100. {
  101. char *ArcName;
  102. unsigned int OpenMode;
  103. unsigned int OpenResult;
  104. char *CmtBuf;
  105. unsigned int CmtBufSize;
  106. unsigned int CmtSize;
  107. unsigned int CmtState;
  108. };
  109. typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
  110. #define ROADF_VOLUME 0x0001
  111. #define ROADF_COMMENT 0x0002
  112. #define ROADF_LOCK 0x0004
  113. #define ROADF_SOLID 0x0008
  114. #define ROADF_NEWNUMBERING 0x0010
  115. #define ROADF_SIGNED 0x0020
  116. #define ROADF_RECOVERY 0x0040
  117. #define ROADF_ENCHEADERS 0x0080
  118. #define ROADF_FIRSTVOLUME 0x0100
  119. #define ROADOF_KEEPBROKEN 0x0001
  120. struct RAROpenArchiveDataEx
  121. {
  122. char *ArcName;
  123. wchar_t *ArcNameW;
  124. unsigned int OpenMode;
  125. unsigned int OpenResult;
  126. char *CmtBuf;
  127. unsigned int CmtBufSize;
  128. unsigned int CmtSize;
  129. unsigned int CmtState;
  130. unsigned int Flags;
  131. UNRARCALLBACK Callback;
  132. LPARAM UserData;
  133. unsigned int OpFlags;
  134. wchar_t *CmtBufW;
  135. unsigned int Reserved[25];
  136. };
  137. enum UNRARCALLBACK_MESSAGES {
  138. UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD,UCM_CHANGEVOLUMEW,
  139. UCM_NEEDPASSWORDW
  140. };
  141. typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode);
  142. typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size);
  143. #ifdef __cplusplus
  144. extern "C" {
  145. #endif
  146. HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData);
  147. HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData);
  148. int PASCAL RARCloseArchive(HANDLE hArcData);
  149. int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *HeaderData);
  150. int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
  151. int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
  152. int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName);
  153. void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData);
  154. void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
  155. void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
  156. void PASCAL RARSetPassword(HANDLE hArcData,char *Password);
  157. int PASCAL RARGetDllVersion();
  158. #ifdef __cplusplus
  159. }
  160. #endif
  161. #pragma pack(pop)
  162. #endif