VirtualBox

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

Last change on this file since 32902 was 32683, checked in by vboxsync, 15 years ago

Windows Guest Additions installer: More WDDM cleanup.

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

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