@ -32,6 +32,27 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
@@ -32,6 +32,27 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
; Write the installation path into the registry
WriteRegStr HKLM "Software\qBittorrent" "InstallLocation" "$INSTDIR"
; Register qBittorrent as possible default program for .torrent files and magnet links
WriteRegStr HKLM "Software\qBittorrent\Capabilities" "ApplicationDescription" "A BitTorrent client in Qt"
WriteRegStr HKLM "Software\qBittorrent\Capabilities" "ApplicationName" "qBittorrent"
WriteRegStr HKLM "Software\qBittorrent\Capabilities\FileAssociations" ".torrent" "qBittorrent.File.Torrent"
WriteRegStr HKLM "Software\qBittorrent\Capabilities\UrlAssociations" "magnet" "qBittorrent.Url.Magnet"
WriteRegStr HKLM "Software\RegisteredApplications" "qBittorrent" "Software\qBittorrent\Capabilities"
; Register qBittorrent ProgIDs
WriteRegStr HKLM "Software\Classes\qBittorrent.File.Torrent" "" "Torrent File"
WriteRegStr HKLM "Software\Classes\qBittorrent.File.Torrent\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
WriteRegStr HKLM "Software\Classes\qBittorrent.File.Torrent\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
WriteRegStr HKLM "Software\Classes\qBittorrent.Url.Magnet" "" "Magnet URI"
WriteRegStr HKLM "Software\Classes\qBittorrent.Url.Magnet\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
WriteRegStr HKLM "Software\Classes\qBittorrent.Url.Magnet\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
WriteRegStr HKLM "Software\Classes\.torrent" "Content Type" "application/x-bittorrent"
WriteRegStr HKLM "Software\Classes\magnet" "" "URL:Magnet URI"
WriteRegStr HKLM "Software\Classes\magnet" "Content Type" "application/x-magnet"
WriteRegStr HKLM "Software\Classes\magnet" "URL Protocol" ""
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p 0, p 0)'
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "DisplayName" "qBittorrent"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "UninstallString" '"$INSTDIR\uninst.exe"'
@ -46,13 +67,6 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
@@ -46,13 +67,6 @@ Section $(inst_qbt_req) ;"qBittorrent (required)"
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent" "EstimatedSize" "$0"
; qBittorrent ProgID
WriteRegStr HKLM "Software\Classes\qBittorrent" "" "qBittorrent Torrent File"
WriteRegStr HKLM "Software\Classes\qBittorrent" "FriendlyTypeName" "qBittorrent Torrent File"
WriteRegStr HKLM "Software\Classes\qBittorrent\shell" "" "open"
WriteRegStr HKLM "Software\Classes\qBittorrent\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
WriteRegStr HKLM "Software\Classes\qBittorrent\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
SectionEnd
; Optional section (can be disabled by the user)
@ -82,72 +96,6 @@ Function inst_startup_user
@@ -82,72 +96,6 @@ Function inst_startup_user
FunctionEnd
Section $(inst_torrent) ;"Open .torrent files with qBittorrent"
ReadRegStr $0 HKLM "Software\Classes\.torrent" ""
StrCmp $0 "qBittorrent" clear_errors 0
;Check if empty string
StrCmp $0 "" clear_errors 0
;Write old value to OpenWithProgIds
WriteRegStr HKLM "Software\Classes\.torrent\OpenWithProgIds" $0 ""
clear_errors:
ClearErrors
WriteRegStr HKLM "Software\Classes\.torrent" "" "qBittorrent"
WriteRegStr HKLM "Software\Classes\.torrent" "Content Type" "application/x-bittorrent"
!insertmacro UAC_AsUser_Call Function inst_torrent_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p 0, p 0)'
SectionEnd
Function inst_torrent_user
ReadRegStr $0 HKCU "Software\Classes\.torrent" ""
StrCmp $0 "qBittorrent" clear_errors 0
;Check if empty string
StrCmp $0 "" clear_errors 0
;Write old value to OpenWithProgIds
WriteRegStr HKCU "Software\Classes\.torrent\OpenWithProgIds" $0 ""
clear_errors:
ClearErrors
WriteRegStr HKCU "Software\Classes\.torrent" "" "qBittorrent"
WriteRegStr HKCU "Software\Classes\.torrent" "Content Type" "application/x-bittorrent"
FunctionEnd
Section $(inst_magnet) ;"Open magnet links with qBittorrent"
WriteRegStr HKLM "Software\Classes\magnet" "" "URL:Magnet link"
WriteRegStr HKLM "Software\Classes\magnet" "Content Type" "application/x-magnet"
WriteRegStr HKLM "Software\Classes\magnet" "URL Protocol" ""
WriteRegStr HKLM "Software\Classes\magnet\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
WriteRegStr HKLM "Software\Classes\magnet\shell" "" "open"
WriteRegStr HKLM "Software\Classes\magnet\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
!insertmacro UAC_AsUser_Call Function inst_magnet_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p 0, p 0)'
SectionEnd
Function inst_magnet_user
WriteRegStr HKCU "Software\Classes\magnet" "" "URL:Magnet link"
WriteRegStr HKCU "Software\Classes\magnet" "Content Type" "application/x-magnet"
WriteRegStr HKCU "Software\Classes\magnet" "URL Protocol" ""
WriteRegStr HKCU "Software\Classes\magnet\DefaultIcon" "" '"$INSTDIR\qbittorrent.exe",1'
WriteRegStr HKCU "Software\Classes\magnet\shell" "" "open"
WriteRegStr HKCU "Software\Classes\magnet\shell\open\command" "" '"$INSTDIR\qbittorrent.exe" "%1"'
FunctionEnd
Section $(inst_firewall)
DetailPrint $(inst_firewallinfo)