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