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:
Eric Kohl 2016-03-31 21:48:43 +00:00
parent ec5cd6b41d
commit 79407a8027

View file

@ -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;
}