VirtualBox

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

Last change on this file since 108935 was 108935, checked in by vboxsync, 2 weeks ago

Windows Guest Additions installer: Fixes for %BUILD_TARGET_ARCH% -> %KBUILD_TARGET_ARCH% (note the 'K' at the beginning).

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette