VirtualBox

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

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

wddm: disable for guest installer

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette