VirtualBox

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

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

Windows Guest Additions installer: Attempt to fix SysWOW64 problems for D3D installation on 64-bit.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 40.5 KB
Line 
1; $Id: VBoxGuestAdditions.nsi 39513 2011-12-02 12:11:04Z 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
737; a WRP (Windows Resource Protection) protected file
738Function PrepareWRPFile
739
740 Pop $0
741
742 IfFileExists "$0" +3 +1
743 LogText "WRP: File $0 does not exist, skipping"
744 Return
745
746 IfFileExists "$g_strSystemDir\takeown.exe" +1 +4
747 nsExec::ExecToLog '"$g_strSystemDir\takeown.exe" /F "$0"'
748 Pop $1 ; Ret value
749 LogText "WRP: Taking ownership for $0 returned: $1"
750
751 AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
752 Pop $1
753 DetailPrint "WRP: Setting file owner for $0 returned: $1"
754
755 AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
756 Pop $1
757 DetailPrint "WRP: Setting access rights for $0 returned: $1"
758
759!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
760 !ifdef WFP_FILE_EXCEPTION
761 VBoxGuestInstallHelper::DisableWFP "$0"
762 Pop $1 ; Get return value (ignored for now)
763 DetailPrint "WRP: Setting WFP exception for $0 returned: $1"
764 !endif
765!endif
766
767FunctionEnd
768
769; Direct3D support
770Section /o $(VBOX_COMPONENT_D3D) SEC03
771
772!if $%VBOX_WITH_WDDM% == "1"
773 ${If} $g_bWithWDDM == "true"
774 ; All D3D components are installed with WDDM driver package, nothing to be done here
775 Return
776 ${EndIf}
777!endif
778
779 SetOverwrite on
780
781 ${If} $g_strSystemDir == ''
782 StrCpy $g_strSystemDir "$SYSDIR"
783 ${EndIf}
784
785 SetOutPath $g_strSystemDir
786 DetailPrint "Installing Direct3D support ..."
787 !if $%BUILD_TARGET_ARCH% == "x86"
788 FILE "$%PATH_OUT%\bin\additions\libWine.dll"
789 !endif
790 FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
791 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
792 FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
793
794 ; Update DLL cache
795 SetOutPath "$g_strSystemDir\dllcache"
796 IfFileExists "$g_strSystemDir\dllcache\msd3d8.dll" +2
797 CopyFiles /SILENT "$g_strSystemDir\dllcache\d3d8.dll" "$g_strSystemDir\dllcache\msd3d8.dll"
798 IfFileExists "$g_strSystemDir\dllcache\msd3d9.dll" +2
799 CopyFiles /SILENT "$g_strSystemDir\dllcache\d3d9.dll" "$g_strSystemDir\dllcache\msd3d9.dll"
800
801 Push "$g_strSystemDir\dllcache\d3d8.dll"
802 Call PrepareWRPFile
803
804 Push "$g_strSystemDir\dllcache\d3d9.dll"
805 Call PrepareWRPFile
806
807 ; Exchange DLLs
808 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
809 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
810
811 ; If exchange above failed, do it on reboot
812 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
813 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
814
815 ; Save original DLLs (only if msd3d*.dll does not exist) ...
816 SetOutPath $g_strSystemDir
817 IfFileExists "$g_strSystemDir\msd3d8.dll" +2
818 CopyFiles /SILENT "$g_strSystemDir\d3d8.dll" "$g_strSystemDir\msd3d8.dll"
819 IfFileExists "$g_strSystemDir\msd3d9.dll" +2
820 CopyFiles /SILENT "$g_strSystemDir\d3d9.dll" "$g_strSystemDir\msd3d9.dll"
821
822 Push "$g_strSystemDir\d3d8.dll"
823 Call PrepareWRPFile
824
825 Push "$g_strSystemDir\d3d9.dll"
826 Call PrepareWRPFile
827
828 ; Exchange DLLs
829 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
830 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
831
832 ; If exchange above failed, do it on reboot
833 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
834 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
835
836 !if $%BUILD_TARGET_ARCH% == "amd64"
837 ; We need a special directory set to SysWOW64 because some
838 ; shell operations don't support file redirection (yet)
839 Var SYSWOW64DIR
840 StrCpy SYSWOW64DIR "$WINDIR\SysWOW64"
841 ; Only 64-bit installer:
842 ; Also copy 32-bit DLLs on 64-bit Windows in SysWOW64 node
843 SetOutPath $SYSWOW64DIR
844 DetailPrint "Installing Direct3D support (SysWOW64: $SYSWOW64DIR) ..."
845 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\libWine.dll"
846 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
847 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
848 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
849
850 ;
851 ; Update DLL cache
852 ;
853
854 ; Save original DLLs (only if msd3d*.dll does not exist) ...
855 SetOutPath "$SYSWOW64DIR\dllcache"
856 IfFileExists "$SYSWOW64DIR\dllcache\msd3d8.dll" +2
857 CopyFiles /SILENT "$SYSWOW64DIR\dllcache\d3d8.dll" "$SYSWOW64DIR\dllcache\msd3d8.dll"
858 IfFileExists "$SYSWOW64DIR\dllcache\msd3d9.dll" +2
859 CopyFiles /SILENT "$SYSWOW64DIR\dllcache\d3d9.dll" "$SYSWOW64DIR\dllcache\msd3d9.dll"
860
861 Push "$SYSWOW64DIR\dllcache\d3d8.dll"
862 Call PrepareWRPFile
863
864 Push "$SYSWOW64DIR\dllcache\d3d9.dll"
865 Call PrepareWRPFile
866
867 ; Exchange DLLs
868 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSWOW64DIR\dllcache\d3d8.dll" "$TEMP"
869 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSWOW64DIR\dllcache\d3d9.dll" "$TEMP"
870
871 ; If exchange above failed, do it on reboot
872 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSWOW64DIR\dllcache\d3d8.dll" "$TEMP"
873 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSWOW64DIR\dllcache\d3d9.dll" "$TEMP"
874
875 ;
876 ; Update original DLLs
877 ;
878
879 ; Save original DLLs (only if msd3d*.dll does not exist) ...
880 IfFileExists "$SYSWOW64DIR\msd3d8.dll" +2
881 CopyFiles /SILENT "$SYSWOW64DIR\d3d8.dll" "$SYSWOW64DIR\msd3d8.dll"
882 IfFileExists "$SYSWOW64DIR\msd3d9.dll" +2
883 CopyFiles /SILENT "$SYSWOW64DIR\d3d9.dll" "$SYSWOW64DIR\msd3d9.dll"
884
885 Push "$SYSWOW64DIR\d3d8.dll"
886 Call PrepareWRPFile
887
888 Push "$SYSWOW64DIR\d3d9.dll"
889 Call PrepareWRPFile
890
891 ; Exchange DLLs
892 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSWOW64DIR\d3d8.dll" "$TEMP"
893 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSWOW64DIR\d3d9.dll" "$TEMP"
894
895 ; If exchange above failed, do it on reboot
896 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSWOW64DIR\d3d8.dll" "$TEMP"
897 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSWOW64DIR\d3d9.dll" "$TEMP"
898
899 !endif ; amd64
900 Goto done
901
902error:
903 ; @todo
904 Goto exit
905
906done:
907
908!ifndef WFP_FILE_EXCEPTION
909 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_WFP_WARN_REPLACE) /SD IDOK
910!endif
911 Goto exit
912
913exit:
914
915SectionEnd
916
917!ifdef USE_MUI
918 ;Assign language strings to sections
919 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
920 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
921 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
922 !if $%VBOX_WITH_CROGL% == "1"
923 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
924 !endif
925 !insertmacro MUI_FUNCTION_DESCRIPTION_END
926!endif ; USE_MUI
927
928Section -Content
929
930 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
931
932SectionEnd
933
934Section -StartMenu
935
936 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
937 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\iexplore.ico"
938 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
939
940SectionEnd
941
942; This section is called after all the files are in place
943Section -Post
944
945!ifdef _DEBUG
946 DetailPrint "Doing post install ..."
947!endif
948
949!ifdef EXTERNAL_UNINSTALLER
950 SetOutPath "$INSTDIR"
951 FILE "$%PATH_TARGET%\uninst.exe"
952!else
953 WriteUninstaller "$INSTDIR\uninst.exe"
954!endif
955
956 ; Write uninstaller in "Add / Remove programs"
957 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
958 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
959 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
960 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
961 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
962
963 ; Tune TcpWindowSize for a better network throughput
964 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
965
966 DetailPrint "Installation completed."
967
968SectionEnd
969
970; !!! NOTE: This function *has* to be right under the last section; otherwise it does
971; *not* get called! Don't ask me why ... !!!
972Function .onSelChange
973
974 Push $0
975
976 ; Handle selection of D3D component
977 SectionGetFlags ${SEC03} $0
978 ${If} $0 == ${SF_SELECTED}
979
980!if $%VBOX_WITH_WDDM% == "1"
981 ; If we're able to use the WDDM driver just use it instead of the replaced
982 ; D3D components below
983 ${If} $g_bCapWDDM == "true"
984 ;
985 ; Temporary solution: Since WDDM is marked as experimental yet we notify the user
986 ; that WDDM (Aero) support is available but not recommended for production use. He now
987 ; can opt-in for installing WDDM or still go for the old (XPDM) way -- safe mode still required!
988 ;
989 MessageBox MB_ICONQUESTION|MB_YESNO $(VBOX_COMPONENT_D3D_OR_WDDM) /SD IDNO IDYES d3d_install
990 ; Display an uncoditional hint about needed VRAM sizes
991 ; Note: We also could use the PCI configuration space (WMI: Win32_SystemSlot Class) for querying
992 ; the current VRAM size, but let's keep it simple for now
993 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_HINT_VRAM) /SD IDOK
994 StrCpy $g_bWithWDDM "true"
995 Goto exit
996 ${EndIf}
997
998d3d_install:
999
1000!endif
1001
1002 ${If} $g_bForceInstall != "true"
1003 ; Do not install on < XP
1004 ${If} $g_strWinVersion == "NT4"
1005 ${OrIf} $g_strWinVersion == "2000"
1006 ${OrIf} $g_strWinVersion == ""
1007 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NOT_SUPPORTED) /SD IDOK
1008 Goto d3d_disable
1009 ${EndIf}
1010 ${EndIf}
1011
1012 ; If force flag is set skip the safe mode check
1013 ${If} $g_bForceInstall != "true"
1014 ; If we're not in safe mode, print a warning and don't install D3D support
1015 ${If} $g_iSystemMode == '0'
1016 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NO_SM) /SD IDOK
1017 Goto d3d_disable
1018 ${EndIf}
1019 ${EndIf}
1020 ${Else} ; D3D unselected again
1021 ${If} $g_strWinVersion != "8" ; On Windows 8 WDDM is mandatory
1022 StrCpy $g_bWithWDDM "false"
1023 ${EndIf}
1024 ${EndIf}
1025 Goto exit
1026
1027d3d_disable:
1028
1029 IntOp $0 $0 & ${SECTION_OFF} ; Unselect section again
1030 SectionSetFlags ${SEC03} $0
1031 Goto exit
1032
1033exit:
1034
1035 Pop $0
1036
1037FunctionEnd
1038
1039; This function is called when a critical error occurred
1040Function .onInstFailed
1041
1042 MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
1043
1044 Push "Error while installing ${PRODUCT_NAME}!"
1045 Push 2 ; Message type = error
1046 Call WriteLogVBoxTray
1047
1048 StrCpy $g_bLogEnable "true"
1049 Call WriteLogUI
1050 SetErrorLevel 1
1051
1052FunctionEnd
1053
1054; This function is called when installation was successful!
1055Function .onInstSuccess
1056
1057 Push "${PRODUCT_NAME} successfully updated!"
1058 Push 0 ; Message type = info
1059 Call WriteLogVBoxTray
1060
1061FunctionEnd
1062
1063; This function is called at the very beginning of installer execution
1064Function .onInit
1065
1066 Push $0
1067
1068 ; Init values
1069 StrCpy $g_iSystemMode "0"
1070 StrCpy $g_strCurUser "<None>"
1071 StrCpy $g_strAddVerMaj "0"
1072 StrCpy $g_strAddVerMin "0"
1073 StrCpy $g_strAddVerBuild "0"
1074 StrCpy $g_strAddVerRev "0"
1075
1076 StrCpy $g_bIgnoreUnknownOpts "false"
1077 StrCpy $g_bLogEnable "false"
1078 StrCpy $g_bFakeWHQL "false"
1079 StrCpy $g_bForceInstall "false"
1080 StrCpy $g_bUninstall "false"
1081 StrCpy $g_bRebootOnExit "false"
1082 StrCpy $g_iScreenX "0"
1083 StrCpy $g_iScreenY "0"
1084 StrCpy $g_iScreenBpp "0"
1085 StrCpy $g_iSfOrder "0"
1086 StrCpy $g_bNoVBoxServiceExit "false"
1087 StrCpy $g_bNoVBoxTrayExit "false"
1088 StrCpy $g_bNoVideoDrv "false"
1089 StrCpy $g_bNoGuestDrv "false"
1090 StrCpy $g_bNoMouseDrv "false"
1091 StrCpy $g_bWithAutoLogon "false"
1092 StrCpy $g_bWithD3D "false"
1093 StrCpy $g_bOnlyExtract "false"
1094 StrCpy $g_bWithWDDM "false"
1095 StrCpy $g_bCapWDDM "false"
1096 StrCpy $g_bPostInstallStatus "false"
1097
1098 SetErrorLevel 0
1099 ClearErrors
1100
1101!ifdef UNINSTALLER_ONLY
1102
1103 ;
1104 ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
1105 ; so we can sign it
1106 ;
1107 ; Note that the Quit causes the exit status to be 2 instead of 0
1108 ;
1109 WriteUninstaller "$%PATH_TARGET%\uninst.exe"
1110 Quit
1111
1112!else
1113
1114 ; Handle command line
1115 Call HandleCommandLine
1116
1117 ; Check if there's already another instance of the installer is running -
1118 ; important for preventing NT4 to spawn the installer twice
1119 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
1120 Pop $0
1121 ${If} $0 != 0
1122 Quit
1123 ${EndIf}
1124
1125 ; Retrieve Windows version and store result in $g_strWinVersion
1126 Call GetWindowsVer
1127
1128 ; Retrieve capabilities
1129 Call CheckForCapabilities
1130
1131 ; Get user Name
1132 AccessControl::GetCurrentUserName
1133 Pop $g_strCurUser
1134 DetailPrint "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
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 SectionSetFlags ${SEC02} ${SF_SELECTED}
1177 ${EndIf}
1178!if $%VBOX_WITH_CROGL% == "1"
1179 ${If} $g_bWithD3D == "true" ; D3D support
1180 SectionSetFlags ${SEC03} ${SF_SELECTED}
1181 ${EndIf}
1182!endif
1183 ; On Windows 8 we always select the 3D section and
1184 ; disable it so that it cannot be deselected again
1185 ${If} $g_strWinVersion == "8"
1186 IntOp $0 ${SF_SELECTED} | ${SF_RO}
1187 SectionSetFlags ${SEC03} $0
1188 ${EndIf}
1189
1190!ifdef USE_MUI
1191 ; Display language selection dialog (will be hidden in silent mode!)
1192 !ifdef VBOX_INSTALLER_ADD_LANGUAGES
1193 !insertmacro MUI_LANGDLL_DISPLAY
1194 !endif
1195!endif
1196
1197 Call SetAppMode64
1198
1199 ; Check for old additions
1200 Call CheckForOldGuestAdditions
1201 Call GetAdditionsVersion
1202
1203 ; Due to some bug in NSIS the license page won't be displayed if we're in
1204 ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
1205 ; mode for now
1206 Call SetAppMode32
1207
1208!endif ; UNINSTALLER_ONLY
1209
1210 Pop $0
1211
1212FunctionEnd
1213
1214;
1215; The uninstaller is built separately when doing code signing
1216; For some reason NSIS still finds the Uninstall section even
1217; when EXTERNAL_UNINSTALLER is defined. This causes a silly warning
1218;
1219!ifndef EXTERNAL_UNINSTALLER
1220
1221Function un.onUninstSuccess
1222
1223 HideWindow
1224 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1225
1226FunctionEnd
1227
1228Function un.onInit
1229
1230 ; Has the user who calls us admin rights?
1231 UserInfo::GetAccountType
1232 Pop $0
1233 ${If} $0 != "Admin"
1234 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1235 Abort
1236 ${EndIf}
1237
1238 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
1239 Quit
1240
1241proceed:
1242
1243 Call un.SetAppMode64
1244
1245 ; Set system directory
1246 StrCpy $g_strSystemDir "$SYSDIR"
1247
1248 ; Retrieve Windows version we're running on and store it in $g_strWinVersion
1249 Call un.GetWindowsVer
1250
1251 ; Retrieve capabilities
1252 Call un.CheckForCapabilities
1253
1254FunctionEnd
1255
1256Section Uninstall
1257
1258!ifdef _DEBUG
1259 ; Enable logging
1260 Call un.EnableLog
1261!endif
1262
1263 Call un.SetAppMode64
1264
1265 ; Call the uninstall main function
1266 Call un.Uninstall
1267
1268 ; ... and remove the local install directory
1269 Call un.UninstallInstDir
1270
1271!ifndef _DEBUG
1272 SetAutoClose true
1273 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
1274 StrCmp $g_bRebootOnExit "true" restart
1275!endif
1276
1277 Goto exit
1278
1279restart:
1280
1281 DetailPrint "Rebooting ..."
1282 Reboot
1283
1284exit:
1285
1286SectionEnd
1287
1288; !EXTERNAL_UNINSTALLER
1289!endif
1290
1291;Direct the output to our bin dir
1292!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