VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsW2KXP.nsh@ 44824

Last change on this file since 44824 was 44459, checked in by vboxsync, 12 years ago

Windows Guest Additions installer: Invoke external calls via own function to also log stdout/stderr output into installer log files.

  • Property svn:eol-style set to native
File size: 30.6 KB
Line 
1; $Id$
2;; @file
3; VBoxGuestAdditionsW2KXP.nsh - Guest Additions installation for Windows 2000/XP.
4;
5
6;
7; Copyright (C) 2006-2013 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17
18Function W2K_SetVideoResolution
19
20 ; NSIS only supports global vars, even in functions -- great
21 Var /GLOBAL i
22 Var /GLOBAL tmp
23 Var /GLOBAL tmppath
24 Var /GLOBAL dev_id
25 Var /GLOBAL dev_desc
26
27 ; Check for all required parameters
28 StrCmp $g_iScreenX "0" exit
29 StrCmp $g_iScreenY "0" exit
30 StrCmp $g_iScreenBpp "0" exit
31
32 ${LogVerbose} "Setting display parameters ($g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP) ..."
33
34 ; Enumerate all video devices (up to 32 at the moment, use key "MaxObjectNumber" key later)
35 ${For} $i 0 32
36
37 ReadRegStr $tmp HKLM "HARDWARE\DEVICEMAP\VIDEO" "\Device\Video$i"
38 StrCmp $tmp "" dev_not_found
39
40 ; Extract path to video settings
41 ; Ex: \Registry\Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
42 ; Or: \Registry\Machine\System\CurrentControlSet\Control\Video\vboxvideo\Device0
43 ; Result: Machine\System\CurrentControlSet\Control\Video\{28B74D2B-F0A9-48E0-8028-D76F6BB1AE65}\0000
44 Push "$tmp" ; String
45 Push "\" ; SubString
46 Push ">" ; SearchDirection
47 Push ">" ; StrInclusionDirection
48 Push "0" ; IncludeSubString
49 Push "2" ; Loops
50 Push "0" ; CaseSensitive
51 Call StrStrAdv
52 Pop $tmppath ; $1 only contains the full path
53 StrCmp $tmppath "" dev_not_found
54
55 ; Get device description
56 ReadRegStr $dev_desc HKLM "$tmppath" "Device Description"
57!ifdef _DEBUG
58 ${LogVerbose} "Registry path: $tmppath"
59 ${LogVerbose} "Registry path to device name: $temp"
60!endif
61 ${LogVerbose} "Detected video device: $dev_desc"
62
63 ${If} $dev_desc == "VirtualBox Graphics Adapter"
64 ${LogVerbose} "VirtualBox video device found!"
65 Goto dev_found
66 ${EndIf}
67 ${Next}
68 Goto dev_not_found
69
70dev_found:
71
72 ; If we're on Windows 2000, skip the ID detection ...
73 ${If} $g_strWinVersion == "2000"
74 Goto change_res
75 ${EndIf}
76 Goto dev_found_detect_id
77
78dev_found_detect_id:
79
80 StrCpy $i 0 ; Start at index 0
81 ${LogVerbose} "Detecting device ID ..."
82
83dev_found_detect_id_loop:
84
85 ; Resolve real path to hardware instance "{GUID}"
86 EnumRegKey $dev_id HKLM "SYSTEM\CurrentControlSet\Control\Video" $i
87 StrCmp $dev_id "" dev_not_found ; No more entries? Jump out
88!ifdef _DEBUG
89 ${LogVerbose} "Got device ID: $dev_id"
90!endif
91 ReadRegStr $dev_desc HKLM "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000" "Device Description" ; Try to read device name
92 ${If} $dev_desc == "VirtualBox Graphics Adapter"
93 ${LogVerbose} "Device ID of $dev_desc: $dev_id"
94 Goto change_res
95 ${EndIf}
96
97 IntOp $i $i + 1 ; Increment index
98 goto dev_found_detect_id_loop
99
100dev_not_found:
101
102 ${LogVerbose} "No VirtualBox video device (yet) detected! No custom mode set."
103 Goto exit
104
105change_res:
106
107!ifdef _DEBUG
108 ${LogVerbose} "Device description: $dev_desc"
109 ${LogVerbose} "Device ID: $dev_id"
110!endif
111
112 Var /GLOBAL reg_path_device
113 Var /GLOBAL reg_path_monitor
114
115 ${LogVerbose} "Custom mode set: Platform is Windows $g_strWinVersion"
116 ${If} $g_strWinVersion == "2000"
117 ${OrIf} $g_strWinVersion == "Vista"
118 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0"
119 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\SERVICES\VBoxVideo\Device0\Mon00000001"
120 ${ElseIf} $g_strWinVersion == "XP"
121 ${OrIf} $g_strWinVersion == "7"
122 ${OrIf} $g_strWinVersion == "8"
123 StrCpy $reg_path_device "SYSTEM\CurrentControlSet\Control\Video\$dev_id\0000"
124 StrCpy $reg_path_monitor "SYSTEM\CurrentControlSet\Control\VIDEO\$dev_id\0000\Mon00000001"
125 ${Else}
126 ${LogVerbose} "Custom mode set: Windows $g_strWinVersion not supported yet"
127 Goto exit
128 ${EndIf}
129
130 ; Write the new value in the adapter config (VBoxVideo.sys) using hex values in binary format
131 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomXRes REG_BIN $g_iScreenX DWORD" "false"
132 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomYRes REG_BIN $g_iScreenY DWORD" "false"
133 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry write HKLM $reg_path_device CustomBPP REG_BIN $g_iScreenBpp DWORD" "false"
134
135 ; ... and tell Windows to use that mode on next start!
136 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.XResolution" "$g_iScreenX"
137 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.YResolution" "$g_iScreenY"
138 WriteRegDWORD HKCC $reg_path_device "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
139
140 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.XResolution" "$g_iScreenX"
141 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.YResolution" "$g_iScreenY"
142 WriteRegDWORD HKCC $reg_path_monitor "DefaultSettings.BitsPerPixel" "$g_iScreenBpp"
143
144 ${LogVerbose} "Custom mode set to $g_iScreenXx$g_iScreenY, $g_iScreenBpp BPP on next restart."
145
146exit:
147
148FunctionEnd
149
150Function W2K_Prepare
151
152 ${If} $g_bNoVBoxServiceExit == "false"
153 ; Stop / kill VBoxService
154 Call StopVBoxService
155 ${EndIf}
156
157 ${If} $g_bNoVBoxTrayExit == "false"
158 ; Stop / kill VBoxTray
159 Call StopVBoxTray
160 ${EndIf}
161
162 ; Delete VBoxService from registry
163 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
164
165 ; Delete old VBoxService.exe from install directory (replaced by VBoxTray.exe)
166 Delete /REBOOTOK "$INSTDIR\VBoxService.exe"
167
168FunctionEnd
169
170Function W2K_CopyFiles
171
172 Push $0
173 SetOutPath "$INSTDIR"
174
175 ; Video driver
176 FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
177 FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
178
179 ; Mouse driver
180 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
181 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
182!ifdef VBOX_SIGN_ADDITIONS
183 FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
184!endif
185
186 ; Guest driver
187 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
188 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
189!ifdef VBOX_SIGN_ADDITIONS
190 FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
191!endif
192
193 ; Guest driver files
194 FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
195 FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe" ; Not used by W2K and up, but required by the .INF file
196
197 ; WHQL fake
198!ifdef WHQL_FAKE
199 FILE "$%PATH_OUT%\bin\additions\VBoxWHQLFake.exe"
200!endif
201
202 SetOutPath $g_strSystemDir
203
204 ; VBoxService
205 ${If} $g_bNoVBoxServiceExit == "false"
206 ; VBoxService has been terminated before, so just install the file
207 ; in the regular way
208 FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
209 ${Else}
210 ; VBoxService is in use and wasn't terminated intentionally. So extract the
211 ; new version into a temporary location and install it on next reboot
212 Push $0
213 ClearErrors
214 GetTempFileName $0
215 IfErrors 0 +3
216 ${LogVerbose} "Error getting temp file for VBoxService.exe"
217 StrCpy "$0" "$INSTDIR\VBoxServiceTemp.exe"
218 ${LogVerbose} "VBoxService is in use, will be installed on next reboot (from '$0')"
219 File "/oname=$0" "$%PATH_OUT%\bin\additions\VBoxService.exe"
220 IfErrors 0 +2
221 ${LogVerbose} "Error copying VBoxService.exe to '$0'"
222 Rename /REBOOTOK "$0" "$g_strSystemDir\VBoxService.exe"
223 IfErrors 0 +2
224 ${LogVerbose} "Error renaming '$0' to '$g_strSystemDir\VBoxService.exe'"
225 Pop $0
226 ${EndIf}
227
228!if $%VBOX_WITH_WDDM% == "1"
229 ${If} $g_bWithWDDM == "true"
230 ; WDDM Video driver
231 SetOutPath "$INSTDIR"
232
233 !if $%VBOX_WITH_WDDM_W8% == "1"
234 ${If} $g_strWinVersion == "8"
235 !ifdef VBOX_SIGN_ADDITIONS
236 FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.cat"
237 !endif
238 FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.sys"
239 FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.inf"
240 ${Else}
241 !endif
242 !ifdef VBOX_SIGN_ADDITIONS
243 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.cat"
244 !endif
245 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys"
246 FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf"
247 !if $%VBOX_WITH_WDDM_W8% == "1"
248 ${EndIf}
249 !endif
250
251 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
252
253 !if $%VBOX_WITH_CROGL% == "1"
254 FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
255 FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
256 FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
257 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
258 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
259 FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
260 FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
261
262 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
263 FILE "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
264 !endif ; $%VBOX_WITH_CROGL% == "1"
265
266 !if $%BUILD_TARGET_ARCH% == "amd64"
267 FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
268
269 !if $%VBOX_WITH_CROGL% == "1"
270 FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
271 FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
272 FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
273 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
274 FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
275 FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
276 FILE "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
277
278 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
279 FILE "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
280 !endif ; $%VBOX_WITH_CROGL% == "1"
281 !endif ; $%BUILD_TARGET_ARCH% == "amd64"
282
283 Goto doneCr
284 ${EndIf}
285!endif ; $%VBOX_WITH_WDDM% == "1"
286
287!if $%VBOX_WITH_CROGL% == "1"
288 ; crOpenGL
289 !if $%BUILD_TARGET_ARCH% == "amd64"
290 !define LIBRARY_X64 ; Enable installation of 64-bit libraries
291 !endif
292 StrCpy $0 "$TEMP\VBoxGuestAdditions\VBoxOGL"
293 CreateDirectory "$0"
294 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll" "$g_strSystemDir\VBoxOGLarrayspu.dll" "$0"
295 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll" "$g_strSystemDir\VBoxOGLcrutil.dll" "$0"
296 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll" "$g_strSystemDir\VBoxOGLerrorspu.dll" "$0"
297 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll" "$g_strSystemDir\VBoxOGLpackspu.dll" "$0"
298 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll" "$g_strSystemDir\VBoxOGLpassthroughspu.dll" "$0"
299 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll" "$g_strSystemDir\VBoxOGLfeedbackspu.dll" "$0"
300 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%PATH_OUT%\bin\additions\VBoxOGL.dll" "$g_strSystemDir\VBoxOGL.dll" "$0"
301 !if $%BUILD_TARGET_ARCH% == "amd64"
302 !undef LIBRARY_X64 ; Disable installation of 64-bit libraries
303 !endif
304
305 !if $%BUILD_TARGET_ARCH% == "amd64"
306 StrCpy $0 "$TEMP\VBoxGuestAdditions\VBoxOGL32"
307 CreateDirectory "$0"
308 ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target arch in
309 ; Wow64 node (32-bit sub system). Note that $SYSDIR contains the 32-bit
310 ; path after calling EnableX64FSRedirection
311 ${EnableX64FSRedirection}
312 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLarrayspu.dll" "$SYSDIR\VBoxOGLarrayspu.dll" "$0"
313 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLcrutil.dll" "$SYSDIR\VBoxOGLcrutil.dll" "$0"
314 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLerrorspu.dll" "$SYSDIR\VBoxOGLerrorspu.dll" "$0"
315 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpackspu.dll" "$SYSDIR\VBoxOGLpackspu.dll" "$0"
316 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpassthroughspu.dll" "$SYSDIR\VBoxOGLpassthroughspu.dll" "$0"
317 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLfeedbackspu.dll" "$SYSDIR\VBoxOGLfeedbackspu.dll" "$0"
318 !insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGL.dll" "$SYSDIR\VBoxOGL.dll" "$0"
319 ${DisableX64FSRedirection}
320 !endif
321
322!endif ; VBOX_WITH_CROGL
323
324doneCr:
325
326 Pop $0
327
328FunctionEnd
329
330!ifdef WHQL_FAKE
331
332Function W2K_WHQLFakeOn
333
334 StrCmp $g_bFakeWHQL "true" do
335 Goto exit
336
337do:
338
339 ${LogVerbose} "Turning off WHQL protection..."
340 ${CmdExecute} "$\"$INSTDIR\VBoxWHQLFake.exe$\" $\"ignore$\"" "true"
341
342exit:
343
344FunctionEnd
345
346Function W2K_WHQLFakeOff
347
348 StrCmp $g_bFakeWHQL "true" do
349 Goto exit
350
351do:
352
353 ${LogVerbose} "Turning back on WHQL protection..."
354 ${CmdExecute} "$\"$INSTDIR\VBoxWHQLFake.exe$\" $\"warn$\"" "true"
355
356exit:
357
358FunctionEnd
359
360!endif
361
362Function W2K_InstallFiles
363
364 ; The Shared Folder IFS goes to the system directory
365 FILE /oname=$g_strSystemDir\drivers\VBoxSF.sys "$%PATH_OUT%\bin\additions\VBoxSF.sys"
366 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll" "$g_strSystemDir\VBoxMRXNP.dll" "$INSTDIR"
367 AccessControl::GrantOnFile "$g_strSystemDir\VBoxMRXNP.dll" "(BU)" "GenericRead"
368 !if $%BUILD_TARGET_ARCH% == "amd64"
369 ; Only 64-bit installer: Copy the 32-bit DLL for 32 bit applications.
370 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll" "$g_strSysWow64\VBoxMRXNP.dll" "$INSTDIR"
371 AccessControl::GrantOnFile "$g_strSysWow64\VBoxMRXNP.dll" "(BU)" "GenericRead"
372 !endif
373
374 ; The VBoxTray hook DLL also goes to the system directory; it might be locked
375 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxHook.dll" "$g_strSystemDir\VBoxHook.dll" "$INSTDIR"
376 AccessControl::GrantOnFile "$g_strSystemDir\VBoxHook.dll" "(BU)" "GenericRead"
377
378 ${LogVerbose} "Installing drivers ..."
379
380 Push $0 ; For fetching results
381
382 SetOutPath "$INSTDIR"
383
384 ${If} $g_bNoGuestDrv == "false"
385 ${LogVerbose} "Installing guest driver ..."
386 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxGuest.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
387 ${Else}
388 ${LogVerbose} "Guest driver installation skipped!"
389 ${EndIf}
390
391 ${If} $g_bNoVideoDrv == "false"
392 ${If} $g_bWithWDDM == "true"
393 !if $%VBOX_WITH_WDDM_W8% == "1"
394 ${If} $g_strWinVersion == "8"
395 ${LogVerbose} "Installing WDDM video driver for Windows 8..."
396 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxVideoW8.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
397 ${Else}
398 !endif
399 ${LogVerbose} "Installing WDDM video driver for Windows Vista and 7..."
400 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxVideoWddm.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
401 !if $%VBOX_WITH_WDDM_W8% == "1"
402 ${EndIf}
403 !endif
404 ${Else}
405 ${LogVerbose} "Installing video driver ..."
406 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver install $\"$INSTDIR\VBoxVideo.inf$\" $\"$INSTDIR\install_drivers.log$\"" "false"
407 ${EndIf}
408 ${Else}
409 ${LogVerbose} "Video driver installation skipped!"
410 ${EndIf}
411
412 ${If} $g_bNoMouseDrv == "false"
413 ${LogVerbose} "Installing mouse driver ..."
414 ; The mouse filter does not contain any device IDs but a "DefaultInstall" section;
415 ; so this .INF file needs to be installed using "InstallHinfSection" which is implemented
416 ; with VBoxDrvInst's "driver executeinf" routine
417 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver executeinf $\"$INSTDIR\VBoxMouse.inf$\"" "false"
418 ${Else}
419 ${LogVerbose} "Mouse driver installation skipped!"
420 ${EndIf}
421
422 ; Create the VBoxService service
423 ; No need to stop/remove the service here! Do this only on uninstallation!
424 ${LogVerbose} "Installing VirtualBox service ..."
425 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxService$\" $\"VirtualBox Guest Additions Service$\" 16 2 $\"system32\VBoxService.exe$\" $\"Base$\"" "false"
426
427 ; Set service description
428 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxService" "Description" "Manages VM runtime information, time synchronization, remote sysprep execution and miscellaneous utilities for guest operating systems."
429
430sf:
431
432 ${LogVerbose} "Installing Shared Folders service ..."
433
434 ; Create the Shared Folders service ...
435 ; No need to stop/remove the service here! Do this only on uninstallation!
436 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service create $\"VBoxSF$\" $\"VirtualBox Shared Folders$\" 2 1 $\"system32\drivers\VBoxSF.sys$\" $\"NetworkProvider$\"" "false"
437
438 ; ... and the link to the network provider
439 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "DeviceName" "\Device\VBoxMiniRdr"
440 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "Name" "VirtualBox Shared Folders"
441 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" "ProviderPath" "$SYSDIR\VBoxMRXNP.dll"
442
443 ; Add default network providers (if not present or corrupted)
444 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add WebClient" "false"
445 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add LanmanWorkstation" "false"
446 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add RDPNP" "false"
447
448 ; Add the shared folders network provider
449 ${LogVerbose} "Adding network provider (Order = $g_iSfOrder) ..."
450 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider add VBoxSF $g_iSfOrder" "false"
451
452!if $%VBOX_WITH_CROGL% == "1"
453cropengl:
454 ${If} $g_bWithWDDM == "true"
455 ; Nothing to do here
456 ${Else}
457 ${LogVerbose} "Installing 3D OpenGL support ..."
458 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Version" 2
459 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "DriverVersion" 1
460 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Flags" 1
461 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Dll" "VBoxOGL.dll"
462!if $%BUILD_TARGET_ARCH% == "amd64"
463 SetRegView 32
464 ; Write additional keys required for Windows XP, Vista and 7 64-bit (but for 32-bit stuff)
465 ${If} $g_strWinVersion == '8'
466 ${OrIf} $g_strWinVersion == '7'
467 ${OrIf} $g_strWinVersion == 'Vista'
468 ${OrIf} $g_strWinVersion == '2003' ; Windows XP 64-bit is a renamed Windows 2003 really
469 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Version" 2
470 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "DriverVersion" 1
471 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Flags" 1
472 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Dll" "VBoxOGL.dll"
473 ${EndIf}
474 SetRegView 64
475!endif
476 ${Endif}
477!endif
478
479 Goto done
480
481done:
482
483 Pop $0
484
485FunctionEnd
486
487Function W2K_Main
488
489 SetOutPath "$INSTDIR"
490 SetOverwrite on
491
492 Call W2K_Prepare
493 Call W2K_CopyFiles
494
495!ifdef WHQL_FAKE
496 Call W2K_WHQLFakeOn
497!endif
498
499 Call W2K_InstallFiles
500
501!ifdef WHQL_FAKE
502 Call W2K_WHQLFakeOff
503!endif
504
505 Call W2K_SetVideoResolution
506
507FunctionEnd
508
509!macro W2K_UninstallInstDir un
510Function ${un}W2K_UninstallInstDir
511
512 Delete /REBOOTOK "$INSTDIR\VBoxVideo.sys"
513 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
514 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
515 Delete /REBOOTOK "$INSTDIR\VBoxDisp.dll"
516
517 Delete /REBOOTOK "$INSTDIR\VBoxMouse.sys"
518 Delete /REBOOTOK "$INSTDIR\VBoxMouse.inf"
519 Delete /REBOOTOK "$INSTDIR\VBoxMouse.cat"
520
521 Delete /REBOOTOK "$INSTDIR\VBoxTray.exe"
522
523 Delete /REBOOTOK "$INSTDIR\VBoxGuest.sys"
524 Delete /REBOOTOK "$INSTDIR\VBoxGuest.inf"
525 Delete /REBOOTOK "$INSTDIR\VBoxGuest.cat"
526
527 Delete /REBOOTOK "$INSTDIR\VBCoInst.dll" ; Deprecated, does not get installed anymore
528 Delete /REBOOTOK "$INSTDIR\VBoxControl.exe"
529 Delete /REBOOTOK "$INSTDIR\VBoxService.exe" ; Deprecated, does not get installed anymore
530
531!if $%VBOX_WITH_WDDM% == "1"
532 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoWddm.cat"
533 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys"
534 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf"
535 !if $%VBOX_WITH_WDDM_W8% == "1"
536 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoW8.cat"
537 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoW8.sys"
538 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoW8.inf"
539 !endif
540 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
541
542 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
543 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
544 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
545 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
546 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
547 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
548 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
549
550 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
551 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
552 ; Try to delete libWine in case it is there from old installation
553 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\libWine.dll"
554
555 !if $%BUILD_TARGET_ARCH% == "amd64"
556 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
557
558 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
559 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
560 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
561 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
562 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
563 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
564 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
565
566 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
567 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
568 !endif ; $%BUILD_TARGET_ARCH% == "amd64"
569!endif ; $%VBOX_WITH_WDDM% == "1"
570
571 ; WHQL fake
572!ifdef WHQL_FAKE
573 Delete /REBOOTOK "$INSTDIR\VBoxWHQLFake.exe"
574!endif
575
576 ; Log file
577 Delete /REBOOTOK "$INSTDIR\install.log"
578 Delete /REBOOTOK "$INSTDIR\install_ui.log"
579
580FunctionEnd
581!macroend
582!insertmacro W2K_UninstallInstDir ""
583!insertmacro W2K_UninstallInstDir "un."
584
585!macro W2K_Uninstall un
586Function ${un}W2K_Uninstall
587
588 Push $0
589
590 ; Remove VirtualBox video driver
591 ${LogVerbose} "Uninstalling video driver ..."
592 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideo.inf$\"" "true"
593 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideo" "true"
594 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideo.sys"
595 Delete /REBOOTOK "$g_strSystemDir\VBoxDisp.dll"
596
597 ; Remove video driver
598!if $%VBOX_WITH_WDDM% == "1"
599
600 !if $%VBOX_WITH_WDDM_W8% == "1"
601 ${LogVerbose} "Uninstalling WDDM video driver for Windows 8..."
602 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoW8.inf$\"" "true"
603 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoW8" "true"
604 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
605 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
606 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoW8.sys"
607 !endif ; $%VBOX_WITH_WDDM_W8% == "1"
608
609 ${LogVerbose} "Uninstalling WDDM video driver for Windows Vista and 7..."
610 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoWddm.inf$\"" "true"
611 ; Always try to remove both VBoxVideoWddm & VBoxVideo services no matter what is installed currently
612 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoWddm" "true"
613 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
614 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
615 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoWddm.sys"
616 Delete /REBOOTOK "$g_strSystemDir\VBoxDispD3D.dll"
617!endif ; $%VBOX_WITH_WDDM% == "1"
618
619!if $%VBOX_WITH_CROGL% == "1"
620
621 ${LogVerbose} "Removing Direct3D support ..."
622
623 ; Do file validation before we uninstall
624 Call ${un}ValidateD3DFiles
625 Pop $0
626 ${If} $0 == "1" ; D3D files are invalid
627 ${LogVerbose} $(VBOX_UNINST_INVALID_D3D)
628 MessageBox MB_ICONSTOP|MB_OK $(VBOX_UNINST_INVALID_D3D) /SD IDOK
629 Goto d3d_uninstall_end
630 ${EndIf}
631
632 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLarrayspu.dll"
633 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLcrutil.dll"
634 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLerrorspu.dll"
635 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpackspu.dll"
636 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpassthroughspu.dll"
637 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLfeedbackspu.dll"
638 Delete /REBOOTOK "$g_strSystemDir\VBoxOGL.dll"
639
640 ; Remove D3D stuff
641 ; @todo add a feature flag to only remove if installed explicitly
642 Delete /REBOOTOK "$g_strSystemDir\libWine.dll"
643 Delete /REBOOTOK "$g_strSystemDir\VBoxD3D8.dll"
644 Delete /REBOOTOK "$g_strSystemDir\VBoxD3D9.dll"
645 Delete /REBOOTOK "$g_strSystemDir\wined3d.dll"
646 ; Update DLL cache
647 ${If} ${FileExists} "$g_strSystemDir\dllcache\msd3d8.dll"
648 Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d8.dll"
649 Rename /REBOOTOK "$g_strSystemDir\dllcache\msd3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll"
650 ${EndIf}
651 ${If} ${FileExists} "$g_strSystemDir\dllcache\msd3d9.dll"
652 Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d9.dll"
653 Rename /REBOOTOK "$g_strSystemDir\dllcache\msd3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll"
654 ${EndIf}
655 ; Restore original DX DLLs
656 ${If} ${FileExists} "$g_strSystemDir\msd3d8.dll"
657 Delete /REBOOTOK "$g_strSystemDir\d3d8.dll"
658 Rename /REBOOTOK "$g_strSystemDir\msd3d8.dll" "$g_strSystemDir\d3d8.dll"
659 ${EndIf}
660 ${If} ${FileExists} "$g_strSystemDir\msd3d9.dll"
661 Delete /REBOOTOK "$g_strSystemDir\d3d9.dll"
662 Rename /REBOOTOK "$g_strSystemDir\msd3d9.dll" "$g_strSystemDir\d3d9.dll"
663 ${EndIf}
664
665 !if $%BUILD_TARGET_ARCH% == "amd64"
666 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
667 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLarrayspu.dll"
668 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLcrutil.dll"
669 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLerrorspu.dll"
670 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLpackspu.dll"
671 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLpassthroughspu.dll"
672 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLfeedbackspu.dll"
673 Delete /REBOOTOK "$g_strSysWow64\VBoxOGL.dll"
674
675 ; Remove D3D stuff
676 ; @todo add a feature flag to only remove if installed explicitly
677 Delete /REBOOTOK "$g_strSysWow64\libWine.dll"
678 Delete /REBOOTOK "$g_strSysWow64\VBoxD3D8.dll"
679 Delete /REBOOTOK "$g_strSysWow64\VBoxD3D9.dll"
680 Delete /REBOOTOK "$g_strSysWow64\wined3d.dll"
681 ; Update DLL cache
682 ${If} ${FileExists} "$g_strSysWow64\dllcache\msd3d8.dll"
683 Delete /REBOOTOK "$g_strSysWow64\dllcache\d3d8.dll"
684 Rename /REBOOTOK "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll"
685 ${EndIf}
686 ${If} ${FileExists} "$g_strSysWow64\dllcache\msd3d9.dll"
687 Delete /REBOOTOK "$g_strSysWow64\dllcache\d3d9.dll"
688 Rename /REBOOTOK "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll"
689 ${EndIf}
690 ; Restore original DX DLLs
691 ${If} ${FileExists} "$g_strSysWow64\msd3d8.dll"
692 Delete /REBOOTOK "$g_strSysWow64\d3d8.dll"
693 Rename /REBOOTOK "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll"
694 ${EndIf}
695 ${If} ${FileExists} "$g_strSysWow64\msd3d9.dll"
696 Delete /REBOOTOK "$g_strSysWow64\d3d9.dll"
697 Rename /REBOOTOK "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll"
698 ${EndIf}
699 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL"
700 !endif ; amd64
701
702 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL"
703
704d3d_uninstall_end:
705
706!endif ; VBOX_WITH_CROGL
707
708 ; Remove mouse driver
709 ${LogVerbose} "Removing mouse driver ..."
710 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxMouse" "true"
711 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxMouse.sys"
712 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry delmultisz $\"SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}$\" $\"UpperFilters$\" $\"VBoxMouse$\"" "true"
713
714 ; Delete the VBoxService service
715 Call ${un}StopVBoxService
716 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxService" "true"
717 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
718 Delete /REBOOTOK "$g_strSystemDir\VBoxService.exe"
719
720 ; VBoxGINA
721 Delete /REBOOTOK "$g_strSystemDir\VBoxGINA.dll"
722 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
723 ${If} $0 == "VBoxGINA.dll"
724 ${LogVerbose} "Removing auto-logon support ..."
725 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
726 ${EndIf}
727 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA"
728
729 ; Delete VBoxTray
730 Call ${un}StopVBoxTray
731 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
732
733 ; Remove guest driver
734 ${LogVerbose} "Removing guest driver ..."
735 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxGuest.inf$\"" "true"
736
737 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxGuest" "true"
738 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxGuest.sys"
739 Delete /REBOOTOK "$g_strSystemDir\VBCoInst.dll" ; Deprecated, does not get installed anymore
740 Delete /REBOOTOK "$g_strSystemDir\VBoxTray.exe"
741 Delete /REBOOTOK "$g_strSystemDir\VBoxHook.dll"
742 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" ; Remove VBoxTray autorun
743 Delete /REBOOTOK "$g_strSystemDir\VBoxControl.exe"
744
745 ; Remove shared folders driver
746 ${LogVerbose} "Removing shared folders driver ..."
747 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider remove VBoxSF" "true"
748 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxSF" "true"
749 Delete /REBOOTOK "$g_strSystemDir\VBoxMRXNP.dll" ; The network provider DLL will be locked
750 !if $%BUILD_TARGET_ARCH% == "amd64"
751 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
752 Delete /REBOOTOK "$g_strSysWow64\VBoxMRXNP.dll"
753 !endif ; amd64
754 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxSF.sys"
755
756 Pop $0
757
758FunctionEnd
759!macroend
760!insertmacro W2K_Uninstall ""
761!insertmacro W2K_Uninstall "un."
762
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