Author: ekohl
Date: Sat Jul 8 21:07:29 2017
New Revision: 75308
URL:
http://svn.reactos.org/svn/reactos?rev=75308&view=rev
Log:
[NETAPI32]
- Add DsAddressToSiteNamesExA stub.
- Implement DsAddressToSiteNamesExW.
Modified:
trunk/reactos/dll/win32/netapi32/netapi32.spec
trunk/reactos/dll/win32/netapi32/netlogon.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] Sat Jul 8 21:07:29 2017
@@ -1,7 +1,7 @@
@ stub CredpValidateTargetName
@ stdcall DsAddressToSiteNamesA(str long ptr str)
-@ stub DsAddressToSiteNamesExA
-@ stub DsAddressToSiteNamesExW
+@ stdcall DsAddressToSiteNamesExA(str long ptr str str)
+@ stdcall DsAddressToSiteNamesExW(wstr long ptr wstr wstr)
@ stdcall DsAddressToSiteNamesW(wstr long ptr wstr)
@ stdcall DsDeregisterDnsHostRecordsA(str str ptr ptr str)
@ stdcall DsDeregisterDnsHostRecordsW(wstr wstr ptr ptr wstr)
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] Sat Jul 8 21:07:29 2017
@@ -162,6 +162,122 @@
DWORD
WINAPI
+DsAddressToSiteNamesExA(
+ _In_opt_ LPCSTR ComputerName,
+ _In_ DWORD EntryCount,
+ _In_ PSOCKET_ADDRESS SocketAddresses,
+ _Out_ LPSTR **SiteNames,
+ _Out_ LPSTR **SubnetNames)
+{
+ FIXME("DsAddressToSiteNamesExA(%s, %lu, %p, %p, %p)\n",
+ debugstr_a(ComputerName), EntryCount, SocketAddresses,
+ SiteNames, SubnetNames);
+ return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
+DWORD
+WINAPI
+DsAddressToSiteNamesExW(
+ _In_opt_ LPCWSTR ComputerName,
+ _In_ DWORD EntryCount,
+ _In_ PSOCKET_ADDRESS SocketAddresses,
+ _Out_ LPWSTR **SiteNames,
+ _Out_ LPWSTR **SubnetNames)
+{
+ PNL_SITE_NAME_EX_ARRAY SiteNameArray = NULL;
+ PWSTR *SiteNamesBuffer = NULL, *SubnetNamesBuffer = NULL, Ptr;
+ ULONG SiteNameBufferSize, SubnetNameBufferSize, i;
+ NET_API_STATUS status;
+
+ TRACE("DsAddressToSiteNamesExW(%s, %lu, %p, %p, %p)\n",
+ debugstr_w(ComputerName), EntryCount, SocketAddresses,
+ SiteNames, SubnetNames);
+
+ if (EntryCount == 0)
+ return ERROR_INVALID_PARAMETER;
+
+ *SiteNames = NULL;
+ *SubnetNames = NULL;
+
+ RpcTryExcept
+ {
+ status = DsrAddressToSiteNamesExW((PWSTR)ComputerName,
+ EntryCount,
+ (PNL_SOCKET_ADDRESS)SocketAddresses,
+ &SiteNameArray);
+ if (status == NERR_Success)
+ {
+ if (SiteNameArray->EntryCount == 0)
+ {
+ status = ERROR_INVALID_PARAMETER;
+ }
+ else
+ {
+ SiteNameBufferSize = SiteNameArray->EntryCount * sizeof(PWSTR);
+ SubnetNameBufferSize = SiteNameArray->EntryCount * sizeof(PWSTR);
+ for (i = 0; i < SiteNameArray->EntryCount; i++)
+ {
+ SiteNameBufferSize += SiteNameArray->SiteNames[i].Length +
sizeof(WCHAR);
+ SubnetNameBufferSize += SiteNameArray->SubnetNames[i].Length +
sizeof(WCHAR);
+ }
+
+ status = NetApiBufferAllocate(SiteNameBufferSize,
(PVOID*)&SiteNamesBuffer);
+ if (status == NERR_Success)
+ {
+ ZeroMemory(SiteNamesBuffer, SiteNameBufferSize);
+
+ 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;
+ }
+
+ status = NetApiBufferAllocate(SubnetNameBufferSize,
(PVOID*)&SubnetNamesBuffer);
+ if (status == NERR_Success)
+ {
+ ZeroMemory(SubnetNamesBuffer, SubnetNameBufferSize);
+
+ Ptr = (PWSTR)((ULONG_PTR)SubnetNamesBuffer +
SiteNameArray->EntryCount * sizeof(PWSTR));
+ for (i = 0; i < SiteNameArray->EntryCount; i++)
+ {
+ SubnetNamesBuffer[i] = Ptr;
+ CopyMemory(Ptr,
+ SiteNameArray->SubnetNames[i].Buffer,
+ SiteNameArray->SubnetNames[i].Length);
+
+ Ptr = (PWSTR)((ULONG_PTR)Ptr +
SiteNameArray->SubnetNames[i].Length + sizeof(WCHAR));
+ }
+
+ *SubnetNames = SubnetNamesBuffer;
+ }
+ }
+
+ MIDL_user_free(SiteNameArray);
+ }
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+
+ return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+
+DWORD
+WINAPI
DsDeregisterDnsHostRecordsA(
_In_opt_ LPSTR ServerName,
_In_opt_ LPSTR DnsDomainName,