Hello again.
I'm now looking for a way to see if the current user has admin rights.
I tryied the Iczelions way, and it always says that i dont have admin rights (on vista) . The next code i dont remember where i found, but it always says that the user has admin rights :

HMODULE hMod=GetModuleHandle("kernel32.dll");
	FARPROC endreco=GetProcAddress(hMod, "MessageBox");

admin is always true.
Was thinking to use

net localgroup administrators | find "%USERNAME%"

, but there should be a better way, because the problem arrises on Non-us windows versions (for example in portuguese the AdministraTORs groups is called AdministraDOREs).
Any ideias ?

"The LogonUser function attempts to perform a user logon operation. You specify the user with a user name and domain, and authenticate the user with a clear-text password. If the function succeeds, you receive a handle to a token that represents the logged-on user. You can then use this token handle to impersonate the specified user, or in most cases, to create a process running in the context of the specified user. "
Its not what i was looking for, i wanted to check if current user has administrators rights.
I'm now thinking on trying to create a file at \windows\system32, and if i get some sort of error (cannot create the file ) than its not admin, else it is.
Ok ,found it at http://weseetips.com/2008/04/16/how-to-check-whether-current-user-have-administrator-privilege/ (and works fine).
Thanks anyway.

This question has already been answered. Start a new discussion instead.