Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 13th April 2009, 07:05   #1
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
How do I make a user level have admin rights during installation?

I made an installer that works perfectly with XP. It works with Vista as well but only with administrators.

What if the user wants to install this software but doesn't have the administrator's password (user level at VISTA)? I have tried using the UAC plug in, but this would definitely prompt the user for the admin password.

Is there anyway that could make the installer run by the user as if he's the admin?

Please help... thanks...
bedbuffer is offline   Reply With Quote
Old 13th April 2009, 10:17   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
The entire point of access levels is that a common user can't just simply gain admin level without so much as a prompt for administrator credentials... so, no - you can't have your installer magically gain admin level if the person running the installer only has user level.

If common users should be able to use your installer, you might have to check why your installer needs admin level and see if you can eliminate that need.
Animaether is offline   Reply With Quote
Old 15th April 2009, 04:50   #3
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
That's right. You have a point. But I was wondering why you can install GTalk even if you only have a user level. I think same goes with yahoo messenger.

I would want to make it work that way if there's any way. I actually made a workaround, you can get to install it but only on the APPDATA folder. I figured you can't install in the PROGRAM files folder if you're only a user.
bedbuffer is offline   Reply With Quote
Old 15th April 2009, 08:47   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Your installer is just as broken on XP, it's just that most people run as admin there (but not everyone)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th April 2009, 09:47   #5
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
Nope, it works perfectly on XP whatever folder you select... I'm only having problems on Vista.

If you can install Gtalk and YM on Vista without having admin rights, that means, there's gotta be a way you could do that on your own installer.

That's what I'm trying to figure out...
bedbuffer is offline   Reply With Quote
Old 15th April 2009, 10:57   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
If you try to write to $programfiles without checking for admin rights on XP, your installer is broken!

To install something as non-admin, you must install the program in $localappdata or $appdata

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th April 2009, 11:02   #7
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
I understand, but that's not what i want to do... I want to be able to install to any folder...
bedbuffer is offline   Reply With Quote
Old 15th April 2009, 22:31   #8
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
UAC will also block access to the root of the system drive (C:\ for example) as well as the Windows and Program Files folders. (I'm not totally sure, but I believe the restriction to the root of the system drive might be the difference between XP and Vista.)

MS recommends using the user's profile folder instead if trying to run without elevated permissions. More info here: http://technet.microsoft.com/en-us/w.../cc507861.aspx
Comperio is offline   Reply With Quote
Old 16th April 2009, 01:25   #9
redxii
Senior Member
 
Join Date: Nov 2005
Posts: 115
UAC facilitates switching between Administrator and Non-Administrator tokens, in order to temporarily elevate permissions for a program w/o using a separate account. Else, it has to do with file system permissions which should be the same or similar between XP and Vista.

- Cannot write a FILE to root but can create a folder in the root; if another user created that folder then they can add their own files but not modify the other user's files.
- Can write to their profile directory, and the Shared Documents folder (they can add their own files but not modify other users' files).
- Write to HKEY_CURRENT_USER, few exceptions: HKCU\Software\Microsoft\Windows\CurrentVersion\Policies is not writeable by non-admin even though it's under their hive
redxii is offline   Reply With Quote
Old 16th April 2009, 02:24   #10
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
If you select "single user" for the install type, that means the application will be installed in the current user's account.

My understanding is that, if you're an admin the application should be written in HKLM which makes it available to all users. And if you're just a user it should be written in HKCU.

My question is, If I'm an admin and I select "single user" will the application installed be available to all users?
bedbuffer is offline   Reply With Quote
Old 16th April 2009, 03:05   #11
redxii
Senior Member
 
Join Date: Nov 2005
Posts: 115
Quote:
My question is, If I'm an admin and I select "single user" will the application installed be available to all users? [/B]
That depends on where you install it. If you install it within the admin's profile, non-admin users won't be able to access the program. Non-admins also cannot access other users' profiles, via file system permissions and not UAC, if using NTFS as the file system. If it is somewhere where the user can read it then they can open the program.
redxii is offline   Reply With Quote
Old 16th April 2009, 08:54   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
single user is single user, does not matter if you are admin or not

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th April 2009, 11:44   #13
nsfis
Junior Member
 
Join Date: Oct 2001
Posts: 29
bedbuffer,
have you tried to set RequestExecutionLevel to "user"? By default, XML manifest is not included and OS decides itself what priviliges are required. It can recognize that EXE is an installer and then requires admin priviliges.
nsfis is offline   Reply With Quote
Old 20th April 2009, 02:19   #14
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
nsfis,

Yes I did, it was the very first thing I considered actually.
bedbuffer is offline   Reply With Quote
Old 20th April 2009, 05:57   #15
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
Last Friday, I just finished creating the installer and it works perfectly with Vista and XP. It sets the installation folder depending on the level of priviledge the user has (admin, user, etc...) and it also bypasses the UAC prompt in Vista.

Thanks...

Last edited by bedbuffer; 20th April 2009 at 07:18.
bedbuffer is offline   Reply With Quote
Old 20th April 2009, 09:17   #16
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
Do you guys know how to create a software updater? one that silently installs...
bedbuffer is offline   Reply With Quote
Old 22nd April 2009, 08:44   #17
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
I just figured how to... thanks...
bedbuffer is offline   Reply With Quote
Old 30th April 2009, 09:26   #18
ethanchen
Junior Member
 
Join Date: Apr 2009
Posts: 1
hi bedbuffer, would you show how to do it?
ethanchen is offline   Reply With Quote
Old 6th May 2009, 06:21   #19
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
yes, just check the vpatch sample included in the nsis package. That's how I made the updater...
bedbuffer is offline   Reply With Quote
Old 6th May 2009, 06:58   #20
bedbuffer
Junior Member
 
Join Date: Apr 2009
Posts: 33
also, add a line that would read the registry entry of your app (location of the app) so it would know where to install the updates....
bedbuffer 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