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.

367 lines
7.9 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. dssetp.ch
  5. Abstract:
  6. local funciton prototypes/defines
  7. Author:
  8. Mac McLain (MacM) Feb 10, 1997
  9. Environment:
  10. User Mode
  11. Revision History:
  12. --*/
  13. #ifndef __DSSETP_H__
  14. #define __DSSETP_H__
  15. #include <winldap.h>
  16. #include <dsysdbg.h>
  17. #include <dssetrpc.h>
  18. #include <dns.h>
  19. #include <dsgetdc.h>
  20. #include <lmcons.h>
  21. #include <logonmsv.h>
  22. #define DEB_TRACE_DS 0x00000008
  23. #define DEB_TRACE_UPDATE 0x00000010
  24. #define DEB_TRACE_LOCK 0x00000020
  25. #define DEB_TRACE_SERVICES 0x00000040
  26. #define DEB_TRACE_NET 0x00000080
  27. #if DBG
  28. #ifdef ASSERT
  29. #undef ASSERT
  30. #endif
  31. #define ASSERT DsysAssert
  32. DECLARE_DEBUG2( DsRole )
  33. #define DsRoleDebugOut( args ) DsRoleDebugPrint args
  34. VOID
  35. DsRoleDebugInitialize(
  36. VOID
  37. );
  38. #else
  39. #define DsRoleDebugOut(args)
  40. #define DsRoleDebugInitialize()
  41. #endif // DBG
  42. #define DSROLEP_EVENT_NAME L"\\DsRoleLsaEventName"
  43. #define DSROLEP_PROD_KEY_PATH L"System\\CurrentControlSet\\Control\\ProductOptions"
  44. #define DSROLEP_PROD_VALUE L"ProductType"
  45. #define DSROLEP_SERVER_PRINCIPAL_NAME L"DsRole"
  46. extern handle_t ClientBindingHandle;
  47. //
  48. // Determines whether a bit flag is turned on or not
  49. //
  50. #define FLAG_ON(flag,bits) ((flag) & (bits))
  51. #define FLAG_OFF(flag,bits) (!FLAG_ON(flag,bits))
  52. #define NELEMENTS(x) (sizeof(x)/sizeof((x)[0]))
  53. #define DSROLEP_ALLOCA(y,x) \
  54. __try {\
  55. y = alloca(x);\
  56. } __except ( GetExceptionCode() == STATUS_STACK_OVERFLOW) {\
  57. y=NULL;\
  58. }
  59. #define DSROLEP_MIDL_ALLOC_AND_COPY_STRING_ERROR( dest, src, err ) \
  60. if ( (src) ) { \
  61. (dest) = MIDL_user_allocate( (wcslen( (src) ) + 1) * sizeof( WCHAR ) ); \
  62. if ( !(dest) ) { \
  63. err = ERROR_NOT_ENOUGH_MEMORY; \
  64. } else { \
  65. wcscpy((dest), (src)); \
  66. } \
  67. } else { \
  68. (dest) = NULL; \
  69. }
  70. //
  71. // Options for specifiying the behavior of the path validation function
  72. //
  73. #define DSROLEP_PATH_VALIDATE_EXISTENCE 0x00000001
  74. #define DSROLEP_PATH_VALIDATE_LOCAL 0x00000002
  75. #define DSROLEP_PATH_VALIDATE_NTFS 0x00000004
  76. typedef enum _DSROLEP_MACHINE_TYPE {
  77. DSROLEP_MT_CLIENT = 0,
  78. DSROLEP_MT_STANDALONE,
  79. DSROLEP_MT_MEMBER
  80. } DSROLEP_MACHINE_TYPE, *PDSROLEP_MACHINE_TYPE;
  81. //
  82. // Utility functions
  83. //
  84. DWORD
  85. DsRolepDecryptPassword(
  86. IN PUNICODE_STRING EncryptedPassword,
  87. IN OUT PUNICODE_STRING DecryptedPassword,
  88. OUT PUCHAR Seed
  89. );
  90. DWORD
  91. DsRolepGetMachineType(
  92. IN OUT PDSROLEP_MACHINE_TYPE MachineType );
  93. NTSTATUS
  94. DsRolepInitialize(
  95. VOID
  96. );
  97. NTSTATUS
  98. DsRolepInitializePhase2(
  99. VOID
  100. );
  101. DWORD
  102. DsRolepSetProductType(
  103. IN DSROLEP_MACHINE_TYPE MachineType
  104. );
  105. DWORD
  106. DsRolepCreateAuthIdentForCreds(
  107. IN PWSTR Account,
  108. IN PWSTR Password,
  109. OUT PSEC_WINNT_AUTH_IDENTITY *AuthIdent
  110. );
  111. VOID
  112. DsRolepFreeAuthIdentForCreds(
  113. IN PSEC_WINNT_AUTH_IDENTITY AuthIdent
  114. );
  115. DWORD
  116. DsRolepTimeSyncAndManageIPCConnect(
  117. IN PVOID PromoteArgs,
  118. IN PWSTR ReplicaServer
  119. );
  120. DWORD
  121. DsRolepForceTimeSync(
  122. IN HANDLE ImpToken,
  123. IN PWSTR TimeSource
  124. );
  125. DWORD
  126. DsRolepDnsNameToFlatName(
  127. IN LPWSTR DnsName,
  128. OUT LPWSTR *FlatName,
  129. OUT PULONG StatusFlag
  130. );
  131. DWORD
  132. DsRolepValidatePath(
  133. IN LPWSTR Path,
  134. IN ULONG ValidationCriteria,
  135. OUT PULONG MatchingCriteria
  136. );
  137. DWORD
  138. DsRolepCopyDsDitFiles(
  139. IN LPWSTR DsPath
  140. );
  141. DWORD
  142. DsRolepSetDcSecurity(
  143. IN HANDLE ClientToken,
  144. IN LPWSTR SysvolRootPath,
  145. IN LPWSTR DsDatabasePath,
  146. IN LPWSTR DsLogPath,
  147. IN BOOLEAN Upgrade,
  148. IN BOOLEAN Replica
  149. );
  150. DWORD
  151. DsRolepDsGetDcForAccount(
  152. IN LPWSTR Server OPTIONAL,
  153. IN LPWSTR Domain,
  154. IN LPWSTR Account,
  155. IN ULONG Flags,
  156. IN ULONG AccountBits,
  157. OUT PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo
  158. );
  159. DWORD
  160. DsRolepSetMachineAccountType(
  161. IN LPWSTR Dc,
  162. IN HANDLE ClientToken,
  163. IN LPWSTR User,
  164. IN LPWSTR Password,
  165. IN LPWSTR AccountName,
  166. IN ULONG AccountBits,
  167. IN OUT WCHAR** AccountDn OPTIONAL
  168. );
  169. NTSTATUS
  170. DsRolepGetMixedModeFlags(
  171. IN PSID DomainSid,
  172. OUT PULONG Flags
  173. );
  174. //
  175. // Prototype from protos.h
  176. //
  177. ULONG
  178. SpmpReportEvent(
  179. IN BOOL Unicode,
  180. IN WORD EventType,
  181. IN ULONG EventId,
  182. IN ULONG Category,
  183. IN ULONG SizeOfRawData,
  184. IN PVOID RawData,
  185. IN ULONG NumberOfStrings,
  186. ...
  187. );
  188. DWORD
  189. DsRolepGenerateRandomPassword(
  190. IN ULONG Length,
  191. IN WCHAR *Buffer
  192. );
  193. DWORD
  194. DsRolepDelnodePath(
  195. IN LPWSTR Path,
  196. IN ULONG BufferSize,
  197. IN BOOLEAN DeleteRoot
  198. );
  199. DWORD
  200. DsRolepIsDnsNameChild(
  201. IN LPWSTR ParentDnsName,
  202. IN LPWSTR ChildDnsName
  203. );
  204. DWORD
  205. ImpDsRolepDsGetDcForAccount(
  206. IN HANDLE CallerToken,
  207. IN LPWSTR Server OPTIONAL,
  208. IN LPWSTR Domain,
  209. IN LPWSTR Account,
  210. IN ULONG Flags,
  211. IN ULONG AccountBits,
  212. OUT PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo
  213. );
  214. NET_API_STATUS
  215. NET_API_FUNCTION
  216. ImpNetpManageIPCConnect(
  217. IN HANDLE CallerToken,
  218. IN LPWSTR lpServer,
  219. IN LPWSTR lpAccount,
  220. IN LPWSTR lpPassword,
  221. IN ULONG fOptions
  222. );
  223. NTSTATUS
  224. ImpLsaOpenPolicy(
  225. IN HANDLE CallerToken,
  226. IN PLSA_UNICODE_STRING SystemName OPTIONAL,
  227. IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
  228. IN ACCESS_MASK DesiredAccess,
  229. IN OUT PLSA_HANDLE PolicyHandle
  230. );
  231. NTSTATUS
  232. ImpLsaDelete(
  233. IN HANDLE CallerToken,
  234. IN LSA_HANDLE ObjectHandle
  235. );
  236. NTSTATUS
  237. ImpLsaQueryInformationPolicy(
  238. IN HANDLE CallerToken,
  239. IN LSA_HANDLE PolicyHandle,
  240. IN POLICY_INFORMATION_CLASS InformationClass,
  241. OUT PVOID *Buffer
  242. );
  243. NTSTATUS
  244. ImpLsaOpenTrustedDomainByName(
  245. IN HANDLE CallerToken,
  246. IN LSA_HANDLE PolicyHandle,
  247. IN PLSA_UNICODE_STRING TrustedDomainName,
  248. IN ACCESS_MASK DesiredAccess,
  249. OUT PLSA_HANDLE TrustedDomainHandle
  250. );
  251. NTSTATUS
  252. ImpLsaOpenTrustedDomain(
  253. IN HANDLE CallerToken,
  254. IN LSA_HANDLE PolicyHandle,
  255. IN PSID TrustedDomainSid,
  256. IN ACCESS_MASK DesiredAccess,
  257. OUT PLSA_HANDLE TrustedDomainHandle
  258. );
  259. NTSTATUS
  260. ImpLsaCreateTrustedDomainEx(
  261. IN HANDLE CallerToken,
  262. IN LSA_HANDLE PolicyHandle,
  263. IN PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
  264. IN PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation,
  265. IN ACCESS_MASK DesiredAccess,
  266. OUT PLSA_HANDLE TrustedDomainHandle
  267. );
  268. NTSTATUS
  269. ImpLsaQueryTrustedDomainInfoByName(
  270. IN HANDLE CallerToken,
  271. IN LSA_HANDLE PolicyHandle,
  272. IN PLSA_UNICODE_STRING TrustedDomainName,
  273. IN TRUSTED_INFORMATION_CLASS InformationClass,
  274. OUT PVOID *Buffer
  275. );
  276. NTSTATUS
  277. ImpLsaQueryInfoTrustedDomain(
  278. IN HANDLE CallerToken,
  279. IN LSA_HANDLE TrustedDomain,
  280. IN TRUSTED_INFORMATION_CLASS InformationClass,
  281. OUT PVOID *Buffer
  282. );
  283. NTSTATUS
  284. ImpLsaQueryDomainInformationPolicy(
  285. IN HANDLE CallerToken,
  286. IN LSA_HANDLE PolicyHandle,
  287. IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
  288. OUT PVOID *Buffer
  289. );
  290. NTSTATUS
  291. ImpLsaClose(
  292. IN HANDLE CallerToken,
  293. IN LSA_HANDLE ObjectHandle
  294. );
  295. #endif // __DSSETP_H__