WebUI: Improve hash copy actions in context menu
[qBittorrent.git] / dist / windows / uninstaller.nsh
blob51b47a42b2d539256318b367db61168f698bf8d6
1 Section "un.$(remove_files)" ;"un.Remove files"
2   SectionIn RO
4 ; Remove files and uninstaller
5   Delete "$INSTDIR\qbittorrent.exe"
6   Delete "$INSTDIR\qbittorrent.pdb"
7   Delete "$INSTDIR\qt.conf"
8   Delete "$INSTDIR\uninst.exe"
10   ; Remove directories used
11   RMDir /r "$INSTDIR\translations"
12   RMDir "$INSTDIR"
13 SectionEnd
15 Section "un.$(remove_shortcuts)" ;"un.Remove shortcuts"
16   SectionIn RO
17 ; Remove shortcuts, if any
18   RMDir /r "$SMPROGRAMS\qBittorrent"
19   Delete "$DESKTOP\qBittorrent.lnk"
20 SectionEnd
22 Section "un.$(remove_registry)" ;"un.Remove registry keys"
23   SectionIn RO
24   ; Remove registry keys
25   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent"
26   DeleteRegKey HKLM "Software\qBittorrent"
27   ; Remove ProgIDs
28   DeleteRegKey HKLM "Software\Classes\qBittorrent.File.Torrent"
29   DeleteRegKey HKLM "Software\Classes\qBittorrent.Url.Magnet"
30   System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p 0, p 0)'
31 SectionEnd
33 Section "un.$(remove_firewall)" ;
35   DetailPrint $(remove_firewallinfo)
36   nsisFirewallW::RemoveAuthorizedApplication "$INSTDIR\qbittorrent.exe"
38 SectionEnd
40 Section /o "un.$(remove_conf)" ;"un.Remove configuration files"
42   !insertmacro UAC_AsUser_Call Function un.remove_conf_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
44 SectionEnd
46 Function un.remove_conf_user
48   System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_APPDATA}, i0)i.r0'
49   RMDir /r "$1\qBittorrent"
51 FunctionEnd
53 Section /o "un.$(remove_cache)"
55   !insertmacro UAC_AsUser_Call Function un.remove_cache_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
57 SectionEnd
59 Function un.remove_cache_user
61   System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_LOCALAPPDATA}, i0)i.r0'
62   RMDir /r "$1\qBittorrent\"
64 FunctionEnd
66 ;--------------------------------
67 ;Uninstaller Functions
69 Function un.onInit
71   !insertmacro Init "uninstaller"
72   !insertmacro MUI_UNGETLANGUAGE
74 FunctionEnd
76 Function un.check_instance
78   check:
79   FindProcDLL::FindProc "qbittorrent.exe"
80   StrCmp $R0 "1" 0 notfound
81   MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(uninst_warning) /SD IDCANCEL IDRETRY check IDCANCEL canceled
83   canceled:
84   SetErrorLevel 15618 # WinError.h: `ERROR_PACKAGES_IN_USE`
85   Abort
87   notfound:
89 FunctionEnd
91 Function un.onUninstSuccess
92   SetErrorLevel 0
93 FunctionEnd