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.

339 lines
9.3 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. dsrolep.h
  5. Abstract:
  6. Private definitions for DsRole routines used for upgrading downlevel domains
  7. Author:
  8. Mac McLain (MacM) 24-January-1998
  9. Environment:
  10. Revision History:
  11. --*/
  12. #ifndef __DSROLEP_H__
  13. #define __DSROLEP_H__
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. //
  18. // Data structures for configuring the role of a Dc in a domain
  19. //
  20. typedef PVOID DSROLE_SERVEROP_HANDLE;
  21. typedef PVOID DSROLE_IFM_OPERATION_HANDLE;
  22. //
  23. // Type of display strings to query for
  24. //
  25. typedef enum {
  26. DsRoleOperationPromote = 1,
  27. DsRoleOperationReplicaPromote,
  28. DsRoleOperationDemote,
  29. DsRoleOperationUpgrade
  30. } DSROLE_SERVEROP_OPERATION;
  31. //
  32. // Status of an existing operation
  33. //
  34. typedef struct _DSROLE_SERVEROP_STATUS {
  35. LPWSTR CurrentOperationDisplayString;
  36. ULONG OperationStatus;
  37. ULONG CurrentOperationDisplayStringIndex;
  38. } DSROLE_SERVEROP_STATUS, *PDSROLE_SERVEROP_STATUS;
  39. //
  40. // where:
  41. // CurrentOperationDisplayString is a displayable status of the current operation. For example:
  42. // Locating a domain controller for the domain BRIDGE.NTDEV.MICROSOFT.COM
  43. // Replicating Ds Data from parent domain controller FRANK.BRIDGE.NTDEV.MICROSOFT.COM
  44. // Configuring KDC service to autostart
  45. //
  46. //
  47. // Status returned from a GetOperationResults call
  48. //
  49. typedef struct _DSROLE_SERVEROP_RESULTS {
  50. ULONG OperationStatus;
  51. LPWSTR OperationStatusDisplayString;
  52. LPWSTR ServerInstalledSite;
  53. ULONG OperationResultsFlags;
  54. } DSROLE_SERVEROP_RESULTS, *PDSROLE_SERVEROP_RESULTS;
  55. //
  56. // where:
  57. // OperationStatus is the status code returned from the operation.
  58. // OperationStatusDisplayString is a displayable status of the current operation. For example:
  59. // Successfully installed a domain controller for the domain BRIDGE.NTDEV.MICROSOFT.COM
  60. // Failed to create the trust between BRIDGE.NTDEV.MICROSOFT.COM and
  61. // FRANK.BRIDGE.NTDEV.MICROSOFT.COM because the trust object already exists on the parent
  62. // ServerInstalledSite is where the site the server was installed in is returned
  63. // OperationResultsFlags is where any flags are returned determine any specifics about the results
  64. //
  65. //
  66. typedef struct _IFM_SYSTEM_INFO {
  67. //
  68. // The locally accessible directory of the "alternate location"
  69. // restore.
  70. //
  71. // Also used by ntdsetup.dll:NtdspCopyDatabase()
  72. WCHAR * wszRestorePath;
  73. //
  74. // Some state from the registry of the above restore.
  75. //
  76. // For dcpromo.exe and ntdsa.dll:HandleKeys()
  77. ULONG dwState;
  78. ULONG dwSchemaVersion;
  79. LPWSTR wszDnsDomainName;
  80. // For ntdsetup.dll:NtdspCopyDatabase()
  81. LPWSTR wszOriginalDitPath;
  82. // For ntdsa.dll:HandleKeys()
  83. DWORD dwSysKeyStatus; // whether we got the syskey successfully.
  84. PVOID pvSysKey;
  85. DWORD cbSysKey; // size of syskey.
  86. } IFM_SYSTEM_INFO, *PIFM_SYSTEM_INFO;
  87. //
  88. // Operation states
  89. //
  90. #define DSROLE_CRITICAL_OPERATIONS_COMPLETED 0x00000001
  91. //
  92. // Operation results flags
  93. //
  94. #define DSROLE_NON_FATAL_ERROR_OCCURRED 0x00000001
  95. #define DSROLE_NON_CRITICAL_REPL_NOT_FINISHED 0x00000002
  96. #define DSROLE_IFM_RESTORED_DATABASE_FILES_MOVED 0x00000004
  97. #define DSROLE_IFM_GC_REQUEST_CANNOT_BE_SERVICED 0x00000008
  98. //
  99. // Determines the role of DC following a demotion
  100. //
  101. typedef enum _DSROLE_SERVEROP_DEMOTE_ROLE {
  102. DsRoleServerStandalone = 0,
  103. DsRoleServerMember
  104. } DSROLE_SERVEROP_DEMOTE_ROLE, *PDSROLE_SERVEROP_DEMOTE_ROLE;
  105. //
  106. // Valid options for various DsRole apis
  107. //
  108. #define DSROLE_DC_PARENT_TRUST_EXISTS 0x00000001
  109. #define DSROLE_DC_ROOT_TRUST_EXISTS 0x00000001
  110. #define DSROLE_DC_DELETE_PARENT_TRUST 0x00000002
  111. #define DSROLE_DC_DELETE_ROOT_TRUST 0x00000002
  112. #define DSROLE_DC_ALLOW_DC_REINSTALL 0x00000004
  113. #define DSROLE_DC_ALLOW_DOMAIN_REINSTALL 0x00000008
  114. #define DSROLE_DC_TRUST_AS_ROOT 0x00000010
  115. #define DSROLE_DC_DOWNLEVEL_UPGRADE 0x00000020
  116. #define DSROLE_DC_FORCE_TIME_SYNC 0x00000040
  117. #define DSROLE_DC_CREATE_TRUST_AS_REQUIRED 0x00000080
  118. #define DSROLE_DC_DELETE_SYSVOL_PATH 0x00000100
  119. #define DSROLE_DC_DONT_DELETE_DOMAIN 0x00000200
  120. #define DSROLE_DC_CRITICAL_REPLICATION_ONLY 0x00000400
  121. #define DSROLE_DC_ALLOW_ANONYMOUS_ACCESS 0x00000800
  122. #define DSROLE_DC_NO_NET 0x00001000
  123. #define DSROLE_DC_REQUEST_GC 0x00002000
  124. #define DSROLE_DC_DEFAULT_REPAIR_PWD 0x00004000
  125. #define DSROLE_DC_SET_FOREST_CURRENT 0x00008000
  126. #define DSROLE_DC_FORCE_DEMOTE 0x00010000
  127. //
  128. // Options to be used for fixing up a domain controller
  129. //
  130. #define DSROLE_DC_FIXUP_ACCOUNT 0x00000001
  131. #define DSROLE_DC_FIXUP_ACCOUNT_PASSWORD 0x00000002
  132. #define DSROLE_DC_FIXUP_ACCOUNT_TYPE 0x00000004
  133. #define DSROLE_DC_FIXUP_TIME_SERVICE 0x00000008
  134. #define DSROLE_DC_FIXUP_DC_SERVICES 0x00000010
  135. #define DSROLE_DC_FIXUP_FORCE_SYNC 0x00000020
  136. #define DSROLE_DC_FIXUP_SYNC_LSA_POLICY 0x00000040
  137. #define DSROLE_DC_FIXUP_TIME_SYNC 0x00000080
  138. #define DSROLE_DC_FIXUP_CLEAN_TRUST 0x00000100
  139. //
  140. // Returns from DsRoleGetDatabaseFacts
  141. //
  142. #define DSROLE_DC_IS_GC 0x00000001
  143. #define DSROLE_KEY_STORED 0x00000002
  144. #define DSROLE_KEY_DISK 0x00000004
  145. #define DSROLE_KEY_PROMPT 0x00000008
  146. //
  147. // Flags returned by DsRoleDnsNameToFlatName
  148. //
  149. #define DSROLE_FLATNAME_DEFAULT 0x00000001
  150. #define DSROLE_FLATNAME_UPGRADE 0x00000002
  151. DWORD
  152. WINAPI
  153. DsRoleDnsNameToFlatName(
  154. IN LPCWSTR lpServer OPTIONAL,
  155. IN LPCWSTR lpDnsName,
  156. OUT LPWSTR *lpFlatName,
  157. OUT PULONG lpStatusFlag
  158. );
  159. DWORD
  160. WINAPI
  161. DsRoleDcAsDc(
  162. IN LPCWSTR lpServer OPTIONAL,
  163. IN LPCWSTR lpDnsDomainName,
  164. IN LPCWSTR lpFlatDomainName,
  165. IN LPCWSTR lpDomainAdminPassword OPTIONAL,
  166. IN LPCWSTR lpSiteName, OPTIONAL
  167. IN LPCWSTR lpDsDatabasePath,
  168. IN LPCWSTR lpDsLogPath,
  169. IN LPCWSTR lpSystemVolumeRootPath,
  170. IN LPCWSTR lpParentDnsDomainName OPTIONAL,
  171. IN LPCWSTR lpParentServer OPTIONAL,
  172. IN LPCWSTR lpAccount OPTIONAL,
  173. IN LPCWSTR lpPassword OPTIONAL,
  174. IN LPCWSTR lpDsRepairPassword OPTIONAL,
  175. IN ULONG Options,
  176. OUT DSROLE_SERVEROP_HANDLE *DsOperationHandle
  177. );
  178. DWORD
  179. WINAPI
  180. DsRoleDcAsReplica(
  181. IN LPCWSTR lpServer OPTIONAL,
  182. IN LPCWSTR lpDnsDomainName,
  183. IN LPCWSTR lpReplicaServer,
  184. IN LPCWSTR lpSiteName, OPTIONAL
  185. IN LPCWSTR lpDsDatabasePath,
  186. IN LPCWSTR lpDsLogPath,
  187. IN LPCWSTR lpRestorePath OPTIONAL,
  188. IN LPCWSTR lpSystemVolumeRootPath,
  189. IN OUT LPWSTR lpBootkey OPTIONAL,
  190. IN LPCWSTR lpAccount OPTIONAL,
  191. IN LPCWSTR lpPassword OPTIONAL,
  192. IN LPCWSTR lpDsRepairPassword OPTIONAL,
  193. IN ULONG Options,
  194. OUT DSROLE_SERVEROP_HANDLE *DsOperationHandle
  195. );
  196. DWORD
  197. WINAPI
  198. DsRoleDemoteDc(
  199. IN LPCWSTR lpServer OPTIONAL,
  200. IN LPCWSTR lpDnsDomainName OPTIONAL,
  201. IN DSROLE_SERVEROP_DEMOTE_ROLE ServerRole,
  202. IN LPCWSTR lpAccount OPTIONAL,
  203. IN LPCWSTR lpPassword OPTIONAL,
  204. IN ULONG Options,
  205. IN BOOL fLastDcInDomain,
  206. IN ULONG cRemoveNCs,
  207. IN LPCWSTR * pszRemoveNCs OPTIONAL,
  208. IN LPCWSTR lpDomainAdminPassword OPTIONAL,
  209. OUT DSROLE_SERVEROP_HANDLE *DsOperationHandle
  210. );
  211. DWORD
  212. WINAPI
  213. DsRoleGetDcOperationProgress(
  214. IN LPCWSTR lpServer OPTIONAL,
  215. IN DSROLE_SERVEROP_HANDLE DsOperationHandle,
  216. OUT PDSROLE_SERVEROP_STATUS *ServerOperationStatus
  217. );
  218. DWORD
  219. WINAPI
  220. DsRoleGetDcOperationResults(
  221. IN LPCWSTR lpServer OPTIONAL,
  222. IN DSROLE_SERVEROP_HANDLE DsOperationHandle,
  223. OUT PDSROLE_SERVEROP_RESULTS *ServerOperationResults
  224. );
  225. DWORD
  226. WINAPI
  227. DsRoleCancel(
  228. IN LPCWSTR lpServer OPTIONAL,
  229. IN DSROLE_SERVEROP_HANDLE DsOperationHandle
  230. );
  231. #define DSROLEP_ABORT_FOR_REPLICA_INSTALL 0x0000001
  232. DWORD
  233. WINAPI
  234. DsRoleServerSaveStateForUpgrade(
  235. IN LPCWSTR AnswerFile OPTIONAL
  236. );
  237. DWORD
  238. WINAPI
  239. DsRoleUpgradeDownlevelServer(
  240. IN LPCWSTR lpDnsDomainName,
  241. IN LPCWSTR lpSiteName,
  242. IN LPCWSTR lpDsDatabasePath,
  243. IN LPCWSTR lpDsLogPath,
  244. IN LPCWSTR lpSystemVolumeRootPath,
  245. IN LPCWSTR lpParentDnsDomainName OPTIONAL,
  246. IN LPCWSTR lpParentServer OPTIONAL,
  247. IN LPCWSTR lpAccount OPTIONAL,
  248. IN LPCWSTR lpPassword OPTIONAL,
  249. IN LPCWSTR lpDsRepairPassword OPTIONAL,
  250. IN ULONG Options,
  251. OUT DSROLE_SERVEROP_HANDLE *DsOperationHandle
  252. );
  253. DWORD
  254. WINAPI
  255. DsRoleAbortDownlevelServerUpgrade(
  256. IN LPCWSTR lpAdminPassword,
  257. IN LPCWSTR lpAccount OPTIONAL,
  258. IN LPCWSTR lpPassword OPTIONAL,
  259. IN ULONG Options
  260. );
  261. DWORD
  262. WINAPI
  263. DsRoleGetDatabaseFacts(
  264. IN LPCWSTR lpServer OPTIONAL,
  265. IN LPCWSTR lpRestorePath,
  266. OUT LPWSTR *lpDNSDomainName,
  267. OUT PULONG State,
  268. OUT DSROLE_IFM_OPERATION_HANDLE * pIfmHandle
  269. );
  270. DWORD
  271. WINAPI
  272. DsRoleIfmHandleFree(
  273. IN LPCWSTR lpServer OPTIONAL,
  274. IN DSROLE_IFM_OPERATION_HANDLE * pIfmHandle
  275. );
  276. #ifdef __cplusplus
  277. }
  278. #endif
  279. #endif // __DSROLEP_H__