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