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.

370 lines
7.5 KiB

  1. /*++
  2. Microsoft Windows
  3. Copyright (C) Microsoft Corporation, 1998 - 2001
  4. Module Name:
  5. netdom.h
  6. Abstract:
  7. Common includes and definitions to be used in netdom5
  8. --*/
  9. #ifndef __NETDOM_H__
  10. #define __NETDOM_H__
  11. #include <netdom5.h>
  12. extern HINSTANCE g_hInstance;
  13. #define FLAG_ON(flag,bits) ((flag) & (bits))
  14. #define LOG_VERBOSE( __x__ ) { if ( Verbose ) { NetDompDisplayMessage __x__ ; } }
  15. #define ERROR_VERBOSE( __error__) { if ( Verbose && __error__ != ERROR_SUCCESS ) { \
  16. NetDompDisplayErrorMessage( __error__); } }
  17. #if DBG == 1
  18. #define DBG_VERBOSE( __x__ ) { if ( Verbose ) { printf __x__ ;} }
  19. #define CHECK_WIN32(err, cmd) \
  20. if (ERROR_SUCCESS != err) \
  21. { \
  22. if (Verbose) \
  23. { \
  24. printf("Error %d at line %d in file %s\n", err, __LINE__, __FILE__); \
  25. } \
  26. cmd; \
  27. }
  28. #else
  29. #define DBG_VERBOSE( __x__ )
  30. #define CHECK_WIN32(err, cmd) \
  31. if (ERROR_SUCCESS != err) \
  32. { \
  33. cmd; \
  34. }
  35. #endif
  36. #define NETDOM_STR_LEN 64
  37. extern BOOL Verbose;
  38. typedef struct _ND5_AUTH_INFO {
  39. PWSTR User;
  40. PWSTR Password;
  41. PWSTR pwzUserWoDomain;
  42. PWSTR pwzUsersDomain;
  43. } ND5_AUTH_INFO, *PND5_AUTH_INFO;
  44. #define NETDOM_TRUST_FLAG_DOMAIN_NOT_FOUND 1
  45. #define NETDOM_TRUST_FLAG_PARENT 2
  46. #define NETDOM_TRUST_FLAG_CHILD 4
  47. #define NETDOM_TRUST_PDC_REQUIRED 8
  48. #define NETDOM_TRUST_TYPE_MIT 10
  49. #define NETDOM_TRUST_TYPE_INDIRECT 20
  50. typedef struct _ND5_TRUST_INFO {
  51. PWSTR Server;
  52. PUNICODE_STRING DomainName;
  53. PUNICODE_STRING FlatName;
  54. PUNICODE_STRING ForestName;
  55. PSID Sid;
  56. LSA_HANDLE LsaHandle; // LSA Policy handle
  57. LSA_HANDLE TrustHandle; // TDO handle
  58. ULONG Flags;
  59. BOOL Uplevel;
  60. BOOL Connected;
  61. PVOID BlobToFree;
  62. BOOL fWasDownlevel;
  63. } ND5_TRUST_INFO, *PND5_TRUST_INFO;
  64. bool
  65. CmdFlagOn(ARG_RECORD * rgNetDomArgs, NETDOM_ARG_ENUM eArgIndex);
  66. DWORD
  67. NetDompGetTrustDirection(
  68. IN PND5_TRUST_INFO TrustingInfo,
  69. IN PND5_TRUST_INFO TrustedInfo,
  70. IN OUT PDWORD Direction
  71. );
  72. //
  73. // From ndutil.cxx
  74. //
  75. DWORD
  76. NetDompValidateSecondaryArguments(ARG_RECORD * rgNetDomArgs,
  77. NETDOM_ARG_ENUM eFirstValidParam, ...);
  78. DWORD
  79. NetDompGetUserAndPasswordForOperation(ARG_RECORD * rgNetDomArgs,
  80. NETDOM_ARG_ENUM eUserType,
  81. PWSTR DefaultDomain,
  82. PND5_AUTH_INFO AuthIdent);
  83. VOID
  84. NetDompFreeAuthIdent(
  85. IN PND5_AUTH_INFO AuthIdent
  86. );
  87. DWORD
  88. NetDompGetDomainForOperation(ARG_RECORD * rgNetDomArgs,
  89. PWSTR Server OPTIONAL,
  90. BOOL CanDefaultToCurrent,
  91. PWSTR *DomainName);
  92. DWORD
  93. NetDompGetArgumentString(ARG_RECORD * rgNetDomArgs,
  94. NETDOM_ARG_ENUM eArgToGet,
  95. PWSTR *ArgString);
  96. BOOL
  97. NetDompGetArgumentBoolean(ARG_RECORD * rgNetDomArgs,
  98. NETDOM_ARG_ENUM eArgToGet);
  99. DWORD
  100. NetDompControlService(
  101. IN PWSTR Server,
  102. IN PWSTR Service,
  103. IN DWORD ServiceOptions
  104. );
  105. DWORD
  106. NetDompRestartAsRequired(ARG_RECORD * rgNetDomArgs,
  107. PWSTR Machine,
  108. PWSTR User,
  109. DWORD PreliminaryStatus,
  110. DWORD MsgID);
  111. DWORD
  112. NetDompCheckDomainMembership(
  113. IN PWSTR Server,
  114. IN PND5_AUTH_INFO AuthInfo,
  115. IN BOOL EstablishSessionIfRequried,
  116. IN OUT BOOL * DomainMember
  117. );
  118. DWORD
  119. NetDompGenerateRandomPassword(
  120. IN PWSTR Buffer,
  121. IN ULONG Length
  122. );
  123. BOOL
  124. NetDompGetUserConfirmation(
  125. IN DWORD PromptResId,
  126. IN PWSTR pwzName
  127. );
  128. DWORD
  129. EnablePrivilege( PCWSTR PrivilegeName );
  130. //
  131. // From netdom5.cxx
  132. //
  133. VOID
  134. DisplayExpertHelp(NETDOM_ARG_ENUM HelpOp);
  135. VOID
  136. DisplayHelp(NETDOM_ARG_ENUM HelpOp);
  137. VOID
  138. NetDompDisplayMessage(
  139. IN DWORD MessageId,
  140. ...
  141. );
  142. VOID
  143. NetDompDisplayMessageAndError(
  144. IN DWORD MessageId,
  145. IN DWORD Error,
  146. IN PCWSTR String
  147. );
  148. VOID
  149. NetDompDisplayUnexpectedParameter(
  150. IN PWSTR UnexpectedParameter
  151. );
  152. VOID
  153. NetDompDisplayErrorMessage(
  154. IN DWORD Error
  155. );
  156. //
  157. // From join.cxx
  158. //
  159. DWORD
  160. NetDompHandleAdd(ARG_RECORD * rgNetDomArgs);
  161. DWORD
  162. NetDompHandleRemove(ARG_RECORD * rgNetDomArgs);
  163. DWORD
  164. NetDompHandleJoin(ARG_RECORD * rgNetDomArgs, BOOL AllowMove);
  165. DWORD
  166. NetDompHandleMove(ARG_RECORD * rgNetDomArgs);
  167. DWORD
  168. NetDompHandleReset(ARG_RECORD * rgNetDomArgs);
  169. DWORD
  170. NetDompHandleResetPwd(ARG_RECORD * rgNetDomArgs);
  171. DWORD
  172. NetDompHandleVerify(ARG_RECORD * rgNetDomArgs);
  173. DWORD
  174. NetDompVerifyServerSC(
  175. IN PWSTR Domain,
  176. IN PWSTR Server,
  177. IN PND5_AUTH_INFO AuthInfo,
  178. IN ULONG OkMessageId,
  179. IN ULONG FailedMessageId
  180. );
  181. DWORD
  182. NetDompResetServerSC(
  183. IN PWSTR Domain,
  184. IN PWSTR Server,
  185. IN PWSTR DomainController, OPTIONAL
  186. IN PND5_AUTH_INFO AuthInfo,
  187. IN ULONG OkMessageId,
  188. IN ULONG FailedMessageId
  189. );
  190. //
  191. // From trust.cxx
  192. //
  193. DWORD
  194. NetDompHandleTrust(ARG_RECORD * rgNetDomArgs);
  195. DWORD
  196. NetDompTrustGetDomInfo(
  197. IN PWSTR Domain,
  198. IN PWSTR DomainController OPTIONAL,
  199. IN PND5_AUTH_INFO AuthInfo,
  200. IN OUT PND5_TRUST_INFO TrustInfo,
  201. IN BOOL ManageTrust,
  202. IN BOOL Force,
  203. IN BOOL fUseNullSession
  204. );
  205. VOID
  206. NetDompFreeDomInfo(
  207. IN OUT PND5_TRUST_INFO TrustInfo
  208. );
  209. DWORD
  210. NetDompVerifyTrust(
  211. IN PND5_TRUST_INFO TrustingInfo,
  212. IN PND5_TRUST_INFO TrustedInfo,
  213. BOOL fShowResults
  214. );
  215. DWORD
  216. NetDompResetTrustPasswords(
  217. IN PWSTR TrustingDomain,
  218. IN PWSTR TrustedDomain,
  219. IN PND5_AUTH_INFO TrustingCreds,
  220. IN PND5_AUTH_INFO TrustedCreds
  221. );
  222. DWORD
  223. NetDompSetMitTrustPW(
  224. IN PWSTR TrustingDomain,
  225. IN PWSTR TrustedDomain,
  226. IN PND5_AUTH_INFO TrustingCreds,
  227. IN PND5_AUTH_INFO TrustedCreds,
  228. IN PWSTR pwzNewTrustPW
  229. );
  230. DWORD
  231. NetDompIsParentChild(
  232. IN PND5_TRUST_INFO pFirstDomainInfo,
  233. IN PND5_TRUST_INFO pSecondDomainName,
  234. OUT BOOL * pfParentChild
  235. );
  236. //
  237. // From query.cxx
  238. //
  239. DWORD
  240. NetDompHandleQuery(ARG_RECORD * rgNetDomArgs);
  241. //
  242. // From time.cxx
  243. //
  244. DWORD
  245. NetDompHandleTime(ARG_RECORD * rgNetDomArgs);
  246. //
  247. // From rename.cxx
  248. //
  249. DWORD
  250. NetDompHandleMoveNT4BDC(ARG_RECORD * rgNetDomArgs);
  251. DWORD
  252. NetDompHandleRenameComputer(ARG_RECORD * rgNetDomArgs);
  253. //
  254. // From ldap.cxx
  255. //
  256. DWORD
  257. NetDompLdapBind(
  258. IN LPWSTR DC,
  259. IN LPWSTR Domain,
  260. IN LPWSTR User,
  261. IN LPWSTR Password,
  262. IN ULONG BindType,
  263. OUT PLDAP *Ldap
  264. );
  265. DWORD
  266. NetDompLdapUnbind(
  267. IN PLDAP Ldap
  268. );
  269. DWORD
  270. NetDompLdapReadOneAttribute(
  271. IN PLDAP Ldap,
  272. IN PWSTR ObjectPath,
  273. IN PWSTR Attribute,
  274. OUT PWSTR *ReadAttribute
  275. );
  276. BOOL
  277. IsLocalMachine(PCWSTR pwzMachine);
  278. DWORD
  279. NetDompJoinDownlevel(
  280. IN PWSTR Server,
  281. IN PWSTR Account,
  282. IN PWSTR Password,
  283. IN PWSTR Dc,
  284. IN ULONG DcFlags,
  285. IN BOOL AllowMove
  286. );
  287. DWORD
  288. NetDompManageGroupMembership(
  289. IN PWSTR Server,
  290. IN PSID DomainSid,
  291. IN BOOL Delete
  292. );
  293. DWORD
  294. NetDompManageMachineSecret(
  295. IN LSA_HANDLE PolicyHandle,
  296. IN LPWSTR lpPassword,
  297. IN INT fControl
  298. );
  299. #endif //ifndef __NETDOM_H__