3 ;Compress the header too
4 !packhdr "$%TEMP%\exehead.tmp" 'upx.exe -9 --best --ultra-brute "$%TEMP%\exehead.tmp"'
6 ;Setting the compression
7 SetCompressor
/SOLID LZMA
8 SetCompressorDictSize
64
11 ;Uncomment when packaging 64bit qbittorrent
16 !include "FileFunc.nsh"
21 ;For the file association
22 !define SHCNE_ASSOCCHANGED
0x8000000
23 !define SHCNF_IDLIST
0
25 ;For special folder detection
26 !define CSIDL_APPDATA
'0x1A' ;Application Data path
27 !define CSIDL_LOCALAPPDATA
'0x1C' ;Local Application Data path
30 !define PROG_VERSION
"4.1.2"
32 !define MUI_FINISHPAGE_RUN
33 !define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
34 !define MUI_FINISHPAGE_RUN_TEXT
$(launch_qbt
)
37 ; The name of the installer
38 Name "qBittorrent ${PROG_VERSION}"
41 OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
43 ; The name of the installer
44 Name "qBittorrent ${PROG_VERSION} x64"
47 OutFile "qbittorrent_${PROG_VERSION}_x64_setup.exe"
50 ;Installer Version Information
51 VIAddVersionKey
"ProductName" "qBittorrent"
52 VIAddVersionKey
"CompanyName" "The qBittorrent project"
53 VIAddVersionKey
"LegalCopyright" "Copyright ©2006-2018 The qBittorrent project"
54 VIAddVersionKey
"FileDescription" "qBittorrent - A Bittorrent Client"
55 VIAddVersionKey
"FileVersion" "${PROG_VERSION}"
57 VIProductVersion
"${PROG_VERSION}.0"
59 ; The default installation directory. It changes depending if we install in the 64bit dir or not.
60 ; A caveat of this is if a user has installed a 32bit version and then runs the 64bit installer
61 ; (which in turn launches the 32bit uninstaller first) the value will still point to the 32bit location.
62 ; The user has to manually uninstall the old version and THEN run the 64bit installer
64 InstallDir $PROGRAMFILES32\qBittorrent
66 InstallDir $PROGRAMFILES64\qBittorrent
69 ; Registry key to check for directory (so if you install again, it will
70 ; overwrite the old one automatically)
71 InstallDirRegKey HKLM Software\qbittorrent InstallLocation
73 ; Request application privileges for Windows Vista
74 RequestExecutionLevel user
76 ;--------------------------------
78 !define MUI_ABORTWARNING
79 !define MUI_HEADERIMAGE
80 !define MUI_COMPONENTSPAGE_NODESC
81 ;!define MUI_ICON "qbittorrent.ico"
82 !define MUI_LICENSEPAGE_CHECKBOX
83 !define MUI_LANGDLL_ALLLANGUAGES
85 ;--------------------------------
86 ;Remember the unistaller/installer language
87 !define MUI_LANGDLL_REGISTRY_ROOT
"HKLM"
88 !define MUI_LANGDLL_REGISTRY_KEY
"Software\qbittorrent"
89 !define MUI_LANGDLL_REGISTRY_VALUENAME
"Installer Language"
91 ;--------------------------------
93 !insertmacro MUI_PAGE_WELCOME
94 !insertmacro MUI_PAGE_LICENSE
"license.txt"
95 !insertmacro MUI_PAGE_COMPONENTS
96 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
97 !insertmacro MUI_PAGE_DIRECTORY
98 !insertmacro MUI_PAGE_INSTFILES
99 !insertmacro MUI_PAGE_FINISH
101 ;--------------------------------
103 !insertmacro MUI_UNPAGE_CONFIRM
104 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un
.check_instance
105 !insertmacro MUI_UNPAGE_COMPONENTS
106 !insertmacro MUI_UNPAGE_INSTFILES
108 !insertmacro MUI_RESERVEFILE_LANGDLL
109 ReserveFile
"${NSISDIR}\Plugins\x86-unicode\FindProcDLL.dll"
110 ReserveFile
"${NSISDIR}\Plugins\x86-unicode\UAC.dll"
114 !insertmacro UAC_RunElevated
117 ${IfThen} $1 =
1 ${|
} Quit ${|
} ;we are the outer process, the inner process has done its work, we are done
118 ${IfThen} $3 <> 0 ${|
} ${Break} ${|
} ;we are admin, let the show go on
119 ${If} $1 =
3 ;RunAs completed successfully, but with a non-admin user
120 MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground
"This ${thing} requires admin privileges, try again" /SD
IDNO IDYES uac_tryagain
IDNO 0
122 ;fall-through and die
124 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground
"This ${thing} requires admin privileges, aborting!"
127 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground
"Logon service not running, aborting!"
130 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground
"Unable to elevate , error $0"
134 SetShellVarContext all