PageRenderTime 155ms CodeModel.GetById 71ms app.highlight 3ms RepoModel.GetById 77ms app.codeStats 1ms

/admin/win/nsi/nsis_uac/UAC_AllowLUA.nsi

http://github.com/tomahawk-player/tomahawk
Unknown | 45 lines | 33 code | 12 blank | 0 comment | 0 complexity | 948323ceb1862352833c955f086b940a MD5 | raw file
 1/*
 2This sample will try to elevate, but it will also allow non admin users to continue if they click cancel in the elevation dialog
 3*/
 4
 5RequestExecutionLevel user /* RequestExecutionLevel REQUIRED! */
 6!define APPNAME "UAC_AllowLUA"
 7Name "${APPNAME}"
 8OutFile "${APPNAME}.exe"
 9ShowInstDetails show
10!include UAC.nsh
11
12
13Function .OnInstFailed
14UAC::Unload ;Must call unload!
15FunctionEnd
16Function .OnInstSuccess
17UAC::Unload ;Must call unload!
18FunctionEnd
19
20Function .OnInit
21UAC::RunElevated 
22;MessageBox mb_iconinformation "Debug: UAC::RunElevated: $\n0(Error)=$0 $\n1(UACMode)=$1 $\n2=$2 $\nadmin=$3$\n$\n$CmdLine"
23StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
24StrCmp 0 $0 0 UAC_Err ; Error?
25StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
26Quit
27UAC_Err:
28MessageBox mb_iconstop "Unable to elevate , error $0"
29Abort
30UAC_ElevationAborted:
31# elevation was aborted, we still run as normal
32UAC_Success:
33FunctionEnd
34
35
36
37Section "Info"
38!insertmacro _UAC.DbgDetailPrint
39SectionEnd
40
41
42
43
44
45Page InstFiles