VirtualBox

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

Last change on this file since 96697 was 96694, checked in by vboxsync, 21 months ago

Add/Nt/Installer: Reduce the number of warnings to almost none.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 5.2 KB
Line 
1; $Id: VBoxGuestAdditionsUninstall.nsh 96694 2022-09-12 09:40:40Z vboxsync $
2;; @file
3; VBoxGuestAdditionsUninstall.nsh - Guest Additions uninstallation.
4;
5
6;
7; Copyright (C) 2006-2022 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\DIFxAPI.dll"
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 Delete /REBOOTOK "$INSTDIR\iexplore.ico"
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} Guest Additions.lnk"
57 Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Uninstall.lnk"
58 Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Website.lnk"
59 RMDIR "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions"
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!endif
87
88 ; Which OS are we using?
89!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
90 StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
91!endif
92 StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
93 StrCmp $g_strWinVersion "XP" w2k ; Windows XP
94 StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
95 StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
96 StrCmp $g_strWinVersion "7" vista ; Windows 7
97 StrCmp $g_strWinVersion "8" vista ; Windows 8
98 StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
99 StrCmp $g_strWinVersion "10" vista ; Windows 10
100
101 ${If} $g_bForceInstall == "true"
102 Goto vista ; Assume newer OS than we know of ...
103 ${EndIf}
104
105 Goto notsupported
106
107!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
108nt4:
109
110 Call ${un}NT4_Uninstall
111 goto common
112!endif
113
114w2k:
115
116 Call ${un}W2K_Uninstall
117 goto common
118
119vista:
120
121 Call ${un}W2K_Uninstall
122 Call ${un}Vista_Uninstall
123 goto common
124
125notsupported:
126
127 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
128 Goto exit
129
130common:
131
132exit:
133
134FunctionEnd
135!macroend
136!ifndef UNINSTALLER_ONLY
137 !insertmacro Uninstall ""
138!endif
139!insertmacro Uninstall "un."
140
141!macro UninstallInstDir un
142Function ${un}UninstallInstDir
143
144 ${LogVerbose} "Uninstalling directory ..."
145!ifdef _DEBUG
146 ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
147 ${LogVerbose} "System Directory: $g_strSystemDir"
148!endif
149
150 ; Which OS are we using?
151!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
152 StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
153!endif
154 StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
155 StrCmp $g_strWinVersion "XP" w2k ; Windows XP
156 StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
157 StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
158 StrCmp $g_strWinVersion "7" vista ; Windows 7
159 StrCmp $g_strWinVersion "8" vista ; Windows 8
160 StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
161 StrCmp $g_strWinVersion "10" vista ; Windows 10
162
163 ${If} $g_bForceInstall == "true"
164 Goto vista ; Assume newer OS than we know of ...
165 ${EndIf}
166
167 Goto notsupported
168
169!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
170nt4:
171
172 Call ${un}NT4_UninstallInstDir
173 goto common
174!endif
175
176w2k:
177
178 Call ${un}W2K_UninstallInstDir
179 goto common
180
181vista:
182
183 Call ${un}W2K_UninstallInstDir
184 Call ${un}Vista_UninstallInstDir
185 goto common
186
187notsupported:
188
189 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
190 Goto exit
191
192common:
193
194 Call ${un}UninstallCommon
195
196exit:
197
198FunctionEnd
199!macroend
200;!insertmacro UninstallInstDir "" - only un. version is used.
201!insertmacro UninstallInstDir "un."
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use