VirtualBox

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

Last change on this file since 33282 was 33087, checked in by vboxsync, 14 years ago

Windows Guest Additions installer: Added switch for not shutting down VBoxService when installing, ignore unknown command line parameters in silent mode.

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