dll.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #ifndef _UNRAR_DLL_
  2. #define _UNRAR_DLL_
  3. #pragma pack(1)
  4. #define ERAR_END_ARCHIVE 10
  5. #define ERAR_NO_MEMORY 11
  6. #define ERAR_BAD_DATA 12
  7. #define ERAR_BAD_ARCHIVE 13
  8. #define ERAR_UNKNOWN_FORMAT 14
  9. #define ERAR_EOPEN 15
  10. #define ERAR_ECREATE 16
  11. #define ERAR_ECLOSE 17
  12. #define ERAR_EREAD 18
  13. #define ERAR_EWRITE 19
  14. #define ERAR_SMALL_BUF 20
  15. #define ERAR_UNKNOWN 21
  16. #define ERAR_MISSING_PASSWORD 22
  17. #define RAR_OM_LIST 0
  18. #define RAR_OM_EXTRACT 1
  19. #define RAR_OM_LIST_INCSPLIT 2
  20. #define RAR_SKIP 0
  21. #define RAR_TEST 1
  22. #define RAR_EXTRACT 2
  23. #define RAR_VOL_ASK 0
  24. #define RAR_VOL_NOTIFY 1
  25. #define RAR_DLL_VERSION 5
  26. #ifdef _UNIX
  27. #define CALLBACK
  28. #define PASCAL
  29. #define LONG long
  30. #define HANDLE void *
  31. #define LPARAM long
  32. #define UINT unsigned int
  33. #endif
  34. struct RARHeaderData
  35. {
  36. char ArcName[260];
  37. char FileName[260];
  38. unsigned int Flags;
  39. unsigned int PackSize;
  40. unsigned int UnpSize;
  41. unsigned int HostOS;
  42. unsigned int FileCRC;
  43. unsigned int FileTime;
  44. unsigned int UnpVer;
  45. unsigned int Method;
  46. unsigned int FileAttr;
  47. char *CmtBuf;
  48. unsigned int CmtBufSize;
  49. unsigned int CmtSize;
  50. unsigned int CmtState;
  51. };
  52. struct RARHeaderDataEx
  53. {
  54. char ArcName[1024];
  55. wchar_t ArcNameW[1024];
  56. char FileName[1024];
  57. wchar_t FileNameW[1024];
  58. unsigned int Flags;
  59. unsigned int PackSize;
  60. unsigned int PackSizeHigh;
  61. unsigned int UnpSize;
  62. unsigned int UnpSizeHigh;
  63. unsigned int HostOS;
  64. unsigned int FileCRC;
  65. unsigned int FileTime;
  66. unsigned int UnpVer;
  67. unsigned int Method;
  68. unsigned int FileAttr;
  69. char *CmtBuf;
  70. unsigned int CmtBufSize;
  71. unsigned int CmtSize;
  72. unsigned int CmtState;
  73. unsigned int Reserved[1024];
  74. };
  75. struct RAROpenArchiveData
  76. {
  77. char *ArcName;
  78. unsigned int OpenMode;
  79. unsigned int OpenResult;
  80. char *CmtBuf;
  81. unsigned int CmtBufSize;
  82. unsigned int CmtSize;
  83. unsigned int CmtState;
  84. };
  85. typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
  86. struct RAROpenArchiveDataEx
  87. {
  88. char *ArcName;
  89. wchar_t *ArcNameW;
  90. unsigned int OpenMode;
  91. unsigned int OpenResult;
  92. char *CmtBuf;
  93. unsigned int CmtBufSize;
  94. unsigned int CmtSize;
  95. unsigned int CmtState;
  96. unsigned int Flags;
  97. UNRARCALLBACK Callback;
  98. LPARAM UserData;
  99. unsigned int Reserved[28];
  100. };
  101. enum UNRARCALLBACK_MESSAGES {
  102. UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD
  103. };
  104. typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode);
  105. typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size);
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109. HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData);
  110. HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData);
  111. int PASCAL RARCloseArchive(HANDLE hArcData);
  112. int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *HeaderData);
  113. int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
  114. int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
  115. int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName);
  116. void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData);
  117. void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
  118. void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
  119. void PASCAL RARSetPassword(HANDLE hArcData,char *Password);
  120. int PASCAL RARGetDllVersion();
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #pragma pack()
  125. #endif