View Full Version : How do I check for Administrator?
25th May 2001, 16:58
I need to make sure that the person logged in has administrator access because of other third party drivers I need to install. I only care about this for WinNT/2K/XP. For Win95/98/ME, it can install without checking. How would I go about checking that? Is there some sort of registry setting I can check?
26th May 2001, 04:36
there is no registry setting you can check as that is handled by advapi32.dll; so that is (AFAIK) not yet possible with nsis.
Koen van de Sande
26th May 2001, 15:23
Yes, this sounds like an option which should be added to NSIS. Speaking of NSIS, where's justin?
I guess he's busy on WA3. :o
26th May 2001, 17:15
maybe someone could implement this into nsis:
// Returns True if logged on as admin
// always Returns True on Win9x
HNDL = THandle;
function OpenSCManager(lpMachineName, lpDatabaseName:
PChar; dwDesiredAccess: DWORD): HNDL; stdcall;
external 'advapi32.dll' name 'OpenSCManagerA';
function CloseServiceHandle(hSCObject: HNDL): BOOL;
stdcall; external 'advapi32.dll' name
function IsAdminLoggedOn: Boolean;
if Win32Platform <> VER_PLATFORM_WIN32_NT then
Result := True
hndlSC := OpenSCManager(nil, nil, GENERIC_READ or GENERIC_WRITE or
Result := hndlSC <> 0;
if Result then CloseServiceHandle(hndlSC)
my c knowledge is not that good to do that
28th May 2001, 21:49
I have modified the source code (probably about 10 lines of code) to implement a new command "IfAdmin" using the code supplied by yazno. The command works like "IfErrors". If anyone is interrested in the changes, let me know, and I will post them here.
Thanks again to yazno.
28th May 2001, 23:44
that is cool, maybe you could send the source/changes to justin, so we could all take advantage of it :)
29th May 2001, 00:12
How do I send the changes to Justin?
29th May 2001, 04:19
just send it to email@example.com
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.