-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstaller.nsh
92 lines (63 loc) · 2.27 KB
/
uninstaller.nsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Section "un.$(remove_files)" ;"un.Remove files"
SectionIn RO
; Remove files and uninstaller
Delete "$INSTDIR\qbittorrent.exe"
Delete "$INSTDIR\qbittorrent.pdb"
Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\uninst.exe"
; Remove directories used
RMDir /r "$INSTDIR\translations"
RMDir "$INSTDIR"
SectionEnd
Section "un.$(remove_shortcuts)" ;"un.Remove shortcuts"
SectionIn RO
; Remove shortcuts, if any
RMDir /r "$SMPROGRAMS\qBittorrent"
Delete "$DESKTOP\qBittorrent.lnk"
SectionEnd
Section "un.$(remove_registry)" ;"un.Remove registry keys"
SectionIn RO
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\qBittorrent"
DeleteRegKey HKLM "Software\qBittorrent"
; Remove ProgIDs
DeleteRegKey HKLM "Software\Classes\qBittorrent.File.Torrent"
DeleteRegKey HKLM "Software\Classes\qBittorrent.Url.Magnet"
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p 0, p 0)'
SectionEnd
Section "un.$(remove_firewall)" ;
DetailPrint $(remove_firewallinfo)
nsisFirewallW::RemoveAuthorizedApplication "$INSTDIR\qbittorrent.exe"
SectionEnd
Section /o "un.$(remove_conf)" ;"un.Remove configuration files"
!insertmacro UAC_AsUser_Call Function un.remove_conf_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
SectionEnd
Function un.remove_conf_user
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_APPDATA}, i0)i.r0'
RMDir /r "$1\qBittorrent"
FunctionEnd
Section /o "un.$(remove_cache)"
!insertmacro UAC_AsUser_Call Function un.remove_cache_user ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR}
SectionEnd
Function un.remove_cache_user
System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i ${CSIDL_LOCALAPPDATA}, i0)i.r0'
RMDir /r "$1\qBittorrent\"
FunctionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro Init "uninstaller"
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Function un.check_instance
check:
FindProcDLL::FindProc "qbittorrent.exe"
StrCmp $R0 "1" 0 notfound
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(uninst_warning) IDRETRY check IDCANCEL done
done:
Abort
notfound:
FunctionEnd
Function un.onUninstSuccess
SetErrorLevel 0
FunctionEnd