mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[NETAPI32]
NetEnumerateComputerNames: Convert the returned array of strings. svn path=/trunk/; revision=75112
This commit is contained in:
parent
3138c9072b
commit
b0442978e8
1 changed files with 26 additions and 2 deletions
|
@ -188,6 +188,8 @@ NetEnumerateComputerNames(
|
|||
_Out_ LPWSTR **ComputerNames)
|
||||
{
|
||||
PNET_COMPUTER_NAME_ARRAY ComputerNameArray = NULL;
|
||||
ULONG BufferSize, i;
|
||||
PWSTR *NameBuffer = NULL, Ptr;
|
||||
NET_API_STATUS status;
|
||||
|
||||
TRACE("NetEnumerateComputerNames(%s %lu %lu %p %p)\n",
|
||||
|
@ -202,8 +204,30 @@ NetEnumerateComputerNames(
|
|||
if (status == NERR_Success)
|
||||
{
|
||||
*EntryCount = ComputerNameArray->EntryCount;
|
||||
/* FIXME */
|
||||
// *ComputerNames =
|
||||
|
||||
BufferSize = 0;
|
||||
for (i = 0; i < ComputerNameArray->EntryCount; i++)
|
||||
{
|
||||
BufferSize += ComputerNameArray->ComputerNames[i].Length + sizeof(WCHAR) + sizeof(PWSTR);
|
||||
}
|
||||
|
||||
status = NetApiBufferAllocate(BufferSize, (PVOID*)&NameBuffer);
|
||||
if (status == NERR_Success)
|
||||
{
|
||||
ZeroMemory(NameBuffer, BufferSize);
|
||||
|
||||
Ptr = (PWSTR)((ULONG_PTR)NameBuffer + ComputerNameArray->EntryCount * sizeof(PWSTR));
|
||||
for (i = 0; i < ComputerNameArray->EntryCount; i++)
|
||||
{
|
||||
NameBuffer[i] = Ptr;
|
||||
CopyMemory(Ptr,
|
||||
ComputerNameArray->ComputerNames[i].Buffer,
|
||||
ComputerNameArray->ComputerNames[i].Length);
|
||||
Ptr = (PWSTR)((ULONG_PTR)Ptr + ComputerNameArray->ComputerNames[i].Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
*ComputerNames = NameBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
||||
|
|
Loading…
Reference in a new issue