Old 7th October 2009, 16:25   #1
cowwoc
Member
 
Join Date: Feb 2005
Posts: 51
Installation fails for non-admins under WindowsXP

Hi,

I just found out that when a user runs my installer under WindowsXP as a non-Administrator the InstallDir file extraction will fail with some cryptic error message about not being able to write <output_file>.

My InstallDir points to a directory in C:\Program Files so I am thinking this is a permissions problem. Fair enough, but then how do I get Windows to elevate my permisions to admin (I suspect this isn't possible in XP)? Alternatively, how do I warn the user on startup that the installer must be run as an admin?

This seems like a common problem. I'm rather surprised I haven't found a mention of it on the forums or Google.

Thank you,
Gili
cowwoc is offline   Reply With Quote
Old 7th October 2009, 16:40   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
use the userinfo plugin in .onInit or .onGuiInit and show a messagebox and quit if the user is not admin

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 7th October 2009, 16:44   #3
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Indeed, you cannot 'automatically' elevate the user to Admin in Windows XP. You need to use the UserInfo plugin (UserInfo::GetAccountType) to determine whether or not the user has Admin access. Typically you can do this in .onInit .

(Note that on Vista/Windows7 you *also* need to use the UserInfo plugin, in case the user has disabled his UAC. So just use it always.)


Edit: Heh, too late.
MSG is offline   Reply With Quote
Old 8th October 2009, 04:00   #4
cowwoc
Member
 
Join Date: Feb 2005
Posts: 51
That worked. Thanks!
cowwoc 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