VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsUninstall.nsh@ 108935

Last change on this file since 108935 was 108935, checked in by vboxsync, 5 weeks ago

Windows Guest Additions installer: Fixes for %BUILD_TARGET_ARCH% -> %KBUILD_TARGET_ARCH% (note the 'K' at the beginning).

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette