VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditions.nsi@ 109120

Last change on this file since 109120 was 109120, checked in by vboxsync, 10 days ago

Windows Additions installer: Got rid of strstr.nsh and use the official (included with NSIS) StrFunc.nsh library.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 38.7 KB
Line 
1; $Id: VBoxGuestAdditions.nsi 109120 2025-04-30 15:01:33Z vboxsync $
2; @file
3; VBoxGuestAdditions.nsi - Main file for Windows Guest Additions installation.
4;
5
6;
7; Copyright (C) 2012-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!if $%KBUILD_TYPE% == "debug"
29 !define _DEBUG ; Turn this on to get extra output.
30!endif
31
32!ifdef _DEBUG
33 ; Scratch directory for plugin tests.
34 !addincludedir .\PluginTest
35 !addplugindir .\PluginTest
36!endif
37
38!if $%VBOX_WITH_GUEST_INSTALLER_UNICODE% == "1"
39 ; Whether to use the Unicode version of NSIS.
40 ; Note: Using Unicode will result in the installer not working on a Windows 95/98/ME guest.
41 Unicode true
42!endif
43
44; Defines for special functions.
45!define WFP_FILE_EXCEPTION ; Enables setting a temporary file exception for WFP proctected files.
46
47
48; Product defines.
49!define PRODUCT_NAME "$%VBOX_PRODUCT% Guest Additions"
50!define PRODUCT_DESC "$%VBOX_PRODUCT% Guest Additions"
51!define PRODUCT_VERSION "$%VBOX_VERSION_MAJOR%.$%VBOX_VERSION_MINOR%.$%VBOX_VERSION_BUILD%.$%VBOX_SVN_REV%"
52!define PRODUCT_PUBLISHER "$%VBOX_VENDOR%"
53!define PRODUCT_COPYRIGHT "(C) $%VBOX_C_YEAR% $%VBOX_VENDOR%"
54!define PRODUCT_OUTPUT "VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH%.exe"
55!define PRODUCT_WEB_SITE "https://www.virtualbox.org"
56
57!define LICENSE_FILE_RTF "license.rtf"
58
59; Registry defines.
60!define REGISTRY_KEY_VENDOR_ROOT "SOFTWARE\$%VBOX_VENDOR_SHORT%"
61!define REGISTRY_KEY_PRODUCT_ROOT "${REGISTRY_KEY_VENDOR_ROOT}\VirtualBox Guest Additions"
62!define REGISTRY_KEY_UNINST_ROOT HKLM
63!define REGISTRY_KEY_UNINST_PRODUCT "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
64; Holds the mouse driver path before install (NT4 only).
65; Also was being used by old Sun [xVM] / innotek installations.
66!define REGISTRY_VAL_ORG_MOUSE_PATH "MousePath"
67
68; Needed for InstallLib macro: Install libraries in every case.
69!define LIBRARY_IGNORE_VERSION
70
71VIProductVersion "${PRODUCT_VERSION}"
72VIAddVersionKey "FileVersion" "$%VBOX_VERSION_STRING%"
73VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
74VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
75VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
76VIAddVersionKey "FileDescription" "${PRODUCT_DESC}"
77VIAddVersionKey "LegalCopyright" "${PRODUCT_COPYRIGHT}"
78VIAddVersionKey "InternalName" "${PRODUCT_OUTPUT}"
79
80; If we have our guest install helper DLL, add the plugin path so that NSIS can
81; find it when compiling the installer.
82!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
83 !addplugindir "$%PATH_TARGET%\VBoxGuestInstallHelperDll"
84!endif
85
86!include "LogicLib.nsh"
87!include "FileFunc.nsh"
88 !insertmacro GetParameters
89 !insertmacro GetOptions
90!include "WordFunc.nsh"
91 !insertmacro WordFind
92 !insertmacro StrFilter
93
94!include "nsProcess.nsh"
95!include "Library.nsh"
96!include "Sections.nsh"
97
98; String functions.
99!include "StrFunc.nsh"
100${Using:StrFunc} StrStr
101${Using:StrFunc} UnStrStr
102${Using:StrFunc} StrStrAdv
103; Provide a custom define for ${UnStrStr} so that we can make use of it in
104; macro function which are (also) being used in the uninstaller (functions must begin with ".un").
105!define `un.StrStr` `${UnStrStr}`
106
107!if $%KBUILD_TARGET_ARCH% == "x86" ; Only needed for NT4 SP6 recommendation.
108 !include "servicepack.nsh" ; Function "GetServicePack".
109!endif
110!include "winver.nsh" ; Function for determining Windows version.
111!define REPLACEDLL_NOREGISTER ; Replace in use DLL function.
112!include "ReplaceDLL.nsh"
113
114!if $%KBUILD_TARGET_ARCH% == "amd64"
115 !include "x64.nsh"
116!endif
117
118; Set Modern UI (MUI) as default.
119!define USE_MUI
120
121!ifdef USE_MUI
122 ; Use modern UI, version 2.
123 !include "MUI2.nsh"
124
125 ; MUI Settings.
126 !define MUI_WELCOMEFINISHPAGE_BITMAP "$%VBOX_BRAND_WIN_ADD_INST_DLGBMP%"
127 !define MUI_ABORTWARNING
128 !define MUI_WELCOMEPAGE_TITLE_3LINES ; Add a bit of vertical space for the following text.
129 !define MUI_WELCOMEPAGE_TITLE "$(VBOX_INST_WELCOME_TITLE)"
130
131 ; API defines.
132 !define SM_CLEANBOOT 67
133
134 ; Icons.
135 !if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
136 !define MUI_ICON "$%VBOX_NSIS_ICON_FILE%"
137 !define MUI_UNICON "$%VBOX_NSIS_ICON_FILE%"
138 !else ; 64-bit
139 !define MUI_ICON "$%VBOX_WINDOWS_ADDITIONS_ICON_FILE%"
140 !define MUI_UNICON "$%VBOX_WINDOWS_ADDITIONS_ICON_FILE%"
141 !endif
142
143 ; Welcome page.
144 !insertmacro MUI_PAGE_WELCOME
145 !ifdef VBOX_WITH_LICENSE_DISPLAY
146 ; License page
147 !insertmacro MUI_PAGE_LICENSE "$(VBOX_LICENSE)"
148 !define MUI_LICENSEPAGE_RADIOBUTTONS
149 !endif
150 ; Directory page.
151 !insertmacro MUI_PAGE_DIRECTORY
152 ; Components page.
153 !insertmacro MUI_PAGE_COMPONENTS
154 ; Instfiles page.
155 !insertmacro MUI_PAGE_INSTFILES
156
157 !ifndef _DEBUG
158 !define MUI_FINISHPAGE_TITLE_3LINES ; Have a bit more vertical space for text.
159 !insertmacro MUI_PAGE_FINISH ; Only show in release mode - useful information for debugging!
160 !endif
161
162 ; Uninstaller pages.
163 !insertmacro MUI_UNPAGE_INSTFILES
164
165 ; Define languages we will use.
166 !insertmacro MUI_LANGUAGE "English"
167 !insertmacro MUI_LANGUAGE "French"
168 !insertmacro MUI_LANGUAGE "German"
169
170 ; Set branding text which appears on the horizontal line at the bottom.
171!ifdef _DEBUG
172 BrandingText "VirtualBox Windows Additions $%VBOX_VERSION_STRING% (r$%VBOX_SVN_REV% $%KBUILD_TARGET_ARCH%) - Debug Build"
173!else
174 BrandingText "VirtualBox Windows Additions $%VBOX_VERSION_STRING% r$%VBOX_SVN_REV% ($%KBUILD_TARGET_ARCH%)"
175!endif
176
177!ifdef VBOX_WITH_LICENSE_DISPLAY
178 ; Set license language.
179 LicenseLangString VBOX_LICENSE ${LANG_ENGLISH} "$%VBOX_BRAND_LICENSE_RTF%"
180
181 ; If license files not available (OSE / PUEL) build, then use the English one as default.
182 !ifdef VBOX_BRAND_fr_FR_LICENSE_RTF
183 LicenseLangString VBOX_LICENSE ${LANG_FRENCH} "$%VBOX_BRAND_fr_FR_LICENSE_RTF%"
184 !else
185 LicenseLangString VBOX_LICENSE ${LANG_FRENCH} "$%VBOX_BRAND_LICENSE_RTF%"
186 !endif
187 !ifdef VBOX_BRAND_de_DE_LICENSE_RTF
188 LicenseLangString VBOX_LICENSE ${LANG_GERMAN} "$%VBOX_BRAND_de_DE_LICENSE_RTF%"
189 !else
190 LicenseLangString VBOX_LICENSE ${LANG_GERMAN} "$%VBOX_BRAND_LICENSE_RTF%"
191 !endif
192!endif
193
194 !insertmacro MUI_RESERVEFILE_LANGDLL
195!else ; !USE_MUI
196 XPStyle on
197!ifdef VBOX_WITH_LICENSE_DISPLAY
198 Page license
199!endif
200 Page components
201 Page directory
202 Page instfiles
203!endif ; !USE_MUI
204
205; Must come after MUI includes to have certain defines set for DumpLog.
206!if $%VBOX_WITH_GUEST_INSTALL_HELPER% != "1"
207 !include "dumplog.nsh" ; Dump log to file function.
208!endif
209
210; Language files.
211!include "Languages\English.nsh"
212!include "Languages\French.nsh"
213!include "Languages\German.nsh"
214
215; Variables and output files.
216Name "${PRODUCT_NAME} $%VBOX_VERSION_STRING%"
217!ifdef UNINSTALLER_ONLY
218 !echo "Uninstaller only!"
219 OutFile "$%PATH_TARGET%\VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH%-uninst.exe"
220!else
221 OutFile "VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH%.exe"
222!endif ; UNINSTALLER_ONLY
223
224; Define default installation directory.
225!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit
226 InstallDir "$PROGRAMFILES32\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions"
227!else ; 64-bit
228 InstallDir "$PROGRAMFILES64\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions"
229!endif
230
231InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
232ShowInstDetails show
233ShowUnInstDetails show
234RequestExecutionLevel highest
235
236; Internal parameters.
237Var g_iSystemMode ; Current system mode (0 = Normal boot, 1 = Fail-safe boot, 2 = Fail-safe with network boot).
238Var g_strSystemDir ; Windows system directory.
239Var g_strSysWow64 ; The SysWow64 directory on 64-bit systems.
240Var g_strCurUser ; Current user using the system.
241Var g_strAddVerMaj ; Installed Guest Additions: Major version.
242Var g_strAddVerMin ; Installed Guest Additions: Minor version.
243Var g_strAddVerBuild ; Installed Guest Additions: Build number.
244Var g_strAddVerRev ; Installed Guest Additions: SVN revision.
245Var g_strWinVersion ; Current Windows version we're running on.
246Var g_bLogEnable ; Do logging when installing? "true" or "false".
247Var g_bCapDllCache ; Capability: Does the (Windows) guest have have a DLL cache which needs to be taken care of?
248Var g_bCapXPDM ; Capability: Is the guest able to handle/use our XPDM driver?
249Var g_bCapWDDM ; Capability: Is the guest able to handle/use our WDDM driver?
250Var g_strEarlyNTDrvInfix ; Empty or 'EarlyNT'. For Picking VBoxGuestEarlyNT.inf and VBoxVideoEarlyNT.inf on w2k & nt4.
251
252
253; Command line parameters - these can be set/modified on the command line.
254Var g_bForceInstall ; Cmd line: Force installation on unknown Windows OS version.
255Var g_bUninstall ; Cmd line: Just uninstall any previous Guest Additions and exit.
256Var g_bRebootOnExit ; Cmd line: Auto-Reboot on successful installation. Good for unattended installations ("/reboot").
257Var g_iScreenBpp ; Cmd line: Screen depth ("/depth=X").
258Var g_iScreenX ; Cmd line: Screen resolution X ("/resx=X").
259Var g_iScreenY ; Cmd line: Screen resolution Y ("/resy=Y").
260Var g_iSfOrder ; Cmd line: Order of Shared Folders network provider (0=first, 1=second, ...).
261Var g_bIgnoreUnknownOpts ; Cmd line: Ignore unknown options (don't display the help).
262Var g_bNoVBoxServiceExit ; Cmd line: Do not quit VBoxService before updating - install on next reboot.
263Var g_bNoVBoxTrayExit ; Cmd line: Do not quit VBoxTray before updating - install on next reboot.
264Var g_bNoVideoDrv ; Cmd line: Do not install the VBoxVideo driver.
265Var g_bNoGuestDrv ; Cmd line: Do not install the VBoxGuest driver.
266Var g_bNoMouseDrv ; Cmd line: Do not install the VBoxMouse driver.
267Var g_bNoStartMenuEntries ; Cmd line: Do not create start menu entries.
268Var g_bWithAutoLogon ; Cmd line: Install VBoxGINA / VBoxCredProv for auto logon support.
269Var g_bWithWDDM ; Cmd line: Install the WDDM graphics driver instead of the XPDM one.
270Var g_bOnlyExtract ; Cmd line: Only extract all files, do *not* install them. Only valid with param "/D" (target directory).
271Var g_bPostInstallStatus ; Cmd line: Post the overall installation status to some external program (VBoxTray).
272Var g_bInstallTimestampCA ; Cmd line: Force installing the timestamp CA on the system.
273
274; Platform parts of this installer
275!include "VBoxGuestAdditionsLog.nsh"
276!include "VBoxGuestAdditionsExternal.nsh"
277!include "VBoxGuestAdditionsCommon.nsh"
278!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit only.
279 !include "VBoxGuestAdditionsNT4.nsh"
280!endif
281!include "VBoxGuestAdditionsW2KXP.nsh"
282!include "VBoxGuestAdditionsVista.nsh"
283!include "VBoxGuestAdditionsUninstall.nsh" ; Product uninstallation.
284!ifndef UNINSTALLER_ONLY
285 !include "VBoxGuestAdditionsUninstallOld.nsh" ; Uninstallation of deprecated versions which must be removed first.
286!endif
287
288Function HandleCommandLine
289
290 Push $0 ; Command line (without process name).
291 Push $1 ; Number of parameters.
292 Push $2 ; Current parameter index.
293 Push $3 ; Current parameter pair (name=value).
294 Push $4 ; Current parameter name.
295 Push $5 ; Current parameter value (if present).
296
297 StrCpy $1 "0" ; Init param counter.
298 StrCpy $2 "1" ; Init current param counter.
299
300 ${GetParameters} $0 ; Extract command line.
301 ${If} $0 == "" ; If no parameters at all exit.
302 Goto exit
303 ${EndIf}
304
305 ; Enable for debugging.
306 ;MessageBox MB_OK "CmdLine: $0"
307
308 ${WordFind} $0 " " "#" $1 ; Get number of parameters in cmd line.
309 ${If} $0 == $1 ; If result matches the input then.
310 StrCpy $1 "1" ; no delimiter was found. Correct to 1 word total.
311 ${EndIf}
312
313 ${While} $2 <= $1 ; Loop through all params.
314
315 ${WordFind} $0 " " "+$2" $3 ; Get current name=value pair.
316 ${WordFind} $3 "=" "+1" $4 ; Get current param name.
317 ${WordFind} $3 "=" "+2" $5 ; Get current param value.
318
319 ${StrFilter} $4 "-" "" "" $4 ; Transfer param name to lowercase.
320
321 ; Enable for debugging.
322 ;MessageBox MB_OK "#$2 of #$1, param='$3', name=$4, val=$5"
323
324 ${Switch} $4
325
326 ${Case} '/d' ; NSIS: /D=<instdir> switch, skip.
327 ${Break}
328
329 ${Case} '/depth'
330 ${Case} 'depth'
331 StrCpy $g_iScreenBpp $5
332 ${Break}
333
334 ${Case} '/extract'
335 StrCpy $g_bOnlyExtract "true"
336 ${Break}
337
338 ${Case} '/force'
339 StrCpy $g_bForceInstall "true"
340 ${Break}
341
342 ${Case} '/help'
343 ${Case} '/H'
344 ${Case} '/h'
345 ${Case} '/?'
346 Goto usage
347 ${Break}
348
349 ${Case} '/ignore_unknownopts' ; Not officially documented.
350 StrCpy $g_bIgnoreUnknownOpts "true"
351 ${Break}
352
353 ${Case} '/l'
354 ${Case} '/log'
355 ${Case} '/logging'
356 StrCpy $g_bLogEnable "true"
357 ${Break}
358
359 ${Case} '/ncrc' ; NSIS: /NCRC switch, skip.
360 ${Break}
361
362 ${Case} '/no_vboxservice_exit' ; Not officially documented.
363 StrCpy $g_bNoVBoxServiceExit "true"
364 ${Break}
365
366 ${Case} '/no_vboxtray_exit' ; Not officially documented.
367 StrCpy $g_bNoVBoxTrayExit "true"
368 ${Break}
369
370 ${Case} '/no_videodrv' ; Not officially documented.
371 StrCpy $g_bNoVideoDrv "true"
372 ${Break}
373
374 ${Case} '/no_guestdrv' ; Not officially documented.
375 StrCpy $g_bNoGuestDrv "true"
376 ${Break}
377
378 ${Case} '/no_mousedrv' ; Not officially documented.
379 StrCpy $g_bNoMouseDrv "true"
380 ${Break}
381
382 ${Case} '/no_startmenuentries' ; Not officially documented.
383 StrCpy $g_bNoStartMenuEntries "true"
384 ${Break}
385
386!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
387 ; This switch tells our installer that it
388 ; - should not quit VBoxTray during the update, because ...
389 ; - ... it should show the overall installation status
390 ; using VBoxTray's balloon message feature (since VBox 4.0)
391 ${Case} '/post_installstatus' ; Not officially documented.
392 StrCpy $g_bNoVBoxTrayExit "true"
393 StrCpy $g_bPostInstallStatus "true"
394 ${Break}
395!endif
396
397 ${Case} '/install_timestamp_ca' ; Not officially documented.
398 StrCpy $g_bInstallTimestampCA "true"
399 ${Break}
400
401 ${Case} '/no_install_timestamp_ca' ; Ditto.
402 StrCpy $g_bInstallTimestampCA "false"
403 ${Break}
404
405 ${Case} '/reboot'
406 StrCpy $g_bRebootOnExit "true"
407 ${Break}
408
409 ${Case} '/s' ; NSIS: /S switch, skip.
410 ${Break}
411
412 ${Case} '/sforder'
413 ${Case} 'sforder'
414 StrCpy $g_iSfOrder $5
415 ${Break}
416
417 ${Case} '/uninstall'
418 StrCpy $g_bUninstall "true"
419 ${Break}
420
421 ${Case} '/with_autologon'
422 StrCpy $g_bWithAutoLogon "true"
423 ${Break}
424
425!if $%VBOX_WITH_WDDM% == "1"
426 ${Case} '/with_wddm'
427 StrCpy $g_bWithWDDM "true"
428 ${Break}
429!endif
430
431 ${Case} '/xres'
432 ${Case} 'xres'
433 StrCpy $g_iScreenX $5
434 ${Break}
435
436 ${Case} '/yres'
437 ${Case} 'yres'
438 StrCpy $g_iScreenY $5
439 ${Break}
440
441 ${Default} ; Unknown parameter, print usage message.
442 ; Prevent popping up usage message on (yet) unknown parameters
443 ; in silent mode, just skip.
444 IfSilent +1 +2
445 ${Break}
446 goto usage
447 ${Break}
448
449 ${EndSwitch}
450
451next_param:
452
453 IntOp $2 $2 + 1
454
455 ${EndWhile}
456 Goto exit
457
458usage:
459
460 ; If we were told to ignore unknown (invalid) options, just return to
461 ; the parsing loop ...
462 ${If} $g_bIgnoreUnknownOpts == "true"
463 Goto next_param
464 ${EndIf}
465 MessageBox MB_OK "${PRODUCT_NAME} Installer$\r$\n$\r$\n \
466 Usage: VBoxWindowsAdditions-$%KBUILD_TARGET_ARCH% [OPTIONS] [/l] [/S] [/D=<PATH>]$\r$\n$\r$\n \
467 Options:$\r$\n \
468 /depth=BPP$\tSets the guest's display color depth (bits per pixel)$\r$\n \
469 /extract$\t$\tOnly extract installation files$\r$\n \
470 /force$\t$\tForce installation on unknown/undetected Windows versions$\r$\n \
471 /uninstall$\t$\tJust uninstalls the Guest Additions and exits$\r$\n \
472 /with_autologon$\tInstalls auto-logon support$\r$\n \
473 /with_d3d$\tInstalls D3D support$\r$\n \
474 /with_wddm$\tInstalls the WDDM instead of the XPDM graphics driver$\r$\n \
475 /xres=X$\t$\tSets the guest's display resolution (width in pixels)$\r$\n \
476 /yres=Y$\t$\tSets the guest's display resolution (height in pixels)$\r$\n \
477 $\r$\n \
478 Installer parameters:$\r$\n \
479 /l$\t$\tEnables logging$\r$\n \
480 /S$\t$\tSilent install$\r$\n \
481 /D=<PATH>$\tSets the default install path$\r$\n \
482 $\r$\n \
483 Note: Order of options and installer parameters is fixed, options first." /SD IDOK
484
485 ; No stack restore needed, we're about to quit.
486 Quit
487
488!ifdef UNUSED_CODE
489done:
490
491!ifdef _DEBUG
492 ${LogVerbose} "Property: XRes: $g_iScreenX"
493 ${LogVerbose} "Property: YRes: $g_iScreenY"
494 ${LogVerbose} "Property: BPP: $g_iScreenBpp"
495 ${LogVerbose} "Property: Logging enabled: $g_bLogEnable"
496!endif
497!endif ;UNUSED_CODE
498
499exit:
500
501 Pop $5
502 Pop $4
503 Pop $3
504 Pop $2
505 Pop $1
506 Pop $0
507
508FunctionEnd
509
510
511!ifndef UNINSTALLER_ONLY
512Function CheckForInstalledComponents
513
514 Push $0
515 Push $1
516
517 ${LogVerbose} "Checking for installed components ..."
518 StrCpy $1 ""
519
520 Call SetAppMode64
521
522 ; VBoxGINA already installed? So we need to update the installed version as well,
523 ; regardless whether the user used "/with_autologon" or not.
524 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
525 ${If} $0 == "VBoxGINA.dll"
526 StrCpy $1 "GINA"
527 ${Else}
528 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" ""
529 ${If} $0 == "VBoxCredProv"
530 StrCpy $1 "Credential Provider"
531 ${EndIf}
532 ${EndIf}
533
534!ifdef _DEBUG
535 ${LogVerbose} "Auto-logon module: $0"
536!endif
537
538 ${IfNot} $1 == ""
539 ${LogVerbose} "Auto-logon support ($1) was installed previously"
540 StrCpy $g_bWithAutoLogon "true" ; Force update.
541 ${Else}
542 ${LogVerbose} "Auto-logon support was not installed previously"
543 ${EndIf}
544
545 Pop $1
546 Pop $0
547
548FunctionEnd
549
550
551;;
552; Extracts all files for the current OS to the specified target directory.
553;
554; Input:
555; None
556; Output:
557; None
558;
559Function ExtractFiles
560
561 !insertmacro Common_EmitOSSelectionSwitch
562osselswitch_case_w2k_xp_w2k3:
563 Call W2K_CallbackExtractFiles
564 goto done
565osselswitch_case_vista_and_later:
566 Call W2K_CallbackExtractFiles
567 Call Vista_CallbackExtractFiles
568 goto done
569!if $%KBUILD_TARGET_ARCH% == "x86" ; 32-bit only
570 osselswitch_case_nt4:
571 Call NT4_CallbackExtractFiles
572 goto done
573!endif
574osselswitch_case_unsupported:
575 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
576 Quit
577done:
578 Call Common_ExtractFiles
579 MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
580 Quit
581
582FunctionEnd
583!endif ; !UNINSTALLER_ONLY
584
585
586;
587; Main Files
588;
589Section $(VBOX_COMPONENT_MAIN) SEC01
590
591 SectionIn RO ; Section cannot be unselected (read-only).
592 ${If} $g_bPostInstallStatus == "true"
593 ${LogToVBoxTray} "0" "${PRODUCT_NAME} update started, please wait ..."
594 ${EndIf}
595
596 IfSilent +1 +2
597 StrCpy $g_bLogEnable "true" ; Force logging in silent mode.
598
599 ${LogEnable} "$g_bLogEnable"
600 IfSilent +1 +2 ; NSIS will expand ${LogVerbose} before doing relative jumps!
601 LogText "Installer runs in silent mode"
602
603 SetOutPath "$INSTDIR"
604 SetOverwrite on
605
606 Call SetAppMode64
607
608 StrCpy $g_strSystemDir "$SYSDIR"
609
610 ${LogVerbose} "Version: $%VBOX_VERSION_STRING% (Rev $%VBOX_SVN_REV%)"
611 ${If} $g_strAddVerMaj != ""
612 ${LogVerbose} "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
613 ${Else}
614 ${LogVerbose} "No previous version of ${PRODUCT_NAME} detected"
615 ${EndIf}
616!if $%KBUILD_TARGET_ARCH% == "amd64"
617 ${LogVerbose} "Detected OS: Windows $g_strWinVersion (64-bit)"
618!else
619 ${LogVerbose} "Detected OS: Windows $g_strWinVersion (32-bit)"
620!endif
621 ${LogVerbose} "System Directory: $g_strSystemDir"
622
623!ifdef _DEBUG
624 ${LogVerbose} "Installer runs in debug mode"
625!endif
626
627 Abort
628
629 ;
630 ; Here starts the main dispatcher (based on guest OS).
631 ;
632 !insertmacro Common_EmitOSSelectionSwitch
633osselswitch_case_unsupported:
634 ${If} $g_bForceInstall == "true"
635 Goto osselswitch_case_vista_and_later ; Assume newer OS than we know of ...
636 ${EndIf}
637 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
638 goto exit
639
640!if $%KBUILD_TARGET_ARCH% == "x86"
641osselswitch_case_nt4:
642
643 Call GetServicePack
644 Pop $R0 ; Major version.
645 Pop $R1 ; Minor version.
646
647 ; At least Service Pack 6 installed?
648 ${If} $R0 <> "6"
649 MessageBox MB_YESNO $(VBOX_NT4_NO_SP6) /SD IDYES IDYES +2
650 Quit
651 ${EndIf}
652
653 Call NT4_CallbackPrepare
654
655 Call Common_ExtractFiles
656
657 Call NT4_CallbackExtractFiles
658 Call NT4_CallbackInstall
659 goto success
660!endif ; $%KBUILD_TARGET_ARCH% == "x86"
661
662 ;
663 ; Windows 2000, XP and Windows Server 2003 / XP64.
664 ;
665osselswitch_case_w2k_xp_w2k3:
666
667 Call W2K_CallbackPrepare
668
669 Call Common_ExtractFiles
670 Call W2K_CallbackExtractFiles
671 Call W2K_CallbackInstall
672 goto success
673
674 ;
675 ; Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 and related server products.
676 ;
677osselswitch_case_vista_and_later:
678
679 Call W2K_CallbackPrepare
680 Call Vista_CallbackPrepare
681
682 Call Common_ExtractFiles
683
684 Call W2K_CallbackExtractFiles
685 Call W2K_CallbackInstall
686
687 Call Vista_CallbackExtractFiles
688 Call Vista_CallbackInstall
689 goto success
690
691success:
692
693 ; Write a registry key with version and installation path for later lookup.
694 WriteRegStr HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "Version" "$%VBOX_VERSION_STRING_RAW%"
695 WriteRegStr HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "VersionExt" "$%VBOX_VERSION_STRING%"
696 WriteRegStr HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "Revision" "$%VBOX_SVN_REV%"
697 WriteRegStr HKLM "${REGISTRY_KEY_PRODUCT_ROOT}" "InstallDir" "$INSTDIR"
698
699 ; Set the reboot flag to tell the finish page that is should
700 ; default to the "reboot now" entry.
701 SetRebootFlag true
702
703exit:
704
705SectionEnd
706
707
708;;
709; Auto-logon support (section is hidden at the moment -- only can be enabled via command line switch).
710;
711Section /o -$(VBOX_COMPONENT_AUTOLOGON) SEC02
712
713 Call SetAppMode64
714
715 Call GetWindowsVersion
716 Pop $R0 ; Windows Version
717
718 ${LogVerbose} "Installing auto-logon support ..."
719
720 ; Another GINA already is installed? Check if this is ours, otherwise let the user decide (unless it's a silent setup)
721 ; whether to replace it with the VirtualBox one or not.
722 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
723 ${If} $0 != ""
724 ${If} $0 != "VBoxGINA.dll"
725 ${LogVerbose} "Found another already installed GINA module: $0"
726 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(VBOX_COMPONENT_AUTOLOGON_WARN_3RDPARTY) /SD IDYES IDYES install
727 ${LogVerbose} "Skipping GINA installation, keeping: $0"
728 goto done
729 ${EndIf}
730 ${EndIf}
731
732install:
733
734 ; Do we need VBoxCredProv or VBoxGINA?
735 !insertmacro Common_EmitOSSelectionSwitch
736 osselswitch_case_unsupported:
737 ${LogVerbose} "Warning: Unsupported OS found, skipping auto-logon installation" ; Do not break guests which aren't supported yet.
738 goto done
739 osselswitch_case_vista_and_later:
740 ; Use VBoxCredProv on Vista and up.
741 ${LogVerbose} "Installing VirtualBox credential provider ..."
742 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxCredProv.dll" "$g_strSystemDir\VBoxCredProv.dll" "$INSTDIR"
743 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (default) key
744 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (Default) key
745 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "" "VBoxCredProv.dll" ; adding to (Default) key
746 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "ThreadingModel" "Apartment"
747 goto done
748 osselswitch_case_w2k_xp_w2k3:
749!if $%KBUILD_TARGET_ARCH% == "x86"
750 osselswitch_case_nt4:
751!endif
752 ${LogVerbose} "Installing VirtualBox GINA ..."
753 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
754 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
755 ; Add Windows notification package callbacks for VBoxGINA
756 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "DLLName" "VBoxGINA.dll"
757 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "Impersonate" 0
758 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "StopScreenSaver" "WnpScreenSaverStop"
759 goto done
760
761
762 done:
763
764SectionEnd
765
766
767; Direct3D support
768Section /o $(VBOX_COMPONENT_D3D) SEC03
769
770 ; Nothing to do in here right now.
771
772SectionEnd
773
774; Start menu entries. Enabled by default and can be disabled by the user.
775Section /o $(VBOX_COMPONENT_STARTMENU) SEC04
776
777 Delete /REBOOTOK "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" ; Changed to Website.url in r153663, so remove the old one
778
779 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
780 WriteIniStr "$SMPROGRAMS\${PRODUCT_NAME}\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
781 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
782
783SectionEnd
784
785!ifdef USE_MUI
786 ;Assign language strings to sections
787 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
788 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
789 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
790 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
791 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(VBOX_COMPONENT_STARTMENU_DESC)
792 !insertmacro MUI_FUNCTION_DESCRIPTION_END
793!endif ; USE_MUI
794
795Section -Content
796
797 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
798
799SectionEnd
800
801
802; This section is called after all the files are in place.
803Section -Post
804
805!ifdef _DEBUG
806 ${LogVerbose} "Doing post install ..."
807!endif
808
809!ifdef EXTERNAL_UNINSTALLER
810 SetOutPath "$INSTDIR"
811 FILE "$%PATH_TARGET%\uninst.exe"
812!else
813 WriteUninstaller "$INSTDIR\uninst.exe"
814!endif
815
816 ; Write uninstaller in "Add / Remove programs".
817 WriteRegStr ${REGISTRY_KEY_UNINST_ROOT} "${REGISTRY_KEY_UNINST_PRODUCT}" "DisplayName" "$(^Name)"
818 WriteRegStr ${REGISTRY_KEY_UNINST_ROOT} "${REGISTRY_KEY_UNINST_PRODUCT}" "UninstallString" "$INSTDIR\uninst.exe"
819 WriteRegStr ${REGISTRY_KEY_UNINST_ROOT} "${REGISTRY_KEY_UNINST_PRODUCT}" "DisplayVersion" "${PRODUCT_VERSION}"
820 WriteRegStr ${REGISTRY_KEY_UNINST_ROOT} "${REGISTRY_KEY_UNINST_PRODUCT}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
821 WriteRegStr ${REGISTRY_KEY_UNINST_ROOT} "${REGISTRY_KEY_UNINST_PRODUCT}" "Publisher" "${PRODUCT_PUBLISHER}"
822
823 ; Tune TcpWindowSize for a better network throughput.
824 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
825
826!ifdef _DEBUG
827 ${LogVerbose} "Enable backdoor logging for debug build."
828 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\VBoxGuest" "LoggingEnabled" 255
829!endif
830
831 ; Add Sun Ray client info keys.
832 ; Note: We only need 32-bit keys (HKLM\Software / HKLM\Software\Wow6432Node).
833 ;; @todo r=andy Remove this / still needed?
834!if $%KBUILD_TARGET_ARCH% == "amd64"
835 WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
836 WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
837!else
838 WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
839 WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
840!endif
841
842 ${LogVerbose} "Installation completed."
843
844 ;
845 ; Dump UI log to on success too. Only works with non-silent installs.
846 ; (This has to be done here rather than in .onInstSuccess, because by
847 ; then the log is no longer visible in the UI).
848 ;
849 ${IfNot} ${Silent}
850 !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
851 VBoxGuestInstallHelper::DumpLog "$INSTDIR\install_ui.log"
852 !else
853 StrCpy $0 "$INSTDIR\install_ui.log"
854 Push $0
855 Call DumpLog
856 !endif
857 ${EndIf}
858
859SectionEnd
860
861
862;;
863; !!! NOTE: This function *has* to be right under the last section; otherwise it does
864; *not* get called! Don't ask me why ... !!!
865Function .onSelChange
866
867 Push $0
868
869 ; Handle selection of WDDM component.
870 SectionGetFlags ${SEC03} $0
871 ${If} $0 == ${SF_SELECTED}
872
873!if $%VBOX_WITH_WDDM% == "1"
874 ; If we're able to use the WDDM driver just use it.
875 ${If} $g_bCapWDDM == "true"
876 StrCpy $g_bWithWDDM "true"
877 ${EndIf}
878
879!endif ; $%VBOX_WITH_WDDM% == "1"
880
881 ${Else} ; WDDM unselected again
882
883 ${If} $g_strWinVersion != "8" ; On Windows 8 WDDM is mandatory.
884 ${AndIf} $g_strWinVersion != "8_1" ; ... also on Windows 8.1 / Windows 2012 Server R2.
885 ${AndIf} $g_strWinVersion != "10" ; ... also on Windows 10.
886 StrCpy $g_bWithWDDM "false"
887 ${EndIf}
888
889 ${EndIf}
890
891 Pop $0
892
893FunctionEnd
894
895
896; Function which is being called when installation failed.
897; This will abort the installer.
898;
899; Input:
900; None
901; Output:
902; None
903;
904Function .onInstFailed
905
906 ${LogVerbose} "$(VBOX_ERROR_INST_FAILED)"
907 MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
908
909 ${If} $g_bPostInstallStatus == "true"
910 ${LogToVBoxTray} "2" "Error while installing ${PRODUCT_NAME}!"
911 ${EndIf}
912
913 ; Dump UI log to see what happend. Only works with non-silent installs.
914 ${IfNot} ${Silent}
915 !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
916 VBoxGuestInstallHelper::DumpLog "$INSTDIR\install_ui.log"
917 !else
918 StrCpy $0 "$INSTDIR\install_ui.log"
919 Push $0
920 Call DumpLog
921 !endif
922 ${EndIf}
923
924 ; Set overall exit code
925 SetErrorLevel 1
926
927FunctionEnd
928
929
930;;
931; Function which is being called when installation was successful.
932;
933; Input:
934; None
935; Output:
936; None
937;
938Function .onInstSuccess
939
940 ${LogVerbose} "${PRODUCT_NAME} successfully installed"
941
942 ${If} $g_bPostInstallStatus == "true"
943 ${LogToVBoxTray} "0" "${PRODUCT_NAME} successfully updated!"
944 ${EndIf}
945
946 SetErrorLevel 0
947
948FunctionEnd
949
950
951;;
952; Function which is being called at the very beginning of installer execution.
953;
954; Input:
955; None
956; Output:
957; None
958;
959Function .onInit
960
961 Push $0
962
963 ; Init values
964 StrCpy $g_iSystemMode "0"
965 StrCpy $g_strCurUser "<None>"
966 StrCpy $g_strAddVerMaj "0"
967 StrCpy $g_strAddVerMin "0"
968 StrCpy $g_strAddVerBuild "0"
969 StrCpy $g_strAddVerRev "0"
970
971 StrCpy $g_bIgnoreUnknownOpts "false"
972 StrCpy $g_bLogEnable "false"
973 StrCpy $g_bForceInstall "false"
974 StrCpy $g_bUninstall "false"
975 StrCpy $g_bRebootOnExit "false"
976 StrCpy $g_iScreenX "0"
977 StrCpy $g_iScreenY "0"
978 StrCpy $g_iScreenBpp "0"
979 StrCpy $g_iSfOrder "0"
980 StrCpy $g_bNoVBoxServiceExit "false"
981 StrCpy $g_bNoVBoxTrayExit "false"
982 StrCpy $g_bNoVideoDrv "false"
983 StrCpy $g_bNoGuestDrv "false"
984 StrCpy $g_bNoMouseDrv "false"
985 StrCpy $g_bNoStartMenuEntries "false"
986 StrCpy $g_bWithAutoLogon "false"
987 StrCpy $g_bOnlyExtract "false"
988 StrCpy $g_bWithWDDM "false"
989 StrCpy $g_bCapDllCache "false"
990 StrCpy $g_bCapXPDM "false"
991 StrCpy $g_bCapWDDM "false"
992 StrCpy $g_bPostInstallStatus "false"
993 StrCpy $g_bInstallTimestampCA "unset" ; Tri-state: "unset", "true" and "false".
994
995 ; We need a special directory set to SysWOW64 because some
996 ; shell operations don't support file redirection (yet).
997 StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
998
999 SetErrorLevel 0
1000 ClearErrors
1001
1002!ifdef UNINSTALLER_ONLY
1003
1004 ;
1005 ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
1006 ; so we can sign it.
1007 ;
1008 ; Note that the Quit causes the exit status to be 2 instead of 0.
1009 ;
1010 WriteUninstaller "$%PATH_TARGET%\uninst.exe"
1011 Quit
1012
1013!else
1014
1015 ; Handle command line
1016 Call HandleCommandLine
1017
1018 ; Check if there's already another instance of the installer is running -
1019 ; important for preventing NT4 to spawn the installer twice.
1020 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
1021 Pop $0
1022 ${If} $0 != 0
1023 Quit
1024 ${EndIf}
1025
1026 ; Retrieve Windows version and store result in $g_strWinVersion.
1027 Call GetWindowsVersionEx
1028 Pop $g_strWinVersion
1029
1030 ; Init global variables that depends on the windows version.
1031 ${If} $g_strWinVersion == "XP"
1032 StrCpy $g_strEarlyNTDrvInfix "EarlyNT"
1033 ${ElseIf} $g_strWinVersion == "2000"
1034 StrCpy $g_strEarlyNTDrvInfix "EarlyNT"
1035 ${ElseIf} $g_strWinVersion == "NT4"
1036 StrCpy $g_strEarlyNTDrvInfix "EarlyNT"
1037 ${Else}
1038 StrCpy $g_strEarlyNTDrvInfix ""
1039 ${EndIf}
1040
1041 ; Retrieve capabilities.
1042 Call CheckForCapabilities
1043
1044 ; Get user Name.
1045 AccessControl::GetCurrentUserName
1046 Pop $g_strCurUser
1047 ${LogVerbose} "Current user: $g_strCurUser"
1048
1049 ; Only extract files? This action can be called even from non-Admin users
1050 ; and non-compatible architectures.
1051 ${If} $g_bOnlyExtract == "true"
1052 Call ExtractFiles
1053 MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
1054 Quit
1055 ${EndIf}
1056
1057 ; Check for correct architecture.
1058 !if $%KBUILD_TARGET_ARCH% == "amd64"
1059 ${IfNot} ${IsNativeAMD64}
1060 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_AMD64) /SD IDOK
1061 Abort "$(VBOX_NOTICE_ARCH_AMD64)"
1062 ${EndIf}
1063 !else if $%KBUILD_TARGET_ARCH% == "arm64"
1064 ${IfNot} ${IsNativeARM64}
1065 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_ARM64) /SD IDOK
1066 Abort "$(VBOX_NOTICE_ARCH_ARM64)"
1067 ${EndIf}
1068 !else
1069 ${IfNot} ${IsNativeIA32}
1070 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
1071 Abort "$(VBOX_NOTICE_ARCH_X86)"
1072 ${EndIf}
1073 !endif
1074
1075 ; Has the user who calls us admin rights?
1076 UserInfo::GetAccountType
1077 Pop $0
1078 ${If} $0 != "Admin"
1079 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1080 Abort
1081 ${EndIf}
1082
1083 ; Only uninstall?
1084 ${If} $g_bUninstall == "true"
1085 Call Uninstall_Perform
1086 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1087 Quit
1088 ${EndIf}
1089
1090 Call CheckForInstalledComponents
1091
1092 ;
1093 ; Section 02
1094 ;
1095 ${If} $g_bWithAutoLogon == "true" ; Auto-logon support.
1096 !insertmacro SelectSection ${SEC02}
1097 ${EndIf}
1098
1099 ;
1100 ; Section 03
1101 ;
1102 ${If} $g_bWithWDDM == "true" ; D3D / WDDM support.
1103 !insertmacro SelectSection ${SEC03}
1104 ${EndIf}
1105 ; On Windows 8 / 8.1 / Windows Server 2012 R2 and newer we always select the 3D
1106 ; section and disable it so that it cannot be deselected again.
1107 ${If} $g_strWinVersion == "8"
1108 ${OrIf} $g_strWinVersion == "8_1"
1109 ${OrIf} $g_strWinVersion == "10"
1110 IntOp $0 ${SF_SELECTED} | ${SF_RO}
1111 SectionSetFlags ${SEC03} $0
1112 ${EndIf}
1113 ; If the guest is not able to handle/use our WDDM driver, then 3D is not available.
1114 ${If} $g_bCapWDDM != "true"
1115 SectionSetFlags ${SEC03} ${SF_RO}
1116 ${EndIf}
1117
1118 ;
1119 ; Section 04
1120 ;
1121 ${If} $g_bNoStartMenuEntries == "false" ; Start menu entries.
1122 !insertmacro SelectSection ${SEC04}
1123 ${EndIf}
1124
1125 !ifdef USE_MUI
1126 ; Display language selection dialog (will be hidden in silent mode!).
1127 !ifdef VBOX_INSTALLER_ADD_LANGUAGES
1128 !insertmacro MUI_LANGDLL_DISPLAY
1129 !endif
1130 !endif
1131
1132 Call SetAppMode64
1133
1134 Call GetAdditionsVersion
1135 Call HandleOldGuestAdditions
1136
1137 ; Due to some bug in NSIS the license page won't be displayed if we're in
1138 ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
1139 ; mode for now.
1140 Call SetAppMode32
1141
1142!endif ; UNINSTALLER_ONLY
1143
1144 Pop $0
1145
1146FunctionEnd
1147
1148
1149!ifndef EXTERNAL_UNINSTALLER
1150;;
1151; Function which is being called at the uninstallation success.
1152;
1153; Input:
1154; None
1155; Output:
1156; None
1157;
1158; The uninstaller is built separately when doing code signing.
1159;
1160; When building the non-uninstaller part, we get a 6020 warning because NSIS
1161; detects uninstaller related _code_ (un.xxxx) being present. It would take
1162; some effort to eliminate that one.
1163;
1164Function un.onUninstSuccess
1165
1166 HideWindow
1167 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1168
1169FunctionEnd
1170
1171
1172;;
1173; Function which is being called at the very beginning of uninstaller execution.
1174;
1175; Input:
1176; None
1177; Output:
1178; None
1179;
1180Function un.onInit
1181
1182 ; Has the user who calls us admin rights?
1183 UserInfo::GetAccountType
1184 Pop $0
1185 ${If} $0 != "Admin"
1186 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1187 Abort
1188 ${EndIf}
1189
1190 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
1191 Quit
1192
1193proceed:
1194
1195 Call un.SetAppMode64
1196
1197 ; Set system directory.
1198 StrCpy $g_strSystemDir "$SYSDIR"
1199
1200 ; We need a special directory set to SysWOW64 because some
1201 ; shell operations don't support file redirection (yet).
1202 StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
1203
1204 ; Retrieve Windows version we're running on and store it in $g_strWinVersion.
1205 Call un.GetWindowsVersionEx
1206 Pop $g_strWinVersion
1207
1208 ; Init global variables that depends on the windows version.
1209 ${If} $g_strWinVersion == "2000"
1210 StrCpy $g_strEarlyNTDrvInfix "EarlyNT"
1211 ${ElseIf} $g_strWinVersion == "NT4"
1212 StrCpy $g_strEarlyNTDrvInfix "EarlyNT"
1213 ${Else}
1214 StrCpy $g_strEarlyNTDrvInfix ""
1215 ${EndIf}
1216
1217 ; Retrieve capabilities
1218 Call un.CheckForCapabilities
1219
1220FunctionEnd
1221
1222Section Uninstall
1223
1224!ifdef _DEBUG
1225 ${LogEnable} "true"
1226!endif
1227
1228 Call un.SetAppMode64
1229
1230 ; Call the uninstall main function first.
1231 Call un.Uninstall_Perform
1232
1233 ; After that, call the uninstall main function for deleting all files.
1234 Call un.Uninstall_DeleteFiles
1235
1236!ifndef _DEBUG
1237 SetAutoClose true
1238 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
1239 StrCmp $g_bRebootOnExit "true" restart
1240!endif
1241
1242 Goto exit
1243
1244!ifndef _DEBUG
1245restart:
1246!endif
1247
1248 ${LogVerbose} "Rebooting ..."
1249 Reboot
1250
1251exit:
1252
1253SectionEnd
1254
1255!endif ; !EXTERNAL_UNINSTALLER
1256
1257;Direct the output to our bin dir.
1258!cd "$%PATH_OUT%\bin\additions"
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