NO

Author Topic: problem with NetUserEnum  (Read 4227 times)

blzbb

  • Guest
problem with NetUserEnum
« on: January 08, 2009, 09:39:19 AM »
hi
i use NetUserEnum API to get all user in my computer
but when i want print any user it get with wprintf
it just print the first charackter of users
i also test it with microsoft visual c++ and MinGW, here it work fine
but in pellesc not
what is my mistake?

here is my code

Code: [Select]
#include <windows.h>
#include <stdio.h>
#include <wchar.h>
#include <lm.h>

#pragma comment(lib, "netapi32.lib")

int main()
{
LPUSER_INFO_0 lpUser = NULL;
NET_API_STATUS nStatus;
DWORD dwEntry = 0;
DWORD dwTotal = 0;
DWORD dwResume = 0;

do
{
nStatus = NetUserEnum(NULL,
  0,
  FILTER_NORMAL_ACCOUNT,
  (LPBYTE *)&lpUser,
  MAX_PREFERRED_LENGTH,
  &dwEntry,
  &dwTotal,
  &dwResume);


if ( nStatus == NERR_Success || nStatus == ERROR_MORE_DATA )
wprintf(L"%s\n", lpUser->usri0_name);

if ( lpUser != NULL )
{
NetApiBufferFree(lpUser);
lpUser = NULL;
}
dwResume ++;
}while( dwEntry - 1);
 
return 0;
}

sorry for my bad english if i have any mistake

thanks
« Last Edit: January 08, 2009, 03:51:30 PM by blzbb »

JohnF

  • Guest
Re: problem with NetUserEnum
« Reply #1 on: January 08, 2009, 10:44:43 AM »
wprintf(L"%ls\n", lpUser->usri0_name);

John

blzbb

  • Guest
Re: problem with NetUserEnum
« Reply #2 on: January 08, 2009, 04:00:31 PM »
thanks John, yes now it work :)