VirtualBox

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

最後變更 在這個檔案從95874是 95753,由 vboxsync 提交於 3 年 前

Windows Guest Additions installer: Added switches /[no_]install_timestamp_ca to (not) force installation of the timestamp CA. Note: When not specified explicitly, this does not change the default behaviour of only installing the CA only on guests < Windows 10. bugref:8691

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

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