VirtualBox

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

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

VBoxGINA: Use the Windows Notification Package to know when the screensaver stopped.

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