View Single Post
Old 20th September 2010, 14:48   #1
Junior Member
Join Date: Jun 2010
Posts: 6
!insertmacro UAC_RunElevated crashes installer


I have NSIS v2.38 and use 'UAC v0.2.2c - 20100828' UAC plugin.

I added both files to their respective folder
- UAC.nsh to C:\Program Files\NSIS\Include
- UAC.dll from Release/A to C:\Program Files\NSIS\Plugins
- Added the following lines to the top of the installer:
-- !include "UAC.nsh"
-- RequestExecutionLevel user

There are no errors during the build, however when running the installer it crashes on entering the line '!insertmacro UAC_RunElevated'
I tested it with several msgboxes in the installer to see where it crashes.

messageBox MB_OK "winverok: Just before UAC" ; -> is shown
messageBox MB_OK "In UAC_Elevate" ; ->is shown
!insertmacro UAC_RunElevated
messageBox MB_OK "After insertmacro UAC_Elevate" ;-> NOT shown, crash on line above?
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?

MessageBox mb_iconstop "Unable to elevate, error $0"

# elevation was aborted, run as normal?
MessageBox mb_iconstop "This installer requires admin access, aborting!"

StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox mb_iconstop "This installer requires admin access, try again"
goto UAC_Elevate

messageBox MB_OK "winverok: Just after UAC"

Does anyone have an idea what this can be? I also tried with the U dll but it gives the same problem. When I look in my user temp folder I find the UAC.dll.

Stieven76 is offline   Reply With Quote