Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 25th May 2001, 16:58   #1
Aarif
Junior Member
 
Join Date: May 2001
Posts: 11
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
Aarif is offline   Reply With Quote
Old 26th May 2001, 04:36   #2
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
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

yazno is offline   Reply With Quote
Old 26th May 2001, 15:23   #3
Koen van de Sande
Senior Member
 
Join Date: Mar 2001
Location: Holland
Posts: 269
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.

Koen van de Sande
Van de Sande Productions
TibEd.net | VPatch
Koen van de Sande is offline   Reply With Quote
Old 26th May 2001, 17:15   #4
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
hi,

maybe someone could implement this into nsis:

code:


// 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
yazno is offline   Reply With Quote
Old 28th May 2001, 21:49   #5
Aarif
Junior Member
 
Join Date: May 2001
Posts: 11
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
Aarif is offline   Reply With Quote
Old 28th May 2001, 23:44   #6
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
hi,

that is cool, maybe you could send the source/changes to justin, so we could all take advantage of it

cu yzo
yazno is offline   Reply With Quote
Old 29th May 2001, 00:12   #7
Aarif
Junior Member
 
Join Date: May 2001
Posts: 11
How do I send the changes to Justin?

Aarif
Aarif is offline   Reply With Quote
Old 29th May 2001, 04:19   #8
yazno
Member
 
Join Date: Oct 2000
Posts: 92
Send a message via ICQ to yazno
hi

just send it to justin@nullsoft.com

cu yzo
yazno is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump