VirtualBox

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

Last change on this file since 46867 was 46867, checked in by vboxsync, 11 years ago

GA/Installer/win: fix win8.1 wddm driver installation

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