VirtualBox

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

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

added Win8.1 OS type

  • Property svn:eol-style set to native
File size: 30.8 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_1'
469 ${OrIf} $g_strWinVersion == '8'
470 ${OrIf} $g_strWinVersion == '7'
471 ${OrIf} $g_strWinVersion == 'Vista'
472 ${OrIf} $g_strWinVersion == '2003' ; Windows XP 64-bit is a renamed Windows 2003 really
473 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Version" 2
474 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "DriverVersion" 1
475 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Flags" 1
476 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL" "Dll" "VBoxOGL.dll"
477 ${EndIf}
478 SetRegView 64
479!endif
480 ${Endif}
481!endif
482
483 Goto done
484
485done:
486
487 Pop $0
488
489FunctionEnd
490
491Function W2K_Main
492
493 SetOutPath "$INSTDIR"
494 SetOverwrite on
495
496 Call W2K_Prepare
497 Call W2K_CopyFiles
498
499!ifdef WHQL_FAKE
500 Call W2K_WHQLFakeOn
501!endif
502
503 Call W2K_InstallFiles
504
505!ifdef WHQL_FAKE
506 Call W2K_WHQLFakeOff
507!endif
508
509 Call W2K_SetVideoResolution
510
511FunctionEnd
512
513!macro W2K_UninstallInstDir un
514Function ${un}W2K_UninstallInstDir
515
516 Delete /REBOOTOK "$INSTDIR\VBoxVideo.sys"
517 Delete /REBOOTOK "$INSTDIR\VBoxVideo.inf"
518 Delete /REBOOTOK "$INSTDIR\VBoxVideo.cat"
519 Delete /REBOOTOK "$INSTDIR\VBoxDisp.dll"
520
521 Delete /REBOOTOK "$INSTDIR\VBoxMouse.sys"
522 Delete /REBOOTOK "$INSTDIR\VBoxMouse.inf"
523 Delete /REBOOTOK "$INSTDIR\VBoxMouse.cat"
524
525 Delete /REBOOTOK "$INSTDIR\VBoxTray.exe"
526
527 Delete /REBOOTOK "$INSTDIR\VBoxGuest.sys"
528 Delete /REBOOTOK "$INSTDIR\VBoxGuest.inf"
529 Delete /REBOOTOK "$INSTDIR\VBoxGuest.cat"
530
531 Delete /REBOOTOK "$INSTDIR\VBCoInst.dll" ; Deprecated, does not get installed anymore
532 Delete /REBOOTOK "$INSTDIR\VBoxControl.exe"
533 Delete /REBOOTOK "$INSTDIR\VBoxService.exe" ; Deprecated, does not get installed anymore
534
535!if $%VBOX_WITH_WDDM% == "1"
536 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoWddm.cat"
537 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys"
538 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf"
539 !if $%VBOX_WITH_WDDM_W8% == "1"
540 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoW8.cat"
541 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoW8.sys"
542 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxVideoW8.inf"
543 !endif
544 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
545
546 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
547 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
548 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
549 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
550 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
551 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
552 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
553
554 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
555 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
556 ; Try to delete libWine in case it is there from old installation
557 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\libWine.dll"
558
559 !if $%BUILD_TARGET_ARCH% == "amd64"
560 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
561
562 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
563 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
564 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
565 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
566 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
567 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
568 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
569
570 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
571 Delete /REBOOTOK "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
572 !endif ; $%BUILD_TARGET_ARCH% == "amd64"
573!endif ; $%VBOX_WITH_WDDM% == "1"
574
575 ; WHQL fake
576!ifdef WHQL_FAKE
577 Delete /REBOOTOK "$INSTDIR\VBoxWHQLFake.exe"
578!endif
579
580 ; Log file
581 Delete /REBOOTOK "$INSTDIR\install.log"
582 Delete /REBOOTOK "$INSTDIR\install_ui.log"
583
584FunctionEnd
585!macroend
586!insertmacro W2K_UninstallInstDir ""
587!insertmacro W2K_UninstallInstDir "un."
588
589!macro W2K_Uninstall un
590Function ${un}W2K_Uninstall
591
592 Push $0
593
594 ; Remove VirtualBox video driver
595 ${LogVerbose} "Uninstalling video driver ..."
596 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideo.inf$\"" "true"
597 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideo" "true"
598 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideo.sys"
599 Delete /REBOOTOK "$g_strSystemDir\VBoxDisp.dll"
600
601 ; Remove video driver
602!if $%VBOX_WITH_WDDM% == "1"
603
604 !if $%VBOX_WITH_WDDM_W8% == "1"
605 ${LogVerbose} "Uninstalling WDDM video driver for Windows 8..."
606 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoW8.inf$\"" "true"
607 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoW8" "true"
608 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
609 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
610 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoW8.sys"
611 !endif ; $%VBOX_WITH_WDDM_W8% == "1"
612
613 ${LogVerbose} "Uninstalling WDDM video driver for Windows Vista and 7..."
614 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxVideoWddm.inf$\"" "true"
615 ; Always try to remove both VBoxVideoWddm & VBoxVideo services no matter what is installed currently
616 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxVideoWddm" "true"
617 ;misha> @todo driver file removal (as well as service removal) should be done as driver package uninstall
618 ; could be done with "VBoxDrvInst.exe /u", e.g. by passing additional arg to it denoting that driver package is to be uninstalled
619 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxVideoWddm.sys"
620 Delete /REBOOTOK "$g_strSystemDir\VBoxDispD3D.dll"
621!endif ; $%VBOX_WITH_WDDM% == "1"
622
623!if $%VBOX_WITH_CROGL% == "1"
624
625 ${LogVerbose} "Removing Direct3D support ..."
626
627 ; Do file validation before we uninstall
628 Call ${un}ValidateD3DFiles
629 Pop $0
630 ${If} $0 == "1" ; D3D files are invalid
631 ${LogVerbose} $(VBOX_UNINST_INVALID_D3D)
632 MessageBox MB_ICONSTOP|MB_OK $(VBOX_UNINST_INVALID_D3D) /SD IDOK
633 Goto d3d_uninstall_end
634 ${EndIf}
635
636 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLarrayspu.dll"
637 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLcrutil.dll"
638 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLerrorspu.dll"
639 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpackspu.dll"
640 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLpassthroughspu.dll"
641 Delete /REBOOTOK "$g_strSystemDir\VBoxOGLfeedbackspu.dll"
642 Delete /REBOOTOK "$g_strSystemDir\VBoxOGL.dll"
643
644 ; Remove D3D stuff
645 ; @todo add a feature flag to only remove if installed explicitly
646 Delete /REBOOTOK "$g_strSystemDir\libWine.dll"
647 Delete /REBOOTOK "$g_strSystemDir\VBoxD3D8.dll"
648 Delete /REBOOTOK "$g_strSystemDir\VBoxD3D9.dll"
649 Delete /REBOOTOK "$g_strSystemDir\wined3d.dll"
650 ; Update DLL cache
651 ${If} ${FileExists} "$g_strSystemDir\dllcache\msd3d8.dll"
652 Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d8.dll"
653 Rename /REBOOTOK "$g_strSystemDir\dllcache\msd3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll"
654 ${EndIf}
655 ${If} ${FileExists} "$g_strSystemDir\dllcache\msd3d9.dll"
656 Delete /REBOOTOK "$g_strSystemDir\dllcache\d3d9.dll"
657 Rename /REBOOTOK "$g_strSystemDir\dllcache\msd3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll"
658 ${EndIf}
659 ; Restore original DX DLLs
660 ${If} ${FileExists} "$g_strSystemDir\msd3d8.dll"
661 Delete /REBOOTOK "$g_strSystemDir\d3d8.dll"
662 Rename /REBOOTOK "$g_strSystemDir\msd3d8.dll" "$g_strSystemDir\d3d8.dll"
663 ${EndIf}
664 ${If} ${FileExists} "$g_strSystemDir\msd3d9.dll"
665 Delete /REBOOTOK "$g_strSystemDir\d3d9.dll"
666 Rename /REBOOTOK "$g_strSystemDir\msd3d9.dll" "$g_strSystemDir\d3d9.dll"
667 ${EndIf}
668
669 !if $%BUILD_TARGET_ARCH% == "amd64"
670 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
671 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLarrayspu.dll"
672 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLcrutil.dll"
673 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLerrorspu.dll"
674 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLpackspu.dll"
675 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLpassthroughspu.dll"
676 Delete /REBOOTOK "$g_strSysWow64\VBoxOGLfeedbackspu.dll"
677 Delete /REBOOTOK "$g_strSysWow64\VBoxOGL.dll"
678
679 ; Remove D3D stuff
680 ; @todo add a feature flag to only remove if installed explicitly
681 Delete /REBOOTOK "$g_strSysWow64\libWine.dll"
682 Delete /REBOOTOK "$g_strSysWow64\VBoxD3D8.dll"
683 Delete /REBOOTOK "$g_strSysWow64\VBoxD3D9.dll"
684 Delete /REBOOTOK "$g_strSysWow64\wined3d.dll"
685 ; Update DLL cache
686 ${If} ${FileExists} "$g_strSysWow64\dllcache\msd3d8.dll"
687 Delete /REBOOTOK "$g_strSysWow64\dllcache\d3d8.dll"
688 Rename /REBOOTOK "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll"
689 ${EndIf}
690 ${If} ${FileExists} "$g_strSysWow64\dllcache\msd3d9.dll"
691 Delete /REBOOTOK "$g_strSysWow64\dllcache\d3d9.dll"
692 Rename /REBOOTOK "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll"
693 ${EndIf}
694 ; Restore original DX DLLs
695 ${If} ${FileExists} "$g_strSysWow64\msd3d8.dll"
696 Delete /REBOOTOK "$g_strSysWow64\d3d8.dll"
697 Rename /REBOOTOK "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll"
698 ${EndIf}
699 ${If} ${FileExists} "$g_strSysWow64\msd3d9.dll"
700 Delete /REBOOTOK "$g_strSysWow64\d3d9.dll"
701 Rename /REBOOTOK "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll"
702 ${EndIf}
703 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL"
704 !endif ; amd64
705
706 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\OpenGLDrivers\VBoxOGL"
707
708d3d_uninstall_end:
709
710!endif ; VBOX_WITH_CROGL
711
712 ; Remove mouse driver
713 ${LogVerbose} "Removing mouse driver ..."
714 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxMouse" "true"
715 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxMouse.sys"
716 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" registry delmultisz $\"SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}$\" $\"UpperFilters$\" $\"VBoxMouse$\"" "true"
717
718 ; Delete the VBoxService service
719 Call ${un}StopVBoxService
720 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxService" "true"
721 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxService"
722 Delete /REBOOTOK "$g_strSystemDir\VBoxService.exe"
723
724 ; VBoxGINA
725 Delete /REBOOTOK "$g_strSystemDir\VBoxGINA.dll"
726 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
727 ${If} $0 == "VBoxGINA.dll"
728 ${LogVerbose} "Removing auto-logon support ..."
729 DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
730 ${EndIf}
731 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA"
732
733 ; Delete VBoxTray
734 Call ${un}StopVBoxTray
735 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray"
736
737 ; Remove guest driver
738 ${LogVerbose} "Removing guest driver ..."
739 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" driver uninstall $\"$INSTDIR\VBoxGuest.inf$\"" "true"
740
741 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxGuest" "true"
742 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxGuest.sys"
743 Delete /REBOOTOK "$g_strSystemDir\VBCoInst.dll" ; Deprecated, does not get installed anymore
744 Delete /REBOOTOK "$g_strSystemDir\VBoxTray.exe"
745 Delete /REBOOTOK "$g_strSystemDir\VBoxHook.dll"
746 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "VBoxTray" ; Remove VBoxTray autorun
747 Delete /REBOOTOK "$g_strSystemDir\VBoxControl.exe"
748
749 ; Remove shared folders driver
750 ${LogVerbose} "Removing shared folders driver ..."
751 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" netprovider remove VBoxSF" "true"
752 ${CmdExecute} "$\"$INSTDIR\VBoxDrvInst.exe$\" service delete VBoxSF" "true"
753 Delete /REBOOTOK "$g_strSystemDir\VBoxMRXNP.dll" ; The network provider DLL will be locked
754 !if $%BUILD_TARGET_ARCH% == "amd64"
755 ; Only 64-bit installer: Also remove 32-bit DLLs on 64-bit target arch in Wow64 node
756 Delete /REBOOTOK "$g_strSysWow64\VBoxMRXNP.dll"
757 !endif ; amd64
758 Delete /REBOOTOK "$g_strSystemDir\drivers\VBoxSF.sys"
759
760 Pop $0
761
762FunctionEnd
763!macroend
764!insertmacro W2K_Uninstall ""
765!insertmacro W2K_Uninstall "un."
766
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