VirtualBox

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

Last change on this file since 46838 was 46838, checked in by vboxsync, 11 years ago

Windows Guest Additions: Added support for Windows 8.1 (Blue) / Windows Server 2012 R2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 42.9 KB
Line 
1; $Id: VBoxGuestAdditions.nsi 46838 2013-06-27 12:27:48Z vboxsync $
2; @file
3; VBoxGuestAdditions.nsi - Main file for Windows Guest Additions installation.
4;
5
6;
7; Copyright (C) 2012-2013 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%"
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_bWithVBoxMMR ; Cmd line: Install VBoxMMR for media redirection support
238Var g_bWithD3D ; Cmd line: Install Direct3D support
239Var g_bOnlyExtract ; Cmd line: Only extract all files, do *not* install them. Only valid with param "/D" (target directory)
240Var g_bPostInstallStatus ; Cmd line: Post the overall installation status to some external program (VBoxTray)
241
242; Platform parts of this installer
243!include "VBoxGuestAdditionsLog.nsh"
244!include "VBoxGuestAdditionsExternal.nsh"
245!include "VBoxGuestAdditionsCommon.nsh"
246!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit only
247 !include "VBoxGuestAdditionsNT4.nsh"
248!endif
249!include "VBoxGuestAdditionsW2KXP.nsh"
250!include "VBoxGuestAdditionsVista.nsh"
251!include "VBoxGuestAdditionsUninstall.nsh" ; Product uninstallation
252!include "VBoxGuestAdditionsUninstallOld.nsh" ; Uninstallation of deprecated versions which must be removed first
253
254Function HandleCommandLine
255
256 Push $0 ; Command line (without process name)
257 Push $1 ; Number of parameters
258 Push $2 ; Current parameter index
259 Push $3 ; Current parameter pair (name=value)
260 Push $4 ; Current parameter name
261 Push $5 ; Current parameter value (if present)
262
263 StrCpy $1 "0" ; Init param counter
264 StrCpy $2 "1" ; Init current param counter
265
266 ${GetParameters} $0 ; Extract command line
267 ${If} $0 == "" ; If no parameters at all exit
268 Goto exit
269 ${EndIf}
270
271 ; Enable for debugging
272 ;MessageBox MB_OK "CmdLine: $0"
273
274 ${WordFind} $0 " " "#" $1 ; Get number of parameters in cmd line
275 ${If} $0 == $1 ; If result matches the input then
276 StrCpy $1 "1" ; no delimiter was found. Correct to 1 word total
277 ${EndIf}
278
279 ${While} $2 <= $1 ; Loop through all params
280
281 ${WordFind} $0 " " "+$2" $3 ; Get current name=value pair
282 ${WordFind} $3 "=" "+1" $4 ; Get current param name
283 ${WordFind} $3 "=" "+2" $5 ; Get current param value
284
285 ${StrFilter} $4 "-" "" "" $4 ; Transfer param name to lowercase
286
287 ; Enable for debugging
288 ;MessageBox MB_OK "#$2 of #$1, param='$3', name=$4, val=$5"
289
290 ${Switch} $4
291
292 ${Case} '/d' ; NSIS: /D=<instdir> switch, skip
293 ${Break}
294
295 ${Case} '/depth'
296 ${Case} 'depth'
297 StrCpy $g_iScreenBpp $5
298 ${Break}
299
300 ${Case} '/extract'
301 StrCpy $g_bOnlyExtract "true"
302 ${Break}
303
304 ${Case} '/force'
305 StrCpy $g_bForceInstall "true"
306 ${Break}
307
308 ${Case} '/help'
309 ${Case} '/H'
310 ${Case} '/h'
311 ${Case} '/?'
312 Goto usage
313 ${Break}
314
315 ${Case} '/ignore_unknownopts' ; Not officially documented
316 StrCpy $g_bIgnoreUnknownOpts "true"
317 ${Break}
318
319 ${Case} '/l'
320 ${Case} '/log'
321 ${Case} '/logging'
322 StrCpy $g_bLogEnable "true"
323 ${Break}
324
325 ${Case} '/ncrc' ; NSIS: /NCRC switch, skip
326 ${Break}
327
328 ${Case} '/no_vboxservice_exit' ; Not officially documented
329 StrCpy $g_bNoVBoxServiceExit "true"
330 ${Break}
331
332 ${Case} '/no_vboxtray_exit' ; Not officially documented
333 StrCpy $g_bNoVBoxTrayExit "true"
334 ${Break}
335
336 ${Case} '/no_videodrv' ; Not officially documented
337 StrCpy $g_bNoVideoDrv "true"
338 ${Break}
339
340 ${Case} '/no_guestdrv' ; Not officially documented
341 StrCpy $g_bNoGuestDrv "true"
342 ${Break}
343
344 ${Case} '/no_mousedrv' ; Not officially documented
345 StrCpy $g_bNoMouseDrv "true"
346 ${Break}
347
348!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
349 ; This switch tells our installer that it
350 ; - should not quit VBoxTray during the update, because ...
351 ; - ... it should show the overall installation status
352 ; using VBoxTray's balloon message feature (since VBox 4.0)
353 ${Case} '/post_installstatus' ; Not officially documented
354 StrCpy $g_bNoVBoxTrayExit "true"
355 StrCpy $g_bPostInstallStatus "true"
356 ${Break}
357!endif
358
359 ${Case} '/reboot'
360 StrCpy $g_bRebootOnExit "true"
361 ${Break}
362
363 ${Case} '/s' ; NSIS: /S switch, skip
364 ${Break}
365
366 ${Case} '/sforder'
367 ${Case} 'sforder'
368 StrCpy $g_iSfOrder $5
369 ${Break}
370
371!ifdef WHQL_FAKE
372 ${Case} '/unsig_drv'
373 StrCpy $g_bFakeWHQL "true"
374 ${Break}
375!endif
376
377 ${Case} '/uninstall'
378 StrCpy $g_bUninstall "true"
379 ${Break}
380
381 ${Case} '/with_autologon'
382 StrCpy $g_bWithAutoLogon "true"
383 ${Break}
384
385!if $%VBOX_WITH_MMR% == "1"
386 ${Case} '/with_vboxmmr'
387 StrCpy $g_bWithVBoxMMR "true"
388 ${Break}
389!endif
390
391!if $%VBOX_WITH_CROGL% == "1"
392 ${Case} '/with_d3d'
393 ${Case} '/with_direct3d'
394 StrCpy $g_bWithD3D "true"
395 ${Break}
396!endif
397
398!if $%VBOX_WITH_WDDM% == "1"
399 ${Case} '/with_wddm'
400 StrCpy $g_bWithWDDM "true"
401 ${Break}
402!endif
403
404 ${Case} '/xres'
405 ${Case} 'xres'
406 StrCpy $g_iScreenX $5
407 ${Break}
408
409 ${Case} '/yres'
410 ${Case} 'yres'
411 StrCpy $g_iScreenY $5
412 ${Break}
413
414 ${Default} ; Unknown parameter, print usage message
415 ; Prevent popping up usage message on (yet) unknown parameters
416 ; in silent mode, just skip
417 IfSilent +1 +2
418 ${Break}
419 goto usage
420 ${Break}
421
422 ${EndSwitch}
423
424next_param:
425
426 IntOp $2 $2 + 1
427
428 ${EndWhile}
429 Goto exit
430
431usage:
432
433 ; If we were told to ignore unknown (invalid) options, just return to
434 ; the parsing loop ...
435 ${If} $g_bIgnoreUnknownOpts == "true"
436 Goto next_param
437 ${EndIf}
438 MessageBox MB_OK "${PRODUCT_NAME} Installer$\r$\n$\r$\n \
439 Usage: VBoxWindowsAdditions-$%BUILD_TARGET_ARCH% [OPTIONS] [/l] [/S] [/D=<PATH>]$\r$\n$\r$\n \
440 Options:$\r$\n \
441 /depth=BPP$\tSets the guest's display color depth (bits per pixel)$\r$\n \
442 /extract$\t$\tOnly extract installation files$\r$\n \
443 /force$\t$\tForce installation on unknown/undetected Windows versions$\r$\n \
444 /uninstall$\t$\tJust uninstalls the Guest Additions and exits$\r$\n \
445 /with_autologon$\tInstalls auto-logon support$\r$\n \
446 /with_d3d$\tInstalls D3D support$\r$\n \
447 /with_vboxmmr$\tInstalls multimedia redirection (MMR) support$\r$\n \
448 /with_wddm$\tInstalls the WDDM instead of the XPDM graphics driver$\r$\n \
449 /xres=X$\t$\tSets the guest's display resolution (width in pixels)$\r$\n \
450 /yres=Y$\t$\tSets the guest's display resolution (height in pixels)$\r$\n \
451 $\r$\n \
452 Installer parameters:$\r$\n \
453 /l$\t$\tEnables logging$\r$\n \
454 /S$\t$\tSilent install$\r$\n \
455 /D=<PATH>$\tSets the default install path$\r$\n \
456 $\r$\n \
457 Note: Order of options and installer parameters are mandatory." /SD IDOK
458
459 ; No stack restore needed, we're about to quit
460 Quit
461
462done:
463
464!ifdef _DEBUG
465 ${LogVerbose} "Property: XRes: $g_iScreenX"
466 ${LogVerbose} "Property: YRes: $g_iScreenY"
467 ${LogVerbose} "Property: BPP: $g_iScreenBpp"
468 ${LogVerbose} "Property: Logging enabled: $g_bLogEnable"
469!endif
470
471exit:
472
473 Pop $5
474 Pop $4
475 Pop $3
476 Pop $2
477 Pop $1
478 Pop $0
479
480FunctionEnd
481
482Function CheckForOldGuestAdditions
483
484 Push $0
485 Push $1
486 Push $2
487
488begin:
489
490 ${LogVerbose} "Checking for old Guest Additions ..."
491
492sun_check:
493
494 ; Check for old "Sun VirtualBox Guest Additions"
495 ; - before rebranding to Oracle
496 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun VirtualBox Guest Additions" "UninstallString"
497 StrCmp $0 "" sun_xvm_check ; If string is empty, Sun additions are probably not installed (anymore)
498
499 MessageBox MB_YESNO $(VBOX_SUN_FOUND) /SD IDYES IDYES sun_uninstall
500 Pop $2
501 Pop $1
502 Pop $0
503 MessageBox MB_ICONSTOP $(VBOX_SUN_ABORTED) /SD IDOK
504 Quit
505
506sun_uninstall:
507
508 Call Uninstall_Sun
509 Goto success
510
511sun_xvm_check:
512
513 ; Check for old "Sun xVM VirtualBox Guest Additions"
514 ; - before getting rid of the "xVM" namespace
515 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun xVM VirtualBox Guest Additions" "UninstallString"
516 StrCmp $0 "" innotek_check ; If string is empty, Sun xVM additions are probably not installed (anymore)
517
518 MessageBox MB_YESNO $(VBOX_SUN_FOUND) /SD IDYES IDYES sun_xvm_uninstall
519 Pop $2
520 Pop $1
521 Pop $0
522 MessageBox MB_ICONSTOP $(VBOX_SUN_ABORTED) /SD IDOK
523 Quit
524
525sun_xvm_uninstall:
526
527 Call Uninstall_SunXVM
528 Goto success
529
530innotek_check:
531
532 ; Check for old "innotek" Guest Additions" before rebranding to "Sun"
533 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\innotek VirtualBox Guest Additions" "UninstallString"
534 StrCmp $0 "" exit ; If string is empty, innotek Guest Additions are probably not installed (anymore)
535
536 MessageBox MB_YESNO $(VBOX_INNOTEK_FOUND) /SD IDYES IDYES innotek_uninstall
537 Pop $2
538 Pop $1
539 Pop $0
540 MessageBox MB_ICONSTOP $(VBOX_INNOTEK_ABORTED) /SD IDOK
541 Quit
542
543innotek_uninstall:
544
545 Call Uninstall_Innotek
546 Goto success
547
548success:
549
550 ; Nothing to do here yet
551
552exit:
553
554 Pop $2
555 Pop $1
556 Pop $0
557
558FunctionEnd
559
560Function CheckForInstalledComponents
561
562 Push $0
563 Push $1
564
565 ${LogVerbose} "Checking for installed components ..."
566 StrCpy $1 ""
567
568 Call SetAppMode64
569
570 ; VBoxGINA already installed? So we need to update the installed version as well,
571 ; regardless whether the user used "/with_autologon" or not
572 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
573 ${If} $0 == "VBoxGINA.dll"
574 StrCpy $1 "GINA"
575 ${Else}
576 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" ""
577 ${If} $0 == "VBoxCredProv"
578 StrCpy $1 "Credential Provider"
579 ${EndIf}
580 ${EndIf}
581
582!ifdef _DEBUG
583 ${LogVerbose} "Auto-logon module: $0"
584!endif
585
586 ${IfNot} $1 == ""
587 ${LogVerbose} "Auto-logon support ($1) was installed previously"
588 StrCpy $g_bWithAutoLogon "true" ; Force update
589 ${Else}
590 ${LogVerbose} "Auto-logon support was not installed previously"
591 ${EndIf}
592
593 ; Check for installed MMR support and enable updating
594 ; those modules if needed
595 ${If} ${FileExists} "$g_strSystemDir\VBoxMMR.exe"
596!if $%BUILD_TARGET_ARCH% == "amd64"
597 ${AndIf} ${FileExists} "$g_strSysWow64\VBoxMMRHook.dll"
598!else
599 ${AndIf} ${FileExists} "$g_strSystemDir\VBoxMMRHook.dll"
600!endif
601 ${LogVerbose} "MultiMedia Redirection support (MMR) was installed previously"
602 StrCpy $g_bWithVBoxMMR "true" ; Force update
603 ${Else}
604 ${LogVerbose} "MultiMedia Redirection support (MMR) support was not installed previously"
605 ${EndIf}
606
607 Pop $1
608 Pop $0
609
610FunctionEnd
611
612; Main Files
613Section $(VBOX_COMPONENT_MAIN) SEC01
614
615 SectionIn RO ; Section cannot be unselected (read-only)
616 ${If} $g_bPostInstallStatus == "true"
617 ${LogToVBoxTray} "0" "${PRODUCT_NAME} update started, please wait ..."
618 ${EndIf}
619
620 IfSilent +1 +2
621 StrCpy $g_bLogEnable "true" ; Force logging in silent mode
622
623 ${LogEnable} "$g_bLogEnable"
624 IfSilent +1 +2 ; NSIS will expand ${LogVerbose} before doing relative jumps!
625 LogText "Installer runs in silent mode"
626
627 SetOutPath "$INSTDIR"
628 SetOverwrite on
629
630 Call SetAppMode64
631
632 StrCpy $g_strSystemDir "$SYSDIR"
633
634 ${LogVerbose} "Version: $%VBOX_VERSION_STRING% (Rev $%VBOX_SVN_REV%)"
635 ${If} $g_strAddVerMaj != ""
636 ${LogVerbose} "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
637 ${Else}
638 ${LogVerbose} "No previous version of ${PRODUCT_NAME} detected"
639 ${EndIf}
640!if $%BUILD_TARGET_ARCH% == "amd64"
641 ${LogVerbose} "Detected OS: Windows $g_strWinVersion (64-bit)"
642!else
643 ${LogVerbose} "Detected OS: Windows $g_strWinVersion (32-bit)"
644!endif
645 ${LogVerbose} "System Directory: $g_strSystemDir"
646
647!ifdef _DEBUG
648 ${LogVerbose} "Installer runs in debug mode"
649!endif
650
651 ;
652 ; Here starts the main dispatcher (based on guest OS)
653 ;
654
655 ; Which OS are we using?
656 ; @todo Use logic lib here
657!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
658 StrCmp $g_strWinVersion "NT4" nt4 ; Windows NT 4.0
659!endif
660 StrCmp $g_strWinVersion "2000" w2k ; Windows 2000
661 StrCmp $g_strWinVersion "XP" w2k ; Windows XP
662 StrCmp $g_strWinVersion "2003" w2k ; Windows 2003 Server
663 StrCmp $g_strWinVersion "Vista" vista ; Windows Vista
664 StrCmp $g_strWinVersion "7" vista ; Windows 7
665 StrCmp $g_strWinVersion "8" vista ; Windows 8
666 StrCmp $g_strWinVersion "8_1" vista ; Windows 8.1 / Windows 2012 Server R2
667
668 ${If} $g_bForceInstall == "true"
669 Goto vista ; Assume newer OS than we know of ...
670 ${EndIf}
671
672 Goto notsupported
673
674!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
675nt4: ; Windows NT4
676
677 Call GetServicePack
678 Pop $R0 ; Major version
679 Pop $R1 ; Minor version
680
681 ; At least Service Pack 6 installed?
682 ${If} $R0 <> "6"
683 MessageBox MB_YESNO $(VBOX_NT4_NO_SP6) /SD IDYES IDYES +2
684 Quit
685 ${EndIf}
686
687 ; Copy some common files ...
688 Call Common_CopyFiles
689
690 Call NT4_Main
691 goto success
692!endif
693
694w2k: ; Windows 2000 and XP ...
695
696 ; Copy some common files ...
697 Call Common_CopyFiles
698
699 Call W2K_Main
700 goto success
701
702vista: ; Windows Vista / Windows 7 / Windows 8(.1)
703
704 ; Check requirments; this function can abort the installation if necessary!
705 Call Vista_CheckForRequirements
706
707 ; Copy some common files ...
708 Call Common_CopyFiles
709
710 Call W2K_Main ; First install stuff from Windows 2000 / XP
711 Call Vista_Main ; ... and some specific stuff for Vista / Windows 7
712 goto success
713
714notsupported:
715
716 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
717 goto exit
718
719success:
720
721 ; Write a registry key with version and installation path for later lookup
722 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Version" "$%VBOX_VERSION_STRING_RAW%"
723 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "VersionExt" "$%VBOX_VERSION_STRING%"
724 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Revision" "$%VBOX_SVN_REV%"
725 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "InstallDir" "$INSTDIR"
726
727 ; Set the reboot flag to tell the finish page that is should
728 ; default to the "reboot now" entry
729 SetRebootFlag true
730
731exit:
732
733SectionEnd
734
735; Auto-logon support (section is hidden at the moment -- only can be enabled via command line switch)
736Section /o -$(VBOX_COMPONENT_AUTOLOGON) SEC02
737
738 Call SetAppMode64
739
740 Call GetWindowsVersion
741 Pop $R0 ; Windows Version
742
743 ${LogVerbose} "Installing auto-logon support ..."
744
745 ; Another GINA already is installed? Check if this is ours, otherwise let the user decide (unless it's a silent setup)
746 ; whether to replace it with the VirtualBox one or not
747 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
748 ${If} $0 != ""
749 ${If} $0 != "VBoxGINA.dll"
750 ${LogVerbose} "Found another already installed GINA module: $0"
751 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(VBOX_COMPONENT_AUTOLOGON_WARN_3RDPARTY) /SD IDYES IDYES install
752 ${LogVerbose} "Skipping GINA installation, keeping: $0"
753 goto skip
754 ${EndIf}
755 ${EndIf}
756
757install:
758
759 ; Do we need VBoxCredProv or VBoxGINA?
760 ${If} $R0 == 'Vista' ; Windows Vista.
761 ${OrIf} $R0 == '7' ; Windows 7.
762 ${OrIf} $R0 == '8' ; Windows 8.
763 ; Use VBoxCredProv on Vista and up.
764 ${LogVerbose} "Installing VirtualBox credential provider ..."
765 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxCredProv.dll" "$g_strSystemDir\VBoxCredProv.dll" "$INSTDIR"
766 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (default) key
767 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (Default) key
768 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "" "VBoxCredProv.dll" ; adding to (Default) key
769 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "ThreadingModel" "Apartment"
770 ${Else} ; Use VBoxGINA on older Windows OSes (< Vista)
771 ${LogVerbose} "Installing VirtualBox GINA ..."
772 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
773 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
774 ; Add Windows notification package callbacks for VBoxGINA
775 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "DLLName" "VBoxGINA.dll"
776 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "Impersonate" 0
777 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\VBoxGINA" "StopScreenSaver" "WnpScreenSaverStop"
778 ${EndIf}
779
780skip:
781
782 ; Nothing to do here right now
783
784exit:
785
786SectionEnd
787
788; Prepares the access rights for replacing
789; a WRP (Windows Resource Protection) protected file
790Function PrepareWRPFile
791
792 Pop $0
793
794 ${IfNot} ${FileExists} "$0"
795 ${LogVerbose} "WRP: File $0 does not exist, skipping"
796 Return
797 ${EndIf}
798
799 ${If} ${FileExists} "$g_strSystemDir\takeown.exe"
800 ${CmdExecute} "$\"$g_strSystemDir\takeown.exe$\" /F $\"$0$\"" "true"
801 ${Else}
802 ${LogVerbose} "WRP: Warning: takeown.exe not found, skipping"
803 ${EndIf}
804
805 AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
806 Pop $1
807 ${LogVerbose} "WRP: Setting file owner for $0 returned: $1"
808
809 AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
810 Pop $1
811 ${LogVerbose} "WRP: Setting access rights for $0 returned: $1"
812
813!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
814 !ifdef WFP_FILE_EXCEPTION
815 VBoxGuestInstallHelper::DisableWFP "$0"
816 Pop $1 ; Get return value (ignored for now)
817 ${LogVerbose} "WRP: Setting WFP exception for $0 returned: $1"
818 !endif
819!endif
820
821FunctionEnd
822
823; Direct3D support
824Section /o $(VBOX_COMPONENT_D3D) SEC03
825
826!if $%VBOX_WITH_WDDM% == "1"
827 ${If} $g_bWithWDDM == "true"
828 ; All D3D components are installed with WDDM driver package, nothing to be done here
829 Return
830 ${EndIf}
831!endif
832
833 SetOverwrite on
834
835 ${If} $g_strSystemDir == ''
836 StrCpy $g_strSystemDir "$SYSDIR"
837 ${EndIf}
838
839 SetOutPath $g_strSystemDir
840 ${LogVerbose} "Installing Direct3D support ..."
841 FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
842 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
843 FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
844
845 ;
846 ; Update DLL cache
847 ;
848 ${If} $g_bCapDllCache == "true"
849 ${If} ${FileExists} "$g_strSystemDir\dllcache"
850 SetOutPath "$g_strSystemDir\dllcache"
851 ${CopyFileEx} "" "$g_strSystemDir\dllcache\d3d8.dll" "$g_strSystemDir\dllcache\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
852 ${CopyFileEx} "" "$g_strSystemDir\dllcache\d3d9.dll" "$g_strSystemDir\dllcache\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
853
854 Push "$g_strSystemDir\dllcache\d3d8.dll"
855 Call PrepareWRPFile
856
857 Push "$g_strSystemDir\dllcache\d3d9.dll"
858 Call PrepareWRPFile
859
860 ; Exchange DLLs
861 ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
862 ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
863 ${Else}
864 ${LogVerbose} "DLL cache does not exist, skipping"
865 ${EndIf}
866 ${EndIf}
867
868 ;
869 ; Save original DLLs (only if msd3d*.dll does not exist) ...
870 ;
871 SetOutPath $g_strSystemDir
872 ${CopyFileEx} "" "$g_strSystemDir\d3d8.dll" "$g_strSystemDir\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
873 ${CopyFileEx} "" "$g_strSystemDir\d3d9.dll" "$g_strSystemDir\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
874
875 Push "$g_strSystemDir\d3d8.dll"
876 Call PrepareWRPFile
877
878 Push "$g_strSystemDir\d3d9.dll"
879 Call PrepareWRPFile
880
881 ; Exchange DLLs
882 ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
883 ${InstallFileEx} "" "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
884
885!if $%BUILD_TARGET_ARCH% == "amd64"
886 ; Only 64-bit installer:
887 ; Also copy 32-bit DLLs on 64-bit Windows in SysWOW64 node
888 SetOutPath $g_strSysWow64
889 ${LogVerbose} "Installing Direct3D support for 32-bit applications (SysWOW64: $g_strSysWow64) ..."
890 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
891 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
892 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
893
894 ;
895 ; Update DLL cache
896 ;
897 ${If} $g_bCapDllCache == "true"
898 ${If} ${FileExists} "$g_strSysWow64\dllcache"
899 SetOutPath "$g_strSysWow64\dllcache"
900 ${CopyFileEx} "" "$g_strSysWow64\dllcache\d3d8.dll" "$g_strSysWow64\dllcache\msd3d8.dll" "Microsoft Corporation" "x86"
901 ${CopyFileEx} "" "$g_strSysWow64\dllcache\d3d9.dll" "$g_strSysWow64\dllcache\msd3d9.dll" "Microsoft Corporation" "x86"
902
903 Push "$g_strSysWow64\dllcache\d3d8.dll"
904 Call PrepareWRPFile
905
906 Push "$g_strSysWow64\dllcache\d3d9.dll"
907 Call PrepareWRPFile
908
909 ; Exchange DLLs
910 ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "$TEMP"
911 ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "$TEMP"
912 ${Else}
913 ${LogVerbose} "DLL cache does not exist, skipping"
914 ${EndIf}
915 ${EndIf}
916
917 ;
918 ; Update original DLLs
919 ;
920
921 ; Save original DLLs (only if msd3d*.dll does not exist) ...
922 ${CopyFileEx} "" "$g_strSysWow64\d3d8.dll" "$g_strSysWow64\msd3d8.dll" "Microsoft Corporation" "x86"
923 ${CopyFileEx} "" "$g_strSysWow64\d3d9.dll" "$g_strSysWow64\msd3d9.dll" "Microsoft Corporation" "x86"
924
925 Push "$g_strSysWow64\d3d8.dll"
926 Call PrepareWRPFile
927
928 Push "$g_strSysWow64\d3d9.dll"
929 Call PrepareWRPFile
930
931 ; Exchange DLLs
932 ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\d3d8.dll" "$TEMP"
933 ${InstallFileEx} "" "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\d3d9.dll" "$TEMP"
934
935!endif ; amd64
936 Goto done
937
938error:
939 ; @todo
940 Goto exit
941
942done:
943
944!ifndef WFP_FILE_EXCEPTION
945 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_WFP_WARN_REPLACE) /SD IDOK
946!endif
947 Goto exit
948
949exit:
950
951SectionEnd
952
953!ifdef USE_MUI
954 ;Assign language strings to sections
955 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
956 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
957 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
958 !if $%VBOX_WITH_CROGL% == "1"
959 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
960 !endif
961 !insertmacro MUI_FUNCTION_DESCRIPTION_END
962!endif ; USE_MUI
963
964Section -Content
965
966 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
967
968SectionEnd
969
970Section -StartMenu
971
972 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
973 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\iexplore.ico"
974 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
975
976SectionEnd
977
978; This section is called after all the files are in place
979Section -Post
980
981!ifdef _DEBUG
982 ${LogVerbose} "Doing post install ..."
983!endif
984
985!ifdef EXTERNAL_UNINSTALLER
986 SetOutPath "$INSTDIR"
987 FILE "$%PATH_TARGET%\uninst.exe"
988!else
989 WriteUninstaller "$INSTDIR\uninst.exe"
990!endif
991
992 ; Write uninstaller in "Add / Remove programs"
993 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
994 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
995 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
996 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
997 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
998
999 ; Tune TcpWindowSize for a better network throughput
1000 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
1001
1002 ; Add Sun Ray client info keys
1003 ; Note: We only need 32-bit keys (HKLM\Software / HKLM\Software\Wow6432Node)
1004!if $%BUILD_TARGET_ARCH% == "amd64"
1005 WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
1006 WriteRegStr HKLM "SOFTWARE\Wow6432Node\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
1007!else
1008 WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\ReconnectActions" "" ""
1009 WriteRegStr HKLM "SOFTWARE\Oracle\Sun Ray\ClientInfoAgent\DisconnectActions" "" ""
1010!endif
1011
1012 ${LogVerbose} "Installation completed."
1013
1014SectionEnd
1015
1016; !!! NOTE: This function *has* to be right under the last section; otherwise it does
1017; *not* get called! Don't ask me why ... !!!
1018Function .onSelChange
1019
1020 Push $0
1021
1022 ; Handle selection of D3D component
1023 SectionGetFlags ${SEC03} $0
1024 ${If} $0 == ${SF_SELECTED}
1025
1026 StrCpy $g_bWithD3D "true"
1027
1028!if $%VBOX_WITH_WDDM% == "1"
1029 ; If we're able to use the WDDM driver just use it instead of the replaced
1030 ; D3D components below
1031 ${If} $g_bCapWDDM == "true"
1032 ;
1033 ; Temporary solution: Since WDDM is marked as experimental yet we notify the user
1034 ; that WDDM (Aero) support is available but not recommended for production use. He now
1035 ; can opt-in for installing WDDM or still go for the old (XPDM) way -- safe mode still required!
1036 ;
1037 MessageBox MB_ICONQUESTION|MB_YESNO $(VBOX_COMPONENT_D3D_OR_WDDM) /SD IDNO IDYES d3d_install
1038 ; Display an unconditional hint about needed VRAM sizes
1039 ; Note: We also could use the PCI configuration space (WMI: Win32_SystemSlot Class) for querying
1040 ; the current VRAM size, but let's keep it simple for now
1041 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_HINT_VRAM) /SD IDOK
1042 StrCpy $g_bWithWDDM "true"
1043 Goto exit
1044 ${EndIf}
1045
1046d3d_install:
1047
1048!endif ; $%VBOX_WITH_WDDM% == "1"
1049
1050 ${If} $g_bForceInstall != "true"
1051 ; Do not install on < XP
1052 ${If} $g_strWinVersion == "NT4"
1053 ${OrIf} $g_strWinVersion == "2000"
1054 ${OrIf} $g_strWinVersion == ""
1055 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NOT_SUPPORTED) /SD IDOK
1056 Goto d3d_disable
1057 ${EndIf}
1058 ${EndIf}
1059
1060 ; If force flag is set skip the safe mode check
1061 ${If} $g_bForceInstall != "true"
1062 ; If we're not in safe mode, print a warning and don't install D3D support
1063 ${If} $g_iSystemMode == '0'
1064 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NO_SM) /SD IDOK
1065 Goto d3d_disable
1066 ${EndIf}
1067 ${EndIf}
1068
1069 ${Else} ; D3D unselected again
1070
1071 ${If} $g_strWinVersion != "8" ; On Windows 8 WDDM is mandatory
1072 StrCpy $g_bWithWDDM "false"
1073 ${EndIf}
1074
1075 ${EndIf}
1076 Goto exit
1077
1078d3d_disable:
1079
1080 StrCpy $g_bWithD3D "false"
1081 IntOp $0 $0 & ${SECTION_OFF} ; Unselect section again
1082 SectionSetFlags ${SEC03} $0
1083 Goto exit
1084
1085exit:
1086
1087 Pop $0
1088
1089FunctionEnd
1090
1091; This function is called when a critical error occurred, caused by
1092; the Abort command
1093Function .onInstFailed
1094
1095 ${LogVerbose} "$(VBOX_ERROR_INST_FAILED)"
1096 MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
1097
1098 ${If} $g_bPostInstallStatus == "true"
1099 ${LogToVBoxTray} "2" "Error while installing ${PRODUCT_NAME}!"
1100 ${EndIf}
1101
1102 ; Set overall exit code
1103 SetErrorLevel 1
1104
1105FunctionEnd
1106
1107; This function is called when installation was successful!
1108Function .onInstSuccess
1109
1110 ${LogVerbose} "${PRODUCT_NAME} successfully installed"
1111
1112 ${If} $g_bPostInstallStatus == "true"
1113 ${LogToVBoxTray} "0" "${PRODUCT_NAME} successfully updated!"
1114 ${EndIf}
1115
1116 SetErrorLevel 0
1117
1118FunctionEnd
1119
1120; This function is called at the very beginning of installer execution
1121Function .onInit
1122
1123 Push $0
1124
1125 ; Init values
1126 StrCpy $g_iSystemMode "0"
1127 StrCpy $g_strCurUser "<None>"
1128 StrCpy $g_strAddVerMaj "0"
1129 StrCpy $g_strAddVerMin "0"
1130 StrCpy $g_strAddVerBuild "0"
1131 StrCpy $g_strAddVerRev "0"
1132
1133 StrCpy $g_bIgnoreUnknownOpts "false"
1134 StrCpy $g_bLogEnable "false"
1135 StrCpy $g_bFakeWHQL "false"
1136 StrCpy $g_bForceInstall "false"
1137 StrCpy $g_bUninstall "false"
1138 StrCpy $g_bRebootOnExit "false"
1139 StrCpy $g_iScreenX "0"
1140 StrCpy $g_iScreenY "0"
1141 StrCpy $g_iScreenBpp "0"
1142 StrCpy $g_iSfOrder "0"
1143 StrCpy $g_bNoVBoxServiceExit "false"
1144 StrCpy $g_bNoVBoxTrayExit "false"
1145 StrCpy $g_bNoVideoDrv "false"
1146 StrCpy $g_bNoGuestDrv "false"
1147 StrCpy $g_bNoMouseDrv "false"
1148 StrCpy $g_bWithAutoLogon "false"
1149 StrCpy $g_bWithVBoxMMR "false"
1150 StrCpy $g_bWithD3D "false"
1151 StrCpy $g_bOnlyExtract "false"
1152 StrCpy $g_bWithWDDM "false"
1153 StrCpy $g_bCapDllCache "false"
1154 StrCpy $g_bCapWDDM "false"
1155 StrCpy $g_bPostInstallStatus "false"
1156
1157 ; We need a special directory set to SysWOW64 because some
1158 ; shell operations don't support file redirection (yet)
1159 StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
1160
1161 SetErrorLevel 0
1162 ClearErrors
1163
1164!ifdef UNINSTALLER_ONLY
1165
1166 ;
1167 ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
1168 ; so we can sign it
1169 ;
1170 ; Note that the Quit causes the exit status to be 2 instead of 0
1171 ;
1172 WriteUninstaller "$%PATH_TARGET%\uninst.exe"
1173 Quit
1174
1175!else
1176
1177 ; Handle command line
1178 Call HandleCommandLine
1179
1180 ; Check if there's already another instance of the installer is running -
1181 ; important for preventing NT4 to spawn the installer twice
1182 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
1183 Pop $0
1184 ${If} $0 != 0
1185 Quit
1186 ${EndIf}
1187
1188 ; Retrieve Windows version and store result in $g_strWinVersion
1189 Call GetWindowsVersionEx
1190 Pop $g_strWinVersion
1191
1192 ; Retrieve capabilities
1193 Call CheckForCapabilities
1194
1195 ; Get user Name
1196 AccessControl::GetCurrentUserName
1197 Pop $g_strCurUser
1198 ${LogVerbose} "Current user: $g_strCurUser"
1199
1200 ; Only extract files? This action can be called even from non-Admin users
1201 ; and non-compatible architectures
1202 ${If} $g_bOnlyExtract == "true"
1203 Call ExtractFiles
1204 MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
1205 Quit
1206 ${EndIf}
1207
1208 ; Check for correct architecture
1209 Call CheckArchitecture
1210 Pop $0
1211 ${If} $0 <> 0 ; Wrong architecture? Tell the world
1212!if $%BUILD_TARGET_ARCH% == "amd64"
1213 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_AMD64) /SD IDOK
1214!else
1215 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
1216!endif
1217 Abort "$(VBOX_NOTICE_ARCH_AMD64)"
1218 ${EndIf}
1219
1220 ; Has the user who calls us admin rights?
1221 UserInfo::GetAccountType
1222 Pop $0
1223 ${If} $0 != "Admin"
1224 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1225 Abort
1226 ${EndIf}
1227
1228 ; Only uninstall?
1229 ${If} $g_bUninstall == "true"
1230 Call Uninstall_Innotek
1231 Call Uninstall
1232 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1233 Quit
1234 ${EndIf}
1235
1236 Call CheckForInstalledComponents
1237
1238 ; Set section bits
1239 ${If} $g_bWithAutoLogon == "true" ; Auto-logon support
1240 !insertmacro SelectSection ${SEC02}
1241 ${EndIf}
1242!if $%VBOX_WITH_CROGL% == "1"
1243 ${If} $g_bWithD3D == "true" ; D3D support
1244 !insertmacro SelectSection ${SEC03}
1245 ${EndIf}
1246!endif
1247 ${If} $g_bWithWDDM == "true" ; D3D / WDDM support
1248 !insertmacro SelectSection ${SEC03}
1249 ${EndIf}
1250 ; On Windows 8 we always select the 3D section and
1251 ; disable it so that it cannot be deselected again
1252 ${If} $g_strWinVersion == "8"
1253 IntOp $0 ${SF_SELECTED} | ${SF_RO}
1254 SectionSetFlags ${SEC03} $0
1255 ${EndIf}
1256
1257!ifdef USE_MUI
1258 ; Display language selection dialog (will be hidden in silent mode!)
1259 !ifdef VBOX_INSTALLER_ADD_LANGUAGES
1260 !insertmacro MUI_LANGDLL_DISPLAY
1261 !endif
1262!endif
1263
1264 Call SetAppMode64
1265
1266 ; Check for old additions
1267 Call CheckForOldGuestAdditions
1268 Call GetAdditionsVersion
1269
1270 ; Due to some bug in NSIS the license page won't be displayed if we're in
1271 ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
1272 ; mode for now
1273 Call SetAppMode32
1274
1275!endif ; UNINSTALLER_ONLY
1276
1277 Pop $0
1278
1279FunctionEnd
1280
1281;
1282; The uninstaller is built separately when doing code signing
1283; For some reason NSIS still finds the Uninstall section even
1284; when EXTERNAL_UNINSTALLER is defined. This causes a silly warning
1285;
1286!ifndef EXTERNAL_UNINSTALLER
1287
1288Function un.onUninstSuccess
1289
1290 HideWindow
1291 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1292
1293FunctionEnd
1294
1295Function un.onInit
1296
1297 ; Has the user who calls us admin rights?
1298 UserInfo::GetAccountType
1299 Pop $0
1300 ${If} $0 != "Admin"
1301 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1302 Abort
1303 ${EndIf}
1304
1305 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
1306 Quit
1307
1308proceed:
1309
1310 Call un.SetAppMode64
1311
1312 ; Set system directory
1313 StrCpy $g_strSystemDir "$SYSDIR"
1314
1315 ; We need a special directory set to SysWOW64 because some
1316 ; shell operations don't support file redirection (yet)
1317 StrCpy $g_strSysWow64 "$WINDIR\SysWOW64"
1318
1319 ; Retrieve Windows version we're running on and store it in $g_strWinVersion
1320 Call un.GetWindowsVersionEx
1321 Pop $g_strWinVersion
1322
1323 ; Retrieve capabilities
1324 Call un.CheckForCapabilities
1325
1326FunctionEnd
1327
1328Section Uninstall
1329
1330!ifdef _DEBUG
1331 ${LogEnable} "true"
1332!endif
1333
1334 Call un.SetAppMode64
1335
1336 ; Call the uninstall main function
1337 Call un.Uninstall
1338
1339 ; ... and remove the local install directory
1340 Call un.UninstallInstDir
1341
1342!ifndef _DEBUG
1343 SetAutoClose true
1344 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
1345 StrCmp $g_bRebootOnExit "true" restart
1346!endif
1347
1348 Goto exit
1349
1350restart:
1351
1352 ${LogVerbose} "Rebooting ..."
1353 Reboot
1354
1355exit:
1356
1357SectionEnd
1358
1359; !EXTERNAL_UNINSTALLER
1360!endif
1361
1362;Direct the output to our bin dir
1363!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