|
|
#1 |
|
Forum King
|
RunAsAdmin
if i'm not mistaken, i cannot use the UAC plugin to have an installer in user mode execute a file as admin. is there any other way this can be done? the executed program would ideally request admin rights from the user first.
i came across this, not sure if this is a possible solution. anyway, i would prefer not having to use the registry for such a simple task. |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,839
|
To ExecWait an exe as admin, see here: http://forums.winamp.com/showthread.php?t=287227
I guess to Exec without Wait you can just call shellexecuteex without worrying about process handles. (I found it by using the search function. Keyword 'admin', search in titles only, show results as threads, NSIS forum only.) (Note: Running an exe As Admin will ALWAYS require the user to enter credentials. It would be bad if you could just run something as admin without the admin password!) |
|
|
|
|
|
#3 |
|
Forum King
|
i guess i'd have to make a system call? i have no idea how these work. anyone who could provide a reallife example please?
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Best way (if possible) is for the program itself to request administrator privileges using a requestExecutionLevel manifest and code to test the current user is an administrator.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#5 |
|
Forum King
|
so now i'm using ShellExecWait and it does the job for ExecWait.
however, i looking for the same to perform a simple Exec. i commented the following portion of the code and it works as desired. code: as i don't really understand this, i was wondering if there's more code i could leave? |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
If you don't need to wait for the process to exit, you don't want SEE_MASK_NOCLOSEPROCESS (0x00000040) for the 2nd member (fMask) of the SHELLEXECUTEINFO struct.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#7 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
|
Why make this more complicated than it has to be? To perform a ShellExecute without waiting you can just use the ExecShell command...
IntOp $PostCount $PostCount + 1 |
|
|
|
![]() |
|
|||||||
| Tags |
| elevate, rights, runasadmin, vista, windows 7 |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|