https://git.reactos.org/?p=reactos.git;a=commitdiff;h=57d48a7f1cb91e83daa6d7c1f396d2a2057298e8

commit 57d48a7f1cb91e83daa6d7c1f396d2a2057298e8
Author:     Eric Kohl <[email protected]>
AuthorDate: Sun Nov 25 22:39:47 2018 +0100
Commit:     Eric Kohl <[email protected]>
CommitDate: Sun Nov 25 23:24:21 2018 +0100

    [NETAPI32] Implement DsGetDcNameA/W --> DsGetDcNameWithAccountA/W --> 
DsrGetDcNameEx2.
---
 dll/win32/netapi32/netapi32.spec |   4 +-
 dll/win32/netapi32/netlogon.c    | 108 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 105 insertions(+), 7 deletions(-)

diff --git a/dll/win32/netapi32/netapi32.spec b/dll/win32/netapi32/netapi32.spec
index 7c5b07e17b..d573ef5fa6 100644
--- a/dll/win32/netapi32/netapi32.spec
+++ b/dll/win32/netapi32/netapi32.spec
@@ -10,8 +10,8 @@
 @ stub DsGetDcCloseW
 @ stdcall DsGetDcNameA(str str ptr str long ptr)
 @ stdcall DsGetDcNameW(wstr wstr ptr wstr long ptr)
-@ stub DsGetDcNameWithAccountA
-@ stub DsGetDcNameWithAccountW
+@ stdcall DsGetDcNameWithAccountA(str str long str ptr str long ptr)
+@ stdcall DsGetDcNameWithAccountW(wstr wstr long wstr ptr wstr long ptr)
 @ stub DsGetDcNextA
 @ stub DsGetDcNextW
 @ stub DsGetDcOpenA
diff --git a/dll/win32/netapi32/netlogon.c b/dll/win32/netapi32/netlogon.c
index d4b939109f..605b3eed7a 100644
--- a/dll/win32/netapi32/netlogon.c
+++ b/dll/win32/netapi32/netlogon.c
@@ -17,6 +17,30 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
 
+DWORD
+WINAPI
+DsGetDcNameWithAccountA(
+    _In_opt_ LPCSTR ComputerName,
+    _In_opt_ LPCSTR AccountName,
+    _In_ ULONG AccountControlBits,
+    _In_ LPCSTR DomainName,
+    _In_ GUID *DomainGuid,
+    _In_ LPCSTR SiteName,
+    _In_ ULONG Flags,
+    _Out_ PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo);
+
+DWORD
+WINAPI
+DsGetDcNameWithAccountW(
+    _In_ LPCWSTR ComputerName,
+    _In_opt_ LPCWSTR AccountName,
+    _In_ ULONG AccountControlBits,
+    _In_ LPCWSTR DomainName,
+    _In_ GUID *DomainGuid,
+    _In_ LPCWSTR SiteName,
+    _In_ ULONG Flags,
+    _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo);
+
 /* FUNCTIONS *****************************************************************/
 
 handle_t
@@ -360,37 +384,111 @@ DsEnumerateDomainTrustsW(
 DWORD
 WINAPI
 DsGetDcNameA(
-    _In_ LPCSTR ComputerName,
+    _In_opt_ LPCSTR ComputerName,
     _In_ LPCSTR DomainName,
     _In_ GUID *DomainGuid,
     _In_ LPCSTR SiteName,
     _In_ ULONG Flags,
     _Out_ PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo)
 {
-    FIXME("DsGetDcNameA(%s, %s, %s, %s, %08x, %p): stub\n",
+    TRACE("DsGetDcNameA(%s, %s, %s, %s, %08lx, %p): stub\n",
           debugstr_a(ComputerName), debugstr_a(DomainName), 
debugstr_guid(DomainGuid),
           debugstr_a(SiteName), Flags, DomainControllerInfo);
-    return ERROR_CALL_NOT_IMPLEMENTED;
+    return DsGetDcNameWithAccountA(ComputerName,
+                                   NULL,
+                                   0,
+                                   DomainName,
+                                   DomainGuid,
+                                   SiteName,
+                                   Flags,
+                                   DomainControllerInfo);
 }
 
 
 DWORD
 WINAPI
 DsGetDcNameW(
-    _In_ LPCWSTR ComputerName,
+    _In_opt_ LPCWSTR ComputerName,
     _In_ LPCWSTR DomainName,
     _In_ GUID *DomainGuid,
     _In_ LPCWSTR SiteName,
     _In_ ULONG Flags,
     _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
 {
-    FIXME("DsGetDcNameW(%s, %s, %s, %s, %08x, %p)\n",
+    TRACE("DsGetDcNameW(%s, %s, %s, %s, %08lx, %p)\n",
           debugstr_w(ComputerName), debugstr_w(DomainName), 
debugstr_guid(DomainGuid),
           debugstr_w(SiteName), Flags, DomainControllerInfo);
+    return DsGetDcNameWithAccountW(ComputerName,
+                                   NULL,
+                                   0,
+                                   DomainName,
+                                   DomainGuid,
+                                   SiteName,
+                                   Flags,
+                                   DomainControllerInfo);
+}
+
+
+DWORD
+WINAPI
+DsGetDcNameWithAccountA(
+    _In_opt_ LPCSTR ComputerName,
+    _In_opt_ LPCSTR AccountName,
+    _In_ ULONG AccountControlBits,
+    _In_ LPCSTR DomainName,
+    _In_ GUID *DomainGuid,
+    _In_ LPCSTR SiteName,
+    _In_ ULONG Flags,
+    _Out_ PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo)
+{
+    FIXME("DsGetDcNameWithAccountA(%s, %s, %08lx, %s, %s, %s, %08lx, %p): 
stub\n",
+          debugstr_a(ComputerName), debugstr_a(AccountName), 
AccountControlBits,
+          debugstr_a(DomainName), debugstr_guid(DomainGuid),
+          debugstr_a(SiteName), Flags, DomainControllerInfo);
     return ERROR_CALL_NOT_IMPLEMENTED;
 }
 
 
+DWORD
+WINAPI
+DsGetDcNameWithAccountW(
+    _In_opt_ LPCWSTR ComputerName,
+    _In_opt_ LPCWSTR AccountName,
+    _In_ ULONG AccountControlBits,
+    _In_ LPCWSTR DomainName,
+    _In_ GUID *DomainGuid,
+    _In_ LPCWSTR SiteName,
+    _In_ ULONG Flags,
+    _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
+{
+    NET_API_STATUS status;
+
+    FIXME("DsGetDcNameWithAccountW(%s, %s, %08lx, %s, %s, %s, %08lx, %p): 
stub\n",
+          debugstr_w(ComputerName), debugstr_w(AccountName), 
AccountControlBits,
+          debugstr_w(DomainName), debugstr_guid(DomainGuid),
+          debugstr_w(SiteName), Flags, DomainControllerInfo);
+
+    RpcTryExcept
+    {
+        status = DsrGetDcNameEx2((PWSTR)ComputerName,
+                                 (PWSTR)AccountName,
+                                 AccountControlBits,
+                                 (PWSTR)DomainName,
+                                 DomainGuid,
+                                 (PWSTR)SiteName,
+                                 Flags,
+                                 DomainControllerInfo);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
 DWORD
 WINAPI
 DsGetDcSiteCoverageA(

Reply via email to