Author: ekohl
Date: Sun Jul 2 18:29:38 2017
New Revision: 75268
URL:
http://svn.reactos.org/svn/reactos?rev=75268&view=rev
Log:
[NETAPI32]
- Add DsAddressToSiteNamesA stub.
- Implement DsAddressToSiteNamesW.
[SDK/INCLUDE]
Add DsAddressToSiteNamesA/W and DsAddressToSiteNamesExA/W prototypes to dsgetdc.h.
Modified:
trunk/reactos/dll/win32/netapi32/netapi32.spec
trunk/reactos/dll/win32/netapi32/netlogon.c
trunk/reactos/sdk/include/psdk/dsgetdc.h
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] Sun Jul 2 18:29:38 2017
@@ -1,8 +1,8 @@
@ stub CredpValidateTargetName
-@ stub DsAddressToSiteNamesA
+@ stdcall DsAddressToSiteNamesA(str long ptr str)
@ stub DsAddressToSiteNamesExA
@ stub DsAddressToSiteNamesExW
-@ stub DsAddressToSiteNamesW
+@ stdcall DsAddressToSiteNamesW(wstr long ptr wstr)
@ stub DsDeregisterDnsHostRecordsA
@ stub DsDeregisterDnsHostRecordsW
8 stdcall DsEnumerateDomainTrustsA(wstr long ptr ptr)
Modified: trunk/reactos/dll/win32/netapi32/netlogon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netlogo…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/netlogon.c [iso-8859-1] Sun Jul 2 18:29:38 2017
@@ -9,6 +9,7 @@
/* INCLUDES ******************************************************************/
#include "netapi32.h"
+#include <winsock2.h>
#include <rpc.h>
#include <dsrole.h>
#include <dsgetdc.h>
@@ -75,6 +76,92 @@
DWORD
WINAPI
+DsAddressToSiteNamesA(
+ _In_opt_ LPCSTR ComputerName,
+ _In_ DWORD EntryCount,
+ _In_ PSOCKET_ADDRESS SocketAddresses,
+ _Out_ LPSTR **SiteNames)
+{
+ FIXME("DsAddressToSiteNamesA(%s, %lu, %p, %p)\n",
+ debugstr_a(ComputerName), EntryCount, SocketAddresses, SiteNames);
+ return ERROR_NO_LOGON_SERVERS;
+}
+
+
+DWORD
+WINAPI
+DsAddressToSiteNamesW(
+ _In_opt_ LPCWSTR ComputerName,
+ _In_ DWORD EntryCount,
+ _In_ PSOCKET_ADDRESS SocketAddresses,
+ _Out_ LPWSTR **SiteNames)
+{
+ PNL_SITE_NAME_ARRAY SiteNameArray = NULL;
+ PWSTR *SiteNamesBuffer = NULL, Ptr;
+ ULONG BufferSize, i;
+ NET_API_STATUS status;
+
+ TRACE("DsAddressToSiteNamesW(%s, %lu, %p, %p)\n",
+ debugstr_w(ComputerName), EntryCount, SocketAddresses, SiteNames);
+
+ if (EntryCount == 0)
+ return ERROR_INVALID_PARAMETER;
+
+ *SiteNames = NULL;
+
+ RpcTryExcept
+ {
+ status = DsrAddressToSiteNamesW((PWSTR)ComputerName,
+ EntryCount,
+ (PNL_SOCKET_ADDRESS)SocketAddresses,
+ &SiteNameArray);
+ if (status == NERR_Success)
+ {
+ if (SiteNameArray->EntryCount == 0)
+ {
+ status = ERROR_INVALID_PARAMETER;
+ }
+ else
+ {
+ BufferSize = SiteNameArray->EntryCount * sizeof(PWSTR);
+ for (i = 0; i < SiteNameArray->EntryCount; i++)
+ BufferSize += SiteNameArray->SiteNames[i].Length + sizeof(WCHAR);
+
+ status = NetApiBufferAllocate(BufferSize, (PVOID*)&SiteNamesBuffer);
+ if (status == NERR_Success)
+ {
+ ZeroMemory(SiteNamesBuffer, BufferSize);
+
+ Ptr = (PWSTR)((ULONG_PTR)SiteNamesBuffer +
SiteNameArray->EntryCount * sizeof(PWSTR));
+ for (i = 0; i < SiteNameArray->EntryCount; i++)
+ {
+ SiteNamesBuffer[i] = Ptr;
+ CopyMemory(Ptr,
+ SiteNameArray->SiteNames[i].Buffer,
+ SiteNameArray->SiteNames[i].Length);
+
+ Ptr = (PWSTR)((ULONG_PTR)Ptr +
SiteNameArray->SiteNames[i].Length + sizeof(WCHAR));
+ }
+
+ *SiteNames = SiteNamesBuffer;
+ }
+ }
+
+ MIDL_user_free(SiteNameArray);
+ }
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+DWORD
+WINAPI
DsEnumerateDomainTrustsA(
_In_opt_ LPSTR ServerName,
_In_ ULONG Flags,
Modified: trunk/reactos/sdk/include/psdk/dsgetdc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/dsgetdc.h…
==============================================================================
--- trunk/reactos/sdk/include/psdk/dsgetdc.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/psdk/dsgetdc.h [iso-8859-1] Sun Jul 2 18:29:38 2017
@@ -63,6 +63,36 @@
} DS_DOMAIN_TRUSTSW, *PDS_DOMAIN_TRUSTSW;
DWORD WINAPI
+DsAddressToSiteNamesA(
+ LPCSTR ComputerName,
+ DWORD EntryCount,
+ PSOCKET_ADDRESS SocketAddresses,
+ LPSTR **SiteNames);
+
+DWORD WINAPI
+DsAddressToSiteNamesW(
+ LPCWSTR ComputerName,
+ DWORD EntryCount,
+ PSOCKET_ADDRESS SocketAddresses,
+ LPWSTR **SiteNames);
+
+DWORD WINAPI
+DsAddressToSiteNamesExA(
+ LPCSTR ComputerName,
+ DWORD EntryCount,
+ PSOCKET_ADDRESS SocketAddresses,
+ LPSTR **SiteNames,
+ LPSTR **SubnetNames);
+
+DWORD WINAPI
+DsAddressToSiteNamesExW(
+ LPCWSTR ComputerName,
+ DWORD EntryCount,
+ PSOCKET_ADDRESS SocketAddresses,
+ LPWSTR **SiteNames,
+ LPWSTR **SubnetNames);
+
+DWORD WINAPI
DsEnumerateDomainTrustsA(
LPSTR ServerName,
ULONG Flags,
@@ -97,11 +127,15 @@
#ifdef UNICODE
typedef DOMAIN_CONTROLLER_INFOW DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO;
typedef DS_DOMAIN_TRUSTSW DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS;
+#define DsAddressToSiteNames DsAddressToSiteNamesW
+#define DsAddressToSiteNamesEx DsAddressToSiteNamesExW
#define DsEnumerateDomainTrusts DsEnumerateDomainTrustsW
#define DsGetDcName DsGetDcNameW
#else
typedef DOMAIN_CONTROLLER_INFOA DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO;
typedef DS_DOMAIN_TRUSTSA DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS;
+#define DsAddressToSiteNames DsAddressToSiteNamesA
+#define DsAddressToSiteNamesEx DsAddressToSiteNamesExA
#define DsEnumerateDomainTrusts DsEnumerateDomainTrustsA
#define DsGetDcName DsGetDcNameA
#endif