VirtualBox

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

Last change on this file since 106962 was 106962, checked in by vboxsync, 2 months ago

Windows driver installation/Additions: Ship new VBoxDrvInst and switched from using InstallHelper.exe (formerly known as VBoxDrvInst) => VBoxDrvInst for (un)installing drivers. bugref:10762

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 6.1 KB
Line 
1; $Id: VBoxGuestAdditionsUninstall.nsh 106962 2024-11-12 14:44:38Z 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
29Function ${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"
37 Delete /REBOOTOK "$INSTDIR\VBoxGuestInstallHelper.exe"
38
39 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
40!ifdef VBOX_SIGN_ADDITIONS
41 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
42!endif
43
44!if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
45 Delete /REBOOTOK "$INSTDIR\${LICENSE_FILE_RTF}"
46!endif
47
48 Delete /REBOOTOK "$INSTDIR\VBoxGINA.dll"
49
50 ; Delete registry keys
51 DeleteRegKey /ifempty HKLM "${PRODUCT_INSTALL_KEY}"
52 DeleteRegKey /ifempty HKLM "${VENDOR_ROOT_KEY}"
53
54 ; Delete desktop & start menu entries
55 Delete "$DESKTOP\${PRODUCT_NAME}.lnk" ; Obsolete. We don't install a desktop link any more.
56 Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
57 Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.url"
58 Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" ; Old name. Changed to Website.url in r153663.
59 RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
60
61 ; Delete Guest Additions directory (only if completely empty)
62 RMDir /REBOOTOK "$INSTDIR"
63
64 ; Delete vendor installation directory (only if completely empty)
65!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
66 RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
67!else ; 64-bit
68 RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
69!endif
70
71 ; Remove registry entries
72 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
73
74FunctionEnd
75!macroend
76;!insertmacro UninstallCommon "" - only .un version used
77!insertmacro UninstallCommon "un."
78
79!macro Uninstall un
80Function ${un}Uninstall
81
82 ${LogVerbose} "Uninstalling system files ..."
83!ifdef _DEBUG
84 ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
85 ${LogVerbose} "System Directory: $g_strSystemDir"
86 ${LogVerbose} "Temp Directory: $TEMP"
87!endif
88
89 ; Create temp directory where we can store uninstallation logs.
90 CreateDirectory "$TEMP\${PRODUCT_NAME}"
91
92 ; Which OS are we using?
93!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
94 StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
95!endif
96 StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
97 StrCmp $g_strWinVersion "XP" w2k ; Windows XP
98 StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
99 StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
100 StrCmp $g_strWinVersion "7" vista ; Windows 7
101 StrCmp $g_strWinVersion "8" vista ; Windows 8
102 StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
103 StrCmp $g_strWinVersion "10" vista ; Windows 10
104
105 ${If} $g_bForceInstall == "true"
106 Goto vista ; Assume newer OS than we know of ...
107 ${EndIf}
108
109 Goto notsupported
110
111!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
112nt4:
113
114 Call ${un}NT4_Uninstall
115 goto common
116!endif
117
118w2k:
119
120 Call ${un}W2K_Uninstall
121 goto common
122
123vista:
124
125 Call ${un}W2K_Uninstall
126 Call ${un}Vista_Uninstall
127 goto common
128
129notsupported:
130
131 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
132 Goto exit
133
134common:
135
136exit:
137
138 ;
139 ; Dump UI log to on success too. Only works with non-silent installs.
140 ; (This has to be done here rather than in .onUninstSuccess, because by
141 ; then the log is no longer visible in the UI.)
142 ;
143 ${IfNot} ${Silent}
144 !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
145 VBoxGuestInstallHelper::DumpLog "$TEMP\vbox_uninstall_ui.log"
146 !else
147 StrCpy $0 "$TEMP\vbox_uninstall_ui.log"
148 Push $0
149 Call DumpLog
150 !endif
151 ${EndIf}
152
153FunctionEnd
154!macroend
155!ifndef UNINSTALLER_ONLY
156 !insertmacro Uninstall ""
157!endif
158!insertmacro Uninstall "un."
159
160;;
161; The last step of the uninstallation where we remove all files from the
162; install directory and such.
163;
164!macro UninstallInstDir un
165Function ${un}UninstallInstDir
166
167 ${LogVerbose} "Uninstalling directory ..."
168!ifdef _DEBUG
169 ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
170 ${LogVerbose} "System Directory: $g_strSystemDir"
171!endif
172
173 ; Which OS are we using?
174!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
175 StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
176!endif
177 StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
178 StrCmp $g_strWinVersion "XP" w2k ; Windows XP
179 StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
180 StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
181 StrCmp $g_strWinVersion "7" vista ; Windows 7
182 StrCmp $g_strWinVersion "8" vista ; Windows 8
183 StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
184 StrCmp $g_strWinVersion "10" vista ; Windows 10
185
186 ${If} $g_bForceInstall == "true"
187 Goto vista ; Assume newer OS than we know of ...
188 ${EndIf}
189
190 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
191 Goto exit
192
193!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
194nt4:
195
196 Call ${un}NT4_UninstallInstDir
197 goto common
198!endif
199
200w2k:
201
202 Call ${un}W2K_UninstallInstDir
203 goto common
204
205vista:
206
207 Call ${un}W2K_UninstallInstDir
208 Call ${un}Vista_UninstallInstDir
209 goto common
210
211common:
212
213 Call ${un}Common_CleanupObsoleteFiles
214
215 ; This will attempt remove the install dir, so must be last.
216 Call ${un}UninstallCommon
217
218exit:
219
220FunctionEnd
221!macroend
222;!insertmacro UninstallInstDir "" - only un. version is used.
223!insertmacro UninstallInstDir "un."
Note: See TracBrowser for help on using the repository browser.

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