VirtualBox

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

Last change on this file since 96775 was 96775, checked in by vboxsync, 3 years ago

Add/Nt/Installer: Removed iexplore.ico as it's not needed, except perhaps on NT4.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 38.2 KB
Line 
1; $Id: VBoxGuestAdditions.nsi 96775 2022-09-16 23:39:31Z 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 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
809 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
810 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
811
812SectionEnd
813
814!ifdef USE_MUI
815 ;Assign language strings to sections
816 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
817 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
818 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
819 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
820 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(VBOX_COMPONENT_STARTMENU_DESC)
821 !insertmacro MUI_FUNCTION_DESCRIPTION_END
822!endif ; USE_MUI
823
824Section -Content
825
826 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
827
828SectionEnd
829
830; This section is called after all the files are in place
831Section -Post
832
833!ifdef _DEBUG
834 ${LogVerbose} "Doing post install ..."
835!endif
836
837!ifdef EXTERNAL_UNINSTALLER
838 SetOutPath "$INSTDIR"
839 FILE "$%PATH_TARGET%\uninst.exe"
840!else
841 WriteUninstaller "$INSTDIR\uninst.exe"
842!endif
843
844 ; Write uninstaller in "Add / Remove programs"
845 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
846 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
847 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
848 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
849 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
850
851 ; Tune TcpWindowSize for a better network throughput
852 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
853
854!ifdef _DEBUG
855 ${LogVerbose} "Enable Backdoor logging for debug build."
856 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\VBoxGuest" "LoggingEnabled" 255
857!endif
858
859 ; Add Sun Ray client info keys
860 ; Note: We only need 32-bit keys (HKLM\Software / HKLM\Software\Wow6432Node)
861!if $%KBUILD_TARGET_ARCH% == "amd64"
862 WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
863 WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
864!else
865 WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
866 WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
867!endif
868
869 ${LogVerbose} "Installation completed."
870
871 ;
872 ; Dump UI log to on success too. Only works with non-silent installs.
873 ; (This has to be done here rather than in .onInstSuccess, because by
874 ; then the log is no longer visible in the UI.)
875 ;
876 ${IfNot} ${Silent}
877 !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
878 VBoxGuestInstallHelper::DumpLog "$INSTDIR\install_ui.log"
879 !else
880 StrCpy $0 "$INSTDIR\install_ui.log"
881 Push $0
882 Call DumpLog
883 !endif
884 ${EndIf}
885
886SectionEnd
887
888;;
889; !!! NOTE: This function *has* to be right under the last section; otherwise it does
890; *not* get called! Don't ask me why ... !!!
891Function .onSelChange
892
893 Push $0
894
895 ; Handle selection of WDDM component
896 SectionGetFlags ${SEC03} $0
897 ${If} $0 == ${SF_SELECTED}
898
899!if $%VBOX_WITH_WDDM% == "1"
900 ; If we're able to use the WDDM driver just use it.
901 ${If} $g_bCapWDDM == "true"
902 StrCpy $g_bWithWDDM "true"
903 ${EndIf}
904
905!endif ; $%VBOX_WITH_WDDM% == "1"
906
907 ${Else} ; WDDM unselected again
908
909 ${If} $g_strWinVersion != "8" ; On Windows 8 WDDM is mandatory
910 ${AndIf} $g_strWinVersion != "8_1" ; ... also on Windows 8.1 / Windows 2012 Server R2
911 ${AndIf} $g_strWinVersion != "10" ; ... also on Windows 10
912 StrCpy $g_bWithWDDM "false"
913 ${EndIf}
914
915 ${EndIf}
916
917 Pop $0
918
919FunctionEnd
920
921;;
922; This function is called when a critical error occurred, caused by
923; the Abort command
924;
925Function .onInstFailed
926
927 ${LogVerbose} "$(VBOX_ERROR_INST_FAILED)"
928 MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
929
930 ${If} $g_bPostInstallStatus == "true"
931 ${LogToVBoxTray} "2" "Error while installing ${PRODUCT_NAME}!"
932 ${EndIf}
933
934 ; Dump UI log to see what happend. Only works with non-silent installs.
935 ${IfNot} ${Silent}
936 !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
937 VBoxGuestInstallHelper::DumpLog "$INSTDIR\install_ui.log"
938 !else
939 StrCpy $0 "$INSTDIR\install_ui.log"
940 Push $0
941 Call DumpLog
942 !endif
943 ${EndIf}
944
945 ; Set overall exit code
946 SetErrorLevel 1
947
948FunctionEnd
949
950;;
951; This function is called when installation was successful!
952;
953Function .onInstSuccess
954
955 ${LogVerbose} "${PRODUCT_NAME} successfully installed"
956
957 ${If} $g_bPostInstallStatus == "true"
958 ${LogToVBoxTray} "0" "${PRODUCT_NAME} successfully updated!"
959 ${EndIf}
960
961 SetErrorLevel 0
962
963FunctionEnd
964
965;;
966; This function is called at the very beginning of installer execution
967;
968Function .onInit
969
970 Push $0
971
972 ; Init values
973 StrCpy $g_iSystemMode "0"
974 StrCpy $g_strCurUser "<None>"
975 StrCpy $g_strAddVerMaj "0"
976 StrCpy $g_strAddVerMin "0"
977 StrCpy $g_strAddVerBuild "0"
978 StrCpy $g_strAddVerRev "0"
979
980 StrCpy $g_bIgnoreUnknownOpts "false"
981 StrCpy $g_bLogEnable "false"
982 StrCpy $g_bForceInstall "false"
983 StrCpy $g_bUninstall "false"
984 StrCpy $g_bRebootOnExit "false"
985 StrCpy $g_iScreenX "0"
986 StrCpy $g_iScreenY "0"
987 StrCpy $g_iScreenBpp "0"
988 StrCpy $g_iSfOrder "0"
989 StrCpy $g_bNoVBoxServiceExit "false"
990 StrCpy $g_bNoVBoxTrayExit "false"
991 StrCpy $g_bNoVideoDrv "false"
992 StrCpy $g_bNoGuestDrv "false"
993 StrCpy $g_bNoMouseDrv "false"
994 StrCpy $g_bNoStartMenuEntries "false"
995 StrCpy $g_bWithAutoLogon "false"
996 StrCpy $g_bOnlyExtract "false"
997 StrCpy $g_bWithWDDM "false"
998 StrCpy $g_bCapDllCache "false"
999 StrCpy $g_bCapXPDM "false"
1000 StrCpy $g_bCapWDDM "false"
1001 StrCpy $g_bPostInstallStatus "false"
1002 StrCpy $g_bInstallTimestampCA "unset" ; Tri-state: "unset", "true" and "false"
1003
1004 ; We need a special directory set to SysWOW64 because some
1005 ; shell operations don't support file redirection (yet)
1006 StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
1007
1008 SetErrorLevel 0
1009 ClearErrors
1010
1011!ifdef UNINSTALLER_ONLY
1012
1013 ;
1014 ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
1015 ; so we can sign it
1016 ;
1017 ; Note that the Quit causes the exit status to be 2 instead of 0
1018 ;
1019 WriteUninstaller "$%PATH_TARGET%\uninst.exe"
1020 Quit
1021
1022!else
1023
1024 ; Handle command line
1025 Call HandleCommandLine
1026
1027 ; Check if there's already another instance of the installer is running -
1028 ; important for preventing NT4 to spawn the installer twice
1029 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
1030 Pop $0
1031 ${If} $0 != 0
1032 Quit
1033 ${EndIf}
1034
1035 ; Retrieve Windows version and store result in $g_strWinVersion
1036 Call GetWindowsVersionEx
1037 Pop $g_strWinVersion
1038
1039 ; Retrieve capabilities
1040 Call CheckForCapabilities
1041
1042 ; Get user Name
1043 AccessControl::GetCurrentUserName
1044 Pop $g_strCurUser
1045 ${LogVerbose} "Current user: $g_strCurUser"
1046
1047 ; Only extract files? This action can be called even from non-Admin users
1048 ; and non-compatible architectures
1049 ${If} $g_bOnlyExtract == "true"
1050 Call ExtractFiles
1051 MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
1052 Quit
1053 ${EndIf}
1054
1055 ; Check for correct architecture
1056 Call CheckArchitecture
1057 Pop $0
1058 ${If} $0 <> 0 ; Wrong architecture? Tell the world
1059 !if $%KBUILD_TARGET_ARCH% == "amd64"
1060 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_AMD64) /SD IDOK
1061 !else
1062 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
1063 !endif
1064 Abort "$(VBOX_NOTICE_ARCH_AMD64)"
1065 ${EndIf}
1066
1067 ; Has the user who calls us admin rights?
1068 UserInfo::GetAccountType
1069 Pop $0
1070 ${If} $0 != "Admin"
1071 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1072 Abort
1073 ${EndIf}
1074
1075 ; Only uninstall?
1076 ${If} $g_bUninstall == "true"
1077 Call Uninstall_Innotek
1078 Call Uninstall
1079 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1080 Quit
1081 ${EndIf}
1082
1083 Call CheckForInstalledComponents
1084
1085 ;
1086 ; Section 02
1087 ;
1088 ${If} $g_bWithAutoLogon == "true" ; Auto-logon support
1089 !insertmacro SelectSection ${SEC02}
1090 ${EndIf}
1091
1092 ;
1093 ; Section 03
1094 ;
1095 ${If} $g_bWithWDDM == "true" ; D3D / WDDM support
1096 !insertmacro SelectSection ${SEC03}
1097 ${EndIf}
1098 ; On Windows 8 / 8.1 / Windows Server 2012 R2 and newer we always select the 3D
1099 ; section and disable it so that it cannot be deselected again
1100 ${If} $g_strWinVersion == "8"
1101 ${OrIf} $g_strWinVersion == "8_1"
1102 ${OrIf} $g_strWinVersion == "10"
1103 IntOp $0 ${SF_SELECTED} | ${SF_RO}
1104 SectionSetFlags ${SEC03} $0
1105 ${EndIf}
1106 ; If the guest is not able to handle/use our WDDM driver, then 3D is not available
1107 ${If} $g_bCapWDDM != "true"
1108 SectionSetFlags ${SEC03} ${SF_RO}
1109 ${EndIf}
1110
1111 ;
1112 ; Section 04
1113 ;
1114 ${If} $g_bNoStartMenuEntries == "false" ; Start menu entries
1115 !insertmacro SelectSection ${SEC04}
1116 ${EndIf}
1117
1118 !ifdef USE_MUI
1119 ; Display language selection dialog (will be hidden in silent mode!)
1120 !ifdef VBOX_INSTALLER_ADD_LANGUAGES
1121 !insertmacro MUI_LANGDLL_DISPLAY
1122 !endif
1123 !endif
1124
1125 Call SetAppMode64
1126
1127 ; Check for old additions
1128 Call CheckForOldGuestAdditions
1129 Call GetAdditionsVersion
1130
1131 ; Due to some bug in NSIS the license page won't be displayed if we're in
1132 ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
1133 ; mode for now
1134 Call SetAppMode32
1135
1136!endif ; UNINSTALLER_ONLY
1137
1138 Pop $0
1139
1140FunctionEnd
1141
1142;
1143; The uninstaller is built separately when doing code signing
1144;
1145; When building the non-uninstaller part, we get a 6020 warning because NSIS
1146; detects uninstaller related _code_ (un.xxxx) being present. It would take
1147; some effort to eliminate that one.
1148;
1149!ifndef EXTERNAL_UNINSTALLER
1150
1151Function un.onUninstSuccess
1152
1153 HideWindow
1154 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1155
1156FunctionEnd
1157
1158Function un.onInit
1159
1160 ; Has the user who calls us admin rights?
1161 UserInfo::GetAccountType
1162 Pop $0
1163 ${If} $0 != "Admin"
1164 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1165 Abort
1166 ${EndIf}
1167
1168 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
1169 Quit
1170
1171proceed:
1172
1173 Call un.SetAppMode64
1174
1175 ; Set system directory
1176 StrCpy $g_strSystemDir "$SYSDIR"
1177
1178 ; We need a special directory set to SysWOW64 because some
1179 ; shell operations don't support file redirection (yet)
1180 StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
1181
1182 ; Retrieve Windows version we're running on and store it in $g_strWinVersion
1183 Call un.GetWindowsVersionEx
1184 Pop $g_strWinVersion
1185
1186 ; Retrieve capabilities
1187 Call un.CheckForCapabilities
1188
1189FunctionEnd
1190
1191Section Uninstall
1192
1193!ifdef _DEBUG
1194 ${LogEnable} "true"
1195!endif
1196
1197 Call un.SetAppMode64
1198
1199 ; Call the uninstall main function
1200 Call un.Uninstall
1201
1202 ; ... and remove the local install directory
1203 Call un.UninstallInstDir
1204
1205!ifndef _DEBUG
1206 SetAutoClose true
1207 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
1208 StrCmp $g_bRebootOnExit "true" restart
1209!endif
1210
1211 Goto exit
1212
1213!ifndef _DEBUG
1214restart:
1215!endif
1216
1217 ${LogVerbose} "Rebooting ..."
1218 Reboot
1219
1220exit:
1221
1222SectionEnd
1223
1224!endif ; !EXTERNAL_UNINSTALLER
1225
1226;Direct the output to our bin dir
1227!cd "$%PATH_OUT%\bin\additions"
Note: See TracBrowser for help on using the repository browser.

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