VirtualBox

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

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

Windows Additions: export shared folders and installer to OSE

File size: 4.8 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 DetailPrint "Handled Windows version: $g_strWinVersion"
118 DetailPrint "System Directory: $g_strSystemDir"
119
120 ; Which OS are we using?
121!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
122 StrCmp $g_strWinVersion "nt4" nt4
123!endif
124 StrCmp $g_strWinVersion "2k" w2k
125 StrCmp $g_strWinVersion "vista" vista
126
127 Goto notsupported
128
129!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
130nt4:
131
132 Call ${un}NT_Uninstall
133 goto common
134!endif
135
136w2k:
137
138 Call ${un}W2K_Uninstall
139 goto common
140
141vista:
142
143 Call ${un}W2K_Uninstall
144 Call ${un}Vista_Uninstall
145 goto common
146
147notsupported:
148
149 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
150 Goto exit
151
152common:
153
154exit:
155
156FunctionEnd
157!macroend
158!insertmacro Uninstall ""
159!insertmacro Uninstall "un."
160
161!macro UninstallInstDir un
162Function ${un}UninstallInstDir
163
164 DetailPrint "Uninstalling directory ..."
165 DetailPrint "Handled Windows version: $g_strWinVersion"
166 DetailPrint "System Directory: $g_strSystemDir"
167
168 ; Which OS are we using?
169!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
170 StrCmp $g_strWinVersion "nt4" nt4
171!endif
172 StrCmp $g_strWinVersion "2k" w2k
173 StrCmp $g_strWinVersion "vista" vista
174
175 Goto notsupported
176
177!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
178nt4:
179
180 Call ${un}NT_UninstallInstDir
181 goto common
182!endif
183
184w2k:
185
186 Call ${un}W2K_UninstallInstDir
187 goto common
188
189vista:
190
191 Call ${un}W2K_UninstallInstDir
192 Call ${un}Vista_UninstallInstDir
193 goto common
194
195notsupported:
196
197 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
198 Goto exit
199
200common:
201
202 Call ${un}UninstallCommon
203
204exit:
205
206FunctionEnd
207!macroend
208!insertmacro UninstallInstDir ""
209!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