VirtualBox

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

最後變更 在這個檔案從35654是 35651,由 vboxsync 提交於 14 年 前

Windows Guest Additions installer: Use new VBoxDrvInst command line, add DIFxAPI.dll, clean up, some NT4 renaming.

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

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