VirtualBox

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

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

Windows Additions: hack Windows 8

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 39.7 KB
Line 
1; $Id: VBoxGuestAdditions.nsi 38751 2011-09-14 13:30:16Z 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
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
761!if $%VBOX_WITH_CROGL% == "1"
762Section /o $(VBOX_COMPONENT_D3D) SEC03
763
764!if $%VBOX_WITH_WDDM% == "1"
765 ${If} $g_bWithWDDM == "true"
766 ; All D3D components are installed with WDDM driver package, nothing to be done here
767 Return
768 ${EndIf}
769!endif
770
771 SetOverwrite on
772
773 ${If} $g_strSystemDir == ''
774 StrCpy $g_strSystemDir "$SYSDIR"
775 ${EndIf}
776
777 SetOutPath $g_strSystemDir
778 DetailPrint "Installing Direct3D support ..."
779 !if $%BUILD_TARGET_ARCH% == "x86"
780 FILE "$%PATH_OUT%\bin\additions\libWine.dll"
781 !endif
782 FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
783 FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
784 FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
785
786 ; Update DLL cache
787 SetOutPath "$g_strSystemDir\dllcache"
788 IfFileExists "$g_strSystemDir\dllcache\msd3d8.dll" +1
789 CopyFiles /SILENT "$g_strSystemDir\dllcache\d3d8.dll" "$g_strSystemDir\dllcache\msd3d8.dll"
790 IfFileExists "$g_strSystemDir\dllcache\msd3d9.dll" +1
791 CopyFiles /SILENT "$g_strSystemDir\dllcache\d3d9.dll" "$g_strSystemDir\dllcache\msd3d9.dll"
792
793 Push "$g_strSystemDir\dllcache\d3d8.dll"
794 Call PrepareWRPFile
795
796 Push "$g_strSystemDir\dllcache\d3d9.dll"
797 Call PrepareWRPFile
798
799 ; Exchange DLLs
800 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
801 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
802
803 ; If exchange above failed, do it on reboot
804 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
805 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
806
807 ; Save original DLLs (only if msd3d*.dll does not exist) ...
808 SetOutPath $g_strSystemDir
809 IfFileExists "$g_strSystemDir\msd3d8.dll" +1
810 CopyFiles /SILENT "$g_strSystemDir\d3d8.dll" "$g_strSystemDir\msd3d8.dll"
811 IfFileExists "$g_strSystemDir\msd3d9.dll" +1
812 CopyFiles /SILENT "$g_strSystemDir\d3d9.dll" "$g_strSystemDir\msd3d9.dll"
813
814 Push "$g_strSystemDir\d3d8.dll"
815 Call PrepareWRPFile
816
817 Push "$g_strSystemDir\d3d9.dll"
818 Call PrepareWRPFile
819
820 ; Exchange DLLs
821 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
822 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
823
824 ; If exchange above failed, do it on reboot
825 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
826 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
827
828 !if $%BUILD_TARGET_ARCH% == "amd64"
829 ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target arch in
830 ; Wow64 node (32-bit sub system)
831 ${EnableX64FSRedirection}
832 SetOutPath $SYSDIR
833 DetailPrint "Installing Direct3D support (Wow64) ..."
834 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\libWine.dll"
835 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
836 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
837 FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
838
839 ; Update DLL cache
840 SetOutPath "$SYSDIR\dllcache"
841 IfFileExists "$SYSDIR\dllcache\msd3d8.dll" +1
842 CopyFiles /SILENT "$SYSDIR\dllcache\d3d8.dll" "$SYSDIR\dllcache\msd3d8.dll"
843 IfFileExists "$SYSDIR\dllcache\msd3d9.dll" +1
844 CopyFiles /SILENT "$SYSDIR\dllcache\d3d9.dll" "$SYSDIR\dllcache\msd3d9.dll"
845
846 Push "$SYSDIR\dllcache\d3d8.dll"
847 Call PrepareWRPFile
848
849 Push "$SYSDIR\dllcache\d3d9.dll"
850 Call PrepareWRPFile
851
852 ; Exchange DLLs
853 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "$TEMP"
854 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "$TEMP"
855
856 ; If exchange above failed, do it on reboot
857 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "$TEMP"
858 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "$TEMP"
859
860 ; Save original DLLs (only if msd3d*.dll does not exist) ...
861 SetOutPath $SYSDIR
862 IfFileExists "$SYSDIR\dllcache\msd3d8.dll" +1
863 CopyFiles /SILENT "$SYSDIR\d3d8.dll" "$SYSDIR\msd3d8.dll"
864 IfFileExists "$SYSDIR\dllcache\msd3d9.dll" +1
865 CopyFiles /SILENT "$SYSDIR\d3d9.dll" "$SYSDIR\msd3d9.dll"
866
867 Push "$SYSDIR\d3d8.dll"
868 Call PrepareWRPFile
869
870 Push "$SYSDIR\d3d9.dll"
871 Call PrepareWRPFile
872
873 ; Exchange DLLs
874 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\d3d8.dll" "$TEMP"
875 !insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\d3d9.dll" "$TEMP"
876
877 ; If exchange above failed, do it on reboot
878 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$SYSDIR\d3d8.dll" "$TEMP"
879 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$SYSDIR\d3d9.dll" "$TEMP"
880
881 ${DisableX64FSRedirection}
882 !endif ; amd64
883 Goto done
884
885error:
886 ; @todo
887 Goto exit
888
889done:
890
891!ifndef WFP_FILE_EXCEPTION
892 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_WFP_WARN_REPLACE) /SD IDOK
893!endif
894 Goto exit
895
896exit:
897
898SectionEnd
899!endif ; VBOX_WITH_CROGL
900
901!ifdef USE_MUI
902 ;Assign language strings to sections
903 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
904 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(VBOX_COMPONENT_MAIN_DESC)
905 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(VBOX_COMPONENT_AUTOLOGON_DESC)
906 !if $%VBOX_WITH_CROGL% == "1"
907 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(VBOX_COMPONENT_D3D_DESC)
908 !endif
909 !insertmacro MUI_FUNCTION_DESCRIPTION_END
910!endif ; USE_MUI
911
912Section -Content
913
914 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
915
916SectionEnd
917
918Section -StartMenu
919
920 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
921 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\iexplore.ico"
922 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
923
924SectionEnd
925
926; This section is called after all the files are in place
927Section -Post
928
929!ifdef _DEBUG
930 DetailPrint "Doing post install ..."
931!endif
932
933!ifdef EXTERNAL_UNINSTALLER
934 SetOutPath "$INSTDIR"
935 FILE "$%PATH_TARGET%\uninst.exe"
936!else
937 WriteUninstaller "$INSTDIR\uninst.exe"
938!endif
939
940 ; Write uninstaller in "Add / Remove programs"
941 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
942 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
943 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
944 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
945 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
946
947 ; Tune TcpWindowSize for a better network throughput
948 WriteRegDWORD HKLM "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpWindowSize" 64240
949
950 DetailPrint "Installation completed."
951
952SectionEnd
953
954; !!! NOTE: This function *has* to be right under the last section; otherwise it does
955; *not* get called! Don't ask me why ... !!!
956Function .onSelChange
957
958 Push $0
959
960 ; Handle selection of D3D component
961 SectionGetFlags ${SEC03} $0
962 ${If} $0 == ${SF_SELECTED}
963
964!if $%VBOX_WITH_WDDM% == "1"
965 ; If we're able to use the WDDM driver just use it instead of the replaced
966 ; D3D components below
967 ${If} $g_bCapWDDM == "true"
968 ;
969 ; Temporary solution: Since WDDM is marked as experimental yet we notify the user
970 ; that WDDM (Aero) support is available but not recommended for production use. He now
971 ; can opt-in for installing WDDM or still go for the old (XPDM) way -- safe mode still required!
972 ;
973 MessageBox MB_ICONQUESTION|MB_YESNO $(VBOX_COMPONENT_D3D_OR_WDDM) /SD IDNO IDYES d3d_install
974 ; Display an uncoditional hint about needed VRAM sizes
975 ; Note: We also could use the PCI configuration space (WMI: Win32_SystemSlot Class) for querying
976 ; the current VRAM size, but let's keep it simple for now
977 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_HINT_VRAM) /SD IDOK
978 StrCpy $g_bWithWDDM "true"
979 Goto exit
980 ${EndIf}
981
982d3d_install:
983
984!endif
985
986 ${If} $g_bForceInstall != "true"
987 ; Do not install on < XP
988 ${If} $g_strWinVersion == "NT4"
989 ${OrIf} $g_strWinVersion == "2000"
990 ${OrIf} $g_strWinVersion == ""
991 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NOT_SUPPORTED) /SD IDOK
992 Goto d3d_disable
993 ${EndIf}
994 ${EndIf}
995
996 ; If force flag is set skip the safe mode check
997 ${If} $g_bForceInstall != "true"
998 ; If we're not in safe mode, print a warning and don't install D3D support
999 ${If} $g_iSystemMode == '0'
1000 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_COMPONENT_D3D_NO_SM) /SD IDOK
1001 Goto d3d_disable
1002 ${EndIf}
1003 ${EndIf}
1004 ${Else} ; D3D unselected again
1005 StrCpy $g_bWithWDDM "false"
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 ; Init values
1049 StrCpy $g_iSystemMode "0"
1050 StrCpy $g_strCurUser "<None>"
1051 StrCpy $g_strAddVerMaj "0"
1052 StrCpy $g_strAddVerMin "0"
1053 StrCpy $g_strAddVerBuild "0"
1054 StrCpy $g_strAddVerRev "0"
1055
1056 StrCpy $g_bIgnoreUnknownOpts "false"
1057 StrCpy $g_bLogEnable "false"
1058 StrCpy $g_bFakeWHQL "false"
1059 StrCpy $g_bForceInstall "false"
1060 StrCpy $g_bUninstall "false"
1061 StrCpy $g_bRebootOnExit "false"
1062 StrCpy $g_iScreenX "0"
1063 StrCpy $g_iScreenY "0"
1064 StrCpy $g_iScreenBpp "0"
1065 StrCpy $g_iSfOrder "0"
1066 StrCpy $g_bNoVBoxServiceExit "false"
1067 StrCpy $g_bNoVBoxTrayExit "false"
1068 StrCpy $g_bNoVideoDrv "false"
1069 StrCpy $g_bNoGuestDrv "false"
1070 StrCpy $g_bNoMouseDrv "false"
1071 StrCpy $g_bWithAutoLogon "false"
1072 StrCpy $g_bWithD3D "false"
1073 StrCpy $g_bOnlyExtract "false"
1074 StrCpy $g_bWithWDDM "false"
1075 StrCpy $g_bCapWDDM "false"
1076 StrCpy $g_bPostInstallStatus "false"
1077
1078 SetErrorLevel 0
1079 ClearErrors
1080
1081!ifdef UNINSTALLER_ONLY
1082
1083 ;
1084 ; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
1085 ; so we can sign it
1086 ;
1087 ; Note that the Quit causes the exit status to be 2 instead of 0
1088 ;
1089 WriteUninstaller "$%PATH_TARGET%\uninst.exe"
1090 Quit
1091
1092!else
1093
1094 ; Handle command line
1095 Call HandleCommandLine
1096
1097 ; Check if there's already another instance of the installer is running -
1098 ; important for preventing NT4 to spawn the installer twice
1099 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VBoxGuestInstaller") ?e'
1100 Pop $0
1101 ${If} $0 != 0
1102 Quit
1103 ${EndIf}
1104
1105 ; Retrieve Windows version and store result in $g_strWinVersion
1106 Call GetWindowsVer
1107
1108 ; Retrieve capabilities
1109 Call CheckForCapabilities
1110
1111 ; Get user Name
1112 AccessControl::GetCurrentUserName
1113 Pop $g_strCurUser
1114 DetailPrint "Current user: $g_strCurUser"
1115
1116 ; Only extract files? This action can be called even from non-Admin users
1117 ; and non-compatible architectures
1118 ${If} $g_bOnlyExtract == "true"
1119 Call ExtractFiles
1120 MessageBox MB_OK|MB_ICONINFORMATION $(VBOX_EXTRACTION_COMPLETE) /SD IDOK
1121 Quit
1122 ${EndIf}
1123
1124 ; Check for correct architecture
1125 Call CheckArchitecture
1126 Pop $0
1127 ${If} $0 <> 0 ; Wrong architecture? Tell the world
1128!if $%BUILD_TARGET_ARCH% == "amd64"
1129 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_AMD64) /SD IDOK
1130!else
1131 MessageBox MB_ICONSTOP $(VBOX_NOTICE_ARCH_X86) /SD IDOK
1132!endif
1133 Abort
1134 ${EndIf}
1135
1136 ; Has the user who calls us admin rights?
1137 UserInfo::GetAccountType
1138 Pop $0
1139 ${If} $0 != "Admin"
1140 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1141 Abort
1142 ${EndIf}
1143
1144 ; Only uninstall?
1145 ${If} $g_bUninstall == "true"
1146 Call Uninstall_Innotek
1147 Call Uninstall
1148 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1149 Quit
1150 ${EndIf}
1151
1152 Call CheckForInstalledComponents
1153
1154 ; Set section bits
1155 ${If} $g_bWithAutoLogon == "true" ; Auto-logon support
1156 SectionSetFlags ${SEC02} ${SF_SELECTED}
1157 ${EndIf}
1158!if $%VBOX_WITH_CROGL% == "1"
1159 ${If} $g_bWithD3D == "true" ; D3D support
1160 SectionSetFlags ${SEC03} ${SF_SELECTED}
1161 ${EndIf}
1162!endif
1163
1164!ifdef USE_MUI
1165 ; Display language selection dialog (will be hidden in silent mode!)
1166 !ifdef VBOX_INSTALLER_ADD_LANGUAGES
1167 !insertmacro MUI_LANGDLL_DISPLAY
1168 !endif
1169!endif
1170
1171 Call SetAppMode64
1172
1173 ; Check for old additions
1174 Call CheckForOldGuestAdditions
1175 Call GetAdditionsVersion
1176
1177 ; Due to some bug in NSIS the license page won't be displayed if we're in
1178 ; 64-bit registry view, so as a workaround switch back to 32-bit (Wow6432Node)
1179 ; mode for now
1180 Call SetAppMode32
1181
1182!endif ; UNINSTALLER_ONLY
1183
1184FunctionEnd
1185
1186;
1187; The uninstaller is built separately when doing code signing
1188; For some reason NSIS still finds the Uninstall section even
1189; when EXTERNAL_UNINSTALLER is defined. This causes a silly warning
1190;
1191!ifndef EXTERNAL_UNINSTALLER
1192
1193Function un.onUninstSuccess
1194
1195 HideWindow
1196 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_UNINST_SUCCESS) /SD IDOK
1197
1198FunctionEnd
1199
1200Function un.onInit
1201
1202 ; Has the user who calls us admin rights?
1203 UserInfo::GetAccountType
1204 Pop $0
1205 ${If} $0 != "Admin"
1206 MessageBox MB_ICONSTOP $(VBOX_NOADMIN) /SD IDOK
1207 Abort
1208 ${EndIf}
1209
1210 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_UNINST_CONFIRM) /SD IDYES IDYES proceed
1211 Quit
1212
1213proceed:
1214
1215 Call un.SetAppMode64
1216
1217 ; Set system directory
1218 StrCpy $g_strSystemDir "$SYSDIR"
1219
1220 ; Retrieve Windows version we're running on and store it in $g_strWinVersion
1221 Call un.GetWindowsVer
1222
1223 ; Retrieve capabilities
1224 Call un.CheckForCapabilities
1225
1226FunctionEnd
1227
1228Section Uninstall
1229
1230!ifdef _DEBUG
1231 ; Enable logging
1232 Call un.EnableLog
1233!endif
1234
1235 Call un.SetAppMode64
1236
1237 ; Call the uninstall main function
1238 Call un.Uninstall
1239
1240 ; ... and remove the local install directory
1241 Call un.UninstallInstDir
1242
1243!ifndef _DEBUG
1244 SetAutoClose true
1245 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(VBOX_REBOOT_REQUIRED) /SD IDNO IDYES restart
1246 StrCmp $g_bRebootOnExit "true" restart
1247!endif
1248
1249 Goto exit
1250
1251restart:
1252
1253 DetailPrint "Rebooting ..."
1254 Reboot
1255
1256exit:
1257
1258SectionEnd
1259
1260; !EXTERNAL_UNINSTALLER
1261!endif
1262
1263;Direct the output to our bin dir
1264!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