VirtualBox

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

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

wddm: disable for guest installer

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

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