1 | ; $Id: VBoxGuestAdditionsUninstall.nsh 107235 2024-12-05 10:01:46Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; VBoxGuestAdditionsUninstall.nsh - Guest Additions uninstallation.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | ;
|
---|
27 |
|
---|
28 | !macro UninstallCommon un
|
---|
29 | Function ${un}UninstallCommon
|
---|
30 |
|
---|
31 | Delete /REBOOTOK "$INSTDIR\install*.log"
|
---|
32 | Delete /REBOOTOK "$INSTDIR\uninst.exe"
|
---|
33 | Delete /REBOOTOK "$INSTDIR\${PRODUCT_NAME}.url"
|
---|
34 |
|
---|
35 | ; Remove common files
|
---|
36 | Delete /REBOOTOK "$INSTDIR\VBoxDrvInst.exe" ; Does not exist on NT4, but try to remove it anyway.
|
---|
37 | Delete /REBOOTOK "$INSTDIR\RegCleanup.exe" ; Obsolete since r165894 (see #10799).
|
---|
38 | Delete /REBOOTOK "$INSTDIR\VBoxGuestInstallHelper.exe"
|
---|
39 |
|
---|
40 | Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
|
---|
41 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
42 | Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
|
---|
43 | !endif
|
---|
44 |
|
---|
45 | !if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
|
---|
46 | Delete /REBOOTOK "$INSTDIR\${LICENSE_FILE_RTF}"
|
---|
47 | !endif
|
---|
48 |
|
---|
49 | Delete /REBOOTOK "$INSTDIR\VBoxGINA.dll"
|
---|
50 |
|
---|
51 | ; Delete registry keys
|
---|
52 | DeleteRegKey /ifempty HKLM "${PRODUCT_INSTALL_KEY}"
|
---|
53 | DeleteRegKey /ifempty HKLM "${VENDOR_ROOT_KEY}"
|
---|
54 |
|
---|
55 | ; Delete desktop & start menu entries
|
---|
56 | Delete "$DESKTOP\${PRODUCT_NAME}.lnk" ; Obsolete. We don't install a desktop link any more.
|
---|
57 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
|
---|
58 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.url"
|
---|
59 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" ; Old name. Changed to Website.url in r153663.
|
---|
60 | RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
|
---|
61 |
|
---|
62 | ; Delete Guest Additions directory (only if completely empty)
|
---|
63 | RMDir /REBOOTOK "$INSTDIR"
|
---|
64 |
|
---|
65 | ; Delete vendor installation directory (only if completely empty)
|
---|
66 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
67 | RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
|
---|
68 | !else ; 64-bit
|
---|
69 | RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
|
---|
70 | !endif
|
---|
71 |
|
---|
72 | ; Remove registry entries
|
---|
73 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
---|
74 |
|
---|
75 | FunctionEnd
|
---|
76 | !macroend
|
---|
77 | ;!insertmacro UninstallCommon "" - only .un version used
|
---|
78 | !insertmacro UninstallCommon "un."
|
---|
79 |
|
---|
80 | !macro Uninstall un
|
---|
81 | Function ${un}Uninstall
|
---|
82 |
|
---|
83 | ${LogVerbose} "Uninstalling system files ..."
|
---|
84 | !ifdef _DEBUG
|
---|
85 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
86 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
87 | ${LogVerbose} "Temp Directory: $TEMP"
|
---|
88 | !endif
|
---|
89 |
|
---|
90 | ; Create temp directory where we can store uninstallation logs.
|
---|
91 | CreateDirectory "$TEMP\${PRODUCT_NAME}"
|
---|
92 |
|
---|
93 | ; Which OS are we using?
|
---|
94 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
95 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
96 | !endif
|
---|
97 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
98 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
99 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
100 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
101 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
102 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
103 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
104 | StrCmp $g_strWinVersion "10" vista ; Windows 10
|
---|
105 |
|
---|
106 | ${If} $g_bForceInstall == "true"
|
---|
107 | Goto vista ; Assume newer OS than we know of ...
|
---|
108 | ${EndIf}
|
---|
109 |
|
---|
110 | Goto notsupported
|
---|
111 |
|
---|
112 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
113 | nt4:
|
---|
114 |
|
---|
115 | Call ${un}NT4_Uninstall
|
---|
116 | goto common
|
---|
117 | !endif
|
---|
118 |
|
---|
119 | w2k:
|
---|
120 |
|
---|
121 | Call ${un}W2K_Uninstall
|
---|
122 | goto common
|
---|
123 |
|
---|
124 | vista:
|
---|
125 |
|
---|
126 | Call ${un}W2K_Uninstall
|
---|
127 | Call ${un}Vista_Uninstall
|
---|
128 | goto common
|
---|
129 |
|
---|
130 | notsupported:
|
---|
131 |
|
---|
132 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
133 | Goto exit
|
---|
134 |
|
---|
135 | common:
|
---|
136 |
|
---|
137 | exit:
|
---|
138 |
|
---|
139 | ;
|
---|
140 | ; Dump UI log to on success too. Only works with non-silent installs.
|
---|
141 | ; (This has to be done here rather than in .onUninstSuccess, because by
|
---|
142 | ; then the log is no longer visible in the UI.)
|
---|
143 | ;
|
---|
144 | ${IfNot} ${Silent}
|
---|
145 | !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
|
---|
146 | VBoxGuestInstallHelper::DumpLog "$TEMP\vbox_uninstall_ui.log"
|
---|
147 | !else
|
---|
148 | StrCpy $0 "$TEMP\vbox_uninstall_ui.log"
|
---|
149 | Push $0
|
---|
150 | Call DumpLog
|
---|
151 | !endif
|
---|
152 | ${EndIf}
|
---|
153 |
|
---|
154 | FunctionEnd
|
---|
155 | !macroend
|
---|
156 | !ifndef UNINSTALLER_ONLY
|
---|
157 | !insertmacro Uninstall ""
|
---|
158 | !endif
|
---|
159 | !insertmacro Uninstall "un."
|
---|
160 |
|
---|
161 | ;;
|
---|
162 | ; The last step of the uninstallation where we remove all files from the
|
---|
163 | ; install directory and such.
|
---|
164 | ;
|
---|
165 | !macro UninstallInstDir un
|
---|
166 | Function ${un}UninstallInstDir
|
---|
167 |
|
---|
168 | ${LogVerbose} "Uninstalling directory ..."
|
---|
169 | !ifdef _DEBUG
|
---|
170 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
171 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
172 | !endif
|
---|
173 |
|
---|
174 | ; Which OS are we using?
|
---|
175 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
176 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
177 | !endif
|
---|
178 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
179 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
180 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
181 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
182 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
183 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
184 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
185 | StrCmp $g_strWinVersion "10" vista ; Windows 10
|
---|
186 |
|
---|
187 | ${If} $g_bForceInstall == "true"
|
---|
188 | Goto vista ; Assume newer OS than we know of ...
|
---|
189 | ${EndIf}
|
---|
190 |
|
---|
191 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
192 | Goto exit
|
---|
193 |
|
---|
194 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
195 | nt4:
|
---|
196 |
|
---|
197 | Call ${un}NT4_UninstallInstDir
|
---|
198 | goto common
|
---|
199 | !endif
|
---|
200 |
|
---|
201 | w2k:
|
---|
202 |
|
---|
203 | Call ${un}W2K_UninstallInstDir
|
---|
204 | goto common
|
---|
205 |
|
---|
206 | vista:
|
---|
207 |
|
---|
208 | Call ${un}W2K_UninstallInstDir
|
---|
209 | Call ${un}Vista_UninstallInstDir
|
---|
210 | goto common
|
---|
211 |
|
---|
212 | common:
|
---|
213 |
|
---|
214 | Call ${un}Common_CleanupObsoleteFiles
|
---|
215 |
|
---|
216 | ; This will attempt remove the install dir, so must be last.
|
---|
217 | Call ${un}UninstallCommon
|
---|
218 |
|
---|
219 | exit:
|
---|
220 |
|
---|
221 | FunctionEnd
|
---|
222 | !macroend
|
---|
223 | ;!insertmacro UninstallInstDir "" - only un. version is used.
|
---|
224 | !insertmacro UninstallInstDir "un."
|
---|