VirtualBox

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

Last change on this file since 37253 was 37253, checked in by vboxsync, 14 years ago

Windows Guest Additions installer: Ask if Aero (WDDM) support should be installed instead of the regular Direct3D support.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 39.2 KB
Line 
1; $Id: VBoxGuestAdditions.nsi 37253 2011-05-30 11:56:34Z 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
626 ${If} $g_bForceInstall == "true"
627 Goto vista ; Assume newer OS than we know of ...
628 ${EndIf}
629
630 Goto notsupported
631
632!if $%BUILD_TARGET_ARCH% == "x86" ; 32-bit
633nt4: ; Windows NT4
634
635 Call GetServicePack
636 Pop $R0 ; Major version
637 Pop $R1 ; Minor version
638
639 ; At least Service Pack 6 installed?
640 ${If} $R0 <> "6"
641 MessageBox MB_YESNO $(VBOX_NT4_NO_SP6) /SD IDYES IDYES +2
642 Quit
643 ${EndIf}
644
645 ; Copy some common files ...
646 Call Common_CopyFiles
647
648 Call NT4_Main
649 goto success
650!endif
651
652vista: ; Windows Vista / Windows 7
653
654 ; Copy some common files ...
655 Call Common_CopyFiles
656
657 Call W2K_Main ; First install stuff from Windows 2000 / XP
658 Call Vista_Main ; ... and some specific stuff for Vista / Windows 7
659 goto success
660
661w2k: ; Windows 2000 and XP ...
662
663 ; Copy some common files ...
664 Call Common_CopyFiles
665
666 Call W2K_Main
667 goto success
668
669notsupported:
670
671 MessageBox MB_ICONSTOP $(VBOX_PLATFORM_UNSUPPORTED) /SD IDOK
672 goto exit
673
674success:
675
676 ; Write a registry key with version and installation path for later lookup
677 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Version" "$%VBOX_VERSION_STRING_RAW%"
678 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "VersionExt" "$%VBOX_VERSION_STRING%"
679 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "Revision" "$%VBOX_SVN_REV%"
680 WriteRegStr HKLM "${PRODUCT_INSTALL_KEY}" "InstallDir" "$INSTDIR"
681
682 ; Set the reboot flag to tell the finish page that is should
683 ; default to the "reboot now" entry
684 SetRebootFlag true
685
686exit:
687
688 Call WriteLogUI
689
690SectionEnd
691
692; Auto-logon support (section is hidden at the moment -- only can be enabled via command line switch)
693Section /o -$(VBOX_COMPONENT_AUTOLOGON) SEC02
694
695 Call SetAppMode64
696
697 Call GetWindowsVersion
698 Pop $R0 ; Windows Version
699
700 DetailPrint "Installing auto-logon support ..."
701
702 ; Another GINA already is installed? Check if this is ours, otherwise let the user decide (unless it's a silent setup)
703 ; whether to replace it with the VirtualBox one or not
704 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL"
705 ${If} $0 != ""
706 ${If} $0 != "VBoxGINA.dll"
707 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(VBOX_COMPONENT_AUTOLOGON_WARN_3RDPARTY) /SD IDYES IDYES install
708 goto skip
709 ${EndIf}
710 ${EndIf}
711
712install:
713
714 ; Do we need VBoxCredProv or VBoxGINA?
715 ${If} $R0 == 'Vista' ; Use VBoxCredProv on newer Windows OSes (>= Vista)
716 ${OrIf} $R0 == '7'
717 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxCredProv.dll" "$g_strSystemDir\VBoxCredProv.dll" "$INSTDIR"
718 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (default) key
719 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (Default) key
720 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "" "VBoxCredProv.dll" ; adding to (Default) key
721 WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "ThreadingModel" "Apartment"
722 ${Else} ; Use VBoxGINA on older Windows OSes (< Vista)
723 !insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
724 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
725 ${EndIf}
726
727skip:
728
729 ; Nothing to do here right now
730
731exit:
732
733SectionEnd
734
735; Prepares the access rights for replacing a WRP protected file
736Function PrepareWRPFile
737
738 Pop $0
739
740 IfFileExists "$g_strSystemDir\takeown.exe" 0 +2
741 nsExec::ExecToLog '"$g_strSystemDir\takeown.exe" /F "$0"'
742 AccessControl::SetFileOwner "$0" "(S-1-5-32-545)"
743 Pop $1
744 DetailPrint "Setting file owner for '$0': $1"
745 AccessControl::GrantOnFile "$0" "(S-1-5-32-545)" "FullAccess"
746 Pop $1
747 DetailPrint "Setting access rights for '$0': $1"
748
749!if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
750 !ifdef WFP_FILE_EXCEPTION
751 VBoxGuestInstallHelper::DisableWFP "$0"
752 Pop $1 ; Get return value (ignored for now)
753 DetailPrint "Setting WFP exception for '$0': $1"
754 !endif
755!endif
756
757FunctionEnd
758
759; Direct3D support
760!if $%VBOX_WITH_CROGL% == "1"
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 ...
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\msd3d8.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 ...
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!endif ; VBOX_WITH_CROGL
899
900!ifdef USE_MUI
901 ;Assign language strings to sections
902 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
903 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
904 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
905 !if $%VBOX_WITH_CROGL% == "1"
906 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
907 !endif
908 !insertmacro MUI_FUNCTION_DESCRIPTION_END
909!endif ; USE_MUI
910
911Section -Content
912
913 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
914
915SectionEnd
916
917Section -StartMenu
918
919 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
920 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\iexplore.ico"
921 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
922
923SectionEnd
924
925; This section is called after all the files are in place
926Section -Post
927
928!ifdef _DEBUG
929 DetailPrint "Doing post install ..."
930!endif
931
932!ifdef EXTERNAL_UNINSTALLER
933 SetOutPath "$INSTDIR"
934 FILE "$%PATH_TARGET%\uninst.exe"
935!else
936 WriteUninstaller "$INSTDIR\uninst.exe"
937!endif
938
939 ; Write uninstaller in "Add / Remove programs"
940 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
941 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
942 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
943 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
944 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
945
946 ; Tune TcpWindowSize for a better network throughput
947 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
948
949 DetailPrint "Installation completed."
950
951SectionEnd
952
953; !!! NOTE: This function *has* to be right under the last section; otherwise it does
954; *not* get called! Don't ask me why ... !!!
955Function .onSelChange
956
957 Push $0
958
959 ; Handle selection of D3D component
960 SectionGetFlags ${SEC03} $0
961 ${If} $0 == ${SF_SELECTED}
962
963!if $%VBOX_WITH_WDDM% == "1"
964 ; If we're able to use the WDDM driver just use it instead of the replaced
965 ; D3D components below
966 ${If} $g_bCapWDDM == "true"
967 ;
968 ; Temporary solution: Since WDDM is marked as experimental yet we notify the user
969 ; that WDDM (Aero) support is available but not recommended for production use. He now
970 ; can opt-in for installing WDDM or still go for the old (XPDM) way -- safe mode still required!
971 ;
972 MessageBox MB_ICONQUESTION|MB_YESNO $(VBOX_COMPONENT_D3D_OR_WDDM) /SD IDNO IDYES d3d_install
973 StrCpy $g_bWithWDDM "true"
974 Goto exit
975 ${EndIf}
976
977d3d_install:
978
979!endif
980
981 ${If} $g_bForceInstall != "true"
982 ; Do not install on < XP
983 ${If} $g_strWinVersion == "NT4"
984 ${OrIf} $g_strWinVersion == "2000"
985 ${OrIf} $g_strWinVersion == ""
986 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NOT_SUPPORTED) /SD IDOK
987 Goto d3d_disable
988 ${EndIf}
989 ${EndIf}
990
991 ; If force flag is set skip the safe mode check
992 ${If} $g_bForceInstall != "true"
993 ; If we're not in safe mode, print a warning and don't install D3D support
994 ${If} $g_iSystemMode == '0'
995 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NO_SM) /SD IDOK
996 Goto d3d_disable
997 ${EndIf}
998 ${EndIf}
999 ${Else} ; D3D unselected again
1000 StrCpy $g_bWithWDDM "false"
1001 ${EndIf}
1002 Goto exit
1003
1004d3d_disable:
1005
1006 IntOp $0 $0 & ${SECTION_OFF} ; Unselect section again
1007 SectionSetFlags ${SEC03} $0
1008 Goto exit
1009
1010exit:
1011
1012 Pop $0
1013
1014FunctionEnd
1015
1016; This function is called when a critical error occurred
1017Function .onInstFailed
1018
1019 MessageBox MB_ICONSTOP $(VBOX_ERROR_INST_FAILED) /SD IDOK
1020
1021 Push "Error while installing ${PRODUCT_NAME}!"
1022 Push 2 ; Message type = error
1023 Call WriteLogVBoxTray
1024
1025 StrCpy $g_bLogEnable "true"
1026 Call WriteLogUI
1027 SetErrorLevel 1
1028
1029FunctionEnd
1030
1031; This function is called when installation was successful!
1032Function .onInstSuccess
1033
1034 Push "${PRODUCT_NAME} successfully updated!"
1035 Push 0 ; Message type = info
1036 Call WriteLogVBoxTray
1037
1038FunctionEnd
1039
1040; This function is called at the very beginning of installer execution
1041Function .onInit
1042
1043 ; Init values
1044 StrCpy $g_iSystemMode "0"
1045 StrCpy $g_strCurUser "<None>"
1046 StrCpy $g_strAddVerMaj "0"
1047 StrCpy $g_strAddVerMin "0"
1048 StrCpy $g_strAddVerBuild "0"
1049 StrCpy $g_strAddVerRev "0"
1050
1051 StrCpy $g_bIgnoreUnknownOpts "false"
1052 StrCpy $g_bLogEnable "false"
1053 StrCpy $g_bFakeWHQL "false"
1054 StrCpy $g_bForceInstall "false"
1055 StrCpy $g_bUninstall "false"
1056 StrCpy $g_bRebootOnExit "false"
1057 StrCpy $g_iScreenX "0"
1058 StrCpy $g_iScreenY "0"
1059 StrCpy $g_iScreenBpp "0"
1060 StrCpy $g_iSfOrder "0"
1061 StrCpy $g_bNoVBoxServiceExit "false"
1062 StrCpy $g_bNoVBoxTrayExit "false"
1063 StrCpy $g_bNoVideoDrv "false"
1064 StrCpy $g_bNoGuestDrv "false"
1065 StrCpy $g_bNoMouseDrv "false"
1066 StrCpy $g_bWithAutoLogon "false"
1067 StrCpy $g_bWithD3D "false"
1068 StrCpy $g_bOnlyExtract "false"
1069 StrCpy $g_bWithWDDM "false"
1070 StrCpy $g_bCapWDDM "false"
1071 StrCpy $g_bPostInstallStatus "false"
1072
1073 SetErrorLevel 0
1074 ClearErrors
1075
1076!ifdef UNINSTALLER_ONLY
1077
1078 ;
1079 ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
1080 ; so we can sign it
1081 ;
1082 ; Note that the Quit causes the exit status to be 2 instead of 0
1083 ;
1084 WriteUninstaller "$%PATH_TARGET%\uninst.exe"
1085 Quit
1086
1087!else
1088
1089 ; Handle command line
1090 Call HandleCommandLine
1091
1092 ; Check if there's already another instance of the installer is running -
1093 ; important for preventing NT4 to spawn the installer twice
1094 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
1095 Pop $0
1096 ${If} $0 != 0
1097 Quit
1098 ${EndIf}
1099
1100 ; Retrieve Windows version and store result in $g_strWinVersion
1101 Call GetWindowsVer
1102
1103 ; Retrieve capabilities
1104 Call CheckForCapabilities
1105
1106 ; Get user Name
1107 AccessControl::GetCurrentUserName
1108 Pop $g_strCurUser
1109 DetailPrint "Current user: $g_strCurUser"
1110
1111 ; Only extract files? This action can be called even from non-Admin users
1112 ; and non-compatible architectures
1113 ${If} $g_bOnlyExtract == "true"
1114 Call ExtractFiles
1115 MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
1116 Quit
1117 ${EndIf}
1118
1119 ; Check for correct architecture
1120 Call CheckArchitecture
1121 Pop $0
1122 ${If} $0 <> 0 ; Wrong architecture? Tell the world
1123!if $%BUILD_TARGET_ARCH% == "amd64"
1124 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_AMD64) /SD IDOK
1125!else
1126 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
1127!endif
1128 Abort
1129 ${EndIf}
1130
1131 ; Has the user who calls us admin rights?
1132 UserInfo::GetAccountType
1133 Pop $0
1134 ${If} $0 != "Admin"
1135 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1136 Abort
1137 ${EndIf}
1138
1139 ; Only uninstall?
1140 ${If} $g_bUninstall == "true"
1141 Call Uninstall_Innotek
1142 Call Uninstall
1143 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1144 Quit
1145 ${EndIf}
1146
1147 Call CheckForInstalledComponents
1148
1149 ; Set section bits
1150 ${If} $g_bWithAutoLogon == "true" ; Auto-logon support
1151 SectionSetFlags ${SEC02} ${SF_SELECTED}
1152 ${EndIf}
1153!if $%VBOX_WITH_CROGL% == "1"
1154 ${If} $g_bWithD3D == "true" ; D3D support
1155 SectionSetFlags ${SEC03} ${SF_SELECTED}
1156 ${EndIf}
1157!endif
1158
1159!ifdef USE_MUI
1160 ; Display language selection dialog (will be hidden in silent mode!)
1161 !ifdef VBOX_INSTALLER_ADD_LANGUAGES
1162 !insertmacro MUI_LANGDLL_DISPLAY
1163 !endif
1164!endif
1165
1166 Call SetAppMode64
1167
1168 ; Check for old additions
1169 Call CheckForOldGuestAdditions
1170 Call GetAdditionsVersion
1171
1172 ; Due to some bug in NSIS the license page won't be displayed if we're in
1173 ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
1174 ; mode for now
1175 Call SetAppMode32
1176
1177!endif ; UNINSTALLER_ONLY
1178
1179FunctionEnd
1180
1181;
1182; The uninstaller is built separately when doing code signing
1183; For some reason NSIS still finds the Uninstall section even
1184; when EXTERNAL_UNINSTALLER is defined. This causes a silly warning
1185;
1186!ifndef EXTERNAL_UNINSTALLER
1187
1188Function un.onUninstSuccess
1189
1190 HideWindow
1191 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1192
1193FunctionEnd
1194
1195Function un.onInit
1196
1197 ; Has the user who calls us admin rights?
1198 UserInfo::GetAccountType
1199 Pop $0
1200 ${If} $0 != "Admin"
1201 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1202 Abort
1203 ${EndIf}
1204
1205 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
1206 Quit
1207
1208proceed:
1209
1210 Call un.SetAppMode64
1211
1212 ; Set system directory
1213 StrCpy $g_strSystemDir "$SYSDIR"
1214
1215 ; Retrieve Windows version we're running on and store it in $g_strWinVersion
1216 Call un.GetWindowsVer
1217
1218 ; Retrieve capabilities
1219 Call un.CheckForCapabilities
1220
1221FunctionEnd
1222
1223Section Uninstall
1224
1225!ifdef _DEBUG
1226 ; Enable logging
1227 Call un.EnableLog
1228!endif
1229
1230 Call un.SetAppMode64
1231
1232 ; Call the uninstall main function
1233 Call un.Uninstall
1234
1235 ; ... and remove the local install directory
1236 Call un.UninstallInstDir
1237
1238!ifndef _DEBUG
1239 SetAutoClose true
1240 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
1241 StrCmp $g_bRebootOnExit "true" restart
1242!endif
1243
1244 Goto exit
1245
1246restart:
1247
1248 DetailPrint "Rebooting ..."
1249 Reboot
1250
1251exit:
1252
1253SectionEnd
1254
1255; !EXTERNAL_UNINSTALLER
1256!endif
1257
1258;Direct the output to our bin dir
1259!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