VirtualBox

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

Last change on this file since 34079 was 32503, checked in by vboxsync, 14 years ago

Windows Guest Additions installer:

  • Added a "/force" command line parameter for forcing the installation on (yet) unknown Windows versions.
  • Include build number in GUI version information.
  • Simplified internal OS version naming.
  • Fixed D3D denial on NT4.
File size: 5.5 KB
Line 
1
2; @todo Replace this crappy stuff with a "VBoxDrvInst /delnetprovider".
3!macro RemoveFromProvider un
4Function ${un}RemoveFromProvider
5 Exch $0
6 Push $1
7 Push $2
8 Push $3
9 Push $4
10 Push $5
11 Push $6
12
13 ReadRegStr $1 HKLM "$R0" "ProviderOrder"
14 StrCpy $5 $1 1 -1 # copy last char
15 StrCmp $5 "," +2 # if last char != ,
16 StrCpy $1 "$1," # append ,
17 Push $1
18 Push "$0,"
19 Call ${un}StrStr ; Find `$0,` in $1
20 Pop $2 ; pos of our dir
21 StrCmp $2 "" unRemoveFromPath_done
22 ; else, it is in path
23 # $0 - path to add
24 # $1 - path var
25 StrLen $3 "$0,"
26 StrLen $4 $2
27 StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
28 StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
29 StrCpy $3 $5$6
30
31 StrCpy $5 $3 1 -1 # copy last char
32 StrCmp $5 "," 0 +2 # if last char == ,
33 StrCpy $3 $3 -1 # remove last char
34
35 WriteRegStr HKLM "$R0" "ProviderOrder" $3
36
37unRemoveFromPath_done:
38 Pop $6
39 Pop $5
40 Pop $4
41 Pop $3
42 Pop $2
43 Pop $1
44 Pop $0
45FunctionEnd
46!macroend
47!insertmacro RemoveFromProvider ""
48!insertmacro RemoveFromProvider "un."
49
50!macro RemoveProvider un
51Function ${un}RemoveProvider
52 Push $R0
53 StrCpy $R0 "VBoxSF"
54 Push $R0
55 StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\HWOrder"
56 Call ${un}RemoveFromProvider
57 StrCpy $R0 "VBoxSF"
58 Push $R0
59 StrCpy $R0 "SYSTEM\CurrentControlSet\Control\NetworkProvider\Order"
60 Call ${un}RemoveFromProvider
61 Pop $R0
62FunctionEnd
63!macroend
64!insertmacro RemoveProvider ""
65!insertmacro RemoveProvider "un."
66
67!macro UninstallCommon un
68Function ${un}UninstallCommon
69
70 Delete /REBOOTOK "$INSTDIR\install.log"
71 Delete /REBOOTOK "$INSTDIR\uninst.exe"
72 Delete /REBOOTOK "$INSTDIR\${PRODUCT_NAME}.url"
73
74 ; Remove common files
75 Delete /REBOOTOK "$INSTDIR\VBoxDrvInst.exe"
76
77 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
78!ifdef VBOX_SIGN_ADDITIONS
79 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
80!endif
81
82 Delete /REBOOTOK "$INSTDIR\VBoxGINA.dll"
83 Delete /REBOOTOK "$INSTDIR\iexplore.ico"
84
85 ; Delete registry keys
86 DeleteRegKey /ifempty HKLM "${PRODUCT_INSTALL_KEY}"
87 DeleteRegKey /ifempty HKLM "${VENDOR_ROOT_KEY}"
88
89 ; Delete desktop & start menu entries
90 Delete "$DESKTOP\${PRODUCT_NAME} Guest Additions.lnk"
91 Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Uninstall.lnk"
92 Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Website.lnk"
93 RMDIR "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions"
94
95 ; Delete Guest Additions directory (only if completely empty)
96 RMDir /REBOOTOK "$INSTDIR"
97
98 ; Delete vendor installation directory (only if completely empty)
99!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
100 RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
101!else ; 64-bit
102 RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
103!endif
104
105 ; Remove registry entries
106 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
107
108FunctionEnd
109!macroend
110!insertmacro UninstallCommon ""
111!insertmacro UninstallCommon "un."
112
113!macro Uninstall un
114Function ${un}Uninstall
115
116 DetailPrint "Uninstalling system files ..."
117!ifdef _DEBUG
118 DetailPrint "Detected OS version: Windows $g_strWinVersion"
119 DetailPrint "System Directory: $g_strSystemDir"
120!endif
121
122 ; Which OS are we using?
123!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
124 StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
125!endif
126 StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
127 StrCmp $g_strWinVersion "XP" w2k ; Windows XP
128 StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
129 StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
130 StrCmp $g_strWinVersion "7" vista ; Windows 7
131
132 ${If} $g_bForceInstall == "true"
133 Goto vista ; Assume newer OS than we know of ...
134 ${EndIf}
135
136 Goto notsupported
137
138!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
139nt4:
140
141 Call ${un}NT_Uninstall
142 goto common
143!endif
144
145w2k:
146
147 Call ${un}W2K_Uninstall
148 goto common
149
150vista:
151
152 Call ${un}W2K_Uninstall
153 Call ${un}Vista_Uninstall
154 goto common
155
156notsupported:
157
158 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
159 Goto exit
160
161common:
162
163exit:
164
165FunctionEnd
166!macroend
167!insertmacro Uninstall ""
168!insertmacro Uninstall "un."
169
170!macro UninstallInstDir un
171Function ${un}UninstallInstDir
172
173 DetailPrint "Uninstalling directory ..."
174!ifdef _DEBUG
175 DetailPrint "Detected OS version: Windows $g_strWinVersion"
176 DetailPrint "System Directory: $g_strSystemDir"
177!endif
178
179 ; Which OS are we using?
180!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
181 StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
182!endif
183 StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
184 StrCmp $g_strWinVersion "XP" w2k ; Windows XP
185 StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
186 StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
187 StrCmp $g_strWinVersion "7" vista ; Windows 7
188
189 ${If} $g_bForceInstall == "true"
190 Goto vista ; Assume newer OS than we know of ...
191 ${EndIf}
192
193 Goto notsupported
194
195!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
196nt4:
197
198 Call ${un}NT_UninstallInstDir
199 goto common
200!endif
201
202w2k:
203
204 Call ${un}W2K_UninstallInstDir
205 goto common
206
207vista:
208
209 Call ${un}W2K_UninstallInstDir
210 Call ${un}Vista_UninstallInstDir
211 goto common
212
213notsupported:
214
215 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
216 Goto exit
217
218common:
219
220 Call ${un}UninstallCommon
221
222exit:
223
224FunctionEnd
225!macroend
226!insertmacro UninstallInstDir ""
227!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