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"
22 ;For the file association
23 !define SHCNE_ASSOCCHANGED
0x8000000
24 !define SHCNF_IDLIST
0
26 ;For special folder detection
27 !define CSIDL_APPDATA
'0x1A' ;Application Data path
28 !define CSIDL_LOCALAPPDATA
'0x1C' ;Local Application Data path
31 !define PROG_VERSION
"4.5.0"
33 !define MUI_FINISHPAGE_RUN
34 !define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
35 !define MUI_FINISHPAGE_RUN_TEXT
$(launch_qbt
)
38 ; The name of the installer
39 Name "qBittorrent ${PROG_VERSION}"
42 OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
44 ; The name of the installer
45 Name "qBittorrent ${PROG_VERSION} x64"
48 OutFile "qbittorrent_${PROG_VERSION}_x64_setup.exe"
51 ;Installer Version Information
52 VIAddVersionKey
"ProductName" "qBittorrent"
53 VIAddVersionKey
"CompanyName" "The qBittorrent project"
54 VIAddVersionKey
"LegalCopyright" "Copyright ©2006-2022 The qBittorrent project"
55 VIAddVersionKey
"FileDescription" "qBittorrent - A Bittorrent Client"
56 VIAddVersionKey
"FileVersion" "${PROG_VERSION}"
58 VIProductVersion
"${PROG_VERSION}.0"
60 ; The default installation directory. It changes depending if we install in the 64bit dir or not.
61 ; A caveat of this is if a user has installed a 32bit version and then runs the 64bit installer
62 ; (which in turn launches the 32bit uninstaller first) the value will still point to the 32bit location.
63 ; The user has to manually uninstall the old version and THEN run the 64bit installer
65 InstallDir $PROGRAMFILES32\qBittorrent
67 InstallDir $PROGRAMFILES64\qBittorrent
70 ; Registry key to check for directory (so if you install again, it will
71 ; overwrite the old one automatically)
72 InstallDirRegKey HKLM Software\qbittorrent InstallLocation
74 ; Request application privileges for Windows Vista
75 RequestExecutionLevel user
77 ;--------------------------------
79 !define MUI_ABORTWARNING
80 !define MUI_HEADERIMAGE
81 !define MUI_COMPONENTSPAGE_NODESC
82 ;!define MUI_ICON "qbittorrent.ico"
83 !define MUI_LICENSEPAGE_CHECKBOX
84 !define MUI_LANGDLL_ALLLANGUAGES
86 ;--------------------------------
87 ;Remember the unistaller/installer language
88 !define MUI_LANGDLL_REGISTRY_ROOT
"HKLM"
89 !define MUI_LANGDLL_REGISTRY_KEY
"Software\qbittorrent"
90 !define MUI_LANGDLL_REGISTRY_VALUENAME
"Installer Language"
92 ;--------------------------------
94 !insertmacro MUI_PAGE_WELCOME
95 !insertmacro MUI_PAGE_LICENSE
"license.txt"
96 !insertmacro MUI_PAGE_COMPONENTS
97 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
98 !insertmacro MUI_PAGE_DIRECTORY
99 !insertmacro MUI_PAGE_INSTFILES
100 !insertmacro MUI_PAGE_FINISH
102 ;--------------------------------
104 !insertmacro MUI_UNPAGE_CONFIRM
105 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un
.check_instance
106 !insertmacro MUI_UNPAGE_COMPONENTS
107 !insertmacro MUI_UNPAGE_INSTFILES
109 !insertmacro MUI_RESERVEFILE_LANGDLL
110 ReserveFile
"${NSISDIR}\Plugins\x86-unicode\FindProcDLL.dll"
111 ReserveFile
"${NSISDIR}\Plugins\x86-unicode\UAC.dll"
115 !insertmacro UAC_RunElevated
118 ${IfThen} $1 =
1 ${|
} Quit ${|
} ;we are the outer process, the inner process has done its work, we are done
119 ${IfThen} $3 <> 0 ${|
} ${Break} ${|
} ;we are admin, let the show go on
120 ${If} $1 =
3 ;RunAs completed successfully, but with a non-admin user
121 MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground
"This ${thing} requires admin privileges, try again" /SD
IDNO IDYES uac_tryagain
IDNO 0
123 ;fall-through and die
125 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground
"This ${thing} requires admin privileges, aborting!"
128 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground
"Logon service not running, aborting!"
131 MessageBox mb_IconStop|mb_TopMost|mb_SetForeground
"Unable to elevate , error $0"
135 SetShellVarContext all