[NETAPI32]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 1 Jul 2017 23:12:06 +0000 (23:12 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 1 Jul 2017 23:12:06 +0000 (23:12 +0000)
- Add DsEnumerateDomainTrustsA, DsEnumerateDomainTrustsW, DsRoleFreeMemory, DsGetDcNameA, DsGetDcNameW, DsGetSiteNameA and DsGetSiteNameW stubs to netlogon.c.
- Remove the now obsolete file ds.c.
- Implement DsGetSiteNameW and NetEnumerateTrustedDomains. These functions call their counterpart in the netlogon service.

svn path=/trunk/; revision=75261

reactos/dll/win32/netapi32/CMakeLists.txt
reactos/dll/win32/netapi32/ds.c [deleted file]
reactos/dll/win32/netapi32/netapi32.spec
reactos/dll/win32/netapi32/netlogon.c
reactos/sdk/include/reactos/idl/netlogon.idl

index ab995a7..ca50a39 100644 (file)
@@ -17,7 +17,6 @@ list(APPEND SOURCE
     access.c
     apibuf.c
     browser.c
-    ds.c
     dssetup.c
     group.c
     local_group.c
diff --git a/reactos/dll/win32/netapi32/ds.c b/reactos/dll/win32/netapi32/ds.c
deleted file mode 100644 (file)
index 986bcbe..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2005 Paul Vriens
- *
- * netapi32 directory service functions
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "netapi32.h"
-
-#include <dsrole.h>
-#include <dsgetdc.h>
-
-WINE_DEFAULT_DEBUG_CHANNEL(ds);
-
-DWORD WINAPI DsGetDcNameW(LPCWSTR ComputerName, LPCWSTR AvoidDCName,
- GUID* DomainGuid, LPCWSTR SiteName, ULONG Flags,
- PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
-{
-    FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_w(ComputerName),
-     debugstr_w(AvoidDCName), debugstr_guid(DomainGuid),
-     debugstr_w(SiteName), Flags, DomainControllerInfo);
-    return ERROR_CALL_NOT_IMPLEMENTED;
-}
-
-DWORD WINAPI DsGetDcNameA(LPCSTR ComputerName, LPCSTR AvoidDCName,
- GUID* DomainGuid, LPCSTR SiteName, ULONG Flags,
- PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo)
-{
-    FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_a(ComputerName),
-     debugstr_a(AvoidDCName), debugstr_guid(DomainGuid),
-     debugstr_a(SiteName), Flags, DomainControllerInfo);
-    return ERROR_CALL_NOT_IMPLEMENTED;
-}
-
-DWORD WINAPI DsGetSiteNameW(LPCWSTR ComputerName, LPWSTR *SiteName)
-{
-    FIXME("(%s, %p): stub\n", debugstr_w(ComputerName), SiteName);
-    return ERROR_CALL_NOT_IMPLEMENTED;
-}
-
-/************************************************************
- *  DsRoleFreeMemory (NETAPI32.@)
- *
- * PARAMS
- *  Buffer [I] Pointer to the to-be-freed buffer.
- *
- * RETURNS
- *  Nothing
- */
-VOID WINAPI DsRoleFreeMemory(PVOID Buffer)
-{
-    TRACE("(%p)\n", Buffer);
-    HeapFree(GetProcessHeap(), 0, Buffer);
-}
-
-/************************************************************
- *  DsEnumerateDomainTrustsA (NETAPI32.@)
- */
-DWORD WINAPI DsEnumerateDomainTrustsA(LPSTR ServerName, ULONG Flags, PDS_DOMAIN_TRUSTSA* Domains, PULONG DomainCount)
-{
-    FIXME("(%s, %x, %p, %p): stub\n", ServerName, Flags, Domains, DomainCount);
-    return ERROR_NO_LOGON_SERVERS;
-}
-
-/************************************************************
- *  DsEnumerateDomainTrustsW (NETAPI32.@)
- */
-DWORD WINAPI DsEnumerateDomainTrustsW(LPWSTR ServerName, ULONG Flags, PDS_DOMAIN_TRUSTSW* Domains, PULONG DomainCount)
-{
-    FIXME("(%s, %x, %p, %p): stub\n", debugstr_w(ServerName), Flags, Domains, DomainCount);
-    return ERROR_NO_LOGON_SERVERS;
-}
index a6ae6bb..3f2e108 100644 (file)
@@ -19,7 +19,7 @@
 @ stub DsGetDcSiteCoverageA
 @ stub DsGetDcSiteCoverageW
 @ stub DsGetForestTrustInformationW
-@ stub DsGetSiteNameA
+@ stdcall DsGetSiteNameA(str str)
 @ stdcall DsGetSiteNameW(wstr wstr)
 @ stub DsMergeForestTrustInformationW
 @ stub DsRoleAbortDownlevelServerUpgrade
index 1385d02..d68f8ed 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "netapi32.h"
 #include <rpc.h>
+#include <dsrole.h>
+#include <dsgetdc.h>
 #include "netlogon_c.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
@@ -71,16 +73,147 @@ LOGONSRV_HANDLE_unbind(LOGONSRV_HANDLE pszSystemName,
 }
 
 
+DWORD
+WINAPI
+DsEnumerateDomainTrustsA(
+    _In_opt_ LPSTR ServerName,
+    _In_ ULONG Flags,
+    _Out_ PDS_DOMAIN_TRUSTSA *Domains,
+    _Out_ PULONG DomainCount)
+{
+    FIXME("DsEnumerateDomainTrustsA(%s, %x, %p, %p)\n",
+          debugstr_a(ServerName), Flags, Domains, DomainCount);
+
+    return ERROR_NO_LOGON_SERVERS;
+}
+
+
+DWORD
+WINAPI
+DsEnumerateDomainTrustsW(
+    _In_opt_ LPWSTR ServerName,
+    _In_ ULONG Flags,
+    _Out_ PDS_DOMAIN_TRUSTSW *Domains,
+    _Out_ PULONG DomainCount)
+{
+    FIXME("DsEnumerateDomainTrustsW(%s, %x, %p, %p)\n",
+          debugstr_w(ServerName), Flags, Domains, DomainCount);
+
+    return ERROR_NO_LOGON_SERVERS;
+}
+
+
+VOID
+WINAPI
+DsRoleFreeMemory(
+    _In_ PVOID Buffer)
+{
+    TRACE("DsRoleFreeMemory(%p)\n", Buffer);
+    HeapFree(GetProcessHeap(), 0, Buffer);
+}
+
+
+DWORD
+WINAPI
+DsGetDcNameA(
+    _In_ 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",
+          debugstr_a(ComputerName), debugstr_a(DomainName), debugstr_guid(DomainGuid),
+          debugstr_a(SiteName), Flags, DomainControllerInfo);
+
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
+DWORD
+WINAPI
+DsGetDcNameW(
+    _In_ 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",
+          debugstr_w(ComputerName), debugstr_w(DomainName), debugstr_guid(DomainGuid),
+          debugstr_w(SiteName), Flags, DomainControllerInfo);
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
+DWORD
+WINAPI
+DsGetSiteNameA(
+    _In_ LPCSTR ComputerName,
+    _Out_ LPSTR *SiteName)
+{
+    FIXME("DsGetSiteNameA(%s, %p)\n",
+          debugstr_a(ComputerName), SiteName);
+
+    return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
+DWORD
+WINAPI
+DsGetSiteNameW(
+    _In_ LPCWSTR ComputerName,
+    _Out_ LPWSTR *SiteName)
+{
+    NET_API_STATUS status;
+
+    TRACE("DsGetSiteNameW(%s, %p)\n",
+          debugstr_w(ComputerName), SiteName);
+
+    RpcTryExcept
+    {
+        status = DsrGetSiteName((PWSTR)ComputerName,
+                                SiteName);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return status;
+}
+
+
 NTSTATUS
 WINAPI
 NetEnumerateTrustedDomains(
     _In_ LPWSTR ServerName,
     _Out_ LPWSTR *DomainNames)
 {
-    FIXME("NetEnumerateTrustedDomains(%s, %p)\n",
+    DOMAIN_NAME_BUFFER DomainNameBuffer = {0, NULL};
+    NTSTATUS Status = 0;
+
+    TRACE("NetEnumerateTrustedDomains(%s, %p)\n",
           debugstr_w(ServerName), DomainNames);
 
-    return STATUS_NOT_IMPLEMENTED;
+    RpcTryExcept
+    {
+        Status = NetrEnumerateTrustedDomains(ServerName,
+                                             &DomainNameBuffer);
+        if (NT_SUCCESS(Status))
+        {
+            *DomainNames = (LPWSTR)DomainNameBuffer.DomainNames;
+        }
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    } RpcEndExcept;
+
+    return Status;
 }
 
 
index e6f889b..808361a 100644 (file)
@@ -811,6 +811,7 @@ typedef struct _NL_SITE_NAME_ARRAY
     [size_is(EntryCount)] PRPC_UNICODE_STRING SiteNames;
 } NL_SITE_NAME_ARRAY, *PNL_SITE_NAME_ARRAY;
 
+cpp_quote("#ifndef _DSGETDC_H")
 typedef struct _DS_DOMAIN_TRUSTSW
 {
     [string] wchar_t *NetbiosDomainName;
@@ -822,6 +823,7 @@ typedef struct _DS_DOMAIN_TRUSTSW
     PRPC_SID DomainSid;
     GUID DomainGuid;
 } DS_DOMAIN_TRUSTSW, *PDS_DOMAIN_TRUSTSW;
+cpp_quote("#endif")
 
 typedef struct _NETLOGON_TRUSTED_DOMAIN_ARRAY
 {
@@ -905,6 +907,7 @@ typedef struct _UAS_INFO_0
     ULONG SerialNumber;
 } UAS_INFO_0, *PUAS_INFO_0;
 
+cpp_quote("#ifndef _DSGETDC_H")
 typedef struct _DOMAIN_CONTROLLER_INFOW
 {
     [string, unique] wchar_t *DomainControllerName;
@@ -917,6 +920,7 @@ typedef struct _DOMAIN_CONTROLLER_INFOW
     [string, unique] wchar_t *DcSiteName;
     [string, unique] wchar_t *ClientSiteName;
 } DOMAIN_CONTROLLER_INFOW, *PDOMAIN_CONTROLLER_INFOW;
+cpp_quote("#endif")
 
 typedef struct _NL_TRUST_PASSWORD
 {
@@ -1430,7 +1434,7 @@ interface logon
     /* Function 41 */
     NET_API_STATUS
     __stdcall
-    DsrDeregisterDnsHostRecords (
+    DsrDeregisterDnsHostRecords(
         [in, unique, string] LOGONSRV_HANDLE ServerName,
         [in, unique, string] wchar_t *DnsDomainName,
         [in, unique] GUID *DomainGuid,