VirtualBox

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

Last change on this file since 38994 was 38994, checked in by vboxsync, 13 years ago

Windows Guest Additions installer: Use WDDM driver by default on Windows 8. Enable the 3D section by default and make it read-only.

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