Author: ekohl
Date: Thu Mar 31 21:48:43 2016
New Revision: 71087
URL:
http://svn.reactos.org/svn/reactos?rev=71087&view=rev
Log:
[NET]
Net utility not enumerating local user accounts.
Patch by Curtis Wilson.
CORE-11023 #resolve #comment Thanks a lot!
Modified:
trunk/reactos/base/applications/network/net/cmdUser.c
Modified: trunk/reactos/base/applications/network/net/cmdUser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/net/cmdUser.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/net/cmdUser.c [iso-8859-1] Thu Mar 31 21:48:43
2016
@@ -5,6 +5,7 @@
* PURPOSE:
*
* PROGRAMMERS: Eric Kohl
+ * Curtis Wilson
*/
#include "net.h"
@@ -45,31 +46,37 @@
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++)
- {
-// printf("%p\n", pBuffer[i].lgrpi0_name);
- if (pBuffer[i].usri0_name)
- PrintToConsole(L"%s\n", pBuffer[i].usri0_name);
- }
-
- NetApiBufferFree(pBuffer);
+ do
+ {
+ Status = NetUserEnum(NULL,
+ 0,
+ 0,
+ (LPBYTE*)&pBuffer,
+ MAX_PREFERRED_LENGTH,
+ &dwRead,
+ &dwTotal,
+ &ResumeHandle);
+ if ((Status != NERR_Success) && (Status != ERROR_MORE_DATA))
+ return Status;
+
+ 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;
}