VirtualBox

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

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

Windows Guest Additions installer: Back out reboot flag handling (r68547, r68538, r68537, r68536, r68534), needs more testing after beta.

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

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