mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-19 12:21:52 +02:00
Providing support for UAC plugin as an option.
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
; Some installer script options (comment-out options not required)
|
; Some installer script options (comment-out options not required)
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
;!define OPTION_LICENSE_AGREEMENT
|
;!define OPTION_LICENSE_AGREEMENT
|
||||||
|
;!define OPTION_UAC_ENHANCED
|
||||||
!define OPTION_SECTION_SC_START_MENU
|
!define OPTION_SECTION_SC_START_MENU
|
||||||
!define OPTION_SECTION_SC_DESKTOP
|
!define OPTION_SECTION_SC_DESKTOP
|
||||||
!define OPTION_SECTION_SC_QUICK_LAUNCH
|
!define OPTION_SECTION_SC_QUICK_LAUNCH
|
||||||
@@ -57,10 +58,17 @@ InstType Full
|
|||||||
InstType Minimal
|
InstType Minimal
|
||||||
CRCCheck On
|
CRCCheck On
|
||||||
SetCompressor /SOLID lzma
|
SetCompressor /SOLID lzma
|
||||||
;RequestExecutionLevel user ;Using the UAC plugin.
|
|
||||||
ReserveFile tomahawk.ini
|
ReserveFile tomahawk.ini
|
||||||
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
||||||
|
|
||||||
|
;The UAC plugin provides an elevated user.
|
||||||
|
;Otherwise request admin level here.
|
||||||
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
RequestExecutionLevel user
|
||||||
|
!else
|
||||||
|
RequestExecutionLevel admin
|
||||||
|
!endif
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Include some required header files.
|
; Include some required header files.
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -71,7 +79,9 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
|||||||
!include Memento.nsh ;Remember user selections.
|
!include Memento.nsh ;Remember user selections.
|
||||||
!include WinVer.nsh ;Windows version detection.
|
!include WinVer.nsh ;Windows version detection.
|
||||||
!include WordFunc.nsh ;Used by VersionCompare macro function.
|
!include WordFunc.nsh ;Used by VersionCompare macro function.
|
||||||
;!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
|
||||||
|
!endif
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Memento selections stored in registry.
|
; Memento selections stored in registry.
|
||||||
@@ -136,12 +146,18 @@ UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
Function LaunchTomahawk
|
Function LaunchTomahawk
|
||||||
;${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
|
||||||
|
!else
|
||||||
|
Exec "$INSTDIR\tomahawk.exe"
|
||||||
|
!endif
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
Function LaunchTomahawkAsUser
|
Function LaunchTomahawkAsUser
|
||||||
Exec "$INSTDIR\tomahawk.exe"
|
Exec "$INSTDIR\tomahawk.exe"
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
!endif
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# #
|
# #
|
||||||
@@ -210,10 +226,12 @@ Function PageLeaveReinstall
|
|||||||
Delete $R1
|
Delete $R1
|
||||||
RMDir $INSTDIR
|
RMDir $INSTDIR
|
||||||
no_remove_uninstaller:
|
no_remove_uninstaller:
|
||||||
StrCmp $R0 "2" 0 +3
|
StrCmp $R0 "2" +2 0
|
||||||
;UAC::Unload
|
|
||||||
Quit
|
|
||||||
BringToFront
|
BringToFront
|
||||||
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
UAC::Unload
|
||||||
|
Quit
|
||||||
|
!endif
|
||||||
reinst_done:
|
reinst_done:
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
@@ -473,25 +491,27 @@ Function .onInit
|
|||||||
|
|
||||||
${MementoSectionRestore}
|
${MementoSectionRestore}
|
||||||
|
|
||||||
;UAC_Elevate:
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
;UAC::RunElevated
|
UAC_Elevate:
|
||||||
;StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
UAC::RunElevated
|
||||||
;StrCmp 0 $0 0 UAC_Err ; Error?
|
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
||||||
;StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
StrCmp 0 $0 0 UAC_Err ; Error?
|
||||||
;Quit
|
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
||||||
|
Quit
|
||||||
|
|
||||||
;UAC_Err:
|
UAC_Err:
|
||||||
;MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
||||||
;Abort
|
Abort
|
||||||
|
|
||||||
;UAC_ElevationAborted:
|
UAC_ElevationAborted:
|
||||||
;Abort
|
Abort
|
||||||
|
|
||||||
;UAC_Success:
|
UAC_Success:
|
||||||
;StrCmp 1 $3 +4 ;Admin?
|
StrCmp 1 $3 +4 ;Admin?
|
||||||
;StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
||||||
;MessageBox MB_ICONSTOP "This installer requires admin access, try again"
|
MessageBox MB_ICONSTOP "This installer requires admin access, try again"
|
||||||
;goto UAC_Elevate
|
goto UAC_Elevate
|
||||||
|
!endif
|
||||||
|
|
||||||
;Prevent multiple instances.
|
;Prevent multiple instances.
|
||||||
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e'
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e'
|
||||||
@@ -503,11 +523,15 @@ FunctionEnd
|
|||||||
|
|
||||||
Function .onInstSuccess
|
Function .onInstSuccess
|
||||||
${MementoSectionSave}
|
${MementoSectionSave}
|
||||||
;UAC::Unload ;Must call unload!
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
UAC::Unload ;Must call unload!
|
||||||
|
!endif
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function .onInstFailed
|
Function .onInstFailed
|
||||||
;UAC::Unload ;Must call unload!
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
UAC::Unload ;Must call unload!
|
||||||
|
!endif
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -517,26 +541,27 @@ FunctionEnd
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
Function un.onInit
|
Function un.onInit
|
||||||
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
UAC_Elevate:
|
||||||
|
UAC::RunElevated
|
||||||
|
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?
|
||||||
|
Quit
|
||||||
|
|
||||||
;UAC_Elevate:
|
UAC_Err:
|
||||||
;UAC::RunElevated
|
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
||||||
;StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
|
Abort
|
||||||
;StrCmp 0 $0 0 UAC_Err ; Error?
|
|
||||||
;StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
|
|
||||||
;Quit
|
|
||||||
|
|
||||||
;UAC_Err:
|
UAC_ElevationAborted:
|
||||||
;MessageBox MB_ICONSTOP "Unable to elevate, error $0"
|
Abort
|
||||||
;Abort
|
|
||||||
|
|
||||||
;UAC_ElevationAborted:
|
UAC_Success:
|
||||||
;Abort
|
StrCmp 1 $3 +4 ;Admin?
|
||||||
|
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
||||||
;UAC_Success:
|
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
|
||||||
;StrCmp 1 $3 +4 ;Admin?
|
goto UAC_Elevate
|
||||||
;StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
|
!endif
|
||||||
;MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
|
|
||||||
;goto UAC_Elevate
|
|
||||||
|
|
||||||
;Prevent multiple instances.
|
;Prevent multiple instances.
|
||||||
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e'
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e'
|
||||||
@@ -547,9 +572,13 @@ Function un.onInit
|
|||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function un.onUnInstSuccess
|
Function un.onUnInstSuccess
|
||||||
;UAC::Unload ;Must call unload!
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
UAC::Unload ;Must call unload!
|
||||||
|
!endif
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function un.onUnInstFailed
|
Function un.onUnInstFailed
|
||||||
;UAC::Unload ;Must call unload!
|
!ifdef OPTION_UAC_PLUGIN_ENHANCED
|
||||||
|
UAC::Unload ;Must call unload!
|
||||||
|
!endif
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
Reference in New Issue
Block a user