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.

417 lines
7.8 KiB

  1. /*
  2. * EDBBCLI.H
  3. *
  4. * Microsoft Exchange Information Store
  5. * Copyright (C) 1986-1996, Microsoft Corporation
  6. *
  7. * Contains declarations of additional definitions and interfaces
  8. * for the Exchange Online Backup Client APIs.
  9. */
  10. #ifndef _EDBBCLI_
  11. #define _EDBBCLI_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifdef MIDL_PASS
  16. #define RPC_STRING [string]
  17. #else
  18. #define RPC_STRING
  19. #if !defined(_NATIVE_WCHAR_T_DEFINED)
  20. typedef unsigned short WCHAR;
  21. #else
  22. typedef wchar_t WCHAR;
  23. #endif
  24. #endif
  25. #define EDBBACK_MDB_SERVER "Exchange MDB Database"
  26. #define EDBBACK_DS_SERVER "Exchange DS Database"
  27. #define EDBBACK_API __stdcall
  28. //
  29. // Useful types.
  30. //
  31. // UNDONE: HRESULT should be DWORD (unsigned)
  32. //typedef DWORD HRESULT;
  33. #ifndef MIDL_PASS
  34. typedef LONG HRESULT;
  35. #endif
  36. typedef LONG ERR;
  37. typedef LONG C;
  38. typedef TCHAR BFT;
  39. //
  40. // Type of backup passed into HrBackupPrepare()
  41. //
  42. #define BACKUP_TYPE_FULL 0x01
  43. #define BACKUP_TYPE_LOGS_ONLY 0x02
  44. //
  45. // Set the current log number to this value to disable incremental or
  46. // differential backup.
  47. //
  48. #define BACKUP_DISABLE_INCREMENTAL 0xffffffff
  49. //
  50. // Backup/Restore file types
  51. //
  52. //
  53. // Please note that these file types are binary values, even though they are text (or wchar) typed.
  54. //
  55. // The code in the backup API's rely on the fact that values 0-256 in 8 bit ascii map to the values 0-256 in unicode.
  56. //
  57. //
  58. // If the BFT_DIRECTORY bit is set on the backup file type, it indicates that the path specified is a directory,
  59. // otherwise it is a file name.
  60. //
  61. #define BFT_DIRECTORY 0x80
  62. //
  63. // If the BFT_DATABASE bit is set on the backup file type, it indicates that the file goes into the database directory.
  64. //
  65. #define BFT_DATABASE_DIRECTORY 0x40
  66. //
  67. // If the BFT_LOG bit is set on the backup file type, it indicates that the file goes into the log directory.
  68. //
  69. #define BFT_LOG_DIRECTORY 0x20
  70. //
  71. // Database logs.
  72. //
  73. #define BFT_LOG (BFT)(TEXT('\x01') | BFT_LOG_DIRECTORY)
  74. #define BFT_LOG_DIR (BFT)(TEXT('\x02') | BFT_DIRECTORY)
  75. //
  76. // Checkpoint file.
  77. //
  78. #define BFT_CHECKPOINT_DIR (BFT)(TEXT('\x03') | BFT_DIRECTORY)
  79. //
  80. // Database types.
  81. //
  82. #define BFT_MDB_PRIVATE_DATABASE (BFT)(TEXT('\x05') | BFT_DATABASE_DIRECTORY)
  83. #define BFT_MDB_PUBLIC_DATABASE (BFT)(TEXT('\x06') | BFT_DATABASE_DIRECTORY)
  84. #define BFT_DSA_DATABASE (BFT)(TEXT('\x07') | BFT_DATABASE_DIRECTORY)
  85. //
  86. // JET patch files
  87. //
  88. //
  89. //
  90. #define BFT_PATCH_FILE (BFT)(TEXT('\x08') | BFT_LOG_DIRECTORY)
  91. //
  92. // Catch all for unknown file types.
  93. //
  94. #define BFT_UNKNOWN (BFT)(TEXT('\x0f'))
  95. #include <edbmsg.h>
  96. typedef void *HBC;
  97. typedef struct tagEDB_RSTMAPA
  98. {
  99. RPC_STRING char *szDatabaseName;
  100. RPC_STRING char *szNewDatabaseName;
  101. } EDB_RSTMAPA, *PEDB_RSTMAPA; /* restore map */
  102. // required for Exchange unicode support.
  103. // UNDONE: NYI
  104. #define UNICODE_RSTMAP
  105. typedef struct tagEDB_RSTMAPW {
  106. RPC_STRING WCHAR *wszDatabaseName;
  107. RPC_STRING WCHAR *wszNewDatabaseName;
  108. } EDB_RSTMAPW, *PEDB_RSTMAPW;
  109. #ifdef UNICODE
  110. #define EDB_RSTMAP EDB_RSTMAPW
  111. #define PEDB_RSTMAP PEDB_RSTMAPW
  112. #else
  113. #define EDB_RSTMAP EDB_RSTMAPA
  114. #define PEDB_RSTMAP PEDB_RSTMAPA
  115. #endif
  116. ERR
  117. EDBBACK_API
  118. HrBackupPrepareA(
  119. IN char * szBackupServer,
  120. IN char * szBackupAnnotation,
  121. IN unsigned long grbit,
  122. IN unsigned long btBackupType,
  123. OUT HBC *hbcBackupContext
  124. );
  125. ERR
  126. EDBBACK_API
  127. HrBackupPrepareW(
  128. IN WCHAR * wszBackupServer,
  129. IN WCHAR * wszBackupAnnotation,
  130. IN unsigned long grbit,
  131. IN unsigned long btBackupType,
  132. OUT HBC *hbcBackupContext
  133. );
  134. #ifdef UNICODE
  135. #define HrBackupPrepare HrBackupPrepareW
  136. #else
  137. #define HrBackupPrepare HrBackupPrepareA
  138. #endif
  139. ERR
  140. EDBBACK_API
  141. HrBackupGetDatabaseNamesA(
  142. IN HBC pvBackupContext,
  143. OUT LPSTR *ppszAttachmentInformation,
  144. OUT LPDWORD pcbSize
  145. );
  146. ERR
  147. EDBBACK_API
  148. HrBackupGetDatabaseNamesW(
  149. IN HBC pvBackupContext,
  150. OUT LPWSTR *ppszAttachmentInformation,
  151. OUT LPDWORD pcbSize
  152. );
  153. #ifdef UNICODE
  154. #define HrBackupGetDatabaseNames HrBackupGetDatabaseNamesW
  155. #else
  156. #define HrBackupGetDatabaseNames HrBackupGetDatabaseNamesA
  157. #endif
  158. ERR
  159. EDBBACK_API
  160. HrBackupOpenFileW(
  161. IN HBC pvBackupContext,
  162. IN WCHAR * wszAttachmentName,
  163. IN DWORD cbReadHintSize,
  164. OUT LARGE_INTEGER *pliFileSize
  165. );
  166. ERR
  167. EDBBACK_API
  168. HrBackupOpenFileA(
  169. IN HBC pvBackupContext,
  170. IN char * szAttachmentName,
  171. IN DWORD cbReadHintSize,
  172. OUT LARGE_INTEGER *pliFileSize
  173. );
  174. #ifdef UNICODE
  175. #define HrBackupOpenFile HrBackupOpenFileW
  176. #else
  177. #define HrBackupOpenFile HrBackupOpenFileA
  178. #endif
  179. ERR
  180. EDBBACK_API
  181. HrBackupRead(
  182. IN HBC pvBackupContext,
  183. IN PVOID pvBuffer,
  184. IN DWORD cbBuffer,
  185. OUT PDWORD pcbRead
  186. );
  187. ERR
  188. EDBBACK_API
  189. HrBackupClose(
  190. IN HBC pvBackupContext
  191. );
  192. ERR
  193. EDBBACK_API
  194. HrBackupGetBackupLogsA(
  195. IN HBC pvBackupContext,
  196. IN LPSTR *szBackupLogFile,
  197. IN PDWORD pcbSize
  198. );
  199. ERR
  200. EDBBACK_API
  201. HrBackupGetBackupLogsW(
  202. IN HBC pvBackupContext,
  203. IN LPWSTR *szBackupLogFile,
  204. IN PDWORD pcbSize
  205. );
  206. #ifdef UNICODE
  207. #define HrBackupGetBackupLogs HrBackupGetBackupLogsW
  208. #else
  209. #define HrBackupGetBackupLogs HrBackupGetBackupLogsA
  210. #endif
  211. ERR
  212. EDBBACK_API
  213. HrBackupTruncateLogs(
  214. IN HBC pvBackupContext
  215. );
  216. ERR
  217. EDBBACK_API
  218. HrBackupEnd(
  219. IN HBC pvBackupContext
  220. );
  221. VOID
  222. EDBBACK_API
  223. BackupFree(
  224. IN PVOID pvBuffer
  225. );
  226. ERR
  227. EDBBACK_API
  228. HrRestoreGetDatabaseLocationsA(
  229. IN HBC hbcBackupContext,
  230. OUT LPSTR *ppszDatabaseLocationList,
  231. OUT LPDWORD pcbSize
  232. );
  233. ERR
  234. EDBBACK_API
  235. HrRestoreGetDatabaseLocationsW(
  236. IN HBC pvBackupContext,
  237. OUT LPWSTR *ppszDatabaseLocationList,
  238. OUT LPDWORD pcbSize
  239. );
  240. #ifdef UNICODE
  241. #define HrRestoreGetDatabaseLocations HrRestoreGetDatabaseLocationsW
  242. #else
  243. #define HrRestoreGetDatabaseLocations HrRestoreGetDatabaseLocationsA
  244. #endif
  245. ERR
  246. EDBBACK_API
  247. HrRestorePrepareA(
  248. char * szServerName,
  249. char * szServiceAnnotation,
  250. HBC *phbcBackupContext
  251. );
  252. ERR
  253. EDBBACK_API
  254. HrRestorePrepareW(
  255. WCHAR * szServerName,
  256. WCHAR * szServiceAnnotation,
  257. HBC *phbcBackupContext
  258. );
  259. #ifdef UNICODE
  260. #define HrRestorePrepare HrRestorePrepareW
  261. #else
  262. #define HrRestorePrepare HrRestorePrepareA
  263. #endif
  264. //
  265. // HrRestoreRegister will register a restore
  266. // operation. It will interlock all subsequent
  267. // restore operations, and will prevent the restore target
  268. // from starting until the call to HrRestoreRegisterComplete.
  269. //
  270. ERR
  271. EDBBACK_API
  272. HrRestoreRegisterA(
  273. IN HBC hbcRestoreContext,
  274. IN char * szCheckpointFilePath,
  275. IN char * szLogPath,
  276. IN EDB_RSTMAPA rgrstmap[],
  277. IN C crstmap,
  278. IN char * szBackupLogPath,
  279. IN ULONG genLow,
  280. IN ULONG genHigh
  281. );
  282. ERR
  283. EDBBACK_API
  284. HrRestoreRegisterW(
  285. IN HBC hbcRestoreContext,
  286. IN WCHAR * wszCheckpointFilePath,
  287. IN WCHAR * wszLogPath,
  288. IN EDB_RSTMAPW rgrstmap[],
  289. IN C crstmap,
  290. IN WCHAR * wszBackupLogPath,
  291. IN ULONG genLow,
  292. IN ULONG genHigh
  293. );
  294. #ifdef UNICODE
  295. #define HrRestoreRegister HrRestoreRegisterW
  296. #else
  297. #define HrRestoreRegister HrRestoreRegisterA
  298. #endif
  299. //
  300. // HrRestoreRegisterComplete will complete a restore
  301. // operation. It will allow further subsequent
  302. // restore operations, and will allow the restore target
  303. // to start if hrRestoreState is success.
  304. //
  305. // If hrRestoreState is NOT hrNone, this will
  306. // prevent the restore target from restarting.
  307. //
  308. ERR
  309. EDBBACK_API
  310. HrRestoreRegisterComplete(
  311. HBC hbcRestoreContext,
  312. ERR hrRestoreState
  313. );
  314. ERR
  315. EDBBACK_API
  316. HrRestoreEnd(
  317. HBC hbcRestoreContext
  318. );
  319. ERR
  320. EDBBACK_API
  321. HrSetCurrentBackupLogW(
  322. WCHAR *wszServerName,
  323. WCHAR * wszBackupAnnotation,
  324. DWORD dwCurrentLog
  325. );
  326. ERR
  327. EDBBACK_API
  328. HrSetCurrentBackupLogA(
  329. CHAR * szServerName,
  330. CHAR * szBackupAnnotation,
  331. DWORD dwCurrentLog
  332. );
  333. #ifdef UNICODE
  334. #define HrSetCurrentBackupLog HrSetCurrentBackupLogW
  335. #else
  336. #define HrSetCurrentBackupLog HrSetCurrentBackupLogA
  337. #endif
  338. #ifdef __cplusplus
  339. }
  340. #endif
  341. #endif // _EDBBCLI_
  342.