PageRenderTime 182ms CodeModel.GetById 81ms app.highlight 1ms RepoModel.GetById 99ms app.codeStats 0ms

/admin/win/nsi/nsis_uac/UAC_Uninstaller.nsi

http://github.com/tomahawk-player/tomahawk
Unknown | 49 lines | 42 code | 7 blank | 0 comment | 0 complexity | 942d3ac519e77d75dc5f2f068a2a2379 MD5 | raw file
 1/*
 2This script was made in response to http://forums.winamp.com/showthread.php?threadid=280330
 3It is a ugly hack and is mostly here just to have a solution right now.
 4Hopefully, NSIS will add support for changing the RequestExecutionLevel of the uninstaller
 5This code inspired the _UAC.GenerateUninstallerTango macro (called by ${UAC.U.Elevate.AdminOnly} unless you define UAC_DISABLEUNINSTALLERTANGO)
 6*/
 7
 8RequestExecutionLevel user /* RequestExecutionLevel REQUIRED! */
 9!define APPNAME "UAC_Uninstaller"
10Name "${APPNAME}"
11OutFile "${APPNAME}.exe"
12ShowInstDetails show
13!include LogicLib.nsh
14
15!define UNINSTALLER_UACDATA "uac.ini"
16!define UNINSTALLER_NAME "Uninstall FooBarBaz"
17
18Function un.onInit
19ReadIniStr $0 "$ExeDir\${UNINSTALLER_UACDATA}" UAC "Un.First"
20${IF} $0 != 1
21	;SetSilent silent
22	InitPluginsDir
23	WriteIniStr "$PluginsDir\${UNINSTALLER_UACDATA}" UAC "Un.First" 1
24	CopyFiles /SILENT "$EXEPATH" "$PluginsDir\${UNINSTALLER_NAME}.exe"
25	StrCpy $0 ""
26	${IfThen} ${Silent} ${|} StrCpy $0 "/S " ${|}
27	ExecWait '"$PluginsDir\${UNINSTALLER_NAME}.exe" $0/NCRC _?=$INSTDIR' $0
28	SetErrorLevel $0
29	Quit
30	${EndIf}
31
32# UAC code goes here ...
33FunctionEnd
34
35Section
36WriteUninstaller "$exedir\${UNINSTALLER_NAME}.exe"
37SetAutoClose true
38DetailPrint "Uninstalling..."
39Sleep 1111
40Exec '"$exedir\${UNINSTALLER_NAME}.exe"'
41SectionEnd
42
43Section uninstall
44MessageBox mb_ok "My filename is: $EXEFILE"
45Delete "$instdir\${UNINSTALLER_NAME}.exe"
46Delete "$instdir\${APPNAME}.exe" ;delete generated installer aswell, this is just a sample script
47SectionEnd
48
49page InstFiles