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 | StrCpy $g_bCapWDDM "true"
|
---|
548 | ${LogVerbose} "OS is WDDM driver capable"
|
---|
549 | ${EndIf}
|
---|
550 | ; If we're on Windows 8 we *have* to use the WDDM driver, so select it
|
---|
551 | ; by default
|
---|
552 | ${If} $g_strWinVersion == "8"
|
---|
553 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
554 | StrCpy $g_bWithWDDM "true"
|
---|
555 | ${LogVerbose} "OS needs WDDM driver by default"
|
---|
556 | ${EndIf}
|
---|
557 | !endif
|
---|
558 |
|
---|
559 | FunctionEnd
|
---|
560 | !macroend
|
---|
561 | !insertmacro CheckForWDDMCapability ""
|
---|
562 | !insertmacro CheckForWDDMCapability "un."
|
---|
563 |
|
---|
564 | !macro CheckForCapabilities un
|
---|
565 | Function ${un}CheckForCapabilities
|
---|
566 |
|
---|
567 | Push $0
|
---|
568 |
|
---|
569 | ; Retrieve system mode and store result in
|
---|
570 | System::Call 'user32::GetSystemMetrics(i ${SM_CLEANBOOT}) i .r0'
|
---|
571 | StrCpy $g_iSystemMode $0
|
---|
572 |
|
---|
573 | ; Does the guest have a DLL cache?
|
---|
574 | ${If} $g_strWinVersion == "Vista"
|
---|
575 | ${OrIf} $g_strWinVersion == "7"
|
---|
576 | ${OrIf} $g_strWinVersion == "8"
|
---|
577 | ${OrIf} $g_strWinVersion == "8_1"
|
---|
578 | StrCpy $g_bCapDllCache "true"
|
---|
579 | ${LogVerbose} "OS has a DLL cache"
|
---|
580 | ${EndIf}
|
---|
581 |
|
---|
582 | ; Check whether this OS is capable of handling WDDM drivers
|
---|
583 | Call ${un}CheckForWDDMCapability
|
---|
584 |
|
---|
585 | Pop $0
|
---|
586 |
|
---|
587 | FunctionEnd
|
---|
588 | !macroend
|
---|
589 | !insertmacro CheckForCapabilities ""
|
---|
590 | !insertmacro CheckForCapabilities "un."
|
---|
591 |
|
---|
592 | ; Switches (back) the path + registry view to
|
---|
593 | ; 32-bit mode (SysWOW64) on 64-bit guests
|
---|
594 | !macro SetAppMode32 un
|
---|
595 | Function ${un}SetAppMode32
|
---|
596 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
597 | ${EnableX64FSRedirection}
|
---|
598 | SetRegView 32
|
---|
599 | !endif
|
---|
600 | FunctionEnd
|
---|
601 | !macroend
|
---|
602 | !insertmacro SetAppMode32 ""
|
---|
603 | !insertmacro SetAppMode32 "un."
|
---|
604 |
|
---|
605 | ; Because this NSIS installer is always built in 32-bit mode, we have to
|
---|
606 | ; do some tricks for the Windows paths + registry on 64-bit guests
|
---|
607 | !macro SetAppMode64 un
|
---|
608 | Function ${un}SetAppMode64
|
---|
609 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
610 | ${DisableX64FSRedirection}
|
---|
611 | SetRegView 64
|
---|
612 | !endif
|
---|
613 | FunctionEnd
|
---|
614 | !macroend
|
---|
615 | !insertmacro SetAppMode64 ""
|
---|
616 | !insertmacro SetAppMode64 "un."
|
---|
617 |
|
---|
618 | ;
|
---|
619 | ; Retrieves the vendor ("CompanyName" of FILEINFO structure)
|
---|
620 | ; of a given file.
|
---|
621 | ; @return Stack: Company name, or "" on error/if not found.
|
---|
622 | ; @param Stack: File name to retrieve vendor for.
|
---|
623 | ;
|
---|
624 | !macro GetFileVendor un
|
---|
625 | Function ${un}GetFileVendor
|
---|
626 |
|
---|
627 | ; Preserve values
|
---|
628 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
629 | Push $1
|
---|
630 |
|
---|
631 | IfFileExists "$0" found
|
---|
632 | Goto not_found
|
---|
633 |
|
---|
634 | found:
|
---|
635 |
|
---|
636 | VBoxGuestInstallHelper::FileGetVendor "$0"
|
---|
637 | ; Stack: <vendor> $1 $0
|
---|
638 | Pop $0 ; Get vendor
|
---|
639 | Pop $1 ; Restore $1
|
---|
640 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
641 | Goto end
|
---|
642 |
|
---|
643 | not_found:
|
---|
644 |
|
---|
645 | Pop $1
|
---|
646 | Pop $0
|
---|
647 | Push "File not found"
|
---|
648 | Goto end
|
---|
649 |
|
---|
650 | end:
|
---|
651 |
|
---|
652 | FunctionEnd
|
---|
653 | !macroend
|
---|
654 | !insertmacro GetFileVendor ""
|
---|
655 | !insertmacro GetFileVendor "un."
|
---|
656 |
|
---|
657 | ;
|
---|
658 | ; Retrieves the architecture of a given file.
|
---|
659 | ; @return Stack: Architecture ("x86", "amd64") or error message.
|
---|
660 | ; @param Stack: File name to retrieve architecture for.
|
---|
661 | ;
|
---|
662 | !macro GetFileArchitecture un
|
---|
663 | Function ${un}GetFileArchitecture
|
---|
664 |
|
---|
665 | ; Preserve values
|
---|
666 | Exch $0 ; Stack: $0 <filename> (Get file name into $0)
|
---|
667 | Push $1
|
---|
668 |
|
---|
669 | IfFileExists "$0" found
|
---|
670 | Goto not_found
|
---|
671 |
|
---|
672 | found:
|
---|
673 |
|
---|
674 | VBoxGuestInstallHelper::FileGetArchitecture "$0"
|
---|
675 | ; Stack: <architecture> $1 $0
|
---|
676 | Pop $0 ; Get architecture string
|
---|
677 | Pop $1 ; Restore $1
|
---|
678 | Exch $0 ; Restore $0, push vendor on top of stack
|
---|
679 | Goto end
|
---|
680 |
|
---|
681 | not_found:
|
---|
682 |
|
---|
683 | Pop $1
|
---|
684 | Pop $0
|
---|
685 | Push "File not found"
|
---|
686 | Goto end
|
---|
687 |
|
---|
688 | end:
|
---|
689 |
|
---|
690 | FunctionEnd
|
---|
691 | !macroend
|
---|
692 | !insertmacro GetFileArchitecture ""
|
---|
693 | !insertmacro GetFileArchitecture "un."
|
---|
694 |
|
---|
695 | ;
|
---|
696 | ; Verifies a given file by checking its file vendor and target
|
---|
697 | ; architecture.
|
---|
698 | ; @return Stack: "0" if valid, "1" if not, "2" on error / not found.
|
---|
699 | ; @param Stack: Architecture ("x86" or "amd64").
|
---|
700 | ; @param Stack: Vendor.
|
---|
701 | ; @param Stack: File name to verify.
|
---|
702 | ;
|
---|
703 | !macro VerifyFile un
|
---|
704 | Function ${un}VerifyFile
|
---|
705 |
|
---|
706 | ; Preserve values
|
---|
707 | Exch $0 ; File; S: old$0 vendor arch
|
---|
708 | Exch ; S: vendor old$0 arch
|
---|
709 | Exch $1 ; Vendor; S: old$1 old$0 arch
|
---|
710 | Exch ; S: old$0 old$1 arch
|
---|
711 | Exch 2 ; S: arch old$1 old$0
|
---|
712 | Exch $2 ; Architecture; S: old$2 old$1 old$0
|
---|
713 | Push $3 ; S: old$3 old$2 old$1 old$0
|
---|
714 |
|
---|
715 | IfFileExists "$0" check_vendor
|
---|
716 | Goto not_found
|
---|
717 |
|
---|
718 | check_vendor:
|
---|
719 |
|
---|
720 | Push $0
|
---|
721 | Call ${un}GetFileVendor
|
---|
722 | Pop $3
|
---|
723 |
|
---|
724 | ${If} $3 == $1
|
---|
725 | Goto check_arch
|
---|
726 | ${EndIf}
|
---|
727 | StrCpy $3 "1" ; Invalid
|
---|
728 | Goto end
|
---|
729 |
|
---|
730 | check_arch:
|
---|
731 |
|
---|
732 | Push $0
|
---|
733 | Call ${un}GetFileArchitecture
|
---|
734 | Pop $3
|
---|
735 |
|
---|
736 | ${If} $3 == $2
|
---|
737 | StrCpy $3 "0" ; Valid
|
---|
738 | ${Else}
|
---|
739 | StrCpy $3 "1" ; Invalid
|
---|
740 | ${EndIf}
|
---|
741 | Goto end
|
---|
742 |
|
---|
743 | not_found:
|
---|
744 |
|
---|
745 | StrCpy $3 "2" ; Not found
|
---|
746 | Goto end
|
---|
747 |
|
---|
748 | end:
|
---|
749 |
|
---|
750 | ; S: old$3 old$2 old$1 old$0
|
---|
751 | Exch $3 ; S: $3 old$2 old$1 old$0
|
---|
752 | Exch ; S: old$2 $3 old$1
|
---|
753 | Pop $2 ; S: $3 old$1 old$0
|
---|
754 | Exch ; S: old$1 $3 old$0
|
---|
755 | Pop $1 ; S: $3 old$0
|
---|
756 | Exch ; S: old$0 $3
|
---|
757 | Pop $0 ; S: $3
|
---|
758 |
|
---|
759 | FunctionEnd
|
---|
760 | !macroend
|
---|
761 | !insertmacro VerifyFile ""
|
---|
762 | !insertmacro VerifyFile "un."
|
---|
763 |
|
---|
764 | ;
|
---|
765 | ; Macro for accessing VerifyFile in a more convenient way by using
|
---|
766 | ; a parameter list.
|
---|
767 | ; @return Stack: "0" if valid, "1" if not, "2" on error / not found.
|
---|
768 | ; @param Un/Installer prefix; either "" or "un".
|
---|
769 | ; @param Name of file to verify.
|
---|
770 | ; @param Vendor to check for.
|
---|
771 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
772 | ;
|
---|
773 | !macro VerifyFileEx un File Vendor Architecture
|
---|
774 | Push $0
|
---|
775 | Push "${Architecture}"
|
---|
776 | Push "${Vendor}"
|
---|
777 | Push "${File}"
|
---|
778 | ${LogVerbose} "Verifying file $\"${File}$\" ..."
|
---|
779 | Call ${un}VerifyFile
|
---|
780 | Pop $0
|
---|
781 | ${If} $0 == "0"
|
---|
782 | ${LogVerbose} "Verification of file $\"${File}$\" successful (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
783 | ${ElseIf} $0 == "1"
|
---|
784 | ${LogVerbose} "Verification of file $\"${File}$\" failed (not Vendor: ${Vendor}, and/or not Architecture: ${Architecture})"
|
---|
785 | ${Else}
|
---|
786 | ${LogVerbose} "Skipping to file $\"${File}$\"; not found"
|
---|
787 | ${EndIf}
|
---|
788 | ; Push result popped off the stack to stack again
|
---|
789 | Push $0
|
---|
790 | !macroend
|
---|
791 | !define VerifyFileEx "!insertmacro VerifyFileEx"
|
---|
792 |
|
---|
793 | ;
|
---|
794 | ; Macro for copying a file only if the source file is verified
|
---|
795 | ; to be from a certain vendor and architecture.
|
---|
796 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
797 | ; @param Un/Installer prefix; either "" or "un".
|
---|
798 | ; @param Name of file to verify and copy to destination.
|
---|
799 | ; @param Destination name to copy verified file to.
|
---|
800 | ; @param Vendor to check for.
|
---|
801 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
802 | ;
|
---|
803 | !macro CopyFileEx un FileSrc FileDest Vendor Architecture
|
---|
804 | Push $0
|
---|
805 | Push "${Architecture}"
|
---|
806 | Push "${Vendor}"
|
---|
807 | Push "${FileSrc}"
|
---|
808 | Call ${un}VerifyFile
|
---|
809 | Pop $0
|
---|
810 | ${If} $0 == "0"
|
---|
811 | ${LogVerbose} "Copying verified file $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
812 | ClearErrors
|
---|
813 | SetOverwrite on
|
---|
814 | CopyFiles /SILENT "${FileSrc}" "${FileDest}"
|
---|
815 | ${If} ${Errors}
|
---|
816 | CreateDirectory "$TEMP\${PRODUCT_NAME}"
|
---|
817 | ${GetFileName} "${FileSrc}" $0 ; Get the base name
|
---|
818 | CopyFiles /SILENT "${FileSrc}" "$TEMP\${PRODUCT_NAME}\$0"
|
---|
819 | ${LogVerbose} "Immediate installation failed, postponing to next reboot (temporary location is: $\"$TEMP\${PRODUCT_NAME}\$0$\") ..."
|
---|
820 | ;${InstallFileEx} "${un}" "${FileSrc}" "${FileDest}" "$TEMP" ; Only works with compile time files!
|
---|
821 | System::Call "kernel32::MoveFileEx(t '$TEMP\${PRODUCT_NAME}\$0', t '${FileDest}', i 5)"
|
---|
822 | ${EndIf}
|
---|
823 | ${Else}
|
---|
824 | ${LogVerbose} "Skipping to copy file $\"${FileSrc}$\" to $\"${FileDest}$\" (not Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
825 | ${EndIf}
|
---|
826 | ; Push result popped off the stack to stack again
|
---|
827 | Push $0
|
---|
828 | !macroend
|
---|
829 | !define CopyFileEx "!insertmacro CopyFileEx"
|
---|
830 |
|
---|
831 | ;
|
---|
832 | ; Macro for installing a library/DLL.
|
---|
833 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
834 | ; @param Un/Installer prefix; either "" or "un".
|
---|
835 | ; @param Name of lib/DLL to copy to destination.
|
---|
836 | ; @param Destination name to copy the source file to.
|
---|
837 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
838 | ;
|
---|
839 | !macro InstallFileEx un FileSrc FileDest DirTemp
|
---|
840 | ${LogVerbose} "Installing library $\"${FileSrc}$\" to $\"${FileDest}$\" ..."
|
---|
841 | ; Try the gentle way and replace the file instantly
|
---|
842 | !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
843 | ; If the above call didn't help, use a (later) reboot to replace the file
|
---|
844 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "${FileSrc}" "${FileDest}" "${DirTemp}"
|
---|
845 | !macroend
|
---|
846 | !define InstallFileEx "!insertmacro InstallFileEx"
|
---|
847 |
|
---|
848 | ;
|
---|
849 | ; Macro for installing a library/DLL.
|
---|
850 | ; @return Stack: "0" if copied, "1" if not, "2" on error / not found.
|
---|
851 | ; @param Un/Installer prefix; either "" or "un".
|
---|
852 | ; @param Name of lib/DLL to verify and copy to destination.
|
---|
853 | ; @param Destination name to copy verified file to.
|
---|
854 | ; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
|
---|
855 | ; @param Vendor to check for.
|
---|
856 | ; @param Architecture ("x86" or "amd64") to check for.
|
---|
857 | ;
|
---|
858 | !macro InstallFileVerify un FileSrc FileDest DirTemp Vendor Architecture
|
---|
859 | Push $0
|
---|
860 | Push "${Architecture}"
|
---|
861 | Push "${Vendor}"
|
---|
862 | Push "${FileSrc}"
|
---|
863 | ${LogVerbose} "Verifying library $\"${FileSrc}$\" ..."
|
---|
864 | Call ${un}VerifyFile
|
---|
865 | Pop $0
|
---|
866 | ${If} $0 == "0"
|
---|
867 | ${InstallFileEx} ${un} ${FileSrc} ${FileDest} ${DirTemp}
|
---|
868 | ${Else}
|
---|
869 | ${LogVerbose} "File $\"${FileSrc}$\" did not pass verification (Vendor: ${Vendor}, Architecture: ${Architecture})"
|
---|
870 | ${EndIf}
|
---|
871 | ; Push result popped off the stack to stack again.
|
---|
872 | Push $0
|
---|
873 | !macroend
|
---|
874 | !define InstallFileVerify "!insertmacro InstallFileVerify"
|
---|
875 |
|
---|
876 | ; Prepares the access rights for replacing
|
---|
877 | ; a WRP (Windows Resource Protection) protected file
|
---|
878 | !macro PrepareWRPFile un
|
---|
879 | Function ${un}PrepareWRPFile
|
---|
880 |
|
---|
881 | Pop $0
|
---|
882 | Push $1
|
---|
883 |
|
---|
884 | ${IfNot} ${FileExists} "$0"
|
---|
885 | ${LogVerbose} "WRP: File $\"$0$\" does not exist, skipping"
|
---|
886 | Return
|
---|
887 | ${EndIf}
|
---|
888 |
|
---|
889 | ${If} ${FileExists} "$g_strSystemDir\takeown.exe"
|
---|
890 | ${CmdExecute} "$\"$g_strSystemDir\takeown.exe$\" /F $\"$0$\"" "true"
|
---|
891 | ${Else}
|
---|
892 | ${LogVerbose} "WRP: Warning: takeown.exe not found, skipping"
|
---|
893 | ${EndIf}
|
---|
894 |
|
---|
895 | AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
|
---|
896 | Pop $1
|
---|
897 | ${LogVerbose} "WRP: Setting file owner for $\"$0$\" returned: $1"
|
---|
898 |
|
---|
899 | AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
|
---|
900 | Pop $1
|
---|
901 | ${LogVerbose} "WRP: Setting access rights for $\"$0$\" returned: $1"
|
---|
902 |
|
---|
903 | !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
|
---|
904 | !ifdef WFP_FILE_EXCEPTION
|
---|
905 | VBoxGuestInstallHelper::DisableWFP "$0"
|
---|
906 | Pop $1 ; Get return value (ignored for now)
|
---|
907 | ${LogVerbose} "WRP: Setting WFP exception for $\"$0$\" returned: $1"
|
---|
908 | !endif
|
---|
909 | !endif
|
---|
910 |
|
---|
911 | Pop $1
|
---|
912 |
|
---|
913 | FunctionEnd
|
---|
914 | !macroend
|
---|
915 | !insertmacro PrepareWRPFile ""
|
---|
916 | !insertmacro PrepareWRPFile "un."
|
---|
917 |
|
---|
918 | ;
|
---|
919 | ; Macro for preparing the access rights for replacing
|
---|
920 | ; a WRP (Windows Resource Protection) protected file.
|
---|
921 | ; @return None.
|
---|
922 | ; @param Path of file to prepare.
|
---|
923 | ;
|
---|
924 | !macro PrepareWRPFileEx un FileSrc
|
---|
925 | Push $0
|
---|
926 | Push "${FileSrc}"
|
---|
927 | Call ${un}PrepareWRPFile
|
---|
928 | Pop $0
|
---|
929 | !macroend
|
---|
930 | !define PrepareWRPFileEx "!insertmacro PrepareWRPFileEx"
|
---|
931 |
|
---|
932 | ;
|
---|
933 | ; Validates backed up and replaced Direct3D files; either the d3d*.dll have
|
---|
934 | ; to be from Microsoft or the (already) backed up msd3d*.dll files. If both
|
---|
935 | ; don't match we have a corrupted / invalid installation.
|
---|
936 | ; @return Stack: "0" if files are valid; otherwise "1".
|
---|
937 | ;
|
---|
938 | !macro ValidateFilesDirect3D un
|
---|
939 | Function ${un}ValidateD3DFiles
|
---|
940 |
|
---|
941 | Push $0
|
---|
942 |
|
---|
943 | ; We need to switch to 64-bit app mode to handle the "real" 64-bit files in
|
---|
944 | ; "system32" on a 64-bit guest
|
---|
945 | Call ${un}SetAppMode64
|
---|
946 |
|
---|
947 | ; Note: Not finding a file (like *d3d8.dll) on Windows Vista/7 is fine;
|
---|
948 | ; it simply is not present there.
|
---|
949 |
|
---|
950 | ; Note 2: On 64-bit systems there are no 64-bit *d3d8 DLLs, only 32-bit ones
|
---|
951 | ; in SysWOW64 (or in system32 on 32-bit systems).
|
---|
952 |
|
---|
953 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
954 | ${VerifyFileEx} "${un}" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
955 | Pop $0
|
---|
956 | ${If} $0 == "1"
|
---|
957 | Goto verify_msd3d
|
---|
958 | ${EndIf}
|
---|
959 | !endif
|
---|
960 |
|
---|
961 | ${VerifyFileEx} "${un}" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
962 | Pop $0
|
---|
963 | ${If} $0 == "1"
|
---|
964 | Goto verify_msd3d
|
---|
965 | ${EndIf}
|
---|
966 |
|
---|
967 | ${If} $g_bCapDllCache == "true"
|
---|
968 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
969 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
970 | Pop $0
|
---|
971 | ${If} $0 == "1"
|
---|
972 | Goto verify_msd3d
|
---|
973 | ${EndIf}
|
---|
974 | !endif
|
---|
975 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
976 | Pop $0
|
---|
977 | ${If} $0 == "1"
|
---|
978 | Goto verify_msd3d
|
---|
979 | ${EndIf}
|
---|
980 | ${EndIf}
|
---|
981 |
|
---|
982 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
983 | ${VerifyFileEx} "${un}" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
984 | Pop $0
|
---|
985 | ${If} $0 == "1"
|
---|
986 | Goto verify_msd3d
|
---|
987 | ${EndIf}
|
---|
988 | ${VerifyFileEx} "${un}" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
989 | Pop $0
|
---|
990 | ${If} $0 == "1"
|
---|
991 | Goto verify_msd3d
|
---|
992 | ${EndIf}
|
---|
993 |
|
---|
994 | ${If} $g_bCapDllCache == "true"
|
---|
995 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
996 | Pop $0
|
---|
997 | ${If} $0 == "1"
|
---|
998 | Goto verify_msd3d
|
---|
999 | ${EndIf}
|
---|
1000 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
1001 | Pop $0
|
---|
1002 | ${If} $0 == "1"
|
---|
1003 | Goto verify_msd3d
|
---|
1004 | ${EndIf}
|
---|
1005 | ${EndIf}
|
---|
1006 |
|
---|
1007 | !endif
|
---|
1008 |
|
---|
1009 | Goto valid
|
---|
1010 |
|
---|
1011 | verify_msd3d:
|
---|
1012 |
|
---|
1013 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1014 | ${VerifyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1015 | Pop $0
|
---|
1016 | ${If} $0 == "1"
|
---|
1017 | Goto invalid
|
---|
1018 | ${EndIf}
|
---|
1019 | !endif
|
---|
1020 | ${VerifyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1021 | Pop $0
|
---|
1022 | ${If} $0 == "1"
|
---|
1023 | Goto invalid
|
---|
1024 | ${EndIf}
|
---|
1025 |
|
---|
1026 | ${If} $g_bCapDllCache == "true"
|
---|
1027 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1028 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1029 | Pop $0
|
---|
1030 | ${If} $0 == "1"
|
---|
1031 | Goto invalid
|
---|
1032 | ${EndIf}
|
---|
1033 | !endif
|
---|
1034 | ${VerifyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1035 | Pop $0
|
---|
1036 | ${If} $0 == "1"
|
---|
1037 | Goto invalid
|
---|
1038 | ${EndIf}
|
---|
1039 | ${EndIf}
|
---|
1040 |
|
---|
1041 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
1042 | ${VerifyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "Microsoft Corporation" "x86"
|
---|
1043 | Pop $0
|
---|
1044 | ${If} $0 == "1"
|
---|
1045 | Goto invalid
|
---|
1046 | ${EndIf}
|
---|
1047 | ${VerifyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "Microsoft Corporation" "x86"
|
---|
1048 | Pop $0
|
---|
1049 | ${If} $0 == "1"
|
---|
1050 | Goto invalid
|
---|
1051 | ${EndIf}
|
---|
1052 |
|
---|
1053 | ${If} $g_bCapDllCache == "true"
|
---|
1054 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "Microsoft Corporation" "x86"
|
---|
1055 | Pop $0
|
---|
1056 | ${If} $0 == "1"
|
---|
1057 | Goto invalid
|
---|
1058 | ${EndIf}
|
---|
1059 | ${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "Microsoft Corporation" "x86"
|
---|
1060 | Pop $0
|
---|
1061 | ${If} $0 == "1"
|
---|
1062 | Goto invalid
|
---|
1063 | ${EndIf}
|
---|
1064 | ${EndIf}
|
---|
1065 | !endif
|
---|
1066 |
|
---|
1067 | Goto valid
|
---|
1068 |
|
---|
1069 | valid:
|
---|
1070 |
|
---|
1071 | StrCpy $0 "0" ; Installation valid
|
---|
1072 | Goto end
|
---|
1073 |
|
---|
1074 | invalid:
|
---|
1075 |
|
---|
1076 | StrCpy $0 "1" ; Installation invalid / corrupted
|
---|
1077 | Goto end
|
---|
1078 |
|
---|
1079 | end:
|
---|
1080 |
|
---|
1081 | Exch $0
|
---|
1082 |
|
---|
1083 | FunctionEnd
|
---|
1084 | !macroend
|
---|
1085 | !insertmacro ValidateFilesDirect3D ""
|
---|
1086 | !insertmacro ValidateFilesDirect3D "un."
|
---|
1087 |
|
---|
1088 | ;
|
---|
1089 | ; Restores formerly backed up Direct3D original files, which were replaced by
|
---|
1090 | ; a VBox XPDM driver installation before. This might be necessary for upgrading a
|
---|
1091 | ; XPDM installation to a WDDM one.
|
---|
1092 | ; @return Stack: "0" if files were restored successfully; otherwise "1".
|
---|
1093 | ;
|
---|
1094 | !macro RestoreFilesDirect3D un
|
---|
1095 | Function ${un}RestoreFilesDirect3D
|
---|
1096 |
|
---|
1097 | Push $0
|
---|
1098 |
|
---|
1099 | ; We need to switch to 64-bit app mode to handle the "real" 64-bit files in
|
---|
1100 | ; "system32" on a 64-bit guest
|
---|
1101 | Call ${un}SetAppMode64
|
---|
1102 |
|
---|
1103 | ; Note: Not finding a file (like *d3d8.dll) on Windows Vista/7 is fine;
|
---|
1104 | ; it simply is not present there.
|
---|
1105 |
|
---|
1106 | ; Note 2: On 64-bit systems there are no 64-bit *d3d8 DLLs, only 32-bit ones
|
---|
1107 | ; in SysWOW64 (or in system32 on 32-bit systems).
|
---|
1108 |
|
---|
1109 | ${LogVerbose} "Restoring original D3D files ..."
|
---|
1110 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1111 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\d3d8.dll"
|
---|
1112 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1113 | !endif
|
---|
1114 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\d3d9.dll"
|
---|
1115 | ${CopyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1116 |
|
---|
1117 | ${If} $g_bCapDllCache == "true"
|
---|
1118 | !if $%BUILD_TARGET_ARCH% == "x86"
|
---|
1119 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d8.dll"
|
---|
1120 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1121 | !endif
|
---|
1122 | ${PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d9.dll"
|
---|
1123 | ${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
|
---|
1124 | ${EndIf}
|
---|
1125 |
|
---|
1126 | !if $%BUILD_TARGET_ARCH% == "amd64"
|
---|
1127 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d8.dll"
|
---|
1128 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
1129 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d9.dll"
|
---|
1130 | ${CopyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
1131 |
|
---|
1132 | ${If} $g_bCapDllCache == "true"
|
---|
1133 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d8.dll"
|
---|
1134 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
|
---|
1135 | ${PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d9.dll"
|
---|
1136 | ${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
|
---|
1137 | ${EndIf}
|
---|
1138 | !endif
|
---|
1139 |
|
---|
1140 | ; Do a re-validation afterwards.
|
---|
1141 | Call ${un}ValidateD3DFiles
|
---|
1142 | Pop $0
|
---|
1143 | ${If} $0 == "1" ; D3D files are invalid
|
---|
1144 | ${LogVerbose} $(VBOX_UNINST_UNABLE_TO_RESTORE_D3D)
|
---|
1145 | MessageBox MB_ICONSTOP|MB_OK $(VBOX_UNINST_UNABLE_TO_RESTORE_D3D) /SD IDOK
|
---|
1146 | ${EndIf}
|
---|
1147 |
|
---|
1148 | Exch $0
|
---|
1149 |
|
---|
1150 | FunctionEnd
|
---|
1151 | !macroend
|
---|
1152 | !insertmacro RestoreFilesDirect3D ""
|
---|
1153 | !insertmacro RestoreFilesDirect3D "un."
|
---|