VirtualBox

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

Last change on this file since 109163 was 109138, checked in by vboxsync, 4 weeks ago

Windows Additions installer: Got rid of the ancient servicepack.nsh + winver.nsh and use the official (included with NSIS) WinVer.nsh (in Include\WinVer.nsh). This also makes use if the ${AtLeastWinXXX} macros and stuff to improve code readability.

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