VirtualBox

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

Last change on this file since 96407 was 96407, checked in by vboxsync, 22 months ago

scm copyright and license note update

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

© 2023 Oracle
ContactPrivacy policyTerms of Use