VBoxGuestAdditions.nsi revision 22ecc39cb2e9aeb958d702b60fd677e8df0cdc70
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; VBoxGuestAdditions.nsi - Main file for Windows Guest Additions installation.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; Copyright (C) 2011 Oracle Corporation
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; available from http://www.virtualbox.org. This file is free software;
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; you can redistribute it and/or modify it under the terms of the GNU
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; General Public License (GPL) as published by the Free Software
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!if $%BUILD_TYPE% == "debug"
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync !define _DEBUG ; Turn this on to get extra output
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync!ifdef _DEBUG
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync ; Scratch directory for plugin tests
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync !addincludedir .\PluginTest
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync !addplugindir .\PluginTest
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; Defines for special functions
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define WHQL_FAKE ; Enables faking of non WHQL signed / approved drivers
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync ; Needs the VBoxWHQLFake.exe in the additions output directory!
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define WFP_FILE_EXCEPTION ; Enables setting a temporary file exception for WFP proctected files
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define VENDOR_ROOT_KEY "SOFTWARE\$%VBOX_VENDOR_SHORT%"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; Product defines
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_NAME "$%VBOX_PRODUCT% Guest Additions"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_DESC "$%VBOX_PRODUCT% Guest Additions"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_VERSION "$%VBOX_VERSION_MAJOR%.$%VBOX_VERSION_MINOR%.$%VBOX_VERSION_BUILD%.0"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_PUBLISHER "$%VBOX_VENDOR%"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_COPYRIGHT "(C) $%VBOX_C_YEAR% $%VBOX_VENDOR%"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_OUTPUT "VBoxWindowsAdditions-$%BUILD_TARGET_ARCH%.exe"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_WEB_SITE "http://www.virtualbox.org"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_INSTALL_KEY "${VENDOR_ROOT_KEY}\VirtualBox Guest Additions"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define PRODUCT_UNINST_ROOT_KEY "HKLM"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define LICENSE_FILE_RTF "license.rtf"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; Needed for InstallLib macro: Install libraries in every case
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define LIBRARY_IGNORE_VERSION
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIProductVersion "${PRODUCT_VERSION}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIAddVersionKey "FileVersion" "$%VBOX_VERSION_STRING%"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIAddVersionKey "ProductName" "${PRODUCT_NAME}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIAddVersionKey "FileDescription" "${PRODUCT_DESC}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIAddVersionKey "LegalCopyright" "${PRODUCT_COPYRIGHT}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncVIAddVersionKey "InternalName" "${PRODUCT_OUTPUT}"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; This registry key will hold the mouse driver path before install (NT4 only)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!define ORG_MOUSE_PATH "MousePath"
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!include "WordFunc.nsh"
!include "nsProcess.nsh"
!include "Library.nsh"
!include "strstr.nsh" ; Function "strstr"
!include "servicepack.nsh" ; Function "GetServicePack"
!include "winver.nsh" ; Function for determining Windows version
!include "ReplaceDLL.nsh"
!include "dumplog.nsh" ; Dump log to file function
!include "x64.nsh"
!include "MUI2.nsh"
!include "Languages\English.nsh"
!include "Languages\French.nsh"
!include "Languages\German.nsh"
OutFile "$%PATH_TARGET%\VBoxWindowsAdditions-$%BUILD_TARGET_ARCH%-uninst.exe"
Var g_iSystemMode ; Current system mode (0 = Normal boot, 1 = Fail-safe boot, 2 = Fail-safe with network boot)
Var g_bCapWDDM ; Capability: Is the guest able to handle/use our WDDM driver?
; Command line parameters - these can be set/modified
Var g_bFakeWHQL ; Cmd line: Fake Windows to install non WHQL certificated drivers (only for W2K and XP currently!!) ("/unsig_drv")
Var g_bRebootOnExit ; Cmd line: Auto-Reboot on successful installation. Good for unattended installations ("/reboot")
Var g_bNoVBoxServiceExit ; Cmd line: Do not quit VBoxService before updating - install on next reboot
Var g_bOnlyExtract ; Cmd line: Only extract all files, do *not* install them. Only valid with param "/D" (target directory)
Var g_bPostInstallStatus ; Cmd line: Post the overall installation status to some external program (VBoxTray)
!include "VBoxGuestAdditionsCommon.nsh"
!include "VBoxGuestAdditionsNT4.nsh"
!include "VBoxGuestAdditionsW2KXP.nsh"
!include "VBoxGuestAdditionsVista.nsh"
!include "VBoxGuestAdditionsUninstall.nsh" ; Product uninstallation
!include "VBoxGuestAdditionsUninstallOld.nsh" ; Uninstallation of deprecated versions which must be removed first
/force$\t$\tForce installation on unknown/undetected Windows versions$\r$\n \
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun VirtualBox Guest Additions" "UninstallString"
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sun xVM VirtualBox Guest Additions" "UninstallString"
StrCmp $0 "" innotek_check ; If string is empty, Sun xVM additions are probably not installed (anymore)
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\innotek VirtualBox Guest Additions" "UninstallString"
StrCmp $0 "" exit ; If string is empty, innotek Guest Additions are probably not installed (anymore)
${If} $0 == "VBoxGINA.dll"
FILE "$%VBOX_PATH_DIFX%\DIFxAPI.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
FILE "iexplore.ico"
DetailPrint "Previous version: $g_strAddVerMaj.$g_strAddVerMin.$g_strAddVerBuild (Rev $g_strAddVerRev)"
; Auto-logon support (section is hidden at the moment -- only can be enabled via command line switch)
; Another GINA already is installed? Check if this is ours, otherwise let the user decide (unless it's a silent setup)
${If} $0 != "VBoxGINA.dll"
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(VBOX_COMPONENT_AUTOLOGON_WARN_3RDPARTY) /SD IDYES IDYES install
!insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxCredProv.dll" "$g_strSystemDir\VBoxCredProv.dll" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (default) key
WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}" "" "VBoxCredProv" ; adding to (Default) key
WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "" "VBoxCredProv.dll" ; adding to (Default) key
WriteRegStr HKCR "CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32" "ThreadingModel" "Apartment"
!insertmacro ReplaceDLL "$%PATH_OUT%\bin\additions\VBoxGINA.dll" "$g_strSystemDir\VBoxGINA.dll" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon" "GinaDLL" "VBoxGINA.dll"
IfFileExists "$g_strSystemDir\takeown.exe" +1 +4
nsExec::ExecToLog '"$g_strSystemDir\takeown.exe" /F "$0"'
FILE "$%PATH_OUT%\bin\additions\libWine.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
IfFileExists "$g_strSystemDir\dllcache\msd3d8.dll" +2
IfFileExists "$g_strSystemDir\dllcache\msd3d9.dll" +2
Push "$g_strSystemDir\dllcache\d3d8.dll"
Push "$g_strSystemDir\dllcache\d3d9.dll"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\dllcache\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\dllcache\d3d9.dll" "$TEMP"
IfFileExists "$g_strSystemDir\msd3d8.dll" +2
IfFileExists "$g_strSystemDir\msd3d9.dll" +2
Push "$g_strSystemDir\d3d8.dll"
Push "$g_strSystemDir\d3d9.dll"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d8.dll" "$g_strSystemDir\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%PATH_OUT%\bin\additions\d3d9.dll" "$g_strSystemDir\d3d9.dll" "$TEMP"
FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\libWine.dll"
FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
IfFileExists "$g_strSysWow64\dllcache\msd3d8.dll" +2
IfFileExists "$g_strSysWow64\dllcache\msd3d9.dll" +2
Push "$g_strSysWow64\dllcache\d3d8.dll"
Push "$g_strSysWow64\dllcache\d3d9.dll"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "$TEMP"
IfFileExists "$g_strSysWow64\msd3d8.dll" +2
IfFileExists "$g_strSysWow64\msd3d9.dll" +2
Push "$g_strSysWow64\d3d8.dll"
Push "$g_strSysWow64\d3d9.dll"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\d3d9.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll" "$g_strSysWow64\d3d8.dll" "$TEMP"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll" "$g_strSysWow64\d3d9.dll" "$TEMP"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\iexplore.ico"
FILE "$%PATH_TARGET%\uninst.exe"
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
; If UNINSTALLER_ONLY is defined, we're only interested in uninst.exe
WriteUninstaller "$%PATH_TARGET%\uninst.exe"
Function un.onUninstSuccess
Function un.onInit
Call un.SetAppMode64
Call un.GetWindowsVer
Call un.EnableLog
Call un.SetAppMode64
Call un.Uninstall
Call un.UninstallInstDir