1 | ; $Id$
|
---|
2 | ; @file
|
---|
3 | ; VBoxGuestAdditionsUninstall.nsh - Guest Additions uninstallation.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 |
|
---|
18 | !macro UninstallCommon un
|
---|
19 | Function ${un}UninstallCommon
|
---|
20 |
|
---|
21 | Delete /REBOOTOK "$INSTDIR\install*.log"
|
---|
22 | Delete /REBOOTOK "$INSTDIR\uninst.exe"
|
---|
23 | Delete /REBOOTOK "$INSTDIR\${PRODUCT_NAME}.url"
|
---|
24 |
|
---|
25 | ; Remove common files
|
---|
26 | Delete /REBOOTOK "$INSTDIR\VBoxDrvInst.exe"
|
---|
27 | Delete /REBOOTOK "$INSTDIR\DIFxAPI.dll"
|
---|
28 |
|
---|
29 | Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
|
---|
30 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
31 | Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
|
---|
32 | !endif
|
---|
33 |
|
---|
34 | !if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
|
---|
35 | Delete /REBOOTOK "$INSTDIR\${LICENSE_FILE_RTF}"
|
---|
36 | !endif
|
---|
37 |
|
---|
38 | Delete /REBOOTOK "$INSTDIR\VBoxGINA.dll"
|
---|
39 | Delete /REBOOTOK "$INSTDIR\iexplore.ico"
|
---|
40 |
|
---|
41 | ; Delete registry keys
|
---|
42 | DeleteRegKey /ifempty HKLM "${PRODUCT_INSTALL_KEY}"
|
---|
43 | DeleteRegKey /ifempty HKLM "${VENDOR_ROOT_KEY}"
|
---|
44 |
|
---|
45 | ; Delete desktop & start menu entries
|
---|
46 | Delete "$DESKTOP\${PRODUCT_NAME} Guest Additions.lnk"
|
---|
47 | Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Uninstall.lnk"
|
---|
48 | Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Website.lnk"
|
---|
49 | RMDIR "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions"
|
---|
50 |
|
---|
51 | ; Delete Guest Additions directory (only if completely empty)
|
---|
52 | RMDir /REBOOTOK "$INSTDIR"
|
---|
53 |
|
---|
54 | ; Delete vendor installation directory (only if completely empty)
|
---|
55 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
56 | RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
|
---|
57 | !else ; 64-bit
|
---|
58 | RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
|
---|
59 | !endif
|
---|
60 |
|
---|
61 | ; Remove registry entries
|
---|
62 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
---|
63 |
|
---|
64 | FunctionEnd
|
---|
65 | !macroend
|
---|
66 | !insertmacro UninstallCommon ""
|
---|
67 | !insertmacro UninstallCommon "un."
|
---|
68 |
|
---|
69 | !macro Uninstall un
|
---|
70 | Function ${un}Uninstall
|
---|
71 |
|
---|
72 | ${LogVerbose} "Uninstalling system files ..."
|
---|
73 | !ifdef _DEBUG
|
---|
74 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
75 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
76 | !endif
|
---|
77 |
|
---|
78 | ; Which OS are we using?
|
---|
79 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
80 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
81 | !endif
|
---|
82 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
83 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
84 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
85 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
86 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
87 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
88 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
89 |
|
---|
90 | ${If} $g_bForceInstall == "true"
|
---|
91 | Goto vista ; Assume newer OS than we know of ...
|
---|
92 | ${EndIf}
|
---|
93 |
|
---|
94 | Goto notsupported
|
---|
95 |
|
---|
96 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
97 | nt4:
|
---|
98 |
|
---|
99 | Call ${un}NT4_Uninstall
|
---|
100 | goto common
|
---|
101 | !endif
|
---|
102 |
|
---|
103 | w2k:
|
---|
104 |
|
---|
105 | Call ${un}W2K_Uninstall
|
---|
106 | goto common
|
---|
107 |
|
---|
108 | vista:
|
---|
109 |
|
---|
110 | Call ${un}W2K_Uninstall
|
---|
111 | Call ${un}Vista_Uninstall
|
---|
112 | goto common
|
---|
113 |
|
---|
114 | notsupported:
|
---|
115 |
|
---|
116 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
117 | Goto exit
|
---|
118 |
|
---|
119 | common:
|
---|
120 |
|
---|
121 | exit:
|
---|
122 |
|
---|
123 | FunctionEnd
|
---|
124 | !macroend
|
---|
125 | !insertmacro Uninstall ""
|
---|
126 | !insertmacro Uninstall "un."
|
---|
127 |
|
---|
128 | !macro UninstallInstDir un
|
---|
129 | Function ${un}UninstallInstDir
|
---|
130 |
|
---|
131 | ${LogVerbose} "Uninstalling directory ..."
|
---|
132 | !ifdef _DEBUG
|
---|
133 | ${LogVerbose} "Detected OS version: Windows $g_strWinVersion"
|
---|
134 | ${LogVerbose} "System Directory: $g_strSystemDir"
|
---|
135 | !endif
|
---|
136 |
|
---|
137 | ; Which OS are we using?
|
---|
138 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
139 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
140 | !endif
|
---|
141 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
142 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
143 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
144 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
145 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
146 | StrCmp $g_strWinVersion "8" vista ; Windows 8
|
---|
147 | StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows Server 2012 R2
|
---|
148 |
|
---|
149 | ${If} $g_bForceInstall == "true"
|
---|
150 | Goto vista ; Assume newer OS than we know of ...
|
---|
151 | ${EndIf}
|
---|
152 |
|
---|
153 | Goto notsupported
|
---|
154 |
|
---|
155 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
156 | nt4:
|
---|
157 |
|
---|
158 | Call ${un}NT4_UninstallInstDir
|
---|
159 | goto common
|
---|
160 | !endif
|
---|
161 |
|
---|
162 | w2k:
|
---|
163 |
|
---|
164 | Call ${un}W2K_UninstallInstDir
|
---|
165 | goto common
|
---|
166 |
|
---|
167 | vista:
|
---|
168 |
|
---|
169 | Call ${un}W2K_UninstallInstDir
|
---|
170 | Call ${un}Vista_UninstallInstDir
|
---|
171 | goto common
|
---|
172 |
|
---|
173 | notsupported:
|
---|
174 |
|
---|
175 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
176 | Goto exit
|
---|
177 |
|
---|
178 | common:
|
---|
179 |
|
---|
180 | Call ${un}UninstallCommon
|
---|
181 |
|
---|
182 | exit:
|
---|
183 |
|
---|
184 | FunctionEnd
|
---|
185 | !macroend
|
---|
186 | !insertmacro UninstallInstDir ""
|
---|
187 | !insertmacro UninstallInstDir "un."
|
---|