VirtualBox

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

Last change on this file since 96782 was 96776, checked in by vboxsync, 21 months ago

Add/Nt/Installer: More work related to iexplore.ico removal as it seems it really was needed when we use a .lnk to point to the .url file in the install dir, now I've changed it to generate an identical Website.url file for the start menu too. This way we get the right browser icon associated .url files.

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

© 2023 Oracle
ContactPrivacy policyTerms of Use