VirtualBox

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

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

Windows Guest Additions: Added support for Windows 8.1 (Blue) / Windows Server 2012 R2.

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