Old 20th August 2006, 14:09   #1
ronyh
Junior Member
 
Join Date: Aug 2006
Posts: 5
install on other user dialog

Hello

when i run the install program not with
administrator rights i get a dialog "oher user install.."
i want to avoid this dialog , ands put a MessagfeBox
if not Admin rights end exit install .



Thanks
ronyh is offline   Reply With Quote
Old 20th August 2006, 16:53   #2
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
The XTInfo Plugin has a function to determine if the user is admin or not. You could add this to .OnInit like this:
code:

Function .OnInit
xtInfoPlugin::IsAdministrator
Pop $0
StrCmp $0 "true" continue 0
SetSilent silent
MessageBox MB_OK "You must have Admin rights to run this"
abort

continue:
; *** continue your code here ***
FunctionEnd



There's also a RunAs Plugin that would allow you to ask for the Admin login during the install and then would be able to run as the administrator. It would save the user having to log off and back on, but may not work in your case. (I thought I'd at least mention it.) If you decided to go this way, I'd recommend also using the PassDialog plugin just to keep the password secure.
Comperio is offline   Reply With Quote
Old 20th August 2006, 17:14   #3
ronyh
Junior Member
 
Join Date: Aug 2006
Posts: 5
Hello

Hi
i tried your code .
still get the install program as other user if
running not administrator rights .
ronyh is offline   Reply With Quote
Old 20th August 2006, 17:39   #4
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
OK, let's take a step back:
Do you need to know if the user is Administrator or do you just need the proper permissions to something? (A user can still be admin, but have limited permissions to certain folders, registry keys, etc. depending on how the PC is configured.)

Can you answer these questions:

1) Can you be more specific as to what rights the user is missing? (What exactly fails or what specifically does the user not have rights to do?)

2) I assume that when using my example code that you are NOT getting the messagebox, correct or no?
Comperio is offline   Reply With Quote
Old 20th August 2006, 17:51   #5
ronyh
Junior Member
 
Join Date: Aug 2006
Posts: 5
Hi

1. my app must have admin rights for running
so i dont want to install without admin rights.
2. i got your message after the "install program as other
user" .if you run the install not as admin
the dialog gives you the permission to install
not as admin .
ronyh is offline   Reply With Quote
Old 20th August 2006, 18:02   #6
ronyh
Junior Member
 
Join Date: Aug 2006
Posts: 5
Hi
attach the "install program as other user" dialog
Attached Images
File Type: jpg installdialog1.jpg (27.8 KB, 164 views)
ronyh is offline   Reply With Quote
Old 20th August 2006, 18:42   #7
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
hmm... I guess I misunderstood your question. The message box is coming from Windows itself (not NSIS).

I did some quick searches, but haven't been able to find out exactly what triggers this dialog.

But based on how Windows handles installations in a terminal server environment, I can make some guesses: (I know that you probably aren't using Terminal Services, but my guess is that the same logic applies here. Others feel free to chime in here if I'm mistaken):

1. Windows looks at the name of the program you are running. If it's named "setup.exe" or "install.exe", then it assumes it must be an installation and therefore prompts the user. (You can test this theory by compiling your install under a differnet name such as "test.exe".)

2. If running the install via add/remove programs, then my guess is that it will ALWAYS prompt the message since it would know at this point that you are running an install.

I found this article from MS which explains how the system admin can change the windows policies in such a way to suppress the dialog. (But you'd need admin priveldges to do this.)
Comperio is offline   Reply With Quote
Old 21st August 2006, 06:42   #8
ronyh
Junior Member
 
Join Date: Aug 2006
Posts: 5
Hi
stupid but working

Thanks!!
ronyh is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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