VirtualBox

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

Last change on this file since 107082 was 107082, checked in by vboxsync, 2 months ago

Windows Additions/Installer: Added architecture string to the version string (at page bottom) and also added translations for the Welcome page title. bugref:10775

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

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