VirtualBox

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

Last change on this file since 82433 was 81648, checked in by vboxsync, 5 years ago

Additions/WINNT/Installer: removed the wddm_or_basic_d3d dialog, because there is no basic d3d anymore. bugref:6482 bugref:9529

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