[Pkg-virtualbox-commits] [virtualbox] 10/14: Imported Upstream version 4.3.12-dfsg

Ritesh Raj Sarraf rrs at moszumanska.debian.org
Wed Jun 4 14:25:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

rrs pushed a commit to branch master
in repository virtualbox.

commit 0e889e360849c66ea7848576cafa15641c068619
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date:   Tue May 27 14:31:38 2014 +0200

    Imported Upstream version 4.3.12-dfsg
---
 Config.kmk                                         |    9 +-
 Makefile.kmk                                       |   13 +
 doc/manual/en_US/user_AdvancedTopics.xml           |   56 +-
 doc/manual/en_US/user_BasicConcepts.xml            |   12 +
 doc/manual/en_US/user_Frontends.xml                |    4 +-
 doc/manual/en_US/user_GuestAdditions.xml           |    3 +-
 doc/manual/en_US/user_KnownIssues.xml              |    5 +
 doc/manual/en_US/user_Storage.xml                  |    6 +-
 doc/manual/user_ChangeLogImpl.xml                  |  131 +++
 include/VBox/VBoxCrHgsmi.h                         |    1 +
 include/VBox/shflsvc.h                             |   56 +-
 include/VBox/vmm/hm_vmx.h                          |    2 +-
 include/iprt/mangling.h                            |    3 +
 include/iprt/string.h                              |   39 +-
 src/VBox/Additions/common/VBoxGuest/Makefile.kmk   |    1 -
 .../Additions/common/VBoxGuest/VBoxGuest-win.cpp   |   99 +-
 src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp  |   49 +-
 .../Additions/common/VBoxGuest/VBoxGuestInternal.h |    3 -
 .../VBoxService/VBoxServiceControlProcess.cpp      |    2 +
 src/VBox/Additions/common/crOpenGL/Makefile.kmk    |    4 +-
 .../Additions/common/crOpenGL/getprocaddress.py    |    3 +-
 src/VBox/Additions/common/crOpenGL/load.c          |    8 +-
 src/VBox/Additions/common/crOpenGL/pack/packspu.h  |    2 +
 .../Additions/common/crOpenGL/pack/packspu_get.py  |    2 +-
 .../Additions/common/crOpenGL/pack/packspu_glsl.c  |   76 +-
 .../Additions/common/crOpenGL/pack/packspu_net.c   |    6 +
 .../Additions/common/crOpenGL/pack/packspu_special |    2 +
 .../common/crOpenGL/windows_getprocaddress.py      |    3 +-
 src/VBox/Additions/linux/Makefile.kmk              |   10 +-
 src/VBox/Additions/linux/installer/vboxadd.sh      |   18 +-
 src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd      |  Bin 1048576 -> 1048576 bytes
 src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd      |  Bin 1048576 -> 1048576 bytes
 .../Graphics/BIOS/VBoxVgaBiosAlternative.asm       |    6 +-
 .../Graphics/BIOS/VBoxVgaBiosAlternative.md5sum    |    2 +-
 src/VBox/Devices/Graphics/DevVGA.cpp               |    5 +-
 src/VBox/Devices/Graphics/DevVGA.h                 |    5 +-
 src/VBox/Devices/Graphics/DevVGA_VBVA.cpp          |   62 +-
 src/VBox/Devices/Graphics/DevVGA_VDMA.cpp          |  125 +--
 src/VBox/Devices/Network/slirp/bootp.c             |   14 +-
 src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c |    5 +-
 src/VBox/Devices/Network/slirp/ip_icmp.c           |  168 ++-
 src/VBox/Devices/Network/slirp/libalias/alias_db.c |    9 +-
 .../Devices/Network/slirp/resolv_conf_parser.h     |    2 +-
 src/VBox/Devices/Network/slirp/slirp.c             |    2 +-
 src/VBox/Devices/Network/slirp/slirp.h             |    2 +
 src/VBox/Devices/Network/slirp/socket.c            |    3 +
 src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm   |    4 +-
 .../Devices/PC/BIOS/VBoxBiosAlternative.md5sum     |    2 +-
 src/VBox/Devices/Storage/DevAHCI.cpp               |   27 +-
 src/VBox/Devices/VMMDev/VMMDev.cpp                 |    2 +
 src/VBox/Devices/VMMDev/VMMDevHGCM.cpp             |   43 +-
 src/VBox/Devices/VMMDev/VMMDevHGCM.h               |    2 +
 src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp             |   22 +-
 src/VBox/Frontends/VirtualBox/Makefile.kmk         |    1 +
 .../VirtualBox/src/converter/UIConverterBackend.h  |    6 +
 .../src/converter/UIConverterBackendGlobal.cpp     |   68 ++
 .../Frontends/VirtualBox/src/globals/UIDefs.cpp    |    6 +
 src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h |   21 +
 .../VirtualBox/src/globals/VBoxGlobal.cpp          |   37 +-
 .../Frontends/VirtualBox/src/globals/VBoxGlobal.h  |   10 +
 .../Frontends/VirtualBox/src/medium/UIMedium.cpp   |   19 +
 .../Frontends/VirtualBox/src/medium/UIMedium.h     |    3 +
 .../VirtualBox/src/medium/UIMediumManager.cpp      |   23 +-
 .../VirtualBox/src/medium/UIMediumManager.h        |    3 -
 .../VirtualBox/src/net/UIUpdateManager.cpp         |  113 +-
 .../src/platform/darwin/UICocoaApplication.mm      |   12 +-
 .../src/platform/darwin/VBoxUtils-darwin-cocoa.mm  |   30 +-
 .../src/platform/darwin/VBoxUtils-darwin.cpp       |    5 +
 .../src/platform/darwin/VBoxUtils-darwin.h         |    4 +
 .../VirtualBox/src/runtime/UIFrameBuffer.cpp       |   22 +
 .../VirtualBox/src/runtime/UIFrameBuffer.h         |   16 +
 .../VirtualBox/src/runtime/UIFrameBufferQImage.cpp |  110 +-
 .../VirtualBox/src/runtime/UIFrameBufferQImage.h   |   10 +-
 .../VirtualBox/src/runtime/UIMachineLogic.cpp      |   26 +-
 .../VirtualBox/src/runtime/UIMachineView.cpp       |   10 +
 .../VirtualBox/src/runtime/UIMachineWindow.cpp     |   16 +-
 .../VirtualBox/src/runtime/UIMouseHandler.cpp      |    4 +-
 .../Frontends/VirtualBox/src/runtime/UISession.cpp |   34 +-
 .../Frontends/VirtualBox/src/runtime/UISession.h   |   46 +-
 .../fullscreen/UIMachineLogicFullscreen.cpp        |  158 ++-
 .../runtime/fullscreen/UIMachineLogicFullscreen.h  |    9 +-
 .../fullscreen/UIMachineWindowFullscreen.cpp       |   14 +-
 .../runtime/fullscreen/UIMachineWindowFullscreen.h |    2 +
 .../src/runtime/normal/UIMachineLogicNormal.cpp    |    3 +-
 .../runtime/seamless/UIMachineLogicSeamless.cpp    |    3 +-
 .../runtime/seamless/UIMachineWindowSeamless.cpp   |    2 -
 .../graphics/details/UIGMachinePreview.cpp         |   22 +-
 .../selector/graphics/details/UIGMachinePreview.h  |    1 +
 .../VirtualBox/src/widgets/UIMiniToolBar.cpp       |   18 +-
 .../VirtualBox/src/widgets/VBoxMediaComboBox.cpp   |    5 +
 src/VBox/GuestHost/OpenGL/Makefile.kmk             |    6 +
 src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt |   12 +
 src/VBox/GuestHost/OpenGL/include/cr_net.h         |    5 +
 src/VBox/GuestHost/OpenGL/include/cr_protocol.h    |   21 +-
 src/VBox/GuestHost/OpenGL/include/state/cr_glsl.h  |    6 +
 src/VBox/GuestHost/OpenGL/packer/pack_shaders.c    |   16 +
 src/VBox/GuestHost/OpenGL/packer/packer_special    |    1 +
 .../GuestHost/OpenGL/state_tracker/state_glsl.c    |  289 ++++-
 .../GuestHost/OpenGL/state_tracker/state_special   |    1 +
 src/VBox/GuestHost/OpenGL/util/net.c               |   12 +
 src/VBox/GuestHost/OpenGL/util/net_internals.h     |    3 +
 src/VBox/GuestHost/OpenGL/util/vboxhgcm.c          |  132 ++-
 .../HostDrivers/Support/darwin/SUPDrv-darwin.cpp   |   23 +-
 .../HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp  |   36 +-
 src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp    |    2 +-
 src/VBox/HostDrivers/darwin/VBoxNetSend.h          |    9 -
 src/VBox/HostServices/SharedClipboard/service.cpp  |   24 +-
 src/VBox/HostServices/SharedFolders/mappings.cpp   |   11 +-
 src/VBox/HostServices/SharedFolders/service.cpp    |   59 +-
 src/VBox/HostServices/SharedFolders/vbsf.cpp       |  753 +++++++------
 .../SharedOpenGL/crserverlib/server_config.c       |   19 +-
 .../SharedOpenGL/crserverlib/server_getshaders.c   |   23 +
 .../SharedOpenGL/crserverlib/server_special        |    1 +
 .../HostServices/SharedOpenGL/unpacker/unpack.py   |   12 +-
 .../SharedOpenGL/unpacker/unpack_shaders.c         |   10 +
 .../SharedOpenGL/unpacker/unpacker_special         |    1 +
 .../darwin/VirtualBox_mpkg/distribution.dist       |   11 +-
 src/VBox/Installer/linux/run-inst.sh               |    1 +
 .../win/InstallHelper/VBoxInstallHelper.cpp        |   31 +-
 src/VBox/Installer/win/Makefile.kmk                |  235 +++-
 src/VBox/Installer/win/NLS/de_DE.wxl               |    4 +-
 src/VBox/Installer/win/NLS/en_US.wxl               |    4 +-
 src/VBox/Installer/win/NLS/fa_IR.wxl               |   11 +-
 src/VBox/Installer/win/NLS/fr_FR.wxl               |    4 +-
 src/VBox/Installer/win/NLS/it_IT.wxl               |   11 +-
 src/VBox/Installer/win/NLS/tr_TR.wxl               |  112 +-
 src/VBox/Installer/win/NLS/zh_TW.wxl               |   12 +-
 src/VBox/Installer/win/Properties.wxi              |   60 +
 src/VBox/Installer/win/Stub/VBoxStub.cpp           |  263 +++--
 src/VBox/Installer/win/UserInterface.wxi           |   25 +-
 src/VBox/Installer/win/VBoxMergeApp.wxi            |  346 ++++++
 src/VBox/Installer/win/VBoxMergeApp.wxs            |   69 ++
 src/VBox/Installer/win/VBoxMergeAppCA.wxi          |   19 +
 src/VBox/Installer/win/VBoxMergeAppSeq.wxi         |   19 +
 src/VBox/Installer/win/VBoxMergeCOM32On64.wxi      |   55 +
 src/VBox/Installer/win/VBoxMergeCOM32On64.wxs      |   46 +
 src/VBox/Installer/win/VBoxMergeCOM32On64CA.wxi    |   19 +
 src/VBox/Installer/win/VBoxMergeCOM32On64Seq.wxi   |   19 +
 src/VBox/Installer/win/VBoxMergeNetAdp.wxi         |   29 +
 src/VBox/Installer/win/VBoxMergeNetAdp.wxs         |   54 +
 src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi       |   26 +
 src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi      |   44 +
 src/VBox/Installer/win/VBoxMergeNetFlt.wxi         |   35 +
 src/VBox/Installer/win/VBoxMergeNetFlt.wxs         |   54 +
 src/VBox/Installer/win/VBoxMergeNetFltCA.wxi       |   33 +
 src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi      |   78 ++
 src/VBox/Installer/win/VBoxMergePython.wxi         |   41 +
 src/VBox/Installer/win/VBoxMergePython.wxs         |   54 +
 src/VBox/Installer/win/VBoxMergePythonCA.wxi       |   22 +
 src/VBox/Installer/win/VBoxMergePythonSeq.wxi      |   34 +
 src/VBox/Installer/win/VBoxMergeUSB.wxi            |   49 +
 src/VBox/Installer/win/VBoxMergeUSB.wxs            |   46 +
 src/VBox/Installer/win/VBoxMergeUSBCA.wxi          |   19 +
 src/VBox/Installer/win/VBoxMergeUSBSeq.wxi         |   19 +
 src/VBox/Installer/win/VirtualBox.wxs              | 1184 +++++++-------------
 src/VBox/Main/Makefile.kmk                         |    3 +-
 src/VBox/Main/cbinding/Makefile.kmk                |    3 +-
 src/VBox/Main/cbinding/VBoxCAPI.cpp                |  142 ++-
 src/VBox/Main/cbinding/capiidl.xsl                 |   34 +-
 src/VBox/Main/cbinding/tstCAPIGlue.c               |   31 +-
 src/VBox/Main/include/ConsoleImpl.h                |   49 +-
 src/VBox/Main/include/DisplayImpl.h                |   11 +-
 src/VBox/Main/src-all/win/comregister.cmd          |   12 +-
 src/VBox/Main/src-client/DisplayImpl.cpp           |   14 +-
 src/VBox/Main/src-server/MachineImpl.cpp           |    2 +-
 src/VBox/Main/src-server/darwin/iokit.cpp          |   22 +-
 src/VBox/Main/src-server/linux/USBGetDevices.cpp   |    4 +-
 src/VBox/Main/src-server/win/HostPowerWin.cpp      |   19 +-
 src/VBox/Main/src-server/win/svcmain.cpp           |    4 +-
 src/VBox/NetworkServices/NAT/proxy.c               |    4 +-
 src/VBox/Runtime/Makefile.kmk                      |   10 +-
 src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm  |    4 +-
 src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm   |    4 +-
 src/VBox/Runtime/common/log/log.cpp                |   54 +-
 src/VBox/Runtime/common/string/utf-16.cpp          |  109 ++
 src/VBox/Runtime/common/string/utf-8.cpp           |   18 +-
 .../Runtime/r3/posix/process-creation-posix.cpp    |   17 +-
 .../Runtime/r3/win/RTSystemQueryOSInfo-win.cpp     |    9 +-
 src/VBox/Runtime/r3/win/init-win.cpp               |   74 +-
 src/VBox/Runtime/r3/win/internal-r3-win.h          |   10 +-
 src/VBox/Storage/VHD.cpp                           |   17 +-
 src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp                |    8 +
 src/VBox/VMM/VMMAll/IEMAll.cpp                     |    2 +-
 .../VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h   |   40 +
 184 files changed, 5206 insertions(+), 2240 deletions(-)

diff --git a/Config.kmk b/Config.kmk
index e2260a9..5cae164 100644
--- a/Config.kmk
+++ b/Config.kmk
@@ -206,7 +206,7 @@ VBOX_VERSION_MINOR = 3
 # This is the current build number. It should be increased every time we publish a
 # new build. The define is available in every source file. Only even build numbers
 # will be published, odd numbers are set during development.
-VBOX_VERSION_BUILD = 10
+VBOX_VERSION_BUILD = 12
 # The raw version string. This *must not* contain any other information/fields than
 # major, minor and build revision (as it is now) -- also will be used for host/guest version
 # comparison.
@@ -539,6 +539,8 @@ VBOX_WITH_QTGUI = 1
 ifeq ($(KBUILD_TARGET),darwin)
  VBOX_WITH_COCOA_QT = 1
 endif
+# HiDPI support for OS X
+VBOX_GUI_WITH_HIDPI = 1
 # The SDL based GUI.
 VBOX_WITH_VBOXSDL = 1
 # Build VBoxSDL with secure label support.
@@ -1054,6 +1056,7 @@ ifdef VBOX_OSE
  if1of ($(KBUILD_TARGET), win)
   VBOX_WITH_VPX=
  endif
+ VBOX_GUI_WITH_HIDPI=
  # branding
  VBOX_BRAND_LICENSE_HTML       := $(PATH_ROOT)/doc/License-gpl-2.0.html
  VBOX_BRAND_LICENSE_RTF        := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
@@ -4626,8 +4629,6 @@ ifdef VBOX_WITH_QTGUI
 
   TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
 
-  TEMPLATE_VBOXQT4GUIEXE_INCS += \
-	$(LIB_SDL_INC)
   ## @todo Use VBOX_GCC_PEDANTIC_CXX?
   TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
 	-g $(VBOX_GCC_pipe) $(filter-out -Wno-unused,$(VBOX_GCC_WARN)) -frtti -fno-exceptions -Wno-non-virtual-dtor \
@@ -5528,7 +5529,7 @@ endif
 SVN                    ?= svn$(HOSTSUFF_EXE)
 VBOX_SVN_REV_KMK        = $(PATH_OUT)/revision.kmk
 ifndef VBOX_SVN_REV
- VBOX_SVN_REV_FALLBACK := $(patsubst %:,,  $Rev: 93012 $  )
+ VBOX_SVN_REV_FALLBACK := $(patsubst %:,,  $Rev: 93733 $  )
  VBOX_SVN_DEP          := $(firstword $(wildcard $(PATH_ROOT)/.svn/wc.db $(abspath $(PATH_ROOT)/../.svn/wc.db) $(abspath $(PATH_ROOT)/../../.svn/wc.db) $(PATH_ROOT)/.svn/entries))
  ifeq ($(which $(SVN)),)
   VBOX_SVN_DEP         :=
diff --git a/Makefile.kmk b/Makefile.kmk
index d571d54..f0457c6 100644
--- a/Makefile.kmk
+++ b/Makefile.kmk
@@ -113,11 +113,24 @@ ifeq ($(KBUILD_TARGET).$(VBOX_WITHOUT_COMPILER_REDIST),win.)
   	$(VBOX_PATH_VCC_REDIST_CRT)/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll \
   	$(VBOX_PATH_VCC_REDIST_CRT)/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>testcase/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll \
   	$(VBOX_PATH_VCC_REDIST_CRT)/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>testcase/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+  VBOX_PATH_VCC_REDIST_CRT_X86 = $(VBOX_PATH_VCC_REDIST)/x86/Microsoft.VC100.CRT
+  VBOX_PATH_VCC_REDIST_CRT_DBG_X86 = $(VBOX_PATH_VCC_REDIST)/Debug_NonRedist/x86/Microsoft.VC100.DebugCRT
+  InstallExternalLibs_SOURCES += \
+  	$(VBOX_PATH_VCC_REDIST_CRT_X86)/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>x86/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll \
+  	$(VBOX_PATH_VCC_REDIST_CRT_X86)/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>x86/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll
+ endif
  ifeq ($(VBOX_VCC_CRT_TYPE),d)
+  InstallExternalLibs_SOURCES += \
   	$(VBOX_PATH_VCC_REDIST_CRT_DBG)/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll \
   	$(VBOX_PATH_VCC_REDIST_CRT_DBG)/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll \
   	$(VBOX_PATH_VCC_REDIST_CRT_DBG)/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>testcase/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll \
   	$(VBOX_PATH_VCC_REDIST_CRT_DBG)/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>testcase/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll
+  ifdef VBOX_WITH_32_ON_64_MAIN_API
+  InstallExternalLibs_SOURCES += \
+  	$(VBOX_PATH_VCC_REDIST_CRT_DBG_X86)/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>x86/msvcr$(substr $(VBOX_VCC_TOOL_STEM),4).dll \
+  	$(VBOX_PATH_VCC_REDIST_CRT_DBG_X86)/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll=>x86/msvcp$(substr $(VBOX_VCC_TOOL_STEM),4).dll
+  endif
  endif
 endif
 
diff --git a/doc/manual/en_US/user_AdvancedTopics.xml b/doc/manual/en_US/user_AdvancedTopics.xml
index ed2a45e..2fc651d 100644
--- a/doc/manual/en_US/user_AdvancedTopics.xml
+++ b/doc/manual/en_US/user_AdvancedTopics.xml
@@ -1666,7 +1666,6 @@ VBoxManage setextradata "VM name"
       <para><glosslist>
           <glossentry>
             <glossterm><computeroutput>--timesync-interval</computeroutput></glossterm>
-
             <glossdef>
               <para>Specifies the interval at which to synchronize the time
               with the host. The default is 10000 ms (10 seconds).</para>
@@ -1675,17 +1674,14 @@ VBoxManage setextradata "VM name"
 
           <glossentry>
             <glossterm><computeroutput>--timesync-min-adjust</computeroutput></glossterm>
-
             <glossdef>
               <para>The minimum absolute drift value measured in milliseconds
               to make adjustments for. The default is 1000 ms on OS/2 and 100
               ms elsewhere.</para>
             </glossdef>
           </glossentry>
-
           <glossentry>
             <glossterm><computeroutput>--timesync-latency-factor</computeroutput></glossterm>
-
             <glossdef>
               <para>The factor to multiply the time query latency with to
               calculate the dynamic minimum adjust time. The default is 8
@@ -1700,7 +1696,6 @@ VBoxManage setextradata "VM name"
 
           <glossentry>
             <glossterm><computeroutput>--timesync-max-latency</computeroutput></glossterm>
-
             <glossdef>
               <para>The max host timer query latency to accept. The default is
               250 ms.</para>
@@ -1709,7 +1704,6 @@ VBoxManage setextradata "VM name"
 
           <glossentry>
             <glossterm><computeroutput>--timesync-set-threshold</computeroutput></glossterm>
-
             <glossdef>
               <para>The absolute drift threshold, given as milliseconds where
               to start setting the time instead of trying to smoothly adjust
@@ -1719,7 +1713,6 @@ VBoxManage setextradata "VM name"
 
           <glossentry>
             <glossterm><computeroutput>--timesync-set-start</computeroutput></glossterm>
-
             <glossdef>
               <para>Set the time when starting the time sync service.</para>
             </glossdef>
@@ -1728,7 +1721,6 @@ VBoxManage setextradata "VM name"
           <glossentry>
             <glossterm><computeroutput>--timesync-set-on-restore
             0|1</computeroutput></glossterm>
-
             <glossdef>
               <para>Set the time after the VM was restored from a saved state
               when passing 1 as parameter (default). Disable by passing 0. In
@@ -1936,7 +1928,6 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
       following keywords:<glosslist>
           <glossentry>
             <glossterm><computeroutput>noSelector</computeroutput></glossterm>
-
             <glossdef>
               <para>Don't allow to start the VirtualBox manager. Trying to do so
               will show a window containing a proper error message.</para>
@@ -1945,7 +1936,6 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
 
           <glossentry>
             <glossterm><computeroutput>noMenuBar</computeroutput></glossterm>
-
             <glossdef>
               <para>VM windows will not contain a menu bar.</para>
             </glossdef>
@@ -1953,7 +1943,6 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
 
           <glossentry>
             <glossterm><computeroutput>noStatusBar</computeroutput></glossterm>
-
             <glossdef>
               <para>VM windows will not contain a status bar.</para>
             </glossdef>
@@ -2781,7 +2770,6 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
           following keywords:</para><glosslist>
           <glossentry>
             <glossterm><computeroutput>SaveState</computeroutput></glossterm>
-
             <glossdef>
               <para>Don't allow the user to save the VM state when terminating
               the VM.</para>
@@ -2790,7 +2778,6 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
 
           <glossentry>
             <glossterm><computeroutput>Shutdown</computeroutput></glossterm>
-
             <glossdef>
               <para>Don't allow the user to shutdown the VM by sending the ACPI
               power-off event to the guest.</para>
@@ -2799,7 +2786,6 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
 
           <glossentry>
             <glossterm><computeroutput>PowerOff</computeroutput></glossterm>
-
             <glossdef>
               <para>Don't allow the user to power off the VM.</para>
             </glossdef>
@@ -2807,7 +2793,6 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
 
           <glossentry>
             <glossterm><computeroutput>PowerOffRestoringSnapshot</computeroutput></glossterm>
-
             <glossdef>
               <para>Don't allow the user to return to the last snapshot when
                 powering off the VM.</para>
@@ -2817,6 +2802,47 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
 
         <para>This is a per-VM setting. Any combination of the above is allowed. If all
           options are specified, the VM cannot be shut down at all.</para>
+      </sect2>
+
+      <sect2>
+        <title>Action for handling a Guru Meditation</title>
+
+        <para>A VM runs into a Guru Meditation if there is a problem which
+          cannot be fixed by other means than terminating the process. The
+          default is to show a message window which instructs the user to
+          open a bug report.</para>
+        <para>This behavior can be configured:</para>
+          
+        <para><screen>VBoxManage setextradata "VM name" GUI/GuruMeditationHandler MODE</screen></para>
+
+        <para>where <computeroutput>MODE</computeroutput> is one of the
+          following keywords:</para><glosslist>
+          <glossentry>
+            <glossterm><computeroutput>Default</computeroutput></glossterm>
+            <glossdef>
+              <para>A message window is shown. After the user confirmed, the
+                VM is terminated.</para>
+            </glossdef>
+          </glossentry>
+
+          <glossentry>
+            <glossterm><computeroutput>PowerOff</computeroutput></glossterm>
+            <glossdef>
+              <para>The VM is immediately powered-off without showing any message
+                window. The VM logfile will show information about what happend.</para>
+            </glossdef>
+          </glossentry>
+
+          <glossentry>
+            <glossterm><computeroutput>Ignore</computeroutput></glossterm>
+            <glossdef>
+              <para>The VM is left in stuck mode. Execution is stopped but no
+              message window is shown. The VM has to be powered off manually.</para>
+            </glossdef>
+          </glossentry>
+        </glosslist>
+
+        <para>This is a per-VM setting.</para>
     </sect2>
   </sect1>
 
diff --git a/doc/manual/en_US/user_BasicConcepts.xml b/doc/manual/en_US/user_BasicConcepts.xml
index d6afb21..2905351 100644
--- a/doc/manual/en_US/user_BasicConcepts.xml
+++ b/doc/manual/en_US/user_BasicConcepts.xml
@@ -1379,5 +1379,17 @@ VBoxManage setextradata "VM name" VBoxInternal2/UgaVerticalResolution    900</sc
       <para>The video mode for both GOP and UGA can only be changed when the
       VM is powered off and remains persistent until changed.</para>
     </sect2>
+
+    <sect2 id="efibootargs">
+      <title>Specifying boot arguments</title>
+
+      <para>It is currently not possible to manipulate EFI variables from within a running guest
+      (e.g., setting the "boot-args" variable by running the <computeroutput>nvram</computeroutput> tool in a Mac OS X guest will not work).
+      As an alternative way, "VBoxInternal2/EfiBootArgs" extradata can be passed to a VM in order to set
+      the "boot-args" variable. To change the "boot-args" EFI variable:
+      <screen>VBoxManage setextradata "VM name" VBoxInternal2/EfiBootArgs <value></screen>
+      </para>
+    </sect2>
+
   </sect1>
 </chapter>
diff --git a/doc/manual/en_US/user_Frontends.xml b/doc/manual/en_US/user_Frontends.xml
index 118d280..d98fa5b 100644
--- a/doc/manual/en_US/user_Frontends.xml
+++ b/doc/manual/en_US/user_Frontends.xml
@@ -449,7 +449,7 @@
 
                       <listitem>
                         <para>To enable the library for a particular VM, you
-                        must then switch authentication to external:<screen>VBoxManage modifyvm <vm> --vrdeauthtype external</screen></para>
+                        must then switch authentication to external:<screen>VBoxManage modifyvm "VM name" --vrdeauthtype external</screen></para>
 
                         <para>Replace
                         <computeroutput><vm></computeroutput> with the
@@ -463,7 +463,7 @@
                         whose "extradata" section the password needs to be
                         written, is a plain text file, VirtualBox uses hashes
                         to encrypt passwords. The following command must be
-                        used:<screen>VBoxManage setextradata <vm> "VBoxAuthSimple/users/<user>" <hash></screen></para>
+                        used:<screen>VBoxManage setextradata "VM name" "VBoxAuthSimple/users/<user>" <hash></screen></para>
 
                         <para>Replace
                         <computeroutput><vm></computeroutput> with the
diff --git a/doc/manual/en_US/user_GuestAdditions.xml b/doc/manual/en_US/user_GuestAdditions.xml
index 740ee74..73fc1c1 100644
--- a/doc/manual/en_US/user_GuestAdditions.xml
+++ b/doc/manual/en_US/user_GuestAdditions.xml
@@ -1541,8 +1541,7 @@ Name: /VirtualBox/GuestInfo/OS/LoggedInUsersList, value: username,
     timestamp: 1229099826317386000, flags:</screen></para>
 
     <para>To query the value of a single property, use the "get" subcommand
-    like this:<screen>$ VBoxManage guestproperty get "Windows Vista III"
-         "/VirtualBox/GuestInfo/OS/Product"
+    like this:<screen>$ VBoxManage guestproperty get "Windows Vista III" "/VirtualBox/GuestInfo/OS/Product"
 VirtualBox Command Line Management Interface Version $VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD
 (C) 2005-$VBOX_C_YEAR $VBOX_VENDOR
 All rights reserved.
diff --git a/doc/manual/en_US/user_KnownIssues.xml b/doc/manual/en_US/user_KnownIssues.xml
index 9953de7..6a774b6 100644
--- a/doc/manual/en_US/user_KnownIssues.xml
+++ b/doc/manual/en_US/user_KnownIssues.xml
@@ -232,6 +232,11 @@
                 messages by issuing this command:<screen>VBoxManage setextradata "VM name" "VBoxInternal2/EfiBootArgs" "  "</screen>To
                 revert to the previous behavior, use:<screen>VBoxManage setextradata "VM name" "VBoxInternal2/EfiBootArgs" ""</screen></para>
               </listitem>
+
+              <listitem>
+                <para>It is currently not possible to start a Mac OS X guest in safe mode by specifying "-x" option
+                in "VBoxInternal2/EfiBootArgs" extradata.</para>
+              </listitem>
             </itemizedlist></para>
         </listitem>
     
diff --git a/doc/manual/en_US/user_Storage.xml b/doc/manual/en_US/user_Storage.xml
index b25e5e8..f790843 100644
--- a/doc/manual/en_US/user_Storage.xml
+++ b/doc/manual/en_US/user_Storage.xml
@@ -774,7 +774,7 @@
     I/O cache is used for each I/O controller separately. Either uncheck the
     "Use host I/O cache" box in the "Storage" settings for a given virtual
     storage controller, or use the following VBoxManage command to disable the
-    host I/O cache for a virtual storage controller:<screen>VBoxManage storagectl <vm> --name <controllername> --hostiocache off</screen></para>
+    host I/O cache for a virtual storage controller:<screen>VBoxManage storagectl "VM name" --name <controllername> --hostiocache off</screen></para>
 
     <para>See <xref linkend="vboxmanage-storagectl" /> for details.</para>
 
@@ -794,9 +794,9 @@
     <computeroutput>VBoxManage</computeroutput>. The example below creates a
     bandwidth group named "Limit", sets the limit to 20 MB/s and assigns the
     group to the attached disks of the VM:<screen>VBoxManage bandwidthctl "VM name" add Limit --type disk --limit 20M
-VBoxManage storageattach "VM name" --controller "SATA" --port 0 --device 0 --type hdd
+VBoxManage storageattach "VM name" --storagectl "SATA" --port 0 --device 0 --type hdd
                                    --medium disk1.vdi --bandwidthgroup Limit
-VBoxManage storageattach "VM name" --controller "SATA" --port 1 --device 0 --type hdd
+VBoxManage storageattach "VM name" --storagectl "SATA" --port 1 --device 0 --type hdd
                                    --medium disk2.vdi --bandwidthgroup Limit</screen></para>
 
     <para>All disks in a group share the bandwidth limit, meaning that in the
diff --git a/doc/manual/user_ChangeLogImpl.xml b/doc/manual/user_ChangeLogImpl.xml
index 8c93805..9695cf5 100644
--- a/doc/manual/user_ChangeLogImpl.xml
+++ b/doc/manual/user_ChangeLogImpl.xml
@@ -1,6 +1,137 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
   <sect1>
+    <title>Version 4.3.12 (2014-05-16)</title>
+
+    <para>This is a maintenance release. The following items were fixed and/or
+      added:</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>VMM: fixed an occasional Guru Meditation (Mac OS X hosts only;
+          bugs #12727, #12954)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM: fixed a rare condition that would fail to invalidate guest TLB
+          entries or would invalidate them when not required (Windows hosts only)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM: fixed a <emphasis>VERR_NOT_SUPPORTED</emphasis> Guru Meditation
+          seen with certain guests, e.g. OpenServer 5.0.7</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM: more fixes for MSR emulation on certain hardware (tickets #12240,
+          #12875)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI: fixed mouse positioning with mouse integration disabled and
+          multiple guest screens (Windows hosts only; bug #9059)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI: fixed crash in VM manager (bug #12878)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI: fixed crash under rare conditions on entering/exiting
+          fullscreen/seamless mode</para>
+      </listitem>
+
+      <listitem>
+        <para>Shared Clipboard: don't stop working after taking a snapshot
+          (bug #12700)</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI: fixed a crash under rare circumstances</para>
+      </listitem>
+
+      <listitem>
+        <para>API: fixed a hang during VM shutdown under rare conditions</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT: fixed generation of malformed ICMP error datagrams (4.3.10 regression)</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT: fixed potential crash in DNS proxy</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT Network: don't drop port forwarding rules after some time</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT: fixed ARP cache corruption and network loss in Windows guest caused
+          by iSCSI service activity</para>
+      </listitem>
+
+      <listitem>
+        <para>USB: improved check if a storage device is currently mounted to the host
+          when the device is about to be attached to the VM (Mac OS X hosts only; #11038)</para>
+      </listitem>
+
+      <listitem>
+        <para>3D support: several fixes, including better support for Ubuntu 14.04</para>
+      </listitem>
+
+      <listitem>
+        <para>VRDP: fixed a potential crash on client disconnect (bug #12858)</para>
+      </listitem>
+
+      <listitem>
+        <para>VBoxSVC: fixed a race when a new client is started a few seconds after
+          the last client terminated (Windows hosts only; bugs #11309, #12509)</para>
+      </listitem>
+
+      <listitem>
+        <para>VBoxSVC: fixed VirtualBox.xml registry corruption after VM renaming</para>
+      </listitem>
+
+      <listitem>
+        <para>VBoxSVC: fixed a potential crash caused by incorrect USB device filter
+          (Mac OS X hosts only; #11038)</para>
+      </listitem>
+
+      <listitem>
+        <para>Windows hosts: partly support 32-bit COM on 64-bit systems</para>
+      </listitem>
+
+      <listitem>
+        <para>Windows host installer: implemented merge module (msm) support</para>
+      </listitem>
+
+      <listitem>
+        <para>Linux hosts: fixed dependency of boot script on older Debian systems
+          (bug #12262)</para>
+      </listitem>
+
+      <listitem>
+        <para>Linux guests: fix symbolic link to shared folder helper
+          (bug #12879)</para>
+      </listitem>
+
+      <listitem>
+        <para>Linux Additions: don't crash VBoxService during guest execute for
+          users without a password (bug #12994)</para>
+      </listitem>
+
+      <listitem>
+        <para>Linux Additions: fixed a bug in guest execution where the guest process
+          terminated with <emphasis>VERR_INTERRUPTED</emphasis> to the host</para>
+      </listitem>
+
+    </itemizedlist>
+
+  </sect1>
+
+  <sect1>
     <title>Version 4.3.10 (2014-03-26)</title>
 
     <para>This is a maintenance release. The following items were fixed and/or
diff --git a/include/VBox/VBoxCrHgsmi.h b/include/VBox/VBoxCrHgsmi.h
index e79a5c1..1c4f34c 100644
--- a/include/VBox/VBoxCrHgsmi.h
+++ b/include/VBox/VBoxCrHgsmi.h
@@ -44,6 +44,7 @@ VBOXCRHGSMI_DECL(void) VBoxCrHgsmiDestroy(PVBOXUHGSMI pHgsmi);
 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiTerm(void);
 
 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConGetClientID(PVBOXUHGSMI pHgsmi, uint32_t *pu32ClientID);
+VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConGetHostCaps(PVBOXUHGSMI pHgsmi, uint32_t *pu32HostCaps);
 VBOXCRHGSMI_DECL(int) VBoxCrHgsmiCtlConCall(PVBOXUHGSMI pHgsmi, struct VBoxGuestHGCMCallInfo *pCallInfo, int cbCallInfo);
 
 RT_C_DECLS_END
diff --git a/include/VBox/shflsvc.h b/include/VBox/shflsvc.h
index 8d2d734..dafcac7 100644
--- a/include/VBox/shflsvc.h
+++ b/include/VBox/shflsvc.h
@@ -204,14 +204,14 @@ DECLINLINE(PSHFLSTRING) ShflStringInitBuffer(void *pvBuffer, uint32_t u32Size)
 }
 
 /**
- * Validates a HGCM string parameter.
+ * Validates a HGCM string output parameter.
  *
  * @returns true if valid, false if not.
  *
  * @param   pString     The string buffer pointer.
  * @param   cbBuf       The buffer size from the parameter.
  */
-DECLINLINE(bool) ShflStringIsValid(PCSHFLSTRING pString, uint32_t cbBuf)
+DECLINLINE(bool) ShflStringIsValidOut(PCSHFLSTRING pString, uint32_t cbBuf)
 {
     if (RT_UNLIKELY(cbBuf <= RT_UOFFSETOF(SHFLSTRING, String)))
         return false;
@@ -219,27 +219,61 @@ DECLINLINE(bool) ShflStringIsValid(PCSHFLSTRING pString, uint32_t cbBuf)
         return false;
     if (RT_UNLIKELY(pString->u16Length >= pString->u16Size))
         return false;
-    /** @todo r=bird: Check that u16Length is a multiple of two if UTF-16 input? */
-    /** @todo r=bird: Do we require the string to have a NUL terminator char, if
-     *        so check for it!! (Just had a problem with too small (/2) u16Length
-     *        and code behaving incorrectly because it worked up to the terminator
-     *        instead of the length.) */
-    /** @todo r=bird: Who checks for valid UTF-8 encoding of strings? */
     return true;
 }
 
 /**
- * Validates an optional HGCM string parameter.
+ * Validates a HGCM string input parameter.
+ *
+ * @returns true if valid, false if not.
+ *
+ * @param   pString     The string buffer pointer.
+ * @param   cbBuf       The buffer size from the parameter.
+ * @param   fUtf8Not16  Set if UTF-8 encoding, clear if UTF-16 encoding.
+ */
+DECLINLINE(bool) ShflStringIsValidIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16)
+{
+    int rc;
+    if (RT_UNLIKELY(cbBuf <= RT_UOFFSETOF(SHFLSTRING, String)))
+        return false;
+    if (RT_UNLIKELY((uint32_t)pString->u16Size + RT_UOFFSETOF(SHFLSTRING, String) > cbBuf))
+        return false;
+    if (fUtf8Not16)
+    {
+        /* UTF-8: */
+        if (RT_UNLIKELY(pString->u16Length >= pString->u16Size))
+            return false;
+        rc = RTStrValidateEncodingEx((const char *)&pString->String.utf8[0], pString->u16Length + 1,
+                                     RTSTR_VALIDATE_ENCODING_EXACT_LENGTH | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
+    }
+    else
+    {
+        /* UTF-16: */
+        if (RT_UNLIKELY(pString->u16Length & 1))
+            return false;
+        if (RT_UNLIKELY((uint32_t)sizeof(RTUTF16) + pString->u16Length > pString->u16Size))
+            return false;
+        rc = RTUtf16ValidateEncodingEx(&pString->String.ucs2[0], pString->u16Length / 2 + 1,
+                                       RTSTR_VALIDATE_ENCODING_EXACT_LENGTH | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
+    }
+    if (RT_FAILURE(rc))
+        return false;
+    return true;
+}
+
+/**
+ * Validates an optional HGCM string input parameter.
  *
  * @returns true if valid, false if not.
  *
  * @param   pString     The string buffer pointer. Can be NULL.
  * @param   cbBuf       The buffer size from the parameter.
+ * @param   fUtf8Not16  Set if UTF-8 encoding, clear if UTF-16 encoding.
  */
-DECLINLINE(bool) ShflStringIsValidOrNull(PCSHFLSTRING pString, uint32_t cbBuf)
+DECLINLINE(bool) ShflStringIsValidOrNullIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16)
 {
     if (pString)
-        return ShflStringIsValid(pString, cbBuf);
+        return ShflStringIsValidIn(pString, cbBuf, fUtf8Not16);
     if (RT_UNLIKELY(cbBuf > 0))
         return false;
     return true;
diff --git a/include/VBox/vmm/hm_vmx.h b/include/VBox/vmm/hm_vmx.h
index a84b01c..cd04a4a 100644
--- a/include/VBox/vmm/hm_vmx.h
+++ b/include/VBox/vmm/hm_vmx.h
@@ -281,7 +281,7 @@ AssertCompileSize(VMXRESTOREHOST, 56);
 /** V86 mode SS.Base invalid. */
 #define VMX_IGS_V86_SS_BASE_INVALID                             57
 /** V86 mode SS.Limit invalid. */
-#define VMX_IGS_V86_SS_LIMIT_INVALID                            59
+#define VMX_IGS_V86_SS_LIMIT_INVALID                            58
 /** V86 mode SS.Attr invalid. */
 #define VMX_IGS_V86_SS_ATTR_INVALID                             59
 /** V86 mode DS.Base invalid. */
diff --git a/include/iprt/mangling.h b/include/iprt/mangling.h
index 58c9e94..8296373 100644
--- a/include/iprt/mangling.h
+++ b/include/iprt/mangling.h
@@ -1767,6 +1767,7 @@
 # define RTUtf16GetCpExInternal                         RT_MANGLER(RTUtf16GetCpExInternal)
 # define RTUtf16GetCpInternal                           RT_MANGLER(RTUtf16GetCpInternal)
 # define RTUtf16ICmp                                    RT_MANGLER(RTUtf16ICmp)
+# define RTUtf16IsValidEncoding                         RT_MANGLER(RTUtf16IsValidEncoding)
 # define RTUtf16Len                                     RT_MANGLER(RTUtf16Len)
 # define RTUtf16LocaleICmp                              RT_MANGLER(RTUtf16LocaleICmp)
 # define RTUtf16PutCpInternal                           RT_MANGLER(RTUtf16PutCpInternal)
@@ -1777,6 +1778,8 @@
 # define RTUtf16PurgeComplementSet                      RT_MANGLER(RTUtf16PurgeComplementSet)
 # define RTUtf16ToUtf8ExTag                             RT_MANGLER(RTUtf16ToUtf8ExTag)
 # define RTUtf16ToUtf8Tag                               RT_MANGLER(RTUtf16ToUtf8Tag)
+# define RTUtf16ValidateEncoding                        RT_MANGLER(RTUtf16ValidateEncoding)
+# define RTUtf16ValidateEncodingEx                      RT_MANGLER(RTUtf16ValidateEncodingEx)
 # define RTUuidClear                                    RT_MANGLER(RTUuidClear)
 # define RTUuidCompare                                  RT_MANGLER(RTUuidCompare)
 # define RTUuidCompare2Strs                             RT_MANGLER(RTUuidCompare2Strs)
diff --git a/include/iprt/string.h b/include/iprt/string.h
index fdc44fa..44d83f5 100644
--- a/include/iprt/string.h
+++ b/include/iprt/string.h
@@ -671,11 +671,16 @@ RTDECL(int) RTStrReallocTag(char **ppsz, size_t cbNew, const char *pszTag);
  */
 RTDECL(int) RTStrValidateEncoding(const char *psz);
 
-/** @name Flags for RTStrValidateEncodingEx
+/** @name Flags for RTStrValidateEncodingEx and RTUtf16ValidateEncodingEx
  */
 /** Check that the string is zero terminated within the given size.
  * VERR_BUFFER_OVERFLOW will be returned if the check fails. */
 #define RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED     RT_BIT_32(0)
+/** Check that the string is exactly the given length.
+ * If it terminates early, VERR_BUFFER_UNDERFLOW will be returned.  When used
+ * together with RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED, the given length must
+ * include the terminator or VERR_BUFFER_OVERFLOW will be returned. */
+#define RTSTR_VALIDATE_ENCODING_EXACT_LENGTH        RT_BIT_32(1)
 /** @} */
 
 /**
@@ -683,8 +688,9 @@ RTDECL(int) RTStrValidateEncoding(const char *psz);
  *
  * @returns iprt status code.
  * @param   psz         The string.
- * @param   cch         The max string length. Use RTSTR_MAX to process the entire string.
- * @param   fFlags      Reserved for future. Pass 0.
+ * @param   cch         The max string length (/ size).  Use RTSTR_MAX to
+ *                      process the entire string.
+ * @param   fFlags      Combination of RTSTR_VALIDATE_ENCODING_XXX flags.
  */
 RTDECL(int) RTStrValidateEncodingEx(const char *psz, size_t cch, uint32_t fFlags);
 
@@ -3345,6 +3351,33 @@ RTDECL(PRTUTF16) RTUtf16ToLower(PRTUTF16 pwsz);
 RTDECL(PRTUTF16) RTUtf16ToUpper(PRTUTF16 pwsz);
 
 /**
+ * Validates the UTF-16 encoding of the string.
+ *
+ * @returns iprt status code.
+ * @param   pwsz        The string.
+ */
+RTDECL(int) RTUtf16ValidateEncoding(PCRTUTF16 pwsz);
+
+/**
+ * Validates the UTF-16 encoding of the string.
+ *
+ * @returns iprt status code.
+ * @param   pwsz        The string.
+ * @param   cwc         The max string length (/ size) in UTF-16 units. Use
+ *                      RTSTR_MAX to process the entire string.
+ * @param   fFlags      Combination of RTSTR_VALIDATE_ENCODING_XXX flags.
+ */
+RTDECL(int) RTUtf16ValidateEncodingEx(PCRTUTF16 pwsz, size_t cwc, uint32_t fFlags);
+
+/**
+ * Checks if the UTF-16 encoding is valid.
+ *
+ * @returns true / false.
+ * @param   pwsz        The string.
+ */
+RTDECL(bool) RTUtf16IsValidEncoding(PCRTUTF16 pwsz);
+
+/**
  * Sanitise a (valid) UTF-16 string by replacing all characters outside a white
  * list in-place by an ASCII replacement character.  Multi-byte characters will
  * be replaced byte by byte.
diff --git a/src/VBox/Additions/common/VBoxGuest/Makefile.kmk b/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
index ecaa22c..1ae3c47 100644
--- a/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
+++ b/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
@@ -37,7 +37,6 @@ if1of ($(KBUILD_TARGET), darwin freebsd haiku $(if $(defined VBOX_WITH_ADDITION_
  VBoxGuest_DEFS.haiku    = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1
  VBoxGuest_DEFS.linux    = KBUILD_MODNAME=KBUILD_STR\(vboxguest\) KBUILD_BASENAME=KBUILD_STR\(vboxguest\) DEBUG_HASH=2 DEBUG_HASH2=3 EXPORT_SYMTAB
  VBoxGuest_DEFS.solaris  = VBOX_SVN_REV=$(VBOX_SVN_REV)
- VBoxGuest_DEFS.win      = # VBOX_WITH_VRDP_SESSION_HANDLING
  VBoxGuest_DEFS.darwin   = VBOX_GUESTDRV_WITH_RELEASE_LOGGER
  ifeq ($(KBUILD_TYPE),release)
   # Allow stopping/removing the driver without a reboot
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
index d4ba77b..c3ae0ec 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
@@ -738,86 +738,47 @@ static NTSTATUS vbgdNtIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
         pSession = pDevExt->pKernelSession;
     }
 
-    /*
-     * First process Windows specific stuff which cannot be handled
-     * by the common code used on all other platforms. In the default case
-     * we then finally handle the common cases.
-     */
-    switch (uCmd)
+    /* Verify that it's a buffered CTL. */
+    if ((pStack->Parameters.DeviceIoControl.IoControlCode & 0x3) == METHOD_BUFFERED)
     {
-#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
-        case VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION:
-        {
-            LogRel(("VBoxGuest::vbgdNtIOCtl: ENABLE_VRDP_SESSION: Currently: %sabled\n",
-                    pDevExt->fVRDPEnabled? "en": "dis"));
-            if (!pDevExt->fVRDPEnabled)
-            {
-                KUSER_SHARED_DATA *pSharedUserData = (KUSER_SHARED_DATA *)KI_USER_SHARED_DATA;
+        /*
+         * Process the common IOCtls.
+         */
+        size_t cbDataReturned;
+        int vrc = VBoxGuestCommonIOCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned);
 
-                pDevExt->fVRDPEnabled            = true;
-                LogRel(("VBoxGuest::vbgdNtIOCtl: ENABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",
-                        pSharedUserData->ActiveConsoleId));
-                pDevExt->ulOldActiveConsoleId    = pSharedUserData->ActiveConsoleId;
-                pSharedUserData->ActiveConsoleId = 2;
-            }
-            break;
-        }
+        Log(("VBoxGuest::vbgdNtGuestDeviceControl: rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",
+             vrc, pBuf, cbData, cbDataReturned));
 
-        case VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION:
+        if (RT_SUCCESS(vrc))
         {
-            LogRel(("VBoxGuest::vbgdNtIOCtl: DISABLE_VRDP_SESSION: Currently: %sabled\n",
-                    pDevExt->fVRDPEnabled? "en": "dis"));
-            if (pDevExt->fVRDPEnabled)
+            if (RT_UNLIKELY(   cbDataReturned > cbData
+                            || cbDataReturned > pStack->Parameters.DeviceIoControl.OutputBufferLength))
             {
-                KUSER_SHARED_DATA *pSharedUserData = (KUSER_SHARED_DATA *)KI_USER_SHARED_DATA;
-
-                pDevExt->fVRDPEnabled            = false;
-                Log(("VBoxGuest::vbgdNtIOCtl: DISABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",
-                     pSharedUserData->ActiveConsoleId));
-                pSharedUserData->ActiveConsoleId = pDevExt->ulOldActiveConsoleId;
-                pDevExt->ulOldActiveConsoleId    = 0;
+                Log(("VBoxGuest::vbgdNtGuestDeviceControl: Too much output data %u - expected %u!\n", cbDataReturned, cbData));
+                cbDataReturned = cbData;
+                Status = STATUS_BUFFER_TOO_SMALL;
             }
-            break;
+            if (cbDataReturned > 0)
+                cbOut = cbDataReturned;
         }
-#else
-        /* Add at least one (bogus) fall through case to shut up MSVC! */
-        case 0:
-#endif
-        default:
+        else
         {
-            /*
-             * Process the common IOCtls.
-             */
-            size_t cbDataReturned;
-            int vrc = VBoxGuestCommonIOCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned);
-
-            Log(("VBoxGuest::vbgdNtGuestDeviceControl: rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",
-                 vrc, pBuf, cbData, cbDataReturned));
-
-            if (RT_SUCCESS(vrc))
-            {
-                if (RT_UNLIKELY(cbDataReturned > cbData))
-                {
-                    Log(("VBoxGuest::vbgdNtGuestDeviceControl: Too much output data %u - expected %u!\n", cbDataReturned, cbData));
-                    cbDataReturned = cbData;
-                    Status = STATUS_BUFFER_TOO_SMALL;
-                }
-                if (cbDataReturned > 0)
-                    cbOut = cbDataReturned;
-            }
+            if (   vrc == VERR_NOT_SUPPORTED
+                || vrc == VERR_INVALID_PARAMETER)
+                Status = STATUS_INVALID_PARAMETER;
+            else if (vrc == VERR_OUT_OF_RANGE)
+                Status = STATUS_INVALID_BUFFER_SIZE;
             else
-            {
-                if (   vrc == VERR_NOT_SUPPORTED
-                    || vrc == VERR_INVALID_PARAMETER)
-                    Status = STATUS_INVALID_PARAMETER;
-                else if (vrc == VERR_OUT_OF_RANGE)
-                    Status = STATUS_INVALID_BUFFER_SIZE;
-                else
-                    Status = STATUS_UNSUCCESSFUL;
-            }
-            break;
+                Status = STATUS_UNSUCCESSFUL;
         }
     }
+    else
+    {
+        Log(("VBoxGuest::vbgdNtGuestDeviceControl: Not buffered request (%#x) - not supported\n",
+             pStack->Parameters.DeviceIoControl.IoControlCode));
+        Status = STATUS_NOT_SUPPORTED;
+    }
 
     pIrp->IoStatus.Status = Status;
     pIrp->IoStatus.Information = cbOut;
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
index b1ffd3b..a6fcaf7 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
@@ -122,7 +122,7 @@ DECLINLINE(bool) VBoxGuestCommonGuestCapsModeSet(PVBOXGUESTDEVEXT pDevExt, uint3
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
-static const size_t cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);
+static const uint32_t cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);
 
 #if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)
 /**
@@ -248,7 +248,7 @@ static int vboxGuestInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
             pReq->header.requestType = VMMDevReq_SetHypervisorInfo;
             pReq->header.rc          = VERR_INTERNAL_ERROR;
             pReq->hypervisorSize     = cbHypervisor;
-            pReq->hypervisorStart    = (uintptr_t)RTR0MemObjAddress(hObj);
+            pReq->hypervisorStart    = (RTGCPTR32)(uintptr_t)RTR0MemObjAddress(hObj);
             if (    uAlignment == PAGE_SIZE
                 &&  pReq->hypervisorStart & (_4M - 1))
                 pReq->hypervisorStart = RT_ALIGN_32(pReq->hypervisorStart, _4M);
@@ -790,9 +790,6 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
 #endif
     RTListInit(&pDevExt->WokenUpList);
     RTListInit(&pDevExt->FreeList);
-#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
-    pDevExt->fVRDPEnabled = false;
-#endif
     pDevExt->fLoggingEnabled = false;
     pDevExt->f32PendingEvents = 0;
     pDevExt->u32MousePosChangedSeq = 0;
@@ -1734,7 +1731,7 @@ static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
      */
     const VMMDevRequestType enmType   = pReqHdr->requestType;
     const uint32_t          cbReq     = pReqHdr->size;
-    const uint32_t          cbMinSize = vmmdevGetRequestSize(enmType);
+    const uint32_t          cbMinSize = (uint32_t)vmmdevGetRequestSize(enmType);
 
     Log(("VBoxGuestCommonIOCtl: VMMREQUEST type %d\n", pReqHdr->requestType));
 
@@ -2291,37 +2288,6 @@ static int VBoxGuestCommonIOCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGues
 }
 
 
-#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
-/**
- * Enables the VRDP session and saves its session ID.
- *
- * @returns VBox status code.
- *
- * @param   pDevExt             The device extention.
- * @param   pSession            The session.
- */
-static int VBoxGuestCommonIOCtl_EnableVRDPSession(VBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
-{
-    /* Nothing to do here right now, since this only is supported on Windows at the moment. */
-    return VERR_NOT_IMPLEMENTED;
-}
-
-
-/**
- * Disables the VRDP session.
- *
- * @returns VBox status code.
- *
- * @param   pDevExt             The device extention.
- * @param   pSession            The session.
- */
-static int VBoxGuestCommonIOCtl_DisableVRDPSession(VBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
-{
-    /* Nothing to do here right now, since this only is supported on Windows at the moment. */
-    return VERR_NOT_IMPLEMENTED;
-}
-#endif /* VBOX_WITH_VRDP_SESSION_HANDLING */
-
 #ifdef DEBUG
 /** Unit test SetMouseStatus instead of really executing the request. */
 static bool     g_test_fSetMouseStatus = false;
@@ -2885,15 +2851,6 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
                 rc = VBoxGuestCommonIOCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
                 break;
 
-#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
-            case VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION:
-                rc = VBoxGuestCommonIOCtl_EnableVRDPSession(pDevExt, pSession);
-                break;
-
-            case VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION:
-                rc = VBoxGuestCommonIOCtl_DisableVRDPSession(pDevExt, pSession);
-                break;
-#endif /* VBOX_WITH_VRDP_SESSION_HANDLING */
             case VBOXGUEST_IOCTL_SET_MOUSE_STATUS:
                 CHECKRET_SIZE("SET_MOUSE_STATUS", sizeof(uint32_t));
                 rc = VBoxGuestCommonIOCtl_SetMouseStatus(pDevExt, pSession,
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h b/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
index e91b767..b2a427c 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
@@ -157,9 +157,6 @@ typedef struct VBOXGUESTDEVEXT
 
     /** Spinlock various items in the VBOXGUESTSESSION. */
     RTSPINLOCK                  SessionSpinlock;
-#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
-    bool                        fVRDPEnabled;
-#endif
     /** Flag indicating whether logging to the release log
      *  is enabled. */
     bool                        fLoggingEnabled;
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
index c355b58..1d17d80 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
@@ -524,6 +524,8 @@ static int gstcntlProcessProcLoop(PVBOXSERVICECTRLPROCESS pProcess)
     rc = VbglR3GuestCtrlProcCbStatus(&ctxStart,
                                      pProcess->uPID, PROC_STS_STARTED, 0 /* u32Flags */,
                                      NULL /* pvData */, 0 /* cbData */);
+    if (rc == VERR_INTERRUPTED)
+        rc = VINF_SUCCESS; /* SIGCHLD by quick childs! */
     if (RT_FAILURE(rc))
         VBoxServiceError("[PID %RU32]: Error reporting starting status to host, rc=%Rrc\n",
                          pProcess->uPID, rc);
diff --git a/src/VBox/Additions/common/crOpenGL/Makefile.kmk b/src/VBox/Additions/common/crOpenGL/Makefile.kmk
index 9d21e1a..1827856 100644
--- a/src/VBox/Additions/common/crOpenGL/Makefile.kmk
+++ b/src/VBox/Additions/common/crOpenGL/Makefile.kmk
@@ -235,7 +235,9 @@ endif
 ifdef VBOX_WITH_WDDM
 VBoxOGL_DEFS.win   += VBOX_WITH_WDDM
 endif
-
+if1of ($(KBUILD_TARGET), linux)
+VBoxOGL_LDFLAGS += -Wl,-z,nodelete
+endif
 ifdef VBOX_WITH_WDDM
 #
 # VBoxOGL-x86 - x86 VBoxOGL version built for amd64 build
diff --git a/src/VBox/Additions/common/crOpenGL/getprocaddress.py b/src/VBox/Additions/common/crOpenGL/getprocaddress.py
index 39c9c23..23cde45 100644
--- a/src/VBox/Additions/common/crOpenGL/getprocaddress.py
+++ b/src/VBox/Additions/common/crOpenGL/getprocaddress.py
@@ -58,7 +58,8 @@ print "\t/* Chromium binding/glue functions */"
 for func_name in keys:
 	if (func_name == "Writeback" or
 		func_name == "BoundsInfoCR" or
-		func_name == "GetUniformsLocations"):
+		func_name == "GetUniformsLocations" or
+		func_name == "GetAttribsLocations"):
 		continue
 	if apiutil.Category(func_name) == "Chromium":
 		print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
diff --git a/src/VBox/Additions/common/crOpenGL/load.c b/src/VBox/Additions/common/crOpenGL/load.c
index 35d1f72..16ffd13 100644
--- a/src/VBox/Additions/common/crOpenGL/load.c
+++ b/src/VBox/Additions/common/crOpenGL/load.c
@@ -31,7 +31,6 @@
 #include <d3d9types.h>
 #include <D3dumddi.h>
 #include "../../WINNT/Graphics/Video/common/wddm/VBoxMPIf.h"
-#include "../../WINNT/Graphics/Video/disp/wddm/VBoxDispMp.h"
 #endif
 
 /**
@@ -459,11 +458,10 @@ static void stubSPUSafeTearDown(void)
     {
         ASMAtomicWriteBool(&stub.bShutdownSyncThread, true);
         {
-            /*RTThreadWait might return too early, which cause our code being unloaded while RT thread wrapper is still running*/
-            int rc = pthread_join(RTThreadGetNative(stub.hSyncThread), NULL);
-            if (!rc)
+            int rc = RTThreadWait(stub.hSyncThread, RT_INDEFINITE_WAIT, NULL);
+            if (RT_FAILURE(rc))
             {
-                crDebug("pthread_join failed %i", rc);
+                WARN(("RTThreadWait_join failed %i", rc));
             }
         }
     }
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu.h b/src/VBox/Additions/common/crOpenGL/pack/packspu.h
index 942761a..3c0457d 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu.h
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu.h
@@ -23,6 +23,8 @@
 # include "cr_dump.h"
 #endif
 
+extern uint32_t g_u32VBoxHostCaps;
+
 typedef struct thread_info_t ThreadInfo;
 typedef struct context_info_t ContextInfo;
 
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py b/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
index 82f00a8..17929e0 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_get.py
@@ -116,7 +116,7 @@ for func_name in keys:
 #ifdef CR_ARB_vertex_program
         || pname == GL_MAX_VERTEX_ATTRIBS_ARB
 #endif
-#ifndef GL_EXT_framebuffer_object
+#ifdef GL_EXT_framebuffer_object
         || pname == GL_FRAMEBUFFER_BINDING_EXT
         || pname == GL_READ_FRAMEBUFFER_BINDING_EXT
         || pname == GL_DRAW_FRAMEBUFFER_BINDING_EXT 
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
index d58202e..aacf9ef 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c
@@ -114,13 +114,87 @@ GLint PACKSPU_APIENTRY packspu_GetUniformLocation(GLuint program, const char * n
     return crStateGetUniformLocation(program, name);
 }
 
+GLint PACKSPU_APIENTRY packspu_GetAttribLocationUnchached( GLuint program, const char * name )
+{
+    GET_THREAD(thread);
+    int writeback = 1;
+    GLint return_val = (GLint) 0;
+    if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
+    {
+        crError( "packspu_GetAttribLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
+    }
+    if (pack_spu.swap)
+    {
+        crPackGetAttribLocationSWAP( program, name, &return_val, &writeback );
+    }
+    else
+    {
+        crPackGetAttribLocation( program, name, &return_val, &writeback );
+    }
+    packspuFlush( (void *) thread );
+    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
+    if (pack_spu.swap)
+    {
+        return_val = (GLint) SWAP32(return_val);
+    }
+    return return_val;
+}
+
+GLint PACKSPU_APIENTRY packspu_GetAttribLocation(GLuint program, const char * name)
+{
+    if (!(CR_VBOX_CAP_GETATTRIBSLOCATIONS & g_u32VBoxHostCaps))
+        return packspu_GetAttribLocationUnchached(program, name);
+
+    if (!crStateIsProgramAttribsCached(program))
+    {
+        GET_THREAD(thread);
+        int writeback = 1;
+        GLsizei maxcbData;
+        GLsizei *pData;
+        GLint mu;
+
+        packspu_GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &mu);
+        maxcbData = 4*32*mu*sizeof(char);
+
+        pData = (GLsizei *) crAlloc(maxcbData+sizeof(GLsizei));
+        if (!pData)
+        {
+            crWarning("packspu_GetAttribLocation: not enough memory, fallback to single query");
+            return packspu_GetAttribLocationUnchached(program, name);
+        }
+
+        crPackGetAttribsLocations(program, maxcbData, pData, NULL, &writeback);
+
+        packspuFlush((void *) thread);
+        CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
+
+        crStateGLSLProgramCacheAttribs(program, pData[0], &pData[1]);
+
+        CRASSERT(crStateIsProgramAttribsCached(program));
+
+        crFree(pData);
+    }
+
+    /*crDebug("packspu_GetAttribLocation(%d, %s)=%i", program, name, crStateGetAttribLocation(program, name));*/
+    return crStateGetAttribLocation(program, name);
+}
+
 void PACKSPU_APIENTRY packspu_GetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData)
 {
     (void) program;
     (void) maxcbData;
     (void) cbData;
     (void) pData;
-    crWarning("packspu_GetUniformsLocations shouldn't be called directly");
+    WARN(("packspu_GetUniformsLocations shouldn't be called directly"));
+}
+
+void PACKSPU_APIENTRY packspu_GetAttribsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData)
+{
+    (void) program;
+    (void) maxcbData;
+    (void) cbData;
+    (void) pData;
+    WARN(("packspu_GetAttribsLocations shouldn't be called directly"));
 }
 
 void PACKSPU_APIENTRY packspu_DeleteProgram(GLuint program)
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
index babfe5e..9526825 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c
@@ -13,6 +13,8 @@
 #include "packspu.h"
 #include "packspu_proto.h"
 
+uint32_t g_u32VBoxHostCaps = 0;
+
 static void
 packspuWriteback( const CRMessageWriteback *wb )
 {
@@ -241,6 +243,10 @@ static void packspuFirstConnectToServer( CRNetServer *server
                 , pHgsmi
 #endif
             );
+    if (server->conn)
+    {
+        g_u32VBoxHostCaps = crNetHostCapsGet();
+    }
 }
 
 void packspuConnectToServer( CRNetServer *server
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_special b/src/VBox/Additions/common/crOpenGL/pack/packspu_special
index d7a1212..03426e0 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_special
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_special
@@ -83,7 +83,9 @@ CreateProgram
 LinkProgram
 DeleteProgram
 GetUniformLocation
+GetAttribLocation
 GetUniformsLocations
+GetAttribsLocations
 BindFramebufferEXT
 DeleteObjectARB
 BindFramebufferEXT
diff --git a/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py b/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
index fc167be..21783b3 100644
--- a/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
+++ b/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py
@@ -70,7 +70,8 @@ print "\t/* Chromium binding/glue functions */"
 for func_name in keys:
     if (func_name == "Writeback" or
         func_name == "BoundsInfoCR" or
-        func_name == "GetUniformsLocations"):
+        func_name == "GetUniformsLocations" or
+        func_name == "GetAttribsLocations"):
         continue
     if apiutil.Category(func_name) == "Chromium":
         print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
diff --git a/src/VBox/Additions/linux/Makefile.kmk b/src/VBox/Additions/linux/Makefile.kmk
index 1fd3c81..4ac2c75 100644
--- a/src/VBox/Additions/linux/Makefile.kmk
+++ b/src/VBox/Additions/linux/Makefile.kmk
@@ -128,6 +128,7 @@ VBOX_ADD_STRIP_SBIN += \
 	VBoxService \
 	$(if $(VBOX_WITH_LIGHTDM_GREETER),vbox-greeter)
 
+ifdef VBOX_WITH_CROGL
 VBOX_ADD_STRIP_LIB += \
 	VBoxOGLarrayspu.so \
 	VBoxOGLcrutil.so \
@@ -136,6 +137,7 @@ VBOX_ADD_STRIP_LIB += \
 	VBoxOGLpackspu.so \
 	VBoxOGLpassthroughspu.so \
 	VBoxOGL.so
+endif
 
 VBOX_ADD_STRIP_MOD.linux = \
 	vboxmouse_drv_70.so \
@@ -236,7 +238,7 @@ $(addprefix $(VBOX_LNX_ADD_INST_BIN_DIR),$(VBOX_LNX_ADD_STRIP_BIN)): \
 		| $$(dir $$@)
 	$(call MSG_INST_FILE,$<,$@)
 	$(QUIET)$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@
-	$(QUIET)objcopy --add-gnu-debuglink=$@ $@
+	$(QUIET)objcopy --add-gnu-debuglink=$(subst $(VBOX_LNX_ADD_INST_BIN_DIR),$(VBOX_LNX_ADD_DBG_BIN_DIR),$@) $@
 
 # pattern rule for stripping and copying the VBOX_LNX_ADD_STRIP_SBIN files to the installation directory
 $(addprefix $(VBOX_LNX_ADD_INST_SBIN_DIR),\
@@ -246,7 +248,7 @@ $(addprefix $(VBOX_LNX_ADD_INST_SBIN_DIR),\
 		| $$(dir $$@)
 	$(call MSG_INST_FILE,$<,$@)
 	$(QUIET)$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@
-	$(QUIET)objcopy --add-gnu-debuglink=$@ $@
+	$(QUIET)objcopy --add-gnu-debuglink=$(subst $(VBOX_LNX_ADD_INST_SBIN_DIR),$(VBOX_LNX_ADD_DBG_SBIN_DIR),$@) $@
 
 # pattern rule for stripping and copying vbox-greeter to the installation directory
 $(addprefix $(VBOX_LNX_ADD_INST_SBIN_DIR),vbox-greeter): \
@@ -262,7 +264,7 @@ $(addprefix $(VBOX_LNX_ADD_INST_LIB_DIR),$(VBOX_LNX_ADD_STRIP_LIB)): \
 		| $$(dir $$@)
 	$(call MSG_INST_FILE,$<,$@)
 	$(QUIET)$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@
-	$(QUIET)objcopy --add-gnu-debuglink=$@ $@
+	$(QUIET)objcopy --add-gnu-debuglink=$(subst $(VBOX_LNX_ADD_INST_LIB_DIR),$(VBOX_LNX_ADD_DBG_LIB_DIR),$@) $@
 
 # pattern rule for stripping and copying the VBOX_LNX_ADD_STRIP_MOD files to the installation directory
 $(addprefix $(VBOX_LNX_ADD_INST_MOD_DIR),$(VBOX_LNX_ADD_STRIP_MOD)): \
@@ -271,7 +273,7 @@ $(addprefix $(VBOX_LNX_ADD_INST_MOD_DIR),$(VBOX_LNX_ADD_STRIP_MOD)): \
 		| $$(dir $$@)
 	$(call MSG_INST_FILE,$<,$@)
 	$(QUIET)$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@
-	$(QUIET)objcopy --add-gnu-debuglink=$@ $@
+	$(QUIET)objcopy --add-gnu-debuglink=$(subst $(VBOX_LNX_ADD_INST_MOD_DIR),$(VBOX_LNX_ADD_DBG_MOD_DIR),$@) $@
 
 # pattern rule for stripping and copying the VBOX_LNX_ADD_STRIP_OBJ files to the installation directory
 $(addprefix $(VBOX_LNX_ADD_INST_MOD_DIR),$(VBOX_LNX_ADD_STRIP_OBJ)): \
diff --git a/src/VBox/Additions/linux/installer/vboxadd.sh b/src/VBox/Additions/linux/installer/vboxadd.sh
index 1eb0014..855d962 100755
--- a/src/VBox/Additions/linux/installer/vboxadd.sh
+++ b/src/VBox/Additions/linux/installer/vboxadd.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# Linux Additions kernel module init script ($Revision: 90030 $)
+# Linux Additions kernel module init script ($Revision: 93574 $)
 #
 
 #
@@ -34,7 +34,7 @@ LOG="/var/log/vboxadd-install.log"
 MODPROBE=/sbin/modprobe
 OLDMODULES="vboxguest vboxadd vboxsf vboxvfs vboxvideo"
 
-if $MODPROBE -c | grep -q '^allow_unsupported_modules  *0'; then
+if $MODPROBE -c 2>/dev/null | grep -q '^allow_unsupported_modules  *0'; then
   MODPROBE="$MODPROBE --allow-unsupported-modules"
 fi
 
@@ -43,17 +43,19 @@ cpu=`uname -m`;
 case "$cpu" in
   i[3456789]86|x86)
     cpu="x86"
-    lib_path="/usr/lib"
+    lib_candidates="/usr/lib/i386-linux-gnu /usr/lib /lib"
     ;;
   x86_64|amd64)
     cpu="amd64"
-    if test -d "/usr/lib64"; then
-      lib_path="/usr/lib64"
-    else
-      lib_path="/usr/lib"
-    fi
+    lib_candidates="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib64 /lib"
     ;;
 esac
+for i in $lib_candidates; do
+  if test -d "$i/VBoxGuestAdditions"; then
+    lib_path=$i
+    break
+  fi
+done
 
 if [ -f /etc/arch-release ]; then
     system=arch
diff --git a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd
index dd8f846..b9660b8 100644
Binary files a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd and b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd differ
diff --git a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd
index d64748c..5629e63 100644
Binary files a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd and b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd differ
diff --git a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm
index 183842b..fc58a4e 100644
--- a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm
+++ b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm
@@ -6781,7 +6781,7 @@ vesa_pm_end:                                 ; 0xc4714 LB 0x1
 
 section _DATA progbits vstart=0x4800 align=1 ; size=0x36e1 class=DATA group=DGROUP
 _msg_vga_init:                               ; 0xc4800 LB 0x2f
-    db  'Oracle VM VirtualBox Version 4.3.10 VGA BIOS', 00dh, 00ah, 000h
+    db  'Oracle VM VirtualBox Version 4.3.12 VGA BIOS', 00dh, 00ah, 000h
 _vga_modes:                                  ; 0xc482f LB 0x80
     db  000h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 001h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h
     db  002h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 003h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h
@@ -7669,7 +7669,7 @@ _vbebios_vendor_name:                        ; 0xc7e35 LB 0x13
 _vbebios_product_name:                       ; 0xc7e48 LB 0x21
     db  'Oracle VM VirtualBox VBE Adapter', 000h
 _vbebios_product_revision:                   ; 0xc7e69 LB 0x24
-    db  'Oracle VM VirtualBox Version 4.3.10', 000h
+    db  'Oracle VM VirtualBox Version 4.3.12', 000h
 _vbebios_info_string:                        ; 0xc7e8d LB 0x2b
     db  'VirtualBox VBE Display Adapter enabled', 00dh, 00ah, 00dh, 00ah, 000h
 _no_vbebios_info_string:                     ; 0xc7eb8 LB 0x29
@@ -7700,4 +7700,4 @@ section CONST2 progbits vstart=0x7ee2 align=1 ; size=0x0 class=DATA group=DGROUP
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 068h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 064h
diff --git a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum
index cb2d801..37003d9 100644
--- a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum
+++ b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum
@@ -1 +1 @@
-25d0dc05c628f90ff6b5aa5e3987ba1f *VBoxVgaBios.rom
+b29ad6fb20d5895b561c5efdfffa50d9 *VBoxVgaBios.rom
diff --git a/src/VBox/Devices/Graphics/DevVGA.cpp b/src/VBox/Devices/Graphics/DevVGA.cpp
index da28d9b..d42bd62 100644
--- a/src/VBox/Devices/Graphics/DevVGA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA.cpp
@@ -5211,7 +5211,9 @@ static DECLCALLBACK(void) vgaTimerRefresh(PPDMDEVINS pDevIns, PTMTIMER pTimer, v
     vbvaTimerCb(pThis);
 #endif
 
+#ifdef VBOX_WITH_CRHGSMI
     vboxCmdVBVACmdTimer(pThis);
+#endif
 }
 
 #ifdef VBOX_WITH_VMSVGA
@@ -5927,9 +5929,10 @@ static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF
 #if defined(VBOX_WITH_CRHGSMI)
     pThis->IVBVACallbacks.pfnCrHgsmiCommandCompleteAsync = vboxVDMACrHgsmiCommandCompleteAsync;
     pThis->IVBVACallbacks.pfnCrHgsmiControlCompleteAsync = vboxVDMACrHgsmiControlCompleteAsync;
+
+    pThis->IVBVACallbacks.pfnCrCtlSubmit = vboxCmdVBVACmdHostCtl;
 # endif
 #endif
-    pThis->IVBVACallbacks.pfnCrCtlSubmit = vboxCmdVBVACmdHostCtl;
 
     /*
      * We use our own critical section to avoid unncessary pointer indirections
diff --git a/src/VBox/Devices/Graphics/DevVGA.h b/src/VBox/Devices/Graphics/DevVGA.h
index aad2b43..2701cc2 100644
--- a/src/VBox/Devices/Graphics/DevVGA.h
+++ b/src/VBox/Devices/Graphics/DevVGA.h
@@ -624,11 +624,11 @@ int vboxVBVASaveStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
 # ifdef VBOX_WITH_CRHGSMI
 int vboxVDMACrHgsmiCommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, int rc);
 int vboxVDMACrHgsmiControlCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd, int rc);
-# endif
 int vboxCmdVBVACmdHostCtl(PPDMIDISPLAYVBVACALLBACKS pInterface,
                                                                struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
                                                                PFNCRCTLCOMPLETION pfnCompletion,
                                                                void *pvCompletion);
+# endif
 
 int vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
 int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version);
@@ -645,11 +645,12 @@ int vboxVDMASaveStateExecPrep(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM);
 int vboxVDMASaveStateExecDone(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM);
 # endif /* VBOX_WITH_VDMA */
 
+# ifdef VBOX_WITH_CRHGSMI
 int vboxCmdVBVACmdSubmit(PVGASTATE pVGAState);
 int vboxCmdVBVACmdFlush(PVGASTATE pVGAState);
 void vboxCmdVBVACmdTimer(PVGASTATE pVGAState);
 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl);
-
+# endif /* VBOX_WITH_CRHGSMI */
 #endif /* VBOX_WITH_HGSMI */
 
 # ifdef VBOX_WITH_VMSVGA
diff --git a/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp b/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
index ed727b1..1150560 100644
--- a/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
@@ -1941,16 +1941,21 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
     {
         case VBVA_CMDVBVA_SUBMIT:
         {
+# ifdef VBOX_WITH_CRHGSMI
             rc = vboxCmdVBVACmdSubmit(pVGAState);
+#endif
             break;
         }
         case VBVA_CMDVBVA_FLUSH:
         {
+# ifdef VBOX_WITH_CRHGSMI
             rc =vboxCmdVBVACmdFlush(pVGAState);
+#endif
             break;
         }
         case VBVA_CMDVBVA_CTL:
         {
+#ifdef VBOX_WITH_CRHGSMI
             if (cbBuffer < VBoxSHGSMIBufferHeaderSize() + sizeof (VBOXCMDVBVA_CTL))
             {
                 Log(("buffer too small\n"));
@@ -1960,9 +1965,9 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
                 rc = VERR_INVALID_PARAMETER;
                 break;
             }
-
             VBOXCMDVBVA_CTL *pCtl = (VBOXCMDVBVA_CTL*)VBoxSHGSMIBufferData((PVBOXSHGSMIHEADER)pvBuffer);
             rc = vboxCmdVBVACmdCtl(pVGAState, pCtl, cbBuffer - VBoxSHGSMIBufferHeaderSize());
+#endif
             break;
         }
 #ifdef VBOX_WITH_VDMA
@@ -2057,25 +2062,27 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
             }
 
             /* Guest submits an array of VBVAINFOVIEW structures. */
-            VBVAINFOVIEW *pView = (VBVAINFOVIEW *)pvBuffer;
+            VBVAINFOVIEW *pVw = (VBVAINFOVIEW *)pvBuffer;
 
             for (;
                  cbBuffer >= sizeof (VBVAINFOVIEW);
-                 pView++, cbBuffer -= sizeof (VBVAINFOVIEW))
+                 pVw++, cbBuffer -= sizeof (VBVAINFOVIEW))
             {
+                VBVAINFOVIEW View = *pVw;
+
                 LogFlowFunc(("VBVA_INFO_VIEW: index %d, offset 0x%x, size 0x%x, max screen size 0x%x\n",
-                             pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize));
+                             View.u32ViewIndex, View.u32ViewOffset, View.u32ViewSize, View.u32MaxScreenSize));
 
                 /* @todo verify view data. */
-                if (pView->u32ViewIndex >= pCtx->cViews)
+                if (View.u32ViewIndex >= pCtx->cViews)
                 {
                     Log(("View index too large %d!!!\n",
-                         pView->u32ViewIndex));
+                         View.u32ViewIndex));
                     rc = VERR_INVALID_PARAMETER;
                     break;
                 }
 
-                pCtx->aViews[pView->u32ViewIndex].view = *pView;
+                pCtx->aViews[View.u32ViewIndex].view = View;
             }
         } break;
 
@@ -2117,36 +2124,37 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
                 break;
             }
 
-            VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)pvBuffer;
-            VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view;
+            VBVAINFOSCREEN *pScr = (VBVAINFOSCREEN *)pvBuffer;
+            VBVAINFOSCREEN Screen = *pScr;
+            VBVAINFOVIEW *pView = &pCtx->aViews[Screen.u32ViewIndex].view;
             /* Calculate the offset of the  end of the screen so we can make
              * sure it is inside the view.  I assume that screen rollover is not
              * implemented. */
-            int64_t offEnd =   (int64_t)pScreen->u32Height * pScreen->u32LineSize
-                             + pScreen->u32Width + pScreen->u32StartOffset;
+            int64_t offEnd =   (int64_t)Screen.u32Height * Screen.u32LineSize
+                             + Screen.u32Width + Screen.u32StartOffset;
             LogRel(("VBVA_INFO_SCREEN: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n",
-                            pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY,
-                            pScreen->u32Width, pScreen->u32Height,
-                            pScreen->u32LineSize,  pScreen->u16BitsPerPixel, pScreen->u16Flags));
-
-            if (   pScreen->u32ViewIndex < RT_ELEMENTS (pCtx->aViews)
-                && pScreen->u16BitsPerPixel <= 32
-                && pScreen->u32Width <= UINT16_MAX
-                && pScreen->u32Height <= UINT16_MAX
-                && pScreen->u32LineSize <= UINT16_MAX * 4
+                            Screen.u32ViewIndex, Screen.i32OriginX, Screen.i32OriginY,
+                            Screen.u32Width, Screen.u32Height,
+                            Screen.u32LineSize,  Screen.u16BitsPerPixel, Screen.u16Flags));
+
+            if (   Screen.u32ViewIndex < RT_ELEMENTS (pCtx->aViews)
+                && Screen.u16BitsPerPixel <= 32
+                && Screen.u32Width <= UINT16_MAX
+                && Screen.u32Height <= UINT16_MAX
+                && Screen.u32LineSize <= UINT16_MAX * 4
                 && offEnd < pView->u32MaxScreenSize)
             {
-                vbvaResize (pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen);
+                vbvaResize (pVGAState, &pCtx->aViews[Screen.u32ViewIndex], &Screen);
             }
             else
             {
                 LogRelFlow(("VBVA_INFO_SCREEN [%lu]: bad data: %lux%lu, line 0x%lx, BPP %u, start offset %lu, max screen size %lu\n",
-                            (unsigned long)pScreen->u32ViewIndex,
-                            (unsigned long)pScreen->u32Width,
-                            (unsigned long)pScreen->u32Height,
-                            (unsigned long)pScreen->u32LineSize,
-                            (unsigned long)pScreen->u16BitsPerPixel,
-                            (unsigned long)pScreen->u32StartOffset,
+                            (unsigned long)Screen.u32ViewIndex,
+                            (unsigned long)Screen.u32Width,
+                            (unsigned long)Screen.u32Height,
+                            (unsigned long)Screen.u32LineSize,
+                            (unsigned long)Screen.u16BitsPerPixel,
+                            (unsigned long)Screen.u32StartOffset,
                             (unsigned long)pView->u32MaxScreenSize));
                 rc = VERR_INVALID_PARAMETER;
             }
diff --git a/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp b/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
index 0e35fe5..0800795 100644
--- a/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
@@ -664,15 +664,19 @@ typedef struct VBOXVDMAHOST
 {
     PHGSMIINSTANCE pHgsmi;
     PVGASTATE pVGAState;
+#ifdef VBOX_WITH_CRHGSMI
     VBVAEXHOSTCONTEXT CmdVbva;
     VBOXVDMATHREAD Thread;
     VBOXCRCMD_SVRINFO CrSrvInfo;
     VBVAEXHOSTCTL* pCurRemainingHostCtl;
+#endif
 #ifdef VBOX_VDMA_WITH_WATCHDOG
     PTMTIMERR3 WatchDogTimer;
 #endif
 } VBOXVDMAHOST, *PVBOXVDMAHOST;
 
+#ifdef VBOX_WITH_CRHGSMI
+
 int VBoxVDMAThreadNotifyConstructSucceeded(PVBOXVDMATHREAD pThread)
 {
     Assert(pThread->u32State == VBOXVDMATHREAD_STATE_TERMINATED);
@@ -775,8 +779,6 @@ void VBoxVDMAThreadTerm(PVBOXVDMATHREAD pThread)
 
 static int vdmaVBVACtlSubmitSync(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL* pCtl, VBVAEXHOSTCTL_SOURCE enmSource);
 
-#ifdef VBOX_WITH_CRHGSMI
-
 typedef DECLCALLBACK(void) FNVBOXVDMACRCTL_CALLBACK(PVGASTATE pVGAState, PVBOXVDMACMD_CHROMIUM_CTL pCmd, void* pvContext);
 typedef FNVBOXVDMACRCTL_CALLBACK *PFNVBOXVDMACRCTL_CALLBACK;
 
@@ -1371,36 +1373,6 @@ int vboxVDMACrHgsmiControlCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PV
     return VINF_SUCCESS;
 }
 
-#endif
-
-#ifdef VBOX_VDMA_WITH_WORKERTHREAD
-/* to simplify things and to avoid extra backend if modifications we assume the VBOXVDMA_RECTL is the same as VBVACMDHDR */
-AssertCompile(sizeof(VBOXVDMA_RECTL) == sizeof(VBVACMDHDR));
-AssertCompile(RT_SIZEOFMEMB(VBOXVDMA_RECTL, left) == RT_SIZEOFMEMB(VBVACMDHDR, x));
-AssertCompile(RT_SIZEOFMEMB(VBOXVDMA_RECTL, top) == RT_SIZEOFMEMB(VBVACMDHDR, y));
-AssertCompile(RT_SIZEOFMEMB(VBOXVDMA_RECTL, width) == RT_SIZEOFMEMB(VBVACMDHDR, w));
-AssertCompile(RT_SIZEOFMEMB(VBOXVDMA_RECTL, height) == RT_SIZEOFMEMB(VBVACMDHDR, h));
-AssertCompile(RT_OFFSETOF(VBOXVDMA_RECTL, left) == RT_OFFSETOF(VBVACMDHDR, x));
-AssertCompile(RT_OFFSETOF(VBOXVDMA_RECTL, top) == RT_OFFSETOF(VBVACMDHDR, y));
-AssertCompile(RT_OFFSETOF(VBOXVDMA_RECTL, width) == RT_OFFSETOF(VBVACMDHDR, w));
-AssertCompile(RT_OFFSETOF(VBOXVDMA_RECTL, height) == RT_OFFSETOF(VBVACMDHDR, h));
-
-static int vboxVDMANotifyPrimaryUpdate (PVGASTATE pVGAState, unsigned uScreenId, const VBOXVDMA_RECTL * pRectl)
-{
-    pVGAState->pDrv->pfnVBVAUpdateBegin (pVGAState->pDrv, uScreenId);
-
-    /* Updates the rectangle and sends the command to the VRDP server. */
-    pVGAState->pDrv->pfnVBVAUpdateProcess (pVGAState->pDrv, uScreenId,
-            (const PVBVACMDHDR)pRectl /* <- see above AssertCompile's and comments */,
-            sizeof (VBOXVDMA_RECTL));
-
-    pVGAState->pDrv->pfnVBVAUpdateEnd (pVGAState->pDrv, uScreenId, pRectl->left, pRectl->top,
-                                               pRectl->width, pRectl->height);
-
-    return VINF_SUCCESS;
-}
-#endif
-
 static int vboxVDMACmdExecBltPerform(PVBOXVDMAHOST pVdma,
         uint8_t *pvDstSurf, const uint8_t *pvSrcSurf,
         const PVBOXVDMA_SURF_DESC pDstDesc, const PVBOXVDMA_SURF_DESC pSrcDesc,
@@ -1555,12 +1527,6 @@ static int vboxVDMACmdExecBlt(PVBOXVDMAHOST pVdma, const PVBOXVDMACMD_DMA_PRESEN
         vboxVDMARectlUnite(&updateRectl, &pBlt->dstRectl);
     }
 
-#ifdef VBOX_VDMA_WITH_WORKERTHREAD
-    int iView = 0;
-    /* @todo: fixme: check if update is needed and get iView */
-    vboxVDMANotifyPrimaryUpdate (pVdma->pVGAState, iView, &updateRectl);
-#endif
-
     return cbBlt;
 }
 
@@ -1853,6 +1819,8 @@ static void vboxVDMAControlProcess(PVBOXVDMAHOST pVdma, PVBOXVDMA_CTL pCmd)
     AssertRC(rc);
 }
 
+#endif /* #ifdef VBOX_WITH_CRHGSMI */
+
 #ifdef VBOX_VDMA_WITH_WATCHDOG
 static DECLCALLBACK(void) vboxVDMAWatchDogTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
 {
@@ -1875,11 +1843,7 @@ static int vboxVDMAWatchDogCtl(struct VBOXVDMAHOST *pVdma, uint32_t cMillis)
 int vboxVDMAConstruct(PVGASTATE pVGAState, uint32_t cPipeElements)
 {
     int rc;
-#ifdef VBOX_VDMA_WITH_WORKERTHREAD
-    PVBOXVDMAHOST pVdma = (PVBOXVDMAHOST)RTMemAllocZ(RT_OFFSETOF(VBOXVDMAHOST, CmdPool.aCmds[cPipeElements]));
-#else
     PVBOXVDMAHOST pVdma = (PVBOXVDMAHOST)RTMemAllocZ(sizeof(*pVdma));
-#endif
     Assert(pVdma);
     if (pVdma)
     {
@@ -1892,6 +1856,7 @@ int vboxVDMAConstruct(PVGASTATE pVGAState, uint32_t cPipeElements)
                                     "VDMA WatchDog Timer", &pVdma->WatchDogTimer);
         AssertRC(rc);
 #endif
+#ifdef VBOX_WITH_CRHGSMI
         rc = VBoxVBVAExHSInit(&pVdma->CmdVbva);
         if (RT_SUCCESS(rc))
         {
@@ -1899,9 +1864,7 @@ int vboxVDMAConstruct(PVGASTATE pVGAState, uint32_t cPipeElements)
             if (RT_SUCCESS(rc))
             {
                 pVGAState->pVdma = pVdma;
-#ifdef VBOX_WITH_CRHGSMI
                 int rcIgnored = vboxVDMACrCtlHgsmiSetup(pVdma); NOREF(rcIgnored); /** @todo is this ignoring intentional? */
-#endif
                 return VINF_SUCCESS;
             }
             else
@@ -1913,6 +1876,10 @@ int vboxVDMAConstruct(PVGASTATE pVGAState, uint32_t cPipeElements)
             WARN(("VBoxVBVAExHSInit faile %d\n", rc));
 
         RTMemFree(pVdma);
+#else
+        pVGAState->pVdma = pVdma;
+        return VINF_SUCCESS;
+#endif
     }
     else
         rc = VERR_OUT_OF_RESOURCES;
@@ -1922,6 +1889,7 @@ int vboxVDMAConstruct(PVGASTATE pVGAState, uint32_t cPipeElements)
 
 int vboxVDMAReset(struct VBOXVDMAHOST *pVdma)
 {
+#ifdef VBOX_WITH_CRHGSMI
     VBVAEXHOSTCTL Ctl;
     Ctl.enmType = VBVAEXHOSTCTL_TYPE_HH_RESET;
     int rc = vdmaVBVACtlSubmitSync(pVdma, &Ctl, VBVAEXHOSTCTL_SOURCE_HOST_ANY);
@@ -1930,11 +1898,13 @@ int vboxVDMAReset(struct VBOXVDMAHOST *pVdma)
         WARN(("vdmaVBVACtlSubmitSync failed %d\n", rc));
         return rc;
     }
+#endif
     return VINF_SUCCESS;
 }
 
 int vboxVDMADestruct(struct VBOXVDMAHOST *pVdma)
 {
+#ifdef VBOX_WITH_CRHGSMI
     VBVAEXHOSTCTL Ctl;
     Ctl.enmType = VBVAEXHOSTCTL_TYPE_HH_TERM;
     int rc = vdmaVBVACtlSubmitSync(pVdma, &Ctl, VBVAEXHOSTCTL_SOURCE_HOST_ANY);
@@ -1945,6 +1915,7 @@ int vboxVDMADestruct(struct VBOXVDMAHOST *pVdma)
     }
     VBoxVDMAThreadTerm(&pVdma->Thread);
     VBoxVBVAExHSTerm(&pVdma->CmdVbva);
+#endif
     RTMemFree(pVdma);
     return VINF_SUCCESS;
 }
@@ -1999,7 +1970,6 @@ int vboxVDMASaveStateExecDone(struct VBOXVDMAHOST *pVdma, PSSMHANDLE pSSM)
 
 void vboxVDMAControl(struct VBOXVDMAHOST *pVdma, PVBOXVDMA_CTL pCmd, uint32_t cbCmd)
 {
-#if 1
     PHGSMIINSTANCE pIns = pVdma->pHgsmi;
 
     switch (pCmd->enmCtl)
@@ -2019,40 +1989,12 @@ void vboxVDMAControl(struct VBOXVDMAHOST *pVdma, PVBOXVDMA_CTL pCmd, uint32_t cb
             break;
 #endif
         default:
-            AssertBreakpoint();
+            WARN(("cmd not supported"));
             pCmd->i32Result = VERR_NOT_SUPPORTED;
     }
 
     int rc = VBoxSHGSMICommandComplete (pIns, pCmd);
     AssertRC(rc);
-#else
-    /* test asinch completion */
-    VBOXVDMACMD_SUBMIT_CONTEXT Context;
-    Context.pVdma = pVdma;
-    Context.Cmd.enmType = VBOXVDMAPIPE_CMD_TYPE_DMACTL;
-    Context.Cmd.u.pCtl = pCmd;
-
-    int rc = vboxVDMAPipeModifyClient(&pVdma->Pipe, vboxVDMACommandSubmitCb, &Context);
-    AssertRC(rc);
-    if (RT_SUCCESS(rc))
-    {
-        Assert(Context.bQueued);
-        if (Context.bQueued)
-        {
-            /* success */
-            return;
-        }
-        rc = VERR_OUT_OF_RESOURCES;
-    }
-
-    /* failure */
-    Assert(RT_FAILURE(rc));
-    PHGSMIINSTANCE pIns = pVdma->pHgsmi;
-    pCmd->i32Result = rc;
-    int tmpRc = VBoxSHGSMICommandComplete (pIns, pCmd);
-    AssertRC(tmpRc);
-
-#endif
 }
 
 void vboxVDMACommand(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DR pCmd, uint32_t cbCmd)
@@ -2073,44 +2015,17 @@ void vboxVDMACommand(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DR pCmd, uint32_t
         AssertRC(rc);
         return;
     }
-#endif
 
-#ifndef VBOX_VDMA_WITH_WORKERTHREAD
     vboxVDMACommandProcess(pVdma, pCmd, cbCmd);
 #else
-
-# ifdef DEBUG_misha
-    Assert(0);
-# endif
-
-    VBOXVDMACMD_SUBMIT_CONTEXT Context;
-    Context.pVdma = pVdma;
-    Context.Cmd.enmType = VBOXVDMAPIPE_CMD_TYPE_DMACMD;
-    Context.Cmd.u.pDr = pCmd;
-
-    rc = vboxVDMAPipeModifyClient(&pVdma->Pipe, vboxVDMACommandSubmitCb, &Context);
-    AssertRC(rc);
-    if (RT_SUCCESS(rc))
-    {
-        Assert(Context.bQueued);
-        if (Context.bQueued)
-        {
-            /* success */
-            return;
-        }
-        rc = VERR_OUT_OF_RESOURCES;
-    }
-    /* failure */
-    Assert(RT_FAILURE(rc));
-    PHGSMIINSTANCE pIns = pVdma->pHgsmi;
     pCmd->rc = rc;
-    int tmpRc = VBoxSHGSMICommandComplete (pIns, pCmd);
-    AssertRC(tmpRc);
+    rc = VBoxSHGSMICommandComplete (pVdma->pHgsmi, pCmd);
+    AssertRC(rc);
 #endif
 }
 
 /**/
-
+#ifdef VBOX_WITH_CRHGSMI
 static int vdmaVBVACtlSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL* pCtl, VBVAEXHOSTCTL_SOURCE enmSource, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)
 {
     int rc = VBoxVBVAExHCtlSubmit(&pVdma->CmdVbva, pCtl, enmSource, pfnComplete, pvComplete);
@@ -2382,3 +2297,5 @@ void vboxCmdVBVACmdTimer(PVGASTATE pVGAState)
         return;
     vboxVDMACmdSubmitPerform(pVGAState->pVdma);
 }
+
+#endif
diff --git a/src/VBox/Devices/Network/slirp/bootp.c b/src/VBox/Devices/Network/slirp/bootp.c
index 6cf126b..cf2dce1 100644
--- a/src/VBox/Devices/Network/slirp/bootp.c
+++ b/src/VBox/Devices/Network/slirp/bootp.c
@@ -341,7 +341,9 @@ static int dhcp_do_ack_offer(PNATState pData, struct mbuf *m, BOOTPClient *bc, i
         val = (int)strlen(slirp_hostname);
         FILL_BOOTP_EXT(q, RFC1533_HOSTNAME, val, slirp_hostname);
     }
-    slirp_arp_cache_update_or_add(pData, rbp->bp_yiaddr.s_addr, bc->macaddr);
+    /* Temporary fix: do not pollute ARP cache from BOOTP because it may result
+       in network loss due to cache entry override w/ invalid MAC address. */
+    //slirp_arp_cache_update_or_add(pData, rbp->bp_yiaddr.s_addr, bc->macaddr);
     return q - rbp->bp_vend; /*return offset */
 }
 
@@ -528,11 +530,15 @@ static int dhcp_decode_request(PNATState pData, struct bootp_t *bp, struct mbuf
                 return offReply;
             }
 
-            bc = bc_alloc_client(pData);
+            /* find_addr() got some result? */
             if (!bc)
             {
-                LogRel(("NAT: can't alloc address. RENEW has been silently ignored\n"));
-                return -1;
+                bc = bc_alloc_client(pData);
+                if (!bc)
+                {
+                    LogRel(("NAT: can't alloc address. RENEW has been silently ignored\n"));
+                    return -1;
+                }
             }
             Assert((bp->bp_hlen == ETH_ALEN));
             memcpy(bc->macaddr, bp->bp_hwaddr, bp->bp_hlen);
diff --git a/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c b/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c
index ca69bdf..02351aa 100644
--- a/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c
+++ b/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c
@@ -120,9 +120,8 @@ timeout(PNATState pData, struct socket *so, void *arg)
     /* be paranoid */
     AssertPtrReturnVoid(arg);
 
-    de = TAILQ_PREV(req->dns_server, dns_list_head, de_list);
-
-    if (de == NULL)
+    if (   req->dns_server == NULL
+        || (de = TAILQ_PREV(req->dns_server, dns_list_head, de_list)) == NULL)
     {
         hash_remove_request(pData, req);
         RTMemFree(req);
diff --git a/src/VBox/Devices/Network/slirp/ip_icmp.c b/src/VBox/Devices/Network/slirp/ip_icmp.c
index b760cdd..be72a00 100644
--- a/src/VBox/Devices/Network/slirp/ip_icmp.c
+++ b/src/VBox/Devices/Network/slirp/ip_icmp.c
@@ -599,158 +599,120 @@ done:
  * Send ICMP_UNREACH back to the source regarding msrc.
  * It is reported as the bad ip packet.  The header should
  * be fully correct and in host byte order.
- * ICMP fragmentation is illegal.  All machines must accept 576 bytes in one
- * packet.  The maximum payload is 576-20(ip hdr)-8(icmp hdr)=548
- * @note: implementation note: MSIZE is 256 bytes (minimal buffer), m_getjcl we allocate two mbufs on: clust_zone 
- * and mbuf_zone. the maximum payload 256 - 14 (Ethernet header) - 20 (IPv4 hdr) - 8 (ICMPv4 header) = 214
+ * ICMP fragmentation is illegal.
+ *
+ * @note: implementation note: MSIZE is 256 bytes (minimal buffer).
+ * We always truncate original payload to 8 bytes required by the RFC,
+ * so the largest possible datagram is 14 (ethernet) + 20 (ip) +
+ * 8 (icmp) + 60 (max original ip with options) + 8 (original payload)
+ * = 110 bytes which fits into sinlge mbuf.
  *
  * @note This function will free msrc!
  */
 
 void icmp_error(PNATState pData, struct mbuf *msrc, u_char type, u_char code, int minsize, const char *message)
 {
-    unsigned hlen, shlen, s_ip_len;
-    register struct ip *ip;
-    register struct icmp *icp;
-    register struct mbuf *m;
-    int new_ip_size = 0;
-    int new_m_size = 0;
-    int size = 0;
+    unsigned ohlen, olen;
+    struct mbuf *m;
+    struct ip *oip, *ip;
+    struct icmp *icp;
+    void *payload;
+
+    LogFlow(("icmp_error: msrc = %p, msrc_len = %d\n",
+             (void *)msrc, msrc ? msrc->m_len : 0));
+
+    if (RT_UNLIKELY(msrc == NULL))
+        goto end_error;
 
-    LogFlow(("icmp_error: msrc = %lx, msrc_len = %d\n", (long)msrc, msrc ? msrc->m_len : 0));
-    if (msrc != NULL)
-        M_ASSERTPKTHDR(msrc);
+    M_ASSERTPKTHDR(msrc);
 
     if (   type != ICMP_UNREACH
         && type != ICMP_TIMXCEED
         && type != ICMP_SOURCEQUENCH)
         goto end_error;
 
-    /* check msrc */
-    if (!msrc)
-        goto end_error;
-
-    ip = mtod(msrc, struct ip *);
-    LogFunc(("msrc: %RTnaipv4 -> %RTnaipv4\n", ip->ip_src, ip->ip_dst));
+    oip = mtod(msrc, struct ip *);
+    LogFunc(("msrc: %RTnaipv4 -> %RTnaipv4\n", oip->ip_src, oip->ip_dst));
 
-    /* if source IP datagram hasn't got src address don't bother with sending ICMP error */
-    if (ip->ip_src.s_addr == INADDR_ANY)
+    if (oip->ip_src.s_addr == INADDR_ANY)
         goto end_error;
 
-    if (   ip->ip_off & IP_OFFMASK
-        && type != ICMP_SOURCEQUENCH)
+    if (oip->ip_off & IP_OFFMASK)
         goto end_error;    /* Only reply to fragment 0 */
 
-    shlen = ip->ip_hl << 2;
-    s_ip_len = ip->ip_len;
-    if (ip->ip_p == IPPROTO_ICMP)
+    ohlen = oip->ip_hl * 4;
+    AssertStmt(ohlen >= sizeof(struct ip), goto end_error);
+
+    olen = oip->ip_len;
+    AssertStmt(olen >= ohlen, goto end_error);
+
+    if (oip->ip_p == IPPROTO_ICMP)
     {
-        icp = (struct icmp *)((char *)ip + shlen);
+        struct icmp *oicp = (struct icmp *)((char *)oip + ohlen);
         /*
          *  Assume any unknown ICMP type is an error. This isn't
          *  specified by the RFC, but think about it..
          */
-        if (icp->icmp_type>18 || icmp_flush[icp->icmp_type])
+        if (oicp->icmp_type > ICMP_MAXTYPE || icmp_flush[oicp->icmp_type])
             goto end_error;
     }
 
+    /* undo byte order conversions done in ip_input() */
+    HTONS(oip->ip_len);
+    HTONS(oip->ip_id);
+    HTONS(oip->ip_off);
+
     m = m_gethdr(pData, M_NOWAIT, MT_HEADER);
-    if (!m)
+    if (RT_UNLIKELY(m == NULL))
         goto end_error;
 
     m->m_flags |= M_SKIP_FIREWALL;
     m->m_data += if_maxlinkhdr;
-    m->m_pkthdr.header = mtod(m, void *);
 
-    memcpy(m->m_pkthdr.header, ip, shlen); /* initialize respond IP header with data from original one. */
+    ip = mtod(m, struct ip *);
+    m->m_pkthdr.header = (void *)ip;
 
-    ip   = mtod(m, struct ip *); /* ip points to new IP header */
-    hlen = sizeof(struct ip);  /* trim the IP header no options in reply */
+    /* fill in ip (ip_output0() does the boilerplate for us) */
+    ip->ip_tos = ((oip->ip_tos & 0x1E) | 0xC0);  /* high priority for errors */
+    /* ip->ip_len will be set later */
+    ip->ip_off = 0;
+    ip->ip_ttl = MAXTTL;
+    ip->ip_p = IPPROTO_ICMP;
+    ip->ip_src = alias_addr;
+    ip->ip_dst = oip->ip_src;
 
     /* fill in icmp */
-    m->m_data += hlen; /* shifts m_data to ICMP header */
-    icp = mtod(m, struct icmp *); /* _icp_: points to the ICMP header */
-    m->m_data += RT_OFFSETOF(struct icmp, icmp_ip); /* shifts m_data to IP header payload */
-
+    icp = (struct icmp *)((char *)ip + sizeof(*ip));
     icp->icmp_type = type;
     icp->icmp_code = code;
     icp->icmp_id = 0;
     icp->icmp_seq = 0;
 
-    HTONS(icp->icmp_ip.ip_len);
-    HTONS(icp->icmp_ip.ip_id);
-    HTONS(icp->icmp_ip.ip_off);
-
-    memcpy(mtod(m, void *), mtod(msrc, void *), shlen);  /* copy original IP header (with options) */
-    msrc->m_data += shlen; /* _msrc_: shifts m_data of original mbuf to the end of original IP header */
-    msrc->m_len -= shlen; /* _msrc_: alter m_len to size of original IP datagram payload */
-    m->m_data += shlen; /* _m_: shifts m_data to the end of reported IP datagram */
-    /* initialize reported payload of original datagram  with MUST size RFC792 or with rest of allocated mbuf */
-    s_ip_len = minsize ? 8 : M_TRAILINGSPACE(m);
-    /* trims original IP datagram's payload to the lenght of its mbuf size or already reserved space if it's smaller */
-    s_ip_len = RT_MIN(s_ip_len, msrc->m_len);
-    memcpy(mtod(m, void *), mtod(msrc, void *), s_ip_len);
-
-#if DEBUG
-    if (message)
-    {
+    /* fill in icmp payload: original ip header plus 8 bytes of its payload */
+    if (olen > ohlen + 8)
+        olen = ohlen + 8;
+    payload = (void *)((char *)icp + ICMP_MINLEN);
+    memcpy(payload, oip, olen);
 
-        size_t message_len;
-        /**
-         * Trim reported payload to first eight bytes (RFC792) to let sniffering tools do
-         * their audit duties, and add hint message to the tail of mandatory piece.
-         */
-        s_ip_len = 8;
-        /**
-         * _m_: shifts m_data to the end of mandatory 8b piece to let M_TRAILINGSPACE
-         * to returns available space with counting mandatory region.
-         */
-        m->m_data += s_ip_len;
-        message_len = strlen(message);
-        if (message_len > M_TRAILINGSPACE(m))
-            message_len = M_TRAILINGSPACE(m);
-   
-        /**
-         * m->m_data points to the end of 8 bytes payload, and m->m_len is length of appended 
-         * message.
-         */
-        m_append(pData, m, (int)message_len, message);
-        m->m_data -= s_ip_len; /* now we're ready for further processing, with pointing to mandatory payload */
-    }
-#else
+    /*
+     * Original code appended this message after the payload.  This
+     * might have been a good idea for real slirp, as it provided a
+     * communication channel with the remote host.  But 90s are over.
+     */
     NOREF(message);
-#endif
-    
-    m->m_data -= shlen + RT_OFFSETOF(struct icmp, icmp_ip); /* _m_: shifts m_data to the start of ICMP header */
-    m->m_len += s_ip_len + shlen + RT_OFFSETOF(struct icmp, icmp_ip); /* _m_: m_len counts bytes in IP payload */
 
-    /**
-     * It asserts if calculation above is wrong. 
-     */
-    Assert(icp == mtod(m, struct icmp*));
+    /* hide ip header for icmp checksum calculation */
+    m->m_data += sizeof(struct ip);
+    m->m_len = ICMP_MINLEN + /* truncated */ olen;
 
     icp->icmp_cksum = 0;
     icp->icmp_cksum = cksum(m, m->m_len);
 
-    /* fill in ip */
-    ip->ip_hl = hlen >> 2;
+    /* reveal ip header */
+    m->m_data -= sizeof(struct ip);
+    m->m_len += sizeof(struct ip);
     ip->ip_len = m->m_len;
 
-    ip->ip_tos = ((ip->ip_tos & 0x1E) | 0xC0);  /* high priority for errors */
-
-    ip->ip_ttl = MAXTTL;
-    ip->ip_p = IPPROTO_ICMP;
-    ip->ip_dst = ip->ip_src;    /* ip adresses */
-    ip->ip_src = alias_addr;
-
-    /* returns pointer back. */
-    m->m_data -= hlen;
-    m->m_len  += hlen;
-    
-    /**
-     * paranoid. if something goes wrong previous assert should be triggered.
-     */
-    Assert(ip == mtod(m, struct ip*));
     (void) ip_output0(pData, (struct socket *)NULL, m, 1);
 
     icmpstat.icps_reflect++;
diff --git a/src/VBox/Devices/Network/slirp/libalias/alias_db.c b/src/VBox/Devices/Network/slirp/libalias/alias_db.c
index 98a9c54..d75c862 100644
--- a/src/VBox/Devices/Network/slirp/libalias/alias_db.c
+++ b/src/VBox/Devices/Network/slirp/libalias/alias_db.c
@@ -1003,7 +1003,8 @@ IncrementalCleanup(struct libalias *la)
         la->cleanupIndex = 0;
 }
 
-#ifdef VBOX
+#if defined(VBOX) && !defined(NO_USE_SOCKETS)
+
 /**
  * when slirp delete the link we need inform libalias about it.
  */
@@ -1020,13 +1021,17 @@ void slirpDeleteLinkSocket(void *pvLnk)
         lnk->pSo = NULL;
     }
 }
-#endif /* !VBOX */
+#endif /* VBOX && !NO_USE_SOCKETS */
 
 static void
 DeleteLink(struct alias_link *lnk)
 {
     struct libalias *la = lnk->la;
+#ifndef NO_USE_SOCKETS
     LogFlowFunc(("ENTER: lnk->pSo:%R[natsock]\n", lnk->pSo));
+#else
+    LogFlowFuncEnter();
+#endif
 
     LIBALIAS_LOCK_ASSERT(la);
 /* Don't do anything if the link is marked permanent */
diff --git a/src/VBox/Devices/Network/slirp/resolv_conf_parser.h b/src/VBox/Devices/Network/slirp/resolv_conf_parser.h
index 21353fe..ca322b9 100644
--- a/src/VBox/Devices/Network/slirp/resolv_conf_parser.h
+++ b/src/VBox/Devices/Network/slirp/resolv_conf_parser.h
@@ -1,6 +1,6 @@
 /* $Id: resolv_conf_parser.h $ */
 /** @file
- * resolv_conf_parser.h - interface to parser of resolv.conf resolver(5) 
+ * resolv_conf_parser.h - interface to parser of resolv.conf resolver(5)
  */
 
 /*
diff --git a/src/VBox/Devices/Network/slirp/slirp.c b/src/VBox/Devices/Network/slirp/slirp.c
index 2a7ecfd..cf8cd12 100644
--- a/src/VBox/Devices/Network/slirp/slirp.c
+++ b/src/VBox/Devices/Network/slirp/slirp.c
@@ -1594,7 +1594,7 @@ int slirp_remove_redirect(PNATState pData, int is_udp, struct in_addr host_addr,
             && rule->activated)
         {
             LogRel(("NAT: remove redirect %s host port %d => guest port %d @ %RTnaipv4\n",
-                   rule->proto == IPPROTO_UDP ? "UDP" : "TCP", rule->host_port, rule->guest_port, guest_addr));
+                   rule->proto == IPPROTO_UDP ? "UDP" : "TCP", rule->host_port, rule->guest_port, guest_addr.s_addr));
 
             LibAliasUninit(rule->so->so_la);
             if (is_udp)
diff --git a/src/VBox/Devices/Network/slirp/slirp.h b/src/VBox/Devices/Network/slirp/slirp.h
index 7b5a06a..dde76a4 100644
--- a/src/VBox/Devices/Network/slirp/slirp.h
+++ b/src/VBox/Devices/Network/slirp/slirp.h
@@ -392,6 +392,8 @@ int sscanf(const char *s, const char *format, ...);
 # define bcopy(src, dst, len) memcpy((dst), (src), (len))
 # define bcmp(a1, a2, len) memcmp((a1), (a2), (len))
 # define NO_FW_PUNCH
+/* Two wrongs don't make a right, but this at least averts harm. */
+# define NO_USE_SOCKETS
 
 # ifdef alias_addr
 #  ifndef VBOX_SLIRP_BSD
diff --git a/src/VBox/Devices/Network/slirp/socket.c b/src/VBox/Devices/Network/slirp/socket.c
index d1e7e2a..8f01198 100644
--- a/src/VBox/Devices/Network/slirp/socket.c
+++ b/src/VBox/Devices/Network/slirp/socket.c
@@ -203,9 +203,12 @@ sofree(PNATState pData, struct socket *so)
     else if (so == udp_last_so)
         udp_last_so = &udb;
 
+#if 0 /* XXX: !defined(NO_USE_SOCKETS) */
     /* libalias notification */
     if (so->so_pvLnk)
         slirpDeleteLinkSocket(so->so_pvLnk);
+#endif
+
     /* check if mbuf haven't been already freed  */
     if (so->so_m != NULL)
     {
diff --git a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm
index 068c36e..f2d0778 100644
--- a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm
+++ b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm
@@ -965,7 +965,7 @@ section CONST progbits vstart=0xb0 align=1 ; size=0xcf8 class=DATA group=DGROUP
 
 section CONST2 progbits vstart=0xda8 align=1 ; size=0x3fa class=DATA group=DGROUP
 _bios_cvs_version_string:                    ; 0xf0da8 LB 0x12
-    db  'VirtualBox 4.3.10', 000h
+    db  'VirtualBox 4.3.12', 000h
 _bios_prefix_string:                         ; 0xf0dba LB 0x8
     db  'BIOS: ', 000h, 000h
 _isotag:                                     ; 0xf0dc2 LB 0x6
@@ -16025,4 +16025,4 @@ dummy_iret:                                  ; 0xfff53 LB 0x9d
     db  'XM'
 cpu_reset:                                   ; 0xffff0 LB 0x10
     jmp far 0f000h:0e05bh                     ; ea 5b e0 00 f0
-    db  030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 026h
+    db  030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 024h
diff --git a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum
index 3de9199..99f1982 100644
--- a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum
+++ b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum
@@ -1 +1 @@
-bb8dc7f1c69895d10cad2dadc4306b6d *VBoxPcBios.rom
+aa8db86fdc9998cff85c064af381499f *VBoxPcBios.rom
diff --git a/src/VBox/Devices/Storage/DevAHCI.cpp b/src/VBox/Devices/Storage/DevAHCI.cpp
index 50b0ca8..1001db5 100644
--- a/src/VBox/Devices/Storage/DevAHCI.cpp
+++ b/src/VBox/Devices/Storage/DevAHCI.cpp
@@ -1174,23 +1174,27 @@ static int PortSControl_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32
 #else
     if ((u32Value & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_INIT)
     {
-        bool fAllTasksCanceled;
-
-        /* Cancel all tasks first. */
-        fAllTasksCanceled = ahciCancelActiveTasks(pAhciPort);
-        Assert(fAllTasksCanceled);
-
         if (!ASMAtomicXchgBool(&pAhciPort->fPortReset, true))
             LogRel(("AHCI#%u: Port %d reset\n", ahci->CTX_SUFF(pDevIns)->iInstance,
                     pAhciPort->iLUN));
 
+        /* Make sure the async I/O thread is not working before we start to cancel active requests. */
+        while (   pAhciPort->u32TasksNew
+               || !pAhciPort->fWrkThreadSleeping)
+            RTThreadYield();
+
+        /* Cancel all tasks first. */
+        bool fAllTasksCanceled = ahciCancelActiveTasks(pAhciPort);
+        Assert(fAllTasksCanceled);
+
         pAhciPort->regSSTS = 0;
         pAhciPort->regSIG  = ~0;
         pAhciPort->regTFD  = 0x7f;
         pAhciPort->fFirstD2HFisSend = false;
     }
-    else if ((u32Value & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_NINIT && pAhciPort->pDrvBase &&
-             (pAhciPort->regSCTL & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_INIT)
+    else if (   (u32Value & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_NINIT
+             && (pAhciPort->regSCTL & AHCI_PORT_SCTL_DET) == AHCI_PORT_SCTL_DET_INIT
+             && pAhciPort->pDrvBase)
     {
         if (pAhciPort->pDrvBase)
         {
@@ -1237,7 +1241,7 @@ static int PortSControl_w(PAHCI ahci, PAHCIPort pAhciPort, uint32_t iReg, uint32
                     AssertRC(rc);
                 }
             }
-       }
+        }
     }
 
     pAhciPort->regSCTL = u32Value;
@@ -6533,7 +6537,8 @@ static DECLCALLBACK(int) ahciAsyncIOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
         }
 
         idx = ASMBitFirstSetU32(u32Tasks);
-        while (idx)
+        while (   idx
+               && !pAhciPort->fPortReset)
         {
             bool fReqCanceled = false;
             AHCITXDIR enmTxDir;
@@ -7691,6 +7696,7 @@ static DECLCALLBACK(void) ahciR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32
             AssertMsgFailed(("%s Failed to destroy async IO thread rc=%Rrc rcThread=%Rrc\n", __FUNCTION__, rc, rcThread));
 
         pAhciPort->pAsyncIOThread = NULL;
+        pAhciPort->fWrkThreadSleeping = true;
     }
 
     if (pAhciPort->fATAPI)
@@ -8232,6 +8238,7 @@ static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
         pAhciPort->IPort.pfnQueryDeviceLocation         = ahciR3PortQueryDeviceLocation;
         pAhciPort->IMountNotify.pfnMountNotify          = ahciR3MountNotify;
         pAhciPort->IMountNotify.pfnUnmountNotify        = ahciR3UnmountNotify;
+        pAhciPort->fWrkThreadSleeping                   = true;
 
         /*
          * Attach the block driver
diff --git a/src/VBox/Devices/VMMDev/VMMDev.cpp b/src/VBox/Devices/VMMDev/VMMDev.cpp
index 918b5b0..a0c021b 100644
--- a/src/VBox/Devices/VMMDev/VMMDev.cpp
+++ b/src/VBox/Devices/VMMDev/VMMDev.cpp
@@ -3663,6 +3663,8 @@ static DECLCALLBACK(int) vmmdevDestruct(PPDMDEVINS pDevIns)
         pThis->pCredentials = NULL;
     }
 
+    vmmdevHGCMDestroy(pThis);
+
 #ifndef VBOX_WITHOUT_TESTING_FEATURES
     /*
      * Clean up the testing device.
diff --git a/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp b/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
index ca942b1..d495599 100644
--- a/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
+++ b/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
@@ -92,9 +92,6 @@ struct VBOXHGCMCMD
     /** Whether the command is in the active commands list. */
     bool fInList;
 
-    /** Whether the command was saved. */
-    bool fSaved;
-
     /** GC physical address of the guest request. */
     RTGCPHYS        GCPhys;
 
@@ -808,23 +805,21 @@ int vmmdevHGCMCall (PVMMDEV pThis, VMMDevHGCMCall *pHGCMCall, uint32_t cbHGCMCal
         return rc;
     }
 
-    PVBOXHGCMCMD pCmd = (PVBOXHGCMCMD)RTMemAlloc (cbCmdSize);
+    PVBOXHGCMCMD pCmd = (PVBOXHGCMCMD)RTMemAllocZ(cbCmdSize);
 
     if (pCmd == NULL)
     {
         return VERR_NO_MEMORY;
     }
 
-    memset (pCmd, 0, sizeof (*pCmd));
-
     pCmd->paHostParms = NULL;
     pCmd->cLinPtrs    = cLinPtrs;
     pCmd->cLinPtrPages = cLinPtrPages;
 
     if (cLinPtrs > 0)
     {
-        pCmd->paLinPtrs = (VBOXHGCMLINPTR *)RTMemAlloc (  sizeof (VBOXHGCMLINPTR) * cLinPtrs
-                                                          + sizeof (RTGCPHYS) * cLinPtrPages);
+        pCmd->paLinPtrs = (VBOXHGCMLINPTR *)RTMemAllocZ(  sizeof (VBOXHGCMLINPTR) * cLinPtrs
+                                                        + sizeof (RTGCPHYS) * cLinPtrPages);
 
         if (pCmd->paLinPtrs == NULL)
         {
@@ -1955,9 +1950,9 @@ DECLCALLBACK(void) hgcmCompletedWorker (PPDMIHGCMPORT pInterface, int32_t result
     VBOXDD_HGCMCALL_COMPLETED_EMT(pCmd, result);
     vmmdevHGCMRemoveCommand (pThis, pCmd);
 
-    if (pCmd->fCancelled || pCmd->fSaved)
+    if (pCmd->fCancelled)
     {
-        LogFlowFunc(("A cancelled command %p: %d %d\n", pCmd, pCmd->fCancelled, pCmd->fSaved));
+        LogFlowFunc(("A cancelled command %p: %d\n", pCmd, pCmd->fCancelled));
     }
     else
     {
@@ -2507,12 +2502,6 @@ int vmmdevHGCMSaveState(PVMMDEV pThis, PSSMHANDLE pSSM)
             rc = SSMR3PutU32(pSSM, 0);
             AssertRCReturn(rc, rc);
 
-            /* Mark the command as saved to make sure that it will not be
-             * completed later by a still running host service.
-             */
-            pIter->fSaved = true;
-            vmmdevHGCMRemoveCommand (pThis, pIter);
-
             pIter = pNext;
         }
     }
@@ -2987,3 +2976,25 @@ int vmmdevHGCMLoadStateDone(PVMMDEV pThis, PSSMHANDLE pSSM)
 
     return rc;
 }
+
+void vmmdevHGCMDestroy(PVMMDEV pThis)
+{
+    LogFlowFunc(("\n"));
+
+    PVBOXHGCMCMD pIter = pThis->pHGCMCmdList;
+
+    while (pIter)
+    {
+        PVBOXHGCMCMD pNext = pIter->pNext;
+
+        vmmdevHGCMRemoveCommand(pThis, pIter);
+
+        /* Deallocate the command memory. */
+        RTMemFree(pIter->paLinPtrs);
+        RTMemFree(pIter);
+
+        pIter = pNext;
+    }
+
+    return;
+}
diff --git a/src/VBox/Devices/VMMDev/VMMDevHGCM.h b/src/VBox/Devices/VMMDev/VMMDevHGCM.h
index 6ec1cd3..dd6999a 100644
--- a/src/VBox/Devices/VMMDev/VMMDevHGCM.h
+++ b/src/VBox/Devices/VMMDev/VMMDevHGCM.h
@@ -32,6 +32,8 @@ DECLCALLBACK(void) hgcmCompleted (PPDMIHGCMPORT pInterface, int32_t result, PVBO
 int vmmdevHGCMSaveState(VMMDevState *pVMMDevState, PSSMHANDLE pSSM);
 int vmmdevHGCMLoadState(VMMDevState *pVMMDevState, PSSMHANDLE pSSM, uint32_t u32Version);
 int vmmdevHGCMLoadStateDone(VMMDevState *pVMMDevState, PSSMHANDLE pSSM);
+
+void vmmdevHGCMDestroy(PVMMDEV pThis);
 RT_C_DECLS_END
 
 #endif /* !___VMMDev_VMMDevHGCM_h */
diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
index 53e49b7..277d248 100644
--- a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
+++ b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
@@ -743,13 +743,23 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
      * gets inactive, that is KeyPress and KeyRelease are sent when pressing the lock key
      * to change the mode. The current lock mode is reflected in SDL_GetModState().
      *
-     * Debian patched libSDL to make the lock keys behave like normal keys generating a
-     * KeyPress/KeyRelease event if the lock key was pressed/released. But the lock status
-     * is not reflected in the mod status anymore. We disable the Debian-specific extension
-     * to ensure a defined environment and work around the missing KeyPress/KeyRelease
-     * events in ProcessKeys().
+     * Debian patched libSDL to make the lock keys behave like normal keys
+     * generating a KeyPress/KeyRelease event if the lock key was
+     * pressed/released.  With the new behaviour, the lock status is not
+     * reflected in the mod status anymore, but the user can request the old
+     * behaviour by setting an environment variable.  To confuse matters further
+     * version 1.2.14 (fortunately including the Debian packaged versions)
+     * adopted the Debian behaviour officially, but inverted the meaning of the
+     * environment variable to select the new behaviour, keeping the old as the
+     * default.  We disable the new behaviour to ensure a defined environment
+     * and work around the missing KeyPress/KeyRelease events in ProcessKeys().
      */
-    RTEnvSet("SDL_DISABLE_LOCK_KEYS", "1");
+    {
+        const SDL_version *pVersion = SDL_Linked_Version();
+        if (  SDL_VERSIONNUM(pVersion->major, pVersion->minor, pVersion->patch)
+            < SDL_VERSIONNUM(1, 2, 14))
+            RTEnvSet("SDL_DISABLE_LOCK_KEYS", "1");
+    }
 #endif
 
     /*
diff --git a/src/VBox/Frontends/VirtualBox/Makefile.kmk b/src/VBox/Frontends/VirtualBox/Makefile.kmk
index a1c3a0f..6273212 100644
--- a/src/VBox/Frontends/VirtualBox/Makefile.kmk
+++ b/src/VBox/Frontends/VirtualBox/Makefile.kmk
@@ -107,6 +107,7 @@ VirtualBox_DEFS          += \
 	$(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO) \
 	$(if $(VBOX_WITH_WDDM),VBOX_WITH_WDDM) \
 	$(if $(VBOX_WITH_CROGL),VBOX_WITH_CROGL) \
+	$(if $(VBOX_GUI_WITH_HIDPI),VBOX_GUI_WITH_HIDPI) \
 	$(if $(VBOX_GUI_WITH_PIDFILE),VBOX_GUI_WITH_PIDFILE) \
 	$(if $(VBOX_GUI_WITH_KEYS_RESET_HANDLER),VBOX_GUI_WITH_KEYS_RESET_HANDLER) \
 	$(if $(VBOX_GUI_WITH_CUSTOMIZATIONS1),VBOX_GUI_WITH_CUSTOMIZATIONS1)
diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
index 0425bf1..0e09034 100644
--- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
+++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
@@ -76,6 +76,8 @@ template<> bool canConvert<GlobalSettingsPageType>();
 template<> bool canConvert<MachineSettingsPageType>();
 template<> bool canConvert<IndicatorType>();
 template<> bool canConvert<MachineCloseAction>();
+template<> bool canConvert<GuruMeditationHandlerType>();
+template<> bool canConvert<HiDPIOptimizationType>();
 
 /* Declare COM canConvert specializations: */
 template<> bool canConvert<KMachineState>();
@@ -139,6 +141,10 @@ template<> QString toInternalString(const IndicatorType &indicatorType);
 template<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType);
 template<> QString toInternalString(const MachineCloseAction &machineCloseAction);
 template<> MachineCloseAction fromInternalString<MachineCloseAction>(const QString &strMachineCloseAction);
+template<> QString toInternalString(const GuruMeditationHandlerType &guruMeditationHandlerType);
+template<> GuruMeditationHandlerType fromInternalString<GuruMeditationHandlerType>(const QString &strGuruMeditationHandlerType);
+template<> QString toInternalString(const HiDPIOptimizationType &optimizationType);
+template<> HiDPIOptimizationType fromInternalString<HiDPIOptimizationType>(const QString &strOptimizationType);
 
 /* Declare COM conversion specializations: */
 template<> QColor toColor(const KMachineState &state);
diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
index 0ff5300..6f71e29 100644
--- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
@@ -49,6 +49,8 @@ template<> bool canConvert<GlobalSettingsPageType>() { return true; }
 template<> bool canConvert<MachineSettingsPageType>() { return true; }
 template<> bool canConvert<IndicatorType>() { return true; }
 template<> bool canConvert<MachineCloseAction>() { return true; }
+template<> bool canConvert<GuruMeditationHandlerType>() { return true; }
+template<> bool canConvert<HiDPIOptimizationType>() { return true; }
 
 /* QString <= SizeSuffix: */
 template<> QString toString(const SizeSuffix &sizeSuffix)
@@ -1011,3 +1013,69 @@ template<> MachineCloseAction fromInternalString<MachineCloseAction>(const QStri
     return values.at(keys.indexOf(QRegExp(strMachineCloseAction, Qt::CaseInsensitive)));
 }
 
+/* QString <= GuruMeditationHandlerType: */
+template<> QString toInternalString(const GuruMeditationHandlerType &guruMeditationHandlerType)
+{
+    QString strResult;
+    switch (guruMeditationHandlerType)
+    {
+        case GuruMeditationHandlerType_Default:  strResult = "Default"; break;
+        case GuruMeditationHandlerType_PowerOff: strResult = "PowerOff"; break;
+        case GuruMeditationHandlerType_Ignore:   strResult = "Ignore"; break;
+        default:
+        {
+            AssertMsgFailed(("No text for indicator type=%d", guruMeditationHandlerType));
+            break;
+        }
+    }
+    return strResult;
+}
+
+/* GuruMeditationHandlerType <= QString: */
+template<> GuruMeditationHandlerType fromInternalString<GuruMeditationHandlerType>(const QString &strGuruMeditationHandlerType)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;   QList<GuruMeditationHandlerType> values;
+    keys << "Default";  values << GuruMeditationHandlerType_Default;
+    keys << "PowerOff"; values << GuruMeditationHandlerType_PowerOff;
+    keys << "Ignore";   values << GuruMeditationHandlerType_Ignore;
+    /* Default type for unknown words: */
+    if (!keys.contains(strGuruMeditationHandlerType, Qt::CaseInsensitive))
+        return GuruMeditationHandlerType_Default;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strGuruMeditationHandlerType, Qt::CaseInsensitive)));
+}
+
+/* QString <= HiDPIOptimizationType: */
+template<> QString toInternalString(const HiDPIOptimizationType &optimizationType)
+{
+    QString strResult;
+    switch (optimizationType)
+    {
+        case HiDPIOptimizationType_None:        strResult = "None"; break;
+        case HiDPIOptimizationType_Performance: strResult = "Performance"; break;
+        default:
+        {
+            AssertMsgFailed(("No text for type=%d", optimizationType));
+            break;
+        }
+    }
+    return strResult;
+}
+
+/* HiDPIOptimizationType <= QString: */
+template<> HiDPIOptimizationType fromInternalString<HiDPIOptimizationType>(const QString &strOptimizationType)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;      QList<HiDPIOptimizationType> values;
+    keys << "None";        values << HiDPIOptimizationType_None;
+    keys << "Performance"; values << HiDPIOptimizationType_Performance;
+    /* 'None' type for empty/unknown words: */
+    if (!keys.contains(strOptimizationType, Qt::CaseInsensitive))
+        return HiDPIOptimizationType_None;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strOptimizationType, Qt::CaseInsensitive)));
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
index b4c4cf8..19f961f 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
@@ -50,6 +50,10 @@ const char* UIDefs::GUI_PreventSnapshotOperations = "GUI/PreventSnapshotOperatio
 const char* UIDefs::GUI_HideDetails = "GUI/HideDetails";
 
 /* Machine-window definitions: */
+#ifndef Q_WS_MAC
+const char* UIDefs::GUI_MachineWindowIcons = "GUI/MachineWindowIcons";
+const char* UIDefs::GUI_MachineWindowNamePostfix = "GUI/MachineWindowNamePostfix";
+#endif /* !Q_WS_MAC */
 const char* UIDefs::GUI_RestrictedRuntimeMenus = "GUI/RestrictedRuntimeMenus";
 #ifdef Q_WS_MAC
 const char* UIDefs::GUI_RestrictedRuntimeApplicationMenuActions = "GUI/RestrictedRuntimeApplicationMenuActions";
@@ -79,6 +83,8 @@ const char* UIDefs::GUI_PassCAD = "GUI/PassCAD";
 const char* UIDefs::GUI_DefaultCloseAction = "GUI/DefaultCloseAction";
 const char* UIDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators";
 const char* UIDefs::GUI_HidLedsSync = "GUI/HidLedsSync";
+const char* UIDefs::GUI_GuruMeditationHandler = "GUI/GuruMeditationHandler";
+const char* UIDefs::GUI_HiDPIOptimization = "GUI/HiDPI/Optimization";
 
 /* Settings dialogs stuff: */
 const char* UIDefs::GUI_RestrictedGlobalSettingsPages = "GUI/RestrictedGlobalSettingsPages";
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
index 9f6b479..b1bd184 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
@@ -119,6 +119,10 @@ namespace UIDefs
     extern const char* GUI_HideDetails;
 
     /* Machine-window declarations: */
+#ifndef Q_WS_MAC
+    extern const char* GUI_MachineWindowIcons;
+    extern const char* GUI_MachineWindowNamePostfix;
+#endif /* !Q_WS_MAC */
     extern const char* GUI_RestrictedRuntimeMenus;
 #ifdef Q_WS_MAC
     extern const char* GUI_RestrictedRuntimeApplicationMenuActions;
@@ -148,6 +152,8 @@ namespace UIDefs
     extern const char* GUI_DefaultCloseAction;
     extern const char* GUI_RestrictedStatusBarIndicators;
     extern const char* GUI_HidLedsSync;
+    extern const char* GUI_GuruMeditationHandler;
+    extern const char* GUI_HiDPIOptimization;
 
     /* Settings dialogs stuff: */
     extern const char* GUI_RestrictedGlobalSettingsPages;
@@ -469,5 +475,20 @@ enum MachineCloseAction
 };
 Q_DECLARE_METATYPE(MachineCloseAction);
 
+/** Guru Meditation handler types. */
+enum GuruMeditationHandlerType
+{
+    GuruMeditationHandlerType_Default,
+    GuruMeditationHandlerType_PowerOff,
+    GuruMeditationHandlerType_Ignore
+};
+
+/** Runtime UI: HiDPI optimization types. */
+enum HiDPIOptimizationType
+{
+    HiDPIOptimizationType_None,
+    HiDPIOptimizationType_Performance
+};
+
 #endif /* !___UIDefs_h___ */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
index 7a450d2..671e786 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
@@ -185,13 +185,11 @@ static RenderMode vboxGetRenderMode (const char *aModeStr)
 {
     RenderMode mode = InvalidRenderMode;
 
-#if defined(Q_WS_MAC) && defined(VBOX_GUI_USE_QUARTZ2D)
-    mode = Quartz2DMode;
-#elif defined(VBOX_GUI_USE_QIMAGE)
+#ifdef VBOX_GUI_USE_QIMAGE
     mode = QImageMode;
-#else
+#else /* !VBOX_GUI_USE_QIMAGE */
 # error "Cannot determine the default render mode!"
-#endif
+#endif /* !VBOX_GUI_USE_QIMAGE */
 
     if (aModeStr)
     {
@@ -3770,6 +3768,35 @@ QList<MachineSettingsPageType> VBoxGlobal::restrictedMachineSettingsPages(CMachi
     return result;
 }
 
+#ifndef Q_WS_MAC
+/* static */
+QStringList VBoxGlobal::machineWindowIconNames(CMachine &machine)
+{
+    /* Return result: */
+    return machine.GetExtraDataStringList(GUI_MachineWindowIcons);
+}
+
+/* static */
+QString VBoxGlobal::machineWindowNamePostfix(CMachine &machine)
+{
+    return machine.GetExtraData(GUI_MachineWindowNamePostfix);
+}
+#endif /* !Q_WS_MAC */
+
+/* static */
+GuruMeditationHandlerType VBoxGlobal::guruMeditationHandlerType(CMachine &machine)
+{
+    /* Return result: */
+    return gpConverter->fromInternalString<GuruMeditationHandlerType>(machine.GetExtraData(GUI_GuruMeditationHandler));
+}
+
+/* static */
+HiDPIOptimizationType VBoxGlobal::hiDPIOptimizationType(CMachine &machine)
+{
+    /* Return result: */
+    return gpConverter->fromInternalString<HiDPIOptimizationType>(machine.GetExtraData(GUI_HiDPIOptimization));
+}
+
 #ifdef RT_OS_LINUX
 /* static */
 void VBoxGlobal::checkForWrongUSBMounted()
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
index 7a0a22a..1ce36c4 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
@@ -378,6 +378,16 @@ public:
     static MachineCloseAction restrictedMachineCloseActions(CMachine &machine);
     static QList<GlobalSettingsPageType> restrictedGlobalSettingsPages(CVirtualBox &vbox);
     static QList<MachineSettingsPageType> restrictedMachineSettingsPages(CMachine &machine);
+#ifndef Q_WS_MAC
+    /** Except Mac OS X: Loads redefined machine-window icon names. */
+    static QStringList machineWindowIconNames(CMachine &machine);
+    /** Except Mac OS X: Loads redefined machine-window name postfix. */
+    static QString machineWindowNamePostfix(CMachine &machine);
+#endif /* !Q_WS_MAC */
+    /** Loads redefined guru-meditation handler type. */
+    static GuruMeditationHandlerType guruMeditationHandlerType(CMachine &machine);
+    /** Loads Runtime UI HiDPI optimization type. */
+    static HiDPIOptimizationType hiDPIOptimizationType(CMachine &machine);
 
 #ifdef RT_OS_LINUX
     static void checkForWrongUSBMounted();
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
index ee4de12..e8362e8 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
@@ -559,6 +559,25 @@ QString UIMedium::nullID()
     return m_sstrNullID;
 }
 
+/* static */
+bool UIMedium::isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium)
+{
+    /* Iterate till the root: */
+    UIMedium mediumIterator = medium;
+    do
+    {
+        /* Ignore medium if its hidden
+         * or attached to hidden machines only: */
+        if (mediumIterator.isHidden())
+            return true;
+        /* Move iterator to parent: */
+        mediumIterator = mediumIterator.parent();
+    }
+    while (!mediumIterator.isNull());
+    /* False by default: */
+    return false;
+}
+
 /**
  * Checks if m_noDiffs is filled in and does it if not.
  *
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h
index 85a2ccd..1ed6688 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h
@@ -224,6 +224,9 @@ public:
     /* Static API: Null medium ID: */
     static QString nullID();
 
+    /** Determines if passed @a medium attached to hidden machines only. */
+    static bool isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium);
+
 private:
 
     void checkNoDiffs(bool fNoDiffs);
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
index 0d66c24..6f0eb09 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
@@ -284,7 +284,7 @@ void UIMediumManager::sltHandleMediumCreated(const QString &strMediumID)
 
     /* Ignore mediums (and their children) which are
      * marked as hidden or attached to hidden machines only: */
-    if (isMediumAttachedToHiddenMachinesOnly(medium))
+    if (UIMedium::isMediumAttachedToHiddenMachinesOnly(medium))
         return;
 
     /* Prepare medium-item: */
@@ -419,7 +419,7 @@ void UIMediumManager::sltHandleMediumEnumerated(const QString &strMediumID)
 
     /* Ignore mediums (and their children) which are
      * marked as hidden or attached to hidden machines only: */
-    if (isMediumAttachedToHiddenMachinesOnly(medium))
+    if (UIMedium::isMediumAttachedToHiddenMachinesOnly(medium))
         return;
 
     /* Search for corresponding medium-item: */
@@ -1718,24 +1718,5 @@ QString UIMediumManager::formatPaneText(const QString &strText, bool fCompact /*
     return strInfo;
 }
 
-/* static */
-bool UIMediumManager::isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium)
-{
-    /* Iterate till the root: */
-    UIMedium mediumIterator = medium;
-    do
-    {
-        /* Ignore medium if its hidden
-         * or attached to hidden machines only: */
-        if (mediumIterator.isHidden())
-            return true;
-        /* Move iterator to parent: */
-        mediumIterator = mediumIterator.parent();
-    }
-    while (!mediumIterator.isNull());
-    /* False by default: */
-    return false;
-}
-
 #include "UIMediumManager.moc"
 
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
index ac25fa2..1047a33 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
@@ -156,9 +156,6 @@ private:
     /* Static helper: Formatting stuff: */
     static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
 
-    /* Static helper: Enumeration stuff: */
-    static bool isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium);
-
     /* Variable: Singleton instance: */
     static UIMediumManager *m_spInstance;
 
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
index 705c437..d9d01de 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
@@ -266,85 +266,50 @@ private:
         strPlatform += QString(".%1").arg(ARCH_BITS);
 
         /* Add more system information: */
-#if defined (Q_OS_WIN)
-        OSVERSIONINFO versionInfo;
-        ZeroMemory(&versionInfo, sizeof(OSVERSIONINFO));
-        versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-        GetVersionEx(&versionInfo);
-        int iMajor = versionInfo.dwMajorVersion;
-        int iMinor = versionInfo.dwMinorVersion;
-        int iBuild = versionInfo.dwBuildNumber;
-        QString strVersionInfo = QString::fromUtf16((ushort*)versionInfo.szCSDVersion);
-
-        QString strDistributiveInfo;
-        if (iMajor == 6)
-        {
-            if (iMinor >= 3)
-                strDistributiveInfo = QString("Windows 8.1 %1");
-            else if (iMinor == 2)
-                strDistributiveInfo = QString("Windows 8 %1");
-            else if (iMinor == 1)
-                strDistributiveInfo = QString("Windows 7 %1");
-            else
-                strDistributiveInfo = QString("Windows Vista %1");
-        }
-        else if (iMajor == 5)
+        int vrc;
+#if defined(Q_OS_LINUX)
+        /* On linux we wish to send information about the distribution
+           and such like, so we try invoke a helper script that retrives
+           and formats it for us. */
+
+        /* Get script path: */
+        char szAppPrivPath[RTPATH_MAX];
+        vrc = RTPathAppPrivateNoArch(szAppPrivPath, sizeof(szAppPrivPath)); AssertRC(vrc);
+        if (RT_SUCCESS(vrc))
         {
-            if (iMinor == 2)
-                strDistributiveInfo = QString("Windows Server 2003 %1");
-            else if (iMinor == 1)
-                strDistributiveInfo = QString("Windows XP %1");
-            else if (iMinor == 0)
-                strDistributiveInfo = QString("Windows 2000 %1");
+            /* Run script: */
+            QByteArray result = QIProcess::singleShot(QString(szAppPrivPath) + "/VBoxSysInfo.sh");
+            if (!result.isNull())
+                strPlatform += QString(" [%1]").arg(QString(result).trimmed());
             else
-                strDistributiveInfo = QString("Unknown %1");
+                vrc = VERR_TRY_AGAIN; /* (take the fallback path) */
         }
-        else if (iMajor == 4)
+        if (RT_FAILURE(vrc))
+#endif
         {
-            if (iMinor == 90)
-                strDistributiveInfo = QString("Windows Me %1");
-            else if (iMinor == 10)
-                strDistributiveInfo = QString("Windows 98 %1");
-            else if (iMinor == 0)
-                strDistributiveInfo = QString("Windows 95 %1");
-            else
-                strDistributiveInfo = QString("Unknown %1");
+            /* Use RTSystemQueryOSInfo: */
+            char szTmp[256];
+            QStringList components;
+
+            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
+            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
+                components << QString("Product: %1").arg(szTmp);
+
+            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
+            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
+                components << QString("Release: %1").arg(szTmp);
+
+            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
+            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
+                components << QString("Version: %1").arg(szTmp);
+
+            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof(szTmp));
+            if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
+                components << QString("SP: %1").arg(szTmp);
+
+            if (!components.isEmpty())
+                strPlatform += QString(" [%1]").arg(components.join(" | "));
         }
-        else strDistributiveInfo = QString("Unknown %1");
-        // TODO: Windows Server 2008 == Vista? */
-        strDistributiveInfo = strDistributiveInfo.arg(strVersionInfo);
-        QString strVersion = QString("%1.%2").arg(iMajor).arg(iMinor);
-        QString strKernel = QString("%1").arg(iBuild);
-        strPlatform += QString(" [Distribution: %1 | Version: %2 | Build: %3]")
-            .arg(strDistributiveInfo).arg(strVersion).arg(strKernel);
-#elif defined (Q_OS_LINUX)
-        /* Get script path: */
-        char szAppPrivPath[RTPATH_MAX];
-        int rc = RTPathAppPrivateNoArch(szAppPrivPath, sizeof(szAppPrivPath)); NOREF(rc);
-        AssertRC(rc);
-        /* Run script: */
-        QByteArray result = QIProcess::singleShot(QString(szAppPrivPath) + "/VBoxSysInfo.sh");
-        if (!result.isNull())
-            strPlatform += QString(" [%1]").arg(QString(result).trimmed());
-#else
-        /* Use RTSystemQueryOSInfo: */
-        char szTmp[256];
-        QStringList components;
-        int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
-        if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-            components << QString("Product: %1").arg(szTmp);
-        vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
-        if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-            components << QString("Release: %1").arg(szTmp);
-        vrc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
-        if ((RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-            components << QString("Version: %1").arg(szTmp);
-        vrc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof(szTmp));
-        if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
-            components << QString("SP: %1").arg(szTmp);
-        if (!components.isEmpty())
-            strPlatform += QString(" [%1]").arg(components.join(" | "));
-#endif
 
         return strPlatform;
     }
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
index 994e747..597af7b 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
@@ -190,16 +190,18 @@
     NSString *pstrName = [notification name];
 
     /* Define known notification names: */
-    NSString *spstrWillEnterFullscreenNotification = @"NSWindowWillEnterFullScreenNotification";
-    NSString *spstrDidEnterFullscreenNotification  = @"NSWindowDidEnterFullScreenNotification";
-    NSString *spstrWillExitFullscreenNotification  = @"NSWindowWillExitFullScreenNotification";
-    NSString *spstrDidExitFullscreenNotification   = @"NSWindowDidExitFullScreenNotification";
+    NSString *spstrWillEnterFullscreenNotification      = @"NSWindowWillEnterFullScreenNotification";
+    NSString *spstrDidEnterFullscreenNotification       = @"NSWindowDidEnterFullScreenNotification";
+    NSString *spstrWillExitFullscreenNotification       = @"NSWindowWillExitFullScreenNotification";
+    NSString *spstrDidExitFullscreenNotification        = @"NSWindowDidExitFullScreenNotification";
+    NSString *spstrDidFailToEnterFullScreenNotification = @"NSWindowDidFailToEnterFullScreenNotification";
 
     /* Redirect known notifications to UICocoaApplication instance: */
     if (   [pstrName isEqualToString :spstrWillEnterFullscreenNotification]
         || [pstrName isEqualToString :spstrDidEnterFullscreenNotification]
         || [pstrName isEqualToString :spstrWillExitFullscreenNotification]
-        || [pstrName isEqualToString :spstrDidExitFullscreenNotification])
+        || [pstrName isEqualToString :spstrDidExitFullscreenNotification]
+        || [pstrName isEqualToString :spstrDidFailToEnterFullScreenNotification])
         UICocoaApplication::instance()->nativeNotificationProxy(pstrName, [notification object]);
 }
 @end /* @implementation UICocoaApplicationPrivate */
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
index 6ce8db8..553662b 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
@@ -197,10 +197,9 @@ void darwinEnableTransienceSupport(NativeNSWindowRef pWindow)
 
 void darwinToggleFullscreenMode(NativeNSWindowRef pWindow)
 {
-    /* Toggle native fullscreen mode for passed pWindow. This method is available since 10.7 only.
-     * To automatically sync this method subsequent calls we performing it on the main (GUI) thread. */
+    /* Toggle native fullscreen mode for passed pWindow. This method is available since 10.7 only. */
     if ([pWindow respondsToSelector: @selector(toggleFullScreen:)])
-        [pWindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject: (id)nil waitUntilDone :NO];
+        [pWindow performSelector: @selector(toggleFullScreen:) withObject: (id)nil];
 }
 
 bool darwinIsInFullscreenMode(NativeNSWindowRef pWindow)
@@ -219,6 +218,31 @@ bool darwinScreensHaveSeparateSpaces()
         return false;
 }
 
+double darwinBackingScaleFactor(NativeNSWindowRef pWindow)
+{
+    /* If host window responds to 'backingScaleFactor' selector: */
+    if ([pWindow respondsToSelector :@selector(backingScaleFactor)])
+    {
+        /* Default scale-factor still '1': */
+        CGFloat dScaleFactor = 1.0;
+        /* Compose dynamical invocation: */
+        SEL selector = @selector(backingScaleFactor);
+        NSMethodSignature *signature = [pWindow methodSignatureForSelector :selector];
+        NSInvocation *invocation = [NSInvocation invocationWithMethodSignature :signature];
+        /* Configure invocation: */
+        [invocation setTarget :pWindow];
+        [invocation setSelector :selector];
+        /* Call for invocation: */
+        [invocation invoke];
+        /* And acquire invocation result finally: */
+        [invocation getReturnValue :&dScaleFactor];
+        /* Return scale-factor we have: */
+        return dScaleFactor;
+    }
+    /* Default scale-factor is '1': */
+    return 1.0;
+}
+
 void darwinSetDockIconMenu(QMenu* pMenu)
 {
     extern void qt_mac_set_dock_menu(QMenu *);
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
index a7aa965..3967cba 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
@@ -173,6 +173,11 @@ bool darwinOpenFile(const QString& strFile)
     return ::darwinOpenFile(darwinToNativeString(strFile.toUtf8().constData()));
 }
 
+double darwinBackingScaleFactor(QWidget *pWidget)
+{
+    return ::darwinBackingScaleFactor(::darwinToNativeWindow(pWidget));
+}
+
 QString darwinSystemLanguage(void)
 {
     /* Get the locales supported by our bundle */
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
index ed75cd2..d9f2878 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
@@ -86,6 +86,8 @@ bool darwinScreensHaveSeparateSpaces();
 
 bool darwinOpenFile(NativeNSStringRef pstrFile);
 
+double darwinBackingScaleFactor(NativeNSWindowRef pWindow);
+
 float darwinSmallFontSize();
 bool darwinSetFrontMostProcess();
 uint64_t darwinGetCurrentProcessId();
@@ -250,6 +252,8 @@ void darwinToggleFullscreenMode(QWidget *pWidget);
 bool darwinIsInFullscreenMode(QWidget *pWidget);
 bool darwinOpenFile(const QString &strFile);
 
+double darwinBackingScaleFactor(QWidget *pWidget);
+
 QString darwinSystemLanguage(void);
 QPixmap darwinCreateDragPixmap(const QPixmap& aPixmap, const QString &aText);
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
index 19e3bab..02a9322 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
@@ -48,6 +48,8 @@ UIFrameBuffer::UIFrameBuffer(UIMachineView *pMachineView)
 #ifdef Q_OS_WIN
     , m_iRefCnt(0)
 #endif /* Q_OS_WIN */
+    , m_hiDPIOptimizationType(HiDPIOptimizationType_None)
+    , m_dBackingScaleFactor(1.0)
 {
     /* Assign mahine-view: */
     AssertMsg(m_pMachineView, ("UIMachineView must not be NULL\n"));
@@ -571,6 +573,26 @@ void UIFrameBuffer::setView(UIMachineView * pView)
         prepareConnections();
 }
 
+void UIFrameBuffer::setHiDPIOptimizationType(HiDPIOptimizationType optimizationType)
+{
+    /* Make sure 'HiDPI optimization type' changed: */
+    if (m_hiDPIOptimizationType == optimizationType)
+        return;
+
+    /* Update 'HiDPI optimization type': */
+    m_hiDPIOptimizationType = optimizationType;
+}
+
+void UIFrameBuffer::setBackingScaleFactor(double dBackingScaleFactor)
+{
+    /* Make sure 'backing scale factor' changed: */
+    if (m_dBackingScaleFactor == dBackingScaleFactor)
+        return;
+
+    /* Update 'backing scale factor': */
+    m_dBackingScaleFactor = dBackingScaleFactor;
+}
+
 void UIFrameBuffer::prepareConnections()
 {
     connect(this, SIGNAL(sigRequestResize(int, uchar*, int, int, int, int)),
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
index 447fdeb..384c793 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
@@ -208,6 +208,16 @@ public:
 
     virtual void setView(UIMachineView * pView);
 
+    /** Return HiDPI frame-buffer optimization type. */
+    HiDPIOptimizationType hiDPIOptimizationType() const { return m_hiDPIOptimizationType; }
+    /** Define HiDPI frame-buffer optimization type: */
+    void setHiDPIOptimizationType(HiDPIOptimizationType optimizationType);
+
+    /** Return backing scale factor used by HiDPI frame-buffer. */
+    double backingScaleFactor() const { return m_dBackingScaleFactor; }
+    /** Define backing scale factor used by HiDPI frame-buffer. */
+    void setBackingScaleFactor(double dBackingScaleFactor);
+
 protected:
 
     UIMachineView *m_pMachineView;
@@ -241,6 +251,12 @@ private:
 #ifdef Q_OS_WIN
     long m_iRefCnt;
 #endif /* Q_OS_WIN */
+
+    /** Holds HiDPI frame-buffer optimization type. */
+    HiDPIOptimizationType m_hiDPIOptimizationType;
+
+    /** Holds backing scale factor used by HiDPI frame-buffer. */
+    double m_dBackingScaleFactor;
 };
 
 #endif // !___UIFrameBuffer_h___
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
index e9426dd..2810530 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
@@ -207,13 +207,10 @@ void UIFrameBufferQImage::paintDefault(QPaintEvent *pEvent)
     /* Create painter: */
     QPainter painter(m_pMachineView->viewport());
 
-    /* Draw image rectangle depending on rectangle width: */
-    if ((ulong)paintRect.width() < m_width * 2 / 3)
-        drawImageRectNarrow(painter, m_img,
-                            paintRect, m_pMachineView->contentsX(), m_pMachineView->contentsY());
-    else
-        drawImageRectWide(painter, m_img,
-                          paintRect, m_pMachineView->contentsX(), m_pMachineView->contentsY());
+    /* Draw image rectangle: */
+    drawImageRect(painter, m_img, paintRect,
+                  m_pMachineView->contentsX(), m_pMachineView->contentsY(),
+                  hiDPIOptimizationType(), backingScaleFactor());
 }
 
 void UIFrameBufferQImage::paintSeamless(QPaintEvent *pEvent)
@@ -258,13 +255,10 @@ void UIFrameBufferQImage::paintSeamless(QPaintEvent *pEvent)
             painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
 #endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS && Q_WS_WIN */
 
-            /* Draw image rectangle depending on rectangle width: */
-            if ((ulong)rect.width() < m_width * 2 / 3)
-                drawImageRectNarrow(painter, m_img,
-                                    rect, m_pMachineView->contentsX(), m_pMachineView->contentsY());
-            else
-                drawImageRectWide(painter, m_img,
-                                  rect, m_pMachineView->contentsX(), m_pMachineView->contentsY());
+            /* Draw image rectangle: */
+            drawImageRect(painter, m_img, rect,
+                          m_pMachineView->contentsX(), m_pMachineView->contentsY(),
+                          hiDPIOptimizationType(), backingScaleFactor());
         }
     }
 }
@@ -293,35 +287,75 @@ void UIFrameBufferQImage::paintScale(QPaintEvent *pEvent)
     /* Create painter: */
     QPainter painter(m_pMachineView->viewport());
 
-    /* Draw image rectangle depending on rectangle width: */
-    if ((ulong)paintRect.width() < m_width * 2 / 3)
-        drawImageRectNarrow(painter, sourceImage,
-                            paintRect, m_pMachineView->contentsX(), m_pMachineView->contentsY());
-    else
-        drawImageRectWide(painter, sourceImage,
-                          paintRect, m_pMachineView->contentsX(), m_pMachineView->contentsY());
+    /* Draw image rectangle: */
+    drawImageRect(painter, sourceImage, paintRect,
+                  m_pMachineView->contentsX(), m_pMachineView->contentsY(),
+                  hiDPIOptimizationType(), backingScaleFactor());
 }
 
 /* static */
-void UIFrameBufferQImage::drawImageRectNarrow(QPainter &painter, const QImage &image,
-                                              const QRect &rect, int iContentsShiftX, int iContentsShiftY)
+void UIFrameBufferQImage::drawImageRect(QPainter &painter, const QImage &image, const QRect &rect,
+                                        int iContentsShiftX, int iContentsShiftY,
+                                        HiDPIOptimizationType hiDPIOptimizationType,
+                                        double dBackingScaleFactor)
 {
-    /* This method is faster for narrow updates: */
-    QPixmap pm = QPixmap::fromImage(image.copy(rect.x() + iContentsShiftX,
-                                               rect.y() + iContentsShiftY,
-                                               rect.width(), rect.height()));
-    painter.drawPixmap(rect.x(), rect.y(), pm);
-}
+    /* Calculate offset: */
+    size_t offset = (rect.x() + iContentsShiftX) * image.depth() / 8 +
+                    (rect.y() + iContentsShiftY) * image.bytesPerLine();
 
-/* static */
-void UIFrameBufferQImage::drawImageRectWide(QPainter &painter, const QImage &image,
-                                            const QRect &rect, int iContentsShiftX, int iContentsShiftY)
-{
-    /* This method is faster for wide updates: */
-    QPixmap pm = QPixmap::fromImage(QImage(image.scanLine(rect.y() + iContentsShiftY),
-                                           image.width(), rect.height(), image.bytesPerLine(),
-                                           QImage::Format_RGB32));
-    painter.drawPixmap(rect.x(), rect.y(), pm, rect.x() + iContentsShiftX, 0, 0, 0);
+    /* Create sub-image (no copy involved): */
+    QImage subImage = QImage(image.bits() + offset,
+                             rect.width(), rect.height(),
+                             image.bytesPerLine(), image.format());
+
+#ifndef QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT
+    /* Create sub-pixmap on the basis of sub-image above (1st copy involved): */
+    QPixmap subPixmap = QPixmap::fromImage(subImage);
+
+    /* If HiDPI 'backing scale factor' defined: */
+    if (dBackingScaleFactor > 1.0)
+    {
+        /* Should we optimize HiDPI output for performance? */
+        if (hiDPIOptimizationType == HiDPIOptimizationType_Performance)
+        {
+            /* Fast scale sub-pixmap (2nd copy involved): */
+            subPixmap = subPixmap.scaled(subPixmap.size() * dBackingScaleFactor,
+                                         Qt::IgnoreAspectRatio, Qt::FastTransformation);
+# ifdef Q_WS_MAC
+#  ifdef VBOX_GUI_WITH_HIDPI
+            /* Mark sub-pixmap as HiDPI: */
+            subPixmap.setDevicePixelRatio(dBackingScaleFactor);
+#  endif /* VBOX_GUI_WITH_HIDPI */
+# endif /* Q_WS_MAC */
+        }
+    }
+
+    /* Draw sub-pixmap: */
+    painter.drawPixmap(rect.x(), rect.y(), subPixmap);
+#else /* QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT */
+    /* If HiDPI 'backing scale factor' defined: */
+    if (dBackingScaleFactor > 1.0)
+    {
+        /* Should we optimize HiDPI output for performance? */
+        if (hiDPIOptimizationType == HiDPIOptimizationType_Performance)
+        {
+            /* Create fast-scaled-sub-image (1st copy involved): */
+            QImage scaledSubImage = subImage.scaled(subImage.size() * dBackingScaleFactor,
+                                                    Qt::IgnoreAspectRatio, Qt::FastTransformation);
+# ifdef Q_WS_MAC
+#  ifdef VBOX_GUI_WITH_HIDPI
+            /* Mark sub-pixmap as HiDPI: */
+            scaledSubImage.setDevicePixelRatio(dBackingScaleFactor);
+#  endif /* VBOX_GUI_WITH_HIDPI */
+# endif /* Q_WS_MAC */
+            /* Directly draw scaled-sub-image: */
+            painter.drawImage(rect.x(), rect.y(), scaledSubImage);
+            return;
+        }
+    }
+    /* Directly draw sub-image: */
+    painter.drawImage(rect.x(), rect.y(), subImage);
+#endif /* QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT */
 }
 
 void UIFrameBufferQImage::goFallback()
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h
index b02d4ab..a696320 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h
@@ -54,11 +54,11 @@ private:
     void paintSeamless(QPaintEvent *pEvent);
     void paintScale(QPaintEvent *pEvent);
 
-    /* Static helpers: Drawing stuff: */
-    static void drawImageRectNarrow(QPainter &painter, const QImage &image,
-                                    const QRect &rect, int iContentsShiftX, int iContentsShiftY);
-    static void drawImageRectWide(QPainter &painter, const QImage &image,
-                                  const QRect &rect, int iContentsShiftX, int iContentsShiftY);
+    /** Draws corresponding @a rect of passed @a image with @a painter. */
+    static void drawImageRect(QPainter &painter, const QImage &image, const QRect &rect,
+                              int iContentsShiftX, int iContentsShiftY,
+                              HiDPIOptimizationType hiDPIOptimizationType,
+                              double dBackingScaleFactor);
 
     /* Helper: Fallback stuff: */
     void goFallback();
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
index de3b11c..efac9a5 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
@@ -443,9 +443,27 @@ void UIMachineLogic::sltMachineStateChanged()
             QString strLogFolder = session().GetMachine().GetLogFolder();
             /* Take the screenshot for debugging purposes: */
             takeScreenshot(strLogFolder + "/VBox.png", "png");
-            /* Warn the user about GURU meditation: */
-            if (msgCenter().remindAboutGuruMeditation(QDir::toNativeSeparators(strLogFolder)))
-                powerOff(false /* do NOT restore current snapshot */);
+            /* How should we handle Guru Meditation? */
+            switch (uisession()->guruMeditationHandlerType())
+            {
+                /* Ask how to proceed; Power off VM if proposal accepted: */
+                case GuruMeditationHandlerType_Default:
+                {
+                    if (msgCenter().remindAboutGuruMeditation(QDir::toNativeSeparators(strLogFolder)))
+                        powerOff(false /* do NOT restore current snapshot */);
+                    break;
+                }
+                /* Power off VM silently: */
+                case GuruMeditationHandlerType_PowerOff:
+                {
+                    powerOff(false /* do NOT restore current snapshot */);
+                    break;
+                }
+                /* Just ignore it: */
+                case GuruMeditationHandlerType_Ignore:
+                default:
+                    break;
+            }
             break;
         }
         case KMachineState_Paused:
@@ -783,7 +801,7 @@ void UIMachineLogic::prepareRequiredFeatures()
 void UIMachineLogic::prepareSessionConnections()
 {
     /* We should check for entering/exiting requested modes: */
-    connect(uisession(), SIGNAL(sigMachineStarted()), this, SLOT(sltCheckForRequestedVisualStateType()));
+    connect(uisession(), SIGNAL(sigStarted()), this, SLOT(sltCheckForRequestedVisualStateType()));
     connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltCheckForRequestedVisualStateType()));
 
     /* Machine state-change updater: */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
index 9f396a2..e7db245 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
@@ -437,6 +437,7 @@ void UIMachineView::prepareFrameBuffer()
 # else /* VBOX_WITH_VIDEOHWACCEL */
                 pFrameBuffer = new UIFrameBufferQImage(this);
 # endif /* !VBOX_WITH_VIDEOHWACCEL */
+                pFrameBuffer->setHiDPIOptimizationType(uisession()->hiDPIOptimizationType());
                 uisession()->setFrameBuffer(screenId(), pFrameBuffer);
             }
             m_pFrameBuffer = pFrameBuffer;
@@ -1033,6 +1034,15 @@ bool UIMachineView::eventFilter(QObject *pWatched, QEvent *pEvent)
                 }
                 break;
             }
+#ifdef Q_WS_MAC
+            case QEvent::Move:
+            {
+                /* Update backing scale factor for underlying frame-buffer: */
+                if (m_pFrameBuffer)
+                    m_pFrameBuffer->setBackingScaleFactor(darwinBackingScaleFactor(machineWindow()));
+                break;
+            }
+#endif /* Q_WS_MAC */
             default:
                 break;
         }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
index 776589f..26e5592 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
@@ -173,13 +173,18 @@ UIMachineWindow::UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId)
     , m_pRightSpacer(0)
 {
 #ifndef Q_WS_MAC
-    /* On Mac OS X application icon referenced in info.plist is used. */
+    /* On Mac OS X window icon referenced in info.plist is used. */
 
-    /* Set default application icon (will be changed to VM-specific icon little bit later): */
+    /* Set default window icon (will be changed to VM-specific icon little bit later): */
     setWindowIcon(QIcon(":/VirtualBox_48px.png"));
 
-    /* Set VM-specific application icon: */
-    setWindowIcon(vboxGlobal().vmGuestOSTypeIcon(machine().GetOSTypeId()));
+    /* Set redefined machine-window icon if any: */
+    QIcon *pMachineWidnowIcon = uisession()->machineWindowIcon();
+    if (pMachineWidnowIcon)
+        setWindowIcon(*pMachineWidnowIcon);
+    /* Or set default machine-window icon: */
+    else
+        setWindowIcon(vboxGlobal().vmGuestOSTypeIcon(machine().GetOSTypeId()));
 #endif /* !Q_WS_MAC */
 }
 
@@ -462,7 +467,8 @@ void UIMachineWindow::updateAppearanceOf(int iElement)
             strMachineName += " [" + gpConverter->toString(state) + "]";
         /* Unusual on the Mac. */
 #ifndef Q_WS_MAC
-        strMachineName += " - " + defaultWindowTitle();
+        const QString strUserProductName = uisession()->machineWindowNamePostfix();
+        strMachineName += " - " + (strUserProductName.isEmpty() ? defaultWindowTitle() : strUserProductName);
 #endif /* !Q_WS_MAC */
         if (m.GetMonitorCount() > 1)
             strMachineName += QString(" : %1").arg(m_uScreenId + 1);
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
index 309aa1a..b53199f 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
@@ -179,7 +179,7 @@ void UIMouseHandler::captureMouse(ulong uScreenId)
         QRect visibleRectangle = m_viewports[m_iMouseCaptureViewIndex]->visibleRegion().boundingRect();
         QPoint visibleRectanglePos = m_views[m_iMouseCaptureViewIndex]->mapToGlobal(m_viewports[m_iMouseCaptureViewIndex]->pos());
         visibleRectangle.translate(visibleRectanglePos);
-        visibleRectangle = visibleRectangle.intersected(QApplication::desktop()->availableGeometry());
+        visibleRectangle = visibleRectangle.intersected(QApplication::desktop()->availableGeometry(machineLogic()->machineWindows()[m_iMouseCaptureViewIndex]));
 
 #ifdef Q_WS_WIN
         /* Move the mouse to the center of the visible area: */
@@ -1080,7 +1080,7 @@ void UIMouseHandler::updateMouseCursorClipping()
         /* Get full-viewport-rectangle in global coordinates: */
         viewportRectangle.translate(viewportRectangleGlobalPos);
         /* Trim full-viewport-rectangle by available geometry: */
-        viewportRectangle = viewportRectangle.intersected(QApplication::desktop()->availableGeometry());
+        viewportRectangle = viewportRectangle.intersected(QApplication::desktop()->availableGeometry(machineLogic()->machineWindows()[m_iMouseCaptureViewIndex]));
         /* Trim partial-viewport-rectangle by top-most windows: */
         QRegion viewportRegion(viewportRectangle);
         QRegion topMostRegion(NativeWindowSubsystem::areaCoveredByTopMostWindows());
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
index 8fbdd92..7369222 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
@@ -129,6 +129,11 @@ UISession::UISession(UIMachine *pMachine, CSession &sessionReference)
     , m_pMenuPool(0)
     , m_machineStatePrevious(KMachineState_Null)
     , m_machineState(session().GetMachine().GetState())
+#ifndef Q_WS_MAC
+    , m_pMachineWindowIcon(0)
+#endif /* !Q_WS_MAC */
+    , m_guruMeditationHandlerType(GuruMeditationHandlerType_Default)
+    , m_hiDPIOptimizationType(HiDPIOptimizationType_None)
     , m_fIsExtensionPackUsable(false)
     , m_requestedVisualStateType(UIVisualStateType_Invalid)
 #ifdef Q_WS_WIN
@@ -142,6 +147,7 @@ UISession::UISession(UIMachine *pMachine, CSession &sessionReference)
     , m_fAllCloseActionsRestricted(false)
     , m_fSnapshotOperationsAllowed(true)
     /* Common flags: */
+    , m_fIsStarted(false)
     , m_fIsFirstTimeStarted(false)
     , m_fIsIgnoreRuntimeMediumsChanging(false)
     , m_fIsGuestResizeIgnored(false)
@@ -364,7 +370,7 @@ void UISession::powerUp()
 #endif
 
     /* Warn listeners about machine was started: */
-    emit sigMachineStarted();
+    emit sigStarted();
 }
 
 bool UISession::saveState()
@@ -1011,6 +1017,7 @@ void UISession::prepareConsoleEventHandlers()
 
 void UISession::prepareConnections()
 {
+    connect(this, SIGNAL(sigStarted()), this, SLOT(sltMarkStarted()));
     connect(this, SIGNAL(sigCloseRuntimeUI()), this, SLOT(sltCloseRuntimeUI()));
 
 #ifdef Q_WS_MAC
@@ -1116,6 +1123,25 @@ void UISession::loadSessionSettings()
         /* Temporary: */
         QString strSettings;
 
+#ifndef Q_WS_MAC
+        /* Load/prepare user's machine-window icon: */
+        QIcon icon;
+        foreach (const QString &strIconName, VBoxGlobal::machineWindowIconNames(machine))
+            if (!strIconName.isEmpty())
+                icon.addFile(strIconName);
+        if (!icon.isNull())
+            m_pMachineWindowIcon = new QIcon(icon);
+
+        /* Load user's machine-window name postfix: */
+        m_strMachineWindowNamePostfix = VBoxGlobal::machineWindowNamePostfix(machine);
+#endif /* !Q_WS_MAC */
+
+        /* Determine Guru Meditation handler type: */
+        m_guruMeditationHandlerType = VBoxGlobal::guruMeditationHandlerType(machine);
+
+        /* Determine HiDPI optimization type: */
+        m_hiDPIOptimizationType = VBoxGlobal::hiDPIOptimizationType(machine);
+
         /* Is there should be First RUN Wizard? */
         strSettings = machine.GetExtraData(GUI_FirstRun);
         if (strSettings == "yes")
@@ -1178,6 +1204,12 @@ void UISession::saveSessionSettings()
         SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, true, 0, 0);
 # endif /* Q_WS_WIN */
 #endif
+
+#ifndef Q_WS_MAC
+        /* Cleanup user's machine-window icon: */
+        delete m_pMachineWindowIcon;
+        m_pMachineWindowIcon = 0;
+#endif /* !Q_WS_MAC */
     }
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
index 27c8998..61588e1 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
@@ -40,6 +40,9 @@ class CSession;
 class CUSBDevice;
 class CNetworkAdapter;
 class CMediumAttachment;
+#ifndef Q_WS_MAC
+class QIcon;
+#endif /* !Q_WS_MAC */
 
 /* CConsole callback event types: */
 enum UIConsoleEventType
@@ -93,6 +96,24 @@ public:
     QMenuBar* newMenuBar(RuntimeMenuType fOptions = RuntimeMenuType_All);
     QCursor cursor() const { return m_cursor; }
 
+#ifndef Q_WS_MAC
+    /** @name Branding stuff.
+     ** @{ */
+    /** Returns redefined machine-window icon. */
+    QIcon* machineWindowIcon() const { return m_pMachineWindowIcon; }
+    /** Returns redefined machine-window name postfix. */
+    QString machineWindowNamePostfix() const { return m_strMachineWindowNamePostfix; }
+    /** @} */
+#endif /* !Q_WS_MAC */
+
+    /** @name Runtime workflow stuff.
+     ** @{ */
+    /** Returns Guru Meditation handler type. */
+    GuruMeditationHandlerType guruMeditationHandlerType() const { return m_guruMeditationHandlerType; }
+    /** Returns HiDPI optimization type. */
+    HiDPIOptimizationType hiDPIOptimizationType() const { return m_hiDPIOptimizationType; }
+    /** @} */
+
     /** @name Extension Pack stuff.
      ** @{ */
     /** Determines whether extension pack installed and usable. */
@@ -159,6 +180,7 @@ public:
     bool isStuck() const { return machineState() == KMachineState_Stuck; }
     bool wasPaused() const { return machineStatePrevious() == KMachineState_Paused ||
                                     machineStatePrevious() == KMachineState_TeleportingPausedVM; }
+    bool isStarted() const { return m_fIsStarted; }
     bool isFirstTimeStarted() const { return m_fIsFirstTimeStarted; }
     bool isIgnoreRuntimeMediumsChanging() const { return m_fIsIgnoreRuntimeMediumsChanging; }
     bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }
@@ -247,7 +269,7 @@ signals:
     void sigHostScreenGeometryChanged();
 
     /* Session signals: */
-    void sigMachineStarted();
+    void sigStarted();
 
 public slots:
 
@@ -255,6 +277,9 @@ public slots:
 
 private slots:
 
+    /** Marks machine started. */
+    void sltMarkStarted() { m_fIsStarted = true; }
+
     /* Handler: Close Runtime UI stuff: */
     void sltCloseRuntimeUI();
 
@@ -329,6 +354,24 @@ private:
     KMachineState m_machineState;
     QCursor m_cursor;
 
+#ifndef Q_WS_MAC
+    /** @name Branding variables.
+     ** @{ */
+    /** Holds redefined machine-window icon. */
+    QIcon *m_pMachineWindowIcon;
+    /** Holds redefined machine-window name postfix. */
+    QString m_strMachineWindowNamePostfix;
+    /** @} */
+#endif /* !Q_WS_MAC */
+
+    /** @name Runtime workflow variables.
+     ** @{ */
+    /** Holds Guru Meditation handler type. */
+    GuruMeditationHandlerType m_guruMeditationHandlerType;
+    /** Holds HiDPI optimization type. */
+    HiDPIOptimizationType m_hiDPIOptimizationType;
+    /** @} */
+
     /** @name Extension Pack variables.
      ** @{ */
     /** Determines whether extension pack installed and usable. */
@@ -392,6 +435,7 @@ private:
     /** @} */
 
     /* Common flags: */
+    bool m_fIsStarted : 1;
     bool m_fIsFirstTimeStarted : 1;
     bool m_fIsIgnoreRuntimeMediumsChanging : 1;
     bool m_fIsGuestResizeIgnored : 1;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
index bb37d74..0c20f95 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
@@ -108,7 +108,10 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenWillEnter()
 
     /* Get sender machine-window: */
     UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender());
-    AssertReturnVoid(pMachineWindow);
+    AssertPtrReturnVoid(pMachineWindow);
+    LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenWillEnter: "
+            "Machine-window #%d will enter native fullscreen.\n",
+            (int)pMachineWindow->screenId()));
 
     /* Fade to black: */
     fadeToBlack();
@@ -121,7 +124,10 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidEnter()
 
     /* Get sender machine-window: */
     UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender());
-    AssertReturnVoid(pMachineWindow);
+    AssertPtrReturnVoid(pMachineWindow);
+    LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidEnter: "
+            "Machine-window #%d did enter native fullscreen.\n",
+            (int)pMachineWindow->screenId()));
 
     /* Add machine-window to corresponding set: */
     m_fullscreenMachineWindows.insert(pMachineWindow);
@@ -130,7 +136,8 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidEnter()
     /* Fade to normal if necessary: */
     QSet<UIMachineWindow*> visibleMachineWindows;
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
-        if (uisession()->isScreenVisible(pMachineWindow->screenId()))
+        if (   uisession()->isScreenVisible(pMachineWindow->screenId())
+            && hasHostScreenForGuestScreen(pMachineWindow->screenId()))
             visibleMachineWindows << pMachineWindow;
     if (   !darwinScreensHaveSeparateSpaces()
         || m_fullscreenMachineWindows == visibleMachineWindows)
@@ -144,7 +151,10 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenWillExit()
 
     /* Get sender machine-window: */
     UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender());
-    AssertReturnVoid(pMachineWindow);
+    AssertPtrReturnVoid(pMachineWindow);
+    LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenWillExit: "
+            "Machine-window #%d will exit native fullscreen.\n",
+            (int)pMachineWindow->screenId()));
 
     /* Fade to black: */
     fadeToBlack();
@@ -157,25 +167,30 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit()
 
     /* Get sender machine-window: */
     UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender());
-    AssertReturnVoid(pMachineWindow);
+    AssertPtrReturnVoid(pMachineWindow);
 
     /* Remove machine-window from corresponding set: */
     bool fResult = m_fullscreenMachineWindows.remove(pMachineWindow);
-    AssertReturnVoid(fResult && !m_fullscreenMachineWindows.contains(pMachineWindow));
-    Q_UNUSED(fResult);
+    AssertReturnVoid(!m_fullscreenMachineWindows.contains(pMachineWindow));
+
+    /* We have same signal if window did fail to enter native fullscreen.
+     * In that case window missed in m_fullscreenMachineWindows,
+     * ignore this signal silently: */
+    if (!fResult)
+        return;
 
     /* If that window was invalidated: */
     if (m_invalidFullscreenMachineWindows.contains(pMachineWindow))
     {
         LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
-                "Machine-window #%d exited invalidated fullscreen, revalidate it.\n",
+                "Machine-window #%d exited invalidated native fullscreen, revalidate it.\n",
                 (int)pMachineWindow->screenId()));
 
         /* Exclude window from invalidation list: */
         m_invalidFullscreenMachineWindows.remove(pMachineWindow);
 
         /* Revalidate 'fullscreen' window: */
-        revalidateFullscreenWindow(pMachineWindow);
+        revalidateNativeFullScreen(pMachineWindow);
     }
     /* If there are no invalidated windows: */
     else if (m_invalidFullscreenMachineWindows.isEmpty())
@@ -184,7 +199,8 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit()
         if (!m_fullscreenMachineWindows.isEmpty())
         {
             LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
-                    "Machine-window exited fullscreen, asking others to exit too...\n"));
+                    "Machine-window #%d exited native fullscreen, asking others to exit too...\n",
+                    (int)pMachineWindow->screenId()));
 
             /* Ask window(s) to exit 'fullscreen' mode: */
             emit sigNotifyAboutNativeFullscreenShouldBeExited();
@@ -193,7 +209,8 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit()
         else
         {
             LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: "
-                    "Machine-window(s) exited fullscreen, changing visual-state to requested...\n"));
+                    "Machine-window #%d exited native fullscreen, changing visual-state to requested...\n",
+                    (int)pMachineWindow->screenId()));
 
             /* Change visual-state to requested: */
             UIVisualStateType type = uisession()->requestedVisualState();
@@ -208,6 +225,45 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit()
     }
 }
 
+void UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter()
+{
+    /* Make sure this method is only used for ML and next: */
+    AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion);
+
+    /* Get sender machine-window: */
+    UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender());
+    AssertReturnVoid(pMachineWindow);
+
+    /* Make sure this window is not registered somewhere: */
+    AssertReturnVoid(!m_fullscreenMachineWindows.remove(pMachineWindow));
+    AssertReturnVoid(!m_invalidFullscreenMachineWindows.remove(pMachineWindow));
+
+    /* If there are 'fullscreen' windows: */
+    if (!m_fullscreenMachineWindows.isEmpty())
+    {
+        LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter: "
+                "Machine-window #%d failed to enter native fullscreen, asking others to exit...\n",
+                (int)pMachineWindow->screenId()));
+
+        /* Ask window(s) to exit 'fullscreen' mode: */
+        emit sigNotifyAboutNativeFullscreenShouldBeExited();
+    }
+    /* If there are no 'fullscreen' windows: */
+    else
+    {
+        LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter: "
+                "Machine-window #%d failed to enter native fullscreen, requesting change visual-state to normal...\n",
+                (int)pMachineWindow->screenId()));
+
+        /* Ask session to change 'fullscreen' mode to 'normal': */
+        uisession()->setRequestedVisualState(UIVisualStateType_Normal);
+
+        /* If session started already => push mode-change directly: */
+        if (uisession()->isStarted())
+            sltCheckForRequestedVisualStateType();
+    }
+}
+
 void UIMachineLogicFullscreen::sltChangeVisualStateToNormal()
 {
     /* Base-class handling for Lion and previous: */
@@ -252,6 +308,29 @@ void UIMachineLogicFullscreen::sltChangeVisualStateToScale()
         emit sigNotifyAboutNativeFullscreenShouldBeExited();
     }
 }
+
+void UIMachineLogicFullscreen::sltCheckForRequestedVisualStateType()
+{
+    /* Do not try to change visual-state type if machine was not started yet: */
+    if (!uisession()->isRunning() && !uisession()->isPaused())
+        return;
+
+    /* Check requested visual-state types: */
+    switch (uisession()->requestedVisualState())
+    {
+        /* If 'normal' visual-state type is requested: */
+        case UIVisualStateType_Normal:
+        {
+            LogRel(("UIMachineLogicFullscreen::sltCheckForRequestedVisualStateType: "
+                    "Going 'normal' as requested...\n"));
+            uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
+            uisession()->changeVisualState(UIVisualStateType_Normal);
+            break;
+        }
+        default:
+            break;
+    }
+}
 #endif /* RT_OS_DARWIN */
 
 void UIMachineLogicFullscreen::sltMachineStateChanged()
@@ -285,7 +364,7 @@ void UIMachineLogicFullscreen::sltChangePresentationMode(bool /* fEnabled */)
 
 void UIMachineLogicFullscreen::sltScreenLayoutChanged()
 {
-    LogRel(("UIMachineLogicFullscreen: Multi-screen layout changed.\n"));
+    LogRel(("UIMachineLogicFullscreen::sltScreenLayoutChanged: Multi-screen layout changed.\n"));
 
 #ifdef Q_WS_MAC
     /* For Lion and previous: */
@@ -298,7 +377,7 @@ void UIMachineLogicFullscreen::sltScreenLayoutChanged()
         setPresentationModeEnabled(true);
     }
     /* Revalidate 'fullscreen' windows for ML and next: */
-    else revalidateFullscreenWindows();
+    else revalidateNativeFullScreen();
 #else /* !Q_WS_MAC */
     /* Make sure all machine-window(s) have proper geometry: */
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
@@ -308,7 +387,7 @@ void UIMachineLogicFullscreen::sltScreenLayoutChanged()
 
 void UIMachineLogicFullscreen::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
 {
-    LogRel(("UIMachineLogicFullscreen: Guest-screen count changed.\n"));
+    LogRel(("UIMachineLogicFullscreen::sltGuestMonitorChange: Guest-screen count changed.\n"));
 
     /* Update multi-screen layout before any window update: */
     if (changeType == KGuestMonitorChangedEventType_Enabled ||
@@ -320,7 +399,7 @@ void UIMachineLogicFullscreen::sltGuestMonitorChange(KGuestMonitorChangedEventTy
     if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
         UIMachineLogic::sltGuestMonitorChange(changeType, uScreenId, screenGeo);
     /* Revalidate 'fullscreen' windows for ML and next: */
-    else revalidateFullscreenWindows();
+    else revalidateNativeFullScreen();
 #else /* !Q_WS_MAC */
     /* Call to base-class: */
     UIMachineLogic::sltGuestMonitorChange(changeType, uScreenId, screenGeo);
@@ -329,7 +408,7 @@ void UIMachineLogicFullscreen::sltGuestMonitorChange(KGuestMonitorChangedEventTy
 
 void UIMachineLogicFullscreen::sltHostScreenCountChanged()
 {
-    LogRel(("UIMachineLogicFullscreen: Host-screen count changed.\n"));
+    LogRel(("UIMachineLogicFullscreen::sltHostScreenCountChanged: Host-screen count changed.\n"));
 
     /* Update multi-screen layout before any window update: */
     m_pScreenLayout->rebuild();
@@ -339,7 +418,7 @@ void UIMachineLogicFullscreen::sltHostScreenCountChanged()
     if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
         UIMachineLogic::sltHostScreenCountChanged();
     /* Revalidate 'fullscreen' windows for ML and next: */
-    else revalidateFullscreenWindows();
+    else revalidateNativeFullScreen();
 #else /* !Q_WS_MAC */
     /* Call to base-class: */
     UIMachineLogic::sltHostScreenCountChanged();
@@ -437,16 +516,23 @@ void UIMachineLogicFullscreen::prepareMachineWindows()
                     pMachineWindow, SLOT(sltExitNativeFullscreen(UIMachineWindow*)));
             /* Window => logic signals: */
             connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenWillEnter()),
-                    this, SLOT(sltHandleNativeFullscreenWillEnter()));
+                    this, SLOT(sltHandleNativeFullscreenWillEnter()),
+                    Qt::QueuedConnection);
             connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidEnter()),
-                    this, SLOT(sltHandleNativeFullscreenDidEnter()));
+                    this, SLOT(sltHandleNativeFullscreenDidEnter()),
+                    Qt::QueuedConnection);
             connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenWillExit()),
-                    this, SLOT(sltHandleNativeFullscreenWillExit()));
+                    this, SLOT(sltHandleNativeFullscreenWillExit()),
+                    Qt::QueuedConnection);
             connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidExit()),
-                    this, SLOT(sltHandleNativeFullscreenDidExit()));
+                    this, SLOT(sltHandleNativeFullscreenDidExit()),
+                    Qt::QueuedConnection);
+            connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenFailToEnter()),
+                    this, SLOT(sltHandleNativeFullscreenFailToEnter()),
+                    Qt::QueuedConnection);
         }
         /* Revalidate 'fullscreen' windows: */
-        revalidateFullscreenWindows();
+        revalidateNativeFullScreen();
     }
 #endif /* Q_WS_MAC */
 
@@ -567,6 +653,7 @@ void UIMachineLogicFullscreen::fadeToBlack()
         return;
 
     /* Acquire fade-token: */
+    LogRel(("UIMachineLogicFullscreen::fadeToBlack\n"));
     CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &m_fadeToken);
     CGDisplayFade(m_fadeToken, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true);
 }
@@ -578,15 +665,14 @@ void UIMachineLogicFullscreen::fadeToNormal()
         return;
 
     /* Release fade-token: */
+    LogRel(("UIMachineLogicFullscreen::fadeToNormal\n"));
     CGDisplayFade(m_fadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false);
     CGReleaseDisplayFadeReservation(m_fadeToken);
     m_fadeToken = kCGDisplayFadeReservationInvalidToken;
 }
 
-void UIMachineLogicFullscreen::revalidateFullscreenWindow(UIMachineWindow *pMachineWindow)
+void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMachineWindow)
 {
-    LogRel(("UIMachineLogicFullscreen::revalidateFullscreenWindow #%d begin.\n", pMachineWindow->screenId()));
-
     /* Make sure window is not already invalidated: */
     if (m_invalidFullscreenMachineWindows.contains(pMachineWindow))
         return;
@@ -597,10 +683,15 @@ void UIMachineLogicFullscreen::revalidateFullscreenWindow(UIMachineWindow *pMach
 
     /* Get screen ID: */
     ulong uScreenID = pMachineWindow->screenId();
+    LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: For machine-window #%d.\n",
+            (int)uScreenID));
 
     /* Validate window which can't be fullscreen: */
     if (uScreenID != 0 && !darwinScreensHaveSeparateSpaces())
     {
+        LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
+                "Ask machine-window #%d to show/normalize.\n", (int)uScreenID));
+
         /* Make sure window have proper geometry: */
         pMachineWindow->showInNecessaryMode();
     }
@@ -616,8 +707,8 @@ void UIMachineLogicFullscreen::revalidateFullscreenWindow(UIMachineWindow *pMach
             if (   uisession()->isScreenVisible(uScreenID)
                 && hasHostScreenForGuestScreen(uScreenID))
             {
-                LogRel(("UIMachineLogicFullscreen::revalidateFullscreenWindow: "
-                        "Ask machine-window #%d to enter fullscreen.\n", (int)uScreenID));
+                LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
+                        "Ask machine-window #%d to enter native fullscreen.\n", (int)uScreenID));
 
                 /* Fade to black: */
                 fadeToBlack();
@@ -635,6 +726,9 @@ void UIMachineLogicFullscreen::revalidateFullscreenWindow(UIMachineWindow *pMach
              * is shown while shouldn't: */
             else if (pMachineWindow->isVisible())
             {
+                LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
+                        "Ask machine-window #%d to hide.\n", (int)uScreenID));
+
                 /* Else make sure that window is hidden: */
                 pMachineWindow->showInNecessaryMode();
 
@@ -661,8 +755,8 @@ void UIMachineLogicFullscreen::revalidateFullscreenWindow(UIMachineWindow *pMach
                 || iWantedHostScreenIndex != iCurrentHostScreenIndex
                 || frameBufferSize != screenSize)
             {
-                LogRel(("UIMachineLogicFullscreen::revalidateFullscreenWindow: "
-                        "Ask machine-window #%d to exit fullscreen.\n", (int)uScreenID));
+                LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
+                        "Ask machine-window #%d to exit native fullscreen.\n", (int)uScreenID));
 
                 /* Fade to black: */
                 fadeToBlack();
@@ -675,15 +769,13 @@ void UIMachineLogicFullscreen::revalidateFullscreenWindow(UIMachineWindow *pMach
             }
         }
     }
-
-    LogRel(("UIMachineLogicFullscreen::revalidateFullscreenWindow #%d end.\n", pMachineWindow->screenId()));
 }
 
-void UIMachineLogicFullscreen::revalidateFullscreenWindows()
+void UIMachineLogicFullscreen::revalidateNativeFullScreen()
 {
     /* Revalidate all fullscreen windows: */
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
-        revalidateFullscreenWindow(pMachineWindow);
+        revalidateNativeFullScreen(pMachineWindow);
 }
 #endif /* Q_WS_MAC */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
index 931a08f..567072e 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
@@ -66,6 +66,8 @@ private slots:
     void sltHandleNativeFullscreenWillExit();
     /** Mac OS X: Handles native notification about 'fullscreen' exited. */
     void sltHandleNativeFullscreenDidExit();
+    /** Mac OS X: Handles native notification about 'fullscreen' fail to enter. */
+    void sltHandleNativeFullscreenFailToEnter();
 
     /** Mac OS X: Requests visual-state change from 'fullscreen' to 'normal' (window). */
     void sltChangeVisualStateToNormal();
@@ -73,6 +75,9 @@ private slots:
     void sltChangeVisualStateToSeamless();
     /** Mac OS X: Requests visual-state change from 'fullscreen' to 'scale'. */
     void sltChangeVisualStateToScale();
+
+    /** Mac OS X: Checks if some visual-state type was requested. */
+    void sltCheckForRequestedVisualStateType();
 #endif /* RT_OS_DARWIN */
 
     /* Handler: Console callback stuff: */
@@ -117,9 +122,9 @@ private:
     void fadeToNormal();
 
     /** Mac OS X: Revalidates 'fullscreen' mode for @a pMachineWindow. */
-    void revalidateFullscreenWindow(UIMachineWindow *pMachineWindow);
+    void revalidateNativeFullScreen(UIMachineWindow *pMachineWindow);
     /** Mac OS X: Revalidates 'fullscreen' mode for all windows. */
-    void revalidateFullscreenWindows();
+    void revalidateNativeFullScreen();
 #endif /* Q_WS_MAC */
 
     /* Variables: */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
index 5a92e6b..04ee360 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
@@ -91,6 +91,15 @@ void UIMachineWindowFullscreen::handleNativeNotification(const QString &strNativ
                 "Native fullscreen mode exited, notifying listener...\n"));
         emit sigNotifyAboutNativeFullscreenDidExit();
     }
+    /* Handle 'NSWindowDidFailToEnterFullScreenNotification' notification: */
+    else if (strNativeNotificationName == "NSWindowDidFailToEnterFullScreenNotification")
+    {
+        /* Mark window transition complete: */
+        m_fIsInFullscreenTransition = false;
+        LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
+                "Native fullscreen mode fail to enter, notifying listener...\n"));
+        emit sigNotifyAboutNativeFullscreenFailToEnter();
+    }
 }
 #endif /* Q_WS_MAC */
 
@@ -216,6 +225,8 @@ void UIMachineWindowFullscreen::prepareVisualState()
                                                                      UIMachineWindow::handleNativeNotification);
         UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidExitFullScreenNotification", this,
                                                                      UIMachineWindow::handleNativeNotification);
+        UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidFailToEnterFullScreenNotification", this,
+                                                                     UIMachineWindow::handleNativeNotification);
     }
 #endif /* Q_WS_MAC */
 }
@@ -280,6 +291,7 @@ void UIMachineWindowFullscreen::cleanupVisualState()
         UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidEnterFullScreenNotification", this);
         UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowWillExitFullScreenNotification", this);
         UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidExitFullScreenNotification", this);
+        UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidFailToEnterFullScreenNotification", this);
     }
 #endif /* Q_WS_MAC */
 
@@ -325,8 +337,6 @@ void UIMachineWindowFullscreen::placeOnScreen()
     /* Move mini-toolbar into appropriate place: */
     if (m_pMiniToolBar)
         m_pMiniToolBar->adjustGeometry();
-    /* Process pending move & resize events: */
-    qApp->processEvents();
 }
 
 void UIMachineWindowFullscreen::showInNecessaryMode()
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
index 8b73359..7584217 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
@@ -40,6 +40,8 @@ signals:
     void sigNotifyAboutNativeFullscreenWillExit();
     /** Mac OS X: Notifies listener about native 'fullscreen' exited. */
     void sigNotifyAboutNativeFullscreenDidExit();
+    /** Mac OS X: Notifies listener about native 'fullscreen' fail to enter. */
+    void sigNotifyAboutNativeFullscreenFailToEnter();
 #endif /* RT_OS_DARWIN */
 
 protected:
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
index 2a3f79f..3828c6c 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
@@ -55,7 +55,8 @@ void UIMachineLogicNormal::sltCheckForRequestedVisualStateType()
             /* And supported: */
             if (uisession()->isGuestSupportsSeamless())
             {
-                LogRel(("UIMachineLogicNormal: Going 'seamless' as requested...\n"));
+                LogRel(("UIMachineLogicNormal::sltCheckForRequestedVisualStateType: "
+                        "Going 'seamless' as requested...\n"));
                 uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
                 uisession()->changeVisualState(UIVisualStateType_Seamless);
             }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
index 9eb85fb..217325a 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
@@ -117,7 +117,8 @@ void UIMachineLogicSeamless::sltCheckForRequestedVisualStateType()
     /* If 'seamless' visual-state type is no more supported: */
     if (!uisession()->isGuestSupportsSeamless())
     {
-        LogRel(("UIMachineLogicSeamless: Leaving 'seamless' as it is no more supported...\n"));
+        LogRel(("UIMachineLogicSeamless::sltCheckForRequestedVisualStateType: "
+                "Leaving 'seamless' as it is no more supported...\n"));
         uisession()->setRequestedVisualState(UIVisualStateType_Seamless);
         uisession()->changeVisualState(UIVisualStateType_Normal);
     }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
index 4b3a8a7..391b77a 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
@@ -214,8 +214,6 @@ void UIMachineWindowSeamless::placeOnScreen()
     if (m_pMiniToolBar)
         m_pMiniToolBar->adjustGeometry();
 #endif /* !Q_WS_MAC */
-    /* Process pending move & resize events: */
-    qApp->processEvents();
 }
 
 void UIMachineWindowSeamless::showInNecessaryMode()
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
index 091503d..5ca88b2 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
@@ -111,8 +111,19 @@ UIGMachinePreview::~UIGMachinePreview()
 
 void UIGMachinePreview::setMachine(const CMachine& machine)
 {
+    /* Pause: */
     stop();
+
+    /* Assign new machine: */
     m_machine = machine;
+
+    /* Fetch machine data: */
+    m_strPreviewName = tr("No preview");
+    if (!m_machine.isNull())
+        m_strPreviewName = m_machine.GetAccessible() ? m_machine.GetName() :
+                           QApplication::translate("UIVMListView", "Inaccessible");
+
+    /* Resume: */
     restart();
 }
 
@@ -298,12 +309,7 @@ void UIGMachinePreview::paint(QPainter *pPainter, const QStyleOptionGraphicsItem
         /* Draw full background: */
         pPainter->drawPixmap(cr.x() + m_iMargin, cr.y() + m_iMargin, *m_pbgFullImage);
 
-        /* Compose name: */
-        QString strName = tr("No preview");
-        if (!m_machine.isNull())
-            strName = m_machine.GetAccessible() ? m_machine.GetName() :
-                      QApplication::translate("UIVMListView", "Inaccessible");
-        /* Paint that name: */
+        /* Paint preview name: */
         QFont font = pPainter->font();
         font.setBold(true);
         int fFlags = Qt::AlignCenter | Qt::TextWordWrap;
@@ -317,11 +323,11 @@ void UIGMachinePreview::paint(QPainter *pPainter, const QStyleOptionGraphicsItem
             h = h * .8;
             font.setPixelSize((int)h);
             pPainter->setFont(font);
-            r = pPainter->boundingRect(m_vRect, fFlags, strName);
+            r = pPainter->boundingRect(m_vRect, fFlags, m_strPreviewName);
         }
         while ((r.height() > m_vRect.height() || r.width() > m_vRect.width()) && cMax-- != 0);
         pPainter->setPen(Qt::white);
-        pPainter->drawText(m_vRect, fFlags, strName);
+        pPainter->drawText(m_vRect, fFlags, m_strPreviewName);
     }
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h
index fb968cc..138e234 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h
@@ -112,6 +112,7 @@ private:
     QPixmap *m_pbgEmptyImage;
     QPixmap *m_pbgFullImage;
     QImage *m_pPreviewImg;
+    QString m_strPreviewName;
     static UpdateIntervalMap m_intervals;
 };
 
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
index 98c5ea5..572af0e 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
@@ -314,6 +314,14 @@ void UIRuntimeMiniToolBar::cleanup()
         m_pHoverEnterTimer->stop();
     if (m_pHoverLeaveTimer->isActive())
         m_pHoverLeaveTimer->stop();
+
+    /* Destroy animation before mdi-toolbar: */
+    delete m_pAnimation;
+    m_pAnimation = 0;
+
+    /* Destroy mdi-toolbar after animation: */
+    delete m_pEmbeddedToolbar;
+    m_pEmbeddedToolbar = 0;
 }
 
 void UIRuntimeMiniToolBar::enterEvent(QEvent*)
@@ -383,11 +391,8 @@ void UIRuntimeMiniToolBar::simulateToolbarAutoHiding()
 
 void UIRuntimeMiniToolBar::setToolbarPosition(QPoint point)
 {
-    /* Make sure toolbar exists: */
-    if (!m_pEmbeddedToolbar)
-        return;
-
     /* Update position: */
+    AssertPtrReturnVoid(m_pEmbeddedToolbar);
     m_pEmbeddedToolbar->move(point);
 
 #ifdef Q_WS_X11
@@ -401,11 +406,8 @@ void UIRuntimeMiniToolBar::setToolbarPosition(QPoint point)
 
 QPoint UIRuntimeMiniToolBar::toolbarPosition() const
 {
-    /* Make sure toolbar exists: */
-    if (!m_pEmbeddedToolbar)
-        return QPoint();
-
     /* Return position: */
+    AssertPtrReturn(m_pEmbeddedToolbar, QPoint());
     return m_pEmbeddedToolbar->pos();
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
index 98edb9a..9376f58 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
@@ -172,6 +172,11 @@ void VBoxMediaComboBox::sltHandleMediumCreated(const QString &strMediumID)
     /* Search for corresponding medium: */
     UIMedium medium = vboxGlobal().medium(strMediumID);
 
+    /* Ignore mediums (and their children) which are
+     * marked as hidden or attached to hidden machines only: */
+    if (UIMedium::isMediumAttachedToHiddenMachinesOnly(medium))
+        return;
+
     /* Add only 1. NULL medium and 2. mediums of required type: */
     if (!medium.isNull() && medium.type() != mType)
         return;
diff --git a/src/VBox/GuestHost/OpenGL/Makefile.kmk b/src/VBox/GuestHost/OpenGL/Makefile.kmk
index 2a1d1da..7233624 100644
--- a/src/VBox/GuestHost/OpenGL/Makefile.kmk
+++ b/src/VBox/GuestHost/OpenGL/Makefile.kmk
@@ -116,6 +116,9 @@ VBoxOGLcrutil_LIBS.win    += $(VBOX_PATH_ADDITIONS_LIB)/VBoxDispMpLogger$(VBOX_S
 endif
 VBoxOGLcrutil_CLEAN = \
 	$(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c
+if1of ($(KBUILD_TARGET), linux)
+VBoxOGLcrutil_LDFLAGS += -Wl,-z,nodelete
+endif
 
 # vc7 hangs during compilation of this file when optimizations are enabled.
 VBoxOGLcrutil_pixel.c_CFLAGS.win.x86     += -Od
@@ -157,6 +160,9 @@ VBoxOGLhostcrutil_TEMPLATE = VBOXCROGLR3HOSTDLL
 if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_WDDM)
  VBoxOGLhostcrutil_INSTTYPE.win = both
 endif
+if1of ($(KBUILD_TARGET), linux)
+VBoxOGLhostcrutil_LDFLAGS = $(NO_SUCH_VARIABLE)
+endif
 VBoxOGLhostcrutil_LDFLAGS.darwin = $(VBoxOGLcrutil_LDFLAGS.darwin) \
 	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLhostcrutil.dylib
 VBoxOGLhostcrutil_LIBS.win =  \
diff --git a/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt b/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt
index 3df1d92..ac3b20b 100644
--- a/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt
+++ b/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt
@@ -8384,6 +8384,18 @@ props       nolist
 chromium    extpack
 chrelopcode 0
 
+# custom
+name        GetAttribsLocations
+return      void
+param       program     GLuint
+param       maxcbData   GLsizei
+param       cbData      GLsizei *
+param       pData       GLvoid *
+category    Chromium
+props       get
+chromium    extpack
+chrelopcode 1
+
 name        WindowShow
 return      void
 param       window      GLint
diff --git a/src/VBox/GuestHost/OpenGL/include/cr_net.h b/src/VBox/GuestHost/OpenGL/include/cr_net.h
index f04f38b..9ab6a8e 100644
--- a/src/VBox/GuestHost/OpenGL/include/cr_net.h
+++ b/src/VBox/GuestHost/OpenGL/include/cr_net.h
@@ -35,6 +35,7 @@
 
 #include <iprt/types.h>
 #include <iprt/thread.h>
+#include <iprt/list.h>
     
 #ifdef __cplusplus
 extern "C" {
@@ -244,6 +245,7 @@ struct CRConnection {
     struct _crclient *pClient; /* back reference, just for simplicity */
     CRVBOXHGSMI_CMDDATA CmdData;
 # endif
+    RTLISTANCHOR PendingMsgList;
 #endif
     /* Used on host side to indicate that we are not allowed to store above pointers for later use
      * in crVBoxHGCMReceiveMessage. As those messages are going to be processed after the corresponding 
@@ -303,6 +305,9 @@ extern DECLEXPORT(int) crNetRecv(
     } while (0)
 
 #endif
+#ifdef IN_GUEST
+extern DECLEXPORT(uint32_t) crNetHostCapsGet();
+#endif
 extern DECLEXPORT(void) crNetDefaultRecv( CRConnection *conn, CRMessage *msg, unsigned int len );
 extern DECLEXPORT(void) crNetDispatchMessage( CRNetReceiveFuncList *rfl, CRConnection *conn, CRMessage *msg, unsigned int len );
 
diff --git a/src/VBox/GuestHost/OpenGL/include/cr_protocol.h b/src/VBox/GuestHost/OpenGL/include/cr_protocol.h
index 1bf785b..e2752c9 100644
--- a/src/VBox/GuestHost/OpenGL/include/cr_protocol.h
+++ b/src/VBox/GuestHost/OpenGL/include/cr_protocol.h
@@ -23,9 +23,24 @@ extern "C" {
 #define CR_PROTOCOL_VERSION_MINOR 1
 
 /* new TexPresent mechanism is available */
-#define CR_VBOX_CAP_TEX_PRESENT    0x00000001
+#define CR_VBOX_CAP_TEX_PRESENT         0x00000001
 /* vbva command submission mechanism supported */
-#define CR_VBOX_CAP_CMDVBVA        0x00000002
+#define CR_VBOX_CAP_CMDVBVA             0x00000002
+/* host supports Command Blocks, i.e. CR_CMDBLOCKBEGIN_OPCODE and CR_CMDBLOCKEND_OPCODE opcodes.
+ * Command Block can be used by guest to prevent clients from blocking each other.
+ * The Command Block allows multiple command buffers to be processed with one run.
+ * Command Block commands have to obey to the following rules:
+ * CR_CMDBLOCKBEGIN_OPCODE - must be the first command in the command buffer, specifying the command block start
+ * CR_CMDBLOCKEND_OPCODE - must be the last command in the command buffer, specifying the command block end
+ * If not placed accordingly, CR_CMDBLOCK** commands are ignored.
+ * Server copies the command block buffer commands to its internal storage
+ * and processes them with one run when the command block end is signalled
+ */
+#define CR_VBOX_CAP_CMDBLOCKS            0x00000004
+/* GetAttribsLocations support */
+#define CR_VBOX_CAP_GETATTRIBSLOCATIONS  0x00000008
+
+#define CR_VBOX_CAPS_ALL                 0x0000000f
 
 
 #define CR_PRESENT_SCREEN_MASK 0xffff
@@ -102,7 +117,7 @@ typedef struct CRVBOXHGSMI_CMDDATA {
     {
         struct VBOXVDMACMD_CHROMIUM_CMD *pHgsmiCmd;
         struct VBOXCMDVBVA_CRCMD_CMD *pVbvaCmd;
-        void *pvCmd;
+        const void *pvCmd;
     };
     int          *pCmdRc;
     char         *pWriteback;
diff --git a/src/VBox/GuestHost/OpenGL/include/state/cr_glsl.h b/src/VBox/GuestHost/OpenGL/include/state/cr_glsl.h
index 81ed568..d2d3ada 100644
--- a/src/VBox/GuestHost/OpenGL/include/state/cr_glsl.h
+++ b/src/VBox/GuestHost/OpenGL/include/state/cr_glsl.h
@@ -71,7 +71,10 @@ typedef struct {
     CRGLSLUniform      *pUniforms;
     GLuint              cUniforms;
 #ifdef IN_GUEST
+    CRGLSLAttrib        *pAttribs;
+    GLuint              cAttribs;
     GLboolean           bUniformsSynced; /*uniforms info is updated since last link program call.*/
+    GLboolean           bAttribsSynced; /*attribs info is updated since last link program call.*/
 #endif
 } CRGLSLProgram;
 
@@ -102,11 +105,14 @@ DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateProgram(GLuint id);
 DECLEXPORT(GLuint) STATE_APIENTRY crStateDeleteObjectARB( VBoxGLhandleARB obj );
 
 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramUniformsCached(GLuint program);
+DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramAttribsCached(GLuint program);
 
 #ifdef IN_GUEST
 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms(GLuint program, GLsizei cbData, GLvoid *pData);
+DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheAttribs(GLuint program, GLsizei cbData, GLvoid *pData);
 #else
 DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheUniforms(GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData);
+DECLEXPORT(void) STATE_APIENTRY crStateGLSLProgramCacheAttribs(GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData);
 #endif
 
 #ifdef __cplusplus
diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c b/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c
index b788bd4..ff6d2c6 100644
--- a/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c
+++ b/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c
@@ -567,6 +567,22 @@ void PACK_APIENTRY crPackGetUniformsLocations(GLuint program, GLsizei maxcbData,
     CR_UNLOCK_PACKER_CONTEXT(pc);
 }
 
+void PACK_APIENTRY crPackGetAttribsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
+{
+    CR_GET_PACKER_CONTEXT(pc);
+    unsigned char *data_ptr;
+    (void) pData;
+    CR_GET_BUFFERED_POINTER(pc, 32);
+    WRITE_DATA(0, GLint, 32);
+    WRITE_DATA(4, GLenum, CR_GETATTRIBSLOCATIONS_EXTEND_OPCODE);
+    WRITE_DATA(8, GLuint, program);
+    WRITE_DATA(12, GLsizei, maxcbData);
+    WRITE_NETWORK_POINTER(16, (void *) cbData);
+    WRITE_NETWORK_POINTER(24, (void *) writeback);
+    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
+    CR_UNLOCK_PACKER_CONTEXT(pc);
+}
+
 void PACK_APIENTRY crPackGetAttribLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
 {
     CR_GET_PACKER_CONTEXT(pc);
diff --git a/src/VBox/GuestHost/OpenGL/packer/packer_special b/src/VBox/GuestHost/OpenGL/packer/packer_special
index b37cf2f..a9491f0 100644
--- a/src/VBox/GuestHost/OpenGL/packer/packer_special
+++ b/src/VBox/GuestHost/OpenGL/packer/packer_special
@@ -170,6 +170,7 @@ DeleteFramebuffersEXT
 DeleteRenderbuffersEXT
 LockArraysEXT
 GetUniformsLocations
+GetAttribsLocations
 UniformMatrix2x3fv
 UniformMatrix3x2fv
 UniformMatrix2x4fv
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c b/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
index 48d5a7e..d111e02 100644
--- a/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
+++ b/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
@@ -57,6 +57,16 @@ static void crStateFreeGLSLShader(void *data)
     crFree(pShader);
 }
 
+#ifdef IN_GUEST
+static void crStateFreeProgramAttribsLocationCache(CRGLSLProgram* pProgram)
+{
+    if (pProgram->pAttribs) crFree(pProgram->pAttribs);
+
+    pProgram->pAttribs = NULL;
+    pProgram->cAttribs = 0;
+}
+#endif
+
 static void crStateFreeProgramAttribs(CRGLSLProgram* pProgram)
 {
     GLuint i;
@@ -76,6 +86,13 @@ static void crStateFreeProgramAttribs(CRGLSLProgram* pProgram)
 
     if (pProgram->currentState.pAttribs)
         crFree(pProgram->currentState.pAttribs);
+
+#ifdef IN_GUEST
+    crStateFreeProgramAttribsLocationCache(pProgram);
+
+    pProgram->bAttribsSynced = GL_FALSE;
+#endif
+
 }
 
 static void crStateFreeProgramUniforms(CRGLSLProgram* pProgram)
@@ -360,8 +377,13 @@ DECLEXPORT(GLuint) STATE_APIENTRY crStateCreateProgram(GLuint hwid)
 
     pProgram->pUniforms = NULL;
     pProgram->cUniforms = 0;
+
 #ifdef IN_GUEST
+    pProgram->pAttribs = NULL;
+    pProgram->cAttribs = 0;
+
     pProgram->bUniformsSynced = GL_FALSE;
+    pProgram->bAttribsSynced = GL_FALSE;
 #endif
 
     crHashtableAdd(g->glsl.programs, stateId, pProgram);
@@ -600,6 +622,10 @@ DECLEXPORT(void) STATE_APIENTRY crStateLinkProgram(GLuint program)
         pProgram->activeState.pAttribs[i].name = crStrdup(pProgram->currentState.pAttribs[i].name);
     }
 
+#ifdef IN_GUEST
+    crStateFreeProgramAttribsLocationCache(pProgram);
+#endif
+
     crStateFreeProgramUniforms(pProgram);
 }
 
@@ -769,14 +795,32 @@ DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramUniformsCached(GLuint progr
 
     if (!pProgram)
     {
-        crWarning("Unknown program %d", program);
+        WARN(("Unknown program %d", program));
         return GL_FALSE;
     }
 
 #ifdef IN_GUEST
     return pProgram->bUniformsSynced;
 #else
-    crWarning("crStateIsProgramUniformsCached called on host side!!");
+    WARN(("crStateIsProgramUniformsCached called on host side!!"));
+    return GL_FALSE;
+#endif
+}
+
+DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsProgramAttribsCached(GLuint program)
+{
+    CRGLSLProgram *pProgram = crStateGetProgramObj(program);
+
+    if (!pProgram)
+    {
+        WARN(("Unknown program %d", program));
+        return GL_FALSE;
+    }
+
+#ifdef IN_GUEST
+    return pProgram->bAttribsSynced;
+#else
+    WARN(("crStateIsProgramAttribsCached called on host side!!"));
     return GL_FALSE;
 #endif
 }
@@ -859,6 +903,81 @@ crStateGLSLProgramCacheUniforms(GLuint program, GLsizei cbData, GLvoid *pData)
     CRASSERT((pCurrent-((char*)pData))==cbRead);
     CRASSERT(cbRead==cbData);
 }
+
+DECLEXPORT(void) STATE_APIENTRY
+crStateGLSLProgramCacheAttribs(GLuint program, GLsizei cbData, GLvoid *pData)
+{
+    CRGLSLProgram *pProgram = crStateGetProgramObj(program);
+    char *pCurrent = pData;
+    GLsizei cbRead, cbName;
+    GLuint i;
+
+    if (!pProgram)
+    {
+        WARN(("Unknown program %d", program));
+        return;
+    }
+
+    if (pProgram->bAttribsSynced)
+    {
+        WARN(("crStateGLSLProgramCacheAttribs: this shouldn't happen!"));
+        crStateFreeProgramAttribsLocationCache(pProgram);
+    }
+
+    if (cbData<sizeof(GLsizei))
+    {
+        WARN(("crStateGLSLProgramCacheAttribs: data too short"));
+        return;
+    }
+
+    pProgram->cAttribs = ((GLsizei*)pCurrent)[0];
+    pCurrent += sizeof(GLsizei);
+    cbRead = sizeof(GLsizei);
+
+    crDebug("crStateGLSLProgramCacheAttribs: %i active attribs", pProgram->cAttribs);
+
+    if (pProgram->cAttribs)
+    {
+        pProgram->pAttribs = crAlloc(pProgram->cAttribs*sizeof(CRGLSLAttrib));
+        if (!pProgram->pAttribs)
+        {
+            WARN(("crStateGLSLProgramCacheAttribs: no memory"));
+            pProgram->cAttribs = 0;
+            return;
+        }
+    }
+
+    for (i=0; i<pProgram->cAttribs; ++i)
+    {
+        cbRead += sizeof(GLuint)+sizeof(GLsizei);
+        if (cbRead>cbData)
+        {
+            crWarning("crStateGLSLProgramCacheAttribs: out of data reading attrib %i", i);
+            return;
+        }
+        pProgram->pAttribs[i].index = ((GLint*)pCurrent)[0];
+        pCurrent += sizeof(GLint);
+        cbName = ((GLsizei*)pCurrent)[0];
+        pCurrent += sizeof(GLsizei);
+
+        cbRead += cbName;
+        if (cbRead>cbData)
+        {
+            crWarning("crStateGLSLProgramCacheAttribs: out of data reading attrib's name %i", i);
+            return;
+        }
+
+        pProgram->pAttribs[i].name = crStrndup(pCurrent, cbName);
+        pCurrent += cbName;
+
+        crDebug("crStateGLSLProgramCacheAttribs: attribs[%i]=%d, %s", i, pProgram->pAttribs[i].index, pProgram->pAttribs[i].name);
+    }
+
+    pProgram->bAttribsSynced = GL_TRUE;
+
+    CRASSERT((pCurrent-((char*)pData))==cbRead);
+    CRASSERT(cbRead==cbData);
+}
 #else
 static GLboolean crStateGLSLProgramCacheOneUniform(GLuint location, GLsizei cbName, GLchar *pName, 
                                                    char **pCurrent, GLsizei *pcbWritten, GLsizei maxcbData)
@@ -990,6 +1109,137 @@ crStateGLSLProgramCacheUniforms(GLuint program, GLsizei maxcbData, GLsizei *cbDa
 
     CRASSERT((pCurrent-((char*)pData))==cbWritten);
 }
+
+static GLboolean crStateGLSLProgramCacheOneAttrib(GLuint location, GLsizei cbName, GLchar *pName,
+                                                   char **pCurrent, GLsizei *pcbWritten, GLsizei maxcbData)
+{
+    *pcbWritten += sizeof(GLint)+sizeof(GLsizei)+cbName;
+    if (*pcbWritten>maxcbData)
+    {
+        WARN(("crStateGLSLProgramCacheOneAttrib: buffer too small"));
+        crFree(pName);
+        return GL_FALSE;
+    }
+
+    crDebug("crStateGLSLProgramCacheOneAttrib: attrib[%i]=%s.", location, pName);
+
+    ((GLint*)*pCurrent)[0] = location;
+    *pCurrent += sizeof(GLint);
+    ((GLsizei*)*pCurrent)[0] = cbName;
+    *pCurrent += sizeof(GLsizei);
+    crMemcpy(*pCurrent, pName, cbName);
+    *pCurrent += cbName;
+
+    return GL_TRUE;
+}
+
+DECLEXPORT(void) STATE_APIENTRY
+crStateGLSLProgramCacheAttribs(GLuint program, GLsizei maxcbData, GLsizei *cbData, GLvoid *pData)
+{
+    CRGLSLProgram *pProgram = crStateGetProgramObj(program);
+    GLint maxAttribLen, activeAttribs=0, fakeAttribsCount, i, j;
+    char *pCurrent = pData;
+    GLsizei cbWritten;
+
+    if (!pProgram)
+    {
+        crWarning("Unknown program %d", program);
+        return;
+    }
+
+    diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttribLen);
+    diff_api.GetProgramiv(pProgram->hwid, GL_ACTIVE_ATTRIBUTES, &activeAttribs);
+
+    *cbData = 0;
+
+    cbWritten = sizeof(GLsizei);
+    if (cbWritten>maxcbData)
+    {
+        crWarning("crStateGLSLProgramCacheAttribs: buffer too small");
+        return;
+    }
+    ((GLsizei*)pCurrent)[0] = activeAttribs;
+    fakeAttribsCount = activeAttribs;
+    pCurrent += sizeof(GLsizei);
+
+    crDebug("crStateGLSLProgramCacheAttribs: %i active attribs", activeAttribs);
+
+    if (activeAttribs>0)
+    {
+        /*+8 to make sure our array attribs with higher indices and [] will fit in as well*/
+        GLchar *name = (GLchar *) crAlloc(maxAttribLen+8);
+        GLenum type;
+        GLint size;
+        GLsizei cbName;
+        GLint location;
+
+        if (!name)
+        {
+            crWarning("crStateGLSLProgramCacheAttribs: no memory");
+            return;
+        }
+
+        for (i=0; i<activeAttribs; ++i)
+        {
+            diff_api.GetActiveAttrib(pProgram->hwid, i, maxAttribLen, &cbName, &size, &type, name);
+            location = diff_api.GetAttribLocation(pProgram->hwid, name);
+
+            if (!crStateGLSLProgramCacheOneAttrib(location, cbName, name, &pCurrent, &cbWritten, maxcbData))
+                return;
+
+            /* Only one active attrib variable will be reported for a attrib array by glGetActiveAttrib,
+             * so we insert fake elements for other array elements.
+             */
+            if (size!=1)
+            {
+                char *pIndexStr = crStrchr(name, '[');
+                GLint firstIndex=1;
+                fakeAttribsCount += size;
+
+                crDebug("crStateGLSLProgramCacheAttribs: expanding array attrib, size=%i", size);
+
+                /*For array attribs it's valid to query location of 1st element as both attrib and attrib[0].
+                 *The name returned by glGetActiveAttrib is driver dependent,
+                 *atleast it's with [0] on win/ati and without [0] on linux/nvidia.
+                 */
+                if (!pIndexStr)
+                {
+                    pIndexStr = name+cbName;
+                    firstIndex=0;
+                }
+                else
+                {
+                    cbName = pIndexStr-name;
+                    if (!crStateGLSLProgramCacheOneAttrib(location, cbName, name, &pCurrent, &cbWritten, maxcbData))
+                        return;
+                }
+
+                for (j=firstIndex; j<size; ++j)
+                {
+                    sprintf(pIndexStr, "[%i]", j);
+                    cbName = crStrlen(name);
+
+                    location = diff_api.GetAttribLocation(pProgram->hwid, name);
+
+                    if (!crStateGLSLProgramCacheOneAttrib(location, cbName, name, &pCurrent, &cbWritten, maxcbData))
+                        return;
+                }
+            }
+        }
+
+        crFree(name);
+    }
+
+    if (fakeAttribsCount!=activeAttribs)
+    {
+        ((GLsizei*)pData)[0] = fakeAttribsCount;
+        crDebug("FakeCount %i", fakeAttribsCount);
+    }
+
+    *cbData = cbWritten;
+
+    CRASSERT((pCurrent-((char*)pData))==cbWritten);
+}
 #endif
 
 DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformLocation(GLuint program, const char * name)
@@ -1027,6 +1277,41 @@ DECLEXPORT(GLint) STATE_APIENTRY crStateGetUniformLocation(GLuint program, const
 #endif
 }
 
+DECLEXPORT(GLint) STATE_APIENTRY crStateGetAttribLocation(GLuint program, const char * name)
+{
+#ifdef IN_GUEST
+    CRGLSLProgram *pProgram = crStateGetProgramObj(program);
+    GLint result=-1;
+    GLuint i;
+
+    if (!pProgram)
+    {
+        WARN(("Unknown program %d", program));
+        return -1;
+    }
+
+    if (!pProgram->bAttribsSynced)
+    {
+        WARN(("crStateGetAttribLocation called for uncached attribs"));
+        return -1;
+    }
+
+    for (i=0; i<pProgram->cAttribs; ++i)
+    {
+        if (!crStrcmp(name, pProgram->pAttribs[i].name))
+        {
+            result = pProgram->pAttribs[i].index;
+            break;
+        }
+    }
+
+    return result;
+#else
+    crWarning("crStateGetAttribLocation called on host side!!");
+    return -1;
+#endif
+}
+
 static void crStateGLSLCreateShadersCB(unsigned long key, void *data1, void *data2)
 {
     CRGLSLShader *pShader = (CRGLSLShader*) data1;
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_special b/src/VBox/GuestHost/OpenGL/state_tracker/state_special
index dfdca2f..46b6805 100644
--- a/src/VBox/GuestHost/OpenGL/state_tracker/state_special
+++ b/src/VBox/GuestHost/OpenGL/state_tracker/state_special
@@ -376,6 +376,7 @@ UseProgram
 DeleteProgram
 ValidateProgram
 BindAttribLocation
+GetAttribLocation
 GetUniformLocation
 CopyTexImage2D
 GenFramebuffersEXT
diff --git a/src/VBox/GuestHost/OpenGL/util/net.c b/src/VBox/GuestHost/OpenGL/util/net.c
index 72d9f7a..00216e3 100644
--- a/src/VBox/GuestHost/OpenGL/util/net.c
+++ b/src/VBox/GuestHost/OpenGL/util/net.c
@@ -1275,6 +1275,18 @@ void crNetReadline( CRConnection *conn, void *buf )
     }
 }
 
+#ifdef IN_GUEST
+uint32_t crNetHostCapsGet()
+{
+#ifdef VBOX_WITH_HGCM
+    if ( cr_net.use_hgcm )
+        return crVBoxHGCMHostCapsGet();
+#endif
+    WARN(("HostCaps supportted for HGCM only!"));
+    return 0;
+}
+#endif
+
 /**
  * The big boy -- call this function to see (non-blocking) if there is
  * any pending work.  If there is, the networking layer's "work received"
diff --git a/src/VBox/GuestHost/OpenGL/util/net_internals.h b/src/VBox/GuestHost/OpenGL/util/net_internals.h
index 9ccd89a..2ad26af 100644
--- a/src/VBox/GuestHost/OpenGL/util/net_internals.h
+++ b/src/VBox/GuestHost/OpenGL/util/net_internals.h
@@ -101,6 +101,9 @@ extern int crVBoxHGCMRecv(
         CRConnection *conn
 #endif
         );
+#ifdef IN_GUEST
+extern uint32_t crVBoxHGCMHostCapsGet();
+#endif
 extern CRConnection** crVBoxHGCMDump( int *num );
 extern void crVBoxHGCMTearDown(void);
 #endif
diff --git a/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c b/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
index d5d057d..32bf13e 100644
--- a/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
+++ b/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c
@@ -184,6 +184,10 @@ typedef struct {
 #else
     int                  iGuestDrv;
 #endif
+#ifdef IN_GUEST
+    uint32_t             u32HostCaps;
+    bool                 fHostCapsInitialized;
+#endif
 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     bool bHgsmiOn;
 #endif
@@ -1262,19 +1266,62 @@ static int crVBoxHGCMSetVersion(CRConnection *conn, unsigned int vMajor, unsigne
 
     rc = crVBoxHGCMCall(conn, &parms, sizeof(parms));
 
-    if (RT_FAILURE(rc) || RT_FAILURE(parms.hdr.result))
+    if (RT_SUCCESS(rc))
+    {
+        rc =  parms.hdr.result;
+        if (RT_SUCCESS(rc))
+        {
+            conn->vMajor = CR_PROTOCOL_VERSION_MAJOR;
+            conn->vMinor = CR_PROTOCOL_VERSION_MINOR;
+
+            return VINF_SUCCESS;
+        }
+        else
+            WARN(("Host doesn't accept our version %d.%d. Make sure you have appropriate additions installed!",
+                  parms.vMajor.u.value32, parms.vMinor.u.value32));
+    }
+    else
+        WARN(("crVBoxHGCMCall failed %d", rc));
+
+    return rc;
+}
+
+static int crVBoxHGCMGetHostCaps(CRConnection *conn, uint32_t *pu32HostCaps)
+{
+    CRVBOXHGCMGETCAPS caps;
+    int rc;
+
+    caps.hdr.result      = VERR_WRONG_ORDER;
+    caps.hdr.u32ClientID = conn->u32ClientID;
+    caps.hdr.u32Function = SHCRGL_GUEST_FN_GET_CAPS;
+    caps.hdr.cParms      = SHCRGL_CPARMS_GET_CAPS;
+
+    caps.Caps.type       = VMMDevHGCMParmType_32bit;
+    caps.Caps.u.value32  = 0;
+
+    rc = crVBoxHGCMCall(conn, &caps, sizeof(caps));
+
+    if (RT_SUCCESS(rc))
     {
-        crWarning("Host doesn't accept our version %d.%d. Make sure you have appropriate additions installed!",
-                  parms.vMajor.u.value32, parms.vMinor.u.value32);
+        rc =  caps.hdr.result;
+        if (RT_SUCCESS(rc))
+        {
+            *pu32HostCaps = caps.Caps.u.value32;
+            return VINF_SUCCESS;
+        }
+        else
+            WARN(("SHCRGL_GUEST_FN_GET_CAPS failed %d", rc));
         return FALSE;
     }
+    else
+        WARN(("crVBoxHGCMCall failed %d", rc));
 
-    conn->vMajor = CR_PROTOCOL_VERSION_MAJOR;
-    conn->vMinor = CR_PROTOCOL_VERSION_MINOR;
+    *pu32HostCaps = 0;
 
-    return TRUE;
+    return rc;
 }
 
+
 static int crVBoxHGCMSetPID(CRConnection *conn, unsigned long long pid)
 {
     CRVBOXHGCMSETPID parms;
@@ -1379,17 +1426,38 @@ static int crVBoxHGCMDoConnect( CRConnection *conn )
             crDebug("HGCM connect was successful: client id =0x%x\n", conn->u32ClientID);
 
             rc = crVBoxHGCMSetVersion(conn, CR_PROTOCOL_VERSION_MAJOR, CR_PROTOCOL_VERSION_MINOR);
-            if (!rc)
+            if (RT_FAILURE(rc))
             {
-                return rc;
+                WARN(("crVBoxHGCMSetVersion failed %d", rc));
+                return FALSE;
             }
 #ifdef RT_OS_WINDOWS
             rc = crVBoxHGCMSetPID(conn, GetCurrentProcessId());
 #else
             rc = crVBoxHGCMSetPID(conn, crGetPID());
 #endif
+            if (RT_FAILURE(rc))
+            {
+                WARN(("crVBoxHGCMSetPID failed %d", rc));
+                return FALSE;
+            }
+
+            if (!g_crvboxhgcm.fHostCapsInitialized)
+            {
+                rc = crVBoxHGCMGetHostCaps(conn, &g_crvboxhgcm.u32HostCaps);
+                if (RT_FAILURE(rc))
+                {
+                    WARN(("VBoxCrHgsmiCtlConGetHostCaps failed %d", rc));
+                    g_crvboxhgcm.u32HostCaps = 0;
+                }
+
+                /* host may not support it, ignore any failures */
+                g_crvboxhgcm.fHostCapsInitialized = true;
+                rc = VINF_SUCCESS;
+            }
+
             VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
-            return rc;
+            return RT_SUCCESS(rc);
         }
         else
         {
@@ -1412,7 +1480,7 @@ static int crVBoxHGCMDoConnect( CRConnection *conn )
     }
 
     VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
-    return TRUE;
+    return FALSE;
 
 #else /*#ifdef IN_GUEST*/
     crError("crVBoxHGCMDoConnect called on host side!");
@@ -1637,7 +1705,6 @@ static void _crVBoxHGSMIFree(CRConnection *conn, void *buf)
     {
         PVBOXUHGSMI_BUFFER pBuf = _crVBoxHGSMIBufFromHdr(hgcm_buffer);
         PCRVBOXHGSMI_CLIENT pClient = (PCRVBOXHGSMI_CLIENT)pBuf->pvUserData;
-        pBuf->pfnUnlock(pBuf);
         _crVBoxHGSMIBufFree(pClient, pBuf);
     }
     else
@@ -1867,6 +1934,10 @@ _crVBoxHGSMIWriteReadExact(CRConnection *conn, PCRVBOXHGSMI_CLIENT pClient, void
         {
             uint32_t cbWriteback = parms->cbWriteback;
             rc = parms->hdr.result;
+#ifdef DEBUG_misha
+            /* catch it here to test the buffer */
+            Assert(RT_SUCCESS(parms->hdr.result) || parms->hdr.result == VERR_BUFFER_OVERFLOW);
+#endif
             _crVBoxHGSMICmdBufferUnlock(pClient);
 #ifdef DEBUG
             parms = NULL;
@@ -2196,9 +2267,31 @@ static int crVBoxHGSMIDoConnect( CRConnection *conn )
 
     pClient = _crVBoxHGSMIClientGet(conn);
     if (pClient)
+    {
         rc = VBoxCrHgsmiCtlConGetClientID(pClient->pHgsmi, &conn->u32ClientID);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("VBoxCrHgsmiCtlConGetClientID failed %d", rc));
+        }
+        if (!g_crvboxhgcm.fHostCapsInitialized)
+        {
+            rc = VBoxCrHgsmiCtlConGetHostCaps(pClient->pHgsmi, &g_crvboxhgcm.u32HostCaps);
+            if (RT_SUCCESS(rc))
+            {
+                g_crvboxhgcm.fHostCapsInitialized = true;
+            }
+            else
+            {
+                WARN(("VBoxCrHgsmiCtlConGetHostCaps failed %d", rc));
+                g_crvboxhgcm.u32HostCaps = 0;
+            }
+        }
+    }
     else
+    {
+        WARN(("_crVBoxHGSMIClientGet failed %d", rc));
         rc = VERR_GENERAL_FAILURE;
+    }
 
     VBOXCRHGSMIPROFILE_FUNC_EPILOGUE();
 
@@ -2305,6 +2398,11 @@ void crVBoxHGCMInit(CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned
     crInitMutex(&g_crvboxhgcm.recvmutex);
 #endif
     g_crvboxhgcm.bufpool = crBufferPoolInit(16);
+
+#ifdef IN_GUEST
+    g_crvboxhgcm.fHostCapsInitialized = false;
+    g_crvboxhgcm.u32HostCaps = 0;
+#endif
 }
 
 /* Callback function used to free buffer pool entries */
@@ -2441,6 +2539,10 @@ void crVBoxHGCMConnection(CRConnection *conn
     CRASSERT(conn->pHostBuffer);
     conn->cbHostBuffer = 0;
 
+#if !defined(IN_GUEST)
+    RTListInit(&conn->PendingMsgList);
+#endif
+
 #ifdef CHROMIUM_THREADSAFE
     crLockMutex(&g_crvboxhgcm.mutex);
 #endif
@@ -2500,6 +2602,14 @@ void _crVBoxHGCMPerformReceiveMessage(CRConnection *conn)
     }
 }
 
+#ifdef IN_GUEST
+uint32_t crVBoxHGCMHostCapsGet()
+{
+    Assert(g_crvboxhgcm.fHostCapsInitialized);
+    return g_crvboxhgcm.u32HostCaps;
+}
+#endif
+
 int crVBoxHGCMRecv(
 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
         CRConnection *conn
diff --git a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
index 33803bc..b0666b3 100644
--- a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
+++ b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -426,6 +426,13 @@ static int VBoxDrvDarwinOpen(dev_t Dev, int fFlags, int fDevType, struct proc *p
         return EACCES;
 
     /*
+     * The process issuing the request must be the current process.
+     */
+    RTPROCESS Process = RTProcSelf();
+    if (Process != proc_pid(pProcess))
+        return EIO;
+
+    /*
      * Find the session created by org_virtualbox_SupDrvClient, fail
      * if no such session, and mark it as opened. We set the uid & gid
      * here too, since that is more straight forward at this point.
@@ -443,7 +450,6 @@ static int VBoxDrvDarwinOpen(dev_t Dev, int fFlags, int fDevType, struct proc *p
         RTUID           Uid = pCred->cr_ruid;
         RTGID           Gid = pCred->cr_rgid;
 #endif
-        RTPROCESS       Process = RTProcSelf();
         unsigned        iHash = SESSION_HASH(Process);
         RTSpinlockAcquire(g_Spinlock);
 
@@ -523,14 +529,16 @@ static int VBoxDrvDarwinIOCtl(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags,
      * Find the session.
      */
     RTSpinlockAcquire(g_Spinlock);
+
     pSession = g_apSessionHashTab[iHash];
-    while (pSession && pSession->Process != Process && pSession->fUnrestricted == fUnrestricted && pSession->fOpened)
+    while (pSession && (pSession->Process != Process || pSession->fUnrestricted != fUnrestricted || !pSession->fOpened))
         pSession = pSession->pNextHash;
 
     if (RT_LIKELY(pSession))
         supdrvSessionRetain(pSession);
+
     RTSpinlockReleaseNoInts(g_Spinlock);
-    if (!pSession)
+    if (RT_UNLIKELY(!pSession))
     {
         OSDBGPRINT(("VBoxDrvDarwinIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#lx\n",
                     (int)Process, iCmd));
@@ -1207,11 +1215,8 @@ bool org_virtualbox_SupDrvClient::start(IOService *pProvider)
                 RTSpinlockAcquire(g_Spinlock);
 
                 PSUPDRVSESSION pCur = g_apSessionHashTab[iHash];
-                if (pCur && pCur->Process != m_pSession->Process)
-                {
-                    do pCur = pCur->pNextHash;
-                    while (pCur && pCur->Process != m_pSession->Process);
-                }
+                while (pCur && pCur->Process != m_pSession->Process)
+                    pCur = pCur->pNextHash;
                 if (!pCur)
                 {
                     m_pSession->pNextHash = g_apSessionHashTab[iHash];
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
index 2a7bbc2..c4360d4 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
@@ -143,6 +143,9 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinQueryINetCfg(OUT INetCfg **ppNetCfg,
 
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinReleaseINetCfg(IN INetCfg *pNetCfg, IN BOOL fHasWriteLock)
 {
+    if (!pNetCfg) /* If network config has been released already, just bail out. */
+        return S_OK;
+
     HRESULT hr = pNetCfg->Uninitialize();
     if (FAILED(hr))
     {
@@ -273,21 +276,19 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallComponent(IN INetCfg *pNetCfg, I
     return hr;
 }
 
-/** @todo r=bird: This function is not in the header file, why is it
- *        exported? */
-VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallInfAndComponent(IN INetCfg *pNetCfg, IN LPCWSTR pszwComponentId, IN const GUID *pguidClass,
-                                                                IN LPCWSTR const *apInfPaths, IN UINT cInfPaths,
-                                                                OUT INetCfgComponent **ppComponent)
+static HRESULT vboxNetCfgWinInstallInfAndComponent(IN INetCfg *pNetCfg, IN LPCWSTR pszwComponentId, IN const GUID *pguidClass,
+                                                   IN LPCWSTR const *apInfPaths, IN UINT cInfPaths,
+                                                   OUT INetCfgComponent **ppComponent)
 {
     HRESULT hr = S_OK;
-    UINT i = 0;
+    UINT cFilesProcessed = 0;
 
     NonStandardLogFlow(("Installing %u INF files ...\n", cInfPaths));
 
-    for (; i < cInfPaths; i++)
+    for (; cFilesProcessed < cInfPaths; cFilesProcessed++)
     {
-        NonStandardLogFlow(("Installing INF file \"%ws\" ...\n", apInfPaths[i]));
-        hr = VBoxDrvCfgInfInstall(apInfPaths[i]);
+        NonStandardLogFlow(("Installing INF file \"%ws\" ...\n", apInfPaths[cFilesProcessed]));
+        hr = VBoxDrvCfgInfInstall(apInfPaths[cFilesProcessed]);
         if (FAILED(hr))
         {
             NonStandardLogFlow(("VBoxNetCfgWinInfInstall failed, hr (0x%x)\n", hr));
@@ -304,8 +305,19 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallInfAndComponent(IN INetCfg *pNet
 
     if (FAILED(hr))
     {
-        for (UINT j = i - 1; j != 0; j--)
-            VBoxDrvCfgInfUninstall(apInfPaths[j], 0);
+        NonStandardLogFlow(("Installation failed, rolling back installation set ...\n"));
+
+        do
+        {
+            HRESULT hr2 = VBoxDrvCfgInfUninstall(apInfPaths[cFilesProcessed], 0);
+            if (FAILED(hr2))
+                NonStandardLogFlow(("VBoxDrvCfgInfUninstall failed, hr (0x%x)\n", hr2));
+                /* Keep going. */
+            if (!cFilesProcessed)
+                break;
+        } while (cFilesProcessed--);
+
+        NonStandardLogFlow(("Rollback complete\n"));
     }
 
     return hr;
@@ -2025,7 +2037,7 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltInstall(IN INetCfg *pNc,
     if (SUCCEEDED(hr))
     {
         NonStandardLog("NetFlt will be installed ...\n");
-        hr = VBoxNetCfgWinInstallInfAndComponent(pNc, VBOXNETCFGWIN_NETFLT_ID,
+        hr = vboxNetCfgWinInstallInfAndComponent(pNc, VBOXNETCFGWIN_NETFLT_ID,
                                                  &GUID_DEVCLASS_NETSERVICE,
                                                  apInfFullPaths,
                                                  cInfFullPaths,
diff --git a/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp b/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp
index a2a2aeb..9dbacb0 100644
--- a/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp
+++ b/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp
@@ -598,7 +598,7 @@ org_virtualbox_VBoxUSBClient::free()
 {
     uint32_t cInstances = ASMAtomicDecU32(&g_cInstances); NOREF(cInstances);
     Log(("VBoxUSBClient::free([%p]) new g_cInstances=%d\n", this, cInstances));
-    IOService::free();
+    IOUserClient::free();
 }
 
 
diff --git a/src/VBox/HostDrivers/darwin/VBoxNetSend.h b/src/VBox/HostDrivers/darwin/VBoxNetSend.h
index 42f7163..0aadc4c 100644
--- a/src/VBox/HostDrivers/darwin/VBoxNetSend.h
+++ b/src/VBox/HostDrivers/darwin/VBoxNetSend.h
@@ -13,15 +13,6 @@
  * Foundation, in version 2 as it comes in the "COPYING" file of the
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
  */
 
 /** @todo move this to src/VBox/HostDrivers/darwin as a .cpp file. */
diff --git a/src/VBox/HostServices/SharedClipboard/service.cpp b/src/VBox/HostServices/SharedClipboard/service.cpp
index 413e772..f4c5d6f 100644
--- a/src/VBox/HostServices/SharedClipboard/service.cpp
+++ b/src/VBox/HostServices/SharedClipboard/service.cpp
@@ -329,8 +329,12 @@ static DECLCALLBACK(int) svcDisconnect (void *, uint32_t u32ClientID, void *pvCl
 {
     VBOXCLIPBOARDCLIENTDATA *pClient = (VBOXCLIPBOARDCLIENTDATA *)pvClient;
 
+    LogRel2(("svcDisconnect: u32ClientID = %d\n", u32ClientID));
+
     vboxSvcClipboardReportMsg (pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT, 0);
 
+    vboxSvcClipboardCompleteReadData(pClient, VERR_NO_DATA, 0);
+
     vboxClipboardDisconnect (pClient);
 
     memset (pClient, 0, sizeof (*pClient));
@@ -760,16 +764,11 @@ static SSMFIELD const g_aClipboardClientDataFields[] =
 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM)
 {
 #ifndef UNIT_TEST
-    /* If there are any pending requests, they must be completed here. Since
-     * the service is single threaded, there could be only requests
-     * which the service itself has postponed.
-     *
-     * HGCM knows that the state is being saved and that the pfnComplete
-     * calls are just clean ups. These requests are saved by the VMMDev.
-     *
-     * When the state will be restored, these requests will be reissued
+    /* 
+     * When the state will be restored, pending requests will be reissued
      * by VMMDev. The service therefore must save state as if there were no
      * pending request.
+     * Pending requests, if any, will be completed in svcDisconnect.
      */
     LogRel2 (("svcSaveState: u32ClientID = %d\n", u32ClientID));
 
@@ -780,15 +779,6 @@ static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClie
     SSMR3PutU32 (pSSM, UINT32_C (0x80000002));
     int rc = SSMR3PutStructEx (pSSM, pClient, sizeof(*pClient), 0 /*fFlags*/, &g_aClipboardClientDataFields[0], NULL);
     AssertRCReturn (rc, rc);
-
-    if (pClient->fAsync)
-    {
-        g_pHelpers->pfnCallComplete (pClient->async.callHandle, VINF_SUCCESS /* error code is not important here. */);
-        pClient->fAsync = false;
-    }
-
-    vboxSvcClipboardCompleteReadData (pClient, VINF_SUCCESS, 0);
-
 #endif /* !UNIT_TEST */
     return VINF_SUCCESS;
 }
diff --git a/src/VBox/HostServices/SharedFolders/mappings.cpp b/src/VBox/HostServices/SharedFolders/mappings.cpp
index 3031090..10c8e75 100644
--- a/src/VBox/HostServices/SharedFolders/mappings.cpp
+++ b/src/VBox/HostServices/SharedFolders/mappings.cpp
@@ -534,7 +534,7 @@ void testMapFolder(RTTEST hTest)
 }
 #endif
 int vbsfMapFolder(PSHFLCLIENTDATA pClient, PSHFLSTRING pszMapName,
-                  RTUTF16 pwszDelimiter, bool fCaseSensitive, SHFLROOT *pRoot)
+                  RTUTF16 wcDelimiter, bool fCaseSensitive, SHFLROOT *pRoot)
 {
     MAPPING *pFolderMapping = NULL;
 
@@ -547,13 +547,18 @@ int vbsfMapFolder(PSHFLCLIENTDATA pClient, PSHFLSTRING pszMapName,
         Log(("vbsfMapFolder %ls\n", pszMapName->String.ucs2));
     }
 
+    AssertMsgReturn(wcDelimiter == '/' || wcDelimiter == '\\',
+                    ("Invalid path delimiter: %#x\n", wcDelimiter),
+                    VERR_INVALID_PARAMETER);
     if (pClient->PathDelimiter == 0)
     {
-        pClient->PathDelimiter = pwszDelimiter;
+        pClient->PathDelimiter = wcDelimiter;
     }
     else
     {
-        Assert(pwszDelimiter == pClient->PathDelimiter);
+        AssertMsgReturn(wcDelimiter == pClient->PathDelimiter,
+                        ("wcDelimiter=%#x PathDelimiter=%#x", wcDelimiter, pClient->PathDelimiter),
+                        VERR_INVALID_PARAMETER);
     }
 
     if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8))
diff --git a/src/VBox/HostServices/SharedFolders/service.cpp b/src/VBox/HostServices/SharedFolders/service.cpp
index 0c724f3..8035d89 100644
--- a/src/VBox/HostServices/SharedFolders/service.cpp
+++ b/src/VBox/HostServices/SharedFolders/service.cpp
@@ -384,7 +384,7 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 SHFLSTRING *pString    = (SHFLSTRING *)paParms[1].u.pointer.addr;
 
                 /* Verify parameters values. */
-                if (!ShflStringIsValid(pString, paParms[1].u.pointer.size))
+                if (!ShflStringIsValidOut(pString, paParms[1].u.pointer.size))
                 {
                     rc = VERR_INVALID_PARAMETER;
                 }
@@ -430,7 +430,7 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 uint32_t cbParms        = paParms[2].u.pointer.size;
 
                 /* Verify parameters values. */
-                if (   !ShflStringIsValid(pPath, cbPath)
+                if (   !ShflStringIsValidIn(pPath, cbPath, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8))
                     || (cbParms != sizeof (SHFLCREATEPARMS))
                    )
                 {
@@ -441,7 +441,6 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 else
                 {
                     /* Execute the function. */
-
                     rc = vbsfCreate (pClient, root, pPath, cbPath, pParms);
 
                     if (RT_SUCCESS(rc))
@@ -489,7 +488,6 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 else
                 {
                     /* Execute the function. */
-
                     rc = vbsfClose (pClient, root, Handle);
 
                     if (RT_SUCCESS(rc))
@@ -761,7 +759,7 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 /* Verify parameters values. */
                 if (   (length < sizeof (SHFLDIRINFO))
                     ||  length > paParms[5].u.pointer.size
-                    ||  !ShflStringIsValidOrNull(pPath, paParms[4].u.pointer.size)
+                    ||  !ShflStringIsValidOrNullIn(pPath, paParms[4].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8))
                    )
                 {
                     rc = VERR_INVALID_PARAMETER;
@@ -829,7 +827,7 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 uint32_t  cbBuffer = paParms[2].u.pointer.size;
 
                 /* Verify parameters values. */
-                if (!ShflStringIsValidOrNull(pPath, paParms[1].u.pointer.size))
+                if (!ShflStringIsValidOrNullIn(pPath, paParms[1].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8)))
                 {
                     rc = VERR_INVALID_PARAMETER;
                 }
@@ -874,7 +872,7 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 RTUTF16     delimiter  = (RTUTF16)paParms[2].u.uint32;
 
                 /* Verify parameters values. */
-                if (!ShflStringIsValid(pszMapName, paParms[0].u.pointer.size))
+                if (!ShflStringIsValidIn(pszMapName, paParms[0].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8)))
                 {
                     rc = VERR_INVALID_PARAMETER;
                 }
@@ -925,22 +923,37 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 bool        fCaseSensitive = !!paParms[3].u.uint32;
 
                 /* Verify parameters values. */
-                if (!ShflStringIsValid(pszMapName, paParms[0].u.pointer.size))
+                if (ShflStringIsValidIn(pszMapName, paParms[0].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8)))
                 {
-                    rc = VERR_INVALID_PARAMETER;
+                    rc = VINF_SUCCESS;
                 }
                 else
                 {
+                    rc = VERR_INVALID_PARAMETER;
 
-                    /* Execute the function. */
-                    rc = vbsfMapFolder (pClient, pszMapName, delimiter, fCaseSensitive, &root);
-
-                    if (RT_SUCCESS(rc))
+                    /* Fudge for windows GAs getting the length wrong by one char. */
+                    if (   !(pClient->fu32Flags & SHFL_CF_UTF8)
+                        && paParms[0].u.pointer.size >= sizeof(SHFLSTRING)
+                        && pszMapName->u16Length >= 2
+                        && pszMapName->String.ucs2[pszMapName->u16Length / 2 - 1] == 0x0000)
                     {
-                        /* Update parameters.*/
-                        paParms[1].u.uint32 = root;
+                        pszMapName->u16Length -= 2;
+                        if (ShflStringIsValidIn(pszMapName, paParms[0].u.pointer.size, false /*fUtf8Not16*/))
+                            rc = VINF_SUCCESS;
+                        else
+                            pszMapName->u16Length += 2;
                     }
                 }
+
+                /* Execute the function. */
+                if (RT_SUCCESS(rc))
+                    rc = vbsfMapFolder (pClient, pszMapName, delimiter, fCaseSensitive, &root);
+
+                if (RT_SUCCESS(rc))
+                {
+                    /* Update parameters.*/
+                    paParms[1].u.uint32 = root;
+                }
             }
             Log(("SharedFolders host service: map operation result %Rrc\n", rc));
             if (RT_SUCCESS(rc))
@@ -1064,7 +1077,7 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 uint32_t flags          = paParms[2].u.uint32;
 
                 /* Verify parameters values. */
-                if (!ShflStringIsValid(pPath, cbPath))
+                if (!ShflStringIsValidIn(pPath, cbPath, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8)))
                 {
                     rc = VERR_INVALID_PARAMETER;
                 }
@@ -1108,8 +1121,8 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 uint32_t    flags       = paParms[3].u.uint32;
 
                 /* Verify parameters values. */
-                if (    !ShflStringIsValid(pSrc, paParms[1].u.pointer.size)
-                    ||  !ShflStringIsValid(pDest, paParms[2].u.pointer.size)
+                if (    !ShflStringIsValidIn(pSrc, paParms[1].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8))
+                    ||  !ShflStringIsValidIn(pDest, paParms[2].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8))
                    )
                 {
                     rc = VERR_INVALID_PARAMETER;
@@ -1208,8 +1221,8 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
                 uint32_t     cbInfo   = paParms[3].u.pointer.size;
 
                 /* Verify parameters values. */
-                if (    !ShflStringIsValid(pNewPath, paParms[1].u.pointer.size)
-                    ||  !ShflStringIsValid(pOldPath, paParms[2].u.pointer.size)
+                if (    !ShflStringIsValidIn(pNewPath, paParms[1].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8))
+                    ||  !ShflStringIsValidIn(pOldPath, paParms[2].u.pointer.size, RT_BOOL(pClient->fu32Flags & SHFL_CF_UTF8))
                     ||  (cbInfo != sizeof(SHFLFSOBJINFO))
                    )
                 {
@@ -1305,8 +1318,8 @@ static DECLCALLBACK(int) svcHostCall (void *, uint32_t u32Function, uint32_t cPa
             uint32_t fFlags         = paParms[2].u.uint32;
 
             /* Verify parameters values. */
-            if (    !ShflStringIsValid(pFolderName, paParms[0].u.pointer.size)
-                ||  !ShflStringIsValid(pMapName, paParms[1].u.pointer.size)
+            if (    !ShflStringIsValidIn(pFolderName, paParms[0].u.pointer.size, false /*fUtf8Not16*/)
+                ||  !ShflStringIsValidIn(pMapName, paParms[1].u.pointer.size, false /*fUtf8Not16*/)
                )
             {
                 rc = VERR_INVALID_PARAMETER;
@@ -1361,7 +1374,7 @@ static DECLCALLBACK(int) svcHostCall (void *, uint32_t u32Function, uint32_t cPa
             SHFLSTRING *pString = (SHFLSTRING *)paParms[0].u.pointer.addr;
 
             /* Verify parameters values. */
-            if (!ShflStringIsValid(pString, paParms[0].u.pointer.size))
+            if (!ShflStringIsValidIn(pString, paParms[0].u.pointer.size, false /*fUtf8Not16*/))
             {
                 rc = VERR_INVALID_PARAMETER;
             }
diff --git a/src/VBox/HostServices/SharedFolders/vbsf.cpp b/src/VBox/HostServices/SharedFolders/vbsf.cpp
index 935e94c..fa72b8c 100644
--- a/src/VBox/HostServices/SharedFolders/vbsf.cpp
+++ b/src/VBox/HostServices/SharedFolders/vbsf.cpp
@@ -106,82 +106,282 @@ void vbsfStripLastComponent(char *pszFullPath, uint32_t cbFullPathRoot)
     LogFlowFunc(("%s, %s, %s\n", pszFullPath, delimLast, delimSecondLast));
 }
 
+/**
+ * Corrects the casing of the final component
+ *
+ * @returns
+ * @param   pClient             .
+ * @param   pszFullPath         .
+ * @param   pszStartComponent   .
+ */
 static int vbsfCorrectCasing(SHFLCLIENTDATA *pClient, char *pszFullPath, char *pszStartComponent)
 {
-    PRTDIRENTRYEX  pDirEntry = NULL;
-    uint32_t       cbDirEntry, cbComponent;
-    int            rc = VERR_FILE_NOT_FOUND;
-    PRTDIR         hSearch = 0;
-    char           szWildCard[4];
-
     Log2(("vbsfCorrectCasing: %s %s\n", pszFullPath, pszStartComponent));
 
-    cbComponent = (uint32_t) strlen(pszStartComponent);
+    AssertReturn((uintptr_t)pszFullPath < (uintptr_t)pszStartComponent - 1U, VERR_INTERNAL_ERROR_2);
+    AssertReturn(pszStartComponent[-1] == RTPATH_DELIMITER, VERR_INTERNAL_ERROR_5);
 
-    cbDirEntry = 4096;
-    pDirEntry  = (PRTDIRENTRYEX)RTMemAlloc(cbDirEntry);
-    if (pDirEntry == 0)
-    {
-        AssertFailed();
+    /*
+     * Allocate a buffer that can hold really long file name entries as well as
+     * the initial search pattern.
+     */
+    size_t cchComponent = strlen(pszStartComponent);
+    size_t cchParentDir = pszStartComponent - pszFullPath;
+    size_t cchFullPath  = cchParentDir + cchComponent;
+    Assert(strlen(pszFullPath) == cchFullPath);
+
+    size_t cbDirEntry   = 4096;
+    if (cchFullPath + 4 > cbDirEntry - RT_OFFSETOF(RTDIRENTRYEX, szName))
+        cbDirEntry = RT_OFFSETOF(RTDIRENTRYEX, szName) + cchFullPath + 4;
+
+    PRTDIRENTRYEX pDirEntry = (PRTDIRENTRYEX)RTMemAlloc(cbDirEntry);
+    if (pDirEntry == NULL)
         return VERR_NO_MEMORY;
-    }
 
-    /** @todo this is quite inefficient, especially for directories with many files */
-    Assert(pszFullPath < pszStartComponent-1);
-    Assert(*(pszStartComponent-1) == RTPATH_DELIMITER);
-    *(pszStartComponent-1) = 0;
-    strcpy(pDirEntry->szName, pszFullPath);
-    szWildCard[0] = RTPATH_DELIMITER;
-    szWildCard[1] = '*';
-    szWildCard[2] = 0;
-    strcat(pDirEntry->szName, szWildCard);
+    /*
+     * Construct the search criteria in the szName member of pDirEntry.
+     */
+    /** @todo This is quite inefficient, especially for directories with many
+     *        files.  If any of the typically case sensitive host systems start
+     *        supporting opendir wildcard filters, it would make sense to build
+     *        one here with '?' for case foldable charaters. */
+    /** @todo Use RTDirOpen here and drop the whole uncessary path copying? */
+    int rc = RTPathJoinEx(pDirEntry->szName, cbDirEntry - RT_OFFSETOF(RTDIRENTRYEX, szName),
+                          pszFullPath, cchParentDir,
+                          RT_STR_TUPLE("*"));
+    AssertRC(rc);
+    if (RT_SUCCESS(rc))
+    {
+        PRTDIR hSearch = NULL;
+        rc = RTDirOpenFiltered(&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT, 0);
+        if (RT_SUCCESS(rc))
+        {
+            for (;;)
+            {
+                size_t cbDirEntrySize = cbDirEntry;
+
+                rc = RTDirReadEx(hSearch, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
+                if (rc == VERR_NO_MORE_FILES)
+                    break;
+
+                if (   rc != VINF_SUCCESS
+                    && rc != VWRN_NO_DIRENT_INFO)
+                {
+                    AssertFailed();
+                    if (   rc == VERR_NO_TRANSLATION
+                        || rc == VERR_INVALID_UTF8_ENCODING)
+                        continue;
+                    break;
+                }
+
+                Log2(("vbsfCorrectCasing: found %s\n", &pDirEntry->szName[0]));
+                if (    pDirEntry->cbName == cchComponent
+                    &&  !RTStrICmp(pszStartComponent, &pDirEntry->szName[0]))
+                {
+                    Log(("Found original name %s (%s)\n", &pDirEntry->szName[0], pszStartComponent));
+                    strcpy(pszStartComponent, &pDirEntry->szName[0]);
+                    rc = VINF_SUCCESS;
+                    break;
+                }
+            }
+
+            RTDirClose(hSearch);
+        }
+    }
 
-    rc = RTDirOpenFiltered(&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT, 0);
-    *(pszStartComponent-1) = RTPATH_DELIMITER;
     if (RT_FAILURE(rc))
-        goto end;
+        Log(("vbsfCorrectCasing %s failed with %Rrc\n", pszStartComponent, rc));
 
-    for (;;)
-    {
-        size_t cbDirEntrySize = cbDirEntry;
+    RTMemFree(pDirEntry);
 
-        rc = RTDirReadEx(hSearch, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
-        if (rc == VERR_NO_MORE_FILES)
-            break;
+    return rc;
+}
+
+/* Temporary stand-in for RTPathExistEx. */
+static int vbsfQueryExistsEx(const char *pszPath, uint32_t fFlags)
+{
+#if 0 /** @todo Fix the symlink issue on windows! */
+    return RTPathExistsEx(pszPath, fFlags);
+#else
+    RTFSOBJINFO IgnInfo;
+    return RTPathQueryInfoEx(pszPath, &IgnInfo, RTFSOBJATTRADD_NOTHING, fFlags);
+#endif
+}
 
-        if (   rc != VINF_SUCCESS
-            && rc != VWRN_NO_DIRENT_INFO)
+/**
+ * Helper for vbsfBuildFullPath that performs case corrections on the path
+ * that's being build.
+ *
+ * @returns VINF_SUCCESS at the moment.
+ * @param   pClient                 The client data.
+ * @param   pszFullPath             Pointer to the full path.  This is the path
+ *                                  which may need case corrections.  The
+ *                                  corrections will be applied in place.
+ * @param   cchFullPath             The length of the full path.
+ * @param   fWildCard               Whether the last component may contain
+ *                                  wildcards and thus might require exclusion
+ *                                  from the case correction.
+ * @param   fPreserveLastComponent  Always exclude the last component from case
+ *                                  correction if set.
+ */
+static int vbsfCorrectPathCasing(SHFLCLIENTDATA *pClient, char *pszFullPath, size_t cchFullPath,
+                                 bool fWildCard, bool fPreserveLastComponent)
+{
+    /*
+     * Hide the last path component if it needs preserving.  This is required
+     * in the following cases:
+     *    - Contains the wildcard(s).
+     *    - Is a 'rename' target.
+     */
+    char *pszLastComponent = NULL;
+    if (fWildCard || fPreserveLastComponent)
+    {
+        char *pszSrc = pszFullPath + cchFullPath - 1;
+        Assert(strchr(pszFullPath, '\0') == pszSrc + 1);
+        while ((uintptr_t)pszSrc > (uintptr_t)pszFullPath)
         {
-            AssertFailed();
-            if (   rc == VERR_NO_TRANSLATION
-                || rc == VERR_INVALID_UTF8_ENCODING)
-                continue;
-            break;
+            if (*pszSrc == RTPATH_DELIMITER)
+                break;
+            pszSrc--;
         }
-
-        Log2(("vbsfCorrectCasing: found %s\n", &pDirEntry->szName[0]));
-        if (    pDirEntry->cbName == cbComponent
-            &&  !RTStrICmp(pszStartComponent, &pDirEntry->szName[0]))
+        if (*pszSrc == RTPATH_DELIMITER)
         {
-            Log(("Found original name %s (%s)\n", &pDirEntry->szName[0], pszStartComponent));
-            strcpy(pszStartComponent, &pDirEntry->szName[0]);
-            rc = VINF_SUCCESS;
-            break;
+            if (   fPreserveLastComponent
+                /* Or does it really have wildcards? */
+                || strchr(pszSrc + 1, '*') != NULL
+                || strchr(pszSrc + 1, '?') != NULL
+                || strchr(pszSrc + 1, '>') != NULL
+                || strchr(pszSrc + 1, '<') != NULL
+                || strchr(pszSrc + 1, '"') != NULL )
+            {
+                pszLastComponent = pszSrc;
+                *pszLastComponent = '\0';
+            }
         }
     }
 
-end:
-    if (RT_FAILURE(rc))
-        Log(("vbsfCorrectCasing %s failed with %d\n", pszStartComponent, rc));
+    /*
+     * If the path/file doesn't exist, we need to attempt case correcting it.
+     */
+    /** @todo Don't check when creating files or directories; waste of time. */
+    int rc = vbsfQueryExistsEx(pszFullPath, SHFL_RT_LINK(pClient));
+    if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
+    {
+        Log(("Handle case insensitive guest fs on top of host case sensitive fs for %s\n", pszFullPath));
 
-    if (pDirEntry)
-        RTMemFree(pDirEntry);
+        /*
+         * Work from the end of the path to find a partial path that's valid.
+         */
+        char *pszSrc = pszLastComponent ? pszLastComponent - 1 : pszFullPath + cchFullPath - 1;
+        Assert(strchr(pszFullPath, '\0') == pszSrc + 1);
 
-    if (hSearch)
-        RTDirClose(hSearch);
-    return rc;
+        while ((uintptr_t)pszSrc > (uintptr_t)pszFullPath)
+        {
+            if (*pszSrc == RTPATH_DELIMITER)
+            {
+                *pszSrc = '\0';
+                rc = vbsfQueryExistsEx(pszFullPath, SHFL_RT_LINK(pClient));
+                *pszSrc = RTPATH_DELIMITER;
+                if (RT_SUCCESS(rc))
+                {
+#ifdef DEBUG
+                    *pszSrc = '\0';
+                    Log(("Found valid partial path %s\n", pszFullPath));
+                    *pszSrc = RTPATH_DELIMITER;
+#endif
+                    break;
+                }
+            }
+
+            pszSrc--;
+        }
+        Assert(*pszSrc == RTPATH_DELIMITER && RT_SUCCESS(rc));
+        if (   *pszSrc == RTPATH_DELIMITER
+            && RT_SUCCESS(rc))
+        {
+            /*
+             * Turn around and work the other way case correcting the components.
+             */
+            pszSrc++;
+            for (;;)
+            {
+                bool fEndOfString = true;
+
+                /* Find the end of the component. */
+                char *pszEnd = pszSrc;
+                while (*pszEnd)
+                {
+                    if (*pszEnd == RTPATH_DELIMITER)
+                        break;
+                    pszEnd++;
+                }
+
+                if (*pszEnd == RTPATH_DELIMITER)
+                {
+                    fEndOfString = false;
+                    *pszEnd = '\0';
+#if 0 /** @todo Please, double check this. The original code is in the #if 0, what I hold as correct is in the #else. */
+                    rc = RTPathQueryInfoEx(pszSrc, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
+#else
+                    rc = vbsfQueryExistsEx(pszFullPath, SHFL_RT_LINK(pClient));
+#endif
+                    Assert(rc == VINF_SUCCESS || rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
+                }
+                else if (pszEnd == pszSrc)
+                    rc = VINF_SUCCESS;  /* trailing delimiter */
+                else
+                    rc = VERR_FILE_NOT_FOUND;
+
+                if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
+                {
+                    /* Path component is invalid; try to correct the casing. */
+                    rc = vbsfCorrectCasing(pClient, pszFullPath, pszSrc);
+                    if (RT_FAILURE(rc))
+                    {
+                        /* Failed, so don't bother trying any further components. */
+                        if (!fEndOfString)
+                            *pszEnd = RTPATH_DELIMITER; /* Restore the original full path. */
+                        break;
+                    }
+                }
+
+                /* Next (if any). */
+                if (fEndOfString)
+                    break;
+
+                *pszEnd = RTPATH_DELIMITER;
+                pszSrc = pszEnd + 1;
+            }
+            if (RT_FAILURE(rc))
+                Log(("Unable to find suitable component rc=%d\n", rc));
+        }
+        else
+            rc = VERR_FILE_NOT_FOUND;
+
+    }
+
+    /* Restore the final component if it was dropped. */
+    if (pszLastComponent)
+        *pszLastComponent = RTPATH_DELIMITER;
+
+    /* might be a new file so don't fail here! */
+    return VINF_SUCCESS;
 }
 
+
+/** @def VBSF_IS_PATH_SLASH
+ * Checks if @a a_ch is a path delimiter (slash, not volume spearator) for the
+ * guest or the host.
+ * @param   a_pClient   Pointer to the client data (SHFLCLIENTDATA).
+ * @param   a_ch        The character to inspect.
+ */
+#if 1
+# define VBSF_IS_PATH_SLASH(a_pClient, a_ch)     ( (a_ch) == '\\' || (a_ch) == '/' || RTPATH_IS_SLASH(a_ch) )
+#else
+# define VBSF_IS_PATH_SLASH(a_pClient, a_ch)     ( (RTUTF16)(a_ch) == (a_pClient)->PathDelimiter || RTPATH_IS_SLASH(a_ch) )
+#endif
+
+
 /**
  * Check the given UTF-8 path for root escapes.
  *
@@ -192,125 +392,137 @@ end:
  * @retval  VINF_SUCCESS
  * @retval  VERR_INVALID_NAME
  *
- * @param   pUtf8Path   The path to check.
- * @param   cchPath     The length of the path in chars (not code points, but
- *                      the C type) excluding the string terminator.
+ * @param   pszPath         The (UTF-8) path to check.  Slashes has been convert
+ *                          to host slashes by this time.
  *
  * @remarks This function assumes that the path will be appended to the root
  *          directory of the shared folder mapping.  Keep that in mind when
  *          checking absolute paths!
  */
-static int vbsfPathCheck(const char *pUtf8Path, size_t cchPath)
+static int vbsfPathCheck(const char *pszPath)
 {
-    int rc = VINF_SUCCESS;
+    /*
+     * Walk the path, component by component and check for escapes.
+     */
 
-    size_t i = 0;
     int cComponents = 0; /* How many normal path components. */
     int cParentDirs = 0; /* How many '..' components. */
 
     for (;;)
     {
-        /* Skip leading path delimiters. */
-        while (   i < cchPath
-               && (pUtf8Path[i] == '\\' || pUtf8Path[i] == '/'))
-            i++;
+        char ch;
 
-        if (i >= cchPath)
-            break;
+        /* Skip leading path delimiters. */
+        do
+            ch = *pszPath++;
+        while (RTPATH_IS_SLASH(ch));
+        if (ch == '\0')
+            return VINF_SUCCESS;
 
         /* Check if that is a dot component. */
         int cDots = 0;
-        while (i < cchPath && pUtf8Path[i] == '.')
+        while (ch == '.')
         {
             cDots++;
-            i++;
+            ch = *pszPath++;
         }
 
-        if (   cDots >= 2 /* Consider all multidots sequences as a 'parent dir'. */
-            && (i >= cchPath || (pUtf8Path[i] == '\\' || pUtf8Path[i] == '/')))
-        {
-            cParentDirs++;
-        }
-        else if (   cDots == 1
-                 && (i >= cchPath || (pUtf8Path[i] == '\\' || pUtf8Path[i] == '/')))
+        if (   cDots >= 1
+            && (ch == '\0' || RTPATH_IS_SLASH(ch)) )
         {
-            /* Single dot, nothing changes. */
+            if (cDots >= 2) /* Consider all multidots sequences as a 'parent dir'. */
+            {
+                cParentDirs++;
+
+                /* Escaping? */
+                if (cParentDirs > cComponents)
+                    return VERR_INVALID_NAME;
+            }
+            /* else: Single dot, nothing changes. */
         }
         else
         {
-            /* Skip this component. */
-            while (   i < cchPath
-                   && (pUtf8Path[i] != '\\' && pUtf8Path[i] != '/'))
-                i++;
-
+            /* Not a dot component, skip to the end of it. */
+            while (ch != '\0' && !RTPATH_IS_SLASH(ch))
+                ch = *pszPath++;
             cComponents++;
         }
+        Assert(cComponents >= cParentDirs);
 
-        Assert(i >= cchPath || (pUtf8Path[i] == '\\' || pUtf8Path[i] == '/'));
-
-        /* Verify counters for every component. */
-        if (cParentDirs > cComponents)
-        {
-            rc = VERR_INVALID_NAME;
-            break;
-        }
+        /* The end? */
+        Assert(ch == '\0' || RTPATH_IS_SLASH(ch));
+        if (ch == '\0')
+            return VINF_SUCCESS;
     }
-
-    return rc;
 }
 
 static int vbsfBuildFullPath(SHFLCLIENTDATA *pClient, SHFLROOT root, PSHFLSTRING pPath,
                              uint32_t cbPath, char **ppszFullPath, uint32_t *pcbFullPathRoot,
                              bool fWildCard = false, bool fPreserveLastComponent = false)
 {
-    int rc = VINF_SUCCESS;
-    char *pszFullPath = NULL;
-    size_t cbRoot;
+    /* Resolve the root prefix into a string. */
     const char *pszRoot = vbsfMappingsQueryHostRoot(root);
-
     if (   !pszRoot
-        || !(cbRoot = strlen(pszRoot)))
+        || !*pszRoot)
     {
         Log(("vbsfBuildFullPath: invalid root!\n"));
         return VERR_INVALID_PARAMETER;
     }
+    uint32_t cchRoot = (uint32_t)strlen(pszRoot);
+#if RTPATH_STYLE == RTPATH_STR_F_STYLE_DOS
+    Assert(!strchr(pszRoot, '/'));
+#endif
 
+    /*
+     * Combine the root prefix with the guest path into a full UTF-8 path in a
+     * buffer pointed to by pszFullPath.  cchRoot may be adjusted in the process.
+     */
+    int    rc;
+    size_t cchFullPath;
+    char  *pszFullPath = NULL;
     if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8))
     {
-        /* Verify that the path is under the root directory. */
-        rc = vbsfPathCheck((const char *)&pPath->String.utf8[0], pPath->u16Length);
-        if (RT_SUCCESS(rc))
+        /* Strip leading slashes from the path the guest specified. */
+        uint32_t    cchSrc = pPath->u16Length;
+        const char *pszSrc = (char *)&pPath->String.utf8[0];
+        Log(("Root %s path %.*s\n", pszRoot, cchSrc, pszSrc));
+
+        while (   cchSrc > 0
+               && VBSF_IS_PATH_SLASH(pClient, *pszSrc))
         {
-            size_t cbUtf8FullPath = cbRoot + 1 + pPath->u16Length + 1;
-            char *utf8FullPath = (char *) RTMemAllocZ(cbUtf8FullPath);
+            pszSrc++;
+            cchSrc--;
+        }
 
-            if (!utf8FullPath)
-            {
-                rc = VERR_NO_MEMORY;
-                *ppszFullPath = NULL;
-                Log(("RTMemAllocZ %x failed!!\n", cbUtf8FullPath));
-            }
-            else
+        /* Allocate a buffer that will be able to contain the root prefix and
+           the path specified by the guest. */
+        cchFullPath = cchRoot + cchSrc;
+        pszFullPath = (char *)RTMemAlloc(cchFullPath + 1 + 1);
+        if (RT_LIKELY(pszFullPath != NULL))
+        {
+            memcpy(pszFullPath, pszRoot, cchRoot);
+            if (!RTPATH_IS_SLASH(pszRoot[-1]))
             {
-                /** @todo r-bird: Pardon me for asking, but who validates the UTF-8 encoding?*/
-                memcpy(utf8FullPath, pszRoot, cbRoot);
-                utf8FullPath[cbRoot] = '/';
-                memcpy(utf8FullPath + cbRoot + 1, &pPath->String.utf8[0], pPath->u16Length);
-                utf8FullPath[cbUtf8FullPath - 1] = 0;
-                pszFullPath = utf8FullPath;
-
-                if (pcbFullPathRoot)
-                    *pcbFullPathRoot = (uint32_t)cbRoot; /* Must index the path delimiter. */
+                pszFullPath[cchRoot++] = RTPATH_DELIMITER;
+                cchFullPath++;
             }
+
+            if (cchSrc)
+                memcpy(&pszFullPath[cchRoot], pszSrc, cchSrc);
+
+            /* Terminate the string. */
+            pszFullPath[cchRoot + cchSrc] = '\0';
+            rc = VINF_SUCCESS;
         }
         else
         {
-            Log(("vbsfBuildFullPath: vbsfPathCheck failed with %Rrc\n", rc));
+            Log(("RTMemAlloc %x failed!!\n", cchFullPath + 1));
+            rc = VERR_NO_MEMORY;
         }
     }
-    else
+    else /* Client speaks UTF-16. */
     {
-#ifdef RT_OS_DARWIN
+#ifdef RT_OS_DARWIN /* Misplaced hack! See todo! */
 /** @todo This belongs in rtPathToNative or in the windows shared folder file system driver...
  * The question is simply whether the NFD normalization is actually applied on a (virtual) file
  * system level in darwin, or just by the user mode application libs. */
@@ -344,241 +556,125 @@ static int vbsfBuildFullPath(SHFLCLIENTDATA *pClient, SHFLROOT root, PSHFLSTRING
 
         CFRelease(inStr);
 #endif
-        /* Client sends us UCS2, so convert it to UTF8. */
-        Log(("Root %s path %.*ls\n", pszRoot, pPath->u16Length/sizeof(pPath->String.ucs2[0]), pPath->String.ucs2));
 
-        /* Allocate buffer that will be able to contain the root prefix and
-         * the pPath converted to UTF8. Expect a 2 bytes UCS2 to be converted
-         * to 8 bytes UTF8 in the worst case.
-         */
-        uint32_t cbFullPath = (cbRoot + ShflStringLength(pPath)) * 4;
-        pszFullPath = (char *)RTMemAllocZ(cbFullPath);
-        if (!pszFullPath)
+        /* Strip leading slashes and calculate the UTF-8 length. */
+        size_t      cwcSrc  = pPath->u16Length / sizeof(RTUTF16);
+        PRTUTF16    pwszSrc = &pPath->String.ucs2[0];
+        Log(("Root %s path %.*ls\n", pszRoot, cwcSrc, pwszSrc));
+
+        while (   cwcSrc > 0
+               && *pwszSrc < 0x80
+               && VBSF_IS_PATH_SLASH(pClient, (char)*pwszSrc))
         {
-            rc = VERR_NO_MEMORY;
+            pwszSrc++;
+            cwcSrc--;
         }
-        else
-        {
-            memcpy(pszFullPath, pszRoot, cbRoot + 1);
-            char *pszDst = pszFullPath;
-            size_t cbDst = strlen(pszDst);
-            size_t cb    = cbFullPath;
-            if (pszDst[cbDst - 1] != RTPATH_DELIMITER)
-            {
-                pszDst[cbDst] = RTPATH_DELIMITER;
-                cbDst++;
-            }
-
-            if (pcbFullPathRoot)
-                *pcbFullPathRoot = cbDst - 1; /* Must index the path delimiter.  */
-
-            pszDst += cbDst;
-            cb     -= cbDst;
-
-            if (pPath->u16Length)
-            {
-                /* Convert and copy components. */
-                size_t   cwcSrc  = pPath->u16Length / sizeof(RTUTF16);
-                PRTUTF16 pwszSrc = &pPath->String.ucs2[0];
-
-                /* Correct path delimiters */
-                if (pClient->PathDelimiter != RTPATH_DELIMITER)
-                {
-                    LogFlow(("Correct path delimiter in %ls\n", pwszSrc));
-                    while (*pwszSrc)
-                    {
-                        if (*pwszSrc == pClient->PathDelimiter)
-                            *pwszSrc = RTPATH_DELIMITER;
-                        pwszSrc++;
-                    }
-                    pwszSrc = &pPath->String.ucs2[0];
-                    LogFlow(("Corrected string %ls\n", pwszSrc));
-                }
-                if (*pwszSrc == RTPATH_DELIMITER)
-                {
-                    pwszSrc++;  /* we already appended a delimiter to the first part */
-                    cwcSrc--;
-                }
-
-                rc = RTUtf16ToUtf8Ex(pwszSrc, cwcSrc, &pszDst, cb, &cbDst);
-                if (RT_FAILURE(rc))
-                {
-                    AssertFailed();
-#ifdef RT_OS_DARWIN
-                    RTMemFree(pPath);
-                    pPath = pPathParameter;
-#endif
-                    return rc;
-                }
-                Assert(cbDst == strlen(pszDst));
 
-                /* Verify that the path is under the root directory. */
-                rc = vbsfPathCheck(pszDst, cbDst);
-                if (RT_FAILURE(rc))
-                {
+        size_t      cchPathAsUtf8 = RTUtf16CalcUtf8Len(pwszSrc);
 #ifdef RT_OS_DARWIN
-                    RTMemFree(pPath);
+        AssertReturnStmt(cchPathAsUtf8 >= cwcSrc, RTMemFree(pPath), VERR_INTERNAL_ERROR_3);
+#else
+        AssertReturn(cchPathAsUtf8 >= cwcSrc, VERR_INTERNAL_ERROR_3);
 #endif
-                    return rc;
-                }
 
-                cb     -= cbDst;
-                pszDst += cbDst;
+        /* Allocate buffer that will be able to contain the root prefix and
+         * the pPath converted to UTF-8. */
+        cchFullPath = cchRoot + cchPathAsUtf8;
+        pszFullPath = (char *)RTMemAlloc(cchFullPath + 1 + 1);
+        if (RT_LIKELY(pszFullPath != NULL))
+        {
+            /* Copy the root prefix into the result buffer and make sure it
+               ends with a path separator. */
+            memcpy(pszFullPath, pszRoot, cchRoot);
+            if (!RTPATH_IS_SLASH(pszFullPath[cchRoot - 1]))
+            {
+                pszFullPath[cchRoot++] = RTPATH_DELIMITER;
+                cchFullPath++;
+            }
 
-                Assert(cb > 0);
+            /* Append the path specified by the guest (if any). */
+            if (cchPathAsUtf8)
+            {
+                size_t cchActual;
+                char *pszDst = &pszFullPath[cchRoot];
+                rc = RTUtf16ToUtf8Ex(pwszSrc, cwcSrc, &pszDst, cchFullPath - cchRoot + 1, &cchActual);
+                AssertRC(rc);
+                AssertStmt(RT_FAILURE(rc) || cchActual == cchPathAsUtf8, rc = VERR_INTERNAL_ERROR_4);
+                Assert(strlen(pszDst) == cchPathAsUtf8);
             }
+            else
+                rc = VINF_SUCCESS;
 
-            /* Nul terminate the string */
-            *pszDst = 0;
+            /* Terminate the string. */
+            pszFullPath[cchRoot + cchPathAsUtf8] = '\0';
         }
+        else
+        {
+            Log(("RTMemAlloc %x failed!!\n", cchFullPath + 1));
+            rc = VERR_NO_MEMORY;
+        }
+
 #ifdef RT_OS_DARWIN
         RTMemFree(pPath);
         pPath = pPathParameter;
 #endif
     }
-
     if (RT_SUCCESS(rc))
     {
-        /* When the host file system is case sensitive and the guest expects
-         * a case insensitive fs, then problems can occur */
-        if (     vbsfIsHostMappingCaseSensitive(root)
-            &&  !vbsfIsGuestMappingCaseSensitive(root))
-        {
-            RTFSOBJINFO info;
-            char *pszLastComponent = NULL;
+        Assert(strlen(pszFullPath) == cchFullPath);
+        Assert(RTPATH_IS_SLASH(pszFullPath[cchRoot - 1])); /* includes delimiter. */
 
-            if (fWildCard || fPreserveLastComponent)
-            {
-                /* strip off the last path component, that has to be preserved:
-                 * contains the wildcard(s) or a 'rename' target. */
-                size_t cb = strlen(pszFullPath);
-                char *pszSrc = pszFullPath + cb - 1;
+        if (pcbFullPathRoot)
+            *pcbFullPathRoot = cchRoot - 1; /* Must index the path delimiter. */
 
-                while (pszSrc > pszFullPath)
-                {
-                    if (*pszSrc == RTPATH_DELIMITER)
-                        break;
-                    pszSrc--;
-                }
-                if (*pszSrc == RTPATH_DELIMITER)
-                {
-                    bool fHaveWildcards = false;
-                    char *psz = pszSrc;
-
-                    while (*psz)
-                    {
-                        char ch = *psz;
-                        if (ch == '*' || ch == '?' || ch == '>' || ch == '<' || ch == '"')
-                        {
-                            fHaveWildcards = true;
-                            break;
-                        }
-                        psz++;
-                    }
-
-                    if (fHaveWildcards || fPreserveLastComponent)
-                    {
-                        pszLastComponent = pszSrc;
-                        *pszLastComponent = 0;
-                    }
-                }
-            }
+        /*
+         * Convert guest path delimiters into host ones and check for attempts
+         * to escape the shared folder root directory.
+         *
+         * After this, there will only be RTPATH_DELIMITER slashes in the path!
+         *
+         * ASSUMES that the root path only has RTPATH_DELIMITER as well.
+         */
+        char  ch;
+        char *pszTmp = &pszFullPath[cchRoot];
+        while ((ch = *pszTmp) != '\0')
+        {
+            if (VBSF_IS_PATH_SLASH(pClient, ch))
+                *pszTmp = RTPATH_DELIMITER;
+            pszTmp++;
+        }
+        LogFlow(("Corrected string %s\n", pszFullPath));
 
-            /** @todo don't check when creating files or directories; waste of time */
-            rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
-            if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
+        rc = vbsfPathCheck(&pszFullPath[cchRoot]);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * When the host file system is case sensitive and the guest expects
+             * a case insensitive fs, then problems can occur.
+             */
+            if (    vbsfIsHostMappingCaseSensitive(root)
+                && !vbsfIsGuestMappingCaseSensitive(root))
+                rc = vbsfCorrectPathCasing(pClient, pszFullPath, cchFullPath, fWildCard, fPreserveLastComponent);
+            if (RT_SUCCESS(rc))
             {
-                size_t cb = strlen(pszFullPath);
-                char   *pszSrc = pszFullPath + cb - 1;
-
-                Log(("Handle case insensitive guest fs on top of host case sensitive fs for %s\n", pszFullPath));
-
-                /* Find partial path that's valid */
-                while (pszSrc > pszFullPath)
-                {
-                    if (*pszSrc == RTPATH_DELIMITER)
-                    {
-                        *pszSrc = 0;
-                        rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
-                        *pszSrc = RTPATH_DELIMITER;
-                        if (RT_SUCCESS(rc))
-                        {
-#ifdef DEBUG
-                            *pszSrc = 0;
-                            Log(("Found valid partial path %s\n", pszFullPath));
-                            *pszSrc = RTPATH_DELIMITER;
-#endif
-                            break;
-                        }
-                    }
-
-                    pszSrc--;
-                }
-                Assert(*pszSrc == RTPATH_DELIMITER && RT_SUCCESS(rc));
-                if (    *pszSrc == RTPATH_DELIMITER
-                    &&  RT_SUCCESS(rc))
-                {
-                    pszSrc++;
-                    for (;;)
-                    {
-                        char *pszEnd = pszSrc;
-                        bool fEndOfString = true;
-
-                        while (*pszEnd)
-                        {
-                            if (*pszEnd == RTPATH_DELIMITER)
-                                break;
-                            pszEnd++;
-                        }
-
-                        if (*pszEnd == RTPATH_DELIMITER)
-                        {
-                            fEndOfString = false;
-                            *pszEnd = 0;
-                            rc = RTPathQueryInfoEx(pszSrc, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
-                            Assert(rc == VINF_SUCCESS || rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
-                        }
-                        else if (pszEnd == pszSrc)
-                            rc = VINF_SUCCESS;  /* trailing delimiter */
-                        else
-                            rc = VERR_FILE_NOT_FOUND;
-
-                        if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
-                        {
-                            /* path component is invalid; try to correct the casing */
-                            rc = vbsfCorrectCasing(pClient, pszFullPath, pszSrc);
-                            if (RT_FAILURE(rc))
-                            {
-                                if (!fEndOfString)
-                                    *pszEnd = RTPATH_DELIMITER; /* restore the original full path */
-                                break;
-                            }
-                        }
-
-                        if (fEndOfString)
-                            break;
-
-                        *pszEnd = RTPATH_DELIMITER;
-                        pszSrc = pszEnd + 1;
-                    }
-                    if (RT_FAILURE(rc))
-                        Log(("Unable to find suitable component rc=%d\n", rc));
-                }
-                else
-                    rc = VERR_FILE_NOT_FOUND;
-
+                /*
+                 * We're good.
+                 */
+                *ppszFullPath = pszFullPath;
+                LogFlow(("vbsfBuildFullPath: %s rc=%Rrc\n", pszFullPath, rc));
+                return rc;
             }
-            if (pszLastComponent)
-                *pszLastComponent = RTPATH_DELIMITER;
 
-            /* might be a new file so don't fail here! */
-            rc = VINF_SUCCESS;
+            /* Failed, clean up. */
+            Log(("vbsfBuildFullPath: %s rc=%Rrc\n", pszFullPath, rc));
         }
-        *ppszFullPath = pszFullPath;
-
-        LogFlow(("vbsfBuildFullPath: %s rc=%Rrc\n", pszFullPath, rc));
+        else
+            Log(("vbsfBuildPath: Caught escape attempt: (%.*s) '%s'\n", cchRoot, pszFullPath, &pszFullPath[cchRoot]));
     }
 
+    if (pszFullPath)
+        RTMemFree(pszFullPath);
+    *ppszFullPath = NULL;
     return rc;
 }
 
@@ -1959,6 +2055,7 @@ int vbsfQueryVolumeInfo(SHFLCLIENTDATA *pClient, SHFLROOT root, uint32_t flags,
     pSFDEntry   = (PSHFLVOLINFO)pBuffer;
 
     ShflStringInitBuffer(&dummy, sizeof(dummy));
+    dummy.String.ucs2[0] = '\0';
     rc = vbsfBuildFullPath(pClient, root, &dummy, 0, &pszFullPath, NULL);
 
     if (RT_SUCCESS(rc))
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
index c4b0ab9..b084b88 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
@@ -225,15 +225,13 @@ void crServerSetVBoxConfiguration()
     if (env && env[0] != '\0')
     {
         cr_server.u32Caps = crServerVBoxParseNumerics(env, 0);
-        cr_server.u32Caps &= ~(CR_VBOX_CAP_TEX_PRESENT | CR_VBOX_CAP_CMDVBVA);
+        cr_server.u32Caps &= CR_VBOX_CAPS_ALL;
     }
     else
     {
-        cr_server.u32Caps = CR_VBOX_CAP_TEX_PRESENT/* | CR_VBOX_CAP_CMDVBVA*/;
-#ifdef DEBUG_misha
-        cr_server.u32Caps |= CR_VBOX_CAP_CMDVBVA;
-#endif
-
+        cr_server.u32Caps = CR_VBOX_CAP_TEX_PRESENT
+                | CR_VBOX_CAP_GETATTRIBSLOCATIONS
+                ;
     }
 
     crInfo("Cfg: u32Caps(%#x), fVisualBitsDefault(%#x)",
@@ -375,14 +373,13 @@ void crServerSetVBoxConfigurationHGCM()
     if (env && env[0] != '\0')
     {
         cr_server.u32Caps = crServerVBoxParseNumerics(env, 0);
-        cr_server.u32Caps &= ~(CR_VBOX_CAP_TEX_PRESENT | CR_VBOX_CAP_CMDVBVA);
+        cr_server.u32Caps &= CR_VBOX_CAPS_ALL;
     }
     else
     {
-        cr_server.u32Caps = CR_VBOX_CAP_TEX_PRESENT/* | CR_VBOX_CAP_CMDVBVA*/;
-#ifdef DEBUG_misha
-        cr_server.u32Caps |= CR_VBOX_CAP_CMDVBVA;
-#endif
+        cr_server.u32Caps = CR_VBOX_CAP_TEX_PRESENT
+                | CR_VBOX_CAP_GETATTRIBSLOCATIONS
+                ;
     }
 
     crInfo("Cfg: u32Caps(%#x), fVisualBitsDefault(%#x)",
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c
index 20acbc0..93a99d6 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c
@@ -223,6 +223,29 @@ crServerDispatchGetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei
     crFree(pLocal);
 }
 
+void SERVER_DISPATCH_APIENTRY
+crServerDispatchGetAttribsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData)
+{
+    GLsizei *pLocal;
+
+    (void) cbData;
+    (void) pData;
+
+    pLocal = (GLsizei*) crAlloc(maxcbData+sizeof(GLsizei));
+    if (!pLocal)
+    {
+        GLsizei zero=0;
+        crServerReturnValue(&zero, sizeof(zero));
+    }
+
+    /* initial (fallback )value */
+    *pLocal = 0;
+    crStateGLSLProgramCacheAttribs(program, maxcbData, pLocal, (char*)&pLocal[1]);
+
+    crServerReturnValue(pLocal, (*pLocal)+sizeof(GLsizei));
+    crFree(pLocal);
+}
+
 static GLint __GetUniformSize(GLuint program, GLint location)
 {
     GLint  size = 0;
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
index e2df4e9..6477afb 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
@@ -220,6 +220,7 @@ ValidateProgram
 BindAttribLocation
 DeleteObjectARB
 GetUniformsLocations
+GetAttribsLocations
 GetPolygonStipple
 Flush
 Finish
diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
index 5953527..b86db49 100644
--- a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
+++ b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py
@@ -29,8 +29,12 @@ SPUDispatchTable cr_unpackDispatch;
 static void crUnpackExtend(void);
 static void crUnpackExtendDbg(void);
 
-/*#define CR_UNPACK_DEBUG_OPCODES*/
-/*#define CR_UNPACK_DEBUG_LAST_OPCODES*/
+static GLenum g_VBoxDbgCrLastOpcode = 0;
+
+#ifdef DEBUG_misha
+//# define CR_UNPACK_DEBUG_OPCODES
+# define CR_UNPACK_DEBUG_LAST_OPCODES
+#endif
 """
 
 nodebug_opcodes = [
@@ -292,6 +296,8 @@ print 'static void crUnpackExtend(void)'
 print '{'
 print '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );
 print ''
+print '\tg_VBoxDbgCrLastOpcode = extend_opcode;'
+print ''
 print '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'
 print '\tswitch( extend_opcode )'
 print '\t{'
@@ -318,6 +324,8 @@ print 'static void crUnpackExtendDbg(void)'
 print '{'
 print '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );
 print ''
+print '\tg_VBoxDbgCrLastOpcode = extend_opcode;'
+print ''
 print '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'
 print '\tswitch( extend_opcode )'
 print '\t{'
diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c
index 2e90b3d..22a1d27 100644
--- a/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c
+++ b/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c
@@ -76,6 +76,7 @@ void crUnpackExtendShaderSource(void)
     }
 
 //    cr_unpackDispatch.ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
+
     cr_unpackDispatch.ShaderSource(shader, 1, ppStrings, 0);
 
     crFree(ppStrings);
@@ -335,3 +336,12 @@ void crUnpackExtendGetUniformsLocations(void)
 	SET_WRITEBACK_PTR(24);
 	cr_unpackDispatch.GetUniformsLocations(program, maxcbData, NULL, NULL);
 }
+
+void crUnpackExtendGetAttribsLocations(void)
+{
+    GLuint program = READ_DATA(8, GLuint);
+    GLsizei maxcbData = READ_DATA(12, GLsizei);
+    SET_RETURN_PTR(16);
+    SET_WRITEBACK_PTR(24);
+    cr_unpackDispatch.GetAttribsLocations(program, maxcbData, NULL, NULL);
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/unpacker/unpacker_special b/src/VBox/HostServices/SharedOpenGL/unpacker/unpacker_special
index cd1fc41..ff1cb7a 100644
--- a/src/VBox/HostServices/SharedOpenGL/unpacker/unpacker_special
+++ b/src/VBox/HostServices/SharedOpenGL/unpacker/unpacker_special
@@ -168,6 +168,7 @@ DeleteRenderbuffersEXT
 LockArraysEXT
 UnlockArraysEXT
 GetUniformsLocations
+GetAttribsLocations
 GetTexImage
 GetCompressedTexImageARB
 GetPolygonStipple
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist b/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist
index 3749e35..61700a5 100644
--- a/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist
+++ b/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist
@@ -66,7 +66,7 @@
                   event listeners to block VBoxSVC processes from exiting until
                   the waiting time was elapsed. In the extreme case this was
                   infinitely long, blocking updates. */
-               system.run('/bin/sh', '-c', 'pids=`/usr/bin/pgrep VBoxXPCOMIPCD` rc=0; [ -z "$pids" ] && rc=1; for i in $pids; do c=`/usr/sbin/lsof -p $i | /usr/bin/grep -E \'^[^ ]+ +[^ ]+ +[^ ]+ +[^ ]+ +unix\' | wc -l`; [ $c -le 2 ] || rc=1; done; if [ $rc -eq 0 ]; then pkill -KILL \'^(VirtualBox)|(VBoxNetDHCP)|(VBoxNetNAT)|(VBoxHeadless)|(VBoxXPCOMIPCD)|(VBoxSVC)$\'; sleep 1; fi');
+               system.run('/bin/sh', '-c', 'pids=`/usr/bin/pgrep VBoxXPCOMIPCD` rc=0; [ -z "$pids" ] && rc=1; for i in $pids; do c=`/usr/sbin/lsof -p $i | /usr/bin/grep -E \'^[^ ]+ +[^ ]+ +[^ ]+ +[^ ]+ +unix\' | wc -l`; [ $c -le 2 ] || rc=1; done; if [ $rc -eq 0 ]; then /usr/bin/pkill -KILL \'^(VirtualBox)|(VBoxNetDHCP)|(VBoxNetNAT)|(VBoxHeadless)|(VBoxXPCOMIPCD)|(VBoxSVC)$\'; sleep 1; fi');
            }
        } catch (e) { system.log(e); }
 
@@ -81,6 +81,15 @@
 
        if (!result)
        {
+           /* Temporary instrumentation for finding out with some probability
+            * who keeps VBoxSVC busy (unix socket to VBoxXPCOMIPCD open). Needs
+            * very little time (unlike a full lsof) and causes bearable amount
+            * of messages to install.log so that it can stay in for a while. */
+           try
+           {
+               system.run('/usr/sbin/lsof', '-l', '-U');
+           } catch (e) { system.log(e); }
+
            my.result.type = 'Fatal';
            my.result.title = system.localizedString('RUNNING_VMS_TLE');
            my.result.message = system.localizedString('RUNNING_VMS_MSG');
diff --git a/src/VBox/Installer/linux/run-inst.sh b/src/VBox/Installer/linux/run-inst.sh
index e196489..9c32ef9 100755
--- a/src/VBox/Installer/linux/run-inst.sh
+++ b/src/VBox/Installer/linux/run-inst.sh
@@ -358,6 +358,7 @@ bzip2 -d -c "$ARCH_PACKAGE" | tar -xf - -C "$INSTALLATION_DIR" || exit 1
 link_into_fs "bin" "/usr/bin"
 link_into_fs "sbin" "/usr/sbin"
 link_into_fs "lib" "$lib_path"
+add_symlink "$INSTALLATION_DIR/lib/$PACKAGE" /usr/lib/"$PACKAGE"
 link_into_fs "share" "/usr/share"
 link_into_fs "src" "/usr/src"
 
diff --git a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
index 85f3eb1..c801f17 100644
--- a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
+++ b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -255,9 +255,8 @@ UINT __stdcall InstallPythonAPI(MSIHANDLE hModule)
         VBoxGetProperty(hModule, L"CustomActionData", wszPathTargetDir, sizeof(wszPathTargetDir));
         if (wcslen(wszPathTargetDir))
         {
-
             /* Set final path. */
-            swprintf_s(wszPath, RT_ELEMENTS(wszPath), L"%s\\sdk\\install", wszPathTargetDir);
+            swprintf_s(wszPath, RT_ELEMENTS(wszPath), L"%s", wszPathTargetDir);
 
             /* Install our API module. */
             swprintf_s(wszCmdLine, RT_ELEMENTS(wszCmdLine), L"%s\\python.exe vboxapisetup.py install", wszVal);
@@ -288,7 +287,7 @@ UINT __stdcall InstallPythonAPI(MSIHANDLE hModule)
             logStringW(hModule, L"InstallPythonAPI: Unable to retrieve VBox installation path!");
     }
 
-    VBoxSetProperty(hModule, L"PYTHON_INSTALLED", bInstalled ? L"1" : L"0");
+    VBoxSetProperty(hModule, L"VBOX_PYTHON_IS_INSTALLED", bInstalled ? L"1" : L"0");
 
     if (!bInstalled)
         logStringW(hModule, L"InstallPythonAPI: VBox API not installed.");
@@ -492,8 +491,8 @@ UINT __stdcall InstallBranding(MSIHANDLE hModule)
 /** @todo should use some real VBox app name */
 #define VBOX_NETCFG_APP_NAME L"VirtualBox Installer"
 #define VBOX_NETCFG_MAX_RETRIES 10
-#define NETFLT_PT_INF_REL_PATH L"drivers\\network\\netflt\\VBoxNetFlt.inf"
-#define NETFLT_MP_INF_REL_PATH L"drivers\\network\\netflt\\VBoxNetFltM.inf"
+#define NETFLT_PT_INF_REL_PATH L"VBoxNetFlt.inf"
+#define NETFLT_MP_INF_REL_PATH L"VBoxNetFltM.inf"
 #define NETFLT_ID  L"sun_VBoxNetFlt" /** @todo Needs to be changed (?). */
 #define NETADP_ID  L"sun_VBoxNetAdp" /** @todo Needs to be changed (?). */
 
@@ -537,7 +536,7 @@ static UINT errorConvertFromHResult(MSIHANDLE hModule, HRESULT hr)
 
         case NETCFG_S_REBOOT:
         {
-            logStringW(hModule, L"Reboot required, setting REBOOT property to Force");
+            logStringW(hModule, L"Reboot required, setting REBOOT property to \"force\"");
             HRESULT hr2 = MsiSetPropertyW(hModule, L"REBOOT", L"Force");
             if (hr2 != ERROR_SUCCESS)
                 logStringW(hModule, L"Failed to set REBOOT property, error = 0x%x", hr2);
@@ -854,7 +853,7 @@ UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
 
     GUID guid;
     WCHAR wszMpInf[MAX_PATH];
-    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("drivers\\network\\netadp\\VBoxNetAdp.inf") - 1;
+    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("VBoxNetAdp.inf") - 1;
     LPCWSTR pwszInfPath = NULL;
     bool bIsFile = false;
     UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszMpInf, &cchMpInf);
@@ -869,17 +868,17 @@ UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
                 wszMpInf[cchMpInf]   = L'\0';
             }
 
-            wcscat(wszMpInf, L"drivers\\network\\netadp\\VBoxNetAdp.inf");
+            wcscat(wszMpInf, L"VBoxNetAdp.inf");
             pwszInfPath = wszMpInf;
             bIsFile = true;
 
             logStringW(hModule, L"CreateHostOnlyInterface: Resulting INF path = %s", pwszInfPath);
         }
         else
-            logStringW(hModule, L"CreateHostOnlyInterface: NetAdpDir property value is empty");
+            logStringW(hModule, L"CreateHostOnlyInterface: VBox installation path is empty");
     }
     else
-        logStringW(hModule, L"CreateHostOnlyInterface: Failed to get NetAdpDir property, error = 0x%x", uErr);
+        logStringW(hModule, L"CreateHostOnlyInterface: Unable to retrieve VBox installation path, error = 0x%x", uErr);
 
     /* Make sure the inf file is installed. */
     if (pwszInfPath != NULL && bIsFile)
@@ -942,7 +941,7 @@ UINT __stdcall RemoveHostOnlyInterfaces(MSIHANDLE hModule)
         hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, NETADP_ID, L"Net", 0/* could be SUOI_FORCEDELETE */);
         if (FAILED(hr))
         {
-            logStringW(hModule, L"RemoveHostOnlyInterfaces: NetAdp uninstalled successfully, but failed to remove infs");
+            logStringW(hModule, L"RemoveHostOnlyInterfaces: NetAdp uninstalled successfully, but failed to remove INF files");
         }
     }
     else
@@ -999,7 +998,7 @@ UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
     BOOL bSetupModeInteractive = SetupSetNonInteractiveMode(FALSE);
 
     WCHAR wszMpInf[MAX_PATH];
-    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("drivers\\network\\netadp\\VBoxNetAdp.inf") - 1;
+    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("VBoxNetAdp.inf") - 1;
     LPCWSTR pwszInfPath = NULL;
     bool bIsFile = false;
     UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszMpInf, &cchMpInf);
@@ -1014,7 +1013,7 @@ UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
                 wszMpInf[cchMpInf]   = L'\0';
             }
 
-            wcscat(wszMpInf, L"drivers\\network\\netadp\\VBoxNetAdp.inf");
+            wcscat(wszMpInf, L"VBoxNetAdp.inf");
             pwszInfPath = wszMpInf;
             bIsFile = true;
 
@@ -1049,10 +1048,10 @@ UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
             }
         }
         else
-            logStringW(hModule, L"UpdateHostOnlyInterfaces: NetAdpDir property value is empty");
+            logStringW(hModule, L"UpdateHostOnlyInterfaces: VBox installation path is empty");
     }
     else
-        logStringW(hModule, L"UpdateHostOnlyInterfaces: Failed to get NetAdpDir property, error = 0x%x", uErr);
+        logStringW(hModule, L"UpdateHostOnlyInterfaces: Unable to retrieve VBox installation path, error = 0x%x", uErr);
 
     /* Restore original setup mode. */
     if (bSetupModeInteractive)
diff --git a/src/VBox/Installer/win/Makefile.kmk b/src/VBox/Installer/win/Makefile.kmk
index 6621d1d..49c16df 100644
--- a/src/VBox/Installer/win/Makefile.kmk
+++ b/src/VBox/Installer/win/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2006-2013 Oracle Corporation
+# Copyright (C) 2006-2014 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -47,11 +47,39 @@ include $(PATH_SUB_CURRENT)/Resources/Makefile.kmk
 
 #
 # Globals and targets.
+# Note: en_US *must* come first for the dependency file generation.
 #
-VBOX_INSTALLER_LANGUAGES  = de_DE en_US fr_FR it_IT zh_TW
+VBOX_INSTALLER_LANGUAGES  = en_US de_DE fr_FR it_IT zh_TW
 VBOX_INSTALLER_LANGUAGES += $(VBOX_INSTALLER_ADD_LANGUAGES)
 
 #
+# Use merge modules if we're not doing an official release.
+# This will increase the overall installer size significantly because
+# merge modules are not able to use a common .cab file to reduce their
+# size.
+#
+ifneq ($(int-mod $(VBOX_VERSION_BUILD),2),0)
+# VBOX_WITH_MSM_INSTALL := 1
+# VBOX_INSTALLER_LANGUAGES = en_US
+endif
+
+ifeq ($(USERNAME),andy)
+ VBOX_WITH_MSM_INSTALL := 1
+ VBOX_INSTALLER_LANGUAGES = en_US
+endif
+
+#
+# List of merge modules to use.
+#
+VBOX_INSTALLER_MERGE_MODULES = App USB NetAdp NetFlt Python
+ifeq ($(KBUILD_TARGET_ARCH),amd64)
+ VBOX_INSTALLER_MERGE_MODULES += COM32On64
+endif
+
+# We only ship the merge modules in locale en_US for the moment.
+VBOX_INSTALLER_MERGE_LANGUAGES = $(VBOX_INSTALLER_LANGUAGES)
+
+#
 # We don't have the license text in another language than English yet,
 # so just define the branding targets to use the English one for now.
 #
@@ -90,7 +118,10 @@ ifdef VBOX_WITH_COMBINED_PACKAGE
  PACKAGE_NAME_MULTIARCH.amd64       := $(PACKAGE_NAME_MULTIARCH)_amd64.msi
  PACKAGE_NAME_FINAL                 := $(PATH_MULTIARCH_TEMP)/$(PACKAGE_NAME_MULTIARCH.$(KBUILD_TARGET_ARCH))
  PACKAGE_NAME_MULTIARCH_FINAL       := $(PACKAGE_NAME_MULTIARCH).exe
- PACKAGE_NAME_MULTIARCH_COMMONCAB   := common.cab
+ # Always take the common.cab from the amd64 build, as it
+ # might contain certain files for x86 compatibility such
+ # as our 32-on-64-bit COM stuff.
+ PACKAGE_NAME_MULTIARCH_COMMONCAB   := $(PATH_OUT_BASE)/win.amd64/$(KBUILD_TYPE)/obj/Installer/win/common.cab
 
  BLDDIRS += $(PATH_MULTIARCH_TEMP)
  PACKING += $(PACKAGE_NAME_FINAL)
@@ -108,7 +139,7 @@ OTHER_CLEAN += \
 	$(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj \
 	$(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep \
 	$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
-	$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi \
+	$(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
 	$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
 	$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
 		$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
@@ -118,6 +149,7 @@ OTHER_CLEAN += \
 		$(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_LANG)_$(lang).msi) \
 	$(VBOX_WIN_INST_OUT_DIR)/Files_Doc.wxi \
 	$(VBOX_WIN_INST_OUT_DIR)/Files_License.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/Files_Main.wxi \
 	$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi
 
 ifdef VBOX_WITH_COMBINED_PACKAGE
@@ -126,7 +158,7 @@ ifdef VBOX_WITH_COMBINED_PACKAGE
   	$(PATH_STAGE_BIN)/$(PACKAGE_NAME_MULTIARCH_FINAL) \
   	$(PATH_MULTIARCH_TEMP)/$(PACKAGE_NAME_MULTIARCH.x86) \
   	$(PATH_MULTIARCH_TEMP)/$(PACKAGE_NAME_MULTIARCH.am64) \
-  	$(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_MULTIARCH_COMMONCAB)
+  	$(PACKAGE_NAME_MULTIARCH_COMMONCAB)
  else
   # Nothing to do here yet.
  endif
@@ -135,6 +167,16 @@ else
 	$(PACKAGE_NAME_FINAL)
 endif
 
+ifdef VBOX_WITH_MSM_INSTALL
+ OTHER_CLEAN += \
+  $(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
+   $(foreach lang,$(VBOX_INSTALLER_MERGE_LANGUAGES), \
+		$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep \
+		$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm \
+		$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj \
+		$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixpdb))
+endif
+
 ifdef VBOX_WITH_BUNDLED_INSTALLER
  ifeq ($(KBUILD_TARGET),darwin)
   VBOX_TMP_DIR ?= /VBox
@@ -158,12 +200,16 @@ ifdef VBOX_WITH_BUNDLED_INSTALLER
 endif
 
 #
-# Surpress/skip the following ICE (internal consistency evaluators):
+# Suppress/skip the following ICE (Internal Consistency Evaluators):
 # - ICE64: Checks that new directories in the user profile are removed correctly in roaming scenarios.
 #          -> We don't want to remove system folders (like "Microsoft/Internet Explorer/Quick Launch").
+# - ICE69: Checks if file references are within the same component.
+#          -> We reference to files within different components, but these components are installed using
+#             the same feature, so that's fine.
 #
 VBOX_MSI_ICE_IGNORE := \
-	-ice:64
+	-ice:64 \
+	-ice:69
 
 #
 # Create intermediate XML file for languages (needed for .MSI linking).
@@ -179,8 +225,8 @@ $(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl: $(VBOX_PATH_WIN_INST_SRC)/NLS
 	$(QUIET)$(INSTALL) -m 0644 $$< $$@
 endef
 
-$(foreach lang,$(VBOX_INSTALLER_LANGUAGES),$(eval $(def_vbox_lang_xml)))
-
+$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
+	$(eval $(def_vbox_lang_xml)))
 
 #
 # Create intermediate XML file for licenses (needed for .MSI linking).
@@ -217,7 +263,6 @@ $(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
 	$(eval local license_file := $(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF)) \
 	$(eval $(def_vbox_license_xml)))
 
-
 #
 # Create one intermediate WXI (Windows Installer Include) file for all installers (needed for .MSI compiling).
 # This file includes all language-specific files (PDFs, CHMs, ...) to install.
@@ -256,7 +301,7 @@ $(VBOX_WIN_INST_OUT_DIR)/Files_License.wxi: $(MAKEFILE_CURRENT) | $$(dir $$@)
 	$(APPEND) $@ '	<File Id="file_License_en_US.rtf" Name="License_en_US.rtf" DiskId="$(VBOX_INSTALLER_COMMON_DISKID)" Vital="yes" Source="$(VBOX_BRAND_LICENSE_RTF)">' \
 	             '	</File>'
 	$(APPEND) -n $@ $(foreach lang,$(VBOX_MANUAL_ADD_LANGUAGES), \
-	             '	<File Id="file_License_$(lang).rtf" Name="License_$(lang).rtf" DiskId="$(VBOX_INSTALLER_COMMON_DISKID)" Vital="yes" Source="$(VBOX_BRAND_$(lang)_LICENSE_RTF)"/>' \
+	             '	<File Id="file_License_$(lang).rtf" Name="License_$(lang).rtf" DiskId="$(VBOX_INSTALLER_COMMON_DISKID)" Vital="yes" Source="$(VBOX_BRAND_$(lang)_LICENSE_RTF)">' \
 	             '	</File>')
 	$(APPEND) $@ '</Include>'
 
@@ -309,7 +354,7 @@ $(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_LANG)_$(lang).msi: \
 		| $$$$(dir $$$$@)
 	$$(call MSG_L1,Linking installer $$@)
 	$(QUIET)$(RM) -f $$(wildcard $(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_BASE)-r*_$(lang).msi)
-	$(VBOX_PATH_WIX)/light.exe -nologo \
+	$(VBOX_PATH_WIX)/light.exe -v -nologo \
 		-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
 		-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
 		-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
@@ -324,8 +369,47 @@ $(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_LANG)_$(lang).msi: \
 	$(call VBOX_SIGN_FILE_FN,$$@,$(VBOX_PRODUCT) $(VBOX_VERSION_STRING)r$(VBOX_SVN_REV) ($(KBUILD_TARGET_ARCH)))
 endef
 
-$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), $(eval $(def_vbox_link_msi)))
+$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
+	$(eval $(def_vbox_link_msi)))
 
+#
+# Merge module linking (all languages).
+#
+# Note: This will clean up any previous .msm to prevent dep build boxes from
+#       filling up with old files.
+#
+# Note: Disable parallel jobs here because of shared common.cab access issues.
+#
+define def_vbox_link_msm
+.NOTPARALLEL: $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm
+$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm: \
+		$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj \
+		$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
+		$(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
+		$(PATH_STAGE_BIN)/VBoxInstallHelper.dll \
+		$(VBOX_SVN_REV_KMK) \
+		$(MAKEFILE_CURRENT) \
+		| $$$$(dir $$$$@)
+	$$(call MSG_L1,Linking installer $$@)
+	$(QUIET)$(RM) -f $$(wildcard $(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_BASE)-r*_$(lang).msi)
+	$(VBOX_PATH_WIX)/light.exe -v -nologo \
+		-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
+		-loc $(VBOX_WIN_INST_OUT_DIR)/NLS/License_$(lang).wxl \
+		-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
+		$(VBOX_MSI_ICE_IGNORE) \
+		-out $$@ \
+		$$< \
+		$(if-expr "$(KBUILD_TARGET_ARCH)" == "x86", \
+			$(VBOX_PATH_WIX)/difxapp_x86.wixlib, \
+			$(VBOX_PATH_WIX)/difxapp_x64.wixlib)
+	$(RM) -f $(VBOX_WIN_INST_OUT_DIR)/NLS/$(lang).mst
+	$(call VBOX_SIGN_FILE_FN,$$@,$(VBOX_PRODUCT) $(VBOX_VERSION_STRING)r$(VBOX_SVN_REV) ($(KBUILD_TARGET_ARCH)))
+endef
+
+$(if $(VBOX_WITH_MSM_INSTALL), \
+	$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
+		$(foreach lang,$(VBOX_INSTALLER_MERGE_LANGUAGES), \
+			$(eval $(def_vbox_link_msm)))),)
 
 #
 # Load and adjust the MSI compile step dependencies.
@@ -344,7 +428,7 @@ ifdef VBOX_USE_VCC110
 	$(PATH_OUT)/bin/msvcr100.dll \
 	$(PATH_OUT)/bin/msvcp100.dll \
 	, $(VBOX_MSI_DEPENDENCIES))
-else
+else # VCC100
  VBOX_MSI_DEPENDENCIES := $(filter-out \
 	$(PATH_OUT)/bin/msvcr110.dll \
 	$(PATH_OUT)/bin/msvcp110.dll \
@@ -352,6 +436,7 @@ else
 endif
 # TODO: Add filtering out more dependencies here!
 ifndef VBOX_WITH_QTGUI
+ VBOX_MSI_DEPENDENCIES := $(filter-out \
 	$(PATH_OUT)/bin/VirtualBox.exe \
 	$(PATH_OUT)/bin/VBoxTestOGL.exe \
 	$(PATH_OUT)/bin/QtCoreVBox4.dll \
@@ -415,13 +500,16 @@ endif
 define def_vbox_compile_wixobj
 $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 			$(PATH_SUB_CURRENT)/VirtualBox.wxs \
-			$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi \
 			$(PATH_SUB_CURRENT)/UserInterface.wxi \
-			$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
-			$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
-			$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
-			$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi \
-			$(VBOX_MSI_DEPENDENCIES) \
+			$(if $(VBOX_WITH_MSM_INSTALL), \
+				$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
+					$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm), \
+				$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi \
+				$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
+				$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
+				$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
+				$(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
+				$(VBOX_MSI_DEPENDENCIES)) \
 			$(VBOX_VERSION_STAMP) \
 			| $$$$(dir $$$$@)
 	$(QUIET)$(RM) -f $@
@@ -447,6 +535,9 @@ $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 		-E 'VBOX_VERSION_MINOR_INST=$(VBOX_VERSION_MINOR)' \
 		-E 'VBOX_SIGNING_MODE=$(strip $(if $(VBOX_SIGNING_MODE),$(VBOX_SIGNING_MODE),none))' \
 		-E 'VBOX_GUI_USE_QGL=$(if $(VBOX_GUI_USE_QGL),yes,no)' \
+		$(if $(VBOX_WITH_MSM_INSTALL), \
+			$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
+				-E 'VBOX_WIN_INST_MERGE_$(toupper $(module))=$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm'),) \
 		-E 'VBOX_WITH_32_ON_64_MAIN_API=$(if $(VBOX_WITH_32_ON_64_MAIN_API),yes,no)' \
 		-E 'VBOX_WITH_ADDITIONS_PACKING=$(if $(VBOX_WITH_ADDITIONS_PACKING),yes,no)' \
 		-E 'VBOX_WITH_COMBINED_PACKAGE=$(if $(VBOX_WITH_COMBINED_PACKAGE),yes,no)' \
@@ -465,6 +556,7 @@ $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 		-E 'VBOX_WITH_VRDP=$(if-expr defined(VBOX_WITH_VRDP) && !defined(VBOX_WITH_EXTPACK_PUEL),yes,no)' \
 		-E 'VBOX_WITH_WEBSERVICES=$(if $(VBOX_WITH_WEBSERVICES),yes,no)' \
 		-E 'VBOX_WITH_SECURELABEL=$(if $(VBOX_WITH_SECURELABEL),yes,no)' \
+		-E 'VBOX_WITH_MSM_INSTALL=$(if $(VBOX_WITH_MSM_INSTALL),yes,no)' \
 		-E 'VBOX_WITH_SERIALNUMBER_INSTALL=$(if $(VBOX_WITH_SERIALNUMBER_INSTALL),yes,no)' \
 		-E 'VBOX_WITH_LICENSE_DISPLAY=$(if $(VBOX_WITH_LICENSE_DISPLAY),yes,no)' \
 		-E 'VBOX_WINDOWS_ICON_FILE=$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))' \
@@ -483,9 +575,12 @@ ifeq ($(lang),en_US)
 	$(APPEND) -t $(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep 'VBOX_MSI_DEPENDENCIES = \'
 	$(SED) -f $(VBOX_PATH_WIN_INST_SRC)/dep.sed \
 		--append $(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep \
+		$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
+			$(VBOX_PATH_WIN_INST_SRC)/VBoxMerge$(module).wxi) \
 		$(VBOX_PATH_WIN_INST_SRC)/VirtualBox.wxs \
 		$(VBOX_PATH_WIN_INST_SRC)/UserInterface.wxi \
-		$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi
+		$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
+		$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,)
 	$(APPEND) $(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep ''
 endif
 endef
@@ -494,6 +589,96 @@ $(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
 	$(eval $(def_vbox_compile_wixobj)))
 
 #
+# MSM (merge module) compile.
+#
+define def_vbox_compile_msm
+$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj: \
+			$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxs \
+			$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxi \
+			$(PATH_SUB_CURRENT)/VBoxMerge$(module)CA.wxi \
+			$(PATH_SUB_CURRENT)/VBoxMerge$(module)Seq.wxi \
+			$(PATH_SUB_CURRENT)/UserInterface.wxi \
+			$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi \
+			$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
+			$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
+			$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
+			$(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
+			$(VBOX_MSI_DEPENDENCIES) \
+			$(VBOX_VERSION_STAMP) \
+			| $$$$(dir $$$$@)
+	$(QUIET)$(RM) -f $@
+	$(REDIRECT) \
+		-E 'PATH_OUT=$(subst /,\\,$(PATH_OUT))' \
+		-E 'PATH_TARGET=$(subst /,\\,$(VBOX_WIN_INST_OUT_DIR))' \
+		-E 'PATH_ROOT=$(subst /,\\,$(PATH_ROOT))' \
+		-E 'PATH_MULTIARCH_GUEST_ADDITIONS_ISO=$(subst /,\\,$(PATH_MULTIARCH_GUEST_ADDITIONS_ISO))' \
+		-E 'VBOX_PATH_WIN_INST_SRC=$(subst /,\\,$(VBOX_PATH_WIN_INST_SRC))' \
+		-E 'VBOX_BRAND_WIN_INST_DLGJPG=$(subst /,\\,$(VBOX_BRAND_WIN_INST_DLGJPG))' \
+		-E 'VBOX_ADD_LANGUAGES=$(VBOX_INSTALLER_ADD_LANGUAGES)' \
+		-E 'VBOX_BRAND_LICENSE_RTF=$(subst /,\\,$(VBOX_BRAND_LICENSE_RTF))' \
+		$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
+			-E 'VBOX_BRAND_$(lang)_LICENSE_RTF=$(subst /,\\,$(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF))') \
+		-E 'VBOX_BUILD_NR_FOR_INST=$(VBOX_VERSION_BUILD)' \
+		-E 'VBOX_VENDOR=$(VBOX_VENDOR)' \
+		-E 'VBOX_VENDOR_SHORT=$(VBOX_VENDOR_SHORT)' \
+		-E 'VBOX_PRODUCT=$(VBOX_PRODUCT)' \
+		-E 'VBOX_C_YEAR=$(VBOX_C_YEAR)' \
+		-E 'VBOX_VERSION_STRING=$(VBOX_VERSION_STRING)' \
+		-E 'VBOX_VERSION_STRING_RAW=$(VBOX_VERSION_STRING_RAW)' \
+		-E 'VBOX_VERSION_MAJOR_INST=$(VBOX_VERSION_MAJOR)' \
+		-E 'VBOX_VERSION_MINOR_INST=$(VBOX_VERSION_MINOR)' \
+		-E 'VBOX_SIGNING_MODE=$(strip $(if $(VBOX_SIGNING_MODE),$(VBOX_SIGNING_MODE),none))' \
+		-E 'VBOX_GUI_USE_QGL=$(if $(VBOX_GUI_USE_QGL),yes,no)' \
+		-E 'VBOX_WITH_32_ON_64_MAIN_API=$(if $(VBOX_WITH_32_ON_64_MAIN_API),yes,no)' \
+		-E 'VBOX_WITH_ADDITIONS_PACKING=$(if $(VBOX_WITH_ADDITIONS_PACKING),yes,no)' \
+		-E 'VBOX_WITH_COMBINED_PACKAGE=$(if $(VBOX_WITH_COMBINED_PACKAGE),yes,no)' \
+		-E 'VBOX_WITH_CROGL=$(if $(VBOX_WITH_CROGL),yes,no)' \
+		-E 'VBOX_WITH_DEBUGGER_GUI=$(if-expr defined(VBOX_WITH_DEBUGGER_GUI) && defined(VBOX_WITH_QTGUI),yes,no)' \
+		-E 'VBOX_WITH_DOCS_PACKING=$(if $(VBOX_WITH_DOCS_PACKING),yes,no)' \
+		-E 'VBOX_WITH_EFIFW_PACKING=$(if $(VBOX_WITH_EFIFW_PACKING),yes,no)' \
+		-E 'VBOX_WITH_EXTPACK=$(if $(VBOX_WITH_EXTPACK),yes,no)' \
+		-E 'VBOX_WITH_GUEST_CONTROL=$(if $(VBOX_WITH_GUEST_CONTROL),yes,no)' \
+		-E 'VBOX_WITH_GUEST_PROPS=$(if $(VBOX_WITH_GUEST_PROPS),yes,no)' \
+		-E 'VBOX_WITH_DRAG_AND_DROP=$(if $(VBOX_WITH_DRAG_AND_DROP),yes,no)' \
+		-E 'VBOX_WITH_NETFLT=$(if $(VBOX_WITH_NETFLT),yes,no)' \
+		-E 'VBOX_WITH_PYTHON=$(if $(VBOX_WITH_PYTHON),yes,no)' \
+		-E 'VBOX_WITH_QTGUI=$(if $(VBOX_WITH_QTGUI),yes,no)' \
+		-E 'VBOX_WITH_VIDEOHWACCEL=$(if $(VBOX_WITH_VIDEOHWACCEL),yes,no)' \
+		-E 'VBOX_WITH_VRDP=$(if-expr defined(VBOX_WITH_VRDP) && !defined(VBOX_WITH_EXTPACK_PUEL),yes,no)' \
+		-E 'VBOX_WITH_WEBSERVICES=$(if $(VBOX_WITH_WEBSERVICES),yes,no)' \
+		-E 'VBOX_WITH_MSM_INSTALL=$(if $(VBOX_WITH_MSM_INSTALL),yes,no)' \
+		-E 'VBOX_WITH_SECURELABEL=$(if $(VBOX_WITH_SECURELABEL),yes,no)' \
+		-E 'VBOX_WITH_SERIALNUMBER_INSTALL=$(if $(VBOX_WITH_SERIALNUMBER_INSTALL),yes,no)' \
+		-E 'VBOX_WITH_LICENSE_DISPLAY=$(if $(VBOX_WITH_LICENSE_DISPLAY),yes,no)' \
+		-E 'VBOX_WINDOWS_ICON_FILE=$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))' \
+		-E 'BUILD_TYPE=$(KBUILD_TYPE)' \
+		-E 'BUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH)' \
+		-E 'VBOX_VCC_TOOL_STEM=$(VBOX_VCC_TOOL_STEM)' \
+		-- \
+		$(VBOX_PATH_WIX)/candle.exe $(filter-out $(VBOX_VERSION_STAMP),$$<) \
+			-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
+			-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
+			-out $$@
+ifeq ($(lang),en_US)
+#
+# Generate dependency file, we share this between all the languages.
+#
+	$(APPEND) -t $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep 'VBOX_MSI_DEPENDENCIES = \'
+	$(SED) -f $(VBOX_PATH_WIN_INST_SRC)/dep.sed \
+		--append $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep \
+		$(VBOX_PATH_WIN_INST_SRC)/VBoxMerge$(module).wxi \
+		$(VBOX_PATH_WIN_INST_SRC)/UserInterface.wxi \
+		$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
+		$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,)
+	$(APPEND) $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep ''
+endif
+endef
+
+$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
+	$(foreach lang,$(VBOX_INSTALLER_MERGE_LANGUAGES), \
+		$(eval $(def_vbox_compile_msm))))
+
+#
 # VirtualBox Type Library definition.
 #
 $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi: \
@@ -510,7 +695,6 @@ $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi: \
 	$(SED) -e 's/VBoxC/VBoxClient_x86/g' --output $@ $@.tmp
 	$(RM) -f $@.tmp
 
-
 #
 # Construct the list of GUI translations.
 # ('-t' -- truncate file; '-n' -- new line between arguments)
@@ -591,7 +775,8 @@ $(PACKAGE_NAME_FINAL): \
 if defined(VBOX_WITH_COMBINED_PACKAGE) && "$(KBUILD_TARGET_ARCH)" == "x86"
 #
 # Make the multi-architecture installer by calling our stub builder
-# with both platform installers (x86 and amd64) + common cab. We only
+# with both platform installers (x86 and amd64) + common cab. The common
+# cab only is needed when we don't use merge modules. We only
 # need to do this once; so do it on x86 only.
 #
 $(PATH_STAGE_BIN)/$(PACKAGE_NAME_MULTIARCH_FINAL): \
@@ -600,12 +785,12 @@ $(PATH_STAGE_BIN)/$(PACKAGE_NAME_MULTIARCH_FINAL): \
 		$(PATH_STAGE_BIN)/VBoxStub.exe \
 		$$(VBoxStubBld_1_TARGET)
 	$(call MSG_L1,Building Windows combined package)
-	$(call VBOX_SIGN_FILE_FN,$(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_MULTIARCH_COMMONCAB))
+	$(if $(VBOX_WITH_MSM_INSTALL),,$(call VBOX_SIGN_FILE_FN,$(PACKAGE_NAME_MULTIARCH_COMMONCAB)))
 	$(REDIRECT) -C $(@D) -- \
 		$(VBoxStubBld_1_TARGET) -out $@ \
 			-target-x86 $(PATH_MULTIARCH_TEMP)/$(PACKAGE_NAME_MULTIARCH.x86) \
 			-target-amd64 $(PATH_MULTIARCH_TEMP)/$(PACKAGE_NAME_MULTIARCH.amd64) \
-			-target-all $(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_MULTIARCH_COMMONCAB) \
+			$(if $(VBOX_WITH_MSM_INSTALL),,-target-all $(PACKAGE_NAME_MULTIARCH_COMMONCAB)) \
 			-stub $(PATH_STAGE_BIN)/VBoxStub.exe
 	$(call VBOX_SIGN_FILE_FN,$@)
 endif
diff --git a/src/VBox/Installer/win/NLS/de_DE.wxl b/src/VBox/Installer/win/NLS/de_DE.wxl
index 8f666ba..23dcd96 100644
--- a/src/VBox/Installer/win/NLS/de_DE.wxl
+++ b/src/VBox/Installer/win/NLS/de_DE.wxl
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<WixLocalization xmlns="http://schemas.microsoft.com/wix/2003/11/localization" Codepage="1252" Culture="de_DE">
+<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1252" Culture="de_DE">
 
     <!--
             Language Definition Include for VirtualBox WiX script.
 
-            Copyright (C) 2011-2012 Oracle Corporation
+            Copyright (C) 2011-2014 Oracle Corporation
 
             This file is part of VirtualBox Open Source Edition (OSE), as
             available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Installer/win/NLS/en_US.wxl b/src/VBox/Installer/win/NLS/en_US.wxl
index 8ffa834..f773604 100644
--- a/src/VBox/Installer/win/NLS/en_US.wxl
+++ b/src/VBox/Installer/win/NLS/en_US.wxl
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<WixLocalization xmlns="http://schemas.microsoft.com/wix/2003/11/localization" Codepage="1252" Culture="en_US">
+<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1252" Culture="en_US">
 
     <!--
             Language Definition Include for VirtualBox WiX script.
 
-            Copyright (C) 2011-2012 Oracle Corporation
+            Copyright (C) 2011-2014 Oracle Corporation
 
             This file is part of VirtualBox Open Source Edition (OSE), as
             available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Installer/win/NLS/fa_IR.wxl b/src/VBox/Installer/win/NLS/fa_IR.wxl
index 37b7f67..75f1956 100644
--- a/src/VBox/Installer/win/NLS/fa_IR.wxl
+++ b/src/VBox/Installer/win/NLS/fa_IR.wxl
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
-<WixLocalization xmlns="http://schemas.microsoft.com/wix/2003/11/localization" Codepage="1256" Culture="fa">
+<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1256" Culture="fa">
+
     <!--
             Language Definition Include for VirtualBox WiX script.
-            Copyright (C) 2011-2012 Oracle Corporation
+
+            Copyright (C) 2011-2014 Oracle Corporation
+
             This file is part of VirtualBox Open Source Edition (OSE), as
             available from http://www.virtualbox.org. This file is free software;
             you can redistribute it and/or modify it under the terms of the GNU
@@ -11,8 +14,10 @@
             VirtualBox OSE distribution. VirtualBox OSE is distributed in the
             hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
     -->
+
     <String Id="LANG">1065</String>
     <String Id="LangName">Farsi</String>
+
     <String Id="ButtonText_No">&خير</String>
     <String Id="ButtonText_Yes">&بله</String>
     <String Id="ButtonText_Cancel">&انصراف</String>
@@ -510,4 +515,4 @@
     <String Id="UITextVolumeCostRequired">موردنیاز</String>
     <String Id="UITextVolumeCostSize">حجم دیسک</String>
     <String Id="UITextVolumeCostVolume">درایو</String>
-</WixLocalization>
\ No newline at end of file
+</WixLocalization>
diff --git a/src/VBox/Installer/win/NLS/fr_FR.wxl b/src/VBox/Installer/win/NLS/fr_FR.wxl
index fa3d77f..eb26d21 100644
--- a/src/VBox/Installer/win/NLS/fr_FR.wxl
+++ b/src/VBox/Installer/win/NLS/fr_FR.wxl
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<WixLocalization xmlns="http://schemas.microsoft.com/wix/2003/11/localization" Codepage="1252" Culture="fr_FR">
+<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1252" Culture="fr_FR">
 
     <!--
             Language Definition Include for VirtualBox WiX script.
 
-            Copyright (C) 2010-2012 Oracle Corporation
+            Copyright (C) 2011-2014 Oracle Corporation
 
             This file is part of VirtualBox Open Source Edition (OSE), as
             available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Installer/win/NLS/it_IT.wxl b/src/VBox/Installer/win/NLS/it_IT.wxl
index 98e6bc3..b6d00e6 100644
--- a/src/VBox/Installer/win/NLS/it_IT.wxl
+++ b/src/VBox/Installer/win/NLS/it_IT.wxl
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
-<WixLocalization xmlns="http://schemas.microsoft.com/wix/2003/11/localization" Codepage="1252" Culture="en_US">
+<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1252" Culture="en_US">
+
     <!--
             Language Definition Include for VirtualBox WiX script.
-            Copyright (C) 2011-2012 Oracle Corporation
+
+            Copyright (C) 2011-2014 Oracle Corporation
+
             This file is part of VirtualBox Open Source Edition (OSE), as
             available from http://www.virtualbox.org. This file is free software;
             you can redistribute it and/or modify it under the terms of the GNU
@@ -11,8 +14,10 @@
             VirtualBox OSE distribution. VirtualBox OSE is distributed in the
             hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
     -->
+
     <String Id="LANG">1040</String>
     <String Id="LangName">Italiano</String>
+
     <String Id="ButtonText_No">&No</String>
     <String Id="ButtonText_Yes">&Sì</String>
     <String Id="ButtonText_Cancel">A&nnulla</String>
@@ -510,4 +515,4 @@
     <String Id="UITextVolumeCostRequired">Richiesto</String>
     <String Id="UITextVolumeCostSize">Dimensione disco</String>
     <String Id="UITextVolumeCostVolume">Volume</String>
-</WixLocalization>
\ No newline at end of file
+</WixLocalization>
diff --git a/src/VBox/Installer/win/NLS/tr_TR.wxl b/src/VBox/Installer/win/NLS/tr_TR.wxl
index e907e91..508441d 100644
--- a/src/VBox/Installer/win/NLS/tr_TR.wxl
+++ b/src/VBox/Installer/win/NLS/tr_TR.wxl
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
-<WixLocalization xmlns="http://schemas.microsoft.com/wix/2003/11/localization" Codepage="1254" Culture="tr_TR">
+<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1254" Culture="tr_TR">
 
     <!--
             Language Definition Include for VirtualBox WiX script.
 
-            Copyright (C) 2011-2012 Oracle Corporation
+            Copyright (C) 2011-2014 Oracle Corporation
 
             This file is part of VirtualBox Open Source Edition (OSE), as
             available from http://www.virtualbox.org. This file is free software;
@@ -52,58 +52,58 @@
     <String Id="VB_NetAdpDriver">Sadece-Anamakine Ağı Oluşturma için [ProductName] sanal ağ bağdaştırıcısı sürücüsü.</String>
 
     <String Id="VB_Python">VirtualBox için Python desteği.</String>
-    
+
 	<!---->
-    
+
 	<String Id="NeedAdmin">[ProductName] yüklemek(kaldırmak) için yönetici haklarına sahip olmanız gerekir! Bu kur şimdi iptal edilecek.</String>
     <String Id="WrongOS">Bu uygulama sadece Windows XP veya üzerinde çalışır.</String>
     <String Id="Only32Bit">Bu uygulama sadece 32-bit Windows sistemlerinde çalışır. Lütfen [ProductName] 64-bit sürümünü yükleyin!</String>
     <String Id="Only64Bit">Bu uygulama sadece 64-bit Windows sistemlerinde çalışır. Lütfen [ProductName] 32-bit sürümünü yükleyin!</String>
     <String Id="SunFound">Bu makinede eski bir Sun VirtualBox kurulumu bulundu. Lütfen önce bu paketi kaldırın ve sonra [ProductName] yükleyin!</String>
     <String Id="InnotekFound">Bu makinede eski bir innotek VirtualBox kurulumu bulundu. Lütfen önce bu paketi kaldırın ve sonra [ProductName] yükleyin!</String>
-   
+
 	<!---->
-    
+
 	<String Id="CancelDlg_Question">[ProductName] kurulumunu iptal etmek istediğinize emin misiniz?</String>
-    
+
 	<!---->
-    
+
 	<String Id="WelcomeDlg_Header">[ProductName] Kur Sihirbazına Hoş Geldiniz</String>
     <String Id="WelcomeDlg_Body">Kur Sihirbazı bilgisayarınıza [ProductName] kuracak. Devam etmek için İleri'ye veya Kur Sihirbazından çıkmak için İptal'e tıklayın.</String>
-    
+
 	<!---->
-    
+
 	<String Id="LicenseAgreementDlg_Header">Son Kullanıcı Lisans Sözleşmesi</String>
     <String Id="LicenseAgreementDlg_Body">Lütfen aşağıdaki lisans sözleşmesini dikkatlice okuyun.</String>
     <String Id="LicenseAgreementDlg_Accept">Lisans Sözleşmesi içindeki şartları kabul e&diyorum</String>
     <String Id="LicenseAgreementDlg_Decline">Lisans Sözleşmesi içindeki şartları kabul e&tmiyorum</String>
 
     <!---->
-    
+
 	<String Id="CheckSerialDlg_Header">Seri Numara</String>
     <String Id="CheckSerialDlg_Body">Lütfen aşağıdaki alana seri numaranızı girin. You'll find it on the sticker inside the VirtualBox CD kutusu içerisindeki etikette bulacaksınız.</String>
     <String Id="CheckSerialDlg_Footer">Seri numarasını girmeniz bittiğinde, aşağıdaki "Kontrol Et" düğmesine basın".</String>
-    
+
 	<!---->
-    
+
 	<String Id="WrongSerialDlg_Header">Girilen seri numarası geçersiz!</String>
     <String Id="WrongSerialDlg_Desc1">Seri numaranızı tekrar girmek için lütfen geri gidin.</String>
     <String Id="WrongSerialDlg_Desc2">Seri numarasını etiket üzerine basıldığı gibi aynen hecesi hecesine yazılmak zorunda olduğunu aklınızdan çıkarmayın.</String>
-    
+
 	<!---->
-    
+
 	<String Id="WarnSaveStatesDlg_Header">Uyarı:</String>
     <String Id="WarnSaveStatesDlg_Header2">Uyumsuz Kaydedilmiş Durum!</String>
     <String Id="WarnSaveStatesDlg_Desc">[ProductName] yükseltildiğinde, zaten mevcut makinelerinizden kaydedilmiş tüm durumlar bundan böyle çalışmayacak! Kurulumdan sonra bunlardan el ile vazgeçmek zorundasınız.</String>
     <String Id="WarnSaveStatesDlg_Proceed">Hemen kuruluma devam edilsin mi?</String>
-    
+
 	<!---->
-    
+
 	<String Id="WarnTAPDevicesDlg_Header">Anamakine Arayüzleri</String>
     <String Id="WarnTAPDevicesDlg_Desc">Önceki sürümdeki makineleriniz için bazı anamakine arayüzleri kullandıysanız, bu kurulumdan sonra onları el ile yeniden oluşturmak zorundasınız.</String>
-    
+
 	<!---->
-    
+
 	<String Id="NetCfgLocked">Şurda belirtilen uygulama yüklemeye devam etmeden önce kapatılmalıdır: "[2]"</String>
 
 	<!---->
@@ -118,76 +118,76 @@
     <String Id="CustomizeDlg_SelItemPath">CustomizeDlgLocation-CustomizeDlgLocation</String>
 
     <!---->
-    
+
 	<String Id="Customize2Dlg_Header">Özelleştir</String>
     <String Id="Customize2Dlg_Desc">Lütfen aşağıdaki seçeneklerden seçin:</String>
     <String Id="Customize2Dlg_CreateShortcut">Masaüstüne kısayol oluştur</String>
     <String Id="Customize2Dlg_CreateQuickLaunch">Hızlı Başlat Çubuğuna kısayol oluştur</String>
-    
+
 	<!---->
-    
+
 	<String Id="WarnDisconNetIfacesDlg_Title">Uyarı:</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">Ağ Arayüzleri</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">[ProductName] Ağ Oluşturma özelliği kurulumu ağ bağlantınızı sıfırlayacak ve geçici olarak ağınızın bağlantısını kesecek.</String>
     <String Id="WarnDisconNetIfacesDlg_Question">Hemen kuruluma devam edilsin mi?</String>
-    
+
 	<!---->
-    
+
 	<String Id="DiskCostDlg_SpaceRequired">Seçilen özelliklerin kurulumu için gereken disk alanı.</String>
     <String Id="DiskCostDlg_NotEnoughSpace">Vurgulanan bölümler (eğer varsa) şu anki seçilen özellikler için kullanılabilir yeterli disk alanına sahip değil. Ya vurgulanan bölümlerden bazı dosyaları kaldırabilirsiniz ya da yerel sürücüye(lere) daha az özellik yüklemeyi seçebilirsiniz ya da farklı hedef sürücü(leri) seçebilirsiniz.</String>
     <String Id="DiskCostDlg_SpaceRequirements">Disk Alanı Gereksinimleri</String>
     <String Id="DiskCostDlg_VolumeList">{120}{70}{70}{70}{70}</String>
-    
+
 	<!---->
-    
+
 	<String Id="BrowseDlg_BrowseDestFolder">Hedef klasöre gözat</String>
     <String Id="BrowseDlg_ChangeCurFolder">Şu anki hedef klasörü değiştir</String>
     <String Id="BrowseDlg_UpOneLevelTooltip">Bir seviye yukarı</String>
     <String Id="BrowseDlg_CreateNewFolderTooltip">Yeni bir klasör oluştur</String>
     <String Id="BrowseDlg_LookIn">&Bakılan yer:</String>
     <String Id="BrowseDlg_FolderName">&Klasör adı:</String>
-    
+
 	<!---->
-    
+
 	<String Id="VerifyReadyDlg_ReadyToBegin">Kur Sihirbazı [InstallMode] kurulumuna başlamaya hazır.</String>
     <String Id="VerifyReadyDlg_ClickInstall">Kuruluma başlamak için Yükle'ye tıklayın. Eğer herhangi bir kurulum ayarınızı gözden geçirmek veya değiştirmek istiyorsanız, Geri'ye tıklayın. Sihirbazdan çıkmak için İptal'e tıklayın.</String>
     <String Id="VerifyReadyDlg_ReadyToInstall">Yüklemek için hazır</String>
-    
+
 	<!---->
-    
+
 	<String Id="ExitDlg_ClickFinish">Kur Sihirbazından çıkmak için Bitir düğmesine tıklayın.</String>
     <String Id="ExitDlg_InstComplete">[ProductName] kurulumu tamamlandı.</String>
     <String Id="ExitDlg_StartVBox">Kurulumdan sonra [ProductName] uygulamasını başlat</String>
-    
+
 	<!---->
-    
+
 	<String Id="FatalErrorDlg_Header">[ProductName] Kur Sihirbazı zamansız sonlandı</String>
     <String Id="FatalErrorDlg_Desc">[ProductName] kur bir hata yüzünden zamansız sonlandı. Sisteminiz değiştirilmedi. Bu programı daha sonraki bir zamanda yüklemek için lütfen kurulumu tekrar çalıştırın.</String>
     <String Id="FatalErrorDlg_Footer">Kur Sihirbazından çıkmak için Bitir düğmesine tıklayın.</String>
-   
+
 	<!---->
-    
+
 	<String Id="FilesInUse_Text">Bu kur tarafından güncellenmesi gereken dosyaları aşağıdaki uygulamalar kullanıyor. Bu uygulamaları kapatın ve sonra kuruluma devam etmek için &Yeniden Dene'ye veya çıkmak için İptal'e tıklayın.</String>
     <String Id="FilesInUse_Description">Şu anda kullanımda olan bazı dosyaların güncellenmesi gerek.</String>
     <String Id="FilesInUse_Title">Kullanımda olan Dosyalar</String>
-    
+
 	<!---->
-    
+
 	<String Id="UserExitDlg_Header">[ProductName] Kur Sihirbazı yarıda kesildi</String>
     <String Id="UserExitDlg_Desc">[ProductName] kur yarıda kesildi. Sisteminiz değiştirilmedi. Bu programı daha sonraki bir zamanda yüklemek için lütfen kurulumu tekrar çalıştırın.</String>
     <String Id="UserExitDlg_Footer">Kur Sihirbazından çıkmak için Bitir düğmesine tıklayın.</String>
-    
+
 	<!---->
-    
+
 	<String Id="ProgressDlg_PleaseWait">Kur Sihirbazı [ProductName] yüklerken lütfen bekleyin. Bu birkaç dakika alabilir.</String>
-    
+
 	<!---->
-    
+
 	<String Id="ResumeDlg_Header">[ProductName] Kur Sihirbazına Devam Ediliyor</String>
     <String Id="ResumeDlg_Desc">Kur Sihirbazı [ProductName] uygulamasının bilgisayarınıza kurulumunu tamamlayacak. Devam etmek için Yükle'ye veya Kur Sihirbazından çıkmak için İptal'e tıklayın.</String>
-    
+
 	<!---->
-    
+
 	<String Id="MaintenanceTypeDlg_Header">Kurulumu Değiştir, Onar veya Kaldır</String>
     <String Id="MaintenanceTypeDlg_SelOption">Uygulanmasını istediğiniz işlemi seçin.</String>
     <String Id="MaintenanceTypeDlg_Repair">&Onar</String>
@@ -200,43 +200,43 @@
     <String Id="MaintenanceTypeDlg_RemoveTooltip">Kurulumu kaldır</String>
     <String Id="MaintenanceTypeDlg_RemoveProgress1">Kaldırılıyor</String>
     <String Id="MaintenanceTypeDlg_RemoveProgress2">kaldırma</String>
-    
+
 	<!---->
-    
+
 	<String Id="MaintenanceWelcomeDlg_Header">[ProductName] Kur Sihirbazına Hoş Geldiniz</String>
     <String Id="MaintenanceWelcomeDlg_Desc">Kur Sihirbazı şu anki kurulumunuzu onarmanıza veya [ProductName] uygulamasını bilgisayarınızdan kaldırmanıza izin verecek. Devam etmek için İleri'ye veya Kur Sihirbazından çıkmak için İptal'e tıklayın.</String>
-    
+
 	<!---->
 
     <String Id="OutOfDiskDlg_InstallationExceeds">Kurulum için gereken disk alanı mevcut disk alanını aşıyor.</String>
     <String Id="OutOfDiskDlg_NotEnoughDiskSpace">Vurgulanan bölümler şu anki seçilen özellikler için kullanılabilir yeterli disk alanına sahip değil. Ya vurgulanan bölümlerden bazı dosyaları kaldırabilirsiniz ya da yerel sürücüye(lere) daha az özellik yüklemeyi seçebilirsiniz ya da farklı hedef sürücü(leri) seçebilirsiniz.</String>
     <String Id="OutOfDiskDlg_OutOfDiskSpace">Yetersiz Disk Alanı</String>
-    
+
 	<!---->
 
     <String Id="OutOfRbDiskDlg_InstallationExceeds">Kurulum için gereken disk alanı mevcut disk alanını aşıyor.</String>
     <String Id="OutOfRbDiskDlg_NotEnoughDiskSpace">Vurgulanan bölümler şu anki seçilen özellikler için kullanılabilir yeterli disk alanına sahip değil. Ya vurgulanan bölümlerden bazı dosyaları kaldırabilirsiniz ya da yerel sürücüye(lere) daha az özellik yüklemeyi seçebilirsiniz ya da farklı hedef sürücü(leri) seçebilirsiniz.</String>
     <String Id="OutOfRbDiskDlg_OutOfDiskSpace">Yetersiz Disk Alanı</String>
     <String Id="OutOfRbDiskDlg_Desc">Alternatif olarak, yükleyicinin geriye alma işlevselliğini etkisizleştirmeyi seçebilirsiniz. Bu, herhangi bir şekilde kurulumun yarıda kesilmesiyle yükleyicinin bilgisayarınızın orijinal durumuna geri yüklenmesi için izin verir. Geri almayı etkisizleştirme riskini almak isterseniz Evet'e tıklayın.</String>
-    
+
 	<!---->
-    
+
 	<String Id="VerifyRemoveDlg_Header">[ProductName] Kaldır</String>
     <String Id="VerifyRemoveDlg_Desc">Programı bilgisayarınızdan kaldırmayı seçmektesiniz.</String>
     <String Id="VerifyRemoveDlg_ClickRemove">[ProductName] uygulamasını bilgisayarınızdan kaldırmak için Kaldır'a tıklayın. Eğer herhangi bir kurulum ayarınızı gözden geçirmek veya değiştirmek istiyorsanız, Geri'ye tıklayın. Sihirbazdan çıkmak için İptal'e tıklayın.</String>
-    
+
 	<!---->
-    
+
 	<String Id="VerifyRepairDlg_Header">[ProductName] Onar</String>
     <String Id="VerifyRepairDlg_ReadyToBegin">Kur Sihirbazı [ProductName] uygulamasının onarılmasına başlamak için hazır.</String>
     <String Id="VerifyRepairDlg_ClickRepair">[ProductName] kurulumunu onarmak için Onar'a tıklayın. Eğer herhangi bir kurulum ayarınızı gözden geçirmek veya değiştirmek istiyorsanız, Geri'ye tıklayın. Sihirbazdan çıkmak için İptal'e tıklayın.</String>
-    
+
 	<!---->
 
     	<String Id="WaitForCostingDlg_PleaseWait">Yükleyici disk alanı gereksinimlerinizi belirlemeyi bitirirken lütfen bekleyin.</String>
-    
+
 	<!---->
-    
+
 	<String Id="MsiRMFilesInUse_Text">Bu kur tarafından güncellenmesi gereken dosyaları aşağıdaki uygulamalar kullanıyor. Kur Sihirbazına onları kapatması ve yeniden başlatmayı denemesi veya daha sonra makineyi yeniden başlatması için izin verebilirsiniz.</String>
     <String Id="MsiRMFilesInUse_Description">Şu anda kullanımda olan bazı dosyaların güncellenmesi gerek.</String>
     <String Id="MsiRMFilesInUse_Title">Kullanımda olan Dosyalar</String>
@@ -402,7 +402,7 @@
     <String Id="Error1933">Windows Yükleyici hizmeti bir ya da daha fazla korunan Windows dosyasını güncelleyemiyor. {{SFP Dizgisi: [2]. Korunan dosyaların listesi:\r\n[3]}}</String>
     <String Id="Error1934">Kullanıcı kurulumları makinedeki ilke yoluyla etkisizleştirildi.</String>
     <String Id="Error1935">[2] çevirme bileşenlerinin kurulumu sırasında bir hata meydana geldi. HSONUCU: [3]. {{çevirme arayüzü: [4], işlev: [5], çevirme adı: [6]}}</String>
-    
+
 	<!-- Own / special errors -->
     <String Id="Error25001">"[2]" uygulamasının kuruluma devam etmesi için kapatılması gerekiyor.</String>
 
@@ -532,7 +532,7 @@
     <String Id="ProgressTextUnmoveFiles">Taşınmış dosyalar kaldırılıyor</String>
     <String Id="ProgressTextUnmoveFilesTemplate">Dosya: [1], Dizin: [9]</String>
     <String Id="ProgressTextUnpublishProduct">Ürün bilgisi yayından kaldırılıyor</String>
-    
+
 	<String Id="UITextbytes">bayt</String>
     <String Id="UITextGB">GB</String>
     <String Id="UITextKB">KB</String>
@@ -583,4 +583,4 @@
     <String Id="UITextVolumeCostSize">Disk Boyutu</String>
     <String Id="UITextVolumeCostVolume">Bölüm</String>
 
-</WixLocalization>
\ No newline at end of file
+</WixLocalization>
diff --git a/src/VBox/Installer/win/NLS/zh_TW.wxl b/src/VBox/Installer/win/NLS/zh_TW.wxl
index 383a812..8af85c9 100644
--- a/src/VBox/Installer/win/NLS/zh_TW.wxl
+++ b/src/VBox/Installer/win/NLS/zh_TW.wxl
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
-<WixLocalization xmlns="http://schemas.microsoft.com/wix/2003/11/localization" Codepage="65001" Culture="zh_TW">
+<WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="65001" Culture="zh_TW">
 
-  <!--
-          Language Definition Include for VirtualBox WiX script.
+    <!--
+            Language Definition Include for VirtualBox WiX script.
 
-          Copyright (C) 2011-2012 Oracle Corporation
+            Copyright (C) 2011-2014 Oracle Corporation
 
-          This file is part of VirtualBox Open Source Edition (OSE), as
+            This file is part of VirtualBox Open Source Edition (OSE), as
             available from http://www.virtualbox.org. This file is free software;
             you can redistribute it and/or modify it under the terms of the GNU
             General Public License (GPL) as published by the Free Software
@@ -96,7 +96,7 @@
     <String Id="WarnSaveStatesDlg_Header2">已經的儲存狀態不相容!</String>
     <String Id="WarnSaveStatesDlg_Desc">升級 [ProductName] 時,所有來自已經存在機器的儲存狀態不再能動作!安裝後,您必須手動捨棄。</String>
     <String Id="WarnSaveStatesDlg_Proceed">立即進行安裝嗎?</String>
-	
+
     <!---->
 
     <String Id="WarnTAPDevicesDlg_Header">主機介面</String>
diff --git a/src/VBox/Installer/win/Properties.wxi b/src/VBox/Installer/win/Properties.wxi
new file mode 100644
index 0000000..9b17c18
--- /dev/null
+++ b/src/VBox/Installer/win/Properties.wxi
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wix"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+  <!-- TODO: Add "VBox" prefix! -->
+  <?define Property_RegKey = "Software\$(env.VBOX_VENDOR_SHORT)\VirtualBox" ?>
+  <?define Property_RegKeyInstall = "Software\$(env.VBOX_VENDOR_SHORT)\VirtualBox\Install" ?>
+  <?define Property_Upgrade = "yes" ?>
+  <?define Property_Version = "$(env.VBOX_VERSION_STRING_RAW)" ?>
+  <?define Property_VersionExt = "$(env.VBOX_VERSION_STRING)" ?>
+
+  <?if $(env.BUILD_TARGET_ARCH) = "amd64" ?>
+      <?define Property_ProgramFiles = "ProgramFiles64Folder" ?>
+      <?define Property_Platform     = "x64" ?>
+      <?define Property_Win64        = "yes" ?>
+
+      <?if $(env.VBOX_SIGNING_MODE) != none ?>
+          <?define Property_DriverLegacy = "no" ?>
+      <?else ?>
+          <?define Property_DriverLegacy = "yes" ?>
+      <?endif ?>
+
+  <?else ?>
+      <?define Property_ProgramFiles = "ProgramFilesFolder" ?>
+      <?define Property_Platform     = "x86" ?>
+      <?define Property_Win64        = "no" ?>
+
+      <?if $(env.VBOX_SIGNING_MODE) != none ?>
+          <!-- Note: Settings this to 'no' breaks Windows 2000 installs (!) -->
+          <?define Property_DriverLegacy = "yes" ?>
+      <?else ?>
+          <?define Property_DriverLegacy = "yes" ?>
+      <?endif ?>
+
+  <?endif ?>
+
+  <!-- If we build a combined installer (32- and 64-bit in one installer), we
+       use two installer "disks": One for all platform-specific stuff and one which
+       contains all common (platform independent) stuff (like manuals, bitmaps etc) -->
+  <?if $(env.VBOX_WITH_COMBINED_PACKAGE) = "yes" ?>
+      <?define Property_DiskIdCommon = "2" ?>
+  <?else ?>
+      <?define Property_DiskIdCommon = "1" ?>
+  <?endif ?>
+
+</Include>
diff --git a/src/VBox/Installer/win/Stub/VBoxStub.cpp b/src/VBox/Installer/win/Stub/VBoxStub.cpp
index 188bf5e..a60ee31 100644
--- a/src/VBox/Installer/win/Stub/VBoxStub.cpp
+++ b/src/VBox/Installer/win/Stub/VBoxStub.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,8 +18,15 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
+#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0501
+# undef  _WIN32_WINNT
+# define _WIN32_WINNT 0x0501 /* AttachConsole() / FreeConsole(). */
+#endif
+
 #include <Windows.h>
 #include <commctrl.h>
+#include <fcntl.h>
+#include <io.h>
 #include <lmerr.h>
 #include <msiquery.h>
 #include <objbase.h>
@@ -55,6 +62,10 @@
 # include "VBoxStubPublicCert.h"
 #endif
 
+#ifndef TARGET_NT4
+/* Use an own console window if run in verbose mode. */
+# define VBOX_STUB_WITH_OWN_CONSOLE
+#endif
 
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
@@ -89,6 +100,8 @@ typedef STUBCLEANUPREC *PSTUBCLEANUPREC;
 static bool             g_fSilent = false;
 /** List of temporary files. */
 static RTLISTANCHOR     g_TmpFiles;
+/** Verbosity flag. */
+static int              g_iVerbosity = 0;
 
 
 
@@ -801,7 +814,12 @@ int WINAPI WinMain(HINSTANCE  hInstance,
     /* Init IPRT. */
     int vrc = RTR3InitExe(argc, &argv, 0);
     if (RT_FAILURE(vrc))
+    {
+        /* Close the mutex for this application instance. */
+        CloseHandle(hMutexAppRunning);
+        hMutexAppRunning = NULL;
         return RTMsgInitFailure(vrc);
+    }
 
     /*
      * Parse arguments.
@@ -814,11 +832,13 @@ int WINAPI WinMain(HINSTANCE  hInstance,
     bool fEnableSilentCert         = true;
 #endif
     char szExtractPath[RTPATH_MAX] = {0};
-    char szMSIArgs[4096]           = {0};
+    char szMSIArgs[_4K]            = {0};
 
     /* Parameter definitions. */
     static const RTGETOPTDEF s_aOptions[] =
     {
+        /** @todo Replace short parameters with enums since they're not
+         *        used (and not documented to the public). */
         { "--extract",          'x', RTGETOPT_REQ_NOTHING },
         { "-extract",           'x', RTGETOPT_REQ_NOTHING },
         { "/extract",           'x', RTGETOPT_REQ_NOTHING },
@@ -838,6 +858,12 @@ int WINAPI WinMain(HINSTANCE  hInstance,
         { "/path",              'p', RTGETOPT_REQ_STRING  },
         { "--msiparams",        'm', RTGETOPT_REQ_STRING  },
         { "-msiparams",         'm', RTGETOPT_REQ_STRING  },
+        { "--reinstall",        'f', RTGETOPT_REQ_NOTHING },
+        { "-reinstall",         'f', RTGETOPT_REQ_NOTHING },
+        { "/reinstall",         'f', RTGETOPT_REQ_NOTHING },
+        { "--verbose",          'v', RTGETOPT_REQ_NOTHING },
+        { "-verbose",           'v', RTGETOPT_REQ_NOTHING },
+        { "/verbose",           'v', RTGETOPT_REQ_NOTHING },
         { "--version",          'V', RTGETOPT_REQ_NOTHING },
         { "-version",           'V', RTGETOPT_REQ_NOTHING },
         { "/version",           'V', RTGETOPT_REQ_NOTHING },
@@ -848,15 +874,30 @@ int WINAPI WinMain(HINSTANCE  hInstance,
         { "/?",                 'h', RTGETOPT_REQ_NOTHING },
     };
 
+    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
+
     /* Parse the parameters. */
     int ch;
+    bool fParsingDone = false;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
     RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while (   (ch = RTGetOpt(&GetState, &ValueUnion))
+           && rcExit == RTEXITCODE_SUCCESS
+           && !fParsingDone)
     {
         switch (ch)
         {
+            case 'f': /* Force re-installation. */
+                if (szMSIArgs[0])
+                    vrc = RTStrCat(szMSIArgs, sizeof(szMSIArgs), " ");
+                if (RT_SUCCESS(vrc))
+                    vrc = RTStrCat(szMSIArgs, sizeof(szMSIArgs),
+                                   "REINSTALLMODE=vomus REINSTALL=ALL");
+                if (RT_FAILURE(vrc))
+                    rcExit = ShowError("MSI parameters are too long.");
+                break;
+
             case 'x':
                 fExtractOnly = true;
                 break;
@@ -870,7 +911,6 @@ int WINAPI WinMain(HINSTANCE  hInstance,
                 fEnableSilentCert = false;
                 break;
 #endif
-
             case 'l':
                 fEnableLogging = true;
                 break;
@@ -878,7 +918,7 @@ int WINAPI WinMain(HINSTANCE  hInstance,
             case 'p':
                 vrc = RTStrCopy(szExtractPath, sizeof(szExtractPath), ValueUnion.psz);
                 if (RT_FAILURE(vrc))
-                    return ShowError("Extraction path is too long.");
+                    rcExit = ShowError("Extraction path is too long.");
                 break;
 
             case 'm':
@@ -887,114 +927,197 @@ int WINAPI WinMain(HINSTANCE  hInstance,
                 if (RT_SUCCESS(vrc))
                     vrc = RTStrCat(szMSIArgs, sizeof(szMSIArgs), ValueUnion.psz);
                 if (RT_FAILURE(vrc))
-                    return ShowError("MSI parameters are too long.");
+                    rcExit = ShowError("MSI parameters are too long.");
                 break;
 
             case 'V':
                 ShowInfo("Version: %d.%d.%d.%d",
-                         VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, VBOX_SVN_REV);
-                return VINF_SUCCESS;
+                         VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD,
+                         VBOX_SVN_REV);
+                fParsingDone = true;
+                break;
+
+            case 'v':
+                g_iVerbosity++;
+                break;
 
             case 'h':
                 ShowInfo("-- %s v%d.%d.%d.%d --\n"
                          "\n"
                          "Command Line Parameters:\n\n"
                          "--extract                - Extract file contents to temporary directory\n"
-                         "--silent                 - Enables silent mode installation\n"
+                         "--help                   - Print this help and exit\n"
+                         "--logging                - Enables installer logging\n"
+                         "--msiparams <parameters> - Specifies extra parameters for the MSI installers\n"
                          "--no-silent-cert         - Do not install VirtualBox Certificate automatically when --silent option is specified\n"
                          "--path                   - Sets the path of the extraction directory\n"
-                         "--msiparams <parameters> - Specifies extra parameters for the MSI installers\n"
-                         "--logging                - Enables installer logging\n"
-                         "--help                   - Print this help and exit\n"
+                         "--reinstall              - Forces VirtualBox to get re-installed\n"
+                         "--silent                 - Enables silent mode installation\n"
                          "--version                - Print version number and exit\n\n"
                          "Examples:\n"
                          "%s --msiparams INSTALLDIR=C:\\VBox\n"
                          "%s --extract -path C:\\VBox",
                          VBOX_STUB_TITLE, VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, VBOX_SVN_REV,
                          argv[0], argv[0]);
-                return VINF_SUCCESS;
+                fParsingDone = true;
+                break;
+
+            case VINF_GETOPT_NOT_OPTION:
+                /* Are (optional) MSI parameters specified and this is the last
+                 * parameter? Append everything to the MSI parameter list then. */
+                if (szMSIArgs[0])
+                {
+                    vrc = RTStrCat(szMSIArgs, sizeof(szMSIArgs), " ");
+                    if (RT_SUCCESS(vrc))
+                        vrc = RTStrCat(szMSIArgs, sizeof(szMSIArgs), ValueUnion.psz);
+                    if (RT_FAILURE(vrc))
+                        rcExit = ShowError("MSI parameters are too long.");
+                    continue;
+                }
+                /* Fall through is intentional. */
 
             default:
                 if (g_fSilent)
-                    return RTGetOptPrintError(ch, &ValueUnion);
-                if (ch == VINF_GETOPT_NOT_OPTION || ch == VERR_GETOPT_UNKNOWN_OPTION)
-                    ShowError("Unknown option \"%s\"!\n"
-                              "Please refer to the command line help by specifying \"/?\"\n"
-                              "to get more information.", ValueUnion.psz);
+                    rcExit = RTGetOptPrintError(ch, &ValueUnion);
+                if (ch == VERR_GETOPT_UNKNOWN_OPTION)
+                    rcExit = ShowError("Unknown option \"%s\"\n"
+                                       "Please refer to the command line help by specifying \"/?\"\n"
+                                       "to get more information.", ValueUnion.psz);
                 else
-                    ShowError("Parameter parsing error: %Rrc\n"
-                              "Please refer to the command line help by specifying \"/?\"\n"
-                              "to get more information.", ch);
-                return RTEXITCODE_SYNTAX;
-
+                    rcExit = ShowError("Parameter parsing error: %Rrc\n"
+                                       "Please refer to the command line help by specifying \"/?\"\n"
+                                       "to get more information.", ch);
+                break;
         }
     }
 
-    /*
-     * Determine the extration path if not given by the user, and gather some
-     * other bits we'll be needing later.
-     */
-    if (szExtractPath[0] == '\0')
+    if (rcExit != RTEXITCODE_SUCCESS)
+        vrc = VERR_PARSE_ERROR;
+
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0501
+# ifdef VBOX_STUB_WITH_OWN_CONSOLE /* Use an own console window if run in debug mode. */
+    if (   RT_SUCCESS(vrc)
+        && g_iVerbosity)
     {
-        vrc = RTPathTemp(szExtractPath, sizeof(szExtractPath));
-        if (RT_SUCCESS(vrc))
-            vrc = RTPathAppend(szExtractPath, sizeof(szExtractPath), "VirtualBox");
-        if (RT_FAILURE(vrc))
-            return ShowError("Failed to determin extraction path (%Rrc)", vrc);
+        if (!AllocConsole())
+        {
+            DWORD dwErr = GetLastError();
+            ShowError("Unable to allocate console, error = %ld\n",
+                      dwErr);
 
+            /* Close the mutex for this application instance. */
+            CloseHandle(hMutexAppRunning);
+            hMutexAppRunning = NULL;
+            return RTEXITCODE_FAILURE;
+        }
+
+        freopen("CONOUT$", "w", stdout);
+        setvbuf(stdout, NULL, _IONBF, 0);
+
+        freopen("CONOUT$", "w", stderr);
     }
-    else
+# endif /* VBOX_STUB_WITH_OWN_CONSOLE */
+#endif
+
+    if (   RT_SUCCESS(vrc)
+        && g_iVerbosity)
+    {
+        RTPrintf("Silent installation      : %RTbool\n", g_fSilent);
+        RTPrintf("Logging enabled          : %RTbool\n", fEnableLogging);
+#ifdef VBOX_WITH_CODE_SIGNING
+        RTPrintf("Certificate installation : %RTbool\n", fEnableSilentCert);
+#endif
+        RTPrintf("Additional MSI parameters: %s\n",
+                 szMSIArgs[0] ? szMSIArgs : "<None>");
+    }
+
+    if (RT_SUCCESS(vrc))
     {
-        /** @todo should check if there is a .custom subdirectory there or not. */
+        /*
+         * Determine the extration path if not given by the user, and gather some
+         * other bits we'll be needing later.
+         */
+        if (szExtractPath[0] == '\0')
+        {
+            vrc = RTPathTemp(szExtractPath, sizeof(szExtractPath));
+            if (RT_SUCCESS(vrc))
+                vrc = RTPathAppend(szExtractPath, sizeof(szExtractPath), "VirtualBox");
+            if (RT_FAILURE(vrc))
+                ShowError("Failed to determine extraction path (%Rrc)", vrc);
+
+        }
+        else
+        {
+            /** @todo should check if there is a .custom subdirectory there or not. */
+        }
+        RTPathChangeToDosSlashes(szExtractPath,
+                                 true /* Force conversion. */); /* MSI requirement. */
     }
-    RTPathChangeToDosSlashes(szExtractPath, true /* Force conversion. */); /* MSI requirement. */
 
     /* Read our manifest. */
     PVBOXSTUBPKGHEADER pHeader;
-    vrc = FindData("MANIFEST", (PVOID *)&pHeader, NULL);
-    if (RT_FAILURE(vrc))
-        return ShowError("Internal package error: Manifest not found (%Rrc)", vrc);
-    /** @todo If we could, we should validate the header. Only the magic isn't
-     *        commonly defined, nor the version number... */
+    if (RT_SUCCESS(vrc))
+    {
+        vrc = FindData("MANIFEST", (PVOID *)&pHeader, NULL);
+        if (RT_FAILURE(vrc))
+            rcExit = ShowError("Internal package error: Manifest not found (%Rrc)", vrc);
+    }
+    if (RT_SUCCESS(vrc))
+    {
+        /** @todo If we could, we should validate the header. Only the magic isn't
+         *        commonly defined, nor the version number... */
 
-    RTListInit(&g_TmpFiles);
+        RTListInit(&g_TmpFiles);
 
-    /*
-     * Up to this point, we haven't done anything that requires any cleanup.
-     * From here on, we do everything in function so we can counter clean up.
-     */
-    bool fCreatedExtractDir;
-    RTEXITCODE rcExit = ExtractFiles(pHeader->byCntPkgs, szExtractPath, fExtractOnly, &fCreatedExtractDir);
-    if (rcExit == RTEXITCODE_SUCCESS)
-    {
-        if (fExtractOnly)
-            ShowInfo("Files were extracted to: %s", szExtractPath);
-        else
+        /*
+         * Up to this point, we haven't done anything that requires any cleanup.
+         * From here on, we do everything in function so we can counter clean up.
+         */
+        bool fCreatedExtractDir;
+        rcExit = ExtractFiles(pHeader->byCntPkgs, szExtractPath,
+                              fExtractOnly, &fCreatedExtractDir);
+        if (rcExit == RTEXITCODE_SUCCESS)
         {
-            rcExit = CopyCustomDir(szExtractPath);
+            if (fExtractOnly)
+                ShowInfo("Files were extracted to: %s", szExtractPath);
+            else
+            {
+                rcExit = CopyCustomDir(szExtractPath);
 #ifdef VBOX_WITH_CODE_SIGNING
-            if (rcExit == RTEXITCODE_SUCCESS && fEnableSilentCert && g_fSilent)
-                rcExit = InstallCertificate();
+                if (rcExit == RTEXITCODE_SUCCESS && fEnableSilentCert && g_fSilent)
+                    rcExit = InstallCertificate();
 #endif
-            unsigned iPackage = 0;
-            while (iPackage < pHeader->byCntPkgs && rcExit == RTEXITCODE_SUCCESS)
-            {
-                rcExit = ProcessPackage(iPackage, szExtractPath, szMSIArgs, fEnableLogging);
-                iPackage++;
+                unsigned iPackage = 0;
+                while (   iPackage < pHeader->byCntPkgs
+                       && rcExit == RTEXITCODE_SUCCESS)
+                {
+                    rcExit = ProcessPackage(iPackage, szExtractPath,
+                                            szMSIArgs, fEnableLogging);
+                    iPackage++;
+                }
+
+                /* Don't fail if cleanup fail. At least for now. */
+                CleanUp(pHeader->byCntPkgs,
+                           !fEnableLogging
+                        && fCreatedExtractDir ? szExtractPath : NULL);
             }
+        }
 
-            /* Don't fail if cleanup fail. At least for now. */
-            CleanUp(pHeader->byCntPkgs, !fEnableLogging && fCreatedExtractDir ? szExtractPath : NULL);
+        /* Free any left behind cleanup records (not strictly needed). */
+        PSTUBCLEANUPREC pCur, pNext;
+        RTListForEachSafe(&g_TmpFiles, pCur, pNext, STUBCLEANUPREC, ListEntry)
+        {
+            RTListNodeRemove(&pCur->ListEntry);
+            RTMemFree(pCur);
         }
     }
 
-    /* Free any left behind cleanup records (not strictly needed). */
-    PSTUBCLEANUPREC pCur, pNext;
-    RTListForEachSafe(&g_TmpFiles, pCur, pNext, STUBCLEANUPREC, ListEntry)
-    {
-        RTListNodeRemove(&pCur->ListEntry);
-        RTMemFree(pCur);
-    }
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0501
+# ifdef VBOX_STUB_WITH_OWN_CONSOLE
+    if (g_iVerbosity)
+        FreeConsole();
+# endif /* VBOX_STUB_WITH_OWN_CONSOLE */
+#endif
 
     /*
      * Release instance mutex.
diff --git a/src/VBox/Installer/win/UserInterface.wxi b/src/VBox/Installer/win/UserInterface.wxi
index 9886bef..904f73d 100644
--- a/src/VBox/Installer/win/UserInterface.wxi
+++ b/src/VBox/Installer/win/UserInterface.wxi
@@ -293,7 +293,11 @@
         <?endif ?>
             </Control>
             <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.ButtonText_Next)">
+        <?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
                 <Publish Event="NewDialog" Value="VBoxCustomize2Dlg">1</Publish>
+        <?else ?>
+                <Publish Event="NewDialog" Value="VBoxVerifyReadyDlg">1</Publish>
+        <?endif ?>
                 <Subscribe Event="SelectionNoItems" Attribute="Enabled" />
             </Control>
             <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.ButtonText_Cancel)">
@@ -327,26 +331,25 @@
                  change their Windows color scheme.
                  Also see: http://osdir.com/ml/windows.devel.wix.user/2005-02/msg00300.html -->
             <Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="25" Y="95" Width="200" Height="17"
-                Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1">
+                Property="VBOX_INSTALLDESKTOPSHORTCUT" CheckBoxValue="1">
                 <Text>!(loc.Customize2Dlg_CreateShortcut)</Text>
             </Control>
             <Control Id="QuicklaunchShortcutCheckBox" Type="CheckBox" X="25" Y="115" Width="200" Height="17"
-                     Property="INSTALLQUICKLAUNCHSHORTCUT" CheckBoxValue="1">
+                     Property="VBOX_INSTALLQUICKLAUNCHSHORTCUT" CheckBoxValue="1">
                 <Text>!(loc.Customize2Dlg_CreateQuickLaunch)</Text>
             </Control>
             <Control Id="RegisterFileExtensionsCheckBox" Type="CheckBox" X="25" Y="135" Width="200" Height="17"
-                     Property="REGISTERFILEEXTENSIONS" CheckBoxValue="1">
+                     Property="VBOX_REGISTERFILEEXTENSIONS" CheckBoxValue="1">
                 <Text>!(loc.Customize2Dlg_RegisterFileExtensions)</Text>
             </Control>
-
             <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17"
                 Default="yes" Cancel="yes" Text="!(loc.ButtonText_Next)">
-<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+            <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
                 <Publish Event="NewDialog" Value="VBoxWarnDisconNetIfacesDlg"><![CDATA[(&VBoxNetworkFlt=3) AND NOT(!VBoxNetworkFlt=3)]]></Publish>
                 <Publish Event="NewDialog" Value="VBoxVerifyReadyDlg"><![CDATA[(&VBoxNetworkFlt<3)]]></Publish>
-<?else ?>
+            <?else ?>
                 <Publish Event="NewDialog" Value="VBoxVerifyReadyDlg">1</Publish>
-<?endif?>
+            <?endif?>
             </Control>
             <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17"
                 Text="!(loc.ButtonText_Back)">
@@ -493,7 +496,11 @@
                 <Publish Event="SpawnDialog" Value="VBoxOutOfDiskDlg"><![CDATA[(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")]]></Publish>
             </Control>
             <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.ButtonText_Back)">
+        <?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
                 <Publish Event="NewDialog" Value="VBoxCustomize2Dlg"><![CDATA[InstallMode = "!(loc.InstallModeCustom)"]]></Publish>
+        <?else ?>
+                <Publish Event="NewDialog" Value="VBoxCustomizeDlg">1</Publish>
+        <?endif ?>
             </Control>
             <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.ButtonText_Cancel)">
                 <Publish Event="SpawnDialog" Value="VBoxCancelDlg">1</Publish>
@@ -508,7 +515,7 @@
         <!-- This dialog is called after successful installation -->
         <Dialog Id="VBoxExitDlg" Width="370" Height="270" Title="[ProductName] !(loc.Setup)" NoMinimize="yes">
             <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.ButtonText_Finish)">
-                <Publish Event="DoAction" Value="ca_StartVBox"><![CDATA[STARTVBOX]]></Publish>
+                <Publish Event="DoAction" Value="ca_StartVBox"><![CDATA[VBOX_STARTVBOX]]></Publish>
                 <Publish Event="EndDialog" Value="Return">1</Publish>
             </Control>
 
@@ -532,7 +539,7 @@
                  change their Windows color scheme.
                  Also see: http://osdir.com/ml/windows.devel.wix.user/2005-02/msg00300.html -->
             <Control Id="StartVBoxCheckBox" Type="CheckBox" X="135" Y="115" Width="200" Height="17"
-                Property="STARTVBOX" CheckBoxValue="1">
+                Property="VBOX_STARTVBOX" CheckBoxValue="1">
                 <Text>!(loc.ExitDlg_StartVBox)</Text>
                 <Condition Action="hide">
                     <![CDATA[(InstallMode="Repair") OR (InstallMode="Remove") OR
diff --git a/src/VBox/Installer/win/VBoxMergeApp.wxi b/src/VBox/Installer/win/VBoxMergeApp.wxi
new file mode 100644
index 0000000..e943724
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeApp.wxi
@@ -0,0 +1,346 @@
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_DOCS_PACKING) = "yes" ?>
+    <Directory Id="dir_VBoxAppDocuments" Name="doc">
+        <!-- The documentation is a separate component. This allows to split the install process
+             into pieces if ever necessary. Maintenance is easier, too. The following component
+             will be installed in the "doc" folder -->
+        <Component Id="cp_Docs" Guid="40BD12C5-89A8-4B81-8A5E-5EEE2C2763C4"
+                   Win64="$(var.Property_Win64)">
+            <?include $(env.PATH_TARGET)\Files_Doc.wxi ?>
+        </Component>
+    </Directory>
+<?endif ?>
+    <!-- Device driver directory -->
+    <Directory Id="dir_VBoxAppDrivers" Name="drivers">
+        <Directory Id="dir_VBoxAppVBoxDrv" Name="vboxdrv">
+            <Component Id="cp_VBoxDrv" Guid="D3E2F2BB-569F-46A2-836C-BDF30FF1EDF8" Win64="$(var.Property_Win64)">
+                <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
+                                Legacy="$(var.Property_DriverLegacy)" Sequence="2" PlugAndPlayPrompt="no"/>
+                <File Id="file_VBoxDrv.sys" Name="VBoxDrv.sys" KeyPath="yes"
+                      Source="$(env.PATH_OUT)\bin\VBoxDrv.sys"/>
+                <File Id="file_VBoxDrv.inf" Name="VBoxDrv.inf"
+                      Source="$(env.PATH_OUT)\bin\VBoxDrv.inf" />
+<?if $(env.VBOX_SIGNING_MODE) != none ?>
+                <File Id="file_VBoxDrv.cat" Name="VBoxDrv.cat"
+                      Source="$(env.PATH_OUT)\bin\VBoxDrv.cat" />
+<?endif ?>
+            </Component>
+        </Directory>
+    </Directory> <!-- Directory "drivers" -->
+
+<?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
+    <!-- National Language Support directory -->
+    <Directory Id="dir_VBoxAppNLS" Name="nls">
+        <Component Id="cp_NLS" Guid="D63517D7-1CF3-4D06-B3EE-C561E323069B" Win64="$(var.Property_Win64)">
+            <!-- Include the autogenerated NLS file list -->
+            <?include $(env.PATH_TARGET)\VBoxGuiNLS.wxi ?>
+        </Component>
+    </Directory>
+<?endif ?>
+
+    <!-- COM components have a separate entry mainly because of the KeyPath attribute (that hints the
+         TypeLib element where to take the TLB resource from) may appear only once per component -->
+    <Component Id="cp_MainCOM" Guid="CD4A3C6C-C2D5-428D-90A1-B6DA3D0777D6" Win64="$(var.Property_Win64)">
+
+        <!-- Note: This file ID *must not* be changed because of our typelib template generation file! -->
+        <File Id="VBoxSVC" Name="VBoxSVC.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxSVC.exe">
+        </File>
+
+        <!-- We set KeyPath on this file to instruct TypeLib to read the TLB resource from it
+             and create appropriate Interface registry entries. Note that the same TLB is present
+             in VBoxSVC.exe - it's just a matter of choice which one to use -->
+        <!-- Note: This file ID *must not* be changed because of our typelib template generation file! -->
+        <File Id="VBoxC" Name="VBoxC.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxC.dll" KeyPath="yes">
+        </File>
+
+        <!-- Include the auto-generated TypeLib block -->
+        <?include $(env.PATH_TARGET)\VirtualBox_TypeLib.wxi ?>
+
+    </Component>
+
+    <!--
+
+    <Component Id="cp_StartMenuShortcut" Guid="1C137D24-E599-47BD-98D0-2F62F202A8EA" Win64="$(var.Property_Win64)">
+        <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)" Type="string"
+                       Value="installed" KeyPath="yes" />
+        <Shortcut Id="ShortcutStartMenuVBox" Directory="ProgramMenuDir"
+                  Name="VirtualBox" WorkingDirectory="INSTALLDIR" Advertise="no" Target="VirtualBox.exe" />
+        <RemoveFolder Id="ShortcutStartMenuVBoxRemove" On="uninstall" />
+    </Component>-->
+
+    <!---->
+
+<?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
+    <Component Id="cp_RegisterExtensions" Guid="FEB8943E-5D60-4E2D-846F-458207019D40"
+               Win64="$(var.Property_Win64)" KeyPath="yes">
+        <Condition>VBOX_REGISTERFILEEXTENSIONS</Condition>
+        <!-- Register file extensions. Note: Extension IDs *must not* be changed! These specify the actual
+             file extension to handle. Also, here would be the place to add more fancy DDE stuff later.
+             Important: The IDs in "IconIndex" *must* be matching "Resources\resource.h" -->
+        <ProgId Id="progId_VirtualBox.Shell.vbox" Description="VirtualBox Machine Definition" Icon="file_VBoxRes.dll" IconIndex="-201">
+            <Extension Id="vbox" ContentType="application/x-virtualbox-vbox">
+                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
+            </Extension>
+        </ProgId>
+        <ProgId Id="progId_VirtualBox.Shell.vbox-extpack" Description="VirtualBox Extension Pack" Icon="file_VBoxRes.dll" IconIndex="-202">
+            <Extension Id="vbox-extpack" ContentType="application/x-virtualbox-vbox-extpack">
+                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
+            </Extension>
+        </ProgId>
+        <ProgId Id="progId_VirtualBox.Shell.ovf" Description="Open Virtualization Format" Icon="file_VBoxRes.dll" IconIndex="-301">
+            <Extension Id="ovf" ContentType="application/x-virtualbox-ovf">
+                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
+            </Extension>
+        </ProgId>
+        <ProgId Id="progId_VirtualBox.Shell.ova" Description="Open Virtualization Format Archive" Icon="file_VBoxRes.dll" IconIndex="-302">
+            <Extension Id="ova" ContentType="application/x-virtualbox-ova">
+                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
+            </Extension>
+        </ProgId>
+        <ProgId Id="progId_VirtualBox.Shell.vdi" Description="Virtual Disk Image" Icon="file_VBoxRes.dll" IconIndex="-303">
+            <Extension Id="vdi" ContentType="application/x-virtualbox-vdi" />
+        </ProgId>
+        <ProgId Id="progId_VirtualBox.Shell.vmdk" Description="Virtual Machine Disk Format" Icon="file_VBoxRes.dll" IconIndex="-304">
+            <Extension Id="vmdk" ContentType="application/x-virtualbox-vmdk" />
+        </ProgId>
+        <ProgId Id="progId_VirtualBox.Shell.vhd" Description="Virtual Hard Disk" Icon="file_VBoxRes.dll" IconIndex="-305">
+            <Extension Id="vhd" ContentType="application/x-virtualbox-vhd" />
+        </ProgId>
+        <ProgId Id="progId_VirtualBox.Shell.hdd" Description="Virtual Hard Disk" Icon="file_VBoxRes.dll" IconIndex="-306">
+            <Extension Id="hdd" ContentType="application/x-virtualbox-hdd" />
+        </ProgId>
+    </Component> <!-- cp_RegisterExtensions -->
+<?endif ?>
+
+    <!-- All Binaries, DLLs (except COM) and drivers are in one component because they belong together. Additional
+         binaries e.g. test tools, utilities etc. should be in another component so they"re clearly separated -->
+    <Component Id="cp_MainBinaries" Guid="5C8FE57A-F744-4DE0-AA3F-A563F486AD98" Win64="$(var.Property_Win64)">
+
+        <!-- Set required environment variables -->
+        <Environment Id="env_VBoxInstallDir" Action="set" Name="VBOX_MSI_INSTALL_PATH"
+                     System="yes" Part="last" Permanent="no" Value="[msm_VBoxApplicationFolder]" />
+
+        <!-- Files -->
+<?if $(env.VBOX_WITH_DOCS_PACKING) = "yes" ?>
+        <!-- Include all user manual .CHM files (file is generated by makefile) -->
+        <?include $(env.PATH_TARGET)\Files_Main.wxi ?>
+<?endif ?>
+        <!-- Include all license files (file is generated by makefile) -->
+        <?include $(env.PATH_TARGET)\Files_License.wxi ?>
+
+        <!-- Frontends -->
+        <File Id="file_VBoxManage.exe" Name="VBoxManage.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxManage.exe" />
+        <File Id="file_VBoxHeadless.exe" Name="VBoxHeadless.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxHeadless.exe">
+            <!-- Create a simple shortcut for VBoxVRDP, which is not present anymore, pointing to VBoxHeadless.exe -->
+       <!--     <Shortcut Id="ShortcutVBoxVRDP" Directory="INSTALLDIR" Name="VBoxVRDP" Show="normal" WorkingDirectory="INSTALLDIR"/> -->
+        </File>
+        <File Id="file_VBoxBalloonCtrl.exe" Name="VBoxBalloonCtrl.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxBalloonCtrl.exe"/>
+
+        <!-- Misc tools -->
+        <File Id="file_VBoxNetDHCP.exe" Name="VBoxNetDHCP.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxNetDHCP.exe"/>
+        <File Id="file_VBoxNetNAT.exe" Name="VBoxNetNAT.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxNetNAT.exe"/>
+<?if $(env.VBOX_WITH_EXTPACK) = "yes" ?>
+        <File Id="file_VBoxExtPackHelperApp.exe" Name="VBoxExtPackHelperApp.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxExtPackHelperApp.exe"/>
+<?endif ?>
+        <!-- VBox DLL files -->
+        <File Id="file_VBoxDD.dll" Name="VBoxDD.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxDD.dll" />
+        <File Id="file_VBoxDD2.dll" Name="VBoxDD2.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxDD2.dll" />
+        <File Id="file_VBoxDDU.dll" Name="VBoxDDU.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxDDU.dll" />
+        <File Id="file_VBoxRT.dll" Name="VBoxRT.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxRT.dll" />
+        <File Id="file_VBoxREM.dll" Name="VBoxREM.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxREM.dll" />
+<?if $(env.BUILD_TARGET_ARCH) = "x86" ?>
+        <File Id="file_VBoxREM32.dll" Name="VBoxREM32.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxREM32.dll" />
+        <File Id="file_VBoxREM64.dll" Name="VBoxREM64.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxREM64.dll" />
+<?endif ?>
+        <File Id="file_VBoxVMM.dll" Name="VBoxVMM.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxVMM.dll" />
+<?if $(env.VBOX_WITH_VRDP) = "yes" ?>
+        <File Id="file_VBoxVRDP.dll" Name="VBoxVRDP.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxVRDP.dll" />
+<?endif ?>
+        <File Id="file_VBoxSharedFolders.dll" Name="VBoxSharedFolders.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxSharedFolders.dll" />
+        <File Id="file_VBoxSharedClipboard.dll" Name="VBoxSharedClipboard.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxSharedClipboard.dll" />
+<?if $(env.VBOX_WITH_DRAG_AND_DROP)= "yes" ?>
+        <File Id="file_VBoxDragAndDropSvc.dll" Name="VBoxDragAndDropSvc.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxDragAndDropSvc.dll" />
+<?endif ?>
+<?if $(env.VBOX_WITH_GUEST_PROPS) = "yes" ?>
+        <File Id="file_VBoxGuestPropSvc.dll" Name="VBoxGuestPropSvc.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxGuestPropSvc.dll" />
+<?endif ?>
+<?if $(env.VBOX_WITH_GUEST_CONTROL) = "yes" ?>
+        <File Id="file_VBoxGuestControlSvc.dll" Name="VBoxGuestControlSvc.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxGuestControlSvc.dll" />
+<?endif ?>
+        <File Id="file_VBoxHostChannel.dll" Name="VBoxHostChannel.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxHostChannel.dll" />
+        <File Id="file_VBoxAuth.dll" Name="VBoxAuth.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxAuth.dll" />
+        <File Id="file_VBoxAuthSimple.dll" Name="VBoxAuthSimple.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxAuthSimple.dll" />
+
+        <!-- Include resource DLL (icons, ...) -->
+        <File Id="file_VBoxRes.dll" Name="VBoxRes.dll" DiskId="$(var.Property_DiskIdCommon)"
+              Source="$(env.PATH_OUT)\bin\VBoxRes.dll" />
+
+        <File Id="file_VMMGC.gc" Name="VMMGC.gc"
+              Source="$(env.PATH_OUT)\bin\VMMGC.gc" />
+        <File Id="file_VBoxDDGC.gc" Name="VBoxDDGC.gc"
+              Source="$(env.PATH_OUT)\bin\VBoxDDGC.gc" />
+        <File Id="file_VBoxDD2GC.gc" Name="VBoxDD2GC.gc"
+              Source="$(env.PATH_OUT)\bin\VBoxDD2GC.gc" />
+
+        <File Id="file_VMMR0.r0" Name="VMMR0.r0"
+              Source="$(env.PATH_OUT)\bin\VMMR0.r0" />
+        <File Id="file_VBoxDDR0.r0" Name="VBoxDDR0.r0"
+              Source="$(env.PATH_OUT)\bin\VBoxDDR0.r0" />
+        <File Id="file_VBoxDD2R0.r0" Name="VBoxDD2R0.r0"
+              Source="$(env.PATH_OUT)\bin\VBoxDD2R0.r0" />
+
+<?if $(env.VBOX_WITH_CROGL) = "yes" ?>
+        <File Id="file_VBoxTestOGL.exe" Name="VBoxTestOGL.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxTestOGL.exe" />
+<?endif ?>
+<?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
+        <!-- Qt frontend -->
+        <File Id="file_VirtualBox.exe" Name="VirtualBox.exe"
+              Source="$(env.PATH_OUT)\bin\VirtualBox.exe">
+        </File>
+        <File Id="file_QtCoreVBox4.dll" Name="QtCoreVBox4.dll"
+              Source="$(env.PATH_OUT)\bin\QtCoreVBox4.dll" />
+        <File Id="file_QtGuiVBox4.dll" Name="QtGuiVBox4.dll"
+              Source="$(env.PATH_OUT)\bin\QtGuiVBox4.dll" />
+        <File Id="file_QtNetworkVBox4.dll" Name="QtNetworkVBox4.dll"
+              Source="$(env.PATH_OUT)\bin\QtNetworkVBox4.dll" />
+<?endif ?>
+<?if $(env.VBOX_WITH_DEBUGGER_GUI) = "yes" ?>
+        <File Id="file_VBoxDbg.dll" Name="VBoxDbg.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxDbg.dll" />
+<?endif ?>
+<?if $(env.VBOX_GUI_USE_QGL) = "yes" ?>
+        <File Id="file_QtOpenGLVBox4.dll" Name="QtOpenGLVBox4.dll"
+              Source="$(env.PATH_OUT)\bin\QtOpenGLVBox4.dll" />
+<?endif?>
+
+<?if $(env.VBOX_VCC_TOOL_STEM) = "VCC100" ?>
+        <!-- MS C/C++ v10.0 Runtime DLL files -->
+        <File Id="file_msvcr100.dll" Name="msvcr100.dll"
+              Source="$(env.PATH_OUT)\bin\msvcr100.dll" />
+        <File Id="file_msvcp100.dll" Name="msvcp100.dll"
+              Source="$(env.PATH_OUT)\bin\msvcp100.dll" />
+<?endif?>
+<?if $(env.VBOX_VCC_TOOL_STEM) = "VCC110" ?>
+        <!-- MS C/C++ v11.0 Runtime DLL files -->
+        <File Id="file_msvcr110.dll" Name="msvcr110.dll"
+              Source="$(env.PATH_OUT)\bin\msvcr110.dll" />
+        <File Id="file_msvcp110.dll" Name="msvcp110.dll"
+              Source="$(env.PATH_OUT)\bin\msvcp110.dll" />
+<?endif?>
+
+        <!-- EFI firmware -->
+<?if $(env.VBOX_WITH_EFIFW_PACKING) = "yes" ?>
+        <File Id="file_VBoxEFI32.fd" Name="VBoxEFI32.fd" DiskId="$(var.Property_DiskIdCommon)"
+              Source="$(env.PATH_OUT)\bin\VBoxEFI32.fd" />
+        <File Id="file_VBoxEFI64.fd" Name="VBoxEFI64.fd" DiskId="$(var.Property_DiskIdCommon)"
+              Source="$(env.PATH_OUT)\bin\VBoxEFI64.fd" />
+<?endif?>
+        <!-- VBox guest additions -->
+<?if $(env.VBOX_WITH_ADDITIONS_PACKING) = "yes" ?>
+    <?if $(env.VBOX_WITH_COMBINED_PACKAGE) = "yes" ?>
+            <File Id="file_VBoxGuestAdditions.iso" Name="VBoxGuestAdditions.iso"
+                  Source="$(env.PATH_MULTIARCH_GUEST_ADDITIONS_ISO)\VBoxGuestAdditions.iso"
+                  DiskId="$(var.Property_DiskIdCommon)" />
+    <?else ?>
+            <File Id="file_VBoxGuestAdditions.iso" Name="VBoxGuestAdditions.iso"
+                  Source="$(env.PATH_OUT)\bin\additions\VBoxGuestAdditions.iso" />
+    <?endif ?>
+<?endif ?>
+        <!-- Include key for VBox version -->
+        <?include $(env.PATH_TARGET)\VBoxKey.wxi ?>
+
+    </Component> <!-- MainBinaries -->
+
+<?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
+    <!-- Qt accessible plugins -->
+    <Directory Id="dir_VBoxAppAccessible" Name="accessible">
+        <Component Id="cp_QtAccessible" Guid="12040EF9-D4A8-4FB2-A69C-CA2F5C354A45" Win64="$(var.Property_Win64)">
+            <File Id="file_qtaccessiblewidgets4.dll" Name="qtaccessiblewidgets4.dll"
+                  Source="$(env.PATH_OUT)\bin\accessible\qtaccessiblewidgets4.dll" />
+        </Component>
+    </Directory>
+<?endif?>
+
+<?if $(env.VBOX_WITH_CROGL) = "yes" ?>
+    <Component Id="cp_VBoxCROpenGL" Guid="874A1297-835A-491D-8A9D-7E723BC29EE7" Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxOGLhostcrutil.dll" Name="VBoxOGLhostcrutil.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxOGLhostcrutil.dll" />
+        <File Id="file_VBoxOGLhosterrorspu.dll" Name="VBoxOGLhosterrorspu.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxOGLhosterrorspu.dll" />
+        <File Id="file_VBoxOGLrenderspu.dll" Name="VBoxOGLrenderspu.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxOGLrenderspu.dll" />
+        <File Id="file_VBoxSharedCrOpenGL.dll" Name="VBoxSharedCrOpenGL.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxSharedCrOpenGL.dll" />
+    </Component>
+<?endif?>
+    <!-- SDL plugins -->
+    <Component Id="cp_VBoxSDLBinaries" Guid="F09D5FD9-E176-42B0-90A9-481BB18B0CB4"
+               Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxSDL.exe" Name="VBoxSDL.exe"
+              Source="$(env.PATH_OUT)\bin\VBoxSDL.exe" />
+        <File Id="file_SDL.dll" Name="SDL.dll"
+              Source="$(env.PATH_OUT)\bin\SDL.dll" />
+<?if $(env.VBOX_WITH_SECURELABEL) = "yes" ?>
+        <File Id="file_SDL_ttf.dll" Name="SDL_ttf.dll"
+              Source="$(env.PATH_OUT)\bin\SDL_ttf.dll" />
+<?endif?>
+    </Component> <!-- SDL plugins -->
+
+<?if $(env.VBOX_WITH_WEBSERVICES) = "yes" ?>
+    <!-- Webservice -->
+    <Component Id="cp_VBoxWebService" Guid="DD404F04-9874-43E9-AEE2-7762924D922E"
+               Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxWebSrv.exe" Name="VBoxWebSrv.exe"
+              Source="$(env.PATH_OUT)\bin\vboxwebsrv.exe" />
+    </Component>
+<?endif?>
+    <!-- C API (glue) bindings -->
+    <Component Id="cp_VBoxCAPI" Guid="097F7F53-7111-467F-8E0C-257D9926FDA0"
+               Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxCAPI.dll" Name="VBoxCAPI.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxCAPI.dll" />
+    </Component>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeApp.wxs b/src/VBox/Installer/win/VBoxMergeApp.wxs
new file mode 100644
index 0000000..d6bd3cc
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeApp.wxs
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <!-- Note: GUIDs in WiX *must* be uppercase! -->
+    <!-- Always include an upgrade ID or otherwise upgrade installation will not be possible. When doing
+         a major upgrade (more than just fixing a few files) change the product GUID. We always do a major
+         upgrade even for minor VBox updates. For that only change the product ID and the product version.
+         The upgrade code *never* must be changed! -->
+
+    <!-- Update / Upgrade policies:
+         Update Type    Package Code    Product Version     Product Code    Upgrade Code
+         Small update   change          don't change        don't change    don't change
+         Minor update   change          change              don't change    don't change
+         Major upgrade  change          change              change          don't change -->
+
+    <!-- Old product ID: <Product Id="B59FE77B-738F-4f1c-AB48-3104895AF676"
+         Old upgrade code of innotek: UpgradeCode="F5FFAEBF-97AE-4038-8F91-4DE719456127" -->
+
+    <Module Id="msm_VBoxApp"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="d255feb6-597d-4f49-a170-e34f289fa0d3"
+                 Keywords="Installer, Setup"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) installation package"
+                 Comments="$(env.VBOX_PRODUCT) installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="msm_VBoxApplicationFolder" FileSource=".">
+
+                <?include VBoxMergeApp.wxi ?>
+
+            </Directory> <!-- msm_VBoxApplicationFolder directory -->
+        </Directory> <!-- TARGETDIR -->
+
+        <!-- Custom actions -->
+        <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
+        <?include VBoxMergeAppCA.wxi ?>
+
+        <InstallExecuteSequence>
+            <?include VBoxMergeAppSeq.wxi ?>
+        </InstallExecuteSequence>
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergeAppCA.wxi b/src/VBox/Installer/win/VBoxMergeAppCA.wxi
new file mode 100644
index 0000000..4a620ea
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeAppCA.wxi
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeAppSeq.wxi b/src/VBox/Installer/win/VBoxMergeAppSeq.wxi
new file mode 100644
index 0000000..aafb38f
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeAppSeq.wxi
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeCOM32On64.wxi b/src/VBox/Installer/win/VBoxMergeCOM32On64.wxi
new file mode 100644
index 0000000..8edf6fe
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeCOM32On64.wxi
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+    <Directory Id="dir_VBoxCOM32On64X86" Name="x86">
+        <!-- The 32-bit client COM component (see also cp_MainCom below) -->
+        <Component Id="cp_MainCOM_x86" Guid="B600824E-4A25-2EB3-4B44-3D8CB7F9B92D" Win64="no">
+            <!-- Note: This file ID *must not* be changed because of our typelib template generation file! -->
+            <File Id="VBoxClient_x86" Name="VBoxClient-x86.dll"
+                  Source="$(env.PATH_OUT)\bin\x86\VBoxClient-x86.dll" KeyPath="yes"
+                  DiskId="$(var.Property_DiskIdCommon)">
+            </File>
+            <File Id="file_VBoxRT_x86" Name="VBoxRT-x86.dll"
+                  Source="$(env.PATH_OUT)\bin\x86\VBoxRT-x86.dll"
+                  DiskId="$(var.Property_DiskIdCommon)">
+            </File>
+            <?include $(env.PATH_TARGET)\VirtualBox_TypeLib_x86.wxi ?>
+    <?if $(env.VBOX_VCC_TOOL_STEM) = "VCC100" ?>
+            <!-- MS C/C++ v10.0 32 bit Runtime DLL files -->
+            <File Id="file_msvcr100_x86" Name="msvcr100.dll"
+                  Source="$(env.PATH_OUT)\bin\x86\msvcr100.dll"
+                  DiskId="$(var.Property_DiskIdCommon)" />
+            <File Id="file_msvcp100_x86" Name="msvcp100.dll"
+                  Source="$(env.PATH_OUT)\bin\x86\msvcp100.dll"
+                  DiskId="$(var.Property_DiskIdCommon)" />
+    <?endif?>
+    <?if $(env.VBOX_VCC_TOOL_STEM) = "VCC110" ?>
+            <!-- MS C/C++ v11.0 Runtime DLL files -->
+            <File Id="file_msvcr110_x86" Name="msvcr110.dll"
+                  Source="$(env.PATH_OUT)\bin\x86\msvcr110.dll"
+                  DiskId="$(var.Property_DiskIdCommon)" />
+            <File Id="file_msvcp110_x86" Name="msvcp110.dll"
+                  Source="$(env.PATH_OUT)\bin\x86\msvcp110.dll"
+                  DiskId="$(var.Property_DiskIdCommon)" />
+    <?endif?>
+        </Component>
+    </Directory>
+<?endif?>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeCOM32On64.wxs b/src/VBox/Installer/win/VBoxMergeCOM32On64.wxs
new file mode 100644
index 0000000..21848c7
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeCOM32On64.wxs
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Module Id="msm_VBoxCOM32On64"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="606c7efe-3f49-43a4-a4e4-d98688460647"
+                 Keywords="Installer, Setup"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) COM32On64 installation package"
+                 Comments="$(env.VBOX_PRODUCT) COM32On64 installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="MergeRedirectFolder" FileSource=".">
+
+                <?include VBoxMergeCOM32On64.wxi ?>
+
+            </Directory> <!-- MergeRedirectFolder -->
+        </Directory> <!-- TARGETDIR -->
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergeCOM32On64CA.wxi b/src/VBox/Installer/win/VBoxMergeCOM32On64CA.wxi
new file mode 100644
index 0000000..4a620ea
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeCOM32On64CA.wxi
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeCOM32On64Seq.wxi b/src/VBox/Installer/win/VBoxMergeCOM32On64Seq.wxi
new file mode 100644
index 0000000..4a620ea
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeCOM32On64Seq.wxi
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdp.wxi b/src/VBox/Installer/win/VBoxMergeNetAdp.wxi
new file mode 100644
index 0000000..3c700d9
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdp.wxi
@@ -0,0 +1,29 @@
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Component Id="cp_NetAdpDriver" Guid="7adf3e12-af3c-4d36-8bec-36d5064cf84f" Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxNetAdp.sys" Name="VBoxNetAdp.sys" KeyPath="yes"
+              Source="$(env.PATH_OUT)\bin\VBoxNetAdp.sys" Checksum="yes"/>
+        <File Id="file_VBoxNetAdp.inf" Name="VBoxNetAdp.inf"
+              Source="$(env.PATH_OUT)\bin\VBoxNetAdp.inf" />
+<?if $(env.VBOX_SIGNING_MODE) != none ?>
+        <File Id="file_VBoxNetAdp.cat" Name="VBoxNetAdp.cat"
+              Source="$(env.PATH_OUT)\bin\VBoxNetAdp.cat" />
+<?endif ?>
+    </Component>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdp.wxs b/src/VBox/Installer/win/VBoxMergeNetAdp.wxs
new file mode 100644
index 0000000..95e1183
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdp.wxs
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Module Id="msm_VBoxNetworkAdp"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="248b9371-ab62-48ee-8f23-270fb319bb46"
+                 Keywords="Installer, Setup"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) NetAdp installation package"
+                 Comments="$(env.VBOX_PRODUCT) NetAdp installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="msm_VBoxNetworkAdpFolder" FileSource=".">
+
+                <?include VBoxMergeNetAdp.wxi ?>
+
+            </Directory> <!-- msm_VBoxNetworkAdpFolder -->
+        </Directory> <!-- TARGETDIR -->
+
+        <!-- Custom actions -->
+        <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
+        <?include VBoxMergeNetAdpCA.wxi ?>
+
+        <InstallExecuteSequence>
+            <?include VBoxMergeNetAdpSeq.wxi ?>
+        </InstallExecuteSequence>
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi b/src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi
new file mode 100644
index 0000000..4990746
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <CustomAction Id="ca_CreateHostOnlyInterface" BinaryKey="VBoxInstallHelper" DllEntry="CreateHostOnlyInterface" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_CreateHostOnlyInterfaceArgs" Property="ca_CreateHostOnlyInterface" Value="[msm_VBoxNetworkAdpFolder]" Execute="immediate"/>
+    <CustomAction Id="ca_RemoveHostOnlyInterfaces" BinaryKey="VBoxInstallHelper" DllEntry="RemoveHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_StopHostOnlyInterfaces" BinaryKey="VBoxInstallHelper" DllEntry="StopHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_UpdateHostOnlyInterfacesArgs" Property="ca_UpdateHostOnlyInterfaces" Value="[msm_VBoxNetworkAdpFolder]" Execute="immediate"/>
+    <CustomAction Id="ca_UpdateHostOnlyInterfaces" BinaryKey="VBoxInstallHelper" DllEntry="UpdateHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi b/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi
new file mode 100644
index 0000000..851f3df
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <!-- Create host-only interfaces on first-time install -->
+    <Custom Action="ca_CreateHostOnlyInterfaceArgs" Before="ca_CreateHostOnlyInterface" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[NOT Installed]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkAdp=3]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_CreateHostOnlyInterface" Before="InstallFinalize" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[NOT Installed]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkAdp=3]]>
+        <?endif ?>
+    </Custom>
+    <!-- Don't remove the host-only interfaces on update, only on uninstall -->
+    <Custom Action="ca_RemoveHostOnlyInterfaces" Before="InstallFinalize" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
+    <!-- First stop the existing host-only interfaces on update ... -->
+    <Custom Action="ca_StopHostOnlyInterfaces" Before="ca_UpdateHostOnlyInterfaces" ><![CDATA[UPGRADINGPRODUCTCODE]]></Custom>
+    <!-- ... then do the actual driver update -->
+    <Custom Action="ca_UpdateHostOnlyInterfacesArgs" Before="ca_UpdateHostOnlyInterfaces" ><![CDATA[Installed AND UPGRADINGPRODUCTCODE AND (NOT REMOVE="ALL")]]></Custom>
+    <Custom Action="ca_UpdateHostOnlyInterfaces" Before="InstallFiles" ><![CDATA[Installed AND UPGRADINGPRODUCTCODE AND (NOT REMOVE="ALL")]]></Custom>
+<?endif ?>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetFlt.wxi b/src/VBox/Installer/win/VBoxMergeNetFlt.wxi
new file mode 100644
index 0000000..1462b8d
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetFlt.wxi
@@ -0,0 +1,35 @@
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <Component Id="cp_NetFltDriver" Guid="F0A02F6B-A349-42f8-A2EB-569DCAAAF846" Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxNetFlt.sys" Name="VBoxNetFlt.sys"   KeyPath="yes"
+              Source="$(env.PATH_OUT)\bin\VBoxNetFlt.sys" Checksum="yes"/>
+        <File Id="file_VBoxNetFltNobj.sys" Name="VBoxNetFltNobj.dll"
+              Source="$(env.PATH_OUT)\bin\VBoxNetFltNobj.dll" Checksum="yes"/>
+        <File Id="file_VBoxNetFltM.inf" Name="VBoxNetFltM.inf"
+              Source="$(env.PATH_OUT)\bin\VBoxNetFltM.inf" />
+        <File Id="file_VBoxNetFlt.inf" Name="VBoxNetFlt.inf"
+              Source="$(env.PATH_OUT)\bin\VBoxNetFlt.inf" />
+<?if $(env.VBOX_SIGNING_MODE) != none ?>
+        <File Id="file_VBoxNetFlt.cat" Name="VBoxNetFlt.cat"
+              Source="$(env.PATH_OUT)\bin\VBoxNetFlt.cat" />
+<?endif ?>
+    </Component>
+<?endif ?> <!-- VBOX_WITH_NETFLT -->
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetFlt.wxs b/src/VBox/Installer/win/VBoxMergeNetFlt.wxs
new file mode 100644
index 0000000..27b4d5e
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetFlt.wxs
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Module Id="msm_VBoxNetworkFlt"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="687c000b-c74b-4336-a449-dd8b3c6a060e"
+                 Keywords="Installer, Setup"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) NetFlt installation package"
+                 Comments="$(env.VBOX_PRODUCT) NetFlt installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="msm_VBoxNetworkFltFolder" FileSource=".">
+
+                <?include VBoxMergeNetFlt.wxi ?>
+
+            </Directory> <!-- msm_VBoxNetworkFltFolder -->
+        </Directory> <!-- TARGETDIR -->
+
+        <!-- Custom actions -->
+        <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
+        <?include VBoxMergeNetFltCA.wxi ?>
+
+        <InstallExecuteSequence>
+            <?include VBoxMergeNetFltSeq.wxi ?>
+        </InstallExecuteSequence>
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergeNetFltCA.wxi b/src/VBox/Installer/win/VBoxMergeNetFltCA.wxi
new file mode 100644
index 0000000..f383c1d
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetFltCA.wxi
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <CustomAction Id="ca_InstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="InstallNetFlt" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_InstallNetFltArgs" Property="ca_InstallNetFlt" Value="[msm_VBoxNetworkFltFolder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_RollbackInstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetFlt" Execute="rollback" Impersonate="no"/>
+    <CustomAction Id="ca_RollbackInstallNetFltArgs" Property="ca_RollbackInstallNetFlt" Value="[msm_VBoxNetworkFltFolder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_UninstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetFlt" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_UninstallNetFltArgs" Property="ca_UninstallNetFlt" Value="[msm_VBoxNetworkFltFolder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_RollbackUninstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="InstallNetFlt" Execute="rollback" Impersonate="no"/>
+    <CustomAction Id="ca_RollbackUninstallNetFltArgs" Property="ca_RollbackUninstallNetFlt" Value="[msm_VBoxNetworkFltFolder]" Execute="immediate"/>
+<?endif ?>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi b/src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi
new file mode 100644
index 0000000..58ee600
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <Custom Action="ca_RollbackInstallNetFltArgs" Before="ca_RollbackInstallNetFlt" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[UPGRADINGPRODUCTCODE OR (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=3]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_RollbackInstallNetFlt" Before="ca_InstallNetFlt" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[UPGRADINGPRODUCTCODE OR (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=3]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_InstallNetFltArgs" Before="ca_InstallNetFlt" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[UPGRADINGPRODUCTCODE OR (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=3]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_InstallNetFlt" Before="InstallFinalize" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[UPGRADINGPRODUCTCODE OR (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=3]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_RollbackUninstallNetFltArgs" Before="ca_RollbackUninstallNetFlt" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=2]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_RollbackUninstallNetFlt" Before="ca_UninstallNetFlt" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=2]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_UninstallNetFltArgs" Before="ca_UninstallNetFlt" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=2]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_UninstallNetFlt" After="InstallInitialize" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?else ?>
+            <![CDATA[&VBoxNetworkFlt=2]]>
+        <?endif ?>
+    </Custom>
+<?endif?> <!-- VBOX_WITH_NETFLT -->
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergePython.wxi b/src/VBox/Installer/win/VBoxMergePython.wxi
new file mode 100644
index 0000000..2e59bfd
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergePython.wxi
@@ -0,0 +1,41 @@
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
+    <!-- Python bindings -->
+    <Component Id="cp_VBoxPyInst" Guid="C9A40306-5102-11DE-A7BA-C3C555D89593" Win64="$(var.Property_Win64)">
+         <File Id="file_vboxapisetup.py" Name="vboxapisetup.py"
+               Source="$(env.PATH_OUT)\bin\sdk\installer\vboxapisetup.py"
+               DiskId="$(var.Property_DiskIdCommon)" />
+    </Component>
+    <Directory Id="dir_VBoxPythonSDKVBoxAPI" Name="vboxapi">
+        <Component Id="cp_VBoxPyMod" Guid="DF19CB76-5102-11DE-943B-13C755D89593" Win64="$(var.Property_Win64)">
+            <File Id="file___init__.py" Name="__init__.py"
+                  Source="$(env.PATH_OUT)\bin\sdk\installer\vboxapi\__init__.py"
+                  DiskId="$(var.Property_DiskIdCommon)" />
+            <File Id="file_VirtualBox_constants.py" Name="VirtualBox_constants.py"
+                  Source="$(env.PATH_OUT)\bin\sdk\installer\vboxapi\VirtualBox_constants.py"
+                  DiskId="$(var.Property_DiskIdCommon)" />
+        </Component>
+    </Directory>
+<?endif?>
+    <Component Id="cp_VBoxPythonBinding" KeyPath="yes"
+               Guid="293D7E11-78DA-4C31-AEED-AE2FE42F6881" Win64="$(var.Property_Win64)">
+        <Condition>VBOX_PYTHON_IS_INSTALLED</Condition>
+    </Component>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergePython.wxs b/src/VBox/Installer/win/VBoxMergePython.wxs
new file mode 100644
index 0000000..bb2e9a8
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergePython.wxs
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Module Id="msm_VBoxPython"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="0f4de366-a8f3-4842-a165-fb19251cde88"
+                 Keywords="Installer"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) Python bindings installation package"
+                 Comments="$(env.VBOX_PRODUCT) Python bindings installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="msm_VBoxPythonFolder" FileSource=".">
+
+                <?include VBoxMergePython.wxi ?>
+
+            </Directory> <!-- msm_VBoxPythonFolder -->
+        </Directory> <!-- TARGETDIR -->
+
+        <!-- Custom actions -->
+        <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
+        <?include VBoxMergePythonCA.wxi ?>
+
+        <InstallExecuteSequence>
+            <?include VBoxMergePythonSeq.wxi ?>
+        </InstallExecuteSequence>
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergePythonCA.wxi b/src/VBox/Installer/win/VBoxMergePythonCA.wxi
new file mode 100644
index 0000000..23130d2
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergePythonCA.wxi
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <CustomAction Id="ca_InstallPythonAPI" BinaryKey="VBoxInstallHelper" DllEntry="InstallPythonAPI" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_InstallPythonAPIArgs" Property="ca_InstallPythonAPI" Value="[msm_VBoxPythonFolder]" Execute="immediate"/>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergePythonSeq.wxi b/src/VBox/Installer/win/VBoxMergePythonSeq.wxi
new file mode 100644
index 0000000..0abf5de
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergePythonSeq.wxi
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Custom Action="ca_InstallPythonAPIArgs" Before="ca_InstallPythonAPI" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[1]]>
+        <?else ?>
+            <![CDATA[&VBoxPython=3]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_InstallPythonAPI" Before="InstallFinalize" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[1]]>
+        <?else ?>
+            <![CDATA[&VBoxPython=3]]>
+        <?endif ?>
+    </Custom>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeUSB.wxi b/src/VBox/Installer/win/VBoxMergeUSB.wxi
new file mode 100644
index 0000000..fad53c7
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeUSB.wxi
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Directory Id="dir_VBoxUSBFilter" Name="filter">
+        <Component Id="cp_USBFilterDriver" Guid="B7D782D2-96DF-4775-A0E1-A76CF7B04B65" Win64="$(var.Property_Win64)">
+            <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
+                            Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
+            <File Id="file_VBoxUSBMon.sys" Name="VBoxUSBMon.sys"
+                  Source="$(env.PATH_OUT)\bin\VBoxUSBMon.sys" />
+            <File Id="file_VBoxUSBMon.inf" Name="VBoxUSBMon.inf"
+                  Source="$(env.PATH_OUT)\bin\VBoxUSBMon.inf" />
+<?if $(env.VBOX_SIGNING_MODE) != none ?>
+            <File Id="file_VBoxUSBMon.cat" Name="VBoxUSBMon.cat"
+                  Source="$(env.PATH_OUT)\bin\VBoxUSBMon.cat" />
+<?endif ?>
+        </Component>
+    </Directory>
+
+    <Directory Id="dir_VBoxUSBDevice" Name="device">
+        <Component Id="cp_USBDeviceDriver" Guid="010FE46A-E358-43E2-8BDC-38BC8BEC82E0" Win64="$(var.Property_Win64)">
+            <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
+                            Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
+            <File Id="file_VBoxUSB.sys" Name="VBoxUSB.sys"
+                  Source="$(env.PATH_OUT)\bin\VBoxUSB.sys" />
+            <File Id="file_VBoxUSB.inf" Name="VBoxUSB.inf"
+                  Source="$(env.PATH_OUT)\bin\VBoxUSB.inf" />
+<?if $(env.VBOX_SIGNING_MODE) != none ?>
+            <File Id="file_VBoxUSB.cat" Name="VBoxUSB.cat"
+                  Source="$(env.PATH_OUT)\bin\VBoxUSB.cat" />
+<?endif ?>
+        </Component>
+    </Directory>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeUSB.wxs b/src/VBox/Installer/win/VBoxMergeUSB.wxs
new file mode 100644
index 0000000..1f9a3bc
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeUSB.wxs
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Module Id="msm_VBoxUSB"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="b8f1b6f4-2e92-40a6-b819-782e523b20ab"
+                 Keywords="Installer, Setup"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) USB drivers installation package"
+                 Comments="$(env.VBOX_PRODUCT) USB drivers installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="msm_VBoxUSBFolder" FileSource=".">
+
+                <?include VBoxMergeUSB.wxi ?>
+
+            </Directory> <!-- msm_VBoxUSBFolder -->
+        </Directory> <!-- TARGETDIR -->
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergeUSBCA.wxi b/src/VBox/Installer/win/VBoxMergeUSBCA.wxi
new file mode 100644
index 0000000..4a620ea
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeUSBCA.wxi
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeUSBSeq.wxi b/src/VBox/Installer/win/VBoxMergeUSBSeq.wxi
new file mode 100644
index 0000000..4a620ea
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeUSBSeq.wxi
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+</Include>
diff --git a/src/VBox/Installer/win/VirtualBox.wxs b/src/VBox/Installer/win/VirtualBox.wxs
index 176c1e1..13cb3c5 100644
--- a/src/VBox/Installer/win/VirtualBox.wxs
+++ b/src/VBox/Installer/win/VirtualBox.wxs
@@ -1,8 +1,8 @@
-<?xml version="1.0"?>
+<?xml version='1.0' encoding='windows-1252'?>
 <!--
     VirtualBox Windows Installation Script (WiX)
 
-    Copyright (C) 2006-2013 Oracle Corporation
+    Copyright (C) 2014 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -13,63 +13,26 @@
     hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 -->
 
-<?define Property_RegKey = "Software\$(env.VBOX_VENDOR_SHORT)\VirtualBox" ?>
-<?define Property_RegKeyInstall = "Software\$(env.VBOX_VENDOR_SHORT)\VirtualBox\Install" ?>
-<?define Property_Version = "$(env.VBOX_VERSION_STRING_RAW)" ?>
-<?define Property_VersionExt = "$(env.VBOX_VERSION_STRING)" ?>
-<?define Property_Upgrade = "yes" ?>
-
-<?if $(env.BUILD_TARGET_ARCH) = "amd64" ?>
-    <?define Property_ProgramFiles = "ProgramFiles64Folder" ?>
-    <?define Property_Platform     = "x64" ?>
-    <?define Property_Win64        = "yes" ?>
-
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
-    <?define Property_DriverLegacy = "no" ?>
-<?else ?>
-    <?define Property_DriverLegacy = "yes" ?>
-<?endif ?>
-
-<?else ?>
-    <?define Property_ProgramFiles = "ProgramFilesFolder" ?>
-    <?define Property_Platform     = "x86" ?>
-    <?define Property_Win64        = "no" ?>
-
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
-   <!-- Note: Settings this to 'no' breaks win2k installs (!) -->
-    <?define Property_DriverLegacy = "yes" ?>
-<?else ?>
-    <?define Property_DriverLegacy = "yes" ?>
-<?endif ?>
-
-<?endif ?>
-
-<!-- If we build a combined installer (32- and 64-bit in one installer), we
-     use two installer "disks": One for all platform-specific stuff and one which
-     contains all common (platform independent) stuff (like manuals, bitmaps etc). -->
-<?if $(env.VBOX_WITH_COMBINED_PACKAGE) = "yes" ?>
-    <?define Property_DiskIdCommon = "2" ?>
-<?else ?>
-    <?define Property_DiskIdCommon = "1" ?>
-<?endif ?>
-
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
      xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
 
-    <!-- Note: GUIDs in WiX *must* be uppercase! -->
-    <!-- Always include an upgrade ID or otherwise upgrade installation will not be possible. When doing
-         a major upgrade (more than just fixing a few files) change the product GUID. We always do a major
-         upgrade even for minor VBox updates. For that only change the product ID and the product version.
-         The upgrade code *never* must be changed! -->
-
-    <!-- Update / Upgrade policies:
-         Update Type    Package Code    Product Version     Product Code    Upgrade Code
-         Small update   change          don't change        don't change    don't change
-         Minor update   change          change              don't change    don't change
-         Major upgrade  change          change              change          don't change -->
+    <?include Properties.wxi ?>
 
-    <!-- Old product ID: <Product Id="B59FE77B-738F-4f1c-AB48-3104895AF676"
-         Old upgrade code of innotek: UpgradeCode="F5FFAEBF-97AE-4038-8F91-4DE719456127" -->
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+    <!-- The merge module file names -->
+    <?define Property_VBoxMergeApp = "$(env.VBOX_WIN_INST_MERGE_APP)" ?>
+    <?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+        <?define Property_VBoxMergeCOM32On64 = "$(env.VBOX_WIN_INST_MERGE_COM32ON64)" ?>
+    <?endif ?>
+    <?define Property_VBoxMergeUSB = "$(env.VBOX_WIN_INST_MERGE_USB)" ?>
+    <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+        <?define Property_VBoxMergeNetworkFlt = "$(env.VBOX_WIN_INST_MERGE_NETFLT)" ?>
+    <?endif ?>
+    <?define Property_VBoxMergeNetworkAdp = "$(env.VBOX_WIN_INST_MERGE_NETADP)" ?>
+    <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
+        <?define Property_VBoxMergePython = "$(env.VBOX_WIN_INST_MERGE_PYTHON)" ?>
+    <?endif ?>
+<?endif ?>
 
     <Product Id="*"
              UpgradeCode="C4BAD770-BFE8-4D2C-A592-693028A7215B"
@@ -79,787 +42,438 @@
              Version="$(var.Property_Version)"
              Manufacturer="$(env.VBOX_VENDOR)">
 
-        <Package Id="*" Keywords="Installer"
-                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) installation package"
-                 Comments="$(env.VBOX_PRODUCT) installation package"
-                 Manufacturer="$(env.VBOX_VENDOR)"
-                 InstallerVersion="200"
-                 Compressed="yes"
-                 InstallPrivileges="elevated"
-                 Platform="$(var.Property_Platform)"/>
-
-        <!-- *************************** Upgrade packages only ******************************* -->
-        <!-- Minimum and Maximum specify the range of versions we are supposed to update with this upgrade.
-             IncludeMaximum and IncludeMinimum specify whether the bound value is actually included in the range or not
-             (IncludeMaximum = yes meaning to find versions below or equal to the version specified in Maximum while
-             IncludeMaximum = no only finds those below the Maximum).
-             OnlyDetect tells the installer not to remove the previous product. This is useful as long as we
-             only change files in the package. -->
-
-        <Upgrade Id="C4BAD770-BFE8-4D2C-A592-693028A7215B"> <!-- Upgrade of Sun xVM VirtualBox >= v1.6.0 -->
-
-            <!-- Upgrade is flagged if current-install is newer than or equal to package - TODO: should make a dialog appear asking user to confirm downgrade.  -->
-            <!--- Setting "OnlyDetect" to "no" makes the installer uninstall an already newer installed version. -->
-            <UpgradeVersion Property="NEWERVERSIONDETECTED" Minimum="$(var.Property_Version)" OnlyDetect="no" />
-
-            <!-- Flag is set if the install will trigger an upgrade of an existing install -->
-            <UpgradeVersion Property="PREVIOUSVERSIONSINSTALLED" Minimum="1.0.0.0" Maximum="$(var.Property_Version)" IncludeMaximum="yes" />
-
-        </Upgrade>
-
-        <!-- The product's icon table. -->
-        <Icon Id="IconVirtualBox" SourceFile="$(env.VBOX_WINDOWS_ICON_FILE)" />
-
-        <!-- Global properties. -->
-        <Property Id="ARPPRODUCTICON">IconVirtualBox</Property>
-        <Property Id="ARPURLINFOABOUT">http://www.virtualbox.org</Property>
-        <Property Id="ARPURLUPDATEINFO">http://www.virtualbox.org</Property>
-        <Property Id="INSTALLDESKTOPSHORTCUT" Value="1"></Property>
-        <Property Id="INSTALLQUICKLAUNCHSHORTCUT" Value="1"></Property>
-        <Property Id="REGISTERFILEEXTENSIONS" Value="1"></Property>
-        <Property Id="STARTVBOX" Value="1"></Property>
-
-        <!-- Install the product for all users on the system -->
-        <Property Id="ALLUSERS"><![CDATA[1]]></Property>
-
-        <!-- Make sure installation will not start on anything other but the NT family -->
+    <Package Id="*"
+             Keywords="Installer"
+             Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) installation package"
+             Comments="$(env.VBOX_PRODUCT) installation package"
+             Compressed="yes"
+             Manufacturer="$(env.VBOX_VENDOR)"
+             InstallerVersion="200"
+             InstallPrivileges="elevated"
+             Platform="$(var.Property_Platform)"/>
+
+    <!-- Global properties -->
+    <Property Id="ARPPRODUCTICON">IconVirtualBox</Property>
+    <Property Id="ARPURLINFOABOUT">http://www.virtualbox.org</Property>
+    <Property Id="ARPURLUPDATEINFO">http://www.virtualbox.org</Property>
+
+    <!-- Install the product for all users on the system -->
+    <Property Id="ALLUSERS"><![CDATA[1]]></Property>
+
+    <!-- Force overwriting all files and re-create shortcuts to guarantee a working environment -->
+    <Property Id='REINSTALLMODE' Value='amus'/>
+
+    <!-- VirtualBox properties -->
+    <Property Id="VBOX_INSTALLDESKTOPSHORTCUT" Value="1" />
+    <Property Id="VBOX_INSTALLQUICKLAUNCHSHORTCUT" Value="1" />
+    <Property Id="VBOX_REGISTERFILEEXTENSIONS" Value="1" />
+    <Property Id="VBOX_STARTVBOX" Value="1" />
+
+    <!-- Make sure installation will not start on anything other but the NT family -->
 <?if $(env.BUILD_TARGET_ARCH) = "amd64" ?>
-        <Condition Message="!(loc.Only64Bit)">
-            VersionNT64
-        </Condition>
+    <Condition Message="!(loc.Only64Bit)">
+        VersionNT64
+    </Condition>
 <?else ?>
-        <Condition Message="!(loc.Only32Bit)">
-            NOT VersionNT64
-        </Condition>
+    <Condition Message="!(loc.Only32Bit)">
+        NOT VersionNT64
+    </Condition>
 
-        <Condition Message="!(loc.WrongOS)">
-            NOT VersionNT=500 AND NOT Version9X AND NOT VersionNT64
-        </Condition>
+    <Condition Message="!(loc.WrongOS)">
+        NOT VersionNT=500 AND NOT Version9X AND NOT VersionNT64
+    </Condition>
 
 <?endif ?>
 
-        <Condition Message="!(loc.NeedAdmin)">
-            Privileged
-        </Condition>
-
-        <!-- Force overwriting all files and re-create shortcuts to guarantee a working environment -->
-        <Property Id='REINSTALLMODE' Value='amus'/>
-
-        <!-- Custom actions -->
-
-        <!-- Figure out where a previous installation was, if any -->
-<?if $(env.BUILD_TARGET_ARCH) = "amd64" ?>
-        <CustomAction Id="ca_OriginalTargetDir" Execute="firstSequence" Property="INSTALLDIR" Value="[ProgramFiles64Folder]\$(env.VBOX_VENDOR_SHORT)\VirtualBox" />
-
-        <Property Id="EXISTINGINSTALLDIR" Secure="yes">
-            <RegistrySearch Id="RegistryGetInstallPath" Root="HKLM" Key="$(var.Property_RegKey)" Name="InstallDir" Type="raw" Win64="$(var.Property_Win64)"/>
-        </Property>
-        <CustomAction Id="ca_DefaultTargetDir" Execute="firstSequence" Property="INSTALLDIR" Value="[EXISTINGINSTALLDIR]" />
-<?else ?>
-        <CustomAction Id="ca_OriginalTargetDir" Execute="firstSequence" Property="INSTALLDIR" Value="[ProgramFilesFolder]\$(env.VBOX_VENDOR_SHORT)\VirtualBox" />
-
-        <Property Id="EXISTINGINSTALLDIR" Secure="yes">
-            <RegistrySearch Id="RegistryGetInstallPath" Root="HKLM" Key="$(var.Property_RegKey)" Name="InstallDir" Type="raw" Win64="$(var.Property_Win64)"/>
-        </Property>
-        <CustomAction Id="ca_DefaultTargetDir" Execute="firstSequence" Property="INSTALLDIR" Value="[EXISTINGINSTALLDIR]" />
-<?endif ?>
-
-        <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
-        <CustomAction Id="ca_CheckSerial" BinaryKey="VBoxInstallHelper" DllEntry="CheckSerial" Impersonate="no"/>
-
-        <CustomAction Id="ca_InstallPythonAPI" BinaryKey="VBoxInstallHelper" DllEntry="InstallPythonAPI" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_InstallPythonAPIArgs" Property="ca_InstallPythonAPI" Value="[INSTALLDIR]" Execute="immediate"/>
-
-        <CustomAction Id="ca_InstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="InstallBranding" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_InstallBrandingArgs" Property="ca_InstallBranding" Value="[INSTALLDIR]" Execute="immediate"/>
-
-        <CustomAction Id="ca_UninstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="UninstallBranding" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_UninstallBrandingArgs" Property="ca_UninstallBranding" Value="[INSTALLDIR]" Execute="immediate"/>
-
-        <CustomAction Id="ca_UninstallTAPInstances" BinaryKey="VBoxInstallHelper"
-                      DllEntry="UninstallTAPInstances" Execute="deferred" Return="check" Impersonate="no"/>
+    <Condition Message="!(loc.NeedAdmin)">
+        Privileged
+    </Condition>
 
-<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
-        <CustomAction Id="ca_CreateHostOnlyInterface" BinaryKey="VBoxInstallHelper"  DllEntry="CreateHostOnlyInterface" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_CreateHostOnlyInterfaceArgs" Property="ca_CreateHostOnlyInterface" Value="[INSTALLDIR]" Execute="immediate"/>
+    <!-- Detect old innotek installation -->
+    <!-- Force a manual uninstall of an already installed innotek VirtualBox version first -->
+    <Property Id="VBOXINNOTEK">
+        <RegistrySearch Id="RegSearchInnotekVersion" Root="HKLM" Key="SOFTWARE\Innotek\VirtualBox" Name="Version" Type="raw" Win64="$(var.Property_Win64)"/>
+    </Property>
+    <Condition Message="!(loc.InnotekFound)">
+        NOT VBOXINNOTEK
+    </Condition>
 
-        <CustomAction Id="ca_RemoveHostOnlyInterfaces" BinaryKey="VBoxInstallHelper"  DllEntry="RemoveHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_StopHostOnlyInterfaces" BinaryKey="VBoxInstallHelper"  DllEntry="StopHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
+    <!-- *************************** Upgrade packages only ******************************* -->
+    <!-- Minimum and Maximum specify the range of versions we are supposed to update with this upgrade.
+         IncludeMaximum and IncludeMinimum specify whether the bound value is actually included in the range or not
+         (IncludeMaximum = yes meaning to find versions below or equal to the version specified in Maximum while
+         IncludeMaximum = no only finds those below the Maximum).
+         OnlyDetect tells the installer not to remove the previous product. This is useful as long as we
+         only change files in the package -->
 
-        <CustomAction Id="ca_UpdateHostOnlyInterfaces" BinaryKey="VBoxInstallHelper"  DllEntry="UpdateHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_UpdateHostOnlyInterfacesArgs" Property="ca_UpdateHostOnlyInterfaces" Value="[INSTALLDIR]" Execute="immediate"/>
+    <Upgrade Id="C4BAD770-BFE8-4D2C-A592-693028A7215B"> <!-- Upgrade of Sun xVM VirtualBox >= v1.6.0 -->
 
-        <CustomAction Id="ca_InstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="InstallNetFlt" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_InstallNetFltArgs" Property="ca_InstallNetFlt" Value="[INSTALLDIR]" Execute="immediate"/>
+        <!-- Upgrade is flagged if current-install is newer than or equal to package - TODO: should make a dialog appear asking user to confirm downgrade -->
+        <!-- Setting "OnlyDetect" to "no" makes the installer uninstall an already newer installed version -->
+        <UpgradeVersion Property="NEWERVERSIONDETECTED" Minimum="$(var.Property_Version)" OnlyDetect="no" />
 
-        <CustomAction Id="ca_RollbackInstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetFlt" Execute="rollback" Impersonate="no"/>
-        <CustomAction Id="ca_RollbackInstallNetFltArgs" Property="ca_RollbackInstallNetFlt" Value="[INSTALLDIR]" Execute="immediate"/>
+        <!-- Flag is set if the install will trigger an upgrade of an existing install -->
+        <UpgradeVersion Property="PREVIOUSVERSIONSINSTALLED" Minimum="1.0.0.0" Maximum="$(var.Property_Version)" IncludeMaximum="yes" />
 
-        <CustomAction Id="ca_UninstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetFlt" Execute="deferred" Return="check" Impersonate="no"/>
-        <CustomAction Id="ca_UninstallNetFltArgs" Property="ca_UninstallNetFlt" Value="[INSTALLDIR]" Execute="immediate"/>
+    </Upgrade>
 
-        <CustomAction Id="ca_RollbackUninstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="InstallNetFlt" Execute="rollback" Impersonate="no"/>
-        <CustomAction Id="ca_RollbackUninstallNetFltArgs" Property="ca_RollbackUninstallNetFlt" Value="[INSTALLDIR]" Execute="immediate"/>
-<?endif ?>
+    <!-- The product's icon table -->
+    <Icon Id="IconVirtualBox" SourceFile="$(env.VBOX_WINDOWS_ICON_FILE)" />
 
-        <CustomAction Id="ca_StartVBox" FileKey="file_VirtualBox.exe" ExeCommand="" Return="asyncNoWait" Impersonate="yes" />
-
-        <!-- Detect old Sun installation -->
-        <!-- Force a manual uninstall of an already installed Sun VirtualBox version first -->
-        <!--<Property Id="VBOXSUN">
-            <RegistrySearch Id="RegSearchSunVersion" Root="HKLM" Key="SOFTWARE\Sun\VirtualBox" Name="Version" Type="raw" Win64="$(var.Property_Win64)"/>
-        </Property>
-        <Condition Message="!(loc.SunFound)">
-            NOT VBOXSUN
-        </Condition>-->
-
-        <!-- Detect old innotek installation -->
-        <!-- Force a manual uninstall of an already installed innotek VirtualBox version first -->
-        <Property Id="VBOXINNOTEK">
-            <RegistrySearch Id="RegSearchInnotekVersion" Root="HKLM" Key="SOFTWARE\Innotek\VirtualBox" Name="Version" Type="raw" Win64="$(var.Property_Win64)"/>
-        </Property>
-        <Condition Message="!(loc.InnotekFound)">
-            NOT VBOXINNOTEK
-        </Condition>
-
-        <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
-<?if $(env.VBOX_WITH_COMBINED_PACKAGE) = "yes" ?>
+    <!-- The media/binary IDs -->
+    <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "no" ?>
+    <?if $(env.VBOX_WITH_COMBINED_PACKAGE) = "yes" ?>
         <Media Id="2" Cabinet="common.cab" EmbedCab="no" CompressionLevel="high" />
+    <?endif ?>
 <?endif ?>
+    <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
 
-        <!-- Here comes the file/directory list. -->
-        <Directory Id="TARGETDIR" Name="SourceDir">
-           <Directory Id="$(var.Property_ProgramFiles)" Name="PFiles">
-                <Directory Id="INSTALLDIR" Name="$(env.VBOX_PRODUCT)">
-
-<?if $(env.VBOX_WITH_DOCS_PACKING) = "yes" ?>
-                    <Directory Id="dir_Documents" Name="doc">
-                        <!-- The documentation is a separate component. This allows to split the install process
-                             into pieces if ever necessary. Maintenance is easier, too. The following component
-                             will be installed in the "doc" folder. -->
-                        <Component Id="cp_Docs" Guid="40BD12C5-89A8-4B81-8A5E-5EEE2C2763C4">
-                            <?include $(env.PATH_TARGET)\Files_Doc.wxi ?>
-                        </Component>
-                    </Directory>
+    <!-- Custom actions -->
+
+    <!-- Figure out where a previous installation was, if any -->
+<?if $(env.BUILD_TARGET_ARCH) = "amd64" ?>
+    <CustomAction Id="ca_OriginalTargetDir" Execute="firstSequence" Property="INSTALLDIR"
+                  Value="[ProgramFiles64Folder]\$(env.VBOX_VENDOR_SHORT)\VirtualBox" />
+
+    <Property Id="EXISTINGINSTALLDIR" Secure="yes">
+        <RegistrySearch Id="RegistryGetInstallPath" Root="HKLM" Key="$(var.Property_RegKey)" Name="InstallDir"
+                        Type="raw" Win64="$(var.Property_Win64)"/>
+    </Property>
+    <CustomAction Id="ca_DefaultTargetDir" Execute="firstSequence" Property="INSTALLDIR" Value="[EXISTINGINSTALLDIR]" />
+<?else ?>
+    <CustomAction Id="ca_OriginalTargetDir" Execute="firstSequence" Property="INSTALLDIR"
+                  Value="[ProgramFilesFolder]\$(env.VBOX_VENDOR_SHORT)\VirtualBox" />
+
+    <Property Id="EXISTINGINSTALLDIR" Secure="yes">
+        <RegistrySearch Id="RegistryGetInstallPath" Root="HKLM" Key="$(var.Property_RegKey)" Name="InstallDir"
+                        Type="raw" Win64="$(var.Property_Win64)"/>
+    </Property>
+    <CustomAction Id="ca_DefaultTargetDir" Execute="firstSequence" Property="INSTALLDIR" Value="[EXISTINGINSTALLDIR]" />
 <?endif ?>
-                    <!-- Device driver directory -->
-                    <Directory Id="dir_Drivers" Name="drivers">
-                        <Directory Id="dir_VBoxDrv" Name="vboxdrv">
-                            <Component Id="cp_VBoxDrv" Guid="D3E2F2BB-569F-46A2-836C-BDF30FF1EDF8" Win64="$(var.Property_Win64)">
-                                <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
-                                                Legacy="$(var.Property_DriverLegacy)" Sequence="2" PlugAndPlayPrompt="no"/>
-                                <File Id="file_VBoxDrv.sys" Name="VBoxDrv.sys"   KeyPath="yes"
-                                      Source="$(env.PATH_OUT)\bin\VBoxDrv.sys"/>
-                                <File Id="file_VBoxDrv.inf" Name="VBoxDrv.inf"
-                                      Source="$(env.PATH_OUT)\bin\VBoxDrv.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
-                                <File Id="file_VBoxDrv.cat" Name="VBoxDrv.cat"
-                                      Source="$(env.PATH_OUT)\bin\VBoxDrv.cat" />
+    <CustomAction Id="ca_UninstallTAPInstances" BinaryKey="VBoxInstallHelper"
+                  DllEntry="UninstallTAPInstances" Execute="deferred" Return="check" Impersonate="no"/>
+
+    <!-- Detect old Sun installation -->
+    <!-- Force a manual uninstall of an already installed Sun VirtualBox version first -->
+    <!--<Property Id="VBOXSUN">
+        <RegistrySearch Id="RegSearchSunVersion" Root="HKLM" Key="SOFTWARE\Sun\VirtualBox" Name="Version" Type="raw" Win64="$(var.Property_Win64)"/>
+    </Property>
+    <Condition Message="!(loc.SunFound)">
+        NOT VBOXSUN
+    </Condition>-->
+
+    <CustomAction Id="ca_StartVBox" Directory="INSTALLDIR" ExeCommand="[INSTALLDIR]\VirtualBox.exe" Return="asyncNoWait" Impersonate="yes" />
+    <CustomAction Id="ca_CheckSerial" BinaryKey="VBoxInstallHelper" DllEntry="CheckSerial" Impersonate="no"/>
+
+    <CustomAction Id="ca_InstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="InstallBranding" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_InstallBrandingArgs" Property="ca_InstallBranding" Value="[INSTALLDIR]" Execute="immediate"/>
+
+    <CustomAction Id="ca_UninstallBranding" BinaryKey="VBoxInstallHelper" DllEntry="UninstallBranding" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_UninstallBrandingArgs" Property="ca_UninstallBranding" Value="[INSTALLDIR]" Execute="immediate"/>
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "no" ?>
+    <?include VBoxMergeAppCA.wxi ?>
+    <?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+        <?include VBoxMergeCOM32On64CA.wxi ?>
+    <?endif ?>
+    <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+        <?include VBoxMergeNetFltCA.wxi ?>
+    <?endif ?>
+    <?include VBoxMergeNetAdpCA.wxi ?>
+    <?include VBoxMergeUSBCA.wxi ?>
+    <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
+        <?include VBoxMergePythonCA.wxi ?>
+    <?endif ?>
 <?endif ?>
-                            </Component>
-                        </Directory>
 
-                        <Directory Id="dir_USB" Name="USB">
-                            <Directory Id="dir_USBFilter" Name="filter">
-                                <Component Id="cp_USBFilterDriver" Guid="B7D782D2-96DF-4775-A0E1-A76CF7B04B65" Win64="$(var.Property_Win64)">
-                                    <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
-                                                    Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
-                                    <File Id="file_VBoxUSBMon.sys" Name="VBoxUSBMon.sys"
-                                          Source="$(env.PATH_OUT)\bin\VBoxUSBMon.sys" />
-                                    <File Id="file_VBoxUSBMon.inf" Name="VBoxUSBMon.inf"
-                                          Source="$(env.PATH_OUT)\bin\VBoxUSBMon.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
-                                    <File Id="file_VBoxUSBMon.cat" Name="VBoxUSBMon.cat"
-                                          Source="$(env.PATH_OUT)\bin\VBoxUSBMon.cat" />
+    <Directory Id="TARGETDIR" Name="SourceDir">
+        <Directory Id="$(var.Property_ProgramFiles)" Name="PFiles">
+            <Directory Id="INSTALLDIR" Name="$(env.VBOX_PRODUCT)">
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                <Merge Id="msm_VBoxApp" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergeApp)" DiskId="1" />
+    <?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+                <Merge Id="msm_VBoxCOM32On64" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergeCOM32On64)" DiskId="1" />
+    <?endif ?>
+<?else ?>
+                <Directory Id="msm_VBoxApplicationFolder" FileSource=".">
+                    <?include VBoxMergeApp.wxi ?>
+    <?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+                    <?include VBoxMergeCOM32On64.wxi ?>
+    <?endif ?>
+                </Directory>
 <?endif ?>
-                                </Component>
-                            </Directory>
-
-                            <Directory Id="dir_USBDevice" Name="device">
-                                <Component Id="cp_USBDeviceDriver" Guid="010FE46A-E358-43E2-8BDC-38BC8BEC82E0" Win64="$(var.Property_Win64)">
-                                    <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
-                                                    Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
-                                    <File Id="file_VBoxUSB.sys" Name="VBoxUSB.sys"
-                                          Source="$(env.PATH_OUT)\bin\VBoxUSB.sys" />
-                                    <File Id="file_VBoxUSB.inf" Name="VBoxUSB.inf"
-                                          Source="$(env.PATH_OUT)\bin\VBoxUSB.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
-                                    <File Id="file_VBoxUSB.cat" Name="VBoxUSB.cat"
-                                          Source="$(env.PATH_OUT)\bin\VBoxUSB.cat" />
+                <Directory Id="dir_Drivers" Name="drivers">
+                    <Directory Id="dir_USB" Name="USB">
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                        <Merge Id="msm_VBoxUSB" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergeUSB)" DiskId="1" />
+<?else ?>
+                        <Directory Id="msm_VBoxUSBFolder" FileSource=".">
+                            <?include VBoxMergeUSB.wxi ?>
+                        </Directory>
 <?endif ?>
-                                </Component>
+                    </Directory>
+                    <Directory Id="dir_Network" Name="network">
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+                        <Directory Id="dir_NetFlt" Name="netflt">
+    <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                            <Merge Id="msm_VBoxNetworkFlt" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergeNetworkFlt)" DiskId="1" />
+    <?else ?>
+                            <Directory Id="msm_VBoxNetworkFltFolder" FileSource=".">
+                                <?include VBoxMergeNetFlt.wxi ?>
                             </Directory>
+    <?endif ?>
                         </Directory>
-
-<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
-                        <Directory Id="dir_Network" Name="network">
-                            <Directory Id="dir_NetFlt" Name="netflt">
-                                <Component Id="cp_NetFltDriver" Guid="F0A02F6B-A349-42f8-A2EB-569DCAAAF846" Win64="$(var.Property_Win64)">
-                                    <File Id="file_VBoxNetFlt.sys" Name="VBoxNetFlt.sys"   KeyPath="yes"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetFlt.sys" Checksum="yes"/>
-                                    <File Id="file_VBoxNetFltNobj.sys" Name="VBoxNetFltNobj.dll"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetFltNobj.dll" Checksum="yes"/>
-                                    <File Id="file_VBoxNetFltM.inf" Name="VBoxNetFltM.inf"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetFltM.inf" />
-                                    <File Id="file_VBoxNetFlt.inf" Name="VBoxNetFlt.inf"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetFlt.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
-                                    <File Id="file_VBoxNetFlt.cat" Name="VBoxNetFlt.cat"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetFlt.cat" />
 <?endif ?>
-                                </Component>
+                        <Directory Id="dir_NetAdp" Name="netadp">
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                            <Merge Id="msm_VBoxNetworkAdp" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergeNetworkAdp)" DiskId="1" />
+<?else ?>
+                            <Directory Id="msm_VBoxNetworkAdpFolder" FileSource=".">
+                                <?include VBoxMergeNetAdp.wxi ?>
                             </Directory>
-
-                            <Directory Id="dir_NetAdp" Name="netadp">
-                                <Component Id="cp_NetAdpDriver" Guid="7adf3e12-af3c-4d36-8bec-36d5064cf84f" Win64="$(var.Property_Win64)">
-                                    <File Id="file_VBoxNetAdp.sys" Name="VBoxNetAdp.sys" KeyPath="yes"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetAdp.sys" Checksum="yes"/>
-                                    <File Id="file_VBoxNetAdp.inf" Name="VBoxNetAdp.inf"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetAdp.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
-                                    <File Id="file_VBoxNetAdp.cat" Name="VBoxNetAdp.cat"
-                                          Source="$(env.PATH_OUT)\bin\VBoxNetAdp.cat" />
 <?endif ?>
-                                </Component>
-                            </Directory>
                         </Directory>
-<?endif ?>
-                    </Directory> <!-- Directory "drivers" -->
-
-
-                    <!-- National Language Support directory -->
-                    <Directory Id="dir_NLS" Name="nls">
-                        <Component Id="cp_NLS" Guid="D63517D7-1CF3-4D06-B3EE-C561E323069B" Win64="$(var.Property_Win64)">
-                            <!-- Include the autogenerated NLS file list -->
-                            <?include $(env.PATH_TARGET)\VBoxGuiNLS.wxi ?>
-                        </Component>
                     </Directory>
-
-<?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
-                    <!-- The 32-bit client COM component (see also cp_MainCom below). -->
-                    <Component Id="cp_MainCOM_x86" Guid="B600824E-4A25-2EB3-4B44-3D8CB7F9B92D" Win64="no">
-                        <File Id="VBoxClient_x86" Name="VBoxClient-x86.dll"
-                            Source="$(env.PATH_OUT)\bin\VBoxClient-x86.dll" KeyPath="yes">
-                        </File>
-                        <?include $(env.PATH_TARGET)\VirtualBox_TypeLib_x86.wxi ?>
-                    </Component>
-<?endif?>
-
-                    <!-- COM components have a separate entry mainly because of the KeyPath attribute (that hints the
-                         TypeLib element where to take the TLB resource from) may appear only once per Component. -->
-                    <Component Id="cp_MainCOM" Guid="CD4A3C6C-C2D5-428D-90A1-B6DA3D0777D6" Win64="$(var.Property_Win64)">
-
-                        <!-- File ID *must not* be changed because of our typelib template generation file! -->
-                        <File Id="VBoxSVC" Name="VBoxSVC.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxSVC.exe">
-                        </File>
-
-                        <!-- We set KeyPath on this file to instruct TypeLib to read the TLB resource from it
-                             and create appropriate Interface registry entries. Note that the same TLB is present
-                             in VBoxSVC.exe - it's just a matter of choice which one to use -->
-                        <!-- File ID *must not* be changed because of our typelib template generation file! -->
-                        <File Id="VBoxC" Name="VBoxC.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxC.dll" KeyPath="yes">
-                        </File>
-
-                        <!-- Include the autogenerated TypeLib block -->
-                        <?include $(env.PATH_TARGET)\VirtualBox_TypeLib.wxi ?>
-
-                    </Component>
-
-                    <!--
-
-                    <Component Id="cp_StartMenuShortcut" Guid="1C137D24-E599-47BD-98D0-2F62F202A8EA" Win64="$(var.Property_Win64)">
-                        <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)" Type="string"
-                                       Value="installed" KeyPath="yes" />
-                        <Shortcut Id="ShortcutStartMenuVBox" Directory="ProgramMenuDir"
-                                  Name="VirtualBox" WorkingDirectory="INSTALLDIR" Advertise="no" Target="VirtualBox.exe" />
-                        <RemoveFolder Id="ShortcutStartMenuVBoxRemove" On="uninstall" />
-                    </Component>-->
-
-                    <!---->
-
-                    <Component Id="cp_RegisterExtensions" Guid="FEB8943E-5D60-4E2D-846F-458207019D40" Win64="$(var.Property_Win64)">
-                        <Condition>REGISTERFILEEXTENSIONS</Condition>
-                        <!-- Register file extensions. Note: Extension Id's *must not* be changed! These specify the actual
-                             file extension to handle. Also, here would be the place to add more fancy DDE stuff later.
-                             Important: The IDs in "IconIndex" *must* be matching "Resources\resource.h". -->
-                        <ProgId Id="progId_VirtualBox.Shell.vbox" Description="VirtualBox Machine Definition" Icon="file_VBoxRes.dll" IconIndex="-201">
-                            <Extension Id="vbox" ContentType="application/x-virtualbox-vbox">
-                                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
-                            </Extension>
-                        </ProgId>
-                        <ProgId Id="progId_VirtualBox.Shell.vbox-extpack" Description="VirtualBox Extension Pack" Icon="file_VBoxRes.dll" IconIndex="-202">
-                            <Extension Id="vbox-extpack" ContentType="application/x-virtualbox-vbox-extpack">
-                                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
-                            </Extension>
-                        </ProgId>
-                        <ProgId Id="progId_VirtualBox.Shell.ovf" Description="Open Virtualization Format" Icon="file_VBoxRes.dll" IconIndex="-301">
-                            <Extension Id="ovf" ContentType="application/x-virtualbox-ovf">
-                                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
-                            </Extension>
-                        </ProgId>
-                        <ProgId Id="progId_VirtualBox.Shell.ova" Description="Open Virtualization Format Archive" Icon="file_VBoxRes.dll" IconIndex="-302">
-                            <Extension Id="ova" ContentType="application/x-virtualbox-ova">
-                                <Verb Id="open" Command="Open" TargetFile="file_VirtualBox.exe" Argument=""%1"" />
-                            </Extension>
-                        </ProgId>
-                        <ProgId Id="progId_VirtualBox.Shell.vdi" Description="Virtual Disk Image" Icon="file_VBoxRes.dll" IconIndex="-303">
-                            <Extension Id="vdi" ContentType="application/x-virtualbox-vdi" />
-                        </ProgId>
-                        <ProgId Id="progId_VirtualBox.Shell.vmdk" Description="Virtual Machine Disk Format" Icon="file_VBoxRes.dll" IconIndex="-304">
-                            <Extension Id="vmdk" ContentType="application/x-virtualbox-vmdk" />
-                        </ProgId>
-                        <ProgId Id="progId_VirtualBox.Shell.vhd" Description="Virtual Hard Disk" Icon="file_VBoxRes.dll" IconIndex="-305">
-                            <Extension Id="vhd" ContentType="application/x-virtualbox-vhd" />
-                        </ProgId>
-                        <ProgId Id="progId_VirtualBox.Shell.hdd" Description="Virtual Hard Disk" Icon="file_VBoxRes.dll" IconIndex="-306">
-                            <Extension Id="hdd" ContentType="application/x-virtualbox-hdd" />
-                        </ProgId>
-                    </Component> <!-- RegisterExtensions -->
-
-                    <!-- All Binaries, DLLs (except COM) and drivers are in one component because they belong together. Additional
-                         binaries e.g. test tools, utilities etc. should be in another component so they"re clearly separated. -->
-                    <Component Id="cp_MainBinaries" Guid="5C8FE57A-F744-4DE0-AA3F-A563F486AD98" Win64="$(var.Property_Win64)">
-
-                        <!-- Set required environment variables. -->
-                        <Environment Id="env_VBoxInstallDir" Action="set" Name="VBOX_INSTALL_PATH"
-                                     System="yes" Part="last" Permanent="no" Value="[INSTALLDIR]" />
-
-                        <!-- Files -->
-<?if $(env.VBOX_WITH_DOCS_PACKING) = "yes" ?>
-                        <!-- Include all user manual .CHM files (file is generated by makefile). -->
-                        <?include $(env.PATH_TARGET)\Files_Main.wxi ?>
-<?endif ?>
-                        <!-- Include all license files (file is generated by makefile). -->
-                        <?include $(env.PATH_TARGET)\Files_License.wxi ?>
-
-                        <!-- Frontends -->
-                        <File Id="file_VBoxManage.exe" Name="VBoxManage.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxManage.exe" />
-                        <File Id="file_VBoxHeadless.exe" Name="VBoxHeadless.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxHeadless.exe">
-                            <!-- Create a simple shortcut for VBoxVRDP, which is not present anymore, pointing to VBoxHeadless.exe -->
-                       <!--     <Shortcut Id="ShortcutVBoxVRDP" Directory="INSTALLDIR" Name="VBoxVRDP" Show="normal" WorkingDirectory="INSTALLDIR"/> -->
-                        </File>
-                        <File Id="file_VBoxBalloonCtrl.exe" Name="VBoxBalloonCtrl.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxBalloonCtrl.exe"/>
-
-                        <!-- Misc tools -->
-                        <File Id="file_VBoxNetDHCP.exe" Name="VBoxNetDHCP.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxNetDHCP.exe"/>
-			<File Id="file_VBoxNetNAT.exe" Name="VBoxNetNAT.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxNetNAT.exe"/>
-<?if $(env.VBOX_WITH_EXTPACK) = "yes" ?>
-                        <File Id="file_VBoxExtPackHelperApp.exe" Name="VBoxExtPackHelperApp.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxExtPackHelperApp.exe"/>
-<?endif ?>
-                        <!-- VBox DLL files -->
-                        <File Id="file_VBoxDD.dll" Name="VBoxDD.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxDD.dll" />
-                        <File Id="file_VBoxDD2.dll" Name="VBoxDD2.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxDD2.dll" />
-                        <File Id="file_VBoxDDU.dll" Name="VBoxDDU.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxDDU.dll" />
-                        <File Id="file_VBoxRT.dll" Name="VBoxRT.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxRT.dll" />
-                        <File Id="file_VBoxREM.dll" Name="VBoxREM.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxREM.dll" />
-<?if $(env.BUILD_TARGET_ARCH) = "x86" ?>
-                        <File Id="file_VBoxREM32.dll" Name="VBoxREM32.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxREM32.dll" />
-                        <File Id="file_VBoxREM64.dll" Name="VBoxREM64.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxREM64.dll" />
-<?endif ?>
-                        <File Id="file_VBoxVMM.dll" Name="VBoxVMM.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxVMM.dll" />
-<?if $(env.VBOX_WITH_VRDP) = "yes" ?>
-                        <File Id="file_VBoxVRDP.dll" Name="VBoxVRDP.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxVRDP.dll" />
-<?endif ?>
-                        <File Id="file_VBoxSharedFolders.dll" Name="VBoxSharedFolders.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxSharedFolders.dll" />
-                        <File Id="file_VBoxSharedClipboard.dll" Name="VBoxSharedClipboard.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxSharedClipboard.dll" />
-<?if $(env.VBOX_WITH_DRAG_AND_DROP)= "yes" ?>
-                        <File Id="file_VBoxDragAndDropSvc.dll" Name="VBoxDragAndDropSvc.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxDragAndDropSvc.dll" />
-<?endif ?>
-<?if $(env.VBOX_WITH_GUEST_PROPS) = "yes" ?>
-                        <File Id="file_VBoxGuestPropSvc.dll" Name="VBoxGuestPropSvc.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxGuestPropSvc.dll" />
-<?endif ?>
-<?if $(env.VBOX_WITH_GUEST_CONTROL) = "yes" ?>
-                        <File Id="file_VBoxGuestControlSvc.dll" Name="VBoxGuestControlSvc.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxGuestControlSvc.dll" />
-<?endif ?>
-                        <File Id="file_VBoxHostChannel.dll" Name="VBoxHostChannel.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxHostChannel.dll" />
-                        <File Id="file_VBoxAuth.dll" Name="VBoxAuth.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxAuth.dll" />
-                        <File Id="file_VBoxAuthSimple.dll" Name="VBoxAuthSimple.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxAuthSimple.dll" />
-
-                        <!-- Include resource DLL (icons, ...). -->
-                        <File Id="file_VBoxRes.dll" Name="VBoxRes.dll" DiskId="$(var.Property_DiskIdCommon)"
-                              Source="$(env.PATH_OUT)\bin\VBoxRes.dll" />
-
-                        <File Id="file_VMMGC.gc" Name="VMMGC.gc"
-                              Source="$(env.PATH_OUT)\bin\VMMGC.gc" />
-                        <File Id="file_VBoxDDGC.gc" Name="VBoxDDGC.gc"
-                              Source="$(env.PATH_OUT)\bin\VBoxDDGC.gc" />
-                        <File Id="file_VBoxDD2GC.gc" Name="VBoxDD2GC.gc"
-                              Source="$(env.PATH_OUT)\bin\VBoxDD2GC.gc" />
-
-                        <File Id="file_VMMR0.r0" Name="VMMR0.r0"
-                              Source="$(env.PATH_OUT)\bin\VMMR0.r0" />
-                        <File Id="file_VBoxDDR0.r0" Name="VBoxDDR0.r0"
-                              Source="$(env.PATH_OUT)\bin\VBoxDDR0.r0" />
-                        <File Id="file_VBoxDD2R0.r0" Name="VBoxDD2R0.r0"
-                              Source="$(env.PATH_OUT)\bin\VBoxDD2R0.r0" />
-
-<?if $(env.VBOX_WITH_CROGL) = "yes" ?>
-                        <File Id="file_VBoxTestOGL.exe" Name="VBoxTestOGL.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxTestOGL.exe" />
-<?endif ?>
-                        <!-- Qt frontend -->
-                        <File Id="file_VirtualBox.exe" Name="VirtualBox.exe"
-                              Source="$(env.PATH_OUT)\bin\VirtualBox.exe">
-                        </File>
-                        <File Id="file_QtCoreVBox4.dll" Name="QtCoreVBox4.dll"
-                              Source="$(env.PATH_OUT)\bin\QtCoreVBox4.dll" />
-                        <File Id="file_QtGuiVBox4.dll" Name="QtGuiVBox4.dll"
-                              Source="$(env.PATH_OUT)\bin\QtGuiVBox4.dll" />
-                        <File Id="file_QtNetworkVBox4.dll" Name="QtNetworkVBox4.dll"
-                              Source="$(env.PATH_OUT)\bin\QtNetworkVBox4.dll" />
-<?if $(env.VBOX_WITH_DEBUGGER_GUI) = "yes" ?>
-                        <File Id="file_VBoxDbg.dll" Name="VBoxDbg.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxDbg.dll" />
-<?endif ?>
-<?if $(env.VBOX_GUI_USE_QGL) = "yes" ?>
-                        <File Id="file_QtOpenGLVBox4.dll" Name="QtOpenGLVBox4.dll"
-                              Source="$(env.PATH_OUT)\bin\QtOpenGLVBox4.dll" />
-<?endif?>
-
-<?if $(env.VBOX_VCC_TOOL_STEM) = "VCC100" ?>
-                        <!-- MS C/C++ v10.0 Runtime DLL files. -->
-                        <File Id="file_msvcr100.dll" Name="msvcr100.dll"
-                              Source="$(env.PATH_OUT)\bin\msvcr100.dll" />
-                        <File Id="file_msvcp100.dll" Name="msvcp100.dll"
-                              Source="$(env.PATH_OUT)\bin\msvcp100.dll" />
-<?endif?>
-<?if $(env.VBOX_VCC_TOOL_STEM) = "VCC110" ?>
-                        <!-- MS C/C++ v11.0 Runtime DLL files. -->
-                        <File Id="file_msvcr110.dll" Name="msvcr110.dll"
-                              Source="$(env.PATH_OUT)\bin\msvcr110.dll" />
-                        <File Id="file_msvcp110.dll" Name="msvcp110.dll"
-                              Source="$(env.PATH_OUT)\bin\msvcp110.dll" />
-<?endif?>
-
-                        <!-- EFI firmware -->
-<?if $(env.VBOX_WITH_EFIFW_PACKING) = "yes" ?>
-                        <File Id="file_VBoxEFI32.fd" Name="VBoxEFI32.fd" DiskId="$(var.Property_DiskIdCommon)"
-                              Source="$(env.PATH_OUT)\bin\VBoxEFI32.fd" />
-                        <File Id="file_VBoxEFI64.fd" Name="VBoxEFI64.fd" DiskId="$(var.Property_DiskIdCommon)"
-                              Source="$(env.PATH_OUT)\bin\VBoxEFI64.fd" />
-<?endif?>
-                        <!-- VBox guest additions -->
-<?if $(env.VBOX_WITH_ADDITIONS_PACKING) = "yes" ?>
-    <?if $(env.VBOX_WITH_COMBINED_PACKAGE) = "yes" ?>
-                        <File Id="file_VBoxGuestAdditions.iso" Name="VBoxGuestAdditions.iso" DiskId="$(var.Property_DiskIdCommon)"
-                              Source="$(env.PATH_MULTIARCH_GUEST_ADDITIONS_ISO)\VBoxGuestAdditions.iso" />
+                </Directory>
+<?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
+                <Directory Id="dir_SDK" Name="sdk">
+                    <Directory Id="dir_SDKInstall" Name="install">
+    <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                        <Merge Id="msm_VBoxPython" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergePython)" DiskId="1" />
     <?else ?>
-                        <File Id="file_VBoxGuestAdditions.iso" Name="VBoxGuestAdditions.iso"
-                              Source="$(env.PATH_OUT)\bin\additions\VBoxGuestAdditions.iso" />
+                        <Directory Id="msm_VBoxPythonFolder" FileSource=".">
+                            <?include VBoxMergePython.wxi ?>
+                        </Directory>
     <?endif ?>
-<?endif ?>
-                        <!-- Include key for VBox version -->
-                        <?include $(env.PATH_TARGET)\VBoxKey.wxi ?>
-
-                    </Component> <!-- MainBinaries -->
-
-<?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
-                    <!-- Qt accessible plugins -->
-                    <Directory Id="dir_Accessible" Name="accessible">
-                        <Component Id="cp_QtAccessible" Guid="12040EF9-D4A8-4FB2-A69C-CA2F5C354A45" Win64="$(var.Property_Win64)">
-                            <File Id="file_qtaccessiblewidgets4.dll" Name="qtaccessiblewidgets4.dll"
-                                  Source="$(env.PATH_OUT)\bin\accessible\qtaccessiblewidgets4.dll" />
-                        </Component>
                     </Directory>
-<?endif?>
+                </Directory>
+<?endif ?>
+                <!-- Set up special directory IDs for referencing to the start menu
+                     or the Quick Launch bar.
+                     See: http://msdn.microsoft.com/en-us/library/aa368276.aspx
+                          http://wix.mindcapers.com/wiki/Shortcuts_in_WiX -->
+                <Directory Id="ProgramMenuFolder">
+                    <Directory Id="dir_StartMenuVBox" Name="$(env.VBOX_PRODUCT)"/>
+                </Directory>
 
-<?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
-                    <!-- Python bindings -->
-                    <Directory Id="dir_SDK" Name="sdk">
-                        <Directory Id="dir_SDKInstall" Name="install">
-                            <Component Id="cp_VBoxPyInst" Guid="C9A40306-5102-11DE-A7BA-C3C555D89593" Win64="$(var.Property_Win64)">
-                                 <File Id="file_vboxapisetup.py" Name="vboxapisetup.py" DiskId="$(var.Property_DiskIdCommon)"
-                                       Source="$(env.PATH_OUT)\bin\sdk\installer\vboxapisetup.py" />
-                            </Component>
-                            <Directory Id="dir_SDKVBoxAPI" Name="vboxapi">
-                                <Component Id="cp_VBoxPyMod" Guid="DF19CB76-5102-11DE-943B-13C755D89593" Win64="$(var.Property_Win64)">
-                                    <File Id="file___init__.py" Name="__init__.py" DiskId="$(var.Property_DiskIdCommon)"
-                                          Source="$(env.PATH_OUT)\bin\sdk\installer\vboxapi\__init__.py" />
-                                    <File Id="file_VirtualBox_constants.py" Name="VirtualBox_constants.py" DiskId="$(var.Property_DiskIdCommon)"
-                                          Source="$(env.PATH_OUT)\bin\sdk\installer\vboxapi\VirtualBox_constants.py" />
-                                </Component>
-                            </Directory>
+                <Directory Id="DesktopFolder" Name="Desktop"/>
+
+                <Directory Id="AppDataFolder" Name="AppData">
+                    <Directory Id="dir_AppDataMicrosoft" Name="Microsoft">
+                        <Directory Id="dir_AppDataMSIE" Name="Internet Explorer">
+                            <Directory Id="dir_QuicklaunchFolder" Name="Quick Launch"/>
                         </Directory>
                     </Directory>
-<?endif?>
-
-<?if $(env.VBOX_WITH_CROGL) = "yes" ?>
-                    <Component Id="cp_VBoxCROpenGL" Guid="874A1297-835A-491D-8A9D-7E723BC29EE7" Win64="$(var.Property_Win64)">
-                        <File Id="file_VBoxOGLhostcrutil.dll" Name="VBoxOGLhostcrutil.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxOGLhostcrutil.dll" />
-                        <File Id="file_VBoxOGLhosterrorspu.dll" Name="VBoxOGLhosterrorspu.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxOGLhosterrorspu.dll" />
-                        <File Id="file_VBoxOGLrenderspu.dll" Name="VBoxOGLrenderspu.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxOGLrenderspu.dll" />
-                        <File Id="file_VBoxSharedCrOpenGL.dll" Name="VBoxSharedCrOpenGL.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxSharedCrOpenGL.dll" />
-                    </Component>
-<?endif?>
-                    <!-- SDL plugins -->
-                    <Component Id="cp_VBoxSDLBinaries" Guid="F09D5FD9-E176-42B0-90A9-481BB18B0CB4" Win64="$(var.Property_Win64)">
-                        <File Id="file_VBoxSDL.exe" Name="VBoxSDL.exe"
-                              Source="$(env.PATH_OUT)\bin\VBoxSDL.exe" />
-                        <File Id="file_SDL.dll" Name="SDL.dll"
-                              Source="$(env.PATH_OUT)\bin\SDL.dll" />
-<?if $(env.VBOX_WITH_SECURELABEL) = "yes" ?>
-                        <File Id="file_SDL_ttf.dll" Name="SDL_ttf.dll"
-                              Source="$(env.PATH_OUT)\bin\SDL_ttf.dll" />
-<?endif?>
-                    </Component> <!-- SDL plugins -->
-
-<?if $(env.VBOX_WITH_WEBSERVICES) = "yes" ?>
-                    <!-- Webservice -->
-                    <Component Id="cp_VBoxWebService" Guid="DD404F04-9874-43E9-AEE2-7762924D922E">
-                        <File Id="file_VBoxWebSrv.exe" Name="VBoxWebSrv.exe"
-                              Source="$(env.PATH_OUT)\bin\vboxwebsrv.exe" />
-                    </Component>
-<?endif?>
-
-                    <!-- C API (glue) binding -->
-                    <Component Id="cp_VBoxCAPI" Guid="097F7F53-7111-467F-8E0C-257D9926FDA0">
-                        <File Id="file_VBoxCAPI.dll" Name="VBoxCAPI.dll"
-                              Source="$(env.PATH_OUT)\bin\VBoxCAPI.dll" />
-                    </Component>
+                </Directory>
+
+                <!-- Shortcut(s) in start menu -->
+                <Component Id="cp_StartMenuVBox" Guid="C2DC321A-CE63-40EE-8A98-724DF8BD12FB" Win64="$(var.Property_Win64)">
+                    <Shortcut Id="sc_StartMenuVBox" Directory="dir_StartMenuVBox" Name="$(env.VBOX_PRODUCT)" Description="$(env.VBOX_PRODUCT)"
+                              Target="[INSTALLDIR]VirtualBox.exe" WorkingDirectory="INSTALLDIR"/>
+                    <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)"
+                                   Type="string" Value="installed" KeyPath="yes" />
+                    <?include $(env.PATH_TARGET)\Shortcuts_StartMenu.wxi ?>
+                </Component>
+
+                <Component Id="cp_DesktopShortcut" Guid="668F8A1A-F5CE-48B3-BB1A-3042EE27B279" Win64="$(var.Property_Win64)">
+                    <Condition>VBOX_INSTALLDESKTOPSHORTCUT</Condition>
+                    <Shortcut Id="sc_DesktopVBox" Directory="DesktopFolder" Name="$(env.VBOX_PRODUCT)" Description="$(env.VBOX_PRODUCT)"
+                              Target="[INSTALLDIR]VirtualBox.exe" WorkingDirectory="INSTALLDIR"/>
+                    <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)" Type="string"
+                                   Value="installed" KeyPath="yes" />
+                </Component>
+
+                <Component Id="cp_QuickLaunchVBox" Guid="CC19E026-938A-41CB-8E77-3F33296244B6" Win64="$(var.Property_Win64)">
+                    <CreateFolder/>
+                    <Condition>VBOX_INSTALLQUICKLAUNCHSHORTCUT</Condition>
+                    <Shortcut Id="sc_QuickLaunchVBox" Directory="dir_QuicklaunchFolder" Name="$(env.VBOX_PRODUCT)" Description="$(env.VBOX_PRODUCT)"
+                              Target="[INSTALLDIR]VirtualBox.exe" WorkingDirectory="INSTALLDIR"/>
+                    <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)"
+                                   Type="string" Value="installed" KeyPath="yes" />
+                </Component>
 
-<?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
-                    <Component Id="cp_VBoxPythonBinding" Guid="293D7E11-78DA-4C31-AEED-AE2FE42F6881">
-                        <Condition>PYTHON_INSTALLED</Condition>
-                    </Component>
-<?endif?>
-                </Directory> <!-- Installation directory -->
-            </Directory> <!-- Windows program files directory -->
-
-            <!-- Set up special directory IDs for referencing to the start menu
-                 or the Quick Launch bar.
-                 See: http://msdn.microsoft.com/en-us/library/aa368276.aspx
-                      http://wix.mindcapers.com/wiki/Shortcuts_in_WiX -->
-            <Directory Id="ProgramMenuFolder">
-                <Directory Id="dir_StartMenuVBox" Name="$(env.VBOX_PRODUCT)"/>
             </Directory>
+        </Directory>
+    </Directory> <!-- TARGETDIR -->
+
+    <!-- Note: Feature IDs *must not* be renamed to use any prefixes or such,
+               otherwise this will break manual selection using the ADDLOCAL= syntax
+               when using the command line / scripts (see VBox manual). -->
+    <Feature Id="VBoxApplication" Title="VirtualBox Application" Level="1"
+             Description="!(loc.VB_App)"
+             ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
+             Absent="disallow" AllowAdvertise="no" >
+        <!-- Components which are handled only by this installer itself -->
+        <ComponentRef Id="cp_StartMenuVBox" />
+        <ComponentRef Id="cp_DesktopShortcut" />
+        <ComponentRef Id="cp_QuickLaunchVBox" />
+        <!-- Components handled either by the installer itself or
+             the merge module -->
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+        <MergeRef Id="msm_VBoxApp" />
+        <?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+            <MergeRef Id="msm_VBoxCOM32On64" />
+        <?endif ?>
+<?else ?>
+    <?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
+        <ComponentRef Id="cp_RegisterExtensions" />
+    <?endif ?>
+    <?if $(env.VBOX_WITH_DOCS_PACKING) = "yes" ?>
+        <ComponentRef Id="cp_Docs" />
+    <?endif ?>
+    <?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
+        <ComponentRef Id="cp_NLS" />
+    <?endif ?>
+    <?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+        <ComponentRef Id="cp_MainCOM_x86" />
+    <?endif ?>
+        <ComponentRef Id="cp_MainCOM" />
+        <ComponentRef Id="cp_MainBinaries" />
+    <?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
+        <ComponentRef Id="cp_QtAccessible" />
+    <?endif ?>
+    <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
+        <ComponentRef Id="cp_VBoxPyInst" />
+        <ComponentRef Id="cp_VBoxPyMod" />
+    <?endif ?>
 
-            <Directory Id="DesktopFolder" Name="Desktop"/>
+    <?if $(env.VBOX_WITH_CROGL) = "yes" ?>
+        <ComponentRef Id="cp_VBoxCROpenGL" />
+    <?endif ?>
+        <ComponentRef Id="cp_VBoxSDLBinaries" />
+    <?if $(env.VBOX_WITH_WEBSERVICES) = "yes" ?>
+        <ComponentRef Id="cp_VBoxWebService" />
+    <?endif ?>
+        <ComponentRef Id="cp_VBoxDrv" />
+    <?endif ?>
 
-            <Directory Id="AppDataFolder" Name="AppData">
-                <Directory Id="dir_AppDataMicrosoft" Name="Microsoft">
-                    <Directory Id="dir_AppDataMSIE" Name="Internet Explorer">
-                        <Directory Id="dir_QuicklaunchFolder" Name="Quick Launch"/>
-                    </Directory>
-                </Directory>
-            </Directory>
+        <Feature Id="VBoxUSB" Title="VirtualBox USB Support" Level="1"
+                 Description="!(loc.VB_USBDriver)"
+                 ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
+                 Absent="allow" AllowAdvertise="no" >
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <MergeRef Id="msm_VBoxUSB" />
+<?else ?>
+            <ComponentRef Id="cp_USBFilterDriver" />
+            <ComponentRef Id="cp_USBDeviceDriver" />
+<?endif ?>
+        </Feature>
 
-            <!-- Shortcut(s) in start menu -->
-            <Component Id="cp_StartMenuVBox" Guid="C2DC321A-CE63-40EE-8A98-724DF8BD12FB" Win64="$(var.Property_Win64)">
-                <Shortcut Id="sc_StartMenuVBox" Directory="dir_StartMenuVBox" Name="$(env.VBOX_PRODUCT)" Description="$(env.VBOX_PRODUCT)"
-                          Target="[INSTALLDIR]VirtualBox.exe" WorkingDirectory="INSTALLDIR"/>
-                <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)"
-                               Type="string" Value="installed" KeyPath="yes" />
-                <?include $(env.PATH_TARGET)\Shortcuts_StartMenu.wxi ?>
-            </Component>
-
-            <Component Id="cp_DesktopShortcut" Guid="668F8A1A-F5CE-48B3-BB1A-3042EE27B279" Win64="$(var.Property_Win64)">
-                <Condition>INSTALLDESKTOPSHORTCUT</Condition>
-                <Shortcut Id="sc_DesktopVBox" Directory="DesktopFolder" Name="$(env.VBOX_PRODUCT)" Description="$(env.VBOX_PRODUCT)"
-                          Target="[INSTALLDIR]VirtualBox.exe" WorkingDirectory="INSTALLDIR"/>
-                <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)" Type="string"
-                               Value="installed" KeyPath="yes" />
-            </Component>
-
-            <Component Id="cp_QuickLaunchVBox" Guid="CC19E026-938A-41CB-8E77-3F33296244B6" Win64="$(var.Property_Win64)">
-                <CreateFolder/>
-                <Condition>INSTALLQUICKLAUNCHSHORTCUT</Condition>
-                <Shortcut Id="sc_QuickLaunchVBox" Directory="dir_QuicklaunchFolder" Name="$(env.VBOX_PRODUCT)" Description="$(env.VBOX_PRODUCT)"
-                          Target="[INSTALLDIR]VirtualBox.exe" WorkingDirectory="INSTALLDIR"/>
-                <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)"
-                               Type="string" Value="installed" KeyPath="yes" />
-            </Component>
-        </Directory> <!-- TARGETDIR -->
-
-        <!-- Note: Feature IDs *must not* be renamed to use any prefixes or such,
-                   otherwise this will break manual selection using the ADDLOCAL= syntax
-                   when using the command line / scripts (see VBox manual). -->
-        <Feature Id="VBoxApplication" Title="VirtualBox Application" Level="1"
-                 Description="!(loc.VB_App)"
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+        <Feature Id="VBoxNetwork" Title="VirtualBox Networking" Level="1"
+                 Description="!(loc.VB_Network)"
                  ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
-                 Absent="disallow" AllowAdvertise="no" >
-
-            <ComponentRef Id="cp_StartMenuVBox" />
-            <ComponentRef Id="cp_DesktopShortcut" />
-            <ComponentRef Id="cp_QuickLaunchVBox" />
-            <ComponentRef Id="cp_RegisterExtensions" />
-
-<?if $(env.VBOX_WITH_DOCS_PACKING) = "yes" ?>
-            <ComponentRef Id="cp_Docs" />
-<?endif?>
-            <ComponentRef Id="cp_NLS" />
-<?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
-            <ComponentRef Id="cp_MainCOM_x86" />
-<?endif?>
-            <ComponentRef Id="cp_MainCOM" />
-            <ComponentRef Id="cp_MainBinaries" />
-<?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
-            <ComponentRef Id="cp_QtAccessible" />
-<?endif?>
-<?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
-            <ComponentRef Id="cp_VBoxPyInst" />
-            <ComponentRef Id="cp_VBoxPyMod" />
-<?endif?>
-
-<?if $(env.VBOX_WITH_CROGL) = "yes" ?>
-            <ComponentRef Id="cp_VBoxCROpenGL" />
-<?endif?>
-            <ComponentRef Id="cp_VBoxSDLBinaries" />
-<?if $(env.VBOX_WITH_WEBSERVICES) = "yes" ?>
-            <ComponentRef Id="cp_VBoxWebService" />
-<?endif?>
-            <ComponentRef Id="cp_VBoxCAPI" />
-            <ComponentRef Id="cp_VBoxDrv" />
-
-            <Feature Id="VBoxUSB" Title="VirtualBox USB Support" Level="1"
-                     Description="!(loc.VB_USBDriver)"
+                 Absent="allow" AllowAdvertise="no" >
+            <Feature Id="VBoxNetworkFlt" Title="VirtualBox Bridged Networking" Level="1"
+                     Description="!(loc.VB_NetFltDriver)"
                      ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
                      Absent="allow" AllowAdvertise="no" >
-                <ComponentRef Id="cp_USBFilterDriver" />
-                <ComponentRef Id="cp_USBDeviceDriver" />
+    <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                <MergeRef Id="msm_VBoxNetworkFlt" />
+    <?else ?>
+                <ComponentRef Id="cp_NetFltDriver" />
+    <?endif ?>
             </Feature>
-
-<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
-            <Feature Id="VBoxNetwork" Title="VirtualBox Networking" Level="1"
-                     Description="!(loc.VB_Network)"
+            <Feature Id="VBoxNetworkAdp" Title="VirtualBox Host-Only Networking" Level="1"
+                     Description="!(loc.VB_NetAdpDriver)"
                      ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
                      Absent="allow" AllowAdvertise="no" >
-                <Feature Id="VBoxNetworkFlt" Title="VirtualBox Bridged Networking" Level="1"
-                         Description="!(loc.VB_NetFltDriver)"
-                         ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
-                         Absent="allow" AllowAdvertise="no" >
-                    <ComponentRef Id="cp_NetFltDriver" />
-                </Feature>
-                <Feature Id="VBoxNetworkAdp" Title="VirtualBox Host-Only Networking" Level="1"
-                         Description="!(loc.VB_NetAdpDriver)"
-                         ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
-                         Absent="allow" AllowAdvertise="no" >
-                    <ComponentRef Id="cp_NetAdpDriver" />
-                </Feature>
+    <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                <MergeRef Id="msm_VBoxNetworkAdp" />
+    <?else ?>
+                <ComponentRef Id="cp_NetAdpDriver" />
+    <?endif ?>
             </Feature>
-<?endif?>
+        </Feature>
+<?endif ?>
 
 <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
-            <Feature Id="VBoxPython" Title="VirtualBox Python 2.x Support" Level="1"
-                    Description="!(loc.VB_Python)"
-                    ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
-                    Absent="allow" AllowAdvertise="no" >
+        <Feature Id="VBoxPython" Title="VirtualBox Python 2.x Support" Level="1"
+                 Description="!(loc.VB_Python)"
+                 ConfigurableDirectory="INSTALLDIR" TypicalDefault="install" Display="expand"
+                 Absent="allow" AllowAdvertise="no" >
+    <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                <MergeRef Id="msm_VBoxPython" />
+    <?else ?>
                 <ComponentRef Id="cp_VBoxPythonBinding" />
-            </Feature>
-<?endif?>
-
+    <?endif ?>
         </Feature>
+<?endif ?>
+    </Feature>
+
+    <!-- Include user interface definition -->
+    <?include UserInterface.wxi ?>
+
+    <InstallExecuteSequence>
+
+        <!--
+            To debug the action sequences, do: "msiexec /i <VBox.msi> /lar <Logfile>"
+
+            InstallUISequence (client side) is:
+                AppSearch
+                LaunchConditions
+                ValidateProductID
+                CostInitialize
+                FileCost
+                CostFinalize
+                ExecuteAction -> will pass control over to "InstallExecuteSequence"
+
+            The first six actions above will be repeated but skipped on the server
+            side if already run on the client side.
+
+            InstallExecuteSequence (server side) is:
+                <First six action from InstallUISequence>
+                .
+                InstallInitialize
+                .
+                InstallFinalize
+
+            The actions between InstallInitialize and InstallFinalize will be gone through twice:
+            - The first time the installer creates an installation script containing all actions in the right
+              sequence which need to get executed in a batch later. At this point the launch conditions for
+              custom actions must be met already!
+            - The second time the generated installation script will be run as-is.
+
+            Also, the InstallUISequence and InstallExecuteSequence tables run in different sessions which
+            need public properties (that is, UPPERCASE properties).
+        -->
+
+        <!-- AppSearch must be done before "RemoveExistingProducts" and before "FindRelatedProducts" -->
+        <AppSearch Sequence="1"></AppSearch>
+        <LaunchConditions After="AppSearch" />
+
+        <!-- First install the new version and then remove the old version. This is more efficient -->
+        <RemoveExistingProducts After="InstallValidate">PREVIOUSVERSIONSINSTALLED</RemoveExistingProducts>
+
+        <Custom Action="ca_OriginalTargetDir" After="FileCost"><![CDATA[(NOT INSTALLDIR) AND (NOT EXISTINGINSTALLDIR)]]></Custom>
+        <Custom Action="ca_DefaultTargetDir" Before="FileCost" ><![CDATA[NOT Installed AND (NOT INSTALLDIR) AND EXISTINGINSTALLDIR]]></Custom>
+
+        <!-- Check + unininstall old TAP instances - we  don't need them anymore -->
+        <Custom Action="ca_UninstallTAPInstances" Before="InstallFiles" >1</Custom>
+
+        <Custom Action="ca_InstallBrandingArgs" Before="ca_InstallBranding" ><![CDATA[NOT REMOVE]]></Custom>
+        <Custom Action="ca_InstallBranding" Before="InstallFinalize" ><![CDATA[NOT REMOVE]]></Custom>
+
+        <!-- Uninstall branding on complete uninstall, not on update -->
+        <Custom Action="ca_UninstallBrandingArgs" Before="ca_UninstallBranding" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
+        <Custom Action="ca_UninstallBranding" Before="InstallFinalize" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
+
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "no" ?>
+        <?include VBoxMergeAppSeq.wxi ?>
+        <?if $(env.VBOX_WITH_32_ON_64_MAIN_API) = "yes" ?>
+            <?include VBoxMergeCOM32On64Seq.wxi ?>
+        <?endif ?>
+        <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+            <?include VBoxMergeNetFltSeq.wxi ?>
+        <?endif ?>
+        <?include VBoxMergeNetAdpSeq.wxi ?>
+        <?include VBoxMergeUSBSeq.wxi ?>
+        <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
+            <?include VBoxMergePythonSeq.wxi ?>
+        <?endif ?>
+<?endif ?>
 
-        <!-- Include user interface definition. -->
-        <?include UserInterface.wxi ?>
-
-        <InstallExecuteSequence>
-
-            <!--
-                To debug the action sequences, do: "msiexec /i <VBox.msi> /lar <Logfile>"
-
-                InstallUISequence (client side) is:
-                    AppSearch
-                    LaunchConditions
-                    ValidateProductID
-                    CostInitialize
-                    FileCost
-                    CostFinalize
-                    ExecuteAction -> will pass control over to "InstallExecuteSequence"
-
-                The first six actions above will be repeated but skipped on the server
-                side if already run on the client side.
-
-                InstallExecuteSequence (server side) is:
-                    <First six action from InstallUISequence>
-                    .
-                    InstallInitialize
-                    .
-                    InstallFinalize
-
-                The actions between InstallInitialize and InstallFinalize will be gone through twice:
-                - The first time the installer creates an installation script containing all actions in the right
-                  sequence which need to get executed in a batch later. At this point the launch conditions for
-                  custom actions must be met already!
-                - The second time the generated installation script will be run as-is.
-
-                Also, the InstallUISequence and InstallExecuteSequence tables run in different sessions which
-                need public properties (that is, UPPERCASE properties).
-            -->
-
-            <!-- AppSearch must be done before "RemoveExistingProducts" and before "FindRelatedProducts". -->
-            <AppSearch Sequence="1"></AppSearch>
-            <LaunchConditions After="AppSearch" />
-
-            <!-- First install the new version and then remove the old version. This is more efficient. -->
-            <RemoveExistingProducts Before="InstallValidate" />
-
-            <Custom Action="ca_OriginalTargetDir" After="FileCost"><![CDATA[(NOT INSTALLDIR) AND (NOT EXISTINGINSTALLDIR)]]></Custom>
-            <Custom Action="ca_DefaultTargetDir" Before="FileCost" ><![CDATA[NOT Installed AND (NOT INSTALLDIR) AND EXISTINGINSTALLDIR]]></Custom>
+    </InstallExecuteSequence>
 
-            <Custom Action="ca_UninstallTAPInstances" Before="InstallFiles" >1</Custom>
-<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
-            <!-- Create host-only interfaces on first-time install. -->
-            <Custom Action="ca_CreateHostOnlyInterfaceArgs" Before="ca_CreateHostOnlyInterface" ><![CDATA[&VBoxNetworkAdp=3]]></Custom>
-            <Custom Action="ca_CreateHostOnlyInterface" Before="InstallFinalize" ><![CDATA[&VBoxNetworkAdp=3]]></Custom>
-            <!-- Don't remove the host-only interfaces on update, only on uninstall. -->
-            <Custom Action="ca_RemoveHostOnlyInterfaces" After="ca_UninstallNetFlt" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
-            <!-- First stop the existing host-only interfaces on update ... -->
-            <Custom Action="ca_StopHostOnlyInterfaces" Before="ca_UpdateHostOnlyInterfaces" ><![CDATA[UPGRADINGPRODUCTCODE]]></Custom>
-            <!-- ... then do the actual driver update. -->
-            <Custom Action="ca_UpdateHostOnlyInterfacesArgs" Before="ca_UpdateHostOnlyInterfaces" ><![CDATA[Installed AND UPGRADINGPRODUCTCODE]]></Custom>
-            <Custom Action="ca_UpdateHostOnlyInterfaces" Before="InstallFiles" ><![CDATA[Installed AND UPGRADINGPRODUCTCODE]]></Custom>
-
-            <Custom Action="ca_RollbackInstallNetFltArgs" Before="ca_RollbackInstallNetFlt" ><![CDATA[&VBoxNetworkFlt=3]]></Custom>
-            <Custom Action="ca_RollbackInstallNetFlt" Before="ca_InstallNetFlt" ><![CDATA[&VBoxNetworkFlt=3]]></Custom>
-            <Custom Action="ca_InstallNetFltArgs" Before="ca_InstallNetFlt" ><![CDATA[&VBoxNetworkFlt=3]]></Custom>
-            <Custom Action="ca_InstallNetFlt" Before="ca_CreateHostOnlyInterface" ><![CDATA[&VBoxNetworkFlt=3]]></Custom>
-
-            <Custom Action="ca_RollbackUninstallNetFltArgs" Before="ca_RollbackUninstallNetFlt" ><![CDATA[&VBoxNetworkFlt=2]]></Custom>
-            <Custom Action="ca_RollbackUninstallNetFlt" Before="ca_UninstallNetFlt" ><![CDATA[&VBoxNetworkFlt=2]]></Custom>
-            <Custom Action="ca_UninstallNetFltArgs" Before="ca_UninstallNetFlt" ><![CDATA[&VBoxNetworkFlt=2]]></Custom>
-            <Custom Action="ca_UninstallNetFlt" After="InstallInitialize" ><![CDATA[&VBoxNetworkFlt=2]]></Custom>
-<?endif?>
-            <Custom Action="ca_InstallPythonAPIArgs" Before="ca_InstallPythonAPI" ><![CDATA[&VBoxPython=3]]></Custom>
-            <Custom Action="ca_InstallPythonAPI" Before="InstallFinalize" ><![CDATA[&VBoxPython=3]]></Custom>
-
-            <Custom Action="ca_InstallBrandingArgs" Before="ca_InstallBranding" ><![CDATA[NOT REMOVE]]></Custom>
-            <Custom Action="ca_InstallBranding" Before="InstallFinalize" ><![CDATA[NOT REMOVE]]></Custom>
-
-            <!-- Uninstall branding on complete uninstall, not on update. -->
-            <Custom Action="ca_UninstallBrandingArgs" Before="ca_UninstallBranding" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
-            <Custom Action="ca_UninstallBranding" Before="InstallFinalize" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
-
-        </InstallExecuteSequence>
-
-    </Product>
+  </Product>
 </Wix>
-
diff --git a/src/VBox/Main/Makefile.kmk b/src/VBox/Main/Makefile.kmk
index 302f681..715fa8e 100644
--- a/src/VBox/Main/Makefile.kmk
+++ b/src/VBox/Main/Makefile.kmk
@@ -782,6 +782,7 @@ ifdef VBOX_WITH_32_ON_64_MAIN_API
  VBoxClient-x86_TEMPLATE = VBoxMainComp-x86
  VBoxClient-x86_EXTENDS  = VBoxC
  VBoxClient-x86_DEFS = VBOX_COM_INPROC_API_CLIENT $(VBoxC_DEFS)
+ VBoxClient-x86_INST.win = $(INST_DLL)x86/
  VBoxClient-x86_INCS.win = \
  	$(VBoxClient-x86_0_OUTDIR) \
  	$(VBoxCOM-x86_0_OUTDIR) \
@@ -806,7 +807,7 @@ ifdef VBOX_WITH_32_ON_64_MAIN_API
  endif
  VBoxClient-x86_LIBS = $(NO_SUCH_VARIABLE)
  VBoxClient-x86_LIBS.win = $(NO_SUCH_VARIABLE)
- VBoxClient-x86_CLEAN.win += $$(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs
+ VBoxClient-x86_CLEAN.win += $(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs
  src-client/win/VBoxClient-x86.rc_DEPS = \
  	$(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs \
  	$(VBoxCOM-x86_0_OUTDIR)/VirtualBox-x86.tlb
diff --git a/src/VBox/Main/cbinding/Makefile.kmk b/src/VBox/Main/cbinding/Makefile.kmk
index e84dfcb..1f5c4ef 100644
--- a/src/VBox/Main/cbinding/Makefile.kmk
+++ b/src/VBox/Main/cbinding/Makefile.kmk
@@ -152,7 +152,8 @@ if !defined(VBOX_ONLY_SDK)
   endif
   tstCAPIGlue_INTERMEDIATES = \
   	$(VBOX_PATH_SDK)/bindings/c/glue/VBoxCAPIGlue.h \
-  	$(VBOX_PATH_SDK)/bindings/c/include/VBoxCAPI_v$(VBOX_API_VERSION).h
+  	$(VBOX_PATH_SDK)/bindings/c/include/VBoxCAPI_v$(VBOX_API_VERSION).h \
+       $(if-expr !defined(VBOX_WITH_XPCOM),$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h,)
   tstCAPIGlue_SOURCES = \
   	tstCAPIGlue.c
   tstCAPIGlue_LIBS = \
diff --git a/src/VBox/Main/cbinding/VBoxCAPI.cpp b/src/VBox/Main/cbinding/VBoxCAPI.cpp
index 094d4e4..9ad2ccd 100644
--- a/src/VBox/Main/cbinding/VBoxCAPI.cpp
+++ b/src/VBox/Main/cbinding/VBoxCAPI.cpp
@@ -231,10 +231,20 @@ VBoxSafeArrayCopyOutParamHelper(void **ppv, ULONG *pcb, VARTYPE vt, SAFEARRAY *p
         return E_POINTER;
     ULONG cbElement = VBoxVTElemSize(vt);
     if (!cbElement)
+    {
+        *ppv = NULL;
+        if (pcb)
+            *pcb = 0;
         return E_INVALIDARG;
+    }
 #ifndef VBOX_WITH_XPCOM
     if (psa->cDims != 1)
+    {
+        *ppv = NULL;
+        if (pcb)
+            *pcb = 0;
         return E_INVALIDARG;
+    }
     Assert(cbElement = psa->cbElements);
 #endif /* !VBOX_WITH_XPCOM */
     void *pData;
@@ -245,18 +255,32 @@ VBoxSafeArrayCopyOutParamHelper(void **ppv, ULONG *pcb, VARTYPE vt, SAFEARRAY *p
 #else /* !VBOX_WITH_XPCOM */
     HRESULT rc = SafeArrayAccessData(psa, &pData);
     if (FAILED(rc))
+    {
+        *ppv = NULL;
+        if (pcb)
+            *pcb = 0;
         return rc;
+    }
     cElements = psa->rgsabound[0].cElements;
 #endif /* !VBOX_WITH_XPCOM */
     size_t cbTotal = cbElement * cElements;
-    void *pv = malloc(cbTotal);
-    if (pv)
+    void *pv = NULL;
+    if (cbTotal)
     {
-        memcpy(pv, pData, cbTotal);
-        *ppv = pv;
-        if (pcb)
-            *pcb = (ULONG)cbTotal;
+        pv = malloc(cbTotal);
+        if (!pv)
+        {
+            *ppv = NULL;
+            if (pcb)
+                *pcb = 0;
+            return E_OUTOFMEMORY;
+        }
+        else
+            memcpy(pv, pData, cbTotal);
     }
+    *ppv = pv;
+    if (pcb)
+        *pcb = (ULONG)cbTotal;
 #ifndef VBOX_WITH_XPCOM
     SafeArrayUnaccessData(psa);
 #endif /* !VBOX_WITH_XPCOM */
@@ -269,7 +293,11 @@ VBoxSafeArrayCopyOutIfaceParamHelper(IUnknown ***ppaObj, ULONG *pcObj, SAFEARRAY
     ULONG mypcb;
     HRESULT rc = VBoxSafeArrayCopyOutParamHelper((void **)ppaObj, &mypcb, VT_UNKNOWN, psa);
     if (FAILED(rc))
+    {
+        if (pcObj)
+            *pcObj = 0;
         return rc;
+    }
     ULONG cElements = mypcb / sizeof(void *);
     if (pcObj)
         *pcObj = cElements;
@@ -288,6 +316,13 @@ VBoxSafeArrayCopyOutIfaceParamHelper(IUnknown ***ppaObj, ULONG *pcObj, SAFEARRAY
     return S_OK;
 }
 
+static HRESULT
+VBoxArrayOutFree(void *pv)
+{
+    free(pv);
+    return S_OK;
+}
+
 static void
 VBoxComInitialize(const char *pszVirtualBoxIID, IVirtualBox **ppVirtualBox,
                   const char *pszSessionIID, ISession **ppSession)
@@ -714,6 +749,7 @@ VBoxGetCAPIFunctions(unsigned uVersion)
         VBoxSafeArrayCopyOutParamHelper,
         VBoxSafeArrayCopyOutIfaceParamHelper,
         VBoxSafeArrayDestroy,
+        VBoxArrayOutFree,
 
 #ifdef VBOX_WITH_XPCOM
         VBoxGetEventQueue,
@@ -730,6 +766,100 @@ VBoxGetCAPIFunctions(unsigned uVersion)
         return &s_Functions;
 
     /*
+     * Legacy interface version 4.0.
+     */
+    static const struct VBOXCAPIV4
+    {
+        /** The size of the structure. */
+        unsigned cb;
+        /** The structure version. */
+        unsigned uVersion;
+
+        unsigned int (*pfnGetVersion)(void);
+        unsigned int (*pfnGetAPIVersion)(void);
+
+        HRESULT (*pfnClientInitialize)(const char *pszVirtualBoxClientIID,
+                                       IVirtualBoxClient **ppVirtualBoxClient);
+        HRESULT (*pfnClientThreadInitialize)(void);
+        HRESULT (*pfnClientThreadUninitialize)(void);
+        void (*pfnClientUninitialize)(void);
+
+        void  (*pfnComInitialize)(const char *pszVirtualBoxIID,
+                                  IVirtualBox **ppVirtualBox,
+                                  const char *pszSessionIID,
+                                  ISession **ppSession);
+
+        void  (*pfnComUninitialize)(void);
+
+        void (*pfnComUnallocString)(BSTR pwsz);
+
+        int   (*pfnUtf16ToUtf8)(CBSTR pwszString, char **ppszString);
+        int   (*pfnUtf8ToUtf16)(const char *pszString, BSTR *ppwszString);
+        void  (*pfnUtf8Free)(char *pszString);
+        void  (*pfnUtf16Free)(BSTR pwszString);
+
+        SAFEARRAY *(*pfnSafeArrayCreateVector)(VARTYPE vt, LONG lLbound, ULONG cElements);
+        SAFEARRAY *(*pfnSafeArrayOutParamAlloc)(void);
+        HRESULT (*pfnSafeArrayCopyInParamHelper)(SAFEARRAY *psa, const void *pv, ULONG cb);
+        HRESULT (*pfnSafeArrayCopyOutParamHelper)(void **ppv, ULONG *pcb, VARTYPE vt, SAFEARRAY *psa);
+        HRESULT (*pfnSafeArrayCopyOutIfaceParamHelper)(IUnknown ***ppaObj, ULONG *pcObj, SAFEARRAY *psa);
+        HRESULT (*pfnSafeArrayDestroy)(SAFEARRAY *psa);
+
+#ifdef VBOX_WITH_XPCOM
+        void  (*pfnGetEventQueue)(nsIEventQueue **ppEventQueue);
+#endif /* VBOX_WITH_XPCOM */
+        HRESULT (*pfnGetException)(IErrorInfo **ppException);
+        HRESULT (*pfnClearException)(void);
+        int (*pfnProcessEventQueue)(LONG64 iTimeoutMS);
+        int (*pfnInterruptEventQueueProcessing)(void);
+
+        /** Tail version, same as uVersion. */
+        unsigned uEndVersion;
+    } s_Functions_v4_0 =
+    {
+        sizeof(s_Functions_v4_0),
+        0x00040000U,
+
+        VBoxVersion,
+        VBoxAPIVersion,
+
+        VBoxClientInitialize,
+        VBoxClientThreadInitialize,
+        VBoxClientThreadUninitialize,
+        VBoxClientUninitialize,
+
+        VBoxComInitialize,
+        VBoxComUninitialize,
+
+        VBoxComUnallocString,
+
+        VBoxUtf16ToUtf8,
+        VBoxUtf8ToUtf16,
+        VBoxUtf8Free,
+        VBoxUtf16Free,
+
+        VBoxSafeArrayCreateVector,
+        VBoxSafeArrayOutParamAlloc,
+        VBoxSafeArrayCopyInParamHelper,
+        VBoxSafeArrayCopyOutParamHelper,
+        VBoxSafeArrayCopyOutIfaceParamHelper,
+        VBoxSafeArrayDestroy,
+
+#ifdef VBOX_WITH_XPCOM
+        VBoxGetEventQueue,
+#endif /* VBOX_WITH_XPCOM */
+        VBoxGetException,
+        VBoxClearException,
+        VBoxProcessEventQueue,
+        VBoxInterruptEventQueueProcessing,
+
+        0x00040000U
+    };
+
+    if ((uVersion & 0xffff0000U) == 0x00040000U)
+        return (PCVBOXCAPI)&s_Functions_v4_0;
+
+    /*
      * Legacy interface version 3.0.
      */
     static const struct VBOXCAPIV3
diff --git a/src/VBox/Main/cbinding/capiidl.xsl b/src/VBox/Main/cbinding/capiidl.xsl
index 7c23637..7c3635f 100644
--- a/src/VBox/Main/cbinding/capiidl.xsl
+++ b/src/VBox/Main/cbinding/capiidl.xsl
@@ -1357,10 +1357,10 @@ typedef struct VBOXCAPI
      * @param ppSession             output parameter for Session reference,
      *          owned by C bindings
      */
-    void  (*pfnComInitialize)(const char *pszVirtualBoxIID,
-                              IVirtualBox **ppVirtualBox,
-                              const char *pszSessionIID,
-                              ISession **ppSession);
+    void (*pfnComInitialize)(const char *pszVirtualBoxIID,
+                             IVirtualBox **ppVirtualBox,
+                             const char *pszSessionIID,
+                             ISession **ppSession);
     /**
      * Deprecated way to uninitialize the C bindings for an API client.
      * Kept for backwards compatibility and must be used if the C bindings
@@ -1372,7 +1372,7 @@ typedef struct VBOXCAPI
      *
      * @param pwsz          pointer to string to be freed
      */
-    void  (*pfnComUnallocString)(BSTR pwsz);
+    void (*pfnComUnallocString)(BSTR pwsz);
 #ifndef WIN32
     /** Legacy function, was always for freeing strings only. */
 #define pfnComUnallocMem(pv) pfnComUnallocString((BSTR)(pv))
@@ -1385,7 +1385,7 @@ typedef struct VBOXCAPI
      * @param ppszString    output string
      * @returns IPRT status code
      */
-    int   (*pfnUtf16ToUtf8)(CBSTR pwszString, char **ppszString);
+    int (*pfnUtf16ToUtf8)(CBSTR pwszString, char **ppszString);
     /**
      * Convert string from UTF-8 encoding to UTF-16 encoding.
      *
@@ -1393,19 +1393,19 @@ typedef struct VBOXCAPI
      * @param ppwszString   output string
      * @returns IPRT status code
      */
-    int   (*pfnUtf8ToUtf16)(const char *pszString, BSTR *ppwszString);
+    int (*pfnUtf8ToUtf16)(const char *pszString, BSTR *ppwszString);
     /**
      * Free memory returned by pfnUtf16ToUtf8. Do not use for anything else.
      *
      * @param pszString     string to be freed.
      */
-    void  (*pfnUtf8Free)(char *pszString);
+    void (*pfnUtf8Free)(char *pszString);
     /**
      * Free memory returned by pfnUtf8ToUtf16. Do not use for anything else.
      *
      * @param pwszString    string to be freed.
      */
-    void  (*pfnUtf16Free)(BSTR pwszString);
+    void (*pfnUtf16Free)(BSTR pwszString);
 
     /**
      * Create a safearray (used for passing arrays to COM/XPCOM)
@@ -1440,7 +1440,7 @@ typedef struct VBOXCAPI
      * Copy a safearray into a C array (for getting an output parameter)
      *
      * @param ppv           output pointer to newly created array, which has to
-     *          be freed with free().
+     *          be freed with pfnArrayOutFree.
      * @param pcb           number of bytes in the output buffer.
      * @param vt            variant type, defines the size of the elements
      * @param psa           pointer to safearray for getting the data
@@ -1451,7 +1451,7 @@ typedef struct VBOXCAPI
      * Copy a safearray into a C array (special variant for interface pointers)
      *
      * @param ppaObj        output pointer to newly created array, which has
-     *          to be freed with free(). Note that it's the caller's
+     *          to be freed with pfnArrayOutFree. Note that it's the caller's
      *          responsibility to call Release() on each non-NULL interface
      *          pointer before freeing.
      * @param pcObj         number of pointers in the output buffer.
@@ -1462,10 +1462,18 @@ typedef struct VBOXCAPI
     /**
      * Free a safearray
      *
-     * @param psa           pointer to safearray for getting the data
+     * @param psa           pointer to safearray
      * @returns COM/XPCOM error code
      */
     HRESULT (*pfnSafeArrayDestroy)(SAFEARRAY *psa);
+    /**
+     * Free an out array created by pfnSafeArrayCopyOutParamHelper or
+     * pdnSafeArrayCopyOutIfaceParamHelper.
+     *
+     * @param psa           pointer to memory block
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnArrayOutFree)(void *pv);
 
 #ifndef WIN32
     /**
@@ -1474,7 +1482,7 @@ typedef struct VBOXCAPI
      * @param ppEventQueue      output parameter for nsIEventQueue reference,
      *              owned by C bindings.
      */
-    void  (*pfnGetEventQueue)(nsIEventQueue **ppEventQueue);
+    void (*pfnGetEventQueue)(nsIEventQueue **ppEventQueue);
 #endif /* !WIN32 */
 
     /**
diff --git a/src/VBox/Main/cbinding/tstCAPIGlue.c b/src/VBox/Main/cbinding/tstCAPIGlue.c
index 5715a6f..c05ec30 100644
--- a/src/VBox/Main/cbinding/tstCAPIGlue.c
+++ b/src/VBox/Main/cbinding/tstCAPIGlue.c
@@ -1,4 +1,4 @@
-/* $Revision: 91907 $ */
+/* $Revision: 93190 $ */
 /** @file tstCAPIGlue.c
  * Demonstrator program to illustrate use of C bindings of Main API.
  *
@@ -739,6 +739,7 @@ static void startVM(const char *argv0, IVirtualBox *virtualBox, ISession *sessio
     IProgress *progress   = NULL;
     BSTR env              = NULL;
     BSTR sessionType;
+    SAFEARRAY *groupsSA = g_pVBoxFuncs->pfnSafeArrayOutParamAlloc();
 
     rc = IVirtualBox_FindMachine(virtualBox, id, &machine);
     if (FAILED(rc) || !machine)
@@ -747,6 +748,30 @@ static void startVM(const char *argv0, IVirtualBox *virtualBox, ISession *sessio
         return;
     }
 
+    rc = IMachine_get_Groups(machine, ComSafeArrayAsOutParam(groupsSA));
+    if (SUCCEEDED(rc))
+    {
+        BSTR *groups = NULL;
+        ULONG cbGroups = 0;
+        ULONG i, cGroups;
+        g_pVBoxFuncs->pfnSafeArrayCopyOutParamHelper((void **)&groups, &cbGroups, VT_BSTR, groupsSA);
+        cGroups = cbGroups / sizeof(groups[0]);
+        for (i = 0; i < cGroups; ++i)
+        {
+            /* Note that the use of %S might be tempting, but it is not
+             * available on all platforms, and even where it is usable it
+             * may depend on correct compiler options to make wchar_t a
+             * 16 bit number. So better play safe and use UTF-8. */
+            char *group;
+            g_pVBoxFuncs->pfnUtf16ToUtf8(groups[i], &group);
+            printf("Groups[%d]: %s\n", i, group);
+            g_pVBoxFuncs->pfnUtf8Free(group);
+        }
+        for (i = 0; i < cGroups; ++i)
+            g_pVBoxFuncs->pfnComUnallocString(groups[i]);
+        g_pVBoxFuncs->pfnArrayOutFree(groups);
+    }
+
     g_pVBoxFuncs->pfnUtf8ToUtf16("gui", &sessionType);
     rc = IMachine_LaunchVMProcess(machine, session, sessionType, env, &progress);
     g_pVBoxFuncs->pfnUtf16Free(sessionType);
@@ -834,6 +859,7 @@ static void listVMs(const char *argv0, IVirtualBox *virtualBox, ISession *sessio
 
     if (!machineCnt)
     {
+        g_pVBoxFuncs->pfnArrayOutFree(machines);
         printf("\tNo VMs\n");
         return;
     }
@@ -961,8 +987,7 @@ static void listVMs(const char *argv0, IVirtualBox *virtualBox, ISession *sessio
             IMachine_Release(machine);
         }
     }
-    if (machines)
-        free(machines);
+    g_pVBoxFuncs->pfnArrayOutFree(machines);
 }
 
 /* Main - Start the ball rolling. */
diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h
index 5e5cb69..a1c9a02 100644
--- a/src/VBox/Main/include/ConsoleImpl.h
+++ b/src/VBox/Main/include/ConsoleImpl.h
@@ -316,22 +316,20 @@ private:
     class AutoVMCallerBase
     {
     public:
-        AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(S_OK)
+        AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(E_FAIL)
         {
             Assert(aThat);
             mRC = aThat->addVMCaller(taQuiet, taAllowNullVM);
         }
         ~AutoVMCallerBase()
         {
-            if (SUCCEEDED(mRC))
-                mThat->releaseVMCaller();
+            doRelease();
         }
         /** Decreases the number of callers before the instance is destroyed. */
         void releaseCaller()
         {
-            AssertReturnVoid(SUCCEEDED(mRC));
-            mThat->releaseVMCaller();
-            mRC = E_FAIL;
+            Assert(SUCCEEDED(mRC));
+            doRelease();
         }
         /** Restores the number of callers after by #release(). #rc() must be
          *  rechecked to ensure the operation succeeded. */
@@ -346,8 +344,16 @@ private:
         bool isOk() const { return SUCCEEDED(mRC); }
     protected:
         Console *mThat;
-        HRESULT mRC;
+        void doRelease()
+        {
+            if (SUCCEEDED(mRC))
+            {
+                mThat->releaseVMCaller();
+                mRC = E_FAIL;
+            }
+        }
     private:
+        HRESULT mRC; /* Whether the caller was added. */
         DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoVMCallerBase)
     };
 
@@ -407,27 +413,40 @@ private:
     {
         typedef AutoVMCallerBase<taQuiet, true> Base;
     public:
-        SafeVMPtrBase(Console *aThat) : Base(aThat), mpUVM(NULL)
+        SafeVMPtrBase(Console *aThat) : Base(aThat), mRC(E_FAIL), mpUVM(NULL)
         {
-            if (SUCCEEDED(Base::mRC))
-                Base::mRC = aThat->safeVMPtrRetainer(&mpUVM, taQuiet);
+            if (Base::isOk())
+                mRC = aThat->safeVMPtrRetainer(&mpUVM, taQuiet);
         }
         ~SafeVMPtrBase()
         {
-            if (SUCCEEDED(Base::mRC))
-                release();
+            doRelease();
         }
         /** Direct PUVM access. */
         PUVM rawUVM() const { return mpUVM; }
         /** Release the handles. */
         void release()
         {
-            AssertReturnVoid(SUCCEEDED(Base::mRC));
-            Base::mThat->safeVMPtrReleaser(&mpUVM);
-            Base::releaseCaller();
+            Assert(SUCCEEDED(mRC));
+            doRelease();
         }
 
+        /** The combined result of Console::addVMCaller() and Console::safeVMPtrRetainer */
+        HRESULT rc() const { return Base::isOk()? mRC: Base::rc(); }
+        /** Shortcut to SUCCEEDED(rc()) */
+        bool isOk() const { return SUCCEEDED(mRC) && Base::isOk(); }
+
     private:
+        void doRelease()
+        {
+            if (SUCCEEDED(mRC))
+            {
+                Base::mThat->safeVMPtrReleaser(&mpUVM);
+                mRC = E_FAIL;
+            }
+            Base::doRelease();
+        }
+        HRESULT mRC; /* Whether the VM ptr was retained. */
         PUVM    mpUVM;
         DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase)
     };
diff --git a/src/VBox/Main/include/DisplayImpl.h b/src/VBox/Main/include/DisplayImpl.h
index 4bc1415..b0e0980 100644
--- a/src/VBox/Main/include/DisplayImpl.h
+++ b/src/VBox/Main/include/DisplayImpl.h
@@ -172,10 +172,10 @@ public:
     void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
     void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
 #endif
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     int  handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
                                         PFNCRCTLCOMPLETION pfnCompletion,
                                         void *pvCompletion);
-#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     void  handleCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
     void  handleCrVRecScreenshotPerform(uint32_t uScreen,
                                         uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
@@ -242,7 +242,7 @@ private:
     void destructCrHgsmiData(void);
 #endif
 
-#ifdef VBOX_WITH_CROGL
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     void crViewportNotify(class VMMDev *pVMMDev, ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
 #endif
 
@@ -271,11 +271,13 @@ private:
     static DECLCALLBACK(void)  displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
     static DECLCALLBACK(void)  displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
 #endif
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     static DECLCALLBACK(int)  displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
                                         struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
                                         PFNCRCTLCOMPLETION pfnCompletion,
                                         void *pvCompletion);
     static DECLCALLBACK(void)  displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+#endif
 #ifdef VBOX_WITH_HGSMI
     static DECLCALLBACK(int)   displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags);
     static DECLCALLBACK(void)  displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
@@ -368,10 +370,9 @@ private:
 public:
     static int  displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
 
-#ifdef VBOX_WITH_CROGL
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     static BOOL  displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
 #endif
-
 private:
     static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
     static int  drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
@@ -382,7 +383,7 @@ private:
     int  videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
     void videoAccelFlush(void);
 
-#ifdef VBOX_WITH_CROGL
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     int crOglWindowsShow(bool fShow);
 #endif
 
diff --git a/src/VBox/Main/src-all/win/comregister.cmd b/src/VBox/Main/src-all/win/comregister.cmd
index 65f51c3..7377544 100644
--- a/src/VBox/Main/src-all/win/comregister.cmd
+++ b/src/VBox/Main/src-all/win/comregister.cmd
@@ -24,21 +24,21 @@ REM Figure out where the script lives first, so that we can invoke the
 REM correct VBoxSVC and register the right VBoxC.dll.
 REM
 
-REM Determin the current directory.
+REM Determine the current directory.
 set _SCRIPT_CURDIR=%CD%
 for /f "tokens=*" %%d in ('cd') do set _SCRIPT_CURDIR=%%d
 
-REM Determin a correct self - by %0.
+REM Determine a correct self - by %0.
 set _SCRIPT_SELF=%0
 if exist "%_SCRIPT_SELF%" goto found_self
 set _SCRIPT_SELF=%_SCRIPT_SELF%.cmd
 if exist "%_SCRIPT_SELF%" goto found_self
 
-REM Determin a correct self - by current working directory.
+REM Determine a correct self - by current working directory.
 set _SCRIPT_SELF=%_SCRIPT_CURDIR%\comregister.cmd
 if exist "%_SCRIPT_SELF%" goto found_self
 
-REM Determin a correct self - by the PATH
+REM Determine a correct self - by the PATH
 REM This is very verbose because nested for loops didn't work out.
 for /f "tokens=1  delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
 if exist "%_SCRIPT_SELF%" goto found_self
@@ -111,12 +111,12 @@ REM Unregister both first, then register them. The order matters here.
 :register_amd64
 @echo on
 %_VBOX_DIR%VBoxSVC.exe /UnregServer
-%windir%\syswow64\regsvr32 /s /u %_VBOX_DIR%VBoxClient-x86.dll
+%windir%\syswow64\regsvr32 /s /u %_VBOX_DIR%x86\VBoxClient-x86.dll
 %windir%\system32\regsvr32 /s /u %_VBOX_DIR%VBoxC.dll
 @if "%1" == "-u" goto end
 %_VBOX_DIR%VBoxSVC.exe /RegServer
 %windir%\system32\regsvr32 /s    %_VBOX_DIR%VBoxC.dll
-%windir%\syswow64\regsvr32 /s    %_VBOX_DIR%VBoxClient-x86.dll
+%windir%\syswow64\regsvr32 /s    %_VBOX_DIR%x86\VBoxClient-x86.dll
 @echo off
 
 :end
diff --git a/src/VBox/Main/src-client/DisplayImpl.cpp b/src/VBox/Main/src-client/DisplayImpl.cpp
index 3477a07..2350ee5 100644
--- a/src/VBox/Main/src-client/DisplayImpl.cpp
+++ b/src/VBox/Main/src-client/DisplayImpl.cpp
@@ -314,7 +314,7 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
         uint32_t cx = 0;
         uint32_t cy = 0;
 
-#ifdef VBOX_WITH_CROGL
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
         BOOL f3DSnapshot = FALSE;
         BOOL is3denabled;
         that->mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled);
@@ -721,7 +721,7 @@ int Display::registerSSM(PUVM pUVM)
     return VINF_SUCCESS;
 }
 
-#ifdef VBOX_WITH_CROGL
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
 int Display::crOglWindowsShow(bool fShow)
 {
     if (!mfCrOglDataHidden == !!fShow)
@@ -2428,7 +2428,7 @@ STDMETHODIMP Display::SetFramebuffer(ULONG aScreenId, IFramebuffer *aFramebuffer
                 alock.acquire();
             }
         }
-#endif /* VBOX_WITH_CROGL */
+#endif /* #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) */
     }
     else
     {
@@ -2571,7 +2571,7 @@ STDMETHODIMP Display::SetSeamlessMode (BOOL enabled)
     return S_OK;
 }
 
-#ifdef VBOX_WITH_CROGL
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
 BOOL Display::displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height)
 {
     BOOL is3denabled;
@@ -3580,7 +3580,7 @@ int Display::updateDisplayData(void)
     return VINF_SUCCESS;
 }
 
-#ifdef VBOX_WITH_CROGL
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
 void Display::crViewportNotify(VMMDev *pVMMDev, ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height)
 {
 #if 0
@@ -4382,6 +4382,7 @@ DECLCALLBACK(void) Display::displayCrHgsmiControlCompletion(int32_t result, uint
 }
 #endif
 
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
 DECLCALLBACK(void)  Display::displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext)
 {
     VBOXCRCMDCTL *pCmd = (VBOXCRCMDCTL*)pParam->u.pointer.addr;
@@ -4424,7 +4425,6 @@ DECLCALLBACK(int)  Display::displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterf
     return pThis->handleCrHgcmCtlSubmit(pCmd, cbCmd, pfnCompletion, pvCompletion);
 }
 
-#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
 DECLCALLBACK(void)  Display::displayCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext)
 {
     Display *pDisplay = (Display *)pvContext;
@@ -5050,7 +5050,9 @@ DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint
     pThis->IConnector.pfnCrHgsmiCommandProcess = Display::displayCrHgsmiCommandProcess;
     pThis->IConnector.pfnCrHgsmiControlProcess = Display::displayCrHgsmiControlProcess;
 #endif
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     pThis->IConnector.pfnCrHgcmCtlSubmit       = Display::displayCrHgcmCtlSubmit;
+#endif
 #ifdef VBOX_WITH_HGSMI
     pThis->IConnector.pfnVBVAEnable            = Display::displayVBVAEnable;
     pThis->IConnector.pfnVBVADisable           = Display::displayVBVADisable;
diff --git a/src/VBox/Main/src-server/MachineImpl.cpp b/src/VBox/Main/src-server/MachineImpl.cpp
index d790591..6c94aaa 100644
--- a/src/VBox/Main/src-server/MachineImpl.cpp
+++ b/src/VBox/Main/src-server/MachineImpl.cpp
@@ -10172,7 +10172,7 @@ HRESULT Machine::prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
             // store the old and new so that VirtualBox::saveSettings() can update
             // the media registry
             if (    mData->mRegistered
-                 && configDir != newConfigDir)
+                 && (configDir != newConfigDir || configFile != newConfigFile))
             {
                 mParent->rememberMachineNameChangeForMedia(configDir, newConfigDir);
 
diff --git a/src/VBox/Main/src-server/darwin/iokit.cpp b/src/VBox/Main/src-server/darwin/iokit.cpp
index 69c572f..b4ee60e 100644
--- a/src/VBox/Main/src-server/darwin/iokit.cpp
+++ b/src/VBox/Main/src-server/darwin/iokit.cpp
@@ -38,6 +38,7 @@
 #ifdef VBOX_WITH_USB
 # include <IOKit/usb/IOUSBLib.h>
 # include <IOKit/IOCFPlugIn.h>
+# include <IOKit/storage/IOMedia.h>
 #endif
 
 #include <VBox/log.h>
@@ -274,7 +275,7 @@ static bool darwinDictDupString(CFDictionaryRef DictRef, CFStringRef KeyStrRef,
     char szBuf[512];
     if (darwinDictGetString(DictRef, KeyStrRef, szBuf, sizeof(szBuf)))
     {
-        *ppsz = RTStrDup(RTStrStrip(szBuf));
+        *ppsz = RTStrDup(szBuf);
         if (*ppsz)
             return true;
     }
@@ -736,13 +737,28 @@ static io_object_t darwinFindObjectByClass(io_object_t Object, const char *pszCl
  */
 static bool darwinIsMassStorageInterfaceInUse(io_object_t MSDObj, io_name_t pszNameBuf)
 {
-    io_object_t MediaObj = darwinFindObjectByClass(MSDObj, "IOMedia", pszNameBuf);
+    io_object_t MediaObj = darwinFindObjectByClass(MSDObj, kIOMediaClass, pszNameBuf);
     if (MediaObj)
     {
+        CFMutableDictionaryRef pProperties;
+        kern_return_t krc;
+        bool fInUse = true;
+
+        krc = IORegistryEntryCreateCFProperties(MediaObj, &pProperties, kCFAllocatorDefault, kNilOptions);
+        if (krc == KERN_SUCCESS)
+        {
+            CFBooleanRef pBoolValue = (CFBooleanRef)CFDictionaryGetValue(pProperties, CFSTR(kIOMediaOpenKey));
+            if (pBoolValue)
+                fInUse = CFBooleanGetValue(pBoolValue);
+
+            CFRelease(pProperties);
+        }
+
         /* more checks? */
         IOObjectRelease(MediaObj);
-        return true;
+        return fInUse;
     }
+
     return false;
 }
 
diff --git a/src/VBox/Main/src-server/linux/USBGetDevices.cpp b/src/VBox/Main/src-server/linux/USBGetDevices.cpp
index b4ef0df..f0aeedd 100644
--- a/src/VBox/Main/src-server/linux/USBGetDevices.cpp
+++ b/src/VBox/Main/src-server/linux/USBGetDevices.cpp
@@ -1420,8 +1420,8 @@ static void *testDLSym(void *handle, const char *symbol)
     if (!s_fHaveInotifyLibC)
         return NULL;
     if (s_fHaveInotifyKernel)
-        return (void *)testInotifyInitGood;
-    return (void *)testInotifyInitBad;
+        return (void *)(uintptr_t)testInotifyInitGood;
+    return (void *)(uintptr_t)testInotifyInitBad;
 }
 
 void TestUSBSetInotifyAvailable(bool fHaveInotifyLibC, bool fHaveInotifyKernel)
diff --git a/src/VBox/Main/src-server/win/HostPowerWin.cpp b/src/VBox/Main/src-server/win/HostPowerWin.cpp
index 34826f9..ff0f5dd 100644
--- a/src/VBox/Main/src-server/win/HostPowerWin.cpp
+++ b/src/VBox/Main/src-server/win/HostPowerWin.cpp
@@ -53,8 +53,8 @@ HostPowerServiceWin::~HostPowerServiceWin()
 
         /* Is this allowed from another thread? */
         SetWindowLongPtr(mHwnd, 0, 0);
-        /* Send the quit message and wait for it be processed. */
-        SendMessage(mHwnd, WM_QUIT, 0, 0);
+        /* Poke the thread out of the event loop and wait for it to clean up. */
+        PostMessage(mHwnd, WM_QUIT, 0, 0);
         RTThreadWait(mThread, 5000, NULL);
         mThread = NIL_RTTHREAD;
     }
@@ -113,10 +113,19 @@ DECLCALLBACK(int) HostPowerServiceWin::NotificationThread(RTTHREAD ThreadSelf, v
                          SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE);
 
             MSG msg;
-            while (GetMessage(&msg, NULL, 0, 0))
+            BOOL fRet;
+            while ((fRet = GetMessage(&msg, NULL, 0, 0)) != 0)
             {
-                TranslateMessage(&msg);
-                DispatchMessage(&msg);
+                if (fRet != -1)
+                {
+                    TranslateMessage(&msg);
+                    DispatchMessage(&msg);
+                }
+                else
+                {
+                    // handle the error and possibly exit
+                    break;
+                }
             }
         }
     }
diff --git a/src/VBox/Main/src-server/win/svcmain.cpp b/src/VBox/Main/src-server/win/svcmain.cpp
index 5e2c251..b04093f 100644
--- a/src/VBox/Main/src-server/win/svcmain.cpp
+++ b/src/VBox/Main/src-server/win/svcmain.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2004-2012 Oracle Corporation
+ * Copyright (C) 2004-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -56,7 +56,7 @@ public:
 };
 
 const DWORD dwTimeOut = 5000; /* time for EXE to be idle before shutting down */
-const DWORD dwPause = 1000; /* time to wait for threads to finish up */
+const DWORD dwPause = 100; /* time to wait for threads to finish up */
 
 /* Passed to CreateThread to monitor the shutdown event */
 static DWORD WINAPI MonitorProc(void* pv)
diff --git a/src/VBox/NetworkServices/NAT/proxy.c b/src/VBox/NetworkServices/NAT/proxy.c
index 537ae85..eed93da 100644
--- a/src/VBox/NetworkServices/NAT/proxy.c
+++ b/src/VBox/NetworkServices/NAT/proxy.c
@@ -178,8 +178,8 @@ proxy_create_socket(int sdom, int stype)
     {
         int sflags;
 
-        status = fcntl(s, F_GETFL, &sflags);
-        if (status < 0) {
+        sflags = fcntl(s, F_GETFL, 0);
+        if (sflags < 0) {
             perror("F_GETFL");
             closesocket(s);
             return INVALID_SOCKET;
diff --git a/src/VBox/Runtime/Makefile.kmk b/src/VBox/Runtime/Makefile.kmk
index eb7e12a..4cd2511 100644
--- a/src/VBox/Runtime/Makefile.kmk
+++ b/src/VBox/Runtime/Makefile.kmk
@@ -1427,6 +1427,7 @@ endif # linux
 #
 VBoxRT-x86_EXTENDS = VBoxRT
 VBoxRT-x86_TEMPLATE = VBoxR3Dll-x86
+VBoxRT-x86_INST.win = $(INST_DLL)x86/
 VBoxRT-x86_SDKS  = VBOX_LIBXML2
 ifdef VBOX_WITH_LIBCURL
  VBoxRT-x86_SDKS += VBOX_LIBCURL-x86
@@ -2506,7 +2507,7 @@ if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
 		'd'
 # Find the best way to generate a symbol list and subject it to mangling.h.
   if $(intersects $(KBUILD_TARGET), linux) && "$(VBOX_GCC_fvisibility-hidden)"
-	$(call MSG_L1,IPRT: Testing mangling and visiblity...)
+	$(call MSG_L1,IPRT: Testing mangling and visiblity for newer gcc...)
 	@readelf -Ws $^ \
 		| $(SED) \
 			-e '/^  *[[:digit:]]\+:/!d' \
@@ -2555,9 +2556,9 @@ if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
 			-e '/^VBoxHost_/d'\
 			-e '/^VBoxGuest_/d'\
 		| $(SED) -nf "$@"
-  else
-	$(call MSG_L1,IPRT: Testing mangling...)
-	nm $^ 	| $(SED) -n \
+  endif
+	$(call MSG_L1,IPRT: Testing mangling for older gcc...)
+	@nm $^ 	| $(SED) -n \
 			-e 's/^[0-9a-f][0-9a-f]* //' \
 			-e '/^[TUDB] /!d' \
 			-e 's/^. //' \
@@ -2578,7 +2579,6 @@ if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
 			-e '/^RT/p' \
 			-e '/^g_/p' \
 		| $(SED) -nf "$@"
-  endif
  endif
 endif
 	$(QUIET)$(APPEND) -t $@
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
index 1e4bb0b..4274c30 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
@@ -42,9 +42,9 @@ BEGINCODE
 BEGINPROC_EXPORTED ASMAtomicUoAndU32
 %ifdef RT_ARCH_AMD64
  %ifdef ASM_CALL64_MSC
-        and     [rcx], rdx
+        and     [rcx], edx
  %else
-        and     [rdi], rsi
+        and     [rdi], esi
  %endif
 %elifdef RT_ARCH_X86
         mov     ecx, [esp + 04h]
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
index efd63e5..6266a66 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
@@ -42,9 +42,9 @@ BEGINCODE
 BEGINPROC_EXPORTED ASMAtomicUoOrU32
 %ifdef RT_ARCH_AMD64
  %ifdef ASM_CALL64_MSC
-        or      [rcx], rdx
+        or      [rcx], edx
  %else
-        or      [rdi], rsi
+        or      [rdi], esi
  %endif
 %elifdef RT_ARCH_X86
         mov     ecx, [esp + 04h]
diff --git a/src/VBox/Runtime/common/log/log.cpp b/src/VBox/Runtime/common/log/log.cpp
index ed87266..944895c 100644
--- a/src/VBox/Runtime/common/log/log.cpp
+++ b/src/VBox/Runtime/common/log/log.cpp
@@ -293,6 +293,14 @@ static struct
     { "user",     sizeof("user"    ) - 1,  RTLOGDEST_USER },
 };
 
+/**
+ * Log rotation backoff table, important on Windows host, especially for
+ * VBoxSVC release logging. Only a medium term solution, until a proper fix
+ * for log file handling is available. 10 seconds total.
+ */
+static const uint32_t s_aLogBackoff[] =
+{ 10, 10, 10, 20, 50, 100, 200, 200, 200, 200, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000 };
+
 
 /**
  * Locks the logger instance.
@@ -2077,24 +2085,27 @@ RTDECL(int) RTLogGetDestinations(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf)
         char szNum[32];
         if (pLogger->pInt->cHistory)
         {
-            RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "history=%u" : " history=%u", pLogger->pInt->cHistory);
+            RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? " history=%u" : "history=%u", pLogger->pInt->cHistory);
             rc = RTStrCopyP(&pszBuf, &cchBuf, szNum);
             if (RT_FAILURE(rc))
                 return rc;
+            fNotFirst = true;
         }
         if (pLogger->pInt->cbHistoryFileMax != UINT64_MAX)
         {
-            RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "histsize=%llu" : " histsize=%llu", pLogger->pInt->cbHistoryFileMax);
+            RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? " histsize=%llu" : "histsize=%llu", pLogger->pInt->cbHistoryFileMax);
             rc = RTStrCopyP(&pszBuf, &cchBuf, szNum);
             if (RT_FAILURE(rc))
                 return rc;
+            fNotFirst = true;
         }
         if (pLogger->pInt->cSecsHistoryTimeSlot != UINT32_MAX)
         {
-            RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? "histtime=%llu" : " histtime=%llu", pLogger->pInt->cSecsHistoryTimeSlot);
+            RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? " histtime=%llu" : "histtime=%llu", pLogger->pInt->cSecsHistoryTimeSlot);
             rc = RTStrCopyP(&pszBuf, &cchBuf, szNum);
             if (RT_FAILURE(rc))
                 return rc;
+            fNotFirst = true;
         }
     }
 # endif /* IN_RING3 */
@@ -2609,7 +2620,7 @@ RT_EXPORT_SYMBOL(RTLogPrintfV);
  */
 static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMsg)
 {
-    uint32_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE;
+    uint32_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_NONE;
     if (pLogger->fFlags & RTLOGFLAGS_APPEND)
         fOpen |= RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND;
     else
@@ -2617,7 +2628,20 @@ static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMs
     if (pLogger->fFlags & RTLOGFLAGS_WRITE_THROUGH)
         fOpen |= RTFILE_O_WRITE_THROUGH;
 
-    int rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen);
+    int rc;
+    unsigned cBackoff = 0;
+    do
+    {
+        rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen);
+        if (rc == VERR_SHARING_VIOLATION)
+        {
+            if (cBackoff >= RT_ELEMENTS(s_aLogBackoff))
+                break;
+            RTThreadSleep(s_aLogBackoff[cBackoff]);
+            cBackoff++;
+        }
+    }
+    while (rc == VERR_SHARING_VIOLATION);
     if (RT_FAILURE(rc))
     {
         pLogger->pInt->hFile = NIL_RTFILE;
@@ -2709,8 +2733,24 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
 
             char szNewName[sizeof(pLogger->pInt->szFilename) + 32];
             RTStrPrintf(szNewName, sizeof(szNewName), "%s.%u", pLogger->pInt->szFilename, i + 1);
-            if (   RTFileRename(szOldName, szNewName, RTFILEMOVE_FLAGS_REPLACE)
-                == VERR_FILE_NOT_FOUND)
+
+
+
+            int rc;
+            unsigned cBackoff = 0;
+            do
+            {
+                rc = RTFileRename(szOldName, szNewName, RTFILEMOVE_FLAGS_REPLACE);
+                if (rc == VERR_SHARING_VIOLATION)
+                {
+                    if (cBackoff >= RT_ELEMENTS(s_aLogBackoff))
+                        break;
+                    RTThreadSleep(s_aLogBackoff[cBackoff]);
+                    cBackoff++;
+                }
+            }
+            while (rc == VERR_SHARING_VIOLATION);
+            if (rc == VERR_FILE_NOT_FOUND)
                 RTFileDelete(szNewName);
         }
 
diff --git a/src/VBox/Runtime/common/string/utf-16.cpp b/src/VBox/Runtime/common/string/utf-16.cpp
index 9386b5d..2a1eb95 100644
--- a/src/VBox/Runtime/common/string/utf-16.cpp
+++ b/src/VBox/Runtime/common/string/utf-16.cpp
@@ -38,6 +38,66 @@
 #include "internal/string.h"
 
 
+/**
+ * Get get length in code points of an UTF-16 encoded string, validating the
+ * string while doing so.
+ *
+ * @returns IPRT status code.
+ * @param   pwsz            Pointer to the UTF-16 string.
+ * @param   cwc             The max length of the string in UTF-16 units.  Use
+ *                          RTSTR_MAX if all of the string is to be examined.
+ * @param   pcuc            Where to store the length in unicode code points.
+ * @param   pcwcActual      Where to store the actual size of the UTF-16 string
+ *                          on success. Optional.
+ */
+static int rtUtf16Length(PCRTUTF16 pwsz, size_t cwc, size_t *pcuc, size_t *pcwcActual)
+{
+    PCRTUTF16 pwszStart   = pwsz;
+    size_t    cCodePoints = 0;
+    while (cwc > 0)
+    {
+        RTUTF16 wc = *pwsz;
+        if (!wc)
+            break;
+        if (wc < 0xd800 || wc > 0xdfff)
+        {
+            cCodePoints++;
+            pwsz++;
+            cwc--;
+        }
+        /* Surrogate pair: */
+        else if (wc >= 0xdc00)
+        {
+            RTStrAssertMsgFailed(("Lone UTF-16 trail surrogate: %#x (%.*Rhxs)\n", wc, RT_MIN(cwc * 2, 10), pwsz));
+            return VERR_INVALID_UTF16_ENCODING;
+        }
+        else if (cwc < 2)
+        {
+            RTStrAssertMsgFailed(("Lone UTF-16 lead surrogate: %#x\n", wc));
+            return VERR_INVALID_UTF16_ENCODING;
+        }
+        else
+        {
+            RTUTF16 wcTrail = pwsz[1];
+            if (wcTrail < 0xdc00 || wcTrail > 0xdfff)
+            {
+                RTStrAssertMsgFailed(("Invalid UTF-16 trail surrogate: %#x (lead %#x)\n", wcTrail, wc));
+                return VERR_INVALID_UTF16_ENCODING;
+            }
+
+            cCodePoints++;
+            pwsz += 2;
+            cwc -= 2;
+        }
+    }
+
+    /* done */
+    *pcuc = cCodePoints;
+    if (pcwcActual)
+        *pcwcActual = pwsz - pwszStart;
+    return VINF_SUCCESS;
+}
+
 
 RTDECL(void)  RTUtf16Free(PRTUTF16 pwszString)
 {
@@ -249,6 +309,55 @@ RTDECL(PRTUTF16) RTUtf16ToUpper(PRTUTF16 pwsz)
 RT_EXPORT_SYMBOL(RTUtf16ToUpper);
 
 
+RTDECL(int) RTUtf16ValidateEncoding(PCRTUTF16 pwsz)
+{
+    return RTUtf16ValidateEncodingEx(pwsz, RTSTR_MAX, 0);
+}
+RT_EXPORT_SYMBOL(RTUtf16ValidateEncoding);
+
+
+RTDECL(int) RTUtf16ValidateEncodingEx(PCRTUTF16 pwsz, size_t cwc, uint32_t fFlags)
+{
+    AssertReturn(!(fFlags & ~(RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED | RTSTR_VALIDATE_ENCODING_EXACT_LENGTH)),
+                 VERR_INVALID_PARAMETER);
+    AssertPtr(pwsz);
+
+    /*
+     * Use rtUtf16Length for the job.
+     */
+    size_t cwcActual = 0; /* Shut up cc1plus. */
+    size_t cCpsIgnored;
+    int rc = rtUtf16Length(pwsz, cwc, &cCpsIgnored, &cwcActual);
+    if (RT_SUCCESS(rc))
+    {
+        if (fFlags & RTSTR_VALIDATE_ENCODING_EXACT_LENGTH)
+        {
+            if (fFlags & RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED)
+                cwcActual++;
+            if (cwcActual == cwc)
+                rc = VINF_SUCCESS;
+            else if (cwcActual < cwc)
+                rc = VERR_BUFFER_UNDERFLOW;
+            else
+                rc = VERR_BUFFER_OVERFLOW;
+        }
+        else if (    (fFlags & RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED)
+                 &&  cwcActual >= cwc)
+            rc = VERR_BUFFER_OVERFLOW;
+    }
+    return rc;
+}
+RT_EXPORT_SYMBOL(RTUtf16ValidateEncodingEx);
+
+
+RTDECL(bool) RTUtf16IsValidEncoding(PCRTUTF16 pwsz)
+{
+    int rc = RTUtf16ValidateEncodingEx(pwsz, RTSTR_MAX, 0);
+    return RT_SUCCESS(rc);
+}
+RT_EXPORT_SYMBOL(RTUtf16IsValidEncoding);
+
+
 RTDECL(ssize_t) RTUtf16PurgeComplementSet(PRTUTF16 pwsz, PCRTUNICP puszValidSet, char chReplacement)
 {
     size_t cReplacements = 0;
diff --git a/src/VBox/Runtime/common/string/utf-8.cpp b/src/VBox/Runtime/common/string/utf-8.cpp
index fdeb505..bb782a7 100644
--- a/src/VBox/Runtime/common/string/utf-8.cpp
+++ b/src/VBox/Runtime/common/string/utf-8.cpp
@@ -300,7 +300,8 @@ RT_EXPORT_SYMBOL(RTStrValidateEncoding);
 
 RTDECL(int) RTStrValidateEncodingEx(const char *psz, size_t cch, uint32_t fFlags)
 {
-    AssertReturn(!(fFlags & ~(RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED)), VERR_INVALID_PARAMETER);
+    AssertReturn(!(fFlags & ~(RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED | RTSTR_VALIDATE_ENCODING_EXACT_LENGTH)),
+                 VERR_INVALID_PARAMETER);
     AssertPtr(psz);
 
     /*
@@ -311,8 +312,19 @@ RTDECL(int) RTStrValidateEncodingEx(const char *psz, size_t cch, uint32_t fFlags
     int rc = rtUtf8Length(psz, cch, &cCpsIgnored, &cchActual);
     if (RT_SUCCESS(rc))
     {
-        if (    (fFlags & RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED)
-            &&  cchActual >= cch)
+        if (fFlags & RTSTR_VALIDATE_ENCODING_EXACT_LENGTH)
+        {
+            if (fFlags & RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED)
+                cchActual++;
+            if (cchActual == cch)
+                rc = VINF_SUCCESS;
+            else if (cchActual < cch)
+                rc = VERR_BUFFER_UNDERFLOW;
+            else
+                rc = VERR_BUFFER_OVERFLOW;
+        }
+        else if (    (fFlags & RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED)
+                 &&  cchActual >= cch)
             rc = VERR_BUFFER_OVERFLOW;
     }
     return rc;
diff --git a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
index 4fd2d0e..c7f2898 100644
--- a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
@@ -113,11 +113,18 @@ static int rtCheckCredentials(const char *pszUser, const char *pszPasswd, gid_t
     if (spwd)
         pw->pw_passwd = spwd->sp_pwdp;
 
-    /* be reentrant */
-    struct crypt_data *data = (struct crypt_data*)RTMemTmpAllocZ(sizeof(*data));
-    char *pszEncPasswd = crypt_r(pszPasswd, pw->pw_passwd, data);
-    int fCorrect = !strcmp(pszEncPasswd, pw->pw_passwd);
-    RTMemTmpFree(data);
+    /* Default fCorrect=true if no password specified. In that case, pw->pw_passwd
+     * must be NULL (no password set for this user). Fail if a password is specified
+     * but the user does not have one assigned. */
+    int fCorrect = !pszPasswd || !*pszPasswd;
+    if (pw->pw_passwd && *pw->pw_passwd)
+    {
+        struct crypt_data *data = (struct crypt_data*)RTMemTmpAllocZ(sizeof(*data));
+        /* be reentrant */
+        char *pszEncPasswd = crypt_r(pszPasswd, pw->pw_passwd, data);
+        fCorrect = pszEncPasswd && !strcmp(pszEncPasswd, pw->pw_passwd);
+        RTMemTmpFree(data);
+    }
     if (!fCorrect)
         return VERR_PERMISSION_DENIED;
 
diff --git a/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp b/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp
index 28c3462..0a08ea9 100644
--- a/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp
+++ b/src/VBox/Runtime/r3/win/RTSystemQueryOSInfo-win.cpp
@@ -260,8 +260,13 @@ static int rtSystemWinQueryOSVersion(RTSYSOSINFO enmInfo, char *pszInfo, size_t
             else if (g_WinOsInfoEx.szCSDVersion[0])
             {
                 /* just copy the entire string. */
-                memcpy(szTmp, g_WinOsInfoEx.szCSDVersion, sizeof(g_WinOsInfoEx.szCSDVersion));
-                szTmp[sizeof(g_WinOsInfoEx.szCSDVersion)] = '\0';
+                char *pszTmp = szTmp;
+                int rc = RTUtf16ToUtf8Ex(g_WinOsInfoEx.szCSDVersion, RT_ELEMENTS(g_WinOsInfoEx.szCSDVersion),
+                                         &pszTmp, sizeof(szTmp), NULL);
+                if (RT_SUCCESS(rc))
+                    RTStrStripR(szTmp);
+                else
+                    szTmp[0] = '\0';
                 AssertCompile(sizeof(szTmp) > sizeof(g_WinOsInfoEx.szCSDVersion));
             }
             else
diff --git a/src/VBox/Runtime/r3/win/init-win.cpp b/src/VBox/Runtime/r3/win/init-win.cpp
index e40adf6..0f00d9b 100644
--- a/src/VBox/Runtime/r3/win/init-win.cpp
+++ b/src/VBox/Runtime/r3/win/init-win.cpp
@@ -47,15 +47,15 @@
 *   Global Variables                                                           *
 *******************************************************************************/
 /** Windows DLL loader protection level. */
-DECLHIDDEN(RTR3WINLDRPROT)  g_enmWinLdrProt = RTR3WINLDRPROT_NONE;
+DECLHIDDEN(RTR3WINLDRPROT)      g_enmWinLdrProt = RTR3WINLDRPROT_NONE;
 /** Our simplified windows version.    */
-DECLHIDDEN(RTWINOSTYPE)     g_enmWinVer = kRTWinOSType_UNKNOWN;
+DECLHIDDEN(RTWINOSTYPE)         g_enmWinVer = kRTWinOSType_UNKNOWN;
 /** Extended windows version information. */
-DECLHIDDEN(OSVERSIONINFOEX) g_WinOsInfoEx;
+DECLHIDDEN(OSVERSIONINFOEXW)    g_WinOsInfoEx;
 /** The native kernel32.dll handle. */
-DECLHIDDEN(HMODULE)         g_hModKernel32 = NULL;
+DECLHIDDEN(HMODULE)             g_hModKernel32 = NULL;
 /** The native ntdll.dll handle. */
-DECLHIDDEN(HMODULE)         g_hModNtDll = NULL;
+DECLHIDDEN(HMODULE)             g_hModNtDll = NULL;
 
 
 
@@ -91,7 +91,7 @@ CE 2.1         3              2               1
 CE 3.0         3              3               0
 </pre>
  */
-static RTWINOSTYPE rtR3InitWinSimplifiedVersion(OSVERSIONINFOEX const *pOSInfoEx)
+static RTWINOSTYPE rtR3InitWinSimplifiedVersion(OSVERSIONINFOEXW const *pOSInfoEx)
 {
     RTWINOSTYPE enmVer         = kRTWinOSType_UNKNOWN;
     BYTE  const bProductType   = pOSInfoEx->wProductType;
@@ -168,37 +168,67 @@ static RTWINOSTYPE rtR3InitWinSimplifiedVersion(OSVERSIONINFOEX const *pOSInfoEx
 }
 
 
-DECLHIDDEN(int) rtR3InitNativeObtrusiveWorker(void)
+/**
+ * Initializes the global variables related to windows version.
+ */
+static void rtR3InitWindowsVersion(void)
 {
-    /*
-     * Disable error popups.
-     */
-    UINT fOldErrMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
-    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX | fOldErrMode);
+    Assert(g_hModNtDll != NULL);
 
     /*
-     * Query the Windows version.
      * ASSUMES OSVERSIONINFOEX starts with the exact same layout as OSVERSIONINFO (safe).
      */
     AssertCompileMembersSameSizeAndOffset(OSVERSIONINFOEX, szCSDVersion, OSVERSIONINFO, szCSDVersion);
     AssertCompileMemberOffset(OSVERSIONINFOEX, wServicePackMajor, sizeof(OSVERSIONINFO));
+
+    /*
+     * Use the NT version of GetVersionExW so we don't get fooled by
+     * compatability shims.
+     */
     RT_ZERO(g_WinOsInfoEx);
-    g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    if (!GetVersionExA((POSVERSIONINFOA)&g_WinOsInfoEx))
+    g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
+
+    LONG (__stdcall *pfnRtlGetVersion)(OSVERSIONINFOEXW *);
+    *(FARPROC *)&pfnRtlGetVersion = GetProcAddress(g_hModNtDll, "RtlGetVersion");
+    LONG rcNt = -1;
+    if (pfnRtlGetVersion)
+        rcNt = pfnRtlGetVersion(&g_WinOsInfoEx);
+    if (rcNt != 0)
     {
-        /* Fallback, just get the basic info. */
+        /*
+         * Couldn't find it or it failed, try the windows version of the API.
+         */
         RT_ZERO(g_WinOsInfoEx);
-        g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-        if (GetVersionExA((POSVERSIONINFOA)&g_WinOsInfoEx))
-            Assert(g_WinOsInfoEx.dwPlatformId != VER_PLATFORM_WIN32_NT || g_WinOsInfoEx.dwMajorVersion < 5);
-        else
+        g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
+        if (!GetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx))
         {
-            AssertBreakpoint();
+            /*
+             * If that didn't work either, just get the basic version bits.
+             */
             RT_ZERO(g_WinOsInfoEx);
+            g_WinOsInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
+            if (GetVersionExW((POSVERSIONINFOW)&g_WinOsInfoEx))
+                Assert(g_WinOsInfoEx.dwPlatformId != VER_PLATFORM_WIN32_NT || g_WinOsInfoEx.dwMajorVersion < 5);
+            else
+            {
+                AssertBreakpoint();
+                RT_ZERO(g_WinOsInfoEx);
+            }
         }
     }
+
     if (g_WinOsInfoEx.dwOSVersionInfoSize)
         g_enmWinVer = rtR3InitWinSimplifiedVersion(&g_WinOsInfoEx);
+}
+
+
+static int rtR3InitNativeObtrusiveWorker(void)
+{
+    /*
+     * Disable error popups.
+     */
+    UINT fOldErrMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
+    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX | fOldErrMode);
 
     /*
      * Restrict DLL searching for the process on windows versions which allow
@@ -251,6 +281,8 @@ DECLHIDDEN(int) rtR3InitNativeFirst(uint32_t fFlags)
     if (g_hModNtDll == NULL)
         return VERR_INTERNAL_ERROR_2;
 
+    rtR3InitWindowsVersion();
+
     int rc = VINF_SUCCESS;
     if (!(fFlags & RTR3INIT_FLAGS_UNOBTRUSIVE))
         rc = rtR3InitNativeObtrusiveWorker();
diff --git a/src/VBox/Runtime/r3/win/internal-r3-win.h b/src/VBox/Runtime/r3/win/internal-r3-win.h
index efec00a..fdbd932 100644
--- a/src/VBox/Runtime/r3/win/internal-r3-win.h
+++ b/src/VBox/Runtime/r3/win/internal-r3-win.h
@@ -59,12 +59,12 @@ typedef enum RTR3WINLDRPROT
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
-extern DECLHIDDEN(RTR3WINLDRPROT)  g_enmWinLdrProt;
-extern DECLHIDDEN(RTWINOSTYPE)     g_enmWinVer;
+extern DECLHIDDEN(RTR3WINLDRPROT)   g_enmWinLdrProt;
+extern DECLHIDDEN(RTWINOSTYPE)      g_enmWinVer;
 #ifdef _WINDEF_
-extern DECLHIDDEN(HMODULE)         g_hModKernel32;
-extern DECLHIDDEN(HMODULE)         g_hModNtDll;
-extern DECLHIDDEN(OSVERSIONINFOEX) g_WinOsInfoEx;
+extern DECLHIDDEN(HMODULE)          g_hModKernel32;
+extern DECLHIDDEN(HMODULE)          g_hModNtDll;
+extern DECLHIDDEN(OSVERSIONINFOEXW) g_WinOsInfoEx;
 #endif
 
 
diff --git a/src/VBox/Storage/VHD.cpp b/src/VBox/Storage/VHD.cpp
index c563a26..3017031 100644
--- a/src/VBox/Storage/VHD.cpp
+++ b/src/VBox/Storage/VHD.cpp
@@ -439,19 +439,12 @@ static int vhdDynamicHeaderUpdate(PVHDIMAGE pImage)
     for (i = 0; i < VHD_MAX_LOCATOR_ENTRIES; i++)
     {
         /* Skip empty locators */
-        if (ddh.ParentLocatorEntry[i].u32Code != RT_H2BE_U32(VHD_PLATFORM_CODE_NONE))
+        if (   ddh.ParentLocatorEntry[i].u32Code != RT_H2BE_U32(VHD_PLATFORM_CODE_NONE)
+            && pImage->pszParentFilename)
         {
-            if (pImage->pszParentFilename)
-            {
-                rc = vhdLocatorUpdate(pImage, &ddh.ParentLocatorEntry[i], pImage->pszParentFilename);
-                if (RT_FAILURE(rc))
-                    return rc;
-            }
-            else
-            {
-                /* The parent was deleted. */
-                ddh.ParentLocatorEntry[i].u32Code = RT_H2BE_U32(VHD_PLATFORM_CODE_NONE);
-            }
+            rc = vhdLocatorUpdate(pImage, &ddh.ParentLocatorEntry[i], pImage->pszParentFilename);
+            if (RT_FAILURE(rc))
+                return rc;
         }
     }
     /* Update parent's UUID */
diff --git a/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp b/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
index c34a3d4..4d51393 100644
--- a/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
+++ b/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
@@ -199,12 +199,16 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PlatformId(PVMCPU pVCpu, uint32_t idMsr,
 static DECLCALLBACK(int) cpumMsrRd_Ia32ApicBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     PVM pVM = pVCpu->CTX_SUFF(pVM);
+#if 0 /** @todo Sort this one out properly.  Evidence from ticks 12240 and 12875 suggest the apic base is still readable even
+       * after the apic has been diabled.  That makes common sense too.  What we need to do here, though, is check whether
+       * there is an APIC device associated with the VM, and GP if there isn't.  But that's for later. */
     if (   !pVM->cpum.s.GuestFeatures.fApic
         && !pVM->cpum.s.GuestFeatures.fX2Apic)
     {
         Log(("CPUM: %s, apic not present -> GP\n", pRange->szName));
         return VERR_CPUM_RAISE_GP_0;
     }
+#endif
 
     *puValue = pVCpu->cpum.s.Guest.msrApicBase;
     return VINF_SUCCESS;
@@ -563,7 +567,11 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32SysEnterEip(PVMCPU pVCpu, uint32_t idMsr,
         pVCpu->cpum.s.Guest.SysEnter.eip = uValue;
         return VINF_SUCCESS;
     }
+#ifdef IN_RING3
+    LogRel(("CPUM: IA32_SYSENTER_EIP not canonical! %#llx\n", uValue));
+#else
     Log(("CPUM: IA32_SYSENTER_EIP not canonical! %#llx\n", uValue));
+#endif
     return VERR_CPUM_RAISE_GP_0;
 }
 
diff --git a/src/VBox/VMM/VMMAll/IEMAll.cpp b/src/VBox/VMM/VMMAll/IEMAll.cpp
index 8f4c26a..715f73e 100644
--- a/src/VBox/VMM/VMMAll/IEMAll.cpp
+++ b/src/VBox/VMM/VMMAll/IEMAll.cpp
@@ -2354,7 +2354,7 @@ iemRaiseXcptOrIntInProtMode(PIEMCPU     pIemCpu,
 
         case X86_SEL_TYPE_SYS_TASK_GATE:
             /** @todo task gates. */
-            AssertFailedReturn(VERR_NOT_SUPPORTED);
+            IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Task gates\n")); /** @todo Implement task gate support. */
 
         case X86_SEL_TYPE_SYS_286_TRAP_GATE:
             f32BitGate = false;
diff --git a/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h b/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h
index 0c5557b..8da33fc 100644
--- a/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h
+++ b/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h
@@ -6,6 +6,7 @@
  * @remarks Possible that we're missing a few special MSRs due to no                                                                      .
  *          magic register value capabilities in the linux hosted                                                                         .
  *          MSR probing code.
+ * @todo Regenerate this using windows/whatever where we can get to the secret AMD MSRs.
  */
 
 /*
@@ -156,6 +157,45 @@ static CPUMMSRRANGE const g_aMsrRanges_AMD_Athlon_64_X2_Dual_Core_4200[] =
     MFX(0xc0010115, "AMD_K8_IGNNE", AmdK8IgnNe, AmdK8IgnNe, 0, ~(uint64_t)UINT32_MAX, UINT32_C(0xfffffffe)), /* value=0x0 */
     MFN(0xc0010116, "AMD_K8_SMM_CTL", WriteOnly, AmdK8SmmCtl),
     MFX(0xc0010117, "AMD_K8_VM_HSAVE_PA", AmdK8VmHSavePa, AmdK8VmHSavePa, 0, 0, UINT64_C(0xffffff0000000fff)), /* value=0x0 */
+
+    /* Copy & paste from the AMD_Athlon_64_3200 (130nm) profile: */
+    MVX(0xc0010118, "AMD_K8_UNK_c001_0118",0,0,0),
+    MVX(0xc0010119, "AMD_K8_UNK_c001_0119",0,0,0),
+    MVX(0xc001011a, "AMD_K8_UNK_c001_011a", 0, 0, UINT64_C(0xffffffff00000fff)),
+    MVX(0xc001011b, "AMD_K8_UNK_c001_011b", 0, 0, ~(uint64_t)UINT32_MAX),
+    MVX(0xc001011c, "AMD_K8_UNK_c001_011c", UINT32_C(0xdb1f5000), 0, UINT64_C(0xffffffff00000fff)),
+    MFX(0xc0011000, "AMD_K7_MCODE_CTL", AmdK7MicrocodeCtl, AmdK7MicrocodeCtl, 0, ~(uint64_t)UINT32_MAX, 0x204), /* value=0x0 */
+    MFX(0xc0011001, "AMD_K7_APIC_CLUSTER_ID", AmdK7ClusterIdMaybe, AmdK7ClusterIdMaybe, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x0 */
+    MFX(0xc0011004, "AMD_K8_CPUID_CTL_STD01", AmdK8CpuIdCtlStd01hEdcx, AmdK8CpuIdCtlStd01hEdcx, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x78bfbff */
+    MFX(0xc0011005, "AMD_K8_CPUID_CTL_EXT01", AmdK8CpuIdCtlExt01hEdcx, AmdK8CpuIdCtlExt01hEdcx, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0xf1f3fbff */
+    MFX(0xc0011006, "AMD_K7_DEBUG_STS?", AmdK7DebugStatusMaybe, AmdK7DebugStatusMaybe, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x0 */
+    MFN(0xc0011007, "AMD_K7_BH_TRACE_BASE?", AmdK7BHTraceBaseMaybe, AmdK7BHTraceBaseMaybe), /* value=0x0 */
+    MFN(0xc0011008, "AMD_K7_BH_TRACE_PTR?", AmdK7BHTracePtrMaybe, AmdK7BHTracePtrMaybe), /* value=0x0 */
+    MFN(0xc0011009, "AMD_K7_BH_TRACE_LIM?", AmdK7BHTraceLimitMaybe, AmdK7BHTraceLimitMaybe), /* value=0x0 */
+    MFX(0xc001100a, "AMD_K7_HDT_CFG?", AmdK7HardwareDebugToolCfgMaybe, AmdK7HardwareDebugToolCfgMaybe, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x0 */
+    MFX(0xc001100b, "AMD_K7_FAST_FLUSH_COUNT?", AmdK7FastFlushCountMaybe, AmdK7FastFlushCountMaybe, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x7c0 */
+    MFX(0xc001100c, "AMD_K7_NODE_ID", AmdK7NodeId, AmdK7NodeId, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x20906 */
+    MVX(0xc001100d, "AMD_K8_LOGICAL_CPUS_NUM?", 0x10a, 0, 0),
+    MVX(0xc001100e, "AMD_K8_WRMSR_BP?", 0, ~(uint64_t)UINT32_MAX, 0),
+    MVX(0xc001100f, "AMD_K8_WRMSR_BP_MASK?", 0, ~(uint64_t)UINT32_MAX, 0),
+    MVX(0xc0011010, "AMD_K8_BH_TRACE_CTL?", 0, ~(uint64_t)UINT32_MAX, 0),
+    MVX(0xc0011011, "AMD_K8_BH_TRACE_USRD?", 0, 0, 0), /* value=0xc0011011`00000283 */
+    MVX(0xc0011014, "AMD_K8_XCPT_BP_RIP?", 0, 0, 0),
+    MVX(0xc0011015, "AMD_K8_XCPT_BP_RIP_MASK?", 0, 0, 0),
+    MVX(0xc0011016, "AMD_K8_COND_HDT_VAL?", 0, 0, 0),
+    MVX(0xc0011017, "AMD_K8_COND_HDT_VAL_MASK?", 0, 0, 0),
+    MVX(0xc0011018, "AMD_K8_XCPT_BP_CTL?", 0, ~(uint64_t)UINT32_MAX, 0),
+    MVX(0xc001101d, "AMD_K8_NB_BIST?", 0, UINT64_C(0xfffffffffc000000), 0),
+    MVI(0xc001101e, "AMD_K8_THERMTRIP_2?", 0x521020), /* Villain? */
+    MVX(0xc001101f, "AMD_K8_NB_CFG?", UINT64_C(0x1100000008), UINT64_C(0xffffff0000000000), 0),
+    MFX(0xc0011020, "AMD_K7_LS_CFG", AmdK7LoadStoreCfg, AmdK7LoadStoreCfg, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x1000 */
+    MFX(0xc0011021, "AMD_K7_IC_CFG", AmdK7InstrCacheCfg, AmdK7InstrCacheCfg, 0x800, ~(uint64_t)UINT32_MAX, 0), /* value=0x800 */
+    MFX(0xc0011022, "AMD_K7_DC_CFG", AmdK7DataCacheCfg, AmdK7DataCacheCfg, 0, ~(uint64_t)UINT32_MAX, 0), /* value=0x24000008 */
+    MFN(0xc0011023, "AMD_K7_BU_CFG", AmdK7BusUnitCfg, AmdK7BusUnitCfg), /* Villain? value=0x2020 */
+    MFX(0xc0011024, "AMD_K7_DEBUG_CTL_2?", AmdK7DebugCtl2Maybe, AmdK7DebugCtl2Maybe, 0, UINT64_C(0xffffffffffffff00), 0), /* value=0x0 */
+    MFN(0xc0011025, "AMD_K7_DR0_DATA_MATCH?", AmdK7Dr0DataMatchMaybe, AmdK7Dr0DataMatchMaybe), /* value=0x0 */
+    MFN(0xc0011026, "AMD_K7_DR0_DATA_MATCH?", AmdK7Dr0DataMaskMaybe, AmdK7Dr0DataMaskMaybe), /* value=0x0 */
+    MFX(0xc0011027, "AMD_K7_DR0_ADDR_MASK", AmdK7DrXAddrMaskN, AmdK7DrXAddrMaskN, 0x0, UINT64_C(0xfffffffffffff000), 0), /* value=0x0 */
 };
 #endif /* !CPUM_DB_STANDALONE */
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-virtualbox/virtualbox.git



More information about the Pkg-virtualbox-commits mailing list