VirtualBox

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

Last change on this file was 109221, checked in by vboxsync, 9 days ago

Windows Guest Additions: Allow installing Shared Folders when forced mode (/force) is being specified. Allows testing builds from build boxes more easily.

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