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.

363 lines
7.1 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. PSID Sid;
  55. LSA_HANDLE LsaHandle; // LSA Policy handle
  56. LSA_HANDLE TrustHandle; // TDO handle
  57. ULONG Flags;
  58. BOOL Uplevel;
  59. BOOL Connected;
  60. PVOID BlobToFree;
  61. BOOL fWasDownlevel;
  62. } ND5_TRUST_INFO, *PND5_TRUST_INFO;
  63. bool
  64. CmdFlagOn(ARG_RECORD * rgNetDomArgs, NETDOM_ARG_ENUM eArgIndex);
  65. DWORD
  66. NetDompGetTrustDirection(
  67. IN PND5_TRUST_INFO TrustingInfo,
  68. IN PND5_TRUST_INFO TrustedInfo,
  69. IN OUT PDWORD Direction
  70. );
  71. //
  72. // From ndutil.cxx
  73. //
  74. DWORD
  75. NetDompValidateSecondaryArguments(ARG_RECORD * rgNetDomArgs,
  76. NETDOM_ARG_ENUM eFirstValidParam, ...);
  77. DWORD
  78. NetDompGetUserAndPasswordForOperation(ARG_RECORD * rgNetDomArgs,
  79. NETDOM_ARG_ENUM eUserType,
  80. PWSTR DefaultDomain,
  81. PND5_AUTH_INFO AuthIdent);
  82. VOID
  83. NetDompFreeAuthIdent(
  84. IN PND5_AUTH_INFO AuthIdent
  85. );
  86. DWORD
  87. NetDompGetDomainForOperation(ARG_RECORD * rgNetDomArgs,
  88. PWSTR Server OPTIONAL,
  89. BOOL CanDefaultToCurrent,
  90. PWSTR *DomainName);
  91. DWORD
  92. NetDompGetArgumentString(ARG_RECORD * rgNetDomArgs,
  93. NETDOM_ARG_ENUM eArgToGet,
  94. PWSTR *ArgString);
  95. BOOL
  96. NetDompGetArgumentBoolean(ARG_RECORD * rgNetDomArgs,
  97. NETDOM_ARG_ENUM eArgToGet);
  98. DWORD
  99. NetDompControlService(
  100. IN PWSTR Server,
  101. IN PWSTR Service,
  102. IN DWORD ServiceOptions
  103. );
  104. DWORD
  105. NetDompRestartAsRequired(ARG_RECORD * rgNetDomArgs,
  106. PWSTR Machine,
  107. PWSTR User,
  108. DWORD PreliminaryStatus,
  109. DWORD MsgID);
  110. DWORD
  111. NetDompCheckDomainMembership(
  112. IN PWSTR Server,
  113. IN PND5_AUTH_INFO AuthInfo,
  114. IN BOOL EstablishSessionIfRequried,
  115. IN OUT BOOL * DomainMember
  116. );
  117. DWORD
  118. NetDompGenerateRandomPassword(
  119. IN PWSTR Buffer,
  120. IN ULONG Length
  121. );
  122. BOOL
  123. NetDompGetUserConfirmation(
  124. IN DWORD PromptResId,
  125. IN PWSTR pwzName
  126. );
  127. //
  128. // From netdom5.cxx
  129. //
  130. VOID
  131. DisplayHelp(NETDOM_ARG_ENUM HelpOp);
  132. VOID
  133. NetDompDisplayMessage(
  134. IN DWORD MessageId,
  135. ...
  136. );
  137. VOID
  138. NetDompDisplayMessageAndError(
  139. IN DWORD MessageId,
  140. IN DWORD Error,
  141. IN PWSTR String OPTIONAL
  142. );
  143. VOID
  144. NetDompDisplayUnexpectedParameter(
  145. IN PWSTR UnexpectedParameter
  146. );
  147. VOID
  148. NetDompDisplayErrorMessage(
  149. IN DWORD Error
  150. );
  151. //
  152. // From join.cxx
  153. //
  154. DWORD
  155. NetDompHandleAdd(ARG_RECORD * rgNetDomArgs);
  156. DWORD
  157. NetDompHandleRemove(ARG_RECORD * rgNetDomArgs);
  158. DWORD
  159. NetDompHandleJoin(ARG_RECORD * rgNetDomArgs, BOOL AllowMove);
  160. DWORD
  161. NetDompHandleMove(ARG_RECORD * rgNetDomArgs);
  162. DWORD
  163. NetDompHandleReset(ARG_RECORD * rgNetDomArgs);
  164. DWORD
  165. NetDompHandleResetPwd(ARG_RECORD * rgNetDomArgs);
  166. DWORD
  167. NetDompHandleVerify(ARG_RECORD * rgNetDomArgs);
  168. DWORD
  169. NetDompVerifyServerSC(
  170. IN PWSTR Domain,
  171. IN PWSTR Server,
  172. IN PND5_AUTH_INFO AuthInfo,
  173. IN ULONG OkMessageId,
  174. IN ULONG FailedMessageId
  175. );
  176. DWORD
  177. NetDompResetServerSC(
  178. IN PWSTR Domain,
  179. IN PWSTR Server,
  180. IN PWSTR DomainController, OPTIONAL
  181. IN PND5_AUTH_INFO AuthInfo,
  182. IN ULONG OkMessageId,
  183. IN ULONG FailedMessageId
  184. );
  185. //
  186. // From trust.cxx
  187. //
  188. DWORD
  189. NetDompHandleTrust(ARG_RECORD * rgNetDomArgs);
  190. DWORD
  191. NetDompTrustGetDomInfo(
  192. IN PWSTR Domain,
  193. IN PWSTR DomainController OPTIONAL,
  194. IN PND5_AUTH_INFO AuthInfo,
  195. IN OUT PND5_TRUST_INFO TrustInfo,
  196. IN BOOL ManageTrust,
  197. IN BOOL Force,
  198. IN BOOL fUseNullSession
  199. );
  200. VOID
  201. NetDompFreeDomInfo(
  202. IN OUT PND5_TRUST_INFO TrustInfo
  203. );
  204. DWORD
  205. NetDompVerifyTrust(
  206. IN PND5_TRUST_INFO TrustingInfo,
  207. IN PND5_TRUST_INFO TrustedInfo,
  208. BOOL fShowResults
  209. );
  210. DWORD
  211. NetDompResetTrustPasswords(
  212. IN PWSTR TrustingDomain,
  213. IN PWSTR TrustedDomain,
  214. IN PND5_AUTH_INFO TrustingCreds,
  215. IN PND5_AUTH_INFO TrustedCreds
  216. );
  217. DWORD
  218. NetDompSetMitTrustPW(
  219. IN PWSTR TrustingDomain,
  220. IN PWSTR TrustedDomain,
  221. IN PND5_AUTH_INFO TrustingCreds,
  222. IN PND5_AUTH_INFO TrustedCreds,
  223. IN PWSTR pwzNewTrustPW
  224. );
  225. DWORD
  226. NetDompIsParentChild(
  227. IN PND5_TRUST_INFO pFirstDomainInfo,
  228. IN PND5_TRUST_INFO pSecondDomainName,
  229. OUT BOOL * pfParentChild
  230. );
  231. //
  232. // From query.cxx
  233. //
  234. DWORD
  235. NetDompHandleQuery(ARG_RECORD * rgNetDomArgs);
  236. //
  237. // From time.cxx
  238. //
  239. DWORD
  240. NetDompHandleTime(ARG_RECORD * rgNetDomArgs);
  241. //
  242. // From rename.cxx
  243. //
  244. DWORD
  245. NetDompHandleRename(ARG_RECORD * rgNetDomArgs);
  246. DWORD
  247. NetDompHandleRenameComputer(ARG_RECORD * rgNetDomArgs);
  248. //
  249. // From ldap.cxx
  250. //
  251. DWORD
  252. NetDompLdapBind(
  253. IN LPWSTR DC,
  254. IN LPWSTR Domain,
  255. IN LPWSTR User,
  256. IN LPWSTR Password,
  257. IN ULONG BindType,
  258. OUT PLDAP *Ldap
  259. );
  260. DWORD
  261. NetDompLdapUnbind(
  262. IN PLDAP Ldap
  263. );
  264. DWORD
  265. NetDompLdapReadOneAttribute(
  266. IN PLDAP Ldap,
  267. IN PWSTR ObjectPath,
  268. IN PWSTR Attribute,
  269. OUT PWSTR *ReadAttribute
  270. );
  271. BOOL
  272. IsLocalMachine( LPWSTR Machine );
  273. DWORD
  274. NetDompJoinDownlevel(
  275. IN PWSTR Server,
  276. IN PWSTR Account,
  277. IN PWSTR Password,
  278. IN PWSTR Dc,
  279. IN ULONG DcFlags,
  280. IN BOOL AllowMove
  281. );
  282. DWORD
  283. NetDompManageGroupMembership(
  284. IN PWSTR Server,
  285. IN PSID DomainSid,
  286. IN BOOL Delete
  287. );
  288. DWORD
  289. NetDompManageMachineSecret(
  290. IN LSA_HANDLE PolicyHandle,
  291. IN LPWSTR lpPassword,
  292. IN INT fControl
  293. );
  294. #endif //ifndef __NETDOM_H__