- NSIS Discussion
- UAC_AsUser_ExecShell doing nothing
Archive: UAC_AsUser_ExecShell doing nothing
laughingman86
12th January 2011 12:25 UTC
UAC_AsUser_ExecShell doing nothing
hi
at the end of install need to start a program, so using this string
!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\${APP_EXE_FILE}" "" "" ""
But it isn't running
On init using this:
Function .OnInit
!insertmacro UAC_RunElevated
# call userInfo plugin to get user info. The plugin puts the result in the stack
userInfo::getAccountType
# pop the result from the stack into $0
pop $0
# compare the result with the string "Admin" to see if the user is admin.
# If match, jump 3 lines down.
strCmp $0 "Admin" +2
# if there is not a match, quit
Abort
# otherwise, continue
What am i doing wrong?
Anders
12th January 2011 20:25 UTC
There was a fix related to $instdir in the plugin recently so make sure you have the latest version. Also, you .onInit code is all wrong.
laughingman86
13th January 2011 14:32 UTC
Thanks, also appearently my installer file uses ANSI encoding so most of the commands didn't work right.
i used this onInit code to test my admin rights - because of the above reason.
So now i test this onInit
!insertmacro UAC_RunElevated
${IfNot} ${UAC_IsAdmin}
Quit
${EndIf}
and it works fine
Anders
13th January 2011 22:02 UTC
Still wrong, you are supposed to check $0,$1,$2 and $3
browserseal
18th June 2011 14:17 UTC
I'm having exactly the same problem, !insertmacro UAC_AsUser_ExecShell '' '"$TEMP"' '' '' '' has no effect and it is not clear how to debug this.
Could not figure out how the original poster solved his problem...
Anders
18th June 2011 14:26 UTC
I don't think starting $temp would work no matter what:
Admin's $temp is c:\users\admin\... , the normal user cannot access that path...
MSG
18th June 2011 17:19 UTC
Also I'm pretty sure you can't just 'execute' a directory... You'll probably want to run a function as user, and in that function do Exec $windir\explorer.exe /n,"$temp" or something like that.
browserseal
18th June 2011 18:28 UTC
Yeah... you are probably right about the user not being able to access the admin's temp directory. I wonder how can I make NSIS download something to a directory that will be later accessible by the user...
P.S. Of course I'm not trying to run the directory, I removed the program name after I copy-pasted the code.
MSG
18th June 2011 19:11 UTC
Perhaps you can call a function as user and let that download?
browserseal
19th June 2011 05:35 UTC
UAC_AsUser_Call... right. Should work. Thanks