mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[NET]
Net utility not enumerating local user accounts. Patch by Curtis Wilson. CORE-11023 #resolve #comment Thanks a lot! svn path=/trunk/; revision=71087
This commit is contained in:
parent
ec5cd6b41d
commit
79407a8027
1 changed files with 30 additions and 23 deletions
|
@ -5,6 +5,7 @@
|
|||
* PURPOSE:
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
* Curtis Wilson
|
||||
*/
|
||||
|
||||
#include "net.h"
|
||||
|
@ -45,31 +46,37 @@ EnumerateUsers(VOID)
|
|||
|
||||
NetApiBufferFree(pServer);
|
||||
|
||||
Status = NetUserEnum(NULL,
|
||||
0,
|
||||
0,
|
||||
(LPBYTE*)&pBuffer,
|
||||
MAX_PREFERRED_LENGTH,
|
||||
&dwRead,
|
||||
&dwTotal,
|
||||
&ResumeHandle);
|
||||
if (Status != NERR_Success)
|
||||
return Status;
|
||||
|
||||
qsort(pBuffer,
|
||||
dwRead,
|
||||
sizeof(PUSER_INFO_0),
|
||||
CompareInfo);
|
||||
|
||||
// printf("dwRead: %lu dwTotal: %lu\n", dwRead, dwTotal);
|
||||
for (i = 0; i < dwRead; i++)
|
||||
do
|
||||
{
|
||||
// printf("%p\n", pBuffer[i].lgrpi0_name);
|
||||
if (pBuffer[i].usri0_name)
|
||||
PrintToConsole(L"%s\n", pBuffer[i].usri0_name);
|
||||
}
|
||||
Status = NetUserEnum(NULL,
|
||||
0,
|
||||
0,
|
||||
(LPBYTE*)&pBuffer,
|
||||
MAX_PREFERRED_LENGTH,
|
||||
&dwRead,
|
||||
&dwTotal,
|
||||
&ResumeHandle);
|
||||
if ((Status != NERR_Success) && (Status != ERROR_MORE_DATA))
|
||||
return Status;
|
||||
|
||||
NetApiBufferFree(pBuffer);
|
||||
qsort(pBuffer,
|
||||
dwRead,
|
||||
sizeof(PUSER_INFO_0),
|
||||
CompareInfo);
|
||||
|
||||
for (i = 0; i < dwRead; i++)
|
||||
{
|
||||
if (pBuffer[i].usri0_name)
|
||||
PrintToConsole(L"%s\n", pBuffer[i].usri0_name);
|
||||
}
|
||||
|
||||
if (pBuffer != NULL)
|
||||
{
|
||||
NetApiBufferFree(pBuffer);
|
||||
pBuffer = NULL;
|
||||
}
|
||||
}
|
||||
while (Status == ERROR_MORE_DATA);
|
||||
|
||||
return NERR_Success;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue