VBoxGuestAdditionsCommon.nsh revision b6b95429f1ca0979fc22922200b242697b800cf8
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; VBoxGuestAdditionsCommon.nsh - Common / shared utility functions.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync; Copyright (C) 2006-2014 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.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncFunction Common_CopyFiles
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync SetOutPath "$INSTDIR"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync SetOverwrite on
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync!ifdef VBOX_WITH_LICENSE_INSTALL_RTF
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync ; Copy license file (if any) into the installation directory
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync FILE "/oname=${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync FILE "$%VBOX_PATH_DIFX%\DIFxAPI.dll"
930b5f872e89407f445d4000d4e4aaecaa6a0998vboxsync FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!ifdef VBOX_SIGN_ADDITIONS
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!ifndef UNINSTALLER_ONLY
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncFunction ExtractFiles
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync ; @todo: Use a define for all the file specs to group the files per module
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync ; and keep the redundancy low
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync StrCpy "$0" "$INSTDIR\$%BUILD_TARGET_ARCH%"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync ; Root files
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync SetOutPath "$0"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!if $%VBOX_WITH_LICENSE_INSTALL_RTF% == "1"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "/oname=${LICENSE_FILE_RTF}" "$%VBOX_BRAND_LICENSE_RTF%"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync ; Video driver
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync SetOutPath "$0\VBoxVideo"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxVideo.sys"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxVideo.inf"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!ifdef VBOX_SIGN_ADDITIONS
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxVideo.cat"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxDisp.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync!if $%VBOX_WITH_CROGL% == "1"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync SetOutPath "$0\VBoxVideo\OpenGL"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\d3d8.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\d3d9.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxD3D8.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\VBoxD3D9.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%PATH_OUT%\bin\additions\wined3d.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync !if $%BUILD_TARGET_ARCH% == "amd64"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync ; Only 64-bit installer: Also copy 32-bit DLLs on 64-bit target
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync SetOutPath "$0\VBoxVideo\OpenGL\SysWow64"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d8.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\d3d9.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLarrayspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLcrutil.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLerrorspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpackspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLpassthroughspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGLfeedbackspu.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxOGL.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D8.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\VBoxD3D9.dll"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync FILE "$%VBOX_PATH_ADDITIONS_WIN_X86%\wined3d.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.cat"
FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.sys"
FILE "$%PATH_OUT%\bin\additions\VBoxVideoWddm.inf"
FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
FILE "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
FILE "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.cat"
FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.sys"
FILE "$%PATH_OUT%\bin\additions\VBoxVideoW8.inf"
FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGL.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm.dll"
FILE "$%PATH_OUT%\bin\additions\wined3dwddm.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxDispD3D-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLarrayspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLcrutil-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLerrorspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpackspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLpassthroughspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGLfeedbackspu-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxOGL-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxD3D9wddm-x86.dll"
FILE "$%PATH_OUT%\bin\additions\wined3dwddm-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxMouse.sys"
FILE "$%PATH_OUT%\bin\additions\VBoxMouse.inf"
FILE "$%PATH_OUT%\bin\additions\VBoxMouse.cat"
FILE "$%PATH_OUT%\bin\additions\VBoxMouseNT.sys"
FILE "$%PATH_OUT%\bin\additions\VBoxGuest.sys"
FILE "$%PATH_OUT%\bin\additions\VBoxGuest.inf"
FILE "$%PATH_OUT%\bin\additions\VBoxGuest.cat"
FILE "$%PATH_OUT%\bin\additions\VBoxTray.exe"
FILE "$%PATH_OUT%\bin\additions\VBoxHook.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxControl.exe"
FILE "$%PATH_OUT%\bin\additions\VBoxGuestNT.sys"
FILE "$%PATH_OUT%\bin\additions\VBoxService.exe"
FILE "$%PATH_OUT%\bin\additions\VBoxServiceNT.exe"
FILE "$%PATH_OUT%\bin\additions\VBoxSF.sys"
FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxMRXNP-x86.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxGINA.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxCredProv.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxDrvInst.exe"
FILE "$%VBOX_PATH_DIFX%\DIFxAPI.dll"
FILE "$%PATH_OUT%\bin\additions\VBoxGuestDrvInst.exe"
FILE "$%PATH_OUT%\bin\additions\RegCleanup.exe"
; For other windows versions (> XP) it may be necessary to change winver.nsh
; Ok we know it is NT. Must be a string like NT X.XX
;; @todo NT <= 3.x ?
ReadRegStr $g_strAddVerRev HKLM "SOFTWARE\$%VBOX_VENDOR_SHORT%\VirtualBox Guest Additions" "Revision"
Pop $1 ; Got first part (e.g. "1.5")
Pop $g_strAddVerMin ; Extracted second part (e.g. "5" from "1.5")
nsExec::Exec '"$SYSDIR\net.exe" stop VBoxService'
nsExec::Exec '"$SYSDIR\SC.exe" stop VBoxService'
StrCpy $2 "VBoxServiceNT.exe"
StrCpy $2 "VBoxService.exe"
${nsProcess::FindProcess} "VBoxTray.exe" $0
${nsProcess::KillProcess} "VBoxTray.exe" $0
${nsProcess::FindProcess} "VBoxMMR.exe" $0
${nsProcess::KillProcess} "VBoxMMR.exe" $0
${If} ${FileExists} "$g_strSystemDir\shutdown.exe"
${CmdExecute} "$\"$g_strSystemDir\shutdown.exe$\" -a" "true"
${LogVerbose} "Shutting down not supported: Binary $\"$g_strSystemDir\shutdown.exe$\" not found"
; @return Stack: Company name, or "" on error/if not found.
; @param Un/Installer prefix; either "" or "un".
${LogVerbose} "Verification of file $\"${File}$\" successful (Vendor: ${Vendor}, Architecture: ${Architecture})"
${LogVerbose} "Verification of file $\"${File}$\" failed (not Vendor: ${Vendor}, and/or not Architecture: ${Architecture})"
; @param Un/Installer prefix; either "" or "un".
${LogVerbose} "Skipping to copy file $\"${FileSrc}$\" to $\"${FileDest}$\" (not Vendor: ${Vendor}, Architecture: ${Architecture})"
; Macro for installing a library/DLL.
; @param Un/Installer prefix; either "" or "un".
; @param Name of lib/DLL to copy to destination.
; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
; Macro for installing a library/DLL.
; @param Un/Installer prefix; either "" or "un".
; @param Name of lib/DLL to verify and copy to destination.
; @param Temporary folder used for exchanging the (locked) lib/DLL after a reboot.
${LogVerbose} "File $\"${FileSrc}$\" did not pass verification (Vendor: ${Vendor}, Architecture: ${Architecture})"
; Note: Not finding a file (like *d3d8.dll) on Windows Vista/7 is fine;
${VerifyFileEx} "${un}" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
${VerifyFileEx} "${un}" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
${VerifyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${VerifyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "Microsoft Corporation" "x86"
${VerifyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "Microsoft Corporation" "x86"
${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "Microsoft Corporation" "x86"
${VerifyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "Microsoft Corporation" "x86"
; Note: Not finding a file (like *d3d8.dll) on Windows Vista/7 is fine;
${PrepareWRPFileEx} "${un}" "$SYSDIR\d3d8.dll"
${CopyFileEx} "${un}" "$SYSDIR\msd3d8.dll" "$SYSDIR\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${PrepareWRPFileEx} "${un}" "$SYSDIR\d3d9.dll"
${CopyFileEx} "${un}" "$SYSDIR\msd3d9.dll" "$SYSDIR\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d8.dll"
${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d8.dll" "$SYSDIR\dllcache\d3d8.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${PrepareWRPFileEx} "${un}" "$SYSDIR\dllcache\d3d9.dll"
${CopyFileEx} "${un}" "$SYSDIR\dllcache\msd3d9.dll" "$SYSDIR\dllcache\d3d9.dll" "Microsoft Corporation" "$%BUILD_TARGET_ARCH%"
${PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d8.dll"
${CopyFileEx} "${un}" "$g_strSysWow64\msd3d8.dll" "$g_strSysWow64\d3d8.dll" "Microsoft Corporation" "x86"
${PrepareWRPFileEx} "${un}" "$g_strSysWow64\d3d9.dll"
${CopyFileEx} "${un}" "$g_strSysWow64\msd3d9.dll" "$g_strSysWow64\d3d9.dll" "Microsoft Corporation" "x86"
${PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d8.dll"
${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d8.dll" "$g_strSysWow64\dllcache\d3d8.dll" "Microsoft Corporation" "x86"
${PrepareWRPFileEx} "${un}" "$g_strSysWow64\dllcache\d3d9.dll"
${CopyFileEx} "${un}" "$g_strSysWow64\dllcache\msd3d9.dll" "$g_strSysWow64\dllcache\d3d9.dll" "Microsoft Corporation" "x86"
${If} ${FileExists} "$g_strSystemDir\takeown.exe"
${CmdExecute} "$\"$g_strSystemDir\takeown.exe$\" /F $\"$0$\"" "true"
${LogVerbose} "WRP: Warning: takeown.exe not found, skipping"