VirtualBox

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

Last change on this file since 96768 was 96766, checked in by vboxsync, 2 years ago

Add/Nt/Installer,Add/Nt/Tools,Add/Makefile,/Config.kmk: Use bldRTSignTool to extract the root certificates and always ship+install them, except for the legacy TS CA which won't be installed on W10. bugref:8691

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