1 | ;*
|
---|
2 | ;* @file
|
---|
3 | ;* VBoxGuestAdditionsUninstall.nsh - Guest Additions uninstallation.
|
---|
4 | ;*
|
---|
5 |
|
---|
6 | ;*
|
---|
7 | ;* Copyright (C) 2011 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 | DetailPrint "Uninstalling system files ..."
|
---|
73 | !ifdef _DEBUG
|
---|
74 | DetailPrint "Detected OS version: Windows $g_strWinVersion"
|
---|
75 | DetailPrint "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 |
|
---|
88 | ${If} $g_bForceInstall == "true"
|
---|
89 | Goto vista ; Assume newer OS than we know of ...
|
---|
90 | ${EndIf}
|
---|
91 |
|
---|
92 | Goto notsupported
|
---|
93 |
|
---|
94 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
95 | nt4:
|
---|
96 |
|
---|
97 | Call ${un}NT4_Uninstall
|
---|
98 | goto common
|
---|
99 | !endif
|
---|
100 |
|
---|
101 | w2k:
|
---|
102 |
|
---|
103 | Call ${un}W2K_Uninstall
|
---|
104 | goto common
|
---|
105 |
|
---|
106 | vista:
|
---|
107 |
|
---|
108 | Call ${un}W2K_Uninstall
|
---|
109 | Call ${un}Vista_Uninstall
|
---|
110 | goto common
|
---|
111 |
|
---|
112 | notsupported:
|
---|
113 |
|
---|
114 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
115 | Goto exit
|
---|
116 |
|
---|
117 | common:
|
---|
118 |
|
---|
119 | exit:
|
---|
120 |
|
---|
121 | FunctionEnd
|
---|
122 | !macroend
|
---|
123 | !insertmacro Uninstall ""
|
---|
124 | !insertmacro Uninstall "un."
|
---|
125 |
|
---|
126 | !macro UninstallInstDir un
|
---|
127 | Function ${un}UninstallInstDir
|
---|
128 |
|
---|
129 | DetailPrint "Uninstalling directory ..."
|
---|
130 | !ifdef _DEBUG
|
---|
131 | DetailPrint "Detected OS version: Windows $g_strWinVersion"
|
---|
132 | DetailPrint "System Directory: $g_strSystemDir"
|
---|
133 | !endif
|
---|
134 |
|
---|
135 | ; Which OS are we using?
|
---|
136 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
137 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
138 | !endif
|
---|
139 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
140 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
141 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
142 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
143 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
144 |
|
---|
145 | ${If} $g_bForceInstall == "true"
|
---|
146 | Goto vista ; Assume newer OS than we know of ...
|
---|
147 | ${EndIf}
|
---|
148 |
|
---|
149 | Goto notsupported
|
---|
150 |
|
---|
151 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
152 | nt4:
|
---|
153 |
|
---|
154 | Call ${un}NT4_UninstallInstDir
|
---|
155 | goto common
|
---|
156 | !endif
|
---|
157 |
|
---|
158 | w2k:
|
---|
159 |
|
---|
160 | Call ${un}W2K_UninstallInstDir
|
---|
161 | goto common
|
---|
162 |
|
---|
163 | vista:
|
---|
164 |
|
---|
165 | Call ${un}W2K_UninstallInstDir
|
---|
166 | Call ${un}Vista_UninstallInstDir
|
---|
167 | goto common
|
---|
168 |
|
---|
169 | notsupported:
|
---|
170 |
|
---|
171 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
172 | Goto exit
|
---|
173 |
|
---|
174 | common:
|
---|
175 |
|
---|
176 | Call ${un}UninstallCommon
|
---|
177 |
|
---|
178 | exit:
|
---|
179 |
|
---|
180 | FunctionEnd
|
---|
181 | !macroend
|
---|
182 | !insertmacro UninstallInstDir ""
|
---|
183 | !insertmacro UninstallInstDir "un."
|
---|