VirtualBox

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

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

Windows Guest Additions installer: Added "/ignore_unknownopts" command line switch.

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

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