WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > administrator check
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
kio
Junior Member

Registered: Sep 2004
From:

administrator check

Has anyone the isadmin.dll?
I searched everywhere and can't find it..
I really need it.

also
Is there a registry key that determines that if the current user logged on is an Administrator or not?

Something like e.x.
if the current user is an admin then the key will be 1
if the current user is not an admin the key will be 0

or an environmental variable?

Quick Link | Report this post to a moderator | IP: Logged

kio is offline Old Post 09-29-2004 01:07 AM
Click Here to See the Profile for kio Click here to Send kio a Private Message Click Here to Email kio Find more posts by kio Add kio to your buddy list Edit/Delete Message Reply w/Quote
pengyou
Senior Member

Registered: Mar 2003
From:

Try the UserInfo plugin which comes with NSIS. There is an example script in the Contrib\UserInfo folder.

Quick Link | Report this post to a moderator | IP: Logged

pengyou is offline Old Post 09-29-2004 01:39 AM
Click Here to See the Profile for pengyou Click here to Send pengyou a Private Message Find more posts by pengyou Add pengyou to your buddy list Edit/Delete Message Reply w/Quote
JeronimoColon
Junior Member

Registered: Sep 2004
From: New York City

There is an undocumented Windows API call for this in the shell32.dll. As part of the Microsoft settlement Microsoft was force to expose a portion of them. One I'm referring to is: ordinal# 680 a.k.a. IsUserAnAdmin.

It exist, I believe, in all NT based platforms. I remember only verifying its existence and it working on NT4 and up.

The bad news is:
It does not contain a function name - only an ordinal#. I believe Microsoft began including the function name in XP, but I don't know if it was always there or introduced in a later service pack.

This is how you would call it in XP using its function name:
System::Call 'shell32::IsUserAnAdmin(v)i .r1'

Unfortunately, I don't believe you can call functions by ordinals using the System.dll plugin - though - I think it would be a nice feature to have included in a future revision to the plugin.

The good news is: You could create your own plugin to call the function via its ordinal yourself.

I hope this was informative if nothing else...

jc3

Quick Link | Report this post to a moderator | IP: Logged

JeronimoColon is offline Old Post 09-29-2004 05:34 AM
Click Here to See the Profile for JeronimoColon Click here to Send JeronimoColon a Private Message Find more posts by JeronimoColon Add JeronimoColon to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Jerusalem, Israel

code:
System::Call "kernel32::GetModuleHandle(t 'shell32.dll') i .s" System::Call "kernel32::GetProcAddress(i s, i 680) i .r0" System::Call "::$0() i .r0" DetailPrint "is admin? $0"

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 09-29-2004 10:46 AM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
JeronimoColon
Junior Member

Registered: Sep 2004
From: New York City

kichik,

You never seize to amaze...



jc3

Quick Link | Report this post to a moderator | IP: Logged

JeronimoColon is offline Old Post 09-30-2004 04:52 AM
Click Here to See the Profile for JeronimoColon Click here to Send JeronimoColon a Private Message Find more posts by JeronimoColon Add JeronimoColon to your buddy list Edit/Delete Message Reply w/Quote
drmabuse
Junior Member

Registered: Oct 2007
From: austria

Post just packed above into a function for less advanced users

code:


Function CheckAdminRights
System::Call "kernel32::GetModuleHandle(t 'shell32.dll') i .s"
System::Call "kernel32::GetProcAddress(i s, i 680) i .r0"
System::Call "::$0() i .r0"

IntCmp $0 0 isNotAdmin isNotAdmin isAdmin
isNotAdmin:
DetailPrint "Missing Administrator Rights !!!"
messageBox MB_YESNO|MB_DEFBUTTON2 "Die aktuellen Benutzer-Rechte sind zu gering!$\r\
Für die Installation werden Administrator-Rechte benötigt!$\r\
um Bibliotheken (.dll-files) zu registrieren.$\r\
$\r\
Im Fall eines Updates können die aktuellen Rechte dennoch ausreichen.$\r\
$\r\
Soll die Installation ohne Administrator-Rechte fortgesetzt werden ?" IDYES isAdmin
quit

isAdmin:
DetailPrint "Administrator Rights granted"

FunctionEnd

Quick Link | Report this post to a moderator | IP: Logged

drmabuse is offline Old Post 10-01-2007 10:52 AM
Click Here to See the Profile for drmabuse Click here to Send drmabuse a Private Message Find more posts by drmabuse Add drmabuse to your buddy list Edit/Delete Message Reply w/Quote
fishweasel
Junior Member

Registered: Nov 2006
From:

I use the following for validation of Administrator user
(not sure where i got it from)

code:
ClearErrors UserInfo::GetName IfErrors Win9x Pop $0 UserInfo::GetAccountType Pop $1 StrCmp $0 "Administrator" 0 +3 ; Goto done StrCmp $1 "Power" 0 +3 MessageBox MB_OK 'You Must be logged in as Administrator!' Quit ; StrCmp $1 "User" 0 +3 MessageBox MB_OK 'You Must be logged in as Administrator!' Quit ; StrCmp $1 "Guest" 0 +3 MessageBox MB_OK 'You Must be logged in as Administrator!' Quit ; MessageBox MB_OK "Unknown error" Quit ; Win9x: # This one means you don't need to care about admin or # not admin because Windows 9x doesn't either MessageBox MB_OK "Error! This DLL can't run under Windows 9x!" done:


Fish

Quick Link | Report this post to a moderator | IP: Logged

fishweasel is offline Old Post 10-04-2007 01:17 PM
Click Here to See the Profile for fishweasel Click here to Send fishweasel a Private Message Click Here to Email fishweasel Find more posts by fishweasel Add fishweasel to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Jerusalem, Israel

fishweasel, you got this from Examples\UserInfo which is the examples folder for the plug-in written exactly for this purpose.

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 10-04-2007 01:23 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:56 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > administrator check
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON