VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsCommon.nsh@ 35319

最後變更 在這個檔案從35319是 35319,由 vboxsync 提交於 14 年 前
  1. wddm: 64bit support 2. wddm: installation fixes (64bit support, unsigned driver warning) 3. propper fix for #5438 (compile with disabled CROGL)
  • 屬性 svn:eol-style 設為 native
檔案大小: 13.0 KB
 
1
2!ifndef UNINSTALLER_ONLY
3Function ExtractFiles
4
5 ; @todo: Use a define for all the file specs to group the files per module
6 ; and keep the redundancy low
7
8 Push $0
9 StrCpy "$0" "$INSTDIR\$%BUILD_TARGET_ARCH%"
10
11!ifdef VBOX_WITH_LICENSE_INSTALL_RTF
12 FILE "/oname=$0\${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
13!endif
14
15 ; Video driver
16 SetOutPath "$0\VBoxVideo"
17 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
18 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
19!ifdef VBOX_SIGN_ADDITIONS
20 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
21!endif
22 FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
23
24!if $%VBOX_WITH_CROGL% == "1"
25 ; crOpenGL
26 FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
27 FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
28 FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
29 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
30 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
31 FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
32 FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
33
34 ; Do *not* install 64-bit d3d files - they don't work yet
35 !if $%BUILD_TARGET_ARCH% == "x86"
36 SetOutPath "$0\VBoxVideo\OpenGL"
37 FILE "$%PATH_OUT%\bin\additions\d3d8.dll"
38 FILE "$%PATH_OUT%\bin\additions\d3d9.dll"
39 FILE "$%PATH_OUT%\bin\additions\libWine.dll"
40 FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
41 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
42 FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
43 !endif
44
45 !if $%BUILD_TARGET_ARCH% == "amd64"
46 ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target
47 SetOutPath "$0\VBoxVideo\OpenGL\SysWow64"
48 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll"
49 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll"
50 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\libWine.dll"
51 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLarrayspu.dll"
52 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLcrutil.dll"
53 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLerrorspu.dll"
54 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpackspu.dll"
55 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpassthroughspu.dll"
56 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLfeedbackspu.dll"
57 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGL.dll"
58 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
59 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
60 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
61 !endif
62!endif
63
64!if $%VBOX_WITH_WDDM% == "1"
65 ; WDDM Video driver
66 SetOutPath "$0\VBoxVideoWddm"
67
68 !ifdef VBOX_SIGN_ADDITIONS
69 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.cat"
70 !endif
71 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys"
72 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf"
73 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
74
75 !if $%VBOX_WITH_CROGL% == "1"
76 FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
77 FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
78 FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
79 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
80 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
81 FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
82 FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
83
84 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
85 FILE "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
86 !endif ; $%VBOX_WITH_CROGL% == "1"
87
88 !if $%BUILD_TARGET_ARCH% == "amd64"
89 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
90
91 !if $%VBOX_WITH_CROGL% == "1"
92 FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
93 FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
94 FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
95 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
96 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
97 FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
98 FILE "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
99
100 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
101 FILE "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
102 !endif ; $%VBOX_WITH_CROGL% == "1"
103 !endif ; $%BUILD_TARGET_ARCH% == "amd64"
104!endif ; $%VBOX_WITH_WDDM% == "1"
105
106 ; Mouse driver
107 SetOutPath "$0\VBoxMouse"
108 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
109 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
110!ifdef VBOX_SIGN_ADDITIONS
111 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
112!endif
113
114!if $%BUILD_TARGET_ARCH% == "x86"
115 SetOutPath "$0\VBoxMouse\NT4"
116 FILE "$%PATH_OUT%\bin\additions\VBoxMouseNT.sys"
117!endif
118
119 ; Guest driver
120 SetOutPath "$0\VBoxGuest"
121 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
122 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
123!ifdef VBOX_SIGN_ADDITIONS
124 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
125!endif
126 FILE "$%PATH_OUT%\bin\additions\VBCoInst.dll"
127 FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
128 FILE "$%PATH_OUT%\bin\additions\VBoxHook.dll"
129 FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
130
131!if $%BUILD_TARGET_ARCH% == "x86"
132 SetOutPath "$0\VBoxGuest\NT4"
133 FILE "$%PATH_OUT%\bin\additions\VBoxGuestNT.sys"
134!endif
135
136 ; VBoxService
137 SetOutPath "$0\Bin"
138 FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
139!if $%BUILD_TARGET_ARCH% == "x86"
140 FILE "$%PATH_OUT%\bin\additions\VBoxServiceNT.exe"
141!endif
142
143 ; Shared Folders
144 SetOutPath "$0\VBoxSF"
145 FILE "$%PATH_OUT%\bin\additions\VBoxSF.sys"
146 FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll"
147
148 ; Auto-Logon
149 SetOutPath "$0\AutoLogon"
150 FILE "$%PATH_OUT%\bin\additions\VBoxGINA.dll"
151 FILE "$%PATH_OUT%\bin\additions\VBoxCredProv.dll"
152
153 ; Misc tools
154 SetOutPath "$0\Tools"
155 FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
156
157!if $%BUILD_TARGET_ARCH% == "x86"
158 SetOutPath "$0\Tools\NT4"
159 FILE "$%PATH_OUT%\bin\additions\VBoxGuestDrvInst.exe"
160 FILE "$%PATH_OUT%\bin\additions\RegCleanup.exe"
161!endif
162
163 Pop $0
164
165FunctionEnd
166!endif ; UNINSTALLER_ONLY
167
168!macro EnableLog un
169Function ${un}EnableLog
170
171!ifdef _DEBUG
172 Goto log
173!endif
174
175 StrCmp $g_bLogEnable "true" log
176 Goto exit
177
178log:
179
180 LogSet on
181 LogText "Start logging."
182
183exit:
184
185FunctionEnd
186!macroend
187!insertmacro EnableLog ""
188!insertmacro EnableLog "un."
189
190!macro WriteLogUI un
191Function ${un}WriteLogUI
192
193 IfSilent exit
194
195!ifdef _DEBUG
196 Goto log
197!endif
198
199 StrCmp $g_bLogEnable "true" log
200 Goto exit
201
202log:
203
204 ; Dump log to see what happened
205 StrCpy $0 "$INSTDIR\${un}install_ui.log"
206 Push $0
207 Call ${un}DumpLog
208
209exit:
210
211FunctionEnd
212!macroend
213!insertmacro WriteLogUI ""
214!insertmacro WriteLogUI "un."
215
216!macro WriteLogVBoxTray un
217Function ${un}WriteLogVBoxTray
218
219 ; Pop function parameters off the stack
220 ; in reverse order
221 Exch $1 ; Message type (0=Info, 1=Warning, 2=Error)
222 Exch
223 Exch $0 ; Body string
224
225 ; @todo Add more paramters here!
226!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
227 ${If} $g_bPostInstallStatus == "true"
228 ; Parameters:
229 ; - String: Description / Body
230 ; - String: Title / Name of application
231 ; - Integer: Type of message: 0 (Info), 1 (Warning), 2 (Error)
232 ; - Integer: Time (in msec) to show the notification
233 VBoxGuestInstallHelper::VBoxTrayShowBallonMsg "$0" "VirtualBox Guest Additions Setup" $1 5000
234 Pop $0 ; Get return value (ignored for now)
235 ${EndIf}
236!endif
237 Pop $0
238 Pop $1
239
240FunctionEnd
241!macroend
242!insertmacro WriteLogVBoxTray ""
243!insertmacro WriteLogVBoxTray "un."
244
245!macro CheckArchitecture un
246Function ${un}CheckArchitecture
247
248 Push $0
249
250 System::Call "kernel32::GetCurrentProcess() i .s"
251 System::Call "kernel32::IsWow64Process(i s, *i .r0)"
252 ; R0 now contains 1 if we're a 64-bit process, or 0 if not
253
254!if $%BUILD_TARGET_ARCH% == "amd64"
255 IntCmp $0 0 wrong_platform
256!else ; 32-bit
257 IntCmp $0 1 wrong_platform
258!endif
259
260 Push 0
261 Goto exit
262
263wrong_platform:
264
265 Push 1
266 Goto exit
267
268exit:
269
270FunctionEnd
271!macroend
272!insertmacro CheckArchitecture ""
273!insertmacro CheckArchitecture "un."
274
275!macro GetWindowsVer un
276Function ${un}GetWindowsVer
277
278 ; Check if we are running on w2k or above
279 ; For other windows versions (>XP) it may be necessary to change winver.nsh
280 Call ${un}GetWindowsVersion
281 Pop $R3 ; Windows Version
282
283 Push $R3 ; The windows version string
284 Push "NT" ; String to search for. Win 2k family returns no string containing 'NT'
285 Call ${un}StrStr
286 Pop $R0
287 StrCmp $R0 '' nt5plus ; Not NT 3.XX or 4.XX
288
289 ; Ok we know it is NT. Must be a string like NT X.XX
290 Push $R3 ; The windows version string
291 Push "4." ; String to search for
292 Call ${un}StrStr
293 Pop $R0
294 StrCmp $R0 "" nt5plus nt4 ; If empty -> not NT 4
295
296nt5plus: ; Windows 2000+ (XP, Vista, ...)
297
298 StrCpy $g_strWinVersion $R3
299 goto exit
300
301nt4: ; NT 4.0
302
303 StrCpy $g_strWinVersion "NT4"
304 goto exit
305
306exit:
307
308FunctionEnd
309!macroend
310!insertmacro GetWindowsVer ""
311!insertmacro GetWindowsVer "un."
312
313!macro GetAdditionsVersion un
314Function ${un}GetAdditionsVersion
315
316 Push $0
317 Push $1
318
319 ; Get additions version
320 ReadRegStr $0 HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Version"
321
322 ; Get revision
323 ReadRegStr $g_strAddVerRev HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Revision"
324
325 ; Extract major version
326 Push "$0" ; String
327 Push "." ; SubString
328 Push ">" ; SearchDirection
329 Push "<" ; StrInclusionDirection
330 Push "0" ; IncludeSubString
331 Push "0" ; Loops
332 Push "0" ; CaseSensitive
333 Call ${un}StrStrAdv
334 Pop $g_strAddVerMaj
335
336 ; Extract minor version
337 Push "$0" ; String
338 Push "." ; SubString
339 Push ">" ; SearchDirection
340 Push ">" ; StrInclusionDirection
341 Push "0" ; IncludeSubString
342 Push "0" ; Loops
343 Push "0" ; CaseSensitive
344 Call ${un}StrStrAdv
345 Pop $1 ; Got first part (e.g. "1.5")
346
347 Push "$1" ; String
348 Push "." ; SubString
349 Push ">" ; SearchDirection
350 Push "<" ; StrInclusionDirection
351 Push "0" ; IncludeSubString
352 Push "0" ; Loops
353 Push "0" ; CaseSensitive
354 Call ${un}StrStrAdv
355 Pop $g_strAddVerMin ; Extracted second part (e.g. "5" from "1.5")
356
357 ; Extract build number
358 Push "$0" ; String
359 Push "." ; SubString
360 Push "<" ; SearchDirection
361 Push ">" ; StrInclusionDirection
362 Push "0" ; IncludeSubString
363 Push "0" ; Loops
364 Push "0" ; CaseSensitive
365 Call ${un}StrStrAdv
366 Pop $g_strAddVerBuild
367
368exit:
369
370 Pop $1
371 Pop $0
372
373FunctionEnd
374!macroend
375!insertmacro GetAdditionsVersion ""
376!insertmacro GetAdditionsVersion "un."
377
378!macro StopVBoxService un
379Function ${un}StopVBoxService
380
381 Push $0 ; Temp results
382 Push $1
383 Push $2 ; Image name of VBoxService
384 Push $3 ; Safety counter
385
386 StrCpy $3 "0" ; Init counter
387 DetailPrint "Stopping VBoxService ..."
388
389svc_stop:
390
391 LogText "Stopping VBoxService (as service) ..."
392 ${If} $g_strWinVersion == "NT4"
393 nsExec::Exec '"$SYSDIR\net.exe" stop VBoxService'
394 ${Else}
395 nsExec::Exec '"$SYSDIR\SC.exe" stop VBoxService'
396 ${EndIf}
397 Sleep "1000" ; Wait a bit
398
399exe_stop:
400
401!ifdef _DEBUG
402 DetailPrint "Stopping VBoxService (as exe) ..."
403!endif
404
405exe_stop_loop:
406
407 IntCmp $3 10 exit ; Only try this loop 10 times max
408 IntOp $3 $3 + 1 ; Increment
409
410 LogText "Try: $3"
411
412 ${If} $g_strWinVersion == "NT4"
413 StrCpy $2 "VBoxServiceNT.exe"
414 ${Else}
415 StrCpy $2 "VBoxService.exe"
416 ${EndIf}
417
418 ${nsProcess::FindProcess} $2 $0
419 StrCmp $0 0 0 exit
420
421 ${nsProcess::KillProcess} $2 $0
422 Sleep "1000" ; Wait a bit
423 Goto exe_stop_loop
424
425exit:
426
427 DetailPrint "Stopping VBoxService done."
428
429 Pop $3
430 Pop $2
431 Pop $1
432 Pop $0
433
434FunctionEnd
435!macroend
436!insertmacro StopVBoxService ""
437!insertmacro StopVBoxService "un."
438
439!macro StopVBoxTray un
440Function ${un}StopVBoxTray
441
442 Push $0 ; Temp results
443 Push $1 ; Safety counter
444
445 StrCpy $1 "0" ; Init counter
446 DetailPrint "Stopping VBoxTray ..."
447
448exe_stop:
449
450 IntCmp $1 10 exit ; Only try this loop 10 times max
451 IntOp $1 $1 + 1 ; Increment
452
453 ${nsProcess::FindProcess} "VBoxTray.exe" $0
454 StrCmp $0 0 0 exit
455
456 ${nsProcess::KillProcess} "VBoxTray.exe" $0
457 Sleep "1000" ; Wait a bit
458 Goto exe_stop
459
460exit:
461
462 DetailPrint "Stopping VBoxTray done."
463
464 Pop $1
465 Pop $0
466
467FunctionEnd
468!macroend
469!insertmacro StopVBoxTray ""
470!insertmacro StopVBoxTray "un."
471
472!macro WriteRegBinR ROOT KEY NAME VALUE
473 WriteRegBin "${ROOT}" "${KEY}" "${NAME}" "${VALUE}"
474!macroend
475
476!macro AbortShutdown un
477Function ${un}AbortShutdown
478
479 Push $0
480
481 ; Try to abort the shutdown
482 nsExec::ExecToLog '"$g_strSystemDir\shutdown.exe" -a' $0
483
484 Pop $0
485
486FunctionEnd
487!macroend
488!insertmacro AbortShutdown ""
489!insertmacro AbortShutdown "un."
490
491!macro CheckForWDDMCapability un
492Function ${un}CheckForWDDMCapability
493
494!if $%VBOX_WITH_WDDM% == "1"
495 ; If we're on a 32-bit Windows Vista / 7 we can use the WDDM driver
496 ${If} $g_strWinVersion == "Vista"
497 ${OrIf} $g_strWinVersion == "7"
498 StrCpy $g_bCapWDDM "true"
499 ${EndIf}
500!endif
501
502FunctionEnd
503!macroend
504!insertmacro CheckForWDDMCapability ""
505!insertmacro CheckForWDDMCapability "un."
506
507!macro CheckForCapabilities un
508Function ${un}CheckForCapabilities
509
510 Push $0
511
512 ; Retrieve system mode and store result in
513 System::Call 'user32::GetSystemMetrics(i ${SM_CLEANBOOT}) i .r0'
514 StrCpy $g_iSystemMode $0
515
516 ; Check whether this OS is capable of handling WDDM drivers
517 Call ${un}CheckForWDDMCapability
518
519 Pop $0
520
521FunctionEnd
522!macroend
523!insertmacro CheckForCapabilities ""
524!insertmacro CheckForCapabilities "un."
525
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette