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.

223 lines
5.4 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. //
  62. // 0x80000000 is reserved for internal use only
  63. //
  64. //
  65. // Joins a machine to the domain.
  66. //
  67. NET_API_STATUS
  68. NET_API_FUNCTION
  69. NetJoinDomain(
  70. IN LPCWSTR lpServer OPTIONAL,
  71. IN LPCWSTR lpDomain,
  72. IN LPCWSTR lpAccountOU, OPTIONAL
  73. IN LPCWSTR lpAccount OPTIONAL,
  74. IN LPCWSTR lpPassword OPTIONAL,
  75. IN DWORD fJoinOptions
  76. );
  77. NET_API_STATUS
  78. NET_API_FUNCTION
  79. NetUnjoinDomain(
  80. IN LPCWSTR lpServer OPTIONAL,
  81. IN LPCWSTR lpAccount OPTIONAL,
  82. IN LPCWSTR lpPassword OPTIONAL,
  83. IN DWORD fUnjoinOptions
  84. );
  85. NET_API_STATUS
  86. NET_API_FUNCTION
  87. NetRenameMachineInDomain(
  88. IN LPCWSTR lpServer OPTIONAL,
  89. IN LPCWSTR lpNewMachineName OPTIONAL,
  90. IN LPCWSTR lpAccount OPTIONAL,
  91. IN LPCWSTR lpPassword OPTIONAL,
  92. IN DWORD fRenameOptions
  93. );
  94. //
  95. // Determine the validity of a name
  96. //
  97. NET_API_STATUS
  98. NET_API_FUNCTION
  99. NetValidateName(
  100. IN LPCWSTR lpServer OPTIONAL,
  101. IN LPCWSTR lpName,
  102. IN LPCWSTR lpAccount OPTIONAL,
  103. IN LPCWSTR lpPassword OPTIONAL,
  104. IN NETSETUP_NAME_TYPE NameType
  105. );
  106. //
  107. // Determines whether a workstation is joined to a domain or not
  108. //
  109. NET_API_STATUS
  110. NET_API_FUNCTION
  111. NetGetJoinInformation(
  112. IN LPCWSTR lpServer OPTIONAL,
  113. OUT LPWSTR *lpNameBuffer,
  114. OUT PNETSETUP_JOIN_STATUS BufferType
  115. );
  116. //
  117. // Determines the list of OUs that the client can create a machine account in
  118. //
  119. NET_API_STATUS
  120. NET_API_FUNCTION
  121. NetGetJoinableOUs(
  122. IN LPCWSTR lpServer OPTIONAL,
  123. IN LPCWSTR lpDomain,
  124. IN LPCWSTR lpAccount OPTIONAL,
  125. IN LPCWSTR lpPassword OPTIONAL,
  126. OUT DWORD *OUCount,
  127. OUT LPWSTR **OUs
  128. );
  129. //
  130. // Computer rename preparation APIs
  131. //
  132. #define NET_IGNORE_UNSUPPORTED_FLAGS 0x01
  133. NET_API_STATUS
  134. NET_API_FUNCTION
  135. NetAddAlternateComputerName(
  136. IN LPCWSTR Server OPTIONAL,
  137. IN LPCWSTR AlternateName,
  138. IN LPCWSTR DomainAccount OPTIONAL,
  139. IN LPCWSTR DomainAccountPassword OPTIONAL,
  140. IN ULONG Reserved
  141. );
  142. NET_API_STATUS
  143. NET_API_FUNCTION
  144. NetRemoveAlternateComputerName(
  145. IN LPCWSTR Server OPTIONAL,
  146. IN LPCWSTR AlternateName,
  147. IN LPCWSTR DomainAccount OPTIONAL,
  148. IN LPCWSTR DomainAccountPassword OPTIONAL,
  149. IN ULONG Reserved
  150. );
  151. NET_API_STATUS
  152. NET_API_FUNCTION
  153. NetSetPrimaryComputerName(
  154. IN LPCWSTR Server OPTIONAL,
  155. IN LPCWSTR PrimaryName,
  156. IN LPCWSTR DomainAccount OPTIONAL,
  157. IN LPCWSTR DomainAccountPassword OPTIONAL,
  158. IN ULONG Reserved
  159. );
  160. //
  161. // The following enumeration must be kept
  162. // in sync with COMPUTER_NAME_TYPE defined
  163. // in winbase.h
  164. //
  165. typedef enum _NET_COMPUTER_NAME_TYPE {
  166. NetPrimaryComputerName,
  167. NetAlternateComputerNames,
  168. NetAllComputerNames,
  169. NetComputerNameTypeMax
  170. } NET_COMPUTER_NAME_TYPE, *PNET_COMPUTER_NAME_TYPE;
  171. NET_API_STATUS
  172. NET_API_FUNCTION
  173. NetEnumerateComputerNames(
  174. IN LPCWSTR Server OPTIONAL,
  175. IN NET_COMPUTER_NAME_TYPE NameType,
  176. IN ULONG Reserved,
  177. OUT PDWORD EntryCount,
  178. OUT LPWSTR **ComputerNames
  179. );
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183. #endif // __LMJOIN_H__