VirtualBox

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

最後變更 在這個檔案從35365是 35365,由 vboxsync 提交於 14 年 前

adds installer/win: wine d3d 64bit for xpdm

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

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