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.

405 lines
9.6 KiB

  1. /*
  2. * ESEBCLI2.H
  3. *
  4. * Microsoft Exchange
  5. * Copyright (C) 1986-1996, Microsoft Corporation
  6. *
  7. * Contains declarations of additional definitions and interfaces
  8. * for the ESE Online Backup Client APIs.
  9. */
  10. #ifndef _ESEBCLI2_
  11. #define _ESEBCLI2_
  12. #include <stdio.h>
  13. #include <time.h>
  14. #include "esebkmsg.h" // included for the definition of errors
  15. // Common types
  16. typedef long ERR;
  17. typedef void *HCCX; // client context handle
  18. #ifdef MIDL_PASS
  19. #define RPC_STRING [unique, string] WCHAR *
  20. #define RPC_SIZE(X) [size_is(X)]
  21. #else // ! MIDL_PASS
  22. #include <objbase.h>
  23. #include <initguid.h>
  24. #include <mapiguid.h>
  25. typedef long HRESULT;
  26. #if !defined(_NATIVE_WCHAR_T_DEFINED)
  27. typedef unsigned short WCHAR;
  28. #else
  29. typedef wchar_t WCHAR;
  30. #endif
  31. #define RPC_STRING WCHAR *
  32. #define RPC_SIZE(X)
  33. #define IN
  34. #define OUT
  35. #endif // MIDL_PASS
  36. #define ESEBACK_API __stdcall
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. typedef struct _ESE_ICON_DESCRIPTION
  41. {
  42. unsigned long ulSize;
  43. RPC_SIZE(ulSize) char * pvData;
  44. } ESE_ICON_DESCRIPTION;
  45. #define DATABASE_MOUNTED 0x00000010
  46. typedef struct _DATABASE_BACKUP_INFO
  47. {
  48. RPC_STRING wszDatabaseDisplayName;
  49. unsigned long cwDatabaseStreams;
  50. RPC_SIZE(cwDatabaseStreams) WCHAR * wszDatabaseStreams;
  51. GUID guidDatabase;
  52. unsigned long ulIconIndexDatabase;
  53. unsigned long fDatabaseFlags;
  54. } DATABASE_BACKUP_INFO;
  55. typedef struct _INSTANCE_BACKUP_INFO
  56. {
  57. __int64 hInstanceId;
  58. RPC_STRING wszInstanceName;
  59. unsigned long ulIconIndexInstance;
  60. unsigned long cDatabase;
  61. RPC_SIZE(cDatabase) DATABASE_BACKUP_INFO * rgDatabase;
  62. unsigned long cIconDescription;
  63. RPC_SIZE(cIconDescription) ESE_ICON_DESCRIPTION * rgIconDescription;
  64. } INSTANCE_BACKUP_INFO;
  65. //
  66. // Type of backup passed into HrESEBackupSetup()
  67. //
  68. #define BACKUP_TYPE_FULL 0x01
  69. #define BACKUP_TYPE_LOGS_ONLY 0x02
  70. #define BACKUP_TYPE_FULL_WITH_ALL_LOGS 0x03
  71. #define BACKUP_TYPE_SNAPSHOT 0x04
  72. typedef struct _ESE_REGISTERED_INFO
  73. {
  74. RPC_STRING wszDisplayName;
  75. RPC_STRING wszEndpointAnnotation;
  76. unsigned long fFlags;
  77. ESE_ICON_DESCRIPTION iconDescription;
  78. } ESE_REGISTERED_INFO;
  79. #define ESE_REGISTER_BACKUP 0x00000001
  80. #define ESE_REGISTER_ONLINE_RESTORE 0x00000002
  81. #define ESE_REGISTER_OFFLINE_RESTORE 0x00000004
  82. #define ESE_REGISTER_SNAPSHOT_BACKUP 0x00000010
  83. HRESULT ESEBACK_API HrESEBackupRestoreGetRegistered(
  84. IN WCHAR * wszServerName,
  85. IN WCHAR * wszDisplayName,
  86. IN unsigned long fFlags,
  87. OUT unsigned long * pcRegisteredInfo,
  88. OUT ESE_REGISTERED_INFO ** paRegisteredInfo
  89. );
  90. void ESEBACK_API ESEBackupRestoreFreeRegisteredInfo(
  91. IN unsigned long cRegisteredInfo,
  92. IN ESE_REGISTERED_INFO * aRegisteredInfo);
  93. HRESULT ESEBACK_API HrESEBackupPrepare(
  94. IN WCHAR * wszBackupServer,
  95. IN WCHAR * wszBackupAnnotation,
  96. OUT unsigned long * pcInstanceInfo,
  97. OUT INSTANCE_BACKUP_INFO ** paInstanceInfo,
  98. OUT HCCX * phccxBackupContext
  99. );
  100. HRESULT ESEBACK_API HrESEBackupSetup(
  101. IN HCCX hccxBackupContext,
  102. IN __int64 hInstanceId,
  103. IN unsigned long btBackupType
  104. );
  105. HRESULT ESEBACK_API HrESEBackupTruncateLogs(
  106. IN HCCX hccxBackupContext
  107. );
  108. HRESULT ESEBACK_API HrESEBackupGetDependencyInfo(
  109. IN HCCX hccxBackupContext,
  110. OUT WCHAR ** pwszInfo,
  111. OUT unsigned long * pcwInfo,
  112. OUT WCHAR ** pwszAnnotation
  113. );
  114. HRESULT ESEBACK_API HrESEBackupOpenFile (
  115. IN HCCX hccxBackupContext,
  116. IN WCHAR * wszFileName,
  117. IN unsigned long cbReadHintSize,
  118. IN unsigned long cSections,
  119. OUT void ** rghFile,
  120. OUT __int64 * rgliSectionSize
  121. );
  122. HRESULT ESEBACK_API HrESEBackupReadFile(
  123. IN HCCX hccxBackupContext,
  124. IN void * hFile,
  125. IN void * pvBuffer,
  126. IN unsigned long cbBuffer,
  127. OUT unsigned long * pcbRead
  128. );
  129. HRESULT ESEBACK_API HrESEBackupCloseFile(
  130. IN HCCX hccxBackupContext,
  131. IN void * hFile
  132. );
  133. HRESULT ESEBACK_API HrESEBackupGetLogAndPatchFiles(
  134. IN HCCX hccxBackupContext,
  135. IN WCHAR ** pwszFiles
  136. );
  137. HRESULT ESEBACK_API HrESEBackupGetTruncateLogFiles(
  138. IN HCCX hccxBackupContext,
  139. IN WCHAR ** pwszFiles
  140. );
  141. void ESEBACK_API ESEBackupFreeInstanceInfo(
  142. IN unsigned long cInstanceInfo,
  143. IN INSTANCE_BACKUP_INFO * aInstanceInfo
  144. );
  145. void ESEBACK_API ESEBackupFree(
  146. IN void * pvBuffer
  147. );
  148. #define ESE_BACKUP_INSTANCE_END_ERROR 0x00000000
  149. #define ESE_BACKUP_INSTANCE_END_SUCCESS 0x00000001
  150. HRESULT ESEBACK_API HrESEBackupInstanceEnd(
  151. IN HCCX hccxBackupContext,
  152. IN unsigned long fFlags
  153. );
  154. HRESULT ESEBACK_API HrESEBackupEnd(
  155. IN HCCX hccxBackupContext
  156. );
  157. // Restore client APIs
  158. typedef enum
  159. {
  160. recoverInvalid = 0,
  161. recoverNotStarted = 1,
  162. recoverStarted = 2,
  163. recoverEnded = 3,
  164. recoverStatusMax
  165. }
  166. RECOVER_STATUS;
  167. typedef struct _RESTORE_ENVIRONMENT
  168. {
  169. WCHAR * m_wszRestoreLogPath;
  170. WCHAR * m_wszSrcInstanceName;
  171. unsigned long m_cDatabases;
  172. WCHAR ** m_wszDatabaseDisplayName;
  173. GUID * m_rguidDatabase;
  174. WCHAR * m_wszRestoreInstanceSystemPath;
  175. WCHAR * m_wszRestoreInstanceLogPath;
  176. WCHAR * m_wszTargetInstanceName;
  177. WCHAR ** m_wszDatabaseStreamsS;
  178. WCHAR ** m_wszDatabaseStreamsD;
  179. unsigned long m_ulGenLow;
  180. unsigned long m_ulGenHigh;
  181. WCHAR * m_wszLogBaseName;
  182. time_t m_timeLastRestore;
  183. RECOVER_STATUS m_statusLastRecover;
  184. HRESULT m_hrLastRecover;
  185. time_t m_timeLastRecover;
  186. WCHAR * m_wszAnnotation;
  187. } RESTORE_ENVIRONMENT;
  188. HRESULT ESEBACK_API HrESERestoreLoadEnvironment(
  189. IN WCHAR * wszServerName,
  190. IN WCHAR * wszRestoreLogPath,
  191. OUT RESTORE_ENVIRONMENT ** ppRestoreEnvironment);
  192. void ESEBACK_API ESERestoreFreeEnvironment(
  193. IN RESTORE_ENVIRONMENT * pRestoreEnvironment);
  194. HRESULT ESEBACK_API HrESERestoreOpen(
  195. IN WCHAR * wszServerName,
  196. IN WCHAR * wszServiceAnnotation,
  197. IN WCHAR * wszSrcInstanceName,
  198. IN WCHAR * wszRestoreLogPath,
  199. OUT HCCX * phccxRestoreContext);
  200. HRESULT ESEBACK_API HrESERestoreReopen(
  201. IN WCHAR * wszServerName,
  202. IN WCHAR * wszServiceAnnotation,
  203. IN WCHAR * wszRestoreLogPath,
  204. OUT HCCX * phccxRestoreContext);
  205. void ESEBACK_API ESERestoreFree( IN void *pvBuffer );
  206. #define RESTORE_CLOSE_ABORT 0x1
  207. #define RESTORE_CLOSE_NORMAL 0x0
  208. HRESULT ESEBACK_API HrESERestoreClose(
  209. IN HCCX hccxRestoreContext,
  210. IN unsigned long fRestoreAbort);
  211. HRESULT ESEBACK_API HrESERestoreAddDatabase(
  212. IN HCCX hccxRestoreContext,
  213. IN WCHAR * wszDatabaseDisplayName,
  214. IN GUID guidDatabase,
  215. IN WCHAR * wszDatabaseStreamsS,
  216. OUT WCHAR ** pwszDatabaseStreamsD);
  217. HRESULT ESEBACK_API HrESERestoreGetEnvironment(
  218. IN HCCX hccxRestoreContext,
  219. OUT RESTORE_ENVIRONMENT ** ppRestoreEnvironment);
  220. HRESULT ESEBACK_API HrESERestoreSaveEnvironment(
  221. IN HCCX hccxRestoreContext);
  222. #define ESE_RESTORE_COMPLETE_ATTACH_DBS 0x00000001
  223. #define ESE_RESTORE_COMPLETE_START_SERVICE ESE_RESTORE_COMPLETE_ATTACH_DBS
  224. #define ESE_RESTORE_COMPLETE_NOWAIT 0x00010000
  225. #define ESE_RESTORE_KEEP_LOG_FILES 0x00020000
  226. HRESULT ESEBACK_API HrESERestoreComplete(
  227. IN HCCX hccxRestoreContext,
  228. IN WCHAR * wszRestoreInstanceSystemPath,
  229. IN WCHAR * wszRestoreInstanceLogPath,
  230. IN WCHAR * wszTargetInstanceName,
  231. IN unsigned long fFlags);
  232. HRESULT ESEBACK_API HrESERestoreAddDatabaseNS(
  233. IN HCCX hccxRestoreContext,
  234. IN WCHAR * wszDatabaseDisplayName,
  235. IN GUID guidDatabase,
  236. IN WCHAR * wszDatabaseStreamsS,
  237. IN WCHAR * wszDatabaseStreamsD);
  238. HRESULT ESEBACK_API HrESERestoreOpenFile (
  239. IN HCCX hccxRestoreContext,
  240. IN WCHAR * wszFileName,
  241. IN unsigned long cSections,
  242. OUT void ** rghFile
  243. );
  244. HRESULT ESEBACK_API HrESERestoreWriteFile(
  245. IN HCCX hccxRestoreContext,
  246. IN void * hFile,
  247. IN void * pvBuffer,
  248. IN unsigned long cbBuffer
  249. );
  250. HRESULT ESEBACK_API HrESERestoreCloseFile(
  251. IN HCCX hccxRestoreContext,
  252. IN void * hFile
  253. );
  254. /* function used to find the computers to be queried for backup/restore */
  255. /* MAD like behaviour */
  256. #define BACKUP_NODE_TYPE_MACHINE 0x00000001
  257. #define BACKUP_NODE_TYPE_ANNOTATION 0x00000010
  258. #define BACKUP_NODE_TYPE_DISPLAY 0x00000100
  259. typedef struct _BACKUP_NODE_TREE
  260. {
  261. RPC_STRING wszName;
  262. unsigned long fFlags;
  263. ESE_ICON_DESCRIPTION iconDescription;
  264. struct _BACKUP_NODE_TREE * pNextNode;
  265. struct _BACKUP_NODE_TREE * pChildNode;
  266. } BACKUP_NODE_TREE, * PBACKUP_NODE_TREE;
  267. HRESULT ESEBACK_API HrESEBackupRestoreGetNodes(
  268. IN WCHAR * wszComputerName,
  269. OUT PBACKUP_NODE_TREE * ppBackupNodeTree);
  270. void ESEBACK_API ESEBackupRestoreFreeNodes(
  271. IN PBACKUP_NODE_TREE pBackupNodeTree);
  272. // Specific errors that can be returned by callback functions
  273. // Database to be restored is in use
  274. #define hrFromCB_DatabaseInUse hrCBDatabaseInUse
  275. // Database not found
  276. #define hrFromCB_DatabaseNotFound hrCBDatabaseNotFound
  277. // Display name for the database not found
  278. #define hrFromCB_DatabaseDisplayNameNotFound hrCBDatabaseDisplayNameNotFound
  279. // Requested path for restore log files not provided
  280. #define hrFromCB_RestorePathNotProvided hrCBRestorePathNotProvided
  281. // Instance to backup not found
  282. #define hrFromCB_InstanceNotFound hrCBInstanceNotFound
  283. // Database can not be overwritten by a restore
  284. #define hrFromCB_DatabaseCantBeOverwritten hrCBDatabaseCantBeOverwritten
  285. // snapshot API
  286. HRESULT ESEBACK_API HrESESnapshotStart(
  287. IN HCCX hccxBackupContext,
  288. IN WCHAR * wszDatabases,
  289. IN unsigned long fFlags );
  290. HRESULT ESEBACK_API HrESESnapshotStop( IN HCCX hccxBackupContext,
  291. IN unsigned long fFlags );
  292. #ifdef __cplusplus
  293. }
  294. #endif
  295. #endif // _EDBBCLI2_