VirtualBox

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

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

Logging.

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