VirtualBox

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

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

s/VBOX_WITH_LICENSE/VBOX_WITH_LICENSE_DISPLAY

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