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.

346 lines
7.2 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_MIDL_ALLOC_AND_COPY_STRING_ERROR( dest, src, err ) \
  54. if ( (src) ) { \
  55. (dest) = MIDL_user_allocate( (wcslen( (src) ) + 1) * sizeof( WCHAR ) ); \
  56. if ( !(dest) ) { \
  57. err = ERROR_NOT_ENOUGH_MEMORY; \
  58. } else { \
  59. wcscpy((dest), (src)); \
  60. } \
  61. } else { \
  62. (dest) = NULL; \
  63. }
  64. //
  65. // Options for specifiying the behavior of the path validation function
  66. //
  67. #define DSROLEP_PATH_VALIDATE_EXISTENCE 0x00000001
  68. #define DSROLEP_PATH_VALIDATE_LOCAL 0x00000002
  69. #define DSROLEP_PATH_VALIDATE_NTFS 0x00000004
  70. typedef enum _DSROLEP_MACHINE_TYPE {
  71. DSROLEP_MT_CLIENT = 0,
  72. DSROLEP_MT_STANDALONE,
  73. DSROLEP_MT_MEMBER
  74. } DSROLEP_MACHINE_TYPE, *PDSROLEP_MACHINE_TYPE;
  75. //
  76. // Utility functions
  77. //
  78. DWORD
  79. DsRolepDecryptPassword(
  80. IN PUNICODE_STRING EncryptedPassword,
  81. IN OUT PUNICODE_STRING DecryptedPassword,
  82. OUT PUCHAR Seed
  83. );
  84. DWORD
  85. DsRolepGetMachineType(
  86. IN OUT PDSROLEP_MACHINE_TYPE MachineType );
  87. NTSTATUS
  88. DsRolepInitialize(
  89. VOID
  90. );
  91. NTSTATUS
  92. DsRolepInitializePhase2(
  93. VOID
  94. );
  95. DWORD
  96. DsRolepSetProductType(
  97. IN DSROLEP_MACHINE_TYPE MachineType
  98. );
  99. DWORD
  100. DsRolepCreateAuthIdentForCreds(
  101. IN PWSTR Account,
  102. IN PWSTR Password,
  103. OUT PSEC_WINNT_AUTH_IDENTITY *AuthIdent
  104. );
  105. VOID
  106. DsRolepFreeAuthIdentForCreds(
  107. IN PSEC_WINNT_AUTH_IDENTITY AuthIdent
  108. );
  109. DWORD
  110. DsRolepForceTimeSync(
  111. IN HANDLE ImpToken,
  112. IN PWSTR TimeSource
  113. );
  114. DWORD
  115. DsRolepDnsNameToFlatName(
  116. IN LPWSTR DnsName,
  117. OUT LPWSTR *FlatName,
  118. OUT PULONG StatusFlag
  119. );
  120. DWORD
  121. DsRolepValidatePath(
  122. IN LPWSTR Path,
  123. IN ULONG ValidationCriteria,
  124. OUT PULONG MatchingCriteria
  125. );
  126. DWORD
  127. DsRolepCopyDsDitFiles(
  128. IN LPWSTR DsPath
  129. );
  130. DWORD
  131. DsRolepSetDcSecurity(
  132. IN HANDLE ClientToken,
  133. IN LPWSTR SysvolRootPath,
  134. IN LPWSTR DsDatabasePath,
  135. IN LPWSTR DsLogPath,
  136. IN BOOLEAN Upgrade,
  137. IN BOOLEAN Replica
  138. );
  139. DWORD
  140. DsRolepDsGetDcForAccount(
  141. IN LPWSTR Server OPTIONAL,
  142. IN LPWSTR Domain,
  143. IN LPWSTR Account,
  144. IN ULONG Flags,
  145. IN ULONG AccountBits,
  146. OUT PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo
  147. );
  148. DWORD
  149. DsRolepSetMachineAccountType(
  150. IN LPWSTR Dc,
  151. IN HANDLE ClientToken,
  152. IN LPWSTR User,
  153. IN LPWSTR Password,
  154. IN LPWSTR AccountName,
  155. IN ULONG AccountBits,
  156. IN OUT WCHAR** AccountDn OPTIONAL
  157. );
  158. NTSTATUS
  159. DsRolepGetMixedModeFlags(
  160. IN PSID DomainSid,
  161. OUT PULONG Flags
  162. );
  163. //
  164. // Prototype from protos.h
  165. //
  166. ULONG
  167. SpmpReportEvent(
  168. IN BOOL Unicode,
  169. IN WORD EventType,
  170. IN ULONG EventId,
  171. IN ULONG Category,
  172. IN ULONG SizeOfRawData,
  173. IN PVOID RawData,
  174. IN ULONG NumberOfStrings,
  175. ...
  176. );
  177. DWORD
  178. DsRolepGenerateRandomPassword(
  179. IN ULONG Length,
  180. IN WCHAR *Buffer
  181. );
  182. DWORD
  183. DsRolepDelnodePath(
  184. IN LPWSTR Path,
  185. IN ULONG BufferSize,
  186. IN BOOLEAN DeleteRoot
  187. );
  188. DWORD
  189. DsRolepIsDnsNameChild(
  190. IN LPWSTR ParentDnsName,
  191. IN LPWSTR ChildDnsName
  192. );
  193. DWORD
  194. ImpDsRolepDsGetDcForAccount(
  195. IN HANDLE CallerToken,
  196. IN LPWSTR Server OPTIONAL,
  197. IN LPWSTR Domain,
  198. IN LPWSTR Account,
  199. IN ULONG Flags,
  200. IN ULONG AccountBits,
  201. OUT PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo
  202. );
  203. NET_API_STATUS
  204. NET_API_FUNCTION
  205. ImpNetpManageIPCConnect(
  206. IN HANDLE CallerToken,
  207. IN LPWSTR lpServer,
  208. IN LPWSTR lpAccount,
  209. IN LPWSTR lpPassword,
  210. IN ULONG fOptions
  211. );
  212. NTSTATUS
  213. ImpLsaOpenPolicy(
  214. IN HANDLE CallerToken,
  215. IN PLSA_UNICODE_STRING SystemName OPTIONAL,
  216. IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
  217. IN ACCESS_MASK DesiredAccess,
  218. IN OUT PLSA_HANDLE PolicyHandle
  219. );
  220. NTSTATUS
  221. ImpLsaDelete(
  222. IN HANDLE CallerToken,
  223. IN LSA_HANDLE ObjectHandle
  224. );
  225. NTSTATUS
  226. ImpLsaQueryInformationPolicy(
  227. IN HANDLE CallerToken,
  228. IN LSA_HANDLE PolicyHandle,
  229. IN POLICY_INFORMATION_CLASS InformationClass,
  230. OUT PVOID *Buffer
  231. );
  232. NTSTATUS
  233. ImpLsaOpenTrustedDomainByName(
  234. IN HANDLE CallerToken,
  235. IN LSA_HANDLE PolicyHandle,
  236. IN PLSA_UNICODE_STRING TrustedDomainName,
  237. IN ACCESS_MASK DesiredAccess,
  238. OUT PLSA_HANDLE TrustedDomainHandle
  239. );
  240. NTSTATUS
  241. ImpLsaOpenTrustedDomain(
  242. IN HANDLE CallerToken,
  243. IN LSA_HANDLE PolicyHandle,
  244. IN PSID TrustedDomainSid,
  245. IN ACCESS_MASK DesiredAccess,
  246. OUT PLSA_HANDLE TrustedDomainHandle
  247. );
  248. NTSTATUS
  249. ImpLsaCreateTrustedDomainEx(
  250. IN HANDLE CallerToken,
  251. IN LSA_HANDLE PolicyHandle,
  252. IN PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation,
  253. IN PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation,
  254. IN ACCESS_MASK DesiredAccess,
  255. OUT PLSA_HANDLE TrustedDomainHandle
  256. );
  257. NTSTATUS
  258. ImpLsaQueryTrustedDomainInfoByName(
  259. IN HANDLE CallerToken,
  260. IN LSA_HANDLE PolicyHandle,
  261. IN PLSA_UNICODE_STRING TrustedDomainName,
  262. IN TRUSTED_INFORMATION_CLASS InformationClass,
  263. OUT PVOID *Buffer
  264. );
  265. NTSTATUS
  266. ImpLsaQueryDomainInformationPolicy(
  267. IN HANDLE CallerToken,
  268. IN LSA_HANDLE PolicyHandle,
  269. IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
  270. OUT PVOID *Buffer
  271. );
  272. NTSTATUS
  273. ImpLsaClose(
  274. IN HANDLE CallerToken,
  275. IN LSA_HANDLE ObjectHandle
  276. );
  277. #endif // __DSSETP_H__