Leaked source code of windows server 2003
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.

231 lines
6.6 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. cablib.h
  5. Abstract:
  6. Set of APIs to enumerate a file system using Win32 APIs.
  7. Author:
  8. 20-Oct-1999 Ovidiu Temereanca (ovidiut) - File creation.
  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 CABGETTEMPFILEA)(
  38. OUT PSTR Buffer,
  39. IN UINT BufferTchars
  40. );
  41. typedef CABGETTEMPFILEA *PCABGETTEMPFILEA;
  42. typedef BOOL(WINAPI CABGETTEMPFILEW)(
  43. OUT PWSTR Buffer,
  44. IN UINT BufferTchars
  45. );
  46. typedef CABGETTEMPFILEW *PCABGETTEMPFILEW;
  47. typedef BOOL(WINAPI CABNOTIFICATIONA)(
  48. IN PCSTR FileName
  49. );
  50. typedef CABNOTIFICATIONA *PCABNOTIFICATIONA;
  51. typedef BOOL(WINAPI CABNOTIFICATIONW)(
  52. IN PCWSTR FileName
  53. );
  54. typedef CABNOTIFICATIONW *PCABNOTIFICATIONW;
  55. typedef PVOID CCABHANDLE;
  56. typedef PVOID OCABHANDLE;
  57. //
  58. // API
  59. //
  60. CCABHANDLE
  61. CabCreateCabinetByIndexA (
  62. IN PCSTR CabPath,
  63. IN PCSTR CabFileFormat,
  64. IN PCSTR CabDiskFormat,
  65. IN PCABGETTEMPFILEA CabGetTempFile, // OPTIONAL
  66. IN LONG MaxFileSize,
  67. IN INT InitialIndex
  68. );
  69. #define CabCreateCabinetA(p,f,d,t,s) CabCreateCabinetByIndexA(p,f,d,t,s,1)
  70. CCABHANDLE
  71. CabCreateCabinetByIndexW (
  72. IN PCWSTR CabPath,
  73. IN PCWSTR CabFileFormat,
  74. IN PCWSTR CabDiskFormat,
  75. IN PCABGETTEMPFILEW CabGetTempFile, // OPTIONAL
  76. IN LONG MaxFileSize,
  77. IN INT InitialIndex
  78. );
  79. #define CabCreateCabinetW(p,f,d,t,s) CabCreateCabinetByIndexW(p,f,d,t,s,1)
  80. CCABHANDLE
  81. CabCreateCabinetExA (
  82. IN PCABGETCABINETNAMESA CabGetCabinetNames,
  83. IN LONG MaxFileSize
  84. );
  85. CCABHANDLE
  86. CabCreateCabinetExW (
  87. IN PCABGETCABINETNAMESW CabGetCabinetNames,
  88. IN LONG MaxFileSize
  89. );
  90. BOOL
  91. CabAddFileToCabinetA (
  92. IN CCABHANDLE CabHandle,
  93. IN PCSTR FileName,
  94. IN PCSTR StoredName
  95. );
  96. BOOL
  97. CabAddFileToCabinetW (
  98. IN CCABHANDLE CabHandle,
  99. IN PCWSTR FileName,
  100. IN PCWSTR StoredName
  101. );
  102. BOOL
  103. CabFlushAndCloseCabinetExA (
  104. IN CCABHANDLE CabHandle,
  105. OUT PUINT FileCount, OPTIONAL
  106. OUT PLONGLONG FileSize, OPTIONAL
  107. OUT PUINT CabFileCount, OPTIONAL
  108. OUT PLONGLONG CabFileSize OPTIONAL
  109. );
  110. #define CabFlushAndCloseCabinetA(h) CabFlushAndCloseCabinetExA(h,NULL,NULL,NULL,NULL)
  111. BOOL
  112. CabFlushAndCloseCabinetExW (
  113. IN CCABHANDLE CabHandle,
  114. OUT PUINT FileCount, OPTIONAL
  115. OUT PLONGLONG FileSize, OPTIONAL
  116. OUT PUINT CabFileCount, OPTIONAL
  117. OUT PLONGLONG CabFileSize OPTIONAL
  118. );
  119. #define CabFlushAndCloseCabinetW(h) CabFlushAndCloseCabinetExW(h,NULL,NULL,NULL,NULL)
  120. OCABHANDLE
  121. CabOpenCabinetA (
  122. IN PCSTR FileName
  123. );
  124. OCABHANDLE
  125. CabOpenCabinetW (
  126. IN PCWSTR FileName
  127. );
  128. BOOL
  129. CabExtractAllFilesExA (
  130. IN OCABHANDLE CabHandle,
  131. IN PCSTR ExtractPath,
  132. IN PCABNOTIFICATIONA CabNotification OPTIONAL
  133. );
  134. #define CabExtractAllFilesA(h,p) CabExtractAllFilesExA(h,p,NULL)
  135. BOOL
  136. CabExtractAllFilesExW (
  137. IN OCABHANDLE CabHandle,
  138. IN PCWSTR ExtractPath,
  139. IN PCABNOTIFICATIONW CabNotification OPTIONAL
  140. );
  141. #define CabExtractAllFilesW(h,p) CabExtractAllFilesExW(h,p,NULL)
  142. BOOL
  143. CabCloseCabinetA (
  144. IN OCABHANDLE CabHandle
  145. );
  146. BOOL
  147. CabCloseCabinetW (
  148. IN OCABHANDLE CabHandle
  149. );
  150. //
  151. // Macros
  152. //
  153. #ifdef UNICODE
  154. #define CABGETCABINETNAMES CABGETCABINETNAMESW
  155. #define PCABGETCABINETNAMES PCABGETCABINETNAMESW
  156. #define CABNOTIFICATION CABNOTIFICATIONW
  157. #define PCABNOTIFICATION PCABNOTIFICATIONW
  158. #define CABGETTEMPFILE CABGETTEMPFILEW
  159. #define PCABGETTEMPFILE PCABGETTEMPFILEW
  160. #define CabCreateCabinet CabCreateCabinetW
  161. #define CabCreateCabinetByIndex CabCreateCabinetByIndexW
  162. #define CabCreateCabinetEx CabCreateCabinetExW
  163. #define CabAddFileToCabinet CabAddFileToCabinetW
  164. #define CabFlushAndCloseCabinet CabFlushAndCloseCabinetW
  165. #define CabFlushAndCloseCabinetEx CabFlushAndCloseCabinetExW
  166. #define CabOpenCabinet CabOpenCabinetW
  167. #define CabExtractAllFilesEx CabExtractAllFilesExW
  168. #define CabExtractAllFiles CabExtractAllFilesW
  169. #define CabCloseCabinet CabCloseCabinetW
  170. #else
  171. #define CABGETCABINETNAMES CABGETCABINETNAMESA
  172. #define PCABGETCABINETNAMES PCABGETCABINETNAMESA
  173. #define CABNOTIFICATION CABNOTIFICATIONA
  174. #define PCABNOTIFICATION PCABNOTIFICATIONA
  175. #define CABGETTEMPFILE CABGETTEMPFILEA
  176. #define PCABGETTEMPFILE PCABGETTEMPFILEA
  177. #define CabCreateCabinet CabCreateCabinetA
  178. #define CabCreateCabinetByIndex CabCreateCabinetByIndexA
  179. #define CabCreateCabinetEx CabCreateCabinetExA
  180. #define CabAddFileToCabinet CabAddFileToCabinetA
  181. #define CabFlushAndCloseCabinet CabFlushAndCloseCabinetA
  182. #define CabFlushAndCloseCabinetEx CabFlushAndCloseCabinetExA
  183. #define CabOpenCabinet CabOpenCabinetA
  184. #define CabExtractAllFilesEx CabExtractAllFilesExA
  185. #define CabExtractAllFiles CabExtractAllFilesA
  186. #define CabCloseCabinet CabCloseCabinetA
  187. #endif