Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

NetUserGetInfo netapi32.dll


3 replies to this topic

krakos

krakos
  • Full Members
  • 8 posts

Posted 01 September 2009 - 14:20

I want to check if a username exists. For this i use the NetUserGetInfo function from netapi32.dll, but i allways get the returncode 2221 = NERR_UserNotFound = ret.

CODE

prototype LONG Netapi32.NetUserGetInfo( LPSTR,  LPSTR, LONG, POINTER);

result = UseDLL("netapi32.dll");
if(result < ISERR_SUCCESS) then
 MessageBox("Could not load netapi32.DLL.", SEVERE);
 return FALSE;
endif;

userName = "Administrator";
serverName = "";

ret = NetUserGetInfo(NULL, &userName, 0, p1);    
 

if(ret == 0) then
 return 1
else
 return 0;
endif;

UnUseDLL("netapi32.dll");


Can anybody explain me what i am doing wrong?

Thanks!

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 02 September 2009 - 08:42

Have you tried without the & sign?

krakos

krakos
  • Full Members
  • 8 posts

Posted 03 September 2009 - 09:07

Hello Stefan,

yes i tried it in different ways and other datatypes. If you use LPSTR the & sign must be there (Address of Pointer).

If nobody has an idea, im going to write a c# dll, which will do all the jobs for me.
Im a little bit suprised that such elementar thinks like checking a username, is such a big think with InstallScript.

Thanks for your reply.

phood

phood
  • Full Members
  • 37 posts

Posted 22 September 2009 - 22:05

Try LookupAccountName. It's in advapi32.dll and has an ansi version.