1 | ; $Id$
|
---|
2 | ; @file
|
---|
3 | ; VBoxGuestAdditionsCommon.nsh - Common / shared utility functions.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2014 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 | Function Common_CopyFiles
|
---|
19 |
|
---|
20 | SetOutPath "$INSTDIR"
|
---|
21 | SetOverwrite on
|
---|
22 |
|
---|
23 | !ifdef VBOX_WITH_LICENSE_INSTALL_RTF
|
---|
24 | ; Copy license file (if any) into the installation directory
|
---|
25 | FILE "/oname=${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
26 | !endif
|
---|
27 |
|
---|
28 | FILE "$%VBOX_PATH_DIFX%\DIFxAPI.dll"
|
---|
29 | FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
|
---|
30 |
|
---|
31 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
|
---|
32 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
33 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
|
---|
34 | !endif
|
---|
35 |
|
---|
36 | FILE "iexplore.ico"
|
---|
37 |
|
---|
38 | FunctionEnd
|
---|
39 |
|
---|
40 | !ifndef UNINSTALLER_ONLY
|
---|
41 | Function ExtractFiles
|
---|
42 |
|
---|
43 | ; @todo: Use a define for all the file specs to group the files per module
|
---|
44 | ; and keep the redundancy low
|
---|
45 |
|
---|
46 | Push $0
|
---|
47 | StrCpy "$0" "$INSTDIR\$%BUILD_TARGET_ARCH%"
|
---|
48 |
|
---|
49 | ; Root files
|
---|
50 | SetOutPath "$0"
|
---|
51 | !if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
|
---|
52 | FILE "/oname=${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
|
---|
53 | !endif
|
---|
54 |
|
---|
55 | ; Video driver
|
---|
56 | SetOutPath "$0\VBoxVideo"
|
---|
57 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
|
---|
58 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
|
---|
59 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
60 | FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
|
---|
61 | !endif
|
---|
62 | FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
|
---|
63 |
|
---|
64 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
65 | ; crOpenGL
|
---|
66 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
|
---|
67 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
|
---|
68 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
|
---|
69 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
|
---|
70 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
|
---|
71 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
|
---|
72 | FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
|
---|
73 |
|
---|
74 | SetOutPath "$0\VBoxVideo\OpenGL"
|
---|
75 | FILE "$%PATH_OUT%\bin\additions\d3d8.dll"
|
---|
76 | FILE "$%PATH_OUT%\bin\additions\d3d9.dll"
|
---|
77 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
|
---|
78 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
|
---|
79 | FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
|
---|
80 |
|
---|
81 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
82 | ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target
|
---|
83 | SetOutPath "$0\VBoxVideo\OpenGL\SysWow64"
|
---|
84 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll"
|
---|
85 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll"
|
---|
86 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLarrayspu.dll"
|
---|
87 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLcrutil.dll"
|
---|
88 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLerrorspu.dll"
|
---|
89 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpackspu.dll"
|
---|
90 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpassthroughspu.dll"
|
---|
91 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLfeedbackspu.dll"
|
---|
92 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGL.dll"
|
---|
93 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
|
---|
94 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
|
---|
95 | FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
|
---|
96 | !endif
|
---|
97 | !endif
|
---|
98 |
|
---|
99 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
100 | ; WDDM Video driver for Vista and 7
|
---|
101 | SetOutPath "$0\VBoxVideoWddm"
|
---|
102 |
|
---|
103 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
104 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.cat"
|
---|
105 | !endif
|
---|
106 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys"
|
---|
107 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf"
|
---|
108 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
|
---|
109 |
|
---|
110 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
111 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
|
---|
112 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
|
---|
113 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
|
---|
114 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
|
---|
115 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
|
---|
116 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
|
---|
117 | FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
|
---|
118 |
|
---|
119 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
|
---|
120 | FILE "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
|
---|
121 | !endif ; $%VBOX_WITH_CROGL% == "1"
|
---|
122 |
|
---|
123 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
124 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
|
---|
125 |
|
---|
126 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
127 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
|
---|
128 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
|
---|
129 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
|
---|
130 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
|
---|
131 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
|
---|
132 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
|
---|
133 | FILE "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
|
---|
134 |
|
---|
135 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
|
---|
136 | FILE "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
|
---|
137 | !endif ; $%VBOX_WITH_CROGL% == "1"
|
---|
138 | !endif ; $%BUILD_TARGET_ARCH% == "amd64"
|
---|
139 |
|
---|
140 | !if $%VBOX_WITH_WDDM_W8% == "1"
|
---|
141 | ; WDDM Video driver for Win8
|
---|
142 | SetOutPath "$0\VBoxVideoW8"
|
---|
143 |
|
---|
144 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
145 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.cat"
|
---|
146 | !endif
|
---|
147 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.sys"
|
---|
148 | FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.inf"
|
---|
149 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
|
---|
150 |
|
---|
151 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
152 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
|
---|
153 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
|
---|
154 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
|
---|
155 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
|
---|
156 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
|
---|
157 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
|
---|
158 | FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
|
---|
159 |
|
---|
160 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
|
---|
161 | FILE "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
|
---|
162 | !endif ; $%VBOX_WITH_CROGL% == "1"
|
---|
163 |
|
---|
164 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
165 | FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
|
---|
166 |
|
---|
167 | !if $%VBOX_WITH_CROGL% == "1"
|
---|
168 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
|
---|
169 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
|
---|
170 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
|
---|
171 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
|
---|
172 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
|
---|
173 | FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
|
---|
174 | FILE "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
|
---|
175 |
|
---|
176 | FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
|
---|
177 | FILE "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
|
---|
178 | !endif ; $%VBOX_WITH_CROGL% == "1"
|
---|
179 | !endif ; $%BUILD_TARGET_ARCH% == "amd64"
|
---|
180 | !endif ; $%VBOX_WITH_WDDM_W8% == "1"
|
---|
181 | !endif ; $%VBOX_WITH_WDDM% == "1"
|
---|
182 |
|
---|
183 | ; Mouse driver
|
---|
184 | SetOutPath "$0\VBoxMouse"
|
---|
185 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
|
---|
186 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
|
---|
187 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
188 | FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
|
---|
189 | !endif
|
---|
190 |
|
---|
191 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
192 | SetOutPath "$0\VBoxMouse\NT4"
|
---|
193 | FILE "$%PATH_OUT%\bin\additions\VBoxMouseNT.sys"
|
---|
194 | !endif
|
---|
195 |
|
---|
196 | ; Guest driver
|
---|
197 | SetOutPath "$0\VBoxGuest"
|
---|
198 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
|
---|
199 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
|
---|
200 | !ifdef VBOX_SIGN_ADDITIONS
|
---|
201 | FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
|
---|
202 | !endif
|
---|
203 | FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
|
---|
204 | FILE "$%PATH_OUT%\bin\additions\VBoxHook.dll"
|
---|
205 | FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
|
---|
206 |
|
---|
207 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
208 | SetOutPath "$0\VBoxGuest\NT4"
|
---|
209 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestNT.sys"
|
---|
210 | !endif
|
---|
211 |
|
---|
212 | ; VBoxService
|
---|
213 | SetOutPath "$0\Bin"
|
---|
214 | FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
|
---|
215 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
216 | FILE "$%PATH_OUT%\bin\additions\VBoxServiceNT.exe"
|
---|
217 | !endif
|
---|
218 |
|
---|
219 | ; Shared Folders
|
---|
220 | SetOutPath "$0\VBoxSF"
|
---|
221 | FILE "$%PATH_OUT%\bin\additions\VBoxSF.sys"
|
---|
222 | FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll"
|
---|
223 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
224 | ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target
|
---|
225 | FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll"
|
---|
226 | !endif
|
---|
227 |
|
---|
228 | ; Auto-Logon
|
---|
229 | SetOutPath "$0\AutoLogon"
|
---|
230 | FILE "$%PATH_OUT%\bin\additions\VBoxGINA.dll"
|
---|
231 | FILE "$%PATH_OUT%\bin\additions\VBoxCredProv.dll"
|
---|
232 |
|
---|
233 | ; Misc tools
|
---|
234 | SetOutPath "$0\Tools"
|
---|
235 | FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
|
---|
236 | FILE "$%VBOX_PATH_DIFX%\DIFxAPI.dll"
|
---|
237 |
|
---|
238 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
239 | SetOutPath "$0\Tools\NT4"
|
---|
240 | FILE "$%PATH_OUT%\bin\additions\VBoxGuestDrvInst.exe"
|
---|
241 | FILE "$%PATH_OUT%\bin\additions\RegCleanup.exe"
|
---|
242 | !endif
|
---|
243 |
|
---|
244 | Pop $0
|
---|
245 |
|
---|
246 | FunctionEnd
|
---|
247 | !endif ; UNINSTALLER_ONLY
|
---|
248 |
|
---|
249 | !macro CheckArchitecture un
|
---|
250 | Function ${un}CheckArchitecture
|
---|
251 |
|
---|
252 | Push $0
|
---|
253 |
|
---|
254 | System::Call "kernel32::GetCurrentProcess() i .s"
|
---|
255 | System::Call "kernel32::IsWow64Process(i s, *i .r0)"
|
---|
256 | ; R0 now contains 1 if we're a 64-bit process, or 0 if not
|
---|
257 |
|
---|
258 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
259 | IntCmp $0 0 wrong_platform
|
---|
260 | !else ; 32-bit
|
---|
261 | IntCmp $0 1 wrong_platform
|
---|
262 | !endif
|
---|
263 |
|
---|
264 | Push 0
|
---|
265 | Goto exit
|
---|
266 |
|
---|
267 | wrong_platform:
|
---|
268 |
|
---|
269 | Push 1
|
---|
270 | Goto exit
|
---|
271 |
|
---|
272 | exit:
|
---|
273 |
|
---|
274 | FunctionEnd
|
---|
275 | !macroend
|
---|
276 | !insertmacro CheckArchitecture ""
|
---|
277 | !insertmacro CheckArchitecture "un."
|
---|
278 |
|
---|
279 | ;
|
---|
280 | ; Macro for retrieving the Windows version this installer is running on.
|
---|
281 | ;
|
---|
282 | ; @return Stack: Windows version string. Empty on error /
|
---|
283 | ; if not able to identify.
|
---|
284 | ;
|
---|
285 | !macro GetWindowsVersionEx un
|
---|
286 | Function ${un}GetWindowsVersionEx
|
---|
287 |
|
---|
288 | Push $0
|
---|
289 | Push $1
|
---|
290 |
|
---|
291 | ; Check if we are running on Windows 2000 or above
|
---|
292 | ; For other windows versions (> XP) it may be necessary to change winver.nsh
|
---|
293 | Call ${un}GetWindowsVersion
|
---|
294 | Pop $0 ; Windows Version
|
---|
295 |
|
---|
296 | Push $0 ; The windows version string
|
---|
297 | Push "NT" ; String to search for. W2K+ returns no string containing "NT"
|
---|
298 | Call ${un}StrStr
|
---|
299 | Pop $1
|
---|
300 |
|
---|
301 | ${If} $1 == "" ; If empty -> not NT 3.XX or 4.XX
|
---|
302 | ; $0 contains the original version string
|
---|
303 | ${Else}
|
---|
304 | ; Ok we know it is NT. Must be a string like NT X.XX
|
---|
305 | Push $0 ; The windows version string
|
---|
306 | Push "4." ; String to search for
|
---|
307 | Call ${un}StrStr
|
---|
308 | Pop $1
|
---|
309 | ${If} $1 == "" ; If empty -> not NT 4
|
---|
310 | ;; @todo NT <= 3.x ?
|
---|
311 | ; $0 contains the original version string
|
---|
312 | ${Else}
|
---|
313 | StrCpy $0 "NT4"
|
---|
314 | ${EndIf}
|
---|
315 | ${EndIf}
|
---|
316 |
|
---|
317 | Pop $1
|
---|
318 | Exch $0
|
---|
319 |
|
---|
320 | FunctionEnd
|
---|
321 | !macroend
|
---|
322 | !insertmacro GetWindowsVersionEx ""
|
---|
323 | !insertmacro GetWindowsVersionEx "un."
|
---|
324 |
|
---|
325 | !macro GetAdditionsVersion un
|
---|
326 | Function ${un}GetAdditionsVersion
|
---|
327 |
|
---|
328 | Push $0
|
---|
329 | Push $1
|
---|
330 |
|
---|
331 | ; Get additions version
|
---|
332 | ReadRegStr $0 HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Version"
|
---|
333 |
|
---|
334 | ; Get revision
|
---|
335 | ReadRegStr $g_strAddVerRev HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Revision"
|
---|
336 |
|
---|
337 | ; Extract major version
|
---|
338 | Push "$0" ; String
|
---|
339 | Push "." ; SubString
|
---|
340 | Push ">" ; SearchDirection
|
---|
341 | Push "<" ; StrInclusionDirection
|
---|
342 | Push "0" ; IncludeSubString
|
---|
343 | Push "0" ; Loops
|
---|
344 | Push "0" ; CaseSensitive
|
---|
345 | Call ${un}StrStrAdv
|
---|
346 | Pop $g_strAddVerMaj
|
---|
347 |
|
---|
348 | ; Extract minor version
|
---|
349 | Push "$0" ; String
|
---|
350 | Push "." ; SubString
|
---|
351 | Push ">" ; SearchDirection
|
---|
352 | Push ">" ; StrInclusionDirection
|
---|
353 | Push "0" ; IncludeSubString
|
---|
354 | Push "0" ; Loops
|
---|
355 | Push "0" ; CaseSensitive
|
---|
356 | Call ${un}StrStrAdv
|
---|
357 | Pop $1 ; Got first part (e.g. "1.5")
|
---|
358 |
|
---|
359 | Push "$1" ; String
|
---|
360 | Push "." ; SubString
|
---|
361 | Push ">" ; SearchDirection
|
---|
362 | Push "<" ; StrInclusionDirection
|
---|
363 | Push "0" ; IncludeSubString
|
---|
364 | Push "0" ; Loops
|
---|
365 | Push "0" ; CaseSensitive
|
---|
366 | Call ${un}StrStrAdv
|
---|
367 | Pop $g_strAddVerMin ; Extracted second part (e.g. "5" from "1.5")
|
---|
368 |
|
---|
369 | ; Extract build number
|
---|
370 | Push "$0" ; String
|
---|
371 | Push "." ; SubString
|
---|
372 | Push "<" ; SearchDirection
|
---|
373 | Push ">" ; StrInclusionDirection
|
---|
374 | Push "0" ; IncludeSubString
|
---|
375 | Push "0" ; Loops
|
---|
376 | Push "0" ; CaseSensitive
|
---|
377 | Call ${un}StrStrAdv
|
---|
378 | Pop $g_strAddVerBuild
|
---|
379 |
|
---|
380 | exit:
|
---|
381 |
|
---|
382 | Pop $1
|
---|
383 | Pop $0
|
---|
384 |
|
---|
385 | FunctionEnd
|
---|
386 | !macroend
|
---|
387 | !insertmacro GetAdditionsVersion ""
|
---|
388 | !insertmacro GetAdditionsVersion "un."
|
---|
389 |
|
---|
390 | !macro StopVBoxService un
|
---|
391 | Function ${un}StopVBoxService
|
---|
392 |
|
---|
393 | Push $0 ; Temp results
|
---|
394 | Push $1
|
---|
395 | Push $2 ; Image name of VBoxService
|
---|
396 | Push $3 ; Safety counter
|
---|
397 |
|
---|
398 | StrCpy $3 "0" ; Init counter
|
---|
399 | ${LogVerbose} "Stopping VBoxService ..."
|
---|
400 |
|
---|
401 | svc_stop:
|
---|
402 |
|
---|
403 | ${LogVerbose} "Stopping VBoxService via SCM ..."
|
---|
404 | ${If} $g_strWinVersion == "NT4"
|
---|
405 | nsExec::Exec '"$SYSDIR\net.exe" stop VBoxService'
|
---|
406 | ${Else}
|
---|
407 | nsExec::Exec '"$SYSDIR\SC.exe" stop VBoxService'
|
---|
408 | ${EndIf}
|
---|
409 | Sleep "1000" ; Wait a bit
|
---|
410 |
|
---|
411 | exe_stop:
|
---|
412 |
|
---|
413 | !ifdef _DEBUG
|
---|
414 | ${LogVerbose} "Stopping VBoxService (as exe) ..."
|
---|
415 | !endif
|
---|
416 |
|
---|
417 | exe_stop_loop:
|
---|
418 |
|
---|
419 | IntCmp $3 10 exit ; Only try this loop 10 times max
|
---|
420 | IntOp $3 $3 + 1 ; Increment
|
---|
421 |
|
---|
422 | !ifdef _DEBUG
|
---|
423 | ${LogVerbose} "Stopping attempt #$3"
|
---|
424 | !endif
|
---|
425 |
|
---|
426 | ${If} $g_strWinVersion == "NT4"
|
---|
427 | StrCpy $2 "VBoxServiceNT.exe"
|
---|
428 | ${Else}
|
---|
429 | StrCpy $2 "VBoxService.exe"
|
---|
430 | ${EndIf}
|
---|
431 |
|
---|
432 | ${nsProcess::FindProcess} $2 $0
|
---|
433 | StrCmp $0 0 0 exit
|
---|
434 |
|
---|
435 | ${nsProcess::KillProcess} $2 $0
|
---|
436 | Sleep "1000" ; Wait a bit
|
---|
437 | Goto exe_stop_loop
|
---|
438 |
|
---|
439 | exit:
|
---|
440 |
|
---|
441 | ${LogVerbose} "Stopping VBoxService done"
|
---|
442 |
|
---|
443 | Pop $3
|
---|
444 | Pop $2
|
---|
445 | Pop $1
|
---|
446 | Pop $0
|
---|
447 |
|
---|
448 | FunctionEnd
|
---|
449 | !macroend
|
---|
450 | !insertmacro StopVBoxService ""
|
---|
451 | !insertmacro StopVBoxService "un."
|
---|
452 |
|
---|
453 | !macro StopVBoxTray un
|
---|
454 | Function ${un}StopVBoxTray
|
---|
455 |
|
---|
456 | Push $0 ; Temp results
|
---|
457 | Push $1 ; Safety counter
|
---|
458 |
|
---|
459 | StrCpy $1 "0" ; Init counter
|
---|
460 | ${LogVerbose} "Stopping VBoxTray ..."
|
---|
461 |
|
---|
462 | exe_stop:
|
---|
463 |
|
---|
464 | IntCmp $1 10 exit ; Only try this loop 10 times max
|
---|
465 | IntOp $1 $1 + 1 ; Increment
|
---|
466 |
|
---|
467 | ${nsProcess::FindProcess} "VBoxTray.exe" $0
|
---|
468 | StrCmp $0 0 0 exit
|
---|
469 |
|
---|
470 | ${nsProcess::KillProcess} "VBoxTray.exe" $0
|
---|
471 | Sleep "1000" ; Wait a bit
|
---|
472 | Goto exe_stop
|
---|
473 |
|
---|
474 | exit:
|
---|
475 |
|
---|
476 | ${LogVerbose} "Stopping VBoxTray done"
|
---|
477 |
|
---|
478 | Pop $1
|
---|
479 | Pop $0
|
---|
480 |
|
---|
481 | FunctionEnd
|
---|
482 | !macroend
|
---|
483 | !insertmacro StopVBoxTray ""
|
---|
484 | !insertmacro StopVBoxTray "un."
|
---|
485 |
|
---|
486 | !macro StopVBoxMMR un
|
---|
487 | Function ${un}StopVBoxMMR
|
---|
488 |
|
---|
489 | Push $0 ; Temp results
|
---|
490 | Push $1 ; Safety counter
|
---|
491 |
|
---|
492 | StrCpy $1 "0" ; Init counter
|
---|
493 | DetailPrint "Stopping VBoxMMR ..."
|
---|
494 |
|
---|
495 | exe_stop:
|
---|
496 |
|
---|
497 | IntCmp $1 10 exit ; Only try this loop 10 times max
|
---|
498 | IntOp $1 $1 + 1 ; Increment
|
---|
499 |
|
---|
500 | ${nsProcess::FindProcess} "VBoxMMR.exe" $0
|
---|
501 | StrCmp $0 0 0 exit
|
---|
502 |
|
---|
503 | ${nsProcess::KillProcess} "VBoxMMR.exe" $0
|
---|
504 | Sleep "1000" ; Wait a bit
|
---|
505 | Goto exe_stop
|
---|
506 |
|
---|
507 | exit:
|
---|
508 |
|
---|
509 | DetailPrint "Stopping VBoxMMR done."
|
---|
510 |
|
---|
511 | Pop $1
|
---|
512 | Pop $0
|
---|
513 |
|
---|
514 | FunctionEnd
|
---|
515 | !macroend
|
---|
516 | !insertmacro StopVBoxMMR ""
|
---|
517 | !insertmacro StopVBoxMMR "un."
|
---|
518 |
|
---|
519 | !macro WriteRegBinR ROOT KEY NAME VALUE
|
---|
520 | WriteRegBin "${ROOT}" "${KEY}" "${NAME}" "${VALUE}"
|
---|
521 | !macroend
|
---|
522 |
|
---|
523 | !macro AbortShutdown un
|
---|
524 | Function ${un}AbortShutdown
|
---|
525 |
|
---|
526 | ${If} ${FileExists} "$g_strSystemDir\shutdown.exe"
|
---|
527 | ; Try to abort the shutdown
|
---|
528 | ${CmdExecute} "$\"$g_strSystemDir\shutdown.exe$\" -a" "true"
|
---|
529 | ${Else}
|
---|
530 | ${LogVerbose} "Shutting down not supported: Binary $\"$g_strSystemDir\shutdown.exe$\" not found"
|
---|
531 | ${EndIf}
|
---|
532 |
|
---|
533 | FunctionEnd
|
---|
534 | !macroend
|
---|
535 | !insertmacro AbortShutdown ""
|
---|
536 | !insertmacro AbortShutdown "un."
|
---|
537 |
|
---|
538 | !macro CheckForWDDMCapability un
|
---|
539 | Function ${un}CheckForWDDMCapability
|
---|
540 |
|
---|
541 | !if $%VBOX_WITH_WDDM% == "1"
|
---|
542 | ; If we're on a 32-bit Windows Vista / 7 / 8 we can use the WDDM driver
|
---|
543 | ${If} $g_strWinVersion == "Vista"
|
---|
544 | ${OrIf} $g_strWinVersion == "7"
|
---|
545 | ${OrIf} $g_strWinVersion == "8"
|
---|
546 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
547 | ${OrIf} $g_strWinVersion == "10"
|
---|
548 | StrCpy $g_bCapWDDM "true"
|
---|
549 | ${LogVerbose} "OS is WDDM driver capable"
|
---|
550 | ${EndIf}
|
---|
551 | ; If we're on Windows 8 we *have* to use the WDDM driver, so select it
|
---|
552 | ; by default
|
---|
553 | ${If} $g_strWinVersion == "8"
|
---|
554 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
555 | ${OrIf} $g_strWinVersion == "10"
|
---|
556 | StrCpy $g_bWithWDDM "true"
|
---|
557 | ${LogVerbose} "OS needs WDDM driver by default"
|
---|
558 | ${EndIf}
|
---|
559 | !endif
|
---|
560 |
|
---|
561 | FunctionEnd
|
---|
562 | !macroend
|
---|
563 | !insertmacro CheckForWDDMCapability ""
|
---|
564 | !insertmacro CheckForWDDMCapability "un."
|
---|
565 |
|
---|
566 | !macro CheckForCapabilities un
|
---|
567 | Function ${un}CheckForCapabilities
|
---|
568 |
|
---|
569 | Push $0
|
---|
570 |
|
---|
571 | ; Retrieve system mode and store result in
|
---|
572 | System::Call 'user32::GetSystemMetrics(i ${SM_CLEANBOOT}) i .r0'
|
---|
573 | StrCpy $g_iSystemMode $0
|
---|
574 |
|
---|
575 | ; Does the guest have a DLL cache?
|
---|
576 | ${If} $g_strWinVersion == "Vista"
|
---|
577 | ${OrIf} $g_strWinVersion == "7"
|
---|
578 | ${OrIf} $g_strWinVersion == "8"
|
---|
579 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
580 | ${OrIf} $g_strWinVersion == "10"
|
---|
581 | StrCpy $g_bCapDllCache "true"
|
---|
582 | ${LogVerbose} "OS has a DLL cache"
|
---|
583 | ${EndIf}
|
---|
584 |
|
---|
585 | ; Check whether this OS is capable of handling WDDM drivers
|
---|
586 | Call ${un}CheckForWDDMCapability
|
---|
587 |
|
---|
588 | Pop $0
|
---|
589 |
|
---|
590 | FunctionEnd
|
---|
591 | !macroend
|
---|
592 | !insertmacro CheckForCapabilities ""
|
---|
593 | !insertmacro CheckForCapabilities "un."
|
---|
594 |
|
---|
595 | ; Switches (back) the path + registry view to
|
---|
596 | ; 32-bit mode (SysWOW64) on 64-bit guests
|
---|
597 | !macro SetAppMode32 un
|
---|
598 | Function ${un}SetAppMode32
|
---|
599 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
600 | ${EnableX64FSRedirection}
|
---|
601 | SetRegView 32
|
---|
602 | !endif
|
---|
603 | FunctionEnd
|
---|
604 | !macroend
|
---|
605 | !insertmacro SetAppMode32 ""
|
---|
606 | !insertmacro SetAppMode32 "un."
|
---|
607 |
|
---|
608 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
609 | ; do some tricks for the Windows paths + registry on 64-bit guests
|
---|
610 | !macro SetAppMode64 un
|
---|
611 | Function ${un}SetAppMode64
|
---|
612 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
613 | ${DisableX64FSRedirection}
|
---|
614 | SetRegView 64
|
---|
615 | !endif
|
---|
616 | FunctionEnd
|
---|
617 | !macroend
|
---|
618 | !insertmacro SetAppMode64 ""
|
---|
619 | !insertmacro SetAppMode64 "un."
|
---|
620 |
|
---|
621 | ;
|
---|
622 | ; Retrieves the vendor ("CompanyName" of FILEINFO structure)
|
---|
623 | ; of a given file.
|
---|
624 | ; @return Stack: Company name, or "" on error/if not found.
|
---|
625 | ; @param Stack: File name to retrieve vendor for.
|
---|
626 | ;
|
---|
627 | !macro GetFileVendor un
|
---|
628 | Function ${un}GetFileVendor
|
---|
629 |
|
---|
630 | ; Preserve values
|
---|
631 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
632 | Push $1
|
---|
633 |
|
---|
634 | IfFileExists "$0" found
|
---|
635 | Goto not_found
|
---|
636 |
|
---|
637 | found:
|
---|
638 |
|
---|
639 | VBoxGuestInstallHelper::FileGetVendor "$0"
|
---|
640 | ; Stack: <vendor> $1 $0
|
---|
641 | Pop $0 ; Get vendor
|
---|
642 | Pop $1 ; Restore $1
|
---|
643 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
644 | Goto end
|
---|
645 |
|
---|
646 | not_found:
|
---|
647 |
|
---|
648 | Pop $1
|
---|
649 | Pop $0
|
---|
650 | Push "File not found"
|
---|
651 | Goto end
|
---|
652 |
|
---|
653 | end:
|
---|
654 |
|
---|
655 | FunctionEnd
|
---|
656 | !macroend
|
---|
657 | !insertmacro GetFileVendor ""
|
---|
658 | !insertmacro GetFileVendor "un."
|
---|
659 |
|
---|
660 | ;
|
---|
661 | ; Retrieves the architecture of a given file.
|
---|
662 | ; @return Stack: Architecture ("x86", "amd64") or error message.
|
---|
663 | ; @param Stack: File name to retrieve architecture for.
|
---|
664 | ;
|
---|
665 | !macro GetFileArchitecture un
|
---|
666 | Function ${un}GetFileArchitecture
|
---|
667 |
|
---|
668 | ; Preserve values
|
---|
669 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
670 | Push $1
|
---|
671 |
|
---|
672 | IfFileExists "$0" found
|
---|
673 | Goto not_found
|
---|
674 |
|
---|
675 | found:
|
---|
676 |
|
---|
677 | VBoxGuestInstallHelper::FileGetArchitecture "$0"
|
---|
678 | ; Stack: <architecture> $1 $0
|
---|
679 | Pop $0 ; Get architecture string
|
---|
680 | Pop $1 ; Restore $1
|
---|
681 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
682 | Goto end
|
---|
683 |
|
---|
684 | not_found:
|
---|
685 |
|
---|
686 | Pop $1
|
---|
687 | Pop $0
|
---|
688 | Push "File not found"
|
---|
689 | Goto end
|
---|
690 |
|
---|
691 | end:
|
---|
692 |
|
---|
693 | FunctionEnd
|
---|
694 | !macroend
|
---|
695 | !insertmacro GetFileArchitecture ""
|
---|
696 | !insertmacro GetFileArchitecture "un."
|
---|
697 |
|
---|
698 | ;
|
---|
699 | ; Verifies a given file by checking its file vendor and target
|
---|
700 | ; architecture.
|
---|
701 | ; @return Stack: "0" if valid, "1" if not, "2" on error / not found.
|
---|
702 | ; @param Stack: Architecture ("x86" or "amd64").
|
---|
703 | ; @param Stack: Vendor.
|
---|
704 | ; @param Stack: File name to verify.
|
---|
705 | ;
|
---|
706 | !macro VerifyFile un
|
---|
707 | Function ${un}VerifyFile
|
---|
708 |
|
---|
709 | ; Preserve values
|
---|
710 | Exch $0 ; File; S: old$0 vendor arch
|
---|
711 | Exch ; S: vendor old$0 arch
|
---|
712 | Exch $1 ; Vendor; S: old$1 old$0 arch
|
---|
713 | Exch ; S: old$0 old$1 arch
|
---|
714 | Exch 2 ; S: arch old$1 old$0
|
---|
715 | Exch $2 ; Architecture; S: old$2 old$1 old$0
|
---|
716 | Push $3 ; S: old$3 old$2 old$1 old$0
|
---|
717 |
|
---|
718 | IfFileExists "$0" check_vendor
|
---|
719 | Goto not_found
|
---|
720 |
|
---|
721 | check_vendor:
|
---|
722 |
|
---|
723 | Push $0
|
---|
724 | Call ${un}GetFileVendor
|
---|
725 | Pop $3
|
---|
726 |
|
---|
727 | ${If} $3 == $1
|
---|
728 | Goto check_arch
|
---|
729 | ${EndIf}
|
---|
730 | StrCpy $3 "1" ; Invalid
|
---|
731 | Goto end
|
---|
732 |
|
---|
733 | check_arch:
|
---|
734 |
|
---|
735 | Push $0
|
---|
736 | Call ${un}GetFileArchitecture
|
---|
737 | Pop $3
|
---|
738 |
|
---|
739 | ${If} $3 == $2
|
---|
740 | StrCpy $3 "0" ; Valid
|
---|
741 | ${Else}
|
---|
742 | StrCpy $3 "1" ; Invalid
|
---|
743 | ${EndIf}
|
---|
744 | Goto end
|
---|
745 |
|
---|
746 | not_found:
|
---|
747 |
|
---|
748 | StrCpy $3 "2" ; Not found
|
---|
749 | Goto end
|
---|
750 |
|
---|
751 | end:
|
---|
752 |
|
---|
753 | ; S: old$3 old$2 old$1 old$0
|
---|
754 | Exch $3 ; S: $3 old$2 old$1 old$0
|
---|
755 | Exch ; S: old$2 $3 old$1
|
---|
756 | Pop $2 ; S: $3 old$1 old$0
|
---|
757 | Exch ; S: old$1 $3 old$0
|
---|
758 | Pop $1 ; S: $3 old$0
|
---|
759 | Exch ; S: old$0 $3
|
---|
760 | Pop $0 ; S: $3
|
---|
761 |
|
---|
762 | FunctionEnd
|
---|
763 | !macroend
|
---|
764 | !insertmacro VerifyFile ""
|
---|
765 | !insertmacro VerifyFile "un."
|
---|
766 |
|
---|
767 | ;
|
---|
768 | ; Macro for accessing VerifyFile in a more convenient way by using
|
---|
769 | ; a parameter list.
|
---|
770 | ; @return Stack: "0" if valid, "1" if not, "2" on error / not found.
|
---|
771 | ; @param Un/Installer prefix; either "" or "un".
|
---|
772 | ; @param Name of file to verify.
|
---|
773 | ; @param Vendor to check for.
|
---|
774 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
775 | ;
|
---|
776 | !macro VerifyFileEx un File Vendor Architecture
|
---|
777 | Push $0
|
---|
778 | Push "${Architecture}"
|
---|
779 | Push "${Vendor}"
|
---|
780 | Push "${File}"
|
---|
781 | ${LogVerbose} "Verifying file $\"${File}$\" ..."
|
---|
782 | Call ${un}VerifyFile
|
---|
783 | Pop $0
|
---|
784 | ${If} $0 == "0"
|
---|
785 | ${LogVerbose} "Verification of file $\"${File}$\" successful (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
786 | ${ElseIf} $0 == "1"
|
---|
787 | ${LogVerbose} "Verification of file $\"${File}$\" failed (not Vendor: ${Vendor}, and/or not Architecture: ${Architecture})"
|
---|
788 | ${Else}
|
---|
789 | ${LogVerbose} "Skipping to file $\"${File}$\"; not found"
|
---|
790 | ${EndIf}
|
---|
791 | ; Push result popped off the stack to stack again
|
---|
792 | Push $0
|
---|
793 | !macroend
|
---|
794 | !define VerifyFileEx "!insertmacro VerifyFileEx"
|
---|
795 |
|
---|
796 | ;
|
---|
797 | ; Macro for copying a file only if the source file is verified
|
---|
798 | ; to be from a certain vendor and architecture.
|
---|
799 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
800 | ; @param Un/Installer prefix; either "" or "un".
|
---|
801 | ; @param Name of file to verify and copy to destination.
|
---|
802 | ; @param Destination name to copy verified file to.
|
---|
803 | ; @param Vendor to check for.
|
---|
804 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
805 | ;
|
---|
806 | !macro CopyFileEx un FileSrc FileDest Vendor Architecture
|
---|
807 | Push $0
|
---|
808 | Push "${Architecture}"
|
---|
809 | Push "${Vendor}"
|
---|
810 | Push "${FileSrc}"
|
---|
811 | Call ${un}VerifyFile
|
---|
812 | Pop $0
|
---|
813 | ${If} $0 == "0"
|
---|
814 | ${LogVerbose} "Copying verified file $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
815 | ClearErrors
|
---|
816 | SetOverwrite on
|
---|
817 | CopyFiles /SILENT "${FileSrc}" "${FileDest}"
|
---|
818 | ${If} ${Errors}
|
---|
819 | CreateDirectory "$TEMP\${PRODUCT_NAME}"
|
---|
820 | ${GetFileName} "${FileSrc}" $0 ; Get the base name
|
---|
821 | CopyFiles /SILENT "${FileSrc}" "$TEMP\${PRODUCT_NAME}\$0"
|
---|
822 | ${LogVerbose} "Immediate installation failed, postponing to next reboot (temporary location is: $\"$TEMP\${PRODUCT_NAME}\$0$\") ..."
|
---|
823 | ;${InstallFileEx} "${un}" "${FileSrc}" "${FileDest}" "$TEMP" ; Only works with compile time files!
|
---|
824 | System::Call "kernel32::MoveFileEx(t '$TEMP\${PRODUCT_NAME}\$0', t '${FileDest}', i 5)"
|
---|
825 | ${EndIf}
|
---|
826 | ${Else}
|
---|
827 | ${LogVerbose} "Skipping to copy file $\"${FileSrc}$\" to $\"${FileDest}$\" (not Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
828 | ${EndIf}
|
---|
829 | ; Push result popped off the stack to stack again
|
---|
830 | Push $0
|
---|
831 | !macroend
|
---|
832 | !define CopyFileEx "!insertmacro CopyFileEx"
|
---|
833 |
|
---|
834 | ;
|
---|
835 | ; Macro for installing a library/DLL.
|
---|
836 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
837 | ; @param Un/Installer prefix; either "" or "un".
|
---|
838 | ; @param Name of lib/DLL to copy to destination.
|
---|
839 | ; @param Destination name to copy the source file to.
|
---|
840 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
841 | ;
|
---|
842 | !macro InstallFileEx un FileSrc FileDest DirTemp
|
---|
843 | ${LogVerbose} "Installing library $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
844 | ; Try the gentle way and replace the file instantly
|
---|
845 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
846 | ; If the above call didn't help, use a (later) reboot to replace the file
|
---|
847 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
848 | !macroend
|
---|
849 | !define InstallFileEx "!insertmacro InstallFileEx"
|
---|
850 |
|
---|
851 | ;
|
---|
852 | ; Macro for installing a library/DLL.
|
---|
853 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
854 | ; @param Un/Installer prefix; either "" or "un".
|
---|
855 | ; @param Name of lib/DLL to verify and copy to destination.
|
---|
856 | ; @param Destination name to copy verified file to.
|
---|
857 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
858 | ; @param Vendor to check for.
|
---|
859 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
860 | ;
|
---|
861 | !macro InstallFileVerify un FileSrc FileDest DirTemp Vendor Architecture
|
---|
862 | Push $0
|
---|
863 | Push "${Architecture}"
|
---|
864 | Push "${Vendor}"
|
---|
865 | Push "${FileSrc}"
|
---|
866 | ${LogVerbose} "Verifying library $\"${FileSrc}$\" ..."
|
---|
867 | Call ${un}VerifyFile
|
---|
868 | Pop $0
|
---|
869 | ${If} $0 == "0"
|
---|
870 | ${InstallFileEx} ${un} ${FileSrc} ${FileDest} ${DirTemp}
|
---|
871 | ${Else}
|
---|
872 | ${LogVerbose} "File $\"${FileSrc}$\" did not pass verification (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
873 | ${EndIf}
|
---|
874 | ; Push result popped off the stack to stack again.
|
---|
875 | Push $0
|
---|
876 | !macroend
|
---|
877 | !define InstallFileVerify "!insertmacro InstallFileVerify"
|
---|
878 |
|
---|
879 | ; Prepares the access rights for replacing
|
---|
880 | ; a WRP (Windows Resource Protection) protected file
|
---|
881 | !macro PrepareWRPFile un
|
---|
882 | Function ${un}PrepareWRPFile
|
---|
883 |
|
---|
884 | Pop $0
|
---|
885 | Push $1
|
---|
886 |
|
---|
887 | ${IfNot} ${FileExists} "$0"
|
---|
888 | ${LogVerbose} "WRP: File $\"$0$\" does not exist, skipping"
|
---|
889 | Return
|
---|
890 | ${EndIf}
|
---|
891 |
|
---|
892 | ${If} ${FileExists} "$g_strSystemDir\takeown.exe"
|
---|
893 | ${CmdExecute} "$\"$g_strSystemDir\takeown.exe$\" /F $\"$0$\"" "true"
|
---|
894 | ${Else}
|
---|
895 | ${LogVerbose} "WRP: Warning: takeown.exe not found, skipping"
|
---|
896 | ${EndIf}
|
---|
897 |
|
---|
898 | AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
|
---|
899 | Pop $1
|
---|
900 | ${LogVerbose} "WRP: Setting file owner for $\"$0$\" returned: $1"
|
---|
901 |
|
---|
902 | AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
|
---|
903 | Pop $1
|
---|
904 | ${LogVerbose} "WRP: Setting access rights for $\"$0$\" returned: $1"
|
---|
905 |
|
---|
906 | !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
|
---|
907 | !ifdef WFP_FILE_EXCEPTION
|
---|
908 | VBoxGuestInstallHelper::DisableWFP "$0"
|
---|
909 | Pop $1 ; Get return value (ignored for now)
|
---|
910 | ${LogVerbose} "WRP: Setting WFP exception for $\"$0$\" returned: $1"
|
---|
911 | !endif
|
---|
912 | !endif
|
---|
913 |
|
---|
914 | Pop $1
|
---|
915 |
|
---|
916 | FunctionEnd
|
---|
917 | !macroend
|
---|
918 | !insertmacro PrepareWRPFile ""
|
---|
919 | !insertmacro PrepareWRPFile "un."
|
---|
920 |
|
---|
921 | ;
|
---|
922 | ; Macro for preparing the access rights for replacing
|
---|
923 | ; a WRP (Windows Resource Protection) protected file.
|
---|
924 | ; @return None.
|
---|
925 | ; @param Path of file to prepare.
|
---|
926 | ;
|
---|
927 | !macro PrepareWRPFileEx un FileSrc
|
---|
928 | Push $0
|
---|
929 | Push "${FileSrc}"
|
---|
930 | Call ${un}PrepareWRPFile
|
---|
931 | Pop $0
|
---|
932 | !macroend
|
---|
933 | !define PrepareWRPFileEx "!insertmacro PrepareWRPFileEx"
|
---|
934 |
|
---|
935 | ;
|
---|
936 | ; Validates backed up and replaced Direct3D files; either the d3d*.dll have
|
---|
937 | ; to be from Microsoft or the (already) backed up msd3d*.dll files. If both
|
---|
938 | ; don't match we have a corrupted / invalid installation.
|
---|
939 | ; @return Stack: "0" if files are valid; otherwise "1".
|
---|
940 | ;
|
---|
941 | !macro ValidateFilesDirect3D un
|
---|
942 | Function ${un}ValidateD3DFiles
|
---|
943 |
|
---|
944 | Push $0
|
---|
945 |
|
---|
946 | ; We need to switch to 64-bit app mode to handle the "real" 64-bit files in
|
---|
947 | ; "system32" on a 64-bit guest
|
---|
948 | Call ${un}SetAppMode64
|
---|
949 |
|
---|
950 | ; Note: Not finding a file (like *d3d8.dll) on Windows Vista/7 is fine;
|
---|
951 | ; it simply is not present there.
|
---|
952 |
|
---|
953 | ; Note 2: On 64-bit systems there are no 64-bit *d3d8 DLLs, only 32-bit ones
|
---|
954 | ; in SysWOW64 (or in system32 on 32-bit systems).
|
---|
955 |
|
---|
956 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
957 | ${VerifyFileEx} "${un}" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
958 | Pop $0
|
---|
959 | ${If} $0 == "1"
|
---|
960 | Goto verify_msd3d
|
---|
961 | ${EndIf}
|
---|
962 | !endif
|
---|
963 |
|
---|
964 | ${VerifyFileEx} "${un}" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
965 | Pop $0
|
---|
966 | ${If} $0 == "1"
|
---|
967 | Goto verify_msd3d
|
---|
968 | ${EndIf}
|
---|
969 |
|
---|
970 | ${If} $g_bCapDllCache == "true"
|
---|
971 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
972 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
973 | Pop $0
|
---|
974 | ${If} $0 == "1"
|
---|
975 | Goto verify_msd3d
|
---|
976 | ${EndIf}
|
---|
977 | !endif
|
---|
978 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
979 | Pop $0
|
---|
980 | ${If} $0 == "1"
|
---|
981 | Goto verify_msd3d
|
---|
982 | ${EndIf}
|
---|
983 | ${EndIf}
|
---|
984 |
|
---|
985 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
986 | ${VerifyFileEx} "${un}" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
987 | Pop $0
|
---|
988 | ${If} $0 == "1"
|
---|
989 | Goto verify_msd3d
|
---|
990 | ${EndIf}
|
---|
991 | ${VerifyFileEx} "${un}" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
992 | Pop $0
|
---|
993 | ${If} $0 == "1"
|
---|
994 | Goto verify_msd3d
|
---|
995 | ${EndIf}
|
---|
996 |
|
---|
997 | ${If} $g_bCapDllCache == "true"
|
---|
998 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
999 | Pop $0
|
---|
1000 | ${If} $0 == "1"
|
---|
1001 | Goto verify_msd3d
|
---|
1002 | ${EndIf}
|
---|
1003 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
1004 | Pop $0
|
---|
1005 | ${If} $0 == "1"
|
---|
1006 | Goto verify_msd3d
|
---|
1007 | ${EndIf}
|
---|
1008 | ${EndIf}
|
---|
1009 |
|
---|
1010 | !endif
|
---|
1011 |
|
---|
1012 | Goto valid
|
---|
1013 |
|
---|
1014 | verify_msd3d:
|
---|
1015 |
|
---|
1016 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1017 | ${VerifyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1018 | Pop $0
|
---|
1019 | ${If} $0 == "1"
|
---|
1020 | Goto invalid
|
---|
1021 | ${EndIf}
|
---|
1022 | !endif
|
---|
1023 | ${VerifyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1024 | Pop $0
|
---|
1025 | ${If} $0 == "1"
|
---|
1026 | Goto invalid
|
---|
1027 | ${EndIf}
|
---|
1028 |
|
---|
1029 | ${If} $g_bCapDllCache == "true"
|
---|
1030 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1031 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1032 | Pop $0
|
---|
1033 | ${If} $0 == "1"
|
---|
1034 | Goto invalid
|
---|
1035 | ${EndIf}
|
---|
1036 | !endif
|
---|
1037 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1038 | Pop $0
|
---|
1039 | ${If} $0 == "1"
|
---|
1040 | Goto invalid
|
---|
1041 | ${EndIf}
|
---|
1042 | ${EndIf}
|
---|
1043 |
|
---|
1044 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
1045 | ${VerifyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "Microsoft Corporation" "x86"
|
---|
1046 | Pop $0
|
---|
1047 | ${If} $0 == "1"
|
---|
1048 | Goto invalid
|
---|
1049 | ${EndIf}
|
---|
1050 | ${VerifyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "Microsoft Corporation" "x86"
|
---|
1051 | Pop $0
|
---|
1052 | ${If} $0 == "1"
|
---|
1053 | Goto invalid
|
---|
1054 | ${EndIf}
|
---|
1055 |
|
---|
1056 | ${If} $g_bCapDllCache == "true"
|
---|
1057 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "Microsoft Corporation" "x86"
|
---|
1058 | Pop $0
|
---|
1059 | ${If} $0 == "1"
|
---|
1060 | Goto invalid
|
---|
1061 | ${EndIf}
|
---|
1062 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "Microsoft Corporation" "x86"
|
---|
1063 | Pop $0
|
---|
1064 | ${If} $0 == "1"
|
---|
1065 | Goto invalid
|
---|
1066 | ${EndIf}
|
---|
1067 | ${EndIf}
|
---|
1068 | !endif
|
---|
1069 |
|
---|
1070 | Goto valid
|
---|
1071 |
|
---|
1072 | valid:
|
---|
1073 |
|
---|
1074 | StrCpy $0 "0" ; Installation valid
|
---|
1075 | Goto end
|
---|
1076 |
|
---|
1077 | invalid:
|
---|
1078 |
|
---|
1079 | StrCpy $0 "1" ; Installation invalid / corrupted
|
---|
1080 | Goto end
|
---|
1081 |
|
---|
1082 | end:
|
---|
1083 |
|
---|
1084 | Exch $0
|
---|
1085 |
|
---|
1086 | FunctionEnd
|
---|
1087 | !macroend
|
---|
1088 | !insertmacro ValidateFilesDirect3D ""
|
---|
1089 | !insertmacro ValidateFilesDirect3D "un."
|
---|
1090 |
|
---|
1091 | ;
|
---|
1092 | ; Restores formerly backed up Direct3D original files, which were replaced by
|
---|
1093 | ; a VBox XPDM driver installation before. This might be necessary for upgrading a
|
---|
1094 | ; XPDM installation to a WDDM one.
|
---|
1095 | ; @return Stack: "0" if files were restored successfully; otherwise "1".
|
---|
1096 | ;
|
---|
1097 | !macro RestoreFilesDirect3D un
|
---|
1098 | Function ${un}RestoreFilesDirect3D
|
---|
1099 |
|
---|
1100 | Push $0
|
---|
1101 |
|
---|
1102 | ; We need to switch to 64-bit app mode to handle the "real" 64-bit files in
|
---|
1103 | ; "system32" on a 64-bit guest
|
---|
1104 | Call ${un}SetAppMode64
|
---|
1105 |
|
---|
1106 | ; Note: Not finding a file (like *d3d8.dll) on Windows Vista/7 is fine;
|
---|
1107 | ; it simply is not present there.
|
---|
1108 |
|
---|
1109 | ; Note 2: On 64-bit systems there are no 64-bit *d3d8 DLLs, only 32-bit ones
|
---|
1110 | ; in SysWOW64 (or in system32 on 32-bit systems).
|
---|
1111 |
|
---|
1112 | ${LogVerbose} "Restoring original D3D files ..."
|
---|
1113 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1114 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\d3d8.dll"
|
---|
1115 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1116 | !endif
|
---|
1117 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\d3d9.dll"
|
---|
1118 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1119 |
|
---|
1120 | ${If} $g_bCapDllCache == "true"
|
---|
1121 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1122 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d8.dll"
|
---|
1123 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1124 | !endif
|
---|
1125 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d9.dll"
|
---|
1126 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1127 | ${EndIf}
|
---|
1128 |
|
---|
1129 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
1130 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d8.dll"
|
---|
1131 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
1132 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d9.dll"
|
---|
1133 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
1134 |
|
---|
1135 | ${If} $g_bCapDllCache == "true"
|
---|
1136 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d8.dll"
|
---|
1137 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
1138 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d9.dll"
|
---|
1139 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
1140 | ${EndIf}
|
---|
1141 | !endif
|
---|
1142 |
|
---|
1143 | ; Do a re-validation afterwards.
|
---|
1144 | Call ${un}ValidateD3DFiles
|
---|
1145 | Pop $0
|
---|
1146 | ${If} $0 == "1" ; D3D files are invalid
|
---|
1147 | ${LogVerbose} $(VBOX_UNINST_UNABLE_TO_RESTORE_D3D)
|
---|
1148 | MessageBox MB_ICONSTOP|MB_OK $(VBOX_UNINST_UNABLE_TO_RESTORE_D3D) /SD IDOK
|
---|
1149 | ${EndIf}
|
---|
1150 |
|
---|
1151 | Exch $0
|
---|
1152 |
|
---|
1153 | FunctionEnd
|
---|
1154 | !macroend
|
---|
1155 | !insertmacro RestoreFilesDirect3D ""
|
---|
1156 | !insertmacro RestoreFilesDirect3D "un."
|
---|