Author: ekohl
Date: Wed Jun 14 09:50:54 2017
New Revision: 75032
URL:
http://svn.reactos.org/svn/reactos?rev=75032&view=rev
Log:
[NETAPI32]
Implement NetAddAlternateComputerName, NetJoinDomain, NetRemoveAlternateComputerName,
NetRenameMachineInDomain, NetSetPrimaryComputerName and NetUnjoinDomain. These functions
call their counterparts in the workstation service.
Modified:
trunk/reactos/dll/win32/netapi32/netapi32.spec
trunk/reactos/dll/win32/netapi32/wksta_new.c
Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] Wed Jun 14 09:50:54 2017
@@ -99,7 +99,7 @@
@ stub I_NetlogonComputeClientDigest
@ stub I_NetlogonComputeServerDigest
@ stub I_NetlogonGetTrustRid
-@ stub NetAddAlternateComputerName
+@ stdcall NetAddAlternateComputerName(wstr wstr wstr wstr long)
@ stdcall NetAlertRaise(wstr ptr long)
@ stdcall NetAlertRaiseEx(wstr ptr long wstr)
@ stdcall NetApiBufferAllocate(long ptr)
@@ -161,7 +161,7 @@
@ stdcall NetGroupGetUsers(wstr wstr long ptr long ptr ptr ptr)
@ stdcall NetGroupSetInfo(wstr wstr long ptr ptr)
@ stdcall NetGroupSetUsers(wstr wstr long ptr long)
-@ stub NetJoinDomain
+@ stdcall NetJoinDomain(wstr wstr wstr wstr wstr long)
@ stdcall NetLocalGroupAdd(wstr long ptr ptr)
@ stdcall NetLocalGroupAddMember(wstr wstr ptr)
@ stdcall NetLocalGroupAddMembers(wstr wstr long ptr long)
@@ -184,8 +184,8 @@
@ stub NetRegisterDomainNameChangeNotification
@ stub NetRemoteComputerSupports
@ stdcall NetRemoteTOD(wstr ptr)
-@ stub NetRemoveAlternateComputerName
-@ stub NetRenameMachineInDomain
+@ stdcall NetRemoveAlternateComputerName(wstr wstr wstr wstr long)
+@ stdcall NetRenameMachineInDomain(wstr wstr wstr wstr long)
@ stub NetReplExportDirAdd
@ stub NetReplExportDirDel
@ stub NetReplExportDirEnum
@@ -223,7 +223,7 @@
@ stdcall NetSessionDel(wstr wstr wstr)
@ stdcall NetSessionEnum(wstr wstr wstr long ptr long ptr ptr ptr)
@ stdcall NetSessionGetInfo(wstr wstr wstr long ptr)
-@ stub NetSetPrimaryComputerName
+@ stdcall NetSetPrimaryComputerName(wstr wstr wstr wstr long)
@ stdcall NetShareAdd(wstr long ptr ptr)
@ stdcall NetShareCheck(wstr wstr ptr)
@ stdcall NetShareDel(wstr wstr long)
@@ -233,7 +233,7 @@
@ stdcall NetShareGetInfo(wstr wstr long ptr)
@ stdcall NetShareSetInfo(wstr wstr long ptr ptr)
@ stdcall NetStatisticsGet(wstr wstr long long ptr)
-@ stub NetUnjoinDomain
+@ stdcall NetUnjoinDomain(wstr wstr wstr long)
@ stub NetUnregisterDomainNameChangeNotification
@ stdcall NetUseAdd(wstr long ptr ptr)
@ stdcall NetUseDel(wstr wstr long)
Modified: trunk/reactos/dll/win32/netapi32/wksta_new.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/wksta_n…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/wksta_new.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/wksta_new.c [iso-8859-1] Wed Jun 14 09:50:54 2017
@@ -138,9 +138,49 @@
}
+NET_API_STATUS
+WINAPI
+NetAddAlternateComputerName(
+ _In_opt_ LPCWSTR Server,
+ _In_ LPCWSTR AlternateName,
+ _In_opt_ LPCWSTR DomainAccount,
+ _In_opt_ LPCWSTR DomainAccountPassword,
+ _In_ ULONG Reserved)
+{
+ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+ handle_t BindingHandle;
+ NET_API_STATUS status;
+
+ TRACE("NetAddAlternateComputerName(%s %s %s %s 0x%lx)\n",
+ debugstr_w(Server), debugstr_w(AlternateName), debugstr_w(DomainAccount),
+ debugstr_w(DomainAccountPassword), Reserved);
+
+ /* FIXME */
+ BindingHandle = NULL;
+ EncryptedPassword = NULL;
+
+ RpcTryExcept
+ {
+ status = NetrAddAlternateComputerName(BindingHandle,
+ (PWSTR)Server,
+ (PWSTR)AlternateName,
+ (PWSTR)DomainAccount,
+ EncryptedPassword,
+ Reserved);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
#if 0
NET_API_STATUS
-NET_API_FUNCTION
+WINAPI
NetGetJoinInformation(
LPCWSTR Server,
LPWSTR *Name,
@@ -169,6 +209,206 @@
return status;
}
#endif
+
+
+NET_API_STATUS
+WINAPI
+NetJoinDomain(
+ _In_ LPCWSTR lpServer,
+ _In_ LPCWSTR lpDomain,
+ _In_ LPCWSTR lpAccountOU,
+ _In_ LPCWSTR lpAccount,
+ _In_ LPCWSTR lpPassword,
+ _In_ DWORD fJoinOptions)
+{
+ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+ handle_t BindingHandle;
+ NET_API_STATUS status;
+
+ TRACE("NetJoinDomain(%s %s %s %s 0x%lx)\n",
+ debugstr_w(lpServer), debugstr_w(lpDomain), debugstr_w(lpAccountOU),
+ debugstr_w(lpAccount), debugstr_w(lpPassword), fJoinOptions);
+
+ /* FIXME */
+ BindingHandle = NULL;
+ EncryptedPassword = NULL;
+
+ RpcTryExcept
+ {
+ status = NetrJoinDomain2(BindingHandle,
+ (PWSTR)lpServer,
+ (PWSTR)lpDomain,
+ (PWSTR)lpAccountOU,
+ (PWSTR)lpAccount,
+ EncryptedPassword,
+ fJoinOptions);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetRemoveAlternateComputerName(
+ _In_opt_ LPCWSTR Server,
+ _In_ LPCWSTR AlternateName,
+ _In_opt_ LPCWSTR DomainAccount,
+ _In_opt_ LPCWSTR DomainAccountPassword,
+ _In_ ULONG Reserved)
+{
+ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+ handle_t BindingHandle;
+ NET_API_STATUS status;
+
+ TRACE("NetRemoveAlternateComputerName(%s %s %s %s 0x%lx)\n",
+ debugstr_w(Server), debugstr_w(AlternateName), debugstr_w(DomainAccount),
+ debugstr_w(DomainAccountPassword), Reserved);
+
+ /* FIXME */
+ BindingHandle = NULL;
+ EncryptedPassword = NULL;
+
+ RpcTryExcept
+ {
+ status = NetrRemoveAlternateComputerName(BindingHandle,
+ (PWSTR)Server,
+ (PWSTR)AlternateName,
+ (PWSTR)DomainAccount,
+ EncryptedPassword,
+ Reserved);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetRenameMachineInDomain(
+ _In_ LPCWSTR lpServer,
+ _In_ LPCWSTR lpNewMachineName,
+ _In_ LPCWSTR lpAccount,
+ _In_ LPCWSTR lpPassword,
+ _In_ DWORD fRenameOptions)
+{
+ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+ handle_t BindingHandle;
+ NET_API_STATUS status;
+
+ TRACE("NetRenameMachineInDomain(%s %s %s %s 0x%lx)\n",
+ debugstr_w(lpServer), debugstr_w(lpNewMachineName), debugstr_w(lpAccount),
+ debugstr_w(lpPassword), fRenameOptions);
+
+ /* FIXME */
+ BindingHandle = NULL;
+ EncryptedPassword = NULL;
+
+ RpcTryExcept
+ {
+ status = NetrRenameMachineInDomain2(BindingHandle,
+ (PWSTR)lpServer,
+ (PWSTR)lpNewMachineName,
+ (PWSTR)lpAccount,
+ EncryptedPassword,
+ fRenameOptions);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetSetPrimaryComputerName(
+ _In_opt_ LPCWSTR Server,
+ _In_ LPCWSTR PrimaryName,
+ _In_opt_ LPCWSTR DomainAccount,
+ _In_opt_ LPCWSTR DomainAccountPassword,
+ _In_ ULONG Reserved)
+{
+ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+ handle_t BindingHandle;
+ NET_API_STATUS status;
+
+ TRACE("NetSetPrimaryComputerName(%s %s %s %s %lu)\n",
+ debugstr_w(Server), debugstr_w(PrimaryName), debugstr_w(DomainAccount),
+ debugstr_w(DomainAccountPassword), Reserved);
+
+ /* FIXME */
+ BindingHandle = NULL;
+ EncryptedPassword = NULL;
+
+ RpcTryExcept
+ {
+ status = NetrSetPrimaryComputerName(BindingHandle,
+ (PWSTR)Server,
+ (PWSTR)PrimaryName,
+ (PWSTR)DomainAccount,
+ EncryptedPassword,
+ Reserved);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetUnjoinDomain(
+ _In_ LPCWSTR lpServer,
+ _In_ LPCWSTR lpAccount,
+ _In_ LPCWSTR lpPassword,
+ _In_ DWORD fUnjoinOptions)
+{
+ PJOINPR_ENCRYPTED_USER_PASSWORD EncryptedPassword;
+ handle_t BindingHandle;
+ NET_API_STATUS status;
+
+ TRACE("NetUnjoinDomain(%s %s %s %s 0x%lx)\n",
+ debugstr_w(lpServer), debugstr_w(lpAccount),
+ debugstr_w(lpPassword), fUnjoinOptions);
+
+ /* FIXME */
+ BindingHandle = NULL;
+ EncryptedPassword = NULL;
+
+ RpcTryExcept
+ {
+ status = NetrUnjoinDomain2(BindingHandle,
+ (PWSTR)lpServer,
+ (PWSTR)lpAccount,
+ EncryptedPassword,
+ fUnjoinOptions);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
NET_API_STATUS