VirtualBox

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

Last change on this file since 33280 was 32683, checked in by vboxsync, 14 years ago

Windows Guest Additions installer: More WDDM cleanup.

  • Property svn:eol-style set to native
File size: 10.6 KB
Line 
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 happend
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 GetWindowsVer un
171Function ${un}GetWindowsVer
172
173 ; Check if we are running on w2k or above.
174 ; For other windows versions (>XP) it may be necessary to change winver.nsh
175 Call ${un}GetWindowsVersion
176 Pop $R3 ; Windows Version
177
178 Push $R3 ; The windows version string
179 Push "NT" ; String to search for. Win 2k family returns no string containing 'NT'
180 Call ${un}StrStr
181 Pop $R0
182 StrCmp $R0 '' nt5plus ; Not NT 3.XX or 4.XX
183
184 ; Ok we know it is NT. Must be a string like NT X.XX
185 Push $R3 ; The windows version string
186 Push "4." ; String to search for
187 Call ${un}StrStr
188 Pop $R0
189 StrCmp $R0 "" nt5plus nt4 ; If empty -> not NT 4
190
191nt5plus: ; Windows 2000+ (XP, Vista, ...)
192
193 StrCpy $g_strWinVersion $R3
194 goto exit
195
196nt4: ; NT 4.0
197
198 StrCpy $g_strWinVersion "NT4"
199 goto exit
200
201exit:
202
203FunctionEnd
204!macroend
205
206; Insert function as an installer and uninstaller function.
207!insertmacro GetWindowsVer ""
208!insertmacro GetWindowsVer "un."
209
210!macro GetAdditionsVersion un
211Function ${un}GetAdditionsVersion
212
213 Push $0
214 Push $1
215
216 ; Get additions version
217 ReadRegStr $0 HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Version"
218
219 ; Get revision
220 ReadRegStr $g_strAddVerRev HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Revision"
221
222 ; Extract major version
223 Push "$0" ; String
224 Push "." ; SubString
225 Push ">" ; SearchDirection
226 Push "<" ; StrInclusionDirection
227 Push "0" ; IncludeSubString
228 Push "0" ; Loops
229 Push "0" ; CaseSensitive
230 Call ${un}StrStrAdv
231 Pop $g_strAddVerMaj
232
233 ; Extract minor version
234 Push "$0" ; String
235 Push "." ; SubString
236 Push ">" ; SearchDirection
237 Push ">" ; StrInclusionDirection
238 Push "0" ; IncludeSubString
239 Push "0" ; Loops
240 Push "0" ; CaseSensitive
241 Call ${un}StrStrAdv
242 Pop $1 ; Got first part (e.g. "1.5")
243
244 Push "$1" ; String
245 Push "." ; SubString
246 Push ">" ; SearchDirection
247 Push "<" ; StrInclusionDirection
248 Push "0" ; IncludeSubString
249 Push "0" ; Loops
250 Push "0" ; CaseSensitive
251 Call ${un}StrStrAdv
252 Pop $g_strAddVerMin ; Extracted second part (e.g. "5" from "1.5")
253
254 ; Extract build number
255 Push "$0" ; String
256 Push "." ; SubString
257 Push "<" ; SearchDirection
258 Push ">" ; StrInclusionDirection
259 Push "0" ; IncludeSubString
260 Push "0" ; Loops
261 Push "0" ; CaseSensitive
262 Call ${un}StrStrAdv
263 Pop $g_strAddVerBuild
264
265exit:
266
267 Pop $1
268 Pop $0
269
270FunctionEnd
271!macroend
272
273; Insert function as an installer and uninstaller function.
274!insertmacro GetAdditionsVersion ""
275!insertmacro GetAdditionsVersion "un."
276
277!macro IsUserAdmin un
278Function ${un}IsUserAdmin
279
280 ; Check if current user has admin rights
281 UserInfo::GetAccountType
282 Pop $0
283 StrCmp $0 "Admin" is_admin 0
284 MessageBox MB_ICONSTOP $(VBOX_NOADMIN)
285 Abort
286
287is_admin:
288
289FunctionEnd
290!macroend
291
292; Insert function as an installer and uninstaller function.
293!insertmacro IsUserAdmin ""
294!insertmacro IsUserAdmin "un."
295
296!macro StopVBoxService un
297Function ${un}StopVBoxService
298
299 Push $0 ; Temp results
300 Push $1
301 Push $2 ; Image name of VBoxService
302 Push $3 ; Safety counter
303
304 StrCpy $3 "0" ; Init counter
305 DetailPrint "Stopping VBoxService ..."
306
307svc_stop:
308
309 LogText "Stopping VBoxService (as service) ..."
310 ${If} $g_strWinVersion == "NT4"
311 nsExec::Exec '"$SYSDIR\net.exe" stop VBoxService'
312 ${Else}
313 nsExec::Exec '"$SYSDIR\SC.exe" stop VBoxService'
314 ${EndIf}
315 Sleep "1000" ; Wait a bit
316
317exe_stop:
318
319!ifdef _DEBUG
320 DetailPrint "Stopping VBoxService (as exe) ..."
321!endif
322
323exe_stop_loop:
324
325 IntCmp $3 10 exit ; Only try this loop 10 times max
326 IntOp $3 $3 + 1 ; Increment
327
328 LogText "Try: $3"
329
330 ${If} $g_strWinVersion == "NT4"
331 StrCpy $2 "VBoxServiceNT.exe"
332 ${Else}
333 StrCpy $2 "VBoxService.exe"
334 ${EndIf}
335
336 ${nsProcess::FindProcess} $2 $0
337 StrCmp $0 0 0 exit
338
339 ${nsProcess::KillProcess} $2 $0
340 Sleep "1000" ; Wait a bit
341 Goto exe_stop_loop
342
343exit:
344
345 DetailPrint "Stopping VBoxService done."
346
347 Pop $3
348 Pop $2
349 Pop $1
350 Pop $0
351
352FunctionEnd
353!macroend
354
355; Insert function as an installer and uninstaller function.
356!insertmacro StopVBoxService ""
357!insertmacro StopVBoxService "un."
358
359!macro StopVBoxTray un
360Function ${un}StopVBoxTray
361
362 Push $0 ; Temp results
363 Push $1 ; Safety counter
364
365 StrCpy $1 "0" ; Init counter
366 DetailPrint "Stopping VBoxTray ..."
367
368exe_stop:
369
370 IntCmp $1 10 exit ; Only try this loop 10 times max
371 IntOp $1 $1 + 1 ; Increment
372
373 ${nsProcess::FindProcess} "VBoxTray.exe" $0
374 StrCmp $0 0 0 exit
375
376 ${nsProcess::KillProcess} "VBoxTray.exe" $0
377 Sleep "1000" ; Wait a bit
378 Goto exe_stop
379
380exit:
381
382 DetailPrint "Stopping VBoxTray done."
383
384 Pop $1
385 Pop $0
386
387FunctionEnd
388!macroend
389
390; Insert function as an installer and uninstaller function.
391!insertmacro StopVBoxTray ""
392!insertmacro StopVBoxTray "un."
393
394!macro WriteRegBinR ROOT KEY NAME VALUE
395 WriteRegBin "${ROOT}" "${KEY}" "${NAME}" "${VALUE}"
396!macroend
397
398!macro AbortShutdown un
399Function ${un}AbortShutdown
400
401 Push $0
402
403 ; Try to abort the shutdown
404 nsExec::ExecToLog '"$g_strSystemDir\shutdown.exe" -a' $0
405
406 Pop $0
407
408FunctionEnd
409!macroend
410
411; Insert function as an installer and uninstaller function.
412!insertmacro AbortShutdown ""
413!insertmacro AbortShutdown "un."
414
415!macro CheckForWDDMCapability un
416Function ${un}CheckForWDDMCapability
417
418 ; Note: This is done early at startup of the installer, so
419 ; DetailPrint and friends won't work here!
420
421!if $%BUILD_TARGET_ARCH% == "x86"
422 ; If we're on a 32-bit Windows Vista / 7 we can use the WDDM driver
423 ${If} $g_strWinVersion == "Vista"
424 ${OrIf} $g_strWinVersion == "7"
425 StrCpy $g_bCapWDDM "true"
426 ${EndIf}
427!endif
428
429FunctionEnd
430!macroend
431
432; Insert function as an installer and uninstaller function.
433!insertmacro CheckForWDDMCapability ""
434!insertmacro CheckForWDDMCapability "un."
435
436!macro CheckForCapabilities un
437Function ${un}CheckForCapabilities
438
439 Call ${un}CheckForWDDMCapability
440
441FunctionEnd
442!macroend
443
444; Insert function as an installer and uninstaller function.
445!insertmacro CheckForCapabilities ""
446!insertmacro CheckForCapabilities "un."
447
Note: See TracBrowser for help on using the repository browser.

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