Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. cablib.h
  5. Abstract:
  6. APIs to manipulate CAB files.
  7. Author:
  8. 20-Oct-1999 Calin Negreanu (calinn)
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. //
  13. // Types
  14. //
  15. typedef BOOL(WINAPI CABGETCABINETNAMESA)(
  16. IN PCSTR CabPath,
  17. IN UINT CabPathChars,
  18. IN PCSTR CabFileName,
  19. IN UINT CabFileNameChars,
  20. IN PCSTR CabDiskName,
  21. IN UINT CabDiskNameChars,
  22. IN INT CabFileNr,
  23. IN OUT PINT CabDiskNr
  24. );
  25. typedef CABGETCABINETNAMESA *PCABGETCABINETNAMESA;
  26. typedef BOOL(WINAPI CABGETCABINETNAMESW)(
  27. IN PCWSTR CabPath,
  28. IN UINT CabPathChars,
  29. IN PCWSTR CabFileName,
  30. IN UINT CabFileNameChars,
  31. IN PCWSTR CabDiskName,
  32. IN UINT CabDiskNameChars,
  33. IN INT CabFileNr,
  34. IN OUT PINT CabDiskNr
  35. );
  36. typedef CABGETCABINETNAMESW *PCABGETCABINETNAMESW;
  37. typedef BOOL(WINAPI CABNOTIFICATIONA)(
  38. IN PCSTR FileName
  39. );
  40. typedef CABNOTIFICATIONA *PCABNOTIFICATIONA;
  41. typedef BOOL(WINAPI CABNOTIFICATIONW)(
  42. IN PCWSTR FileName
  43. );
  44. typedef CABNOTIFICATIONW *PCABNOTIFICATIONW;
  45. typedef PVOID CCABHANDLE;
  46. typedef PVOID OCABHANDLE;
  47. //
  48. // API
  49. //
  50. CCABHANDLE
  51. CabCreateCabinetA (
  52. IN PCSTR CabPath,
  53. IN PCSTR CabFileFormat,
  54. IN PCSTR CabDiskFormat,
  55. IN LONG MaxFileSize
  56. );
  57. CCABHANDLE
  58. CabCreateCabinetW (
  59. IN PCWSTR CabPath,
  60. IN PCWSTR CabFileFormat,
  61. IN PCWSTR CabDiskFormat,
  62. IN LONG MaxFileSize
  63. );
  64. CCABHANDLE
  65. CabCreateCabinetExA (
  66. IN PCABGETCABINETNAMESA CabGetCabinetNames,
  67. IN LONG MaxFileSize
  68. );
  69. CCABHANDLE
  70. CabCreateCabinetExW (
  71. IN PCABGETCABINETNAMESW CabGetCabinetNames,
  72. IN LONG MaxFileSize
  73. );
  74. BOOL
  75. CabAddFileToCabinetA (
  76. IN CCABHANDLE CabHandle,
  77. IN PCSTR FileName,
  78. IN PCSTR StoredName
  79. );
  80. BOOL
  81. CabAddFileToCabinetW (
  82. IN CCABHANDLE CabHandle,
  83. IN PCWSTR FileName,
  84. IN PCWSTR StoredName
  85. );
  86. BOOL
  87. CabFlushAndCloseCabinetExA (
  88. IN CCABHANDLE CabHandle,
  89. OUT PUINT FileCount, OPTIONAL
  90. OUT PLONGLONG FileSize, OPTIONAL
  91. OUT PUINT CabFileCount, OPTIONAL
  92. OUT PLONGLONG CabFileSize OPTIONAL
  93. );
  94. #define CabFlushAndCloseCabinetA(h) CabFlushAndCloseCabinetExA(h,NULL,NULL,NULL,NULL)
  95. BOOL
  96. CabFlushAndCloseCabinetExW (
  97. IN CCABHANDLE CabHandle,
  98. OUT PUINT FileCount, OPTIONAL
  99. OUT PLONGLONG FileSize, OPTIONAL
  100. OUT PUINT CabFileCount, OPTIONAL
  101. OUT PLONGLONG CabFileSize OPTIONAL
  102. );
  103. #define CabFlushAndCloseCabinetW(h) CabFlushAndCloseCabinetExW(h,NULL,NULL,NULL,NULL)
  104. OCABHANDLE
  105. CabOpenCabinetA (
  106. IN PCSTR FileName
  107. );
  108. OCABHANDLE
  109. CabOpenCabinetW (
  110. IN PCWSTR FileName
  111. );
  112. BOOL
  113. CabExtractAllFilesExA (
  114. IN OCABHANDLE CabHandle,
  115. IN PCSTR ExtractPath,
  116. IN PCABNOTIFICATIONA CabNotification OPTIONAL
  117. );
  118. #define CabExtractAllFilesA(h,p) CabExtractAllFilesExA(h,p,NULL)
  119. BOOL
  120. CabExtractAllFilesExW (
  121. IN OCABHANDLE CabHandle,
  122. IN PCWSTR ExtractPath,
  123. IN PCABNOTIFICATIONW CabNotification OPTIONAL
  124. );
  125. #define CabExtractAllFilesW(h,p) CabExtractAllFilesExW(h,p,NULL)
  126. BOOL
  127. CabCloseCabinetA (
  128. IN OCABHANDLE CabHandle
  129. );
  130. BOOL
  131. CabCloseCabinetW (
  132. IN OCABHANDLE CabHandle
  133. );
  134. BOOL
  135. CabVerifyCabinet (
  136. IN OCABHANDLE CabHandle
  137. );
  138. //
  139. // Macros
  140. //
  141. #ifdef UNICODE
  142. #define CABGETCABINETNAMES CABGETCABINETNAMESW
  143. #define PCABGETCABINETNAMES PCABGETCABINETNAMESW
  144. #define CABNOTIFICATION CABNOTIFICATIONA
  145. #define PCABNOTIFICATION PCABNOTIFICATIONA
  146. #define CabCreateCabinet CabCreateCabinetW
  147. #define CabCreateCabinetEx CabCreateCabinetExW
  148. #define CabAddFileToCabinet CabAddFileToCabinetW
  149. #define CabFlushAndCloseCabinet CabFlushAndCloseCabinetW
  150. #define CabFlushAndCloseCabinetEx CabFlushAndCloseCabinetExW
  151. #define CabOpenCabinet CabOpenCabinetW
  152. #define CabExtractAllFilesEx CabExtractAllFilesExW
  153. #define CabExtractAllFiles CabExtractAllFilesW
  154. #define CabCloseCabinet CabCloseCabinetW
  155. #else
  156. #define CABGETCABINETNAMES CABGETCABINETNAMESA
  157. #define PCABGETCABINETNAMES PCABGETCABINETNAMESA
  158. #define CABNOTIFICATION CABNOTIFICATIONW
  159. #define PCABNOTIFICATION PCABNOTIFICATIONW
  160. #define CabCreateCabinet CabCreateCabinetA
  161. #define CabCreateCabinetEx CabCreateCabinetExA
  162. #define CabAddFileToCabinet CabAddFileToCabinetA
  163. #define CabFlushAndCloseCabinet CabFlushAndCloseCabinetA
  164. #define CabFlushAndCloseCabinetEx CabFlushAndCloseCabinetExA
  165. #define CabOpenCabinet CabOpenCabinetA
  166. #define CabExtractAllFilesEx CabExtractAllFilesExA
  167. #define CabExtractAllFiles CabExtractAllFilesA
  168. #define CabCloseCabinet CabCloseCabinetA
  169. #endif