[NETAPI32]

- Add DsGetDcSiteCoverageA stub.
- Implement DsGetDcSiteCoverageW.

[SDK/INCLUDE]
Add DsGetDcSiteCoverageA/W prototypes to dsgetdc.h.

svn path=/trunk/; revision=75270
This commit is contained in:
Eric Kohl 2017-07-02 20:21:27 +00:00
parent 07c8bb3ca4
commit c8ee4f6694
3 changed files with 110 additions and 14 deletions

View file

@ -16,8 +16,8 @@
@ stub DsGetDcNextW
@ stub DsGetDcOpenA
@ stub DsGetDcOpenW
@ stub DsGetDcSiteCoverageA
@ stub DsGetDcSiteCoverageW
@ stdcall DsGetDcSiteCoverageA(str ptr str)
@ stdcall DsGetDcSiteCoverageW(wstr ptr wstr)
@ stub DsGetForestTrustInformationW
@ stdcall DsGetSiteNameA(str str)
@ stdcall DsGetSiteNameW(wstr wstr)

View file

@ -84,7 +84,7 @@ DsAddressToSiteNamesA(
{
FIXME("DsAddressToSiteNamesA(%s, %lu, %p, %p)\n",
debugstr_a(ComputerName), EntryCount, SocketAddresses, SiteNames);
return ERROR_NO_LOGON_SERVERS;
return ERROR_CALL_NOT_IMPLEMENTED;
}
@ -190,16 +190,6 @@ DsEnumerateDomainTrustsW(
}
VOID
WINAPI
DsRoleFreeMemory(
_In_ PVOID Buffer)
{
TRACE("DsRoleFreeMemory(%p)\n", Buffer);
HeapFree(GetProcessHeap(), 0, Buffer);
}
DWORD
WINAPI
DsGetDcNameA(
@ -235,6 +225,87 @@ DsGetDcNameW(
}
DWORD
WINAPI
DsGetDcSiteCoverageA(
_In_opt_ LPCSTR ServerName,
_Out_ PULONG EntryCount,
_Out_ LPSTR **SiteNames)
{
FIXME("DsGetDcSiteCoverageA(%s, %p, %p)\n",
debugstr_a(ServerName), EntryCount, SiteNames);
return ERROR_CALL_NOT_IMPLEMENTED;
}
DWORD
WINAPI
DsGetDcSiteCoverageW(
_In_opt_ LPCWSTR ServerName,
_Out_ PULONG EntryCount,
_Out_ LPWSTR **SiteNames)
{
PNL_SITE_NAME_ARRAY SiteNameArray = NULL;
PWSTR *SiteNamesBuffer = NULL, Ptr;
ULONG BufferSize, i;
NET_API_STATUS status;
TRACE("DsGetDcSiteCoverageA(%s, %p, %p)\n",
debugstr_w(ServerName), EntryCount, SiteNames);
*EntryCount = 0;
*SiteNames = NULL;
RpcTryExcept
{
status = DsrGetDcSiteCoverageW((PWSTR)ServerName,
&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));
}
*EntryCount = SiteNameArray->EntryCount;
*SiteNames = SiteNamesBuffer;
}
}
MIDL_user_free(SiteNameArray);
}
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
status = I_RpcMapWin32Status(RpcExceptionCode());
}
RpcEndExcept;
return status;
}
DWORD
WINAPI
DsGetSiteNameA(
@ -243,7 +314,6 @@ DsGetSiteNameA(
{
FIXME("DsGetSiteNameA(%s, %p)\n",
debugstr_a(ComputerName), SiteName);
return ERROR_CALL_NOT_IMPLEMENTED;
}
@ -274,6 +344,16 @@ DsGetSiteNameW(
}
VOID
WINAPI
DsRoleFreeMemory(
_In_ PVOID Buffer)
{
TRACE("DsRoleFreeMemory(%p)\n", Buffer);
HeapFree(GetProcessHeap(), 0, Buffer);
}
NTSTATUS
WINAPI
NetEnumerateTrustedDomains(

View file

@ -124,6 +124,20 @@ DsGetDcNameW(
ULONG Flags,
PDOMAIN_CONTROLLER_INFOW* DomainControllerInfo);
DWORD
WINAPI
DsGetDcSiteCoverageA(
LPCSTR ServerName,
PULONG EntryCount,
LPSTR **SiteNames);
DWORD
WINAPI
DsGetDcSiteCoverageW(
LPCWSTR ServerName,
PULONG EntryCount,
LPWSTR **SiteNames);
#ifdef UNICODE
typedef DOMAIN_CONTROLLER_INFOW DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO;
typedef DS_DOMAIN_TRUSTSW DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS;
@ -131,6 +145,7 @@ typedef DS_DOMAIN_TRUSTSW DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS;
#define DsAddressToSiteNamesEx DsAddressToSiteNamesExW
#define DsEnumerateDomainTrusts DsEnumerateDomainTrustsW
#define DsGetDcName DsGetDcNameW
#define DsGetDcSiteCoverage DsGetDcSiteCoverageW
#else
typedef DOMAIN_CONTROLLER_INFOA DOMAIN_CONTROLLER_INFO, *PDOMAIN_CONTROLLER_INFO;
typedef DS_DOMAIN_TRUSTSA DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS;
@ -138,6 +153,7 @@ typedef DS_DOMAIN_TRUSTSA DS_DOMAIN_TRUSTS, *PDS_DOMAIN_TRUSTS;
#define DsAddressToSiteNamesEx DsAddressToSiteNamesExA
#define DsEnumerateDomainTrusts DsEnumerateDomainTrustsA
#define DsGetDcName DsGetDcNameA
#define DsGetDcSiteCoverage DsGetDcSiteCoverageA
#endif
#ifdef __cplusplus