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.

948 lines
30 KiB

  1. /*++ BUILD Version: 0001 Increment if a change has global effects
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. ntfrsipi.h
  5. Abstract:
  6. Header file for the internal programmer's interfaces
  7. to the File Replication Service (NtFrs).
  8. Functions are in ntfrsapi.dll.
  9. Environment:
  10. User Mode - Win32
  11. Notes:
  12. --*/
  13. #ifndef _NTFRSIPI_H_
  14. #define _NTFRSIPI_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. DWORD
  19. WINAPI
  20. NtFrsApi_PrepareForPromotionW(
  21. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG) OPTIONAL
  22. );
  23. /*++
  24. Routine Description:
  25. The NtFrs service seeds the system volume during the promotion
  26. of a server to a Domain Controller (DC). The files and directories
  27. for the system volume come from the same machine that is supplying
  28. the initial Directory Service (DS).
  29. This function prepares the NtFrs service on this machine for
  30. promotion by stopping the service, deleting old promotion
  31. state in the registry, and restarting the service.
  32. This function is not idempotent and isn't MT safe.
  33. Arguments:
  34. None.
  35. Return Value:
  36. Win32 Status
  37. --*/
  38. DWORD
  39. WINAPI
  40. NtFrsApi_PrepareForDemotionW(
  41. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG) OPTIONAL
  42. );
  43. /*++
  44. Routine Description:
  45. The NtFrs service replicates the enterprise system volume to all
  46. Domain Controllers (DCs) and replicates the domain system volume
  47. to the DCs in a domain until the DC is demoted to a member server.
  48. Replication is stopped by tombstoning the system volume's replica
  49. set.
  50. This function prepares the NtFrs service on this machine for
  51. demotion by stopping the service, deleting old demotion
  52. state in the registry, and restarting the service.
  53. This function is not idempotent and isn't MT safe.
  54. Arguments:
  55. None.
  56. Return Value:
  57. Win32 Status
  58. --*/
  59. //
  60. // Replica set types for parameter ReplicaSetType below
  61. //
  62. #define NTFRSAPI_REPLICA_SET_TYPE_ENTERPRISE L"Enterprise"
  63. #define NTFRSAPI_REPLICA_SET_TYPE_DOMAIN L"Domain"
  64. #define NTFRSAPI_REPLICA_SET_TYPE_DFS L"DFS"
  65. #define NTFRSAPI_REPLICA_SET_TYPE_OTHER L"Other"
  66. #define NTFRSAPI_SERVICE_STATE_IS_UNKNOWN (00)
  67. #define NTFRSAPI_SERVICE_PROMOTING (10)
  68. #define NTFRSAPI_SERVICE_DEMOTING (20)
  69. #define NTFRSAPI_SERVICE_DONE (99)
  70. DWORD
  71. WINAPI
  72. NtFrsApi_StartPromotionW(
  73. IN PWCHAR ParentComputer, OPTIONAL
  74. IN PWCHAR ParentAccount, OPTIONAL
  75. IN PWCHAR ParentPassword, OPTIONAL
  76. IN DWORD DisplayCallBack(IN PWCHAR Display), OPTIONAL
  77. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG), OPTIONAL
  78. IN PWCHAR ReplicaSetName,
  79. IN PWCHAR ReplicaSetType,
  80. IN DWORD ReplicaSetPrimary,
  81. IN PWCHAR ReplicaSetStage,
  82. IN PWCHAR ReplicaSetRoot
  83. );
  84. /*++
  85. Routine Description:
  86. The NtFrs service seeds the system volume during the promotion
  87. of a server to a Domain Controller (DC). The files and directories
  88. for the system volume come from the same machine that is supplying
  89. the initial Directory Service (DS).
  90. This function kicks off a thread that updates the sysvol information
  91. in the registry and initiates the seeding process. The thread tracks
  92. the progress of the seeding and periodically informs the caller.
  93. The threads started by NtFrsApi_StartPromotionW can be forcefully
  94. terminated with NtFrsApi_AbortPromotionW.
  95. The threads started by NtFrsApi_StartPromotionW can be waited on
  96. with NtFrsApi_WaitForPromotionW.
  97. Arguments:
  98. ParentComputer - An RPC-bindable name of the computer that is
  99. supplying the Directory Service (DS) with its
  100. initial state. The files and directories for
  101. the system volume are replicated from this
  102. parent computer.
  103. ParentAccount - A logon account on ParentComputer.
  104. ParentPassword - The logon account's password on ParentComputer.
  105. DisplayCallBack - Called periodically with a progress display.
  106. ReplicaSetName - Name of the replica set.
  107. ReplicaSetType - Type of replica set (enterprise or domain)
  108. ReplicaSetPrimary - Is this the primary member of the replica set?
  109. - 1 = primary; 0 = not.
  110. ReplicaSetStage - Staging path.
  111. ReplicaSetRoot - Root path.
  112. Return Value:
  113. Win32 Status
  114. --*/
  115. DWORD
  116. WINAPI
  117. NtFrsApi_StartDemotionW(
  118. IN PWCHAR ReplicaSetName,
  119. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG) OPTIONAL
  120. );
  121. /*++
  122. Routine Description:
  123. The NtFrs service replicates the enterprise system volume to all
  124. Domain Controllers (DCs) and replicates the domain system volume
  125. to the DCs in a domain until the DC is demoted to a member server.
  126. Replication is stopped by tombstoning the system volume's replica
  127. set.
  128. This function kicks off a thread that stops replication of the
  129. system volume on this machine by telling the NtFrs service on
  130. this machine to tombstone the system volume's replica set.
  131. The threads started by NtFrsApi_StartDemotionW can be forcefully
  132. terminated with NtFrsApi_AbortDemotionW.
  133. The threads started by NtFrsApi_StartDemotionW can be waited on
  134. with NtFrsApi_WaitForDemotionW.
  135. Arguments:
  136. ReplicaSetName - Name of the replica set.
  137. Return Value:
  138. Win32 Status
  139. --*/
  140. DWORD
  141. WINAPI
  142. NtFrsApi_WaitForPromotionW(
  143. IN DWORD TimeoutInMilliSeconds,
  144. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG) OPTIONAL
  145. );
  146. /*++
  147. Routine Description:
  148. The NtFrs service seeds the system volume during the promotion
  149. of a server to a Domain Controller (DC). The files and directories
  150. for the system volume come from the same machine that is supplying
  151. the initial Directory Service (DS).
  152. This function waits for the seeding to finish or to stop w/error.
  153. Arguments:
  154. TimeoutInMilliSeconds - Timeout in milliseconds for waiting for
  155. seeding to finish. INFINITE if no timeout.
  156. Return Value:
  157. Win32 Status
  158. --*/
  159. DWORD
  160. WINAPI
  161. NtFrsApi_WaitForDemotionW(
  162. IN DWORD TimeoutInMilliSeconds,
  163. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG) OPTIONAL
  164. );
  165. /*++
  166. Routine Description:
  167. The NtFrs service replicates the enterprise system volume to all
  168. Domain Controllers (DCs) and replicates the domain system volume
  169. to the DCs in a domain until the DC is demoted to a member server.
  170. Replication is stopped by tombstoning the system volume's replica
  171. set.
  172. This function waits for the tombstoning to finish or to stop w/error.
  173. Arguments:
  174. TimeoutInMilliSeconds - Timeout in milliseconds for waiting for
  175. seeding to finish. INFINITE if no timeout.
  176. Return Value:
  177. Win32 Status
  178. --*/
  179. DWORD
  180. WINAPI
  181. NtFrsApi_CommitPromotionW(
  182. IN DWORD TimeoutInMilliSeconds,
  183. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG) OPTIONAL
  184. );
  185. /*++
  186. Routine Description:
  187. WARNING - This function assumes the caller will reboot the system
  188. soon after this call!
  189. The NtFrs service seeds the system volume during the promotion
  190. of a server to a Domain Controller (DC). The files and directories
  191. for the system volume come from the same machine that is supplying
  192. the initial Directory Service (DS).
  193. This function waits for the seeding to finish, stops the service,
  194. and commits the state in the registry. On reboot, the NtFrs Service
  195. updates the DS on this machine with the information in the registry.
  196. Arguments:
  197. TimeoutInMilliSeconds - Timeout in milliseconds for waiting for
  198. seeding to finish. INFINITE if no timeout.
  199. Return Value:
  200. Win32 Status
  201. --*/
  202. DWORD
  203. WINAPI
  204. NtFrsApi_CommitDemotionW(
  205. IN DWORD TimeoutInMilliSeconds,
  206. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG) OPTIONAL
  207. );
  208. /*++
  209. Routine Description:
  210. WARNING - This function assumes the caller will reboot the system
  211. soon after this call!
  212. The NtFrs service replicates the enterprise system volume to all
  213. Domain Controllers (DCs) and replicates the domain system volume
  214. to the DCs in a domain until the DC is demoted to a member server.
  215. Replication is stopped by tombstoning the system volume's replica
  216. set.
  217. This function waits for the tombstoning to finish, tells the service
  218. to forcibly delete the system volumes' replica sets, stops the service,
  219. and commits the state in the registry. On reboot, the NtFrs Service
  220. updates the DS on this machine with the information in the registry.
  221. Arguments:
  222. TimeoutInMilliSeconds - Timeout in milliseconds for waiting for
  223. tombstoning to finish. INFINITE if no timeout.
  224. Return Value:
  225. Win32 Status
  226. --*/
  227. DWORD
  228. WINAPI
  229. NtFrsApi_AbortPromotionW(
  230. VOID
  231. );
  232. /*++
  233. Routine Description:
  234. The NtFrs service seeds the system volume during the promotion
  235. of a server to a Domain Controller (DC). The files and directories
  236. for the system volume come from the same machine that is supplying
  237. the initial Directory Service (DS).
  238. This function aborts the seeding process by stopping the service,
  239. deleting the promotion state out of the registry, cleaning up
  240. the active threads and the active RPC calls, and finally resetting
  241. the service to its pre-seeding state.
  242. Arguments:
  243. None.
  244. Return Value:
  245. Win32 Status
  246. --*/
  247. DWORD
  248. WINAPI
  249. NtFrsApi_AbortDemotionW(
  250. VOID
  251. );
  252. /*++
  253. Routine Description:
  254. The NtFrs service replicates the enterprise system volume to all
  255. Domain Controllers (DCs) and replicates the domain system volume
  256. to the DCs in a domain until the DC is demoted to a member server.
  257. During demotion, NtFrsApi_StartDemotionW stops replication of
  258. the system volume on this machine by telling the NtFrs service
  259. on this machine to tombstone the system volume's replica set.
  260. This function aborts the tombstoning process by stopping the service,
  261. deleting the demotion state out of the registry, cleaning up
  262. the active threads and the active RPC calls, and finally resetting
  263. the service to its pre-tombstoning state.
  264. Arguments:
  265. None.
  266. Return Value:
  267. Win32 Status
  268. --*/
  269. #define NTFRSAPI_MAX_INTERVAL ((((ULONG)0x7FFFFFFF) / 1000) / 60)
  270. #define NTFRSAPI_MIN_INTERVAL (1)
  271. #define NTFRSAPI_DEFAULT_LONG_INTERVAL (1 * 60) // 1 hour
  272. #define NTFRSAPI_DEFAULT_SHORT_INTERVAL (5) // 5 minutes
  273. DWORD
  274. WINAPI
  275. NtFrsApi_Set_DsPollingIntervalW(
  276. IN PWCHAR ComputerName, OPTIONAL
  277. IN ULONG UseShortInterval,
  278. IN ULONG LongInterval,
  279. IN ULONG ShortInterval
  280. );
  281. /*++
  282. Routine Description:
  283. The NtFrs service polls the DS occasionally for configuration changes.
  284. This API alters the polling interval and, if the service is not
  285. in the middle of a polling cycle, forces the service to begin a
  286. polling cycle.
  287. The service uses the long interval by default. The short interval
  288. is used after the ds configuration has been successfully
  289. retrieved and the service is now verifying that the configuration
  290. is not in flux. This API can be used to force the service to use
  291. the short interval until a stable configuration has been retrieved.
  292. After which, the service reverts back to the long interval.
  293. The default values for ShortInterval and LongInterval can be
  294. changed by setting the parameters to a non-zero value. If zero,
  295. the current values remain unchanged and a polling cycle is initiated.
  296. Arguments:
  297. ComputerName - Poke the service on this computer. The computer
  298. name can be any RPC-bindable name. Usually, the
  299. NetBIOS or DNS name works just fine. The NetBIOS
  300. name can be found with GetComputerName() or
  301. hostname. The DNS name can be found with
  302. gethostbyname() or ipconfig /all. If NULL, the
  303. service on this computer is contacted. The service
  304. is contacted using Secure RPC.
  305. UseShortInterval - If non-zero, the service switches to the short
  306. interval until a stable configuration is retrieved
  307. from the DS or another call to this API is made.
  308. Otherwise, the service uses the long interval.
  309. LongInterval - Minutes between polls of the DS. The value must fall
  310. between NTFRSAPI_MIN_INTERVAL and NTFRSAPI_MAX_INTERVAL,
  311. inclusive. If 0, the interval is unchanged.
  312. ShortInterval - Minutes between polls of the DS. The value must fall
  313. between NTFRSAPI_MIN_INTERVAL and NTFRSAPI_MAX_INTERVAL,
  314. inclusive. If 0, the interval is unchanged.
  315. Return Value:
  316. Win32 Status
  317. --*/
  318. DWORD
  319. WINAPI
  320. NtFrsApi_Get_DsPollingIntervalW(
  321. IN PWCHAR ComputerName, OPTIONAL
  322. OUT ULONG *Interval,
  323. OUT ULONG *LongInterval,
  324. OUT ULONG *ShortInterval
  325. );
  326. /*++
  327. Routine Description:
  328. The NtFrs service polls the DS occasionally for configuration changes.
  329. This API returns the values the service uses for polling intervals.
  330. The service uses the long interval by default. The short interval
  331. is used after the ds configuration has been successfully
  332. retrieved and the service is now verifying that the configuration
  333. is not in flux. The short interval is also used if the
  334. NtFrsApi_Set_DsPollingIntervalW() is used to force usage of the short
  335. interval until a stable configuration has been retrieved. After which,
  336. the service reverts back to the long interval.
  337. The value returned in Interval is the polling interval currently in
  338. use.
  339. Arguments:
  340. ComputerName - Poke the service on this computer. The computer
  341. name can be any RPC-bindable name. Usually, the
  342. NetBIOS or DNS name works just fine. The NetBIOS
  343. name can be found with GetComputerName() or
  344. hostname. The DNS name can be found with
  345. gethostbyname() or ipconfig /all. If NULL, the
  346. service on this computer is contacted. The service
  347. is contacted using Secure RPC.
  348. Interval - The current polling interval in minutes.
  349. LongInterval - The long interval in minutes.
  350. ShortInterval - The short interval in minutes.
  351. Return Value:
  352. Win32 Status
  353. --*/
  354. //
  355. // Type of internal information returned by NtFrsApi_InfoW()
  356. //
  357. #define NTFRSAPI_INFO_TYPE_MIN (0)
  358. #define NTFRSAPI_INFO_TYPE_VERSION (0)
  359. #define NTFRSAPI_INFO_TYPE_SETS (1)
  360. #define NTFRSAPI_INFO_TYPE_DS (2)
  361. #define NTFRSAPI_INFO_TYPE_MEMORY (3)
  362. #define NTFRSAPI_INFO_TYPE_IDTABLE (4)
  363. #define NTFRSAPI_INFO_TYPE_OUTLOG (5)
  364. #define NTFRSAPI_INFO_TYPE_INLOG (6)
  365. #define NTFRSAPI_INFO_TYPE_MAX (6)
  366. //
  367. // Internal constants
  368. //
  369. #define NTFRSAPI_DEFAULT_INFO_SIZE (32 * 1024)
  370. #define NTFRSAPI_MINIMUM_INFO_SIZE ( 1 * 1024)
  371. //
  372. // Opaque information from NtFrs.
  373. // Parse with NtFrsApi_InfoLineW().
  374. // Free with NtFrsApi_InfoFreeW();
  375. //
  376. typedef struct _NTFRSAPI_INFO {
  377. ULONG Major;
  378. ULONG Minor;
  379. ULONG NtFrsMajor;
  380. ULONG NtFrsMinor;
  381. ULONG SizeInChars;
  382. ULONG Flags;
  383. ULONG TypeOfInfo;
  384. ULONG TotalChars;
  385. ULONG CharsToSkip;
  386. ULONG OffsetToLines;
  387. ULONG OffsetToFree;
  388. CHAR Lines[1];
  389. } NTFRSAPI_INFO, *PNTFRSAPI_INFO;
  390. //
  391. // RPC Blob must be at least this size
  392. //
  393. #define NTFRSAPI_INFO_HEADER_SIZE (5 * sizeof(ULONG))
  394. //
  395. // NtFrsApi Information Flags
  396. //
  397. #define NTFRSAPI_INFO_FLAGS_VERSION (0x00000001)
  398. #define NTFRSAPI_INFO_FLAGS_FULL (0x00000002)
  399. DWORD
  400. WINAPI
  401. NtFrsApi_InfoW(
  402. IN PWCHAR ComputerName, OPTIONAL
  403. IN ULONG TypeOfInfo,
  404. IN ULONG SizeInChars,
  405. IN OUT PVOID *NtFrsApiInfo
  406. );
  407. /*++
  408. Routine Description:
  409. Return a buffer full of the requested information. The information
  410. can be extracted from the buffer with NtFrsApi_InfoLineW().
  411. *NtFrsApiInfo should be NULL on the first call. On subsequent calls,
  412. *NtFrsApiInfo will be filled in with more data if any is present.
  413. Otherwise, *NtFrsApiInfo is set to NULL and the memory is freed.
  414. The SizeInChars is a suggested size; the actual memory usage
  415. may be different. The function chooses the memory usage if
  416. SizeInChars is 0.
  417. The format of the returned information can change without notice.
  418. Arguments:
  419. ComputerName - Poke the service on this computer. The computer
  420. name can be any RPC-bindable name. Usually, the
  421. NetBIOS or DNS name works just fine. The NetBIOS
  422. name can be found with GetComputerName() or
  423. hostname. The DNS name can be found with
  424. gethostbyname() or ipconfig /all. If NULL, the
  425. service on this computer is contacted. The service
  426. is contacted using Secure RPC.
  427. TypeOfInfo - See the constants beginning with NTFRSAPI_INFO_
  428. in ntfrsapi.h.
  429. SizeInChars - Suggested memory usage; actual may be different.
  430. 0 == Function chooses memory usage
  431. NtFrsApiInfo - Opaque. Parse with NtFrsApi_InfoLineW().
  432. Free with NtFrsApi_InfoFreeW();
  433. Return Value:
  434. Win32 Status
  435. --*/
  436. DWORD
  437. WINAPI
  438. NtFrsApi_InfoLineW(
  439. IN PNTFRSAPI_INFO NtFrsApiInfo,
  440. IN OUT PVOID *InOutLine
  441. );
  442. /*++
  443. Routine Description:
  444. Extract the wchar lines of information from NtFrsApiInformation.
  445. Returns the address of the next L'\0' terminated line of information.
  446. NULL if none.
  447. Arguments:
  448. NtFrsApiInfo - Opaque. Returned by NtFrsApi_InfoW().
  449. Parse with NtFrsApi_InfoLineW().
  450. Free with NtFrsApi_InfoFreeW().
  451. Return Value:
  452. Win32 Status
  453. --*/
  454. BOOL
  455. WINAPI
  456. NtFrsApi_InfoMoreW(
  457. IN PNTFRSAPI_INFO NtFrsApiInfo
  458. );
  459. /*++
  460. Routine Description:
  461. All of the information may not have fit in the buffer. The additional
  462. information can be fetched by calling NtFrsApi_InfoW() again with the
  463. same NtFrsApiInfo struct. NtFrsApi_InfoW() will return NULL in
  464. NtFrsApiInfo if there is no more information.
  465. However, the information returned in subsequent calls to _InfoW() may be
  466. out of sync with the previous information. If the user requires a
  467. coherent information set, then the information buffer should be freed
  468. with NtFrsApi_InfoFreeW() and another call made to NtFrsApi_InfoW()
  469. with an increased SizeInChars. Repeat the procedure until
  470. NtFrsApi_InfoMoreW() returns FALSE.
  471. Arguments:
  472. NtFrsApiInfo - Opaque. Returned by NtFrsApi_InfoW().
  473. Parse with NtFrsApi_InfoLineW().
  474. Free with NtFrsApi_InfoFreeW().
  475. Return Value:
  476. TRUE - The information buffer does *NOT* contain all of the info.
  477. FALSE - The information buffer does contain all of the info.
  478. --*/
  479. DWORD
  480. WINAPI
  481. NtFrsApi_InfoFreeW(
  482. IN PVOID *NtFrsApiInfo
  483. );
  484. /*++
  485. Routine Description:
  486. Free the information buffer allocated by NtFrsApi_InfoW();
  487. Arguments:
  488. NtFrsApiInfo - Opaque. Returned by NtFrsApi_InfoW().
  489. Parse with NtFrsApi_InfoLineW().
  490. Free with NtFrsApi_InfoFreeW().
  491. Return Value:
  492. Win32 Status
  493. --*/
  494. //
  495. // BACKUP/RESTORE API
  496. //
  497. #define NTFRSAPI_BUR_FLAGS_NONE (0x00000000)
  498. #define NTFRSAPI_BUR_FLAGS_AUTHORITATIVE (0x00000001)
  499. #define NTFRSAPI_BUR_FLAGS_NON_AUTHORITATIVE (0x00000002)
  500. #define NTFRSAPI_BUR_FLAGS_PRIMARY (0x00000004)
  501. #define NTFRSAPI_BUR_FLAGS_SYSTEM (0x00000008)
  502. #define NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY (0x00000010)
  503. #define NTFRSAPI_BUR_FLAGS_NORMAL (0x00000020)
  504. #define NTFRSAPI_BUR_FLAGS_ALL_DIRECTORIES_AND_VOLUMES (0x00000040)
  505. #define NTFRSAPI_BUR_FLAGS_RESTORE (0x00000080)
  506. #define NTFRSAPI_BUR_FLAGS_BACKUP (0x00000100)
  507. #define NTFRSAPI_BUR_FLAGS_RESTART (0x00000200)
  508. #define NTFRSAPI_BUR_FLAGS_TYPES_OF_RESTORE \
  509. (NTFRSAPI_BUR_FLAGS_AUTHORITATIVE | \
  510. NTFRSAPI_BUR_FLAGS_NON_AUTHORITATIVE | \
  511. NTFRSAPI_BUR_FLAGS_PRIMARY)
  512. #define NTFRSAPI_BUR_FLAGS_MODES_OF_RESTORE \
  513. (NTFRSAPI_BUR_FLAGS_SYSTEM | \
  514. NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY | \
  515. NTFRSAPI_BUR_FLAGS_NORMAL)
  516. #define NTFRSAPI_BUR_FLAGS_SUPPORTED_RESTORE \
  517. (NTFRSAPI_BUR_FLAGS_AUTHORITATIVE | \
  518. NTFRSAPI_BUR_FLAGS_NON_AUTHORITATIVE | \
  519. NTFRSAPI_BUR_FLAGS_PRIMARY | \
  520. NTFRSAPI_BUR_FLAGS_SYSTEM | \
  521. NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY | \
  522. NTFRSAPI_BUR_FLAGS_NORMAL | \
  523. NTFRSAPI_BUR_FLAGS_RESTORE | \
  524. NTFRSAPI_BUR_FLAGS_ALL_DIRECTORIES_AND_VOLUMES)
  525. #define NTFRSAPI_BUR_FLAGS_SUPPORTED_BACKUP \
  526. (NTFRSAPI_BUR_FLAGS_NORMAL | \
  527. NTFRSAPI_BUR_FLAGS_BACKUP)
  528. DWORD
  529. WINAPI
  530. NtFrsApiInitializeBackupRestore(
  531. IN DWORD ErrorCallBack(IN PWCHAR, IN ULONG), OPTIONAL
  532. IN DWORD BurFlags,
  533. OUT PVOID *BurContext
  534. );
  535. /*++
  536. Routine Description:
  537. Called once in the lifetime of a backup/restore process. Must be
  538. matched with a subsequent call to NtFrsApiDestroyBackupRestore().
  539. Prepare the system for the backup or restore specified by BurFlags.
  540. Currently, the following combinations are supported:
  541. ASR - Automated System Recovery
  542. NTFRSAPI_BUR_FLAGS_RESTORE |
  543. NTFRSAPI_BUR_FLAGS_SYSTEM |
  544. NTFRSAPI_BUR_FLAGS_ALL_DIRECTORIES_AND_VOLUMES |
  545. NTFRSAPI_BUR_FLAGS_PRIMARY or NTFRSAPI_BUR_FLAGS_NON_AUTHORITATIVE
  546. DSR - Distributed Services Restore (all sets)
  547. NTFRSAPI_BUR_FLAGS_RESTORE |
  548. NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY |
  549. NTFRSAPI_BUR_FLAGS_ALL_DIRECTORIES_AND_VOLUMES |
  550. NTFRSAPI_BUR_FLAGS_PRIMARY or NTFRSAPI_BUR_FLAGS_NON_AUTHORITATIVE
  551. DSR - Distributed Services Restore (just the sysvol)
  552. NTFRSAPI_BUR_FLAGS_RESTORE |
  553. NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY
  554. (may be followed by subsequent calls to NtFrsApiRestoringDirectory())
  555. Normal Restore - System is up and running; just restoring files
  556. NTFRSAPI_BUR_FLAGS_RESTORE |
  557. NTFRSAPI_BUR_FLAGS_NORMAL |
  558. NTFRSAPI_BUR_FLAGS_ALL_DIRECTORIES_AND_VOLUMES |
  559. NTFRSAPI_BUR_FLAGS_AUTHORITATIVE
  560. Normal Backup
  561. NTFRSAPI_BUR_FLAGS_BACKUP |
  562. NTFRSAPI_BUR_FLAGS_NORMAL
  563. Arguments:
  564. ErrorCallBack - Ignored if NULL.
  565. Address of function provided by the caller. If
  566. not NULL, this function calls back with a formatted
  567. error message and the error code that caused the
  568. error.
  569. BurFlags - See above for the supported combinations
  570. BurContext - Opaque context for this process
  571. Return Value:
  572. Win32 Status
  573. --*/
  574. DWORD
  575. WINAPI
  576. NtFrsApiDestroyBackupRestore(
  577. IN PVOID *BurContext,
  578. IN DWORD BurFlags,
  579. OUT HKEY *HKey,
  580. IN OUT DWORD *KeyPathSizeInBytes,
  581. OUT PWCHAR KeyPath
  582. );
  583. /*++
  584. Routine Description:
  585. Called once in the lifetime of a backup/restore process. Must be
  586. matched with a previous call to NtFrsApiInitializeBackupRestore().
  587. If NtFrsApiInitializeBackupRestore() was called with:
  588. NTFRSAPI_BUR_FLAGS_RESTORE |
  589. NTFRSAPI_BUR_FLAGS_SYSTEM or NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY
  590. then BurFlags may be set to one of:
  591. NTFRSAPI_BUR_FLAGS_NONE - Do not restart the service. The key
  592. specified by (HKey, KeyPath) must be moved into the final
  593. registry.
  594. NTFRSAPI_BUR_FLAGS_RESTART - Restart the service. HKey,
  595. KeyPathSizeInBytes, and KeyPath must be NULL.
  596. If NtFrsApiInitializeBackupRestore() was not called the above flags,
  597. then BurFlags must be NTFRSAPI_BUR_FLAGS_NONE and HKey, KeyPathSizeInBytes,
  598. and KeyPath must be NULL.
  599. Arguments:
  600. BurContext - Returned by previous call to
  601. NtFrsApiInitializeBackupRestore().
  602. BurFlags - Backup/Restore Flags. See Routine Description.
  603. HKey - Address of a HKEY for that will be set to
  604. HKEY_LOCAL_MACHINE, ...
  605. NULL if BurContext is not for a System or
  606. Active Directory restore or Restart is set.
  607. KeyPathSizeInBytes - Address of of a DWORD specifying the size of
  608. KeyPath. Set to the actual number of bytes
  609. needed by KeyPath. ERROR_INSUFFICIENT_BUFFER
  610. is returned if the size of KeyPath is too small.
  611. NULL if BurContext is not for a System or
  612. Active Directory restore or Restart is set.
  613. KeyPath - Buffer to receive the path of the registry key.
  614. NULL if BurContext is not for a System or
  615. Active Directory restore or Restart is set.
  616. Return Value:
  617. Win32 Status
  618. --*/
  619. DWORD
  620. WINAPI
  621. NtFrsApiGetBackupRestoreSets(
  622. IN PVOID BurContext
  623. );
  624. /*++
  625. Routine Description:
  626. Cannot be called if BurContext is for a System restore.
  627. Retrieves information about the current replicated directories
  628. (AKA replica sets).
  629. Arguments:
  630. BurContext - From NtFrsApiInitializeBackupRestore()
  631. Return Value:
  632. Win32 Status
  633. --*/
  634. DWORD
  635. WINAPI
  636. NtFrsApiEnumBackupRestoreSets(
  637. IN PVOID BurContext,
  638. IN DWORD BurSetIndex,
  639. OUT PVOID *BurSet
  640. );
  641. /*++
  642. Routine Description:
  643. Returns ERROR_NO_MORE_ITEMS if BurSetIndex exceeds the number of
  644. sets returned by NtFrsApiGetBackupRestoreSets().
  645. Arguments:
  646. BurContext - From NtFrsApiInitializeBackupRestore()
  647. BurSetIndex - Index of set. Starts at 0.
  648. BurSet - Opaque struct representing a replicating directory.
  649. Return Value:
  650. Win32 Status
  651. --*/
  652. DWORD
  653. WINAPI
  654. NtFrsApiIsBackupRestoreSetASysvol(
  655. IN PVOID BurContext,
  656. IN PVOID BurSet,
  657. IN BOOL *IsSysvol
  658. );
  659. /*++
  660. Routine Description:
  661. Does the specified BurSet represent a replicating SYSVOL share?
  662. Arguments:
  663. BurContext - From NtFrsApiInitializeBackupRestore()
  664. BurSet - Opaque struct representing a replicating directory.
  665. Returned by NtFrsApiEnumBackupRestoreSets(). Not
  666. valid across calls to NtFrsApiGetBackupRestoreSets().
  667. IsSysvol - TRUE : set is a system volume (AKA SYSVOL).
  668. FALSE: set is a not a system volume (AKA SYSVOL).
  669. Return Value:
  670. Win32 Status
  671. --*/
  672. DWORD
  673. WINAPI
  674. NtFrsApiGetBackupRestoreSetDirectory(
  675. IN PVOID BurContext,
  676. IN PVOID BurSet,
  677. IN OUT DWORD *DirectoryPathSizeInBytes,
  678. OUT PWCHAR DirectoryPath
  679. );
  680. /*++
  681. Routine Description:
  682. Return the path of the replicating directory represented by BurSet.
  683. Arguments:
  684. BurContext - From NtFrsApiInitializeBackupRestore()
  685. BurSet - Opaque struct representing a replicating directory.
  686. Returned by NtFrsApiEnumBackupRestoreSets(). Not
  687. valid across calls to NtFrsApiGetBackupRestoreSets().
  688. DirectoryPathSizeInBytes - Address of DWORD giving size of
  689. DirectoryPath. Cannot be NULL.
  690. Set to the number of bytes needed
  691. to return DirectoryPath.
  692. ERROR_INSUFFICIENT_BUFFER is returned if
  693. DirectoryPath is too small.
  694. DirectoryPath - Buffer that is *DirectoryPathSizeInBytes
  695. bytes in length. Contains path of replicating
  696. directory.
  697. Return Value:
  698. Win32 Status
  699. --*/
  700. DWORD
  701. WINAPI
  702. NtFrsApiRestoringDirectory(
  703. IN PVOID BurContext,
  704. IN PVOID BurSet,
  705. IN DWORD BurFlags
  706. );
  707. /*++
  708. Routine Description:
  709. The backup/restore application is about to restore the directory
  710. specified by BurSet (See NtFrsApiEnumBackupRestoreSets()). Matched
  711. with a later call to NtFrsApiFinishedRestoringDirectory().
  712. This call is supported only if NtFrsApiInitializeBackupRestore()
  713. were called with the flags:
  714. NTFRSAPI_BUR_FLAGS_RESTORE |
  715. NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY
  716. BurFlags can be NTFRSAPI_BUR_FLAGS_PRIMARY or
  717. NTFRSAPI_BUR_FLAGS_NON_AUTHORITATIVE and overrides any value
  718. specified in the call to NtFrsApiInitializeBackupRestore().
  719. Arguments:
  720. BurContext - Opaque context from NtFrsApiInitializeBackupRestore()
  721. BurSet - Opaque set from NtFrsApiEnumBackupRestoreSets();
  722. BurFlags - See above for the supported combinations
  723. Return Value:
  724. Win32 Status
  725. --*/
  726. DWORD
  727. WINAPI
  728. NtFrsApiFinishedRestoringDirectory(
  729. IN PVOID BurContext,
  730. IN PVOID BurSet,
  731. IN DWORD BurFlags
  732. );
  733. /*++
  734. Routine Description:
  735. Finished restoring directory for BurSet. Matched by a previous call
  736. to NtFrsApiRestoringDirectory().
  737. This call is supported only if NtFrsApiInitializeBackupRestore()
  738. were called with the flags:
  739. NTFRSAPI_BUR_FLAGS_RESTORE |
  740. NTFRSAPI_BUR_FLAGS_ACTIVE_DIRECTORY
  741. BurFlags must be NTFRSAPI_BUR_FLAGS_NONE.
  742. Arguments:
  743. BurContext - Opaque context from NtFrsApiInitializeBackupRestore()
  744. BurSet - Opaque set from NtFrsApiEnumBackupRestoreSets();
  745. BurFlags - See above for the supported combinations
  746. Return Value:
  747. Win32 Status
  748. --*/
  749. #ifdef __cplusplus
  750. }
  751. #endif
  752. #endif _NTFRSIPI_H_