VirtualBox

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

Last change on this file was 99470, checked in by vboxsync, 13 months ago

Add/Nt/Installer: Using the EarlyNT variant of VBoxVideo for XP is the right thing to do.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use