1 |
|
---|
2 | ; @todo Replace this crappy stuff with a "VBoxDrvInst /delnetprovider"
|
---|
3 | !macro RemoveFromProvider un
|
---|
4 | Function ${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 |
|
---|
37 | unRemoveFromPath_done:
|
---|
38 | Pop $6
|
---|
39 | Pop $5
|
---|
40 | Pop $4
|
---|
41 | Pop $3
|
---|
42 | Pop $2
|
---|
43 | Pop $1
|
---|
44 | Pop $0
|
---|
45 | FunctionEnd
|
---|
46 | !macroend
|
---|
47 | !insertmacro RemoveFromProvider ""
|
---|
48 | !insertmacro RemoveFromProvider "un."
|
---|
49 |
|
---|
50 | !macro RemoveProvider un
|
---|
51 | Function ${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
|
---|
62 | FunctionEnd
|
---|
63 | !macroend
|
---|
64 | !insertmacro RemoveProvider ""
|
---|
65 | !insertmacro RemoveProvider "un."
|
---|
66 |
|
---|
67 | !macro UninstallCommon un
|
---|
68 | Function ${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 | !ifdef VBOX_WITH_LICENSE_INSTALL_RTF
|
---|
83 | Delete /REBOOTOK "$INSTDIR\${LICENSE_FILE_RTF}"
|
---|
84 | !endif
|
---|
85 |
|
---|
86 | Delete /REBOOTOK "$INSTDIR\VBoxGINA.dll"
|
---|
87 | Delete /REBOOTOK "$INSTDIR\iexplore.ico"
|
---|
88 |
|
---|
89 | ; Delete registry keys
|
---|
90 | DeleteRegKey /ifempty HKLM "${PRODUCT_INSTALL_KEY}"
|
---|
91 | DeleteRegKey /ifempty HKLM "${VENDOR_ROOT_KEY}"
|
---|
92 |
|
---|
93 | ; Delete desktop & start menu entries
|
---|
94 | Delete "$DESKTOP\${PRODUCT_NAME} Guest Additions.lnk"
|
---|
95 | Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Uninstall.lnk"
|
---|
96 | Delete "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions\Website.lnk"
|
---|
97 | RMDIR "$SMPROGRAMS\${PRODUCT_NAME} Guest Additions"
|
---|
98 |
|
---|
99 | ; Delete Guest Additions directory (only if completely empty)
|
---|
100 | RMDir /REBOOTOK "$INSTDIR"
|
---|
101 |
|
---|
102 | ; Delete vendor installation directory (only if completely empty)
|
---|
103 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
104 | RMDir /REBOOTOK "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%"
|
---|
105 | !else ; 64-bit
|
---|
106 | RMDir /REBOOTOK "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%"
|
---|
107 | !endif
|
---|
108 |
|
---|
109 | ; Remove registry entries
|
---|
110 | DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
---|
111 |
|
---|
112 | FunctionEnd
|
---|
113 | !macroend
|
---|
114 | !insertmacro UninstallCommon ""
|
---|
115 | !insertmacro UninstallCommon "un."
|
---|
116 |
|
---|
117 | !macro Uninstall un
|
---|
118 | Function ${un}Uninstall
|
---|
119 |
|
---|
120 | DetailPrint "Uninstalling system files ..."
|
---|
121 | !ifdef _DEBUG
|
---|
122 | DetailPrint "Detected OS version: Windows $g_strWinVersion"
|
---|
123 | DetailPrint "System Directory: $g_strSystemDir"
|
---|
124 | !endif
|
---|
125 |
|
---|
126 | ; Which OS are we using?
|
---|
127 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
128 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
129 | !endif
|
---|
130 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
131 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
132 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
133 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
134 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
135 |
|
---|
136 | ${If} $g_bForceInstall == "true"
|
---|
137 | Goto vista ; Assume newer OS than we know of ...
|
---|
138 | ${EndIf}
|
---|
139 |
|
---|
140 | Goto notsupported
|
---|
141 |
|
---|
142 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
143 | nt4:
|
---|
144 |
|
---|
145 | Call ${un}NT_Uninstall
|
---|
146 | goto common
|
---|
147 | !endif
|
---|
148 |
|
---|
149 | w2k:
|
---|
150 |
|
---|
151 | Call ${un}W2K_Uninstall
|
---|
152 | goto common
|
---|
153 |
|
---|
154 | vista:
|
---|
155 |
|
---|
156 | Call ${un}W2K_Uninstall
|
---|
157 | Call ${un}Vista_Uninstall
|
---|
158 | goto common
|
---|
159 |
|
---|
160 | notsupported:
|
---|
161 |
|
---|
162 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
163 | Goto exit
|
---|
164 |
|
---|
165 | common:
|
---|
166 |
|
---|
167 | exit:
|
---|
168 |
|
---|
169 | FunctionEnd
|
---|
170 | !macroend
|
---|
171 | !insertmacro Uninstall ""
|
---|
172 | !insertmacro Uninstall "un."
|
---|
173 |
|
---|
174 | !macro UninstallInstDir un
|
---|
175 | Function ${un}UninstallInstDir
|
---|
176 |
|
---|
177 | DetailPrint "Uninstalling directory ..."
|
---|
178 | !ifdef _DEBUG
|
---|
179 | DetailPrint "Detected OS version: Windows $g_strWinVersion"
|
---|
180 | DetailPrint "System Directory: $g_strSystemDir"
|
---|
181 | !endif
|
---|
182 |
|
---|
183 | ; Which OS are we using?
|
---|
184 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
185 | StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
|
---|
186 | !endif
|
---|
187 | StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
|
---|
188 | StrCmp $g_strWinVersion "XP" w2k ; Windows XP
|
---|
189 | StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
|
---|
190 | StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
|
---|
191 | StrCmp $g_strWinVersion "7" vista ; Windows 7
|
---|
192 |
|
---|
193 | ${If} $g_bForceInstall == "true"
|
---|
194 | Goto vista ; Assume newer OS than we know of ...
|
---|
195 | ${EndIf}
|
---|
196 |
|
---|
197 | Goto notsupported
|
---|
198 |
|
---|
199 | !if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
|
---|
200 | nt4:
|
---|
201 |
|
---|
202 | Call ${un}NT_UninstallInstDir
|
---|
203 | goto common
|
---|
204 | !endif
|
---|
205 |
|
---|
206 | w2k:
|
---|
207 |
|
---|
208 | Call ${un}W2K_UninstallInstDir
|
---|
209 | goto common
|
---|
210 |
|
---|
211 | vista:
|
---|
212 |
|
---|
213 | Call ${un}W2K_UninstallInstDir
|
---|
214 | Call ${un}Vista_UninstallInstDir
|
---|
215 | goto common
|
---|
216 |
|
---|
217 | notsupported:
|
---|
218 |
|
---|
219 | MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
|
---|
220 | Goto exit
|
---|
221 |
|
---|
222 | common:
|
---|
223 |
|
---|
224 | Call ${un}UninstallCommon
|
---|
225 |
|
---|
226 | exit:
|
---|
227 |
|
---|
228 | FunctionEnd
|
---|
229 | !macroend
|
---|
230 | !insertmacro UninstallInstDir ""
|
---|
231 | !insertmacro UninstallInstDir "un."
|
---|