VirtualBox

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

最後變更 在這個檔案從107246是 107246,由 vboxsync 提交於 4 月 前

Windows Guest Additions installer: Use https:// for the link being created pointing to our website.

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

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