VirtualBox

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

Last change on this file since 54647 was 54120, checked in by vboxsync, 10 years ago

Windows guest additions: cleanup, removed obsolete MMR code.

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