1 | ; $Id: VBoxGuestAdditionsUninstall.nsh 109138 2025-05-02 15:54:09Z 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 |
|
---|
29 | !macro Uninstall un
|
---|
30 | ;;
|
---|
31 | ; Main uninstallation function.
|
---|
32 | ;
|
---|
33 | ; Input:
|
---|
34 | ; None
|
---|
35 | ; Output:
|
---|
36 | ; None
|
---|
37 | ;
|
---|
38 | Function ${un}Uninstall_Perform
|
---|
39 |
|
---|
40 | ${LogVerbose} "Uninstalling ..."
|
---|
41 |
|
---|
42 | ; Create temp directory where we can store uninstallation logs.
|
---|
43 | CreateDirectory "$TEMP\${PRODUCT_NAME}"
|
---|
44 |
|
---|
45 | ; Uninstall OS-specifics.
|
---|
46 | ${If} ${AtLeastWinVista}
|
---|
47 |
|
---|
48 | force_uninstall_unsupported_os:
|
---|
49 |
|
---|
50 | Call ${un}W2K_CallbackUninstall
|
---|
51 | Call ${un}Vista_CallbackUninstall
|
---|
52 | goto done_os_specific ; Needed because of force_uninstall_unsupported_os label.
|
---|
53 |
|
---|
54 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit only
|
---|
55 | ${ElseIf} ${AtLeastWin2000}
|
---|
56 |
|
---|
57 | Call ${un}W2K_CallbackUninstall
|
---|
58 |
|
---|
59 | ${ElseIf} ${AtLeastWinNT4}
|
---|
60 |
|
---|
61 | Call ${un}NT4_CallbackUninstall
|
---|
62 |
|
---|
63 | !endif
|
---|
64 | ${Else}
|
---|
65 |
|
---|
66 | ${If} $g_bForceInstall == "true"
|
---|
67 | Goto force_uninstall_unsupported_os ; Assume newer OS than we know of ...
|
---|
68 | ${EndIf}
|
---|
69 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
70 | Goto done
|
---|
71 |
|
---|
72 | ${EndIf}
|
---|
73 |
|
---|
74 | done_os_specific:
|
---|
75 |
|
---|
76 | ; Delete Guest Additions directory (only if completely empty).
|
---|
77 | RMDir /REBOOTOK "$INSTDIR"
|
---|
78 |
|
---|
79 | ; Delete desktop & start menu entries
|
---|
80 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
|
---|
81 | Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.url"
|
---|
82 | RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
|
---|
83 |
|
---|
84 | ; Delete vendor installation directory (only if completely empty).
|
---|
85 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
86 | RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
|
---|
87 | !else ; 64-bit
|
---|
88 | RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
|
---|
89 | !endif
|
---|
90 |
|
---|
91 | ; Delete version information.
|
---|
92 | DeleteRegValue HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "Version"
|
---|
93 | DeleteRegValue HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "VersionExt"
|
---|
94 | DeleteRegValue HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "Revision"
|
---|
95 | DeleteRegValue HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "InstallDir"
|
---|
96 |
|
---|
97 | ; Delete registry keys.
|
---|
98 | DeleteRegKey /ifempty HKLM "${REGISTRY_KEY_PRODUCT_ROOT}"
|
---|
99 | DeleteRegKey /ifempty HKLM "${REGISTRY_KEY_VENDOR_ROOT}"
|
---|
100 | DeleteRegKey "${REGISTRY_KEY_UNINST_ROOT}" "${REGISTRY_KEY_UNINST_PRODUCT}" ; Uninstaller.
|
---|
101 |
|
---|
102 | done:
|
---|
103 |
|
---|
104 | ;
|
---|
105 | ; Dump UI log to on success too. Only works with non-silent installs.
|
---|
106 | ; (This has to be done here rather than in .onUninstSuccess, because by
|
---|
107 | ; then the log is no longer visible in the UI).
|
---|
108 | ;
|
---|
109 | ${IfNot} ${Silent}
|
---|
110 | !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
|
---|
111 | VBoxGuestInstallHelper::DumpLog "$TEMP\vbox_uninstall_ui.log"
|
---|
112 | !else
|
---|
113 | StrCpy $0 "$TEMP\vbox_uninstall_ui.log"
|
---|
114 | Push $0
|
---|
115 | Call DumpLog
|
---|
116 | !endif
|
---|
117 | ${EndIf}
|
---|
118 |
|
---|
119 | FunctionEnd
|
---|
120 | !macroend
|
---|
121 | !ifndef UNINSTALLER_ONLY
|
---|
122 | !insertmacro Uninstall ""
|
---|
123 | !endif
|
---|
124 | !insertmacro Uninstall "un."
|
---|
125 |
|
---|
126 |
|
---|
127 | !macro Common_DeleteFiles un
|
---|
128 | ;;
|
---|
129 | ; Deletes files commonly used by all supported guest OSes in $INSTDIR.
|
---|
130 | ;
|
---|
131 | ; Input:
|
---|
132 | ; None
|
---|
133 | ; Output:
|
---|
134 | ; None
|
---|
135 | ;
|
---|
136 | Function ${un}Common_DeleteFiles
|
---|
137 |
|
---|
138 | Delete /REBOOTOK "$INSTDIR\${LICENSE_FILE_RTF}"
|
---|
139 | Delete /REBOOTOK "$INSTDIR\iexplore.ico" ; Removed in r153662.
|
---|
140 |
|
---|
141 | Delete /REBOOTOK "$INSTDIR\install.log"
|
---|
142 | Delete /REBOOTOK "$INSTDIR\install*.log"
|
---|
143 | Delete /REBOOTOK "$INSTDIR\uninst.exe"
|
---|
144 | Delete /REBOOTOK "$INSTDIR\VBoxGAs*.log" ; Debug logs created by VBoxStub.
|
---|
145 | Delete /REBOOTOK "$INSTDIR\${PRODUCT_NAME}.url"
|
---|
146 |
|
---|
147 | ;
|
---|
148 | ; Guest driver
|
---|
149 | ;
|
---|
150 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxTray.exe"
|
---|
151 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxControl.exe"
|
---|
152 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxHook.dll"
|
---|
153 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxGuest.sys"
|
---|
154 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxGuest.inf"
|
---|
155 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxGuest.cat"
|
---|
156 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxGuestEarlyNT.inf"
|
---|
157 | Delete /REBOOTOK "$INSTDIR\VBoxGuest\VBoxGuestEarlyNT.cat"
|
---|
158 | RMDir /REBOOTOK "$INSTDIR\VBoxGuest"
|
---|
159 |
|
---|
160 | ;
|
---|
161 | ; Mouse driver
|
---|
162 | ;
|
---|
163 | Delete /REBOOTOK "$INSTDIR\VBoxMouse\VBoxMouse.sys"
|
---|
164 | Delete /REBOOTOK "$INSTDIR\VBoxMouse\VBoxMouse.inf"
|
---|
165 | Delete /REBOOTOK "$INSTDIR\VBoxMouse\VBoxMouse.cat"
|
---|
166 | RMDir /REBOOTOK "$INSTDIR\VBoxMouse"
|
---|
167 |
|
---|
168 | ;
|
---|
169 | ; VBoxVideo driver
|
---|
170 | ;
|
---|
171 | Delete /REBOOTOK "$INSTDIR\VBoxVideo\VBoxVideo.sys"
|
---|
172 | Delete /REBOOTOK "$INSTDIR\VBoxVideo\VBoxVideo.inf"
|
---|
173 | Delete /REBOOTOK "$INSTDIR\VBoxVideo\VBoxVideo.cat"
|
---|
174 | Delete /REBOOTOK "$INSTDIR\VBoxVideo\VBoxVideoEarlyNT.inf"
|
---|
175 | Delete /REBOOTOK "$INSTDIR\VBoxVideo\VBoxVideoEarlyNT.cat"
|
---|
176 | Delete /REBOOTOK "$INSTDIR\VBoxVideo\VBoxDisp.dll"
|
---|
177 | RMDir /REBOOTOK "$INSTDIR\VBoxVideo"
|
---|
178 |
|
---|
179 | ;
|
---|
180 | ; VBoxWddm driver
|
---|
181 | ;
|
---|
182 | ; !if $%VBOX_WITH_WDDM% == "1"
|
---|
183 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxWddm.cat"
|
---|
184 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxWddm.sys"
|
---|
185 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxWddm.inf"
|
---|
186 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxDispD3D.dll"
|
---|
187 | ; !if $%VBOX_WITH_WDDM_DX% == "1"
|
---|
188 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxDX.dll"
|
---|
189 | ; !endif
|
---|
190 | ; !if $%VBOX_WITH_MESA3D% == "1"
|
---|
191 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxNine.dll"
|
---|
192 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxSVGA.dll"
|
---|
193 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxICD.dll"
|
---|
194 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxGL.dll"
|
---|
195 | ; !endif
|
---|
196 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxD3D9wddm.dll"
|
---|
197 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\wined3dwddm.dll"
|
---|
198 | ; !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
199 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxDispD3D-x86.dll"
|
---|
200 | ; !if $%VBOX_WITH_WDDM_DX% == "1"
|
---|
201 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxDX-x86.dll"
|
---|
202 | ; !endif
|
---|
203 | ; !if $%VBOX_WITH_MESA3D% == "1"
|
---|
204 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxNine-x86.dll"
|
---|
205 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxSVGA-x86.dll"
|
---|
206 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxICD-x86.dll"
|
---|
207 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxGL-x86.dll"
|
---|
208 | ; !endif
|
---|
209 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\VBoxD3D9wddm-x86.dll"
|
---|
210 | Delete /REBOOTOK "$INSTDIR\VBoxWddm\wined3dwddm-x86.dll"
|
---|
211 | ; !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
212 | RMDir /REBOOTOK "$INSTDIR\VBoxWddm"
|
---|
213 | ; !endif ; $%VBOX_WITH_WDDM% == "1"
|
---|
214 |
|
---|
215 | ;
|
---|
216 | ; Shared Folders driver
|
---|
217 | ;
|
---|
218 | Delete /REBOOTOK "$INSTDIR\VBoxSF\VBoxSF.sys"
|
---|
219 | ;!if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
220 | Delete /REBOOTOK "$INSTDIR\VBoxSF\VBoxSFW2K.sys"
|
---|
221 | ;!endif
|
---|
222 | Delete /REBOOTOK "$INSTDIR\VBoxSF\VBoxMRXNP.dll"
|
---|
223 | ;!if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
224 | Delete /REBOOTOK "$INSTDIR\VBoxSF\VBoxMRXNP-x86.dll"
|
---|
225 | ; !endif
|
---|
226 | RMDir /REBOOTOK "$INSTDIR\VBoxSF"
|
---|
227 |
|
---|
228 | ;
|
---|
229 | ; Credential providers
|
---|
230 | ;
|
---|
231 | Delete /REBOOTOK "$INSTDIR\AutoLogon\VBoxGINA.dll"
|
---|
232 | Delete /REBOOTOK "$INSTDIR\AutoLogon\VBoxCredProv.dll"
|
---|
233 | RMDir /REBOOTOK "$INSTDIR\AutoLogon"
|
---|
234 |
|
---|
235 | ;
|
---|
236 | ; Certificate stuff.
|
---|
237 | ;
|
---|
238 | Delete /REBOOTOK "$INSTDIR\Cert\VBoxGAs*.log" ; Debug logs created by VBoxCertUtil.
|
---|
239 | Delete /REBOOTOK "$INSTDIR\Cert\VBoxCertUtil.exe"
|
---|
240 | RMDir /REBOOTOK "$INSTDIR\Cert"
|
---|
241 |
|
---|
242 | ;
|
---|
243 | ; Misc binaries
|
---|
244 | ;
|
---|
245 | Delete /REBOOTOK "$INSTDIR\Bin\VBoxService.exe"
|
---|
246 | RMDir /REBOOTOK "$INSTDIR\Bin"
|
---|
247 |
|
---|
248 | ;
|
---|
249 | ; Tools
|
---|
250 | Delete /REBOOTOK "$INSTDIR\Tools\VBoxDrvInst.exe" ; Does not exist on NT4, but try to remove it anyway.
|
---|
251 | Delete /REBOOTOK "$INSTDIR\Tools\VBoxGuestInstallHelper.exe"
|
---|
252 | Delete /REBOOTOK "$INSTDIR\Tools\VBoxAudioTest.exe"
|
---|
253 | RMDir /REBOOTOK "$INSTDIR\Tools"
|
---|
254 |
|
---|
255 | FunctionEnd
|
---|
256 | !macroend
|
---|
257 | !insertmacro Common_DeleteFiles "un."
|
---|
258 |
|
---|
259 |
|
---|
260 | !macro Uninstall_DeleteFiles un
|
---|
261 | ;;
|
---|
262 | ; Deletes all previously installed files in $INSTDIR.
|
---|
263 | ; Must be called after ${un}Uninstall_Perform.
|
---|
264 | ;
|
---|
265 | ; Input:
|
---|
266 | ; None
|
---|
267 | ; Output:
|
---|
268 | ; None
|
---|
269 | ;
|
---|
270 | Function ${un}Uninstall_DeleteFiles
|
---|
271 |
|
---|
272 | ${LogVerbose} "Deleting files in $\"$INSTDIR$\" ..."
|
---|
273 |
|
---|
274 | ${If} ${AtLeastWinVista}
|
---|
275 |
|
---|
276 | force_delete_unsupported_os:
|
---|
277 |
|
---|
278 | Call ${un}W2K_CallbackDeleteFiles
|
---|
279 | Call ${un}Vista_CallbackDeleteFiles
|
---|
280 | goto done_os_specific ; Needed because of force_delete_unsupported_os label.
|
---|
281 |
|
---|
282 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit only
|
---|
283 | ${ElseIf} ${AtLeastWin2000}
|
---|
284 |
|
---|
285 | Call ${un}W2K_CallbackDeleteFiles
|
---|
286 |
|
---|
287 | ${ElseIf} ${AtLeastWinNT4}
|
---|
288 |
|
---|
289 | Call ${un}NT4_CallbackDeleteFiles
|
---|
290 | !endif
|
---|
291 |
|
---|
292 | ${Else}
|
---|
293 |
|
---|
294 | ${If} $g_bForceInstall == "true"
|
---|
295 | Goto force_delete_unsupported_os ; Assume newer OS than we know of ...
|
---|
296 | ${EndIf}
|
---|
297 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
298 | Goto done
|
---|
299 |
|
---|
300 | ${EndIf}
|
---|
301 |
|
---|
302 | done_os_specific:
|
---|
303 |
|
---|
304 | Call ${un}Common_DeleteFiles
|
---|
305 |
|
---|
306 | done:
|
---|
307 |
|
---|
308 | FunctionEnd
|
---|
309 | !macroend
|
---|
310 | !insertmacro Uninstall_DeleteFiles "un."
|
---|