VirtualBox

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

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

Copyright year updates by scm.

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

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