2013-07-06 20:03:26 +08:00
|
|
|
Unicode true
|
2013-01-24 03:06:50 +08:00
|
|
|
;Compress the header too
|
|
|
|
!packhdr "$%TEMP%\exehead.tmp" 'upx.exe -9 --best --ultra-brute "$%TEMP%\exehead.tmp"'
|
|
|
|
|
|
|
|
;Setting the compression
|
|
|
|
SetCompressor /SOLID LZMA
|
|
|
|
SetCompressorDictSize 64
|
|
|
|
XPStyle on
|
|
|
|
|
2014-07-29 00:29:51 +08:00
|
|
|
!include "MUI.nsh"
|
|
|
|
!include "UAC.nsh"
|
2013-01-28 02:46:40 +08:00
|
|
|
!include "FileFunc.nsh"
|
2013-01-24 03:06:50 +08:00
|
|
|
|
|
|
|
;For the file association
|
|
|
|
!define SHCNE_ASSOCCHANGED 0x8000000
|
|
|
|
!define SHCNF_IDLIST 0
|
|
|
|
|
|
|
|
;For special folder detection
|
|
|
|
!define CSIDL_APPDATA '0x1A' ;Application Data path
|
|
|
|
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
|
|
|
|
|
2015-05-14 04:33:22 +08:00
|
|
|
!define PROG_VERSION "3.3.0"
|
2014-07-29 00:29:51 +08:00
|
|
|
!define MUI_FINISHPAGE_RUN
|
|
|
|
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
|
2013-07-07 17:37:28 +08:00
|
|
|
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
|
2013-01-24 03:06:50 +08:00
|
|
|
|
|
|
|
; The name of the installer
|
2013-01-28 02:01:12 +08:00
|
|
|
Name "qBittorrent ${PROG_VERSION}"
|
2013-01-24 03:06:50 +08:00
|
|
|
|
|
|
|
; The file to write
|
|
|
|
OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
|
|
|
|
|
2013-01-28 02:17:13 +08:00
|
|
|
;Installer Version Information
|
|
|
|
VIAddVersionKey "ProductName" "qBittorrent"
|
2013-07-02 04:17:37 +08:00
|
|
|
VIAddVersionKey "CompanyName" "The qBittorrent project"
|
2015-05-14 04:23:53 +08:00
|
|
|
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2015 The qBittorrent project"
|
2013-01-28 02:17:13 +08:00
|
|
|
VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
|
|
|
|
VIAddVersionKey "FileVersion" "${PROG_VERSION}"
|
|
|
|
|
|
|
|
VIProductVersion "${PROG_VERSION}.0"
|
|
|
|
|
2013-01-24 03:06:50 +08:00
|
|
|
; The default installation directory
|
|
|
|
InstallDir $PROGRAMFILES\qBittorrent
|
|
|
|
|
|
|
|
; Registry key to check for directory (so if you install again, it will
|
|
|
|
; overwrite the old one automatically)
|
|
|
|
InstallDirRegKey HKLM Software\qbittorrent InstallLocation
|
|
|
|
|
|
|
|
; Request application privileges for Windows Vista
|
2014-07-29 00:29:51 +08:00
|
|
|
RequestExecutionLevel user
|
2013-01-24 03:06:50 +08:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;General Settings
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
!define MUI_HEADERIMAGE
|
|
|
|
!define MUI_COMPONENTSPAGE_NODESC
|
|
|
|
;!define MUI_ICON "qbittorrent.ico"
|
|
|
|
!define MUI_LICENSEPAGE_CHECKBOX
|
|
|
|
!define MUI_LANGDLL_ALLLANGUAGES
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Remember the unistaller/installer language
|
|
|
|
!define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
|
|
|
|
!define MUI_LANGDLL_REGISTRY_KEY "Software\qbittorrent"
|
|
|
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Installer Pages
|
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
|
|
!insertmacro MUI_PAGE_LICENSE "license.txt"
|
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
2013-02-02 08:39:08 +08:00
|
|
|
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
|
2013-01-24 03:06:50 +08:00
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
2013-01-28 02:59:08 +08:00
|
|
|
!insertmacro MUI_PAGE_FINISH
|
2013-01-24 03:06:50 +08:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Uninstaller Pages
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
2013-01-28 06:44:51 +08:00
|
|
|
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.check_instance
|
2013-01-24 03:06:50 +08:00
|
|
|
!insertmacro MUI_UNPAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
|
|
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
2013-06-30 19:43:23 +08:00
|
|
|
ReserveFile "${NSISDIR}\Plugins\x86-unicode\FindProcDLL.dll"
|
2014-07-29 00:29:51 +08:00
|
|
|
ReserveFile "${NSISDIR}\Plugins\x86-unicode\UAC.dll"
|
|
|
|
|
|
|
|
!macro Init thing
|
|
|
|
uac_tryagain:
|
|
|
|
!insertmacro UAC_RunElevated
|
|
|
|
${Switch} $0
|
|
|
|
${Case} 0
|
|
|
|
${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
|
|
|
|
${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
|
|
|
|
${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
|
|
|
|
MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
|
|
|
|
${EndIf}
|
|
|
|
;fall-through and die
|
|
|
|
${Case} 1223
|
|
|
|
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!"
|
|
|
|
Quit
|
|
|
|
${Case} 1062
|
|
|
|
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!"
|
|
|
|
Quit
|
|
|
|
${Default}
|
|
|
|
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate , error $0"
|
|
|
|
Quit
|
|
|
|
${EndSwitch}
|
|
|
|
|
|
|
|
SetShellVarContext all
|
|
|
|
!macroend
|