mirror of
https://github.com/reactos/reactos.git
synced 2025-05-29 05:58:13 +00:00
[NETAPI32] Implement DsGetDcSiteCoverageA
This commit is contained in:
parent
61ac4f1ee9
commit
792d0f6b78
1 changed files with 86 additions and 9 deletions
|
@ -496,9 +496,86 @@ DsGetDcSiteCoverageA(
|
||||||
_Out_ PULONG EntryCount,
|
_Out_ PULONG EntryCount,
|
||||||
_Out_ LPSTR **SiteNames)
|
_Out_ LPSTR **SiteNames)
|
||||||
{
|
{
|
||||||
FIXME("DsGetDcSiteCoverageA(%s, %p, %p)\n",
|
PWSTR pServerNameW = NULL;
|
||||||
|
PWSTR *pSiteNamesW = NULL;
|
||||||
|
PSTR *pSiteNamesA = NULL;
|
||||||
|
UNICODE_STRING UnicodeString;
|
||||||
|
ANSI_STRING AnsiString;
|
||||||
|
PSTR Ptr;
|
||||||
|
ULONG BufferSize, i;
|
||||||
|
NTSTATUS Status;
|
||||||
|
NET_API_STATUS status = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
TRACE("DsGetDcSiteCoverageA(%s, %p, %p)\n",
|
||||||
debugstr_a(ServerName), EntryCount, SiteNames);
|
debugstr_a(ServerName), EntryCount, SiteNames);
|
||||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
||||||
|
if (ServerName != NULL)
|
||||||
|
{
|
||||||
|
pServerNameW = NetpAllocWStrFromAnsiStr((PSTR)ServerName);
|
||||||
|
if (pServerNameW == NULL)
|
||||||
|
{
|
||||||
|
status = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
status = DsGetDcSiteCoverageW(pServerNameW,
|
||||||
|
EntryCount,
|
||||||
|
&pSiteNamesW);
|
||||||
|
if (status != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
BufferSize = *EntryCount * sizeof(PSTR);
|
||||||
|
for (i = 0; i < *EntryCount; i++)
|
||||||
|
{
|
||||||
|
RtlInitUnicodeString(&UnicodeString, pSiteNamesW[i]);
|
||||||
|
BufferSize += RtlUnicodeStringToAnsiSize(&UnicodeString);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = NetApiBufferAllocate(BufferSize, (PVOID*)&pSiteNamesA);
|
||||||
|
if (status != NERR_Success)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
ZeroMemory(pSiteNamesA, BufferSize);
|
||||||
|
|
||||||
|
Ptr = (PSTR)((ULONG_PTR)pSiteNamesA + *EntryCount * sizeof(PSTR));
|
||||||
|
for (i = 0; i < *EntryCount; i++)
|
||||||
|
{
|
||||||
|
pSiteNamesA[i] = Ptr;
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&UnicodeString, pSiteNamesW[i]);
|
||||||
|
|
||||||
|
AnsiString.Length = 0;
|
||||||
|
AnsiString.MaximumLength = BufferSize;
|
||||||
|
AnsiString.Buffer = Ptr;
|
||||||
|
|
||||||
|
Status = RtlUnicodeStringToAnsiString(&AnsiString,
|
||||||
|
&UnicodeString,
|
||||||
|
FALSE);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
status = RtlNtStatusToDosError(Status);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
|
||||||
|
BufferSize -= (AnsiString.Length + sizeof(CHAR));
|
||||||
|
}
|
||||||
|
|
||||||
|
*SiteNames = pSiteNamesA;
|
||||||
|
pSiteNamesA = NULL;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (status != NERR_Success && pSiteNamesA != NULL)
|
||||||
|
NetApiBufferFree(pSiteNamesA);
|
||||||
|
|
||||||
|
if (pSiteNamesW != NULL)
|
||||||
|
NetApiBufferFree(pSiteNamesW);
|
||||||
|
|
||||||
|
if (pServerNameW != NULL)
|
||||||
|
NetApiBufferFree(pServerNameW);
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -609,7 +686,7 @@ DsGetSiteNameA(
|
||||||
{
|
{
|
||||||
PWSTR pComputerNameW = NULL;
|
PWSTR pComputerNameW = NULL;
|
||||||
PWSTR pSiteNameW = NULL;
|
PWSTR pSiteNameW = NULL;
|
||||||
DWORD dwError = ERROR_SUCCESS;
|
NET_API_STATUS status = ERROR_SUCCESS;
|
||||||
|
|
||||||
TRACE("DsGetSiteNameA(%s, %p)\n",
|
TRACE("DsGetSiteNameA(%s, %p)\n",
|
||||||
debugstr_a(ComputerName), SiteName);
|
debugstr_a(ComputerName), SiteName);
|
||||||
|
@ -619,20 +696,20 @@ DsGetSiteNameA(
|
||||||
pComputerNameW = NetpAllocWStrFromAnsiStr((PSTR)ComputerName);
|
pComputerNameW = NetpAllocWStrFromAnsiStr((PSTR)ComputerName);
|
||||||
if (pComputerNameW == NULL)
|
if (pComputerNameW == NULL)
|
||||||
{
|
{
|
||||||
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
status = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dwError = DsGetSiteNameW(pComputerNameW,
|
status = DsGetSiteNameW(pComputerNameW,
|
||||||
&pSiteNameW);
|
&pSiteNameW);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (status != ERROR_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
*SiteName = NetpAllocAnsiStrFromWStr(pSiteNameW);
|
*SiteName = NetpAllocAnsiStrFromWStr(pSiteNameW);
|
||||||
if (*SiteName == NULL)
|
if (*SiteName == NULL)
|
||||||
{
|
{
|
||||||
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
status = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -642,7 +719,7 @@ done:
|
||||||
if (pComputerNameW != NULL)
|
if (pComputerNameW != NULL)
|
||||||
NetApiBufferFree(pComputerNameW);
|
NetApiBufferFree(pComputerNameW);
|
||||||
|
|
||||||
return dwError;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue