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.

230 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. netsetup.h
  5. Abstract:
  6. Definitions and prototypes for the Net setup apis, for joining/unjoinging
  7. domains and promoting/demoting servers
  8. Environment:
  9. User Mode - Win32
  10. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  11. Requires ANSI C extensions: slash-slash comments, long external names.
  12. Notes:
  13. --*/
  14. #ifndef __LMJOIN_H__
  15. #define __LMJOIN_H__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. //
  23. // Types of name that can be validated
  24. //
  25. typedef enum _NETSETUP_NAME_TYPE {
  26. NetSetupUnknown = 0,
  27. NetSetupMachine,
  28. NetSetupWorkgroup,
  29. NetSetupDomain,
  30. NetSetupNonExistentDomain,
  31. #if(_WIN32_WINNT >= 0x0500)
  32. NetSetupDnsMachine
  33. #endif
  34. } NETSETUP_NAME_TYPE, *PNETSETUP_NAME_TYPE;
  35. //
  36. // Status of a workstation
  37. //
  38. typedef enum _NETSETUP_JOIN_STATUS {
  39. NetSetupUnknownStatus = 0,
  40. NetSetupUnjoined,
  41. NetSetupWorkgroupName,
  42. NetSetupDomainName
  43. } NETSETUP_JOIN_STATUS, *PNETSETUP_JOIN_STATUS;
  44. //
  45. // Flags to determine the behavior of the join/unjoin APIs
  46. //
  47. #define NETSETUP_JOIN_DOMAIN 0x00000001 // If not present, workgroup is joined
  48. #define NETSETUP_ACCT_CREATE 0x00000002 // Do the server side account creation/rename
  49. #define NETSETUP_ACCT_DELETE 0x00000004 // Delete the account when a domain is left
  50. #define NETSETUP_WIN9X_UPGRADE 0x00000010 // Invoked during upgrade of Windows 9x to
  51. // Windows NT
  52. #define NETSETUP_DOMAIN_JOIN_IF_JOINED 0x00000020 // Allow the client to join a new domain
  53. // even if it is already joined to a domain
  54. #define NETSETUP_JOIN_UNSECURE 0x00000040 // Performs an unsecure join
  55. #define NETSETUP_MACHINE_PWD_PASSED 0x00000080 // Indicates that the machine (not user) password
  56. // is passed. Valid only for unsecure joins
  57. #define NETSETUP_DEFER_SPN_SET 0x00000100 // Specifies that writting SPN and DnsHostName
  58. // attributes on the computer object should be
  59. // defered until rename that will follow join
  60. #define NETSETUP_INSTALL_INVOCATION 0x00040000 // The APIs were invoked during install
  61. #define NETSETUP_IGNORE_UNSUPPORTED_FLAGS 0x10000000 // If this bit is set, unrecognized flags
  62. // will be ignored by the NetJoin API and
  63. // the API will behave as if the flags
  64. // were not set.
  65. #define NETSETUP_VALID_UNJOIN_FLAGS (NETSETUP_ACCT_DELETE | NETSETUP_IGNORE_UNSUPPORTED_FLAGS)
  66. //
  67. // 0x80000000 is reserved for internal use only
  68. //
  69. //
  70. // Joins a machine to the domain.
  71. //
  72. NET_API_STATUS
  73. NET_API_FUNCTION
  74. NetJoinDomain(
  75. IN LPCWSTR lpServer OPTIONAL,
  76. IN LPCWSTR lpDomain,
  77. IN LPCWSTR lpAccountOU, OPTIONAL
  78. IN LPCWSTR lpAccount OPTIONAL,
  79. IN LPCWSTR lpPassword OPTIONAL,
  80. IN DWORD fJoinOptions
  81. );
  82. NET_API_STATUS
  83. NET_API_FUNCTION
  84. NetUnjoinDomain(
  85. IN LPCWSTR lpServer OPTIONAL,
  86. IN LPCWSTR lpAccount OPTIONAL,
  87. IN LPCWSTR lpPassword OPTIONAL,
  88. IN DWORD fUnjoinOptions
  89. );
  90. NET_API_STATUS
  91. NET_API_FUNCTION
  92. NetRenameMachineInDomain(
  93. IN LPCWSTR lpServer OPTIONAL,
  94. IN LPCWSTR lpNewMachineName OPTIONAL,
  95. IN LPCWSTR lpAccount OPTIONAL,
  96. IN LPCWSTR lpPassword OPTIONAL,
  97. IN DWORD fRenameOptions
  98. );
  99. //
  100. // Determine the validity of a name
  101. //
  102. NET_API_STATUS
  103. NET_API_FUNCTION
  104. NetValidateName(
  105. IN LPCWSTR lpServer OPTIONAL,
  106. IN LPCWSTR lpName,
  107. IN LPCWSTR lpAccount OPTIONAL,
  108. IN LPCWSTR lpPassword OPTIONAL,
  109. IN NETSETUP_NAME_TYPE NameType
  110. );
  111. //
  112. // Determines whether a workstation is joined to a domain or not
  113. //
  114. NET_API_STATUS
  115. NET_API_FUNCTION
  116. NetGetJoinInformation(
  117. IN LPCWSTR lpServer OPTIONAL,
  118. OUT LPWSTR *lpNameBuffer,
  119. OUT PNETSETUP_JOIN_STATUS BufferType
  120. );
  121. //
  122. // Determines the list of OUs that the client can create a machine account in
  123. //
  124. NET_API_STATUS
  125. NET_API_FUNCTION
  126. NetGetJoinableOUs(
  127. IN LPCWSTR lpServer OPTIONAL,
  128. IN LPCWSTR lpDomain,
  129. IN LPCWSTR lpAccount OPTIONAL,
  130. IN LPCWSTR lpPassword OPTIONAL,
  131. OUT DWORD *OUCount,
  132. OUT LPWSTR **OUs
  133. );
  134. //
  135. // Computer rename preparation APIs
  136. //
  137. #define NET_IGNORE_UNSUPPORTED_FLAGS 0x01
  138. NET_API_STATUS
  139. NET_API_FUNCTION
  140. NetAddAlternateComputerName(
  141. IN LPCWSTR Server OPTIONAL,
  142. IN LPCWSTR AlternateName,
  143. IN LPCWSTR DomainAccount OPTIONAL,
  144. IN LPCWSTR DomainAccountPassword OPTIONAL,
  145. IN ULONG Reserved
  146. );
  147. NET_API_STATUS
  148. NET_API_FUNCTION
  149. NetRemoveAlternateComputerName(
  150. IN LPCWSTR Server OPTIONAL,
  151. IN LPCWSTR AlternateName,
  152. IN LPCWSTR DomainAccount OPTIONAL,
  153. IN LPCWSTR DomainAccountPassword OPTIONAL,
  154. IN ULONG Reserved
  155. );
  156. NET_API_STATUS
  157. NET_API_FUNCTION
  158. NetSetPrimaryComputerName(
  159. IN LPCWSTR Server OPTIONAL,
  160. IN LPCWSTR PrimaryName,
  161. IN LPCWSTR DomainAccount OPTIONAL,
  162. IN LPCWSTR DomainAccountPassword OPTIONAL,
  163. IN ULONG Reserved
  164. );
  165. //
  166. // The following enumeration must be kept
  167. // in sync with COMPUTER_NAME_TYPE defined
  168. // in winbase.h
  169. //
  170. typedef enum _NET_COMPUTER_NAME_TYPE {
  171. NetPrimaryComputerName,
  172. NetAlternateComputerNames,
  173. NetAllComputerNames,
  174. NetComputerNameTypeMax
  175. } NET_COMPUTER_NAME_TYPE, *PNET_COMPUTER_NAME_TYPE;
  176. NET_API_STATUS
  177. NET_API_FUNCTION
  178. NetEnumerateComputerNames(
  179. IN LPCWSTR Server OPTIONAL,
  180. IN NET_COMPUTER_NAME_TYPE NameType,
  181. IN ULONG Reserved,
  182. OUT PDWORD EntryCount,
  183. OUT LPWSTR **ComputerNames
  184. );
  185. #ifdef __cplusplus
  186. }
  187. #endif
  188. #endif // __LMJOIN_H__