Aarif
25th May 2001 17:58 UTC
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?
Thanks,
Aarif
yazno
26th May 2001 05:36 UTC
hi,
there is no registry setting you can check as that is handled by advapi32.dll; so that is (AFAIK) not yet possible with nsis.
cu yzo
Koen van de Sande
26th May 2001 16:23 UTC
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
yazno
26th May 2001 18:15 UTC
hi,
maybe someone could implement this into nsis:
// Returns True if logged on as admin
// always Returns True on Win9x
type
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
'CloseServiceHandle';
function IsAdminLoggedOn: Boolean;
var
hndlSC: HNDL;
begin
if Win32Platform <> VER_PLATFORM_WIN32_NT then
Result := True
else
begin
hndlSC := OpenSCManager(nil, nil, GENERIC_READ or GENERIC_WRITE or
GENERIC_EXECUTE);
Result := hndlSC <> 0;
if Result then CloseServiceHandle(hndlSC)
end
end;
my c knowledge is not that good to do that
cu yzo
Aarif
28th May 2001 22:49 UTC
Thanks yazno.
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.
Aarif
yazno
29th May 2001 00:44 UTC
hi,
that is cool, maybe you could send the source/changes to justin, so we could all take advantage of it :)
cu yzo
Aarif
29th May 2001 01:12 UTC
How do I send the changes to Justin?
Aarif
yazno
29th May 2001 05:19 UTC
hi
just send it to justin@nullsoft.com
cu yzo