1 | ; $Id: VBoxGuestAdditionsCommon.nsh 108936 2025-04-10 18:43:11Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; VBoxGuestAdditionsCommon.nsh - Common / shared utility functions.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | ;
|
---|
27 |
|
---|
28 |
|
---|
29 | ;;
|
---|
30 | ; Macro which emits an OS selection switch.
|
---|
31 | ;
|
---|
32 | ; Input:
|
---|
33 | ; None
|
---|
34 | ; Output:
|
---|
35 | ; None
|
---|
36 | ;
|
---|
37 | ; The following labels must be implemented by the caller:
|
---|
38 | ; - osselswitch_case_w2k_xp_w2k3
|
---|
39 | ; - osselswitch_case_vista_and_later
|
---|
40 | ; - osselswitch_case_nt4 (x86 only)
|
---|
41 | ; - osselswitch_case_unsupported
|
---|
42 | ;
|
---|
43 | ; Note: When adding new OS support, this is the place to add it.
|
---|
44 | ; Used for installation and uninstallation routines.
|
---|
45 | ;
|
---|
46 | !macro Common_EmitOSSelectionSwitch
|
---|
47 | ${If} "$g_strWinVersion" == "2000"
|
---|
48 | ${OrIf} "$g_strWinVersion" == "XP"
|
---|
49 | ${OrIf} "$g_strWinVersion" == "203"
|
---|
50 | goto osselswitch_case_w2k_xp_w2k3
|
---|
51 | ${ElseIf} "$g_strWinVersion" == "2000"
|
---|
52 | ${OrIf} "$g_strWinVersion" == "Vista"
|
---|
53 | ${OrIf} "$g_strWinVersion" == "7"
|
---|
54 | ${OrIf} "$g_strWinVersion" == "8"
|
---|
55 | ${OrIf} "$g_strWinVersion" == "8_1"
|
---|
56 | ${OrIf} "$g_strWinVersion" == "10"
|
---|
57 | goto osselswitch_case_vista_and_later
|
---|
58 | !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit only.
|
---|
59 | ${ElseIf} "$g_strWinVersion" == "NT4"
|
---|
60 | goto osselswitch_case_nt4
|
---|
61 | !endif
|
---|
62 | ${Else}
|
---|
63 | goto osselswitch_case_unsupported
|
---|
64 | ${EndIf}
|
---|
65 | !macroend
|
---|
66 |
|
---|
67 |
|
---|
68 | ;;
|
---|
69 | ; Extracts all files to $INSTDIR.
|
---|
70 | ;
|
---|
71 | ; Input:
|
---|
72 | ; None
|
---|
73 | ; Output:
|
---|
74 | ; None
|
---|
75 | ;
|
---|
76 | ; Note: This is a worker function for the actual installation process to extract all required
|
---|
77 | ; files beforehand into $INSTDIR before the actual (driver) installation, as well as
|
---|
78 | ; when only extracting the installer files into a directory (via /extract).
|
---|
79 | ;
|
---|
80 | Function Common_ExtractFiles
|
---|
81 |
|
---|
82 | SetOutPath "$INSTDIR"
|
---|
83 | SetOverwrite on
|
---|
84 |
|
---|
85 | ${LogVerbose} "Extracting files to: $INSTDIR"
|
---|
86 |
|
---|
87 | !ifdef VBOX_WITH_LICENSE_INSTALL_RTF
|
---|
88 | ; Copy license file (if any) into the installation directory.
|
---|
89 | FILE "/oname=${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
90 | !endif
|
---|
91 |
|
---|
92 | ;
|
---|
93 | ; Guest driver
|
---|
94 | ;
|
---|
95 | SetOutPath "$INSTDIR\VBoxGuest"
|
---|
96 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
|
---|
97 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
|
---|
98 | FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
|
---|
99 | FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
|
---|
100 | FILE "$%PATH_OUT%\bin\additions\VBoxHook.dll"
|
---|
101 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
102 | ${If} $g_strEarlyNTDrvInfix != ""
|
---|
103 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestEarlyNT.inf"
|
---|
104 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
105 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestEarlyNT.cat"
|
---|
106 | !endif
|
---|
107 | ${EndIf}
|
---|
108 | !endif
|
---|
109 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
110 | !if $%KBUILD_TARGET_ARCH% == "arm64"
|
---|
111 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
|
---|
112 | !else
|
---|
113 | ${If} $g_strWinVersion == "10"
|
---|
114 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
|
---|
115 | ${Else}
|
---|
116 | FILE "/oname=VBoxGuest.cat" "$%PATH_OUT%\bin\additions\VBoxGuest-PreW10.cat"
|
---|
117 | ${EndIf}
|
---|
118 | !endif
|
---|
119 | !endif
|
---|
120 |
|
---|
121 | ;
|
---|
122 | ; Mouse driver
|
---|
123 | ;
|
---|
124 | SetOutPath "$INSTDIR\VBoxMouse"
|
---|
125 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
|
---|
126 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
|
---|
127 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
128 | !if $%KBUILD_TARGET_ARCH% == "arm64"
|
---|
129 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
|
---|
130 | !else
|
---|
131 | ${If} $g_strWinVersion == "10"
|
---|
132 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
|
---|
133 | ${Else}
|
---|
134 | FILE "/oname=VBoxMouse.cat" "$%PATH_OUT%\bin\additions\VBoxMouse-PreW10.cat"
|
---|
135 | ${EndIf}
|
---|
136 | !endif
|
---|
137 | !endif
|
---|
138 |
|
---|
139 | ;
|
---|
140 | ; VBoxVideo driver
|
---|
141 | ;
|
---|
142 | !if $%KBUILD_TARGET_ARCH% != "arm64" ;; @todo win.arm64: Make VBoxVideo and friends build on arm.
|
---|
143 | SetOutPath "$INSTDIR\VBoxVideo"
|
---|
144 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
|
---|
145 | FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
|
---|
146 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
|
---|
147 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
148 | ${If} $g_strEarlyNTDrvInfix != ""
|
---|
149 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoEarlyNT.inf"
|
---|
150 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
151 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoEarlyNT.cat"
|
---|
152 | !endif
|
---|
153 | ${EndIf}
|
---|
154 | !endif ; $%KBUILD_TARGET_ARCH% == "x86"
|
---|
155 | !endif ; $%KBUILD_TARGET_ARCH% != "arm64"
|
---|
156 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
157 | !if $%KBUILD_TARGET_ARCH% != "arm64" ;; @todo win.arm64: Ditto.
|
---|
158 | ${If} $g_strWinVersion == "10"
|
---|
159 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
|
---|
160 | ${Else}
|
---|
161 | FILE "/oname=VBoxVideo.cat" "$%PATH_OUT%\bin\additions\VBoxVideo-PreW10.cat"
|
---|
162 | ${EndIf}
|
---|
163 | !endif
|
---|
164 | !endif ; VBOX_SIGN_ADDITIONS
|
---|
165 |
|
---|
166 | ;
|
---|
167 | ; VBoxWddm driver
|
---|
168 | ;
|
---|
169 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
170 | ${If} $g_bWithWDDM == "true"
|
---|
171 | ${OrIf} $g_bOnlyExtract == "true"
|
---|
172 | ; WDDM Video driver
|
---|
173 | SetOutPath "$INSTDIR\VBoxWddm"
|
---|
174 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
175 | !if $%KBUILD_TARGET_ARCH% == "arm64"
|
---|
176 | FILE "$%PATH_OUT%\bin\additions\VBoxWddm.cat"
|
---|
177 | !else
|
---|
178 | ${If} $g_strWinVersion == "10"
|
---|
179 | FILE "$%PATH_OUT%\bin\additions\VBoxWddm.cat"
|
---|
180 | ${Else}
|
---|
181 | FILE "/oname=VBoxWddm.cat" "$%PATH_OUT%\bin\additions\VBoxWddm-PreW10.cat"
|
---|
182 | ${EndIf}
|
---|
183 | !endif
|
---|
184 | !endif
|
---|
185 | FILE "$%PATH_OUT%\bin\additions\VBoxWddm.sys"
|
---|
186 | FILE "$%PATH_OUT%\bin\additions\VBoxWddm.inf"
|
---|
187 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
|
---|
188 | !if $%VBOX_WITH_WDDM_DX% == "1"
|
---|
189 | FILE "$%PATH_OUT%\bin\additions\VBoxDX.dll"
|
---|
190 | !endif
|
---|
191 | !if $%VBOX_WITH_MESA3D% == "1"
|
---|
192 | FILE "$%PATH_OUT%\bin\additions\VBoxNine.dll"
|
---|
193 | FILE "$%PATH_OUT%\bin\additions\VBoxSVGA.dll"
|
---|
194 | FILE "$%PATH_OUT%\bin\additions\VBoxGL.dll"
|
---|
195 | !endif
|
---|
196 |
|
---|
197 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
198 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
|
---|
199 | !if $%VBOX_WITH_WDDM_DX% == "1"
|
---|
200 | FILE "$%PATH_OUT%\bin\additions\VBoxDX-x86.dll"
|
---|
201 | !endif
|
---|
202 | !if $%VBOX_WITH_MESA3D% == "1"
|
---|
203 | FILE "$%PATH_OUT%\bin\additions\VBoxNine-x86.dll"
|
---|
204 | FILE "$%PATH_OUT%\bin\additions\VBoxSVGA-x86.dll"
|
---|
205 | FILE "$%PATH_OUT%\bin\additions\VBoxGL-x86.dll"
|
---|
206 | !endif
|
---|
207 | !endif ; $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
208 | ${EndIf} ; $g_bWithWDDM == "true"
|
---|
209 | !endif ; $%VBOX_WITH_WDDM% == "1"
|
---|
210 |
|
---|
211 | ;
|
---|
212 | ; Shared Folders driver
|
---|
213 | ;
|
---|
214 | ${If} $g_strWinVersion <> "NT4" ; Only available for > NT4.
|
---|
215 | ${OrIf} $g_bOnlyExtract == "true"
|
---|
216 | SetOutPath "$INSTDIR\VBoxSF"
|
---|
217 | FILE "$%PATH_OUT%\bin\additions\VBoxSF.sys"
|
---|
218 | !if $%KBUILD_TARGET_ARCH% == "x86"
|
---|
219 | FILE "$%PATH_OUT%\bin\additions\VBoxSFW2K.sys"
|
---|
220 | !endif
|
---|
221 | FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll"
|
---|
222 | !if $%KBUILD_TARGET_ARCH% == "amd64" ; Not available on arm64.
|
---|
223 | FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll"
|
---|
224 | !endif
|
---|
225 | ${EndIf}
|
---|
226 |
|
---|
227 | ;
|
---|
228 | ; Credential providers
|
---|
229 | ;
|
---|
230 | SetOutPath "$INSTDIR\AutoLogon"
|
---|
231 | FILE "$%PATH_OUT%\bin\additions\VBoxGINA.dll"
|
---|
232 | FILE "$%PATH_OUT%\bin\additions\VBoxCredProv.dll"
|
---|
233 |
|
---|
234 | ;
|
---|
235 | ; Certificate stuff
|
---|
236 | ;
|
---|
237 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
238 | ${If} $g_strWinVersion <> "NT4" ; Only required for > NT4.
|
---|
239 | ${OrIf} $g_bOnlyExtract == "true"
|
---|
240 | SetOutPath "$INSTDIR\Cert"
|
---|
241 | FILE "$%PATH_OUT%\bin\additions\VBoxCertUtil.exe"
|
---|
242 | AccessControl::SetOnFile "$INSTDIR\Cert\VBoxCertUtil.exe" "(BU)" "GenericRead"
|
---|
243 | ${Endif}
|
---|
244 | !endif
|
---|
245 |
|
---|
246 | ;
|
---|
247 | ; Misc binaries
|
---|
248 | ;
|
---|
249 | SetOutPath "$INSTDIR\Bin"
|
---|
250 | ; Technically not needed, as VBoxService gets installed into System32, but
|
---|
251 | ; keep it in the installation directory as well for completeness.
|
---|
252 | FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
|
---|
253 | AccessControl::SetOnFile "$INSTDIR\Bin\VBoxService.exe" "(BU)" "GenericRead"
|
---|
254 |
|
---|
255 | ;
|
---|
256 | ; Tools
|
---|
257 | ;
|
---|
258 | SetOutPath "$INSTDIR\Tools"
|
---|
259 | ${If} $g_strWinVersion <> "NT4" ; VBoxDrvInst only works with > NT4.
|
---|
260 | FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
|
---|
261 | AccessControl::SetOnFile "$INSTDIR\VBoxDrvInst.exe" "(BU)" "GenericRead"
|
---|
262 | ${EndIf}
|
---|
263 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestInstallHelper.exe"
|
---|
264 | AccessControl::SetOnFile "$INSTDIR\VBoxGuestInstallHelper.exe" "(BU)" "GenericRead"
|
---|
265 | !ifdef VBOX_WITH_ADDITIONS_SHIPPING_AUDIO_TEST
|
---|
266 | FILE "$%PATH_OUT%\bin\additions\VBoxAudioTest.exe"
|
---|
267 | AccessControl::SetOnFile "$INSTDIR\VBoxAudioTest.exe" "(BU)" "GenericRead"
|
---|
268 | !endif
|
---|
269 |
|
---|
270 | FunctionEnd
|
---|
271 |
|
---|
272 |
|
---|
273 | ;;
|
---|
274 | ; Macro for retrieving the Windows version this installer is running on.
|
---|
275 | ;
|
---|
276 | ; @return Stack: Windows version string. Empty on error /
|
---|
277 | ; if not able to identify.
|
---|
278 | ;
|
---|
279 | !macro GetWindowsVersionEx un
|
---|
280 | Function ${un}GetWindowsVersionEx
|
---|
281 |
|
---|
282 | Push $0
|
---|
283 | Push $1
|
---|
284 |
|
---|
285 | ; Check if we are running on Windows 2000 or above.
|
---|
286 | ; For other windows versions (> XP) it may be necessary to change winver.nsh.
|
---|
287 | Call ${un}GetWindowsVersion
|
---|
288 | Pop $0 ; Windows Version.
|
---|
289 |
|
---|
290 | Push $0 ; The windows version string.
|
---|
291 | Push "NT" ; String to search for. W2K+ returns no string containing "NT".
|
---|
292 | Call ${un}StrStr
|
---|
293 | Pop $1
|
---|
294 |
|
---|
295 | ${If} $1 == "" ; If empty -> not NT 3.XX or 4.XX.
|
---|
296 | ; $0 contains the original version string.
|
---|
297 | ${Else}
|
---|
298 | ; Ok we know it is NT. Must be a string like NT X.XX.
|
---|
299 | Push $0 ; The windows version string.
|
---|
300 | Push "4." ; String to search for.
|
---|
301 | Call ${un}StrStr
|
---|
302 | Pop $1
|
---|
303 | ${If} $1 == "" ; If empty -> not NT 4.
|
---|
304 | ;; @todo NT <= 3.x ?
|
---|
305 | ; $0 contains the original version string.
|
---|
306 | ${Else}
|
---|
307 | StrCpy $0 "NT4"
|
---|
308 | ${EndIf}
|
---|
309 | ${EndIf}
|
---|
310 |
|
---|
311 | Pop $1
|
---|
312 | Exch $0
|
---|
313 |
|
---|
314 | FunctionEnd
|
---|
315 | !macroend
|
---|
316 | !ifndef UNINSTALLER_ONLY
|
---|
317 | !insertmacro GetWindowsVersionEx ""
|
---|
318 | !endif
|
---|
319 | !insertmacro GetWindowsVersionEx "un."
|
---|
320 |
|
---|
321 |
|
---|
322 | !ifndef UNINSTALLER_ONLY
|
---|
323 | !macro GetAdditionsVersion un
|
---|
324 | ;;
|
---|
325 | ; Retrieves the installed Guest Additions version.
|
---|
326 | ;
|
---|
327 | ; Input:
|
---|
328 | ; None
|
---|
329 | ; Output:
|
---|
330 | ; Will store the results in $g_strAddVerMaj, $g_strAddVerMin, $g_strAddVerBuild.
|
---|
331 | ;
|
---|
332 | Function ${un}GetAdditionsVersion
|
---|
333 |
|
---|
334 | Push $0
|
---|
335 | Push $1
|
---|
336 |
|
---|
337 | ; Get additions version.
|
---|
338 | ReadRegStr $0 HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "Version"
|
---|
339 |
|
---|
340 | ; Get revision.
|
---|
341 | ReadRegStr $g_strAddVerRev HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "Revision"
|
---|
342 |
|
---|
343 | ; Extract major version.
|
---|
344 | Push "$0" ; String
|
---|
345 | Push "." ; SubString
|
---|
346 | Push ">" ; SearchDirection
|
---|
347 | Push "<" ; StrInclusionDirection
|
---|
348 | Push "0" ; IncludeSubString
|
---|
349 | Push "0" ; Loops
|
---|
350 | Push "0" ; CaseSensitive
|
---|
351 | Call ${un}StrStrAdv
|
---|
352 | Pop $g_strAddVerMaj
|
---|
353 |
|
---|
354 | ; Extract minor version.
|
---|
355 | Push "$0" ; String
|
---|
356 | Push "." ; SubString
|
---|
357 | Push ">" ; SearchDirection
|
---|
358 | Push ">" ; StrInclusionDirection
|
---|
359 | Push "0" ; IncludeSubString
|
---|
360 | Push "0" ; Loops
|
---|
361 | Push "0" ; CaseSensitive
|
---|
362 | Call ${un}StrStrAdv
|
---|
363 | Pop $1 ; Got first part (e.g. "1.5")
|
---|
364 |
|
---|
365 | Push "$1" ; String
|
---|
366 | Push "." ; SubString
|
---|
367 | Push ">" ; SearchDirection
|
---|
368 | Push "<" ; StrInclusionDirection
|
---|
369 | Push "0" ; IncludeSubString
|
---|
370 | Push "0" ; Loops
|
---|
371 | Push "0" ; CaseSensitive
|
---|
372 | Call ${un}StrStrAdv
|
---|
373 | Pop $g_strAddVerMin ; Extracted second part (e.g. "5" from "1.5")
|
---|
374 |
|
---|
375 | ; Extract build number.
|
---|
376 | Push "$0" ; String
|
---|
377 | Push "." ; SubString
|
---|
378 | Push "<" ; SearchDirection
|
---|
379 | Push ">" ; StrInclusionDirection
|
---|
380 | Push "0" ; IncludeSubString
|
---|
381 | Push "0" ; Loops
|
---|
382 | Push "0" ; CaseSensitive
|
---|
383 | Call ${un}StrStrAdv
|
---|
384 | Pop $g_strAddVerBuild
|
---|
385 |
|
---|
386 | Pop $1
|
---|
387 | Pop $0
|
---|
388 |
|
---|
389 | FunctionEnd
|
---|
390 | !macroend
|
---|
391 | !insertmacro GetAdditionsVersion ""
|
---|
392 | !endif ; UNINSTALLER_ONLY
|
---|
393 |
|
---|
394 |
|
---|
395 | !macro StopVBoxService un
|
---|
396 | ;;
|
---|
397 | ; Stops VBoxService.
|
---|
398 | ;
|
---|
399 | ; Input:
|
---|
400 | ; None
|
---|
401 | ; Output:
|
---|
402 | ; None
|
---|
403 | ;
|
---|
404 | Function ${un}StopVBoxService
|
---|
405 |
|
---|
406 | Push $0 ; Temp results
|
---|
407 | Push $1
|
---|
408 | Push $2 ; Image name of VBoxService
|
---|
409 | Push $3 ; Safety counter
|
---|
410 |
|
---|
411 | StrCpy $3 "0" ; Init counter.
|
---|
412 | ${LogVerbose} "Stopping VBoxService ..."
|
---|
413 |
|
---|
414 | ${LogVerbose} "Stopping VBoxService via SCM ..."
|
---|
415 | ${If} $g_strWinVersion == "NT4"
|
---|
416 | nsExec::Exec '"$SYSDIR\net.exe" stop VBoxService'
|
---|
417 | ${Else}
|
---|
418 | nsExec::Exec '"$SYSDIR\sc.exe" stop VBoxService'
|
---|
419 | ${EndIf}
|
---|
420 | Sleep "1000" ; Wait a bit
|
---|
421 |
|
---|
422 | !ifdef _DEBUG
|
---|
423 | ${LogVerbose} "Stopping VBoxService (as exe) ..."
|
---|
424 | !endif
|
---|
425 |
|
---|
426 | exe_stop_loop:
|
---|
427 |
|
---|
428 | IntCmp $3 10 exit ; Only try this loop 10 times max.
|
---|
429 | IntOp $3 $3 + 1 ; Increment.
|
---|
430 |
|
---|
431 | !ifdef _DEBUG
|
---|
432 | ${LogVerbose} "Stopping attempt #$3"
|
---|
433 | !endif
|
---|
434 |
|
---|
435 | StrCpy $2 "VBoxService.exe"
|
---|
436 |
|
---|
437 | ${nsProcess::FindProcess} $2 $0
|
---|
438 | StrCmp $0 0 0 exit
|
---|
439 |
|
---|
440 | ${nsProcess::KillProcess} $2 $0
|
---|
441 | Sleep "1000" ; Wait a bit
|
---|
442 | Goto exe_stop_loop
|
---|
443 |
|
---|
444 | exit:
|
---|
445 |
|
---|
446 | ${LogVerbose} "Stopping VBoxService done"
|
---|
447 |
|
---|
448 | Pop $3
|
---|
449 | Pop $2
|
---|
450 | Pop $1
|
---|
451 | Pop $0
|
---|
452 |
|
---|
453 | FunctionEnd
|
---|
454 | !macroend
|
---|
455 | !insertmacro StopVBoxService ""
|
---|
456 | !insertmacro StopVBoxService "un."
|
---|
457 |
|
---|
458 |
|
---|
459 | !macro StopVBoxTray un
|
---|
460 | Function ${un}StopVBoxTray
|
---|
461 |
|
---|
462 | Push $0 ; Temp results
|
---|
463 | Push $1 ; Safety counter
|
---|
464 |
|
---|
465 | StrCpy $1 "0" ; Init counter
|
---|
466 | ${LogVerbose} "Stopping VBoxTray ..."
|
---|
467 |
|
---|
468 | exe_stop:
|
---|
469 |
|
---|
470 | IntCmp $1 10 exit ; Only try this loop 10 times max
|
---|
471 | IntOp $1 $1 + 1 ; Increment
|
---|
472 |
|
---|
473 | ${nsProcess::FindProcess} "VBoxTray.exe" $0
|
---|
474 | StrCmp $0 0 0 exit
|
---|
475 |
|
---|
476 | ${nsProcess::KillProcess} "VBoxTray.exe" $0
|
---|
477 | Sleep "1000" ; Wait a bit
|
---|
478 | Goto exe_stop
|
---|
479 |
|
---|
480 | exit:
|
---|
481 |
|
---|
482 | ${LogVerbose} "Stopping VBoxTray done"
|
---|
483 |
|
---|
484 | Pop $1
|
---|
485 | Pop $0
|
---|
486 |
|
---|
487 | FunctionEnd
|
---|
488 | !macroend
|
---|
489 | !insertmacro StopVBoxTray ""
|
---|
490 | !insertmacro StopVBoxTray "un."
|
---|
491 |
|
---|
492 |
|
---|
493 | !macro StopVBoxMMR un
|
---|
494 | Function ${un}StopVBoxMMR
|
---|
495 |
|
---|
496 | Push $0 ; Temp results
|
---|
497 | Push $1 ; Safety counter
|
---|
498 |
|
---|
499 | StrCpy $1 "0" ; Init counter
|
---|
500 | DetailPrint "Stopping VBoxMMR ..."
|
---|
501 |
|
---|
502 | exe_stop:
|
---|
503 |
|
---|
504 | IntCmp $1 10 exit ; Only try this loop 10 times max
|
---|
505 | IntOp $1 $1 + 1 ; Increment
|
---|
506 |
|
---|
507 | ${nsProcess::FindProcess} "VBoxMMR.exe" $0
|
---|
508 | StrCmp $0 0 0 exit
|
---|
509 |
|
---|
510 | ${nsProcess::KillProcess} "VBoxMMR.exe" $0
|
---|
511 | Sleep "1000" ; Wait a bit
|
---|
512 | Goto exe_stop
|
---|
513 |
|
---|
514 | exit:
|
---|
515 |
|
---|
516 | DetailPrint "Stopping VBoxMMR done."
|
---|
517 |
|
---|
518 | Pop $1
|
---|
519 | Pop $0
|
---|
520 |
|
---|
521 | FunctionEnd
|
---|
522 | !macroend
|
---|
523 | !insertmacro StopVBoxMMR ""
|
---|
524 | !insertmacro StopVBoxMMR "un."
|
---|
525 |
|
---|
526 |
|
---|
527 | !macro WriteRegBinR ROOT KEY NAME VALUE
|
---|
528 | WriteRegBin "${ROOT}" "${KEY}" "${NAME}" "${VALUE}"
|
---|
529 | !macroend
|
---|
530 |
|
---|
531 |
|
---|
532 | ;;
|
---|
533 | ; Sets $g_bCapDllCache, $g_bCapXPDM, $g_bWithWDDM and $g_bCapWDDM.
|
---|
534 | ;
|
---|
535 | ; Input:
|
---|
536 | ; None
|
---|
537 | ; Output:
|
---|
538 | ; None
|
---|
539 | ;
|
---|
540 | !macro CheckForCapabilities un
|
---|
541 | Function ${un}CheckForCapabilities
|
---|
542 |
|
---|
543 | Push $0
|
---|
544 |
|
---|
545 | ; Retrieve system mode and store result in.
|
---|
546 | System::Call 'user32::GetSystemMetrics(i ${SM_CLEANBOOT}) i .r0'
|
---|
547 | StrCpy $g_iSystemMode $0
|
---|
548 |
|
---|
549 | ; Does the guest have a DLL cache?
|
---|
550 | ${If} $g_strWinVersion == "NT4" ; bird: NT4 doesn't have a DLL cache, WTP is 5.0 <= NtVersion < 6.0.
|
---|
551 | ${OrIf} $g_strWinVersion == "2000"
|
---|
552 | ${OrIf} $g_strWinVersion == "XP"
|
---|
553 | StrCpy $g_bCapDllCache "true"
|
---|
554 | ${LogVerbose} "OS has a DLL cache"
|
---|
555 | ${EndIf}
|
---|
556 |
|
---|
557 | ${If} $g_strWinVersion == "2000"
|
---|
558 | ${OrIf} $g_strWinVersion == "XP"
|
---|
559 | ${OrIf} $g_strWinVersion == "2003"
|
---|
560 | ${OrIf} $g_strWinVersion == "Vista"
|
---|
561 | ${OrIf} $g_strWinVersion == "7"
|
---|
562 | StrCpy $g_bCapXPDM "true"
|
---|
563 | ${LogVerbose} "OS is XPDM driver capable"
|
---|
564 | ${EndIf}
|
---|
565 |
|
---|
566 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
567 | ; By default use the WDDM driver on Vista+.
|
---|
568 | ${If} $g_strWinVersion == "Vista"
|
---|
569 | ${OrIf} $g_strWinVersion == "7"
|
---|
570 | ${OrIf} $g_strWinVersion == "8"
|
---|
571 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
572 | ${OrIf} $g_strWinVersion == "10"
|
---|
573 | StrCpy $g_bWithWDDM "true"
|
---|
574 | StrCpy $g_bCapWDDM "true"
|
---|
575 | ${LogVerbose} "OS is WDDM driver capable"
|
---|
576 | ${EndIf}
|
---|
577 | !endif
|
---|
578 |
|
---|
579 | Pop $0
|
---|
580 |
|
---|
581 | FunctionEnd
|
---|
582 | !macroend
|
---|
583 | !ifndef UNINSTALLER_ONLY
|
---|
584 | !insertmacro CheckForCapabilities ""
|
---|
585 | !endif
|
---|
586 | !insertmacro CheckForCapabilities "un."
|
---|
587 |
|
---|
588 |
|
---|
589 | ;;
|
---|
590 | ; Switches (back) the path + registry view to 32-bit mode (SysWOW64)
|
---|
591 | ; for 64-bit Intel + ARM guests.
|
---|
592 | ;
|
---|
593 | ; Input:
|
---|
594 | ; None
|
---|
595 | ; Output:
|
---|
596 | ; None
|
---|
597 | ;
|
---|
598 | !macro SetAppMode32 un
|
---|
599 | Function ${un}SetAppMode32
|
---|
600 | !if $%KBUILD_TARGET_ARCH% != "x86" ; amd64 + arm64
|
---|
601 | ${LogVerbose} "Setting application mode to 32-bit"
|
---|
602 | ${EnableX64FSRedirection}
|
---|
603 | SetRegView 32
|
---|
604 | !endif
|
---|
605 | FunctionEnd
|
---|
606 | !macroend
|
---|
607 | !ifndef UNINSTALLER_ONLY
|
---|
608 | !insertmacro SetAppMode32 ""
|
---|
609 | !insertmacro SetAppMode32 "un."
|
---|
610 | !endif
|
---|
611 |
|
---|
612 |
|
---|
613 | ;;
|
---|
614 | ; Sets the installer's application mode.
|
---|
615 | ;
|
---|
616 | ; Because this NSIS installer is always built for x86 (32-bit), we have to
|
---|
617 | ; do some tricks for the Windows paths + registry on Intel + ARM 64-bit guests.
|
---|
618 | ;
|
---|
619 | ; Input:
|
---|
620 | ; None
|
---|
621 | ; Output:
|
---|
622 | ; None
|
---|
623 | ;
|
---|
624 | !macro SetAppMode64 un
|
---|
625 | Function ${un}SetAppMode64
|
---|
626 | !if $%KBUILD_TARGET_ARCH% != "x86" ; amd64 + arm64
|
---|
627 | ${LogVerbose} "Setting application mode to 64-bit"
|
---|
628 | ${DisableX64FSRedirection}
|
---|
629 | SetRegView 64
|
---|
630 | !endif
|
---|
631 | FunctionEnd
|
---|
632 | !macroend
|
---|
633 | !insertmacro SetAppMode64 ""
|
---|
634 | !insertmacro SetAppMode64 "un."
|
---|
635 |
|
---|
636 |
|
---|
637 | ;;
|
---|
638 | ; Retrieves the vendor ("CompanyName" of FILEINFO structure)
|
---|
639 | ; of a given file.
|
---|
640 | ;
|
---|
641 | ; Input:
|
---|
642 | ; Stack[0]: File name to retrieve vendor for.
|
---|
643 | ; Output:
|
---|
644 | ; Stack[0]: Company name, or "" on error/if not found.
|
---|
645 | ;
|
---|
646 | !macro GetFileVendor un
|
---|
647 | Function ${un}GetFileVendor
|
---|
648 |
|
---|
649 | ; Preserve values
|
---|
650 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
651 | Push $1
|
---|
652 |
|
---|
653 | IfFileExists "$0" found
|
---|
654 | Goto not_found
|
---|
655 |
|
---|
656 | found:
|
---|
657 |
|
---|
658 | VBoxGuestInstallHelper::FileGetVendor "$0"
|
---|
659 | ; Stack: <vendor> $1 $0
|
---|
660 | Pop $0 ; Get vendor
|
---|
661 | Pop $1 ; Restore $1
|
---|
662 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
663 | Goto end
|
---|
664 |
|
---|
665 | not_found:
|
---|
666 |
|
---|
667 | Pop $1
|
---|
668 | Pop $0
|
---|
669 | Push "File not found"
|
---|
670 | Goto end
|
---|
671 |
|
---|
672 | end:
|
---|
673 |
|
---|
674 | FunctionEnd
|
---|
675 | !macroend
|
---|
676 | !insertmacro GetFileVendor ""
|
---|
677 | !insertmacro GetFileVendor "un."
|
---|
678 |
|
---|
679 |
|
---|
680 | ;;
|
---|
681 | ; Retrieves the architecture of a given file.
|
---|
682 | ;
|
---|
683 | ; Input:
|
---|
684 | ; Stack[0]: File name to retrieve architecture for.
|
---|
685 | ; Output:
|
---|
686 | ; Stack[0]: Architecture ("x86", "amd64") or error message.
|
---|
687 | ;
|
---|
688 | !macro GetFileArchitecture un
|
---|
689 | Function ${un}GetFileArchitecture
|
---|
690 |
|
---|
691 | ; Preserve values
|
---|
692 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
693 | Push $1
|
---|
694 |
|
---|
695 | IfFileExists "$0" found
|
---|
696 | Goto not_found
|
---|
697 |
|
---|
698 | found:
|
---|
699 |
|
---|
700 | ${LogVerbose} "Getting architecture of file $\"$0$\" ..."
|
---|
701 |
|
---|
702 | VBoxGuestInstallHelper::FileGetArchitecture "$0"
|
---|
703 |
|
---|
704 | ; Stack: <architecture> $1 $0
|
---|
705 | Pop $0 ; Get architecture string
|
---|
706 |
|
---|
707 | ${LogVerbose} "Architecture is: $0"
|
---|
708 |
|
---|
709 | Pop $1 ; Restore $1
|
---|
710 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
711 | Goto end
|
---|
712 |
|
---|
713 | not_found:
|
---|
714 |
|
---|
715 | Pop $1
|
---|
716 | Pop $0
|
---|
717 | Push "File not found"
|
---|
718 | Goto end
|
---|
719 |
|
---|
720 | end:
|
---|
721 |
|
---|
722 | FunctionEnd
|
---|
723 | !macroend
|
---|
724 | !insertmacro GetFileArchitecture ""
|
---|
725 | !insertmacro GetFileArchitecture "un."
|
---|
726 |
|
---|
727 |
|
---|
728 | ;;
|
---|
729 | ; Verifies a given file by checking its file vendor and target
|
---|
730 | ; architecture.
|
---|
731 | ;
|
---|
732 | ; Input:
|
---|
733 | ; Stack[0]: Architecture ("x86" or "amd64").
|
---|
734 | ; Stack[1]: Vendor.
|
---|
735 | ; Stack[2]: File name to verify.
|
---|
736 | ; Output:
|
---|
737 | ; Stack[0]: "0" if valid, "1" if not, "2" on error / not found.
|
---|
738 | ;
|
---|
739 | !macro VerifyFile un
|
---|
740 | Function ${un}VerifyFile
|
---|
741 |
|
---|
742 | ; Preserve values
|
---|
743 | Exch $0 ; File; S: old$0 vendor arch
|
---|
744 | Exch ; S: vendor old$0 arch
|
---|
745 | Exch $1 ; Vendor; S: old$1 old$0 arch
|
---|
746 | Exch ; S: old$0 old$1 arch
|
---|
747 | Exch 2 ; S: arch old$1 old$0
|
---|
748 | Exch $2 ; Architecture; S: old$2 old$1 old$0
|
---|
749 | Push $3 ; S: old$3 old$2 old$1 old$0
|
---|
750 |
|
---|
751 | ${LogVerbose} "Verifying file $\"$0$\" (vendor: $1, arch: $2) ..."
|
---|
752 |
|
---|
753 | IfFileExists "$0" check_arch
|
---|
754 | Goto not_found
|
---|
755 |
|
---|
756 | check_arch:
|
---|
757 |
|
---|
758 | ${LogVerbose} "File $\"$0$\" found"
|
---|
759 |
|
---|
760 | Push $0
|
---|
761 | Call ${un}GetFileArchitecture
|
---|
762 | Pop $3
|
---|
763 |
|
---|
764 | ${LogVerbose} "Architecture is: $3"
|
---|
765 |
|
---|
766 | ${If} $3 == $2
|
---|
767 | Goto check_vendor
|
---|
768 | ${EndIf}
|
---|
769 | Goto invalid
|
---|
770 |
|
---|
771 | check_vendor:
|
---|
772 |
|
---|
773 | Push $0
|
---|
774 | Call ${un}GetFileVendor
|
---|
775 | Pop $3
|
---|
776 |
|
---|
777 | ${LogVerbose} "Vendor is: $3"
|
---|
778 |
|
---|
779 | ${If} $3 == $1
|
---|
780 | Goto valid
|
---|
781 | ${EndIf}
|
---|
782 |
|
---|
783 | invalid:
|
---|
784 |
|
---|
785 | ${LogVerbose} "File $\"$0$\" is invalid"
|
---|
786 |
|
---|
787 | StrCpy $3 "1" ; Invalid
|
---|
788 | Goto end
|
---|
789 |
|
---|
790 | valid:
|
---|
791 |
|
---|
792 | ${LogVerbose} "File $\"$0$\" is valid"
|
---|
793 |
|
---|
794 | StrCpy $3 "0" ; Valid
|
---|
795 | Goto end
|
---|
796 |
|
---|
797 | not_found:
|
---|
798 |
|
---|
799 | ${LogVerbose} "File $\"$0$\" was not found"
|
---|
800 |
|
---|
801 | StrCpy $3 "2" ; Not found
|
---|
802 | Goto end
|
---|
803 |
|
---|
804 | end:
|
---|
805 |
|
---|
806 | ; S: old$3 old$2 old$1 old$0
|
---|
807 | Exch $3 ; S: $3 old$2 old$1 old$0
|
---|
808 | Exch ; S: old$2 $3 old$1
|
---|
809 | Pop $2 ; S: $3 old$1 old$0
|
---|
810 | Exch ; S: old$1 $3 old$0
|
---|
811 | Pop $1 ; S: $3 old$0
|
---|
812 | Exch ; S: old$0 $3
|
---|
813 | Pop $0 ; S: $3
|
---|
814 |
|
---|
815 | FunctionEnd
|
---|
816 | !macroend
|
---|
817 | !insertmacro VerifyFile ""
|
---|
818 | !insertmacro VerifyFile "un."
|
---|
819 |
|
---|
820 |
|
---|
821 | ;;
|
---|
822 | ; Macro for accessing VerifyFile in a more convenient way by using
|
---|
823 | ; a parameter list.
|
---|
824 | ;
|
---|
825 | ; @return Stack: "0" if valid, "1" if not, "2" on error / not found.
|
---|
826 | ; @param Un/Installer prefix; either "" or "un".
|
---|
827 | ; @param Name of file to verify.
|
---|
828 | ; @param Vendor to check for.
|
---|
829 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
830 | ;
|
---|
831 | !macro VerifyFileEx un File Vendor Architecture
|
---|
832 | Push $0
|
---|
833 | Push "${Architecture}"
|
---|
834 | Push "${Vendor}"
|
---|
835 | Push "${File}"
|
---|
836 | Call ${un}VerifyFile
|
---|
837 | Pop $0
|
---|
838 | ${If} $0 == "0"
|
---|
839 | ${LogVerbose} "Verification of file $\"${File}$\" successful (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
840 | ${ElseIf} $0 == "1"
|
---|
841 | ${LogVerbose} "Verification of file $\"${File}$\" failed (not Vendor: ${Vendor}, and/or not Architecture: ${Architecture})"
|
---|
842 | ${Else}
|
---|
843 | ${LogVerbose} "Skipping to file $\"${File}$\"; not found"
|
---|
844 | ${EndIf}
|
---|
845 | ; Push result popped off the stack to stack again
|
---|
846 | Push $0
|
---|
847 | !macroend
|
---|
848 | !define VerifyFileEx "!insertmacro VerifyFileEx"
|
---|
849 |
|
---|
850 |
|
---|
851 | ;;
|
---|
852 | ; Macro for copying a file only if the source file is verified
|
---|
853 | ; to be from a certain vendor and architecture.
|
---|
854 | ;
|
---|
855 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
856 | ; @param Un/Installer prefix; either "" or "un".
|
---|
857 | ; @param Name of file to verify and copy to destination.
|
---|
858 | ; @param Destination name to copy verified file to.
|
---|
859 | ; @param Vendor to check for.
|
---|
860 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
861 | ;
|
---|
862 | !macro CopyFileEx un FileSrc FileDest Vendor Architecture
|
---|
863 | Push $0
|
---|
864 | Push "${Architecture}"
|
---|
865 | Push "${Vendor}"
|
---|
866 | Push "${FileSrc}"
|
---|
867 | Call ${un}VerifyFile
|
---|
868 | Pop $0
|
---|
869 |
|
---|
870 | Push "${Architecture}"
|
---|
871 | Push "Oracle Corporation"
|
---|
872 | Push "${FileDest}"
|
---|
873 | Call ${un}VerifyFile
|
---|
874 | Pop $0
|
---|
875 |
|
---|
876 | ${If} $0 == "0"
|
---|
877 | ${LogVerbose} "Copying verified file $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
878 | ClearErrors
|
---|
879 | SetOverwrite on
|
---|
880 | CopyFiles /SILENT "${FileSrc}" "${FileDest}"
|
---|
881 | ${If} ${Errors}
|
---|
882 | CreateDirectory "$TEMP\${PRODUCT_NAME}"
|
---|
883 | ${GetFileName} "${FileSrc}" $0 ; Get the base name
|
---|
884 | CopyFiles /SILENT "${FileSrc}" "$TEMP\${PRODUCT_NAME}\$0"
|
---|
885 | ${LogVerbose} "Immediate installation failed, postponing to next reboot (temporary location is: $\"$TEMP\${PRODUCT_NAME}\$0$\") ..."
|
---|
886 | ;${InstallFileEx} "${un}" "${FileSrc}" "${FileDest}" "$TEMP" ; Only works with compile time files!
|
---|
887 | System::Call "kernel32::MoveFileEx(t '$TEMP\${PRODUCT_NAME}\$0', t '${FileDest}', i 5)"
|
---|
888 | ${EndIf}
|
---|
889 | ${Else}
|
---|
890 | ${LogVerbose} "Skipping to copy file $\"${FileSrc}$\" to $\"${FileDest}$\" (not Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
891 | ${EndIf}
|
---|
892 | ; Push result popped off the stack to stack again
|
---|
893 | Push $0
|
---|
894 | !macroend
|
---|
895 | !define CopyFileEx "!insertmacro CopyFileEx"
|
---|
896 |
|
---|
897 |
|
---|
898 | ;;
|
---|
899 | ; Macro for installing a library/DLL.
|
---|
900 | ;
|
---|
901 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
902 | ; @param Un/Installer prefix; either "" or "un".
|
---|
903 | ; @param Name of lib/DLL to copy to destination.
|
---|
904 | ; @param Destination name to copy the source file to.
|
---|
905 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
906 | ;
|
---|
907 | !macro InstallFileEx un FileSrc FileDest DirTemp
|
---|
908 | ${LogVerbose} "Installing library $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
909 | ; Try the gentle way and replace the file instantly
|
---|
910 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
911 | ; If the above call didn't help, use a (later) reboot to replace the file
|
---|
912 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
913 | !macroend
|
---|
914 | !define InstallFileEx "!insertmacro InstallFileEx"
|
---|
915 |
|
---|
916 |
|
---|
917 | ;;
|
---|
918 | ; Macro for installing a library/DLL.
|
---|
919 | ;
|
---|
920 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
921 | ; @param Un/Installer prefix; either "" or "un".
|
---|
922 | ; @param Name of lib/DLL to verify and copy to destination.
|
---|
923 | ; @param Destination name to copy verified file to.
|
---|
924 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
925 | ; @param Vendor to check for.
|
---|
926 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
927 | ;
|
---|
928 | !macro InstallFileVerify un FileSrc FileDest DirTemp Vendor Architecture
|
---|
929 | Push $0
|
---|
930 | Push "${Architecture}"
|
---|
931 | Push "${Vendor}"
|
---|
932 | Push "${FileSrc}"
|
---|
933 | ${LogVerbose} "Verifying library $\"${FileSrc}$\" ..."
|
---|
934 | Call ${un}VerifyFile
|
---|
935 | Pop $0
|
---|
936 | ${If} $0 == "0"
|
---|
937 | ${InstallFileEx} ${un} ${FileSrc} ${FileDest} ${DirTemp}
|
---|
938 | ${Else}
|
---|
939 | ${LogVerbose} "File $\"${FileSrc}$\" did not pass verification (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
940 | ${EndIf}
|
---|
941 | ; Push result popped off the stack to stack again.
|
---|
942 | Push $0
|
---|
943 | !macroend
|
---|
944 | !define InstallFileVerify "!insertmacro InstallFileVerify"
|
---|
945 |
|
---|
946 |
|
---|
947 | ;;
|
---|
948 | ; Function which restores formerly backed up Direct3D original files, which were replaced by
|
---|
949 | ; a VBox XPDM driver installation before. This might be necessary for upgrading a
|
---|
950 | ; XPDM installation to a WDDM one.
|
---|
951 | ;
|
---|
952 | ; @return Stack: "0" if files were restored successfully; otherwise "1".
|
---|
953 | ;
|
---|
954 | ; Note: We don't ship modified Direct3D files anymore, but we need to (try to)
|
---|
955 | ; restore the original (backed up) DLLs when upgrading from an old(er)
|
---|
956 | ; installation.
|
---|
957 | ;
|
---|
958 | !macro RestoreFilesDirect3D un
|
---|
959 | Function ${un}RestoreFilesDirect3D
|
---|
960 | ${If} $g_bCapXPDM != "true"
|
---|
961 | ${LogVerbose} "RestoreFilesDirect3D: XPDM is not supported"
|
---|
962 | Return
|
---|
963 | ${EndIf}
|
---|
964 |
|
---|
965 | Push $0
|
---|
966 |
|
---|
967 | ; We need to switch to 64-bit app mode to handle the "real" 64-bit files in
|
---|
968 | ; "system32" on a 64-bit guest.
|
---|
969 | Call ${un}SetAppMode64
|
---|
970 |
|
---|
971 | ${LogVerbose} "Restoring original D3D files ..."
|
---|
972 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
973 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
974 |
|
---|
975 | ${If} $g_bCapDllCache == "true"
|
---|
976 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
977 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%KBUILD_TARGET_ARCH%"
|
---|
978 | ${EndIf}
|
---|
979 |
|
---|
980 | !if $%KBUILD_TARGET_ARCH% == "amd64"
|
---|
981 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
982 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
983 |
|
---|
984 | ${If} $g_bCapDllCache == "true"
|
---|
985 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
986 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
987 | ${EndIf}
|
---|
988 | !endif
|
---|
989 |
|
---|
990 | Pop $0
|
---|
991 |
|
---|
992 | FunctionEnd
|
---|
993 | !macroend
|
---|
994 | !insertmacro RestoreFilesDirect3D ""
|
---|
995 | !insertmacro RestoreFilesDirect3D "un."
|
---|