Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 17th August 2010, 21:49   #1
LeFrog1
Junior Member
 
Join Date: Aug 2010
Posts: 1
Unhappy Install as Admin, Run as User

I have NSIS/Unicode script that installs my application.
The installation requires admin privileges, which I get by setting up the privilege level
At the end of the installation, I want to launch my application.

My problem is that the application launches in Admin mode.
I'd like to launch it in user mode, just as if a user double clicked its icon.

Nothing I tried worked. Even setting down the level before launching wouldn't help.

What can I do?
LeFrog1 is offline   Reply With Quote
Old 17th August 2010, 22:37   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,784
I'd love to hear what you did when you tried "setting down the level" since such a thing is not possible.

The easy solution: Disable the run checkbox on the finish page
The hard solution: Use the UAC plugin

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th August 2010, 03:29   #3
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 442
Anders,
Quote:
I'd love to hear what you did when you tried "setting down the level" since such a thing is not possible.
There must be some way to reduce a process' privileges. This page http://msdn.microsoft.com/en-us/libr...px#elevationgl says "Once a task that requires administrative privileges is complete, the program should revert to the least privilege state." That phrase is used several times on the page.

I have not yet found where they tell how to revert to lower privileges.

Don
demiller9 is offline   Reply With Quote
Old 18th August 2010, 12:34   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Is the reverse even true? I.e. can a process elevate itself mid-run? I was under the impression that it can't; that, at best, you can start a new process with the appropriate privileges.

There's some discussions out there on how to run an app as user from a higher elevation... one using the Task Scheduler ( http://www.codeproject.com/KB/vista-...aElevator.aspx ), one doing crazy things by getting the desktop (which it presumes to be non-elevated) and spawning a new process using that desktop's security tokens ( http://blogs.msdn.com/b/aaron_margos...vated-app.aspx <- http://blogs.microsoft.co.il/blogs/s...d-process.aspx ) and another that looks entirely like hieroglyphics after gazing at it for 2 minutes ( http://brandonlive.com/2008/04/27/ge...ou-part-2-how/ ).

But they're all about starting new processes - in which case, the UAC plugin should work quite well within the NSIS context and would be more flexible.
Animaether is offline   Reply With Quote
Old 18th August 2010, 13:38   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,784
That's right, there are several hacky code samples out there that claim to "ride the elevator back down" but they are all hacks and will fail in certain configurations.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Tags
nsis security

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