Index: /trunk/include/VBox/VBoxVideo.h
===================================================================
--- /trunk/include/VBox/VBoxVideo.h	(revision 34664)
+++ /trunk/include/VBox/VBoxVideo.h	(revision 34665)
@@ -89,5 +89,5 @@
  * contain other data (for example HGSMIHOSTFLAGS structure).
  */
-#ifdef VBOX_WITH_WDDM
+#ifndef VBOX_XPDM_MINIPORT
 # define VBVA_ADAPTER_INFORMATION_SIZE (64*_1K)
 #else
@@ -984,10 +984,8 @@
 #define VBVA_F_ENABLE  0x00000001
 #define VBVA_F_DISABLE 0x00000002
-#ifdef VBOXWDDM_WITH_VBVA
 /* extended VBVA to be used with WDDM */
 #define VBVA_F_EXTENDED 0x00000004
 /* vbva offset is absolute VRAM offset */
 #define VBVA_F_ABSOFFSET 0x00000008
-#endif
 
 typedef struct VBVAENABLE
@@ -998,5 +996,4 @@
 } VBVAENABLE;
 
-#ifdef VBOXWDDM_WITH_VBVA
 typedef struct VBVAENABLE_EX
 {
@@ -1004,5 +1001,4 @@
     uint32_t u32ScreenId;
 } VBVAENABLE_EX;
-#endif
 
 
Index: /trunk/include/VBox/VBoxVideoGuest.h
===================================================================
--- /trunk/include/VBox/VBoxVideoGuest.h	(revision 34664)
+++ /trunk/include/VBox/VBoxVideoGuest.h	(revision 34665)
@@ -194,5 +194,5 @@
                                        void *pvBuffer);
 
-typedef struct VBVAINFOVIEW *PVBVAINFOVIEW;
+struct VBVAINFOVIEW;
 /**
  * Callback funtion called from @a VBoxHGSMISendViewInfo to initialise
@@ -205,6 +205,7 @@
  * @todo  explicitly pass the array size
  */
-typedef DECLCALLBACK(int) FNHGSMIFILLVIEWINFO (void *pvData,
-                                               PVBVAINFOVIEW pInfo);
+typedef DECLCALLBACK(int) FNHGSMIFILLVIEWINFO(void *pvData,
+                                              struct VBVAINFOVIEW *pInfo,
+                                              uint32_t cViews);
 /** Pointer to a FNHGSMIFILLVIEWINFO callback */
 typedef FNHGSMIFILLVIEWINFO *PFNHGSMIFILLVIEWINFO;
@@ -257,7 +258,8 @@
 RTDECL(bool) VBoxVBVAEnable(PVBVABUFFERCONTEXT pCtx,
                             PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
-                            struct VBVABUFFER *pVBVA);
+                            struct VBVABUFFER *pVBVA, int32_t cScreen);
 RTDECL(void) VBoxVBVADisable(PVBVABUFFERCONTEXT pCtx,
-                             PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx);
+                             PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
+                             int32_t cScreen);
 RTDECL(bool) VBoxVBVABufferBeginUpdate(PVBVABUFFERCONTEXT pCtx,
                                        PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx);
@@ -267,4 +269,7 @@
                            const void *pv, uint32_t cb);
 RTDECL(bool) VBoxVBVAOrderSupported(PVBVABUFFERCONTEXT pCtx, unsigned code);
+RTDECL(void) VBoxVBVASetupBufferContext(PVBVABUFFERCONTEXT pCtx,
+                                        uint32_t offVRAMBuffer,
+                                        uint32_t cbBuffer);
 RTDECL(void) VBoxHGSMIProcessDisplayInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
                                          uint32_t cDisplay,
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c	(revision 34664)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c	(revision 34665)
@@ -912,5 +912,5 @@
         {
             PPDEV ppdev = (PPDEV) dhpdev;
-            VBoxVBVADisable(&ppdev->vbvaCtx, &ppdev->guestCtx);
+            VBoxVBVADisable(&ppdev->vbvaCtx, &ppdev->guestCtx, -1);
         }
 
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c	(revision 34664)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c	(revision 34665)
@@ -244,6 +244,6 @@
     /* Update buffer layout in VBVA context information.  Shouldn't this get
      * zeroed if initialising the HGSMI heap fails? */
-    ppdev->vbvaCtx.offVRAMBuffer = ppdev->layout.offVBVABuffer;
-    ppdev->vbvaCtx.cbBuffer = ppdev->layout.cbVBVABuffer;
+    VBoxVBVASetupBufferContext(&ppdev->vbvaCtx, ppdev->layout.offVBVABuffer,
+                               ppdev->layout.cbVBVABuffer);
 
     DISPDBG((0, "vboxInitVBoxVideo:\n"
@@ -412,5 +412,5 @@
             ppdev->bHGSMISupported = VBoxVBVAEnable(&ppdev->vbvaCtx,
                                                     &ppdev->guestCtx,
-                                                    pVBVA);
+                                                    pVBVA, -1);
             LogRel(("VBoxDisp[%d]: VBVA %senabled\n", ppdev->iDevice, ppdev->bHGSMISupported? "": "not "));
         }
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp	(revision 34664)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp	(revision 34665)
@@ -3033,13 +3033,13 @@
 
 #ifndef VBOX_WITH_WDDM
-DECLCALLBACK(int) vbvaInitInfoDisplay (void *pvData, PVBVAINFOVIEW p)
+DECLCALLBACK(int) vbvaInitInfoDisplay (void *pvData, struct VBVAINFOVIEW *p,
+                                       uint32_t cViews)
 {
     PDEVICE_EXTENSION PrimaryExtension = (PDEVICE_EXTENSION) pvData;
 
-    int i;
+    unsigned i;
     PDEVICE_EXTENSION Extension;
 
-    for (i = 0, Extension = PrimaryExtension;
-         i < commonFromDeviceExt(PrimaryExtension)->cDisplays && Extension;
+    for (i = 0, Extension = PrimaryExtension; i < cViews && Extension;
          i++, Extension = Extension->pNext)
     {
Index: /trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp	(revision 34664)
+++ /trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp	(revision 34665)
@@ -324,5 +324,5 @@
     {
         VBVAINFOVIEW *pInfo = (VBVAINFOVIEW *)p;
-        rc = pfnFill(pvData, pInfo);
+        rc = pfnFill(pvData, pInfo, u32Count);
         if (RT_SUCCESS(rc))
             VBoxHGSMIBufferSubmit (pCtx, p);
@@ -337,9 +337,9 @@
 /**
  * Get the information needed to map the basic communication structures in
- * device memory into our address space.
+ * device memory into our address space.  All pointer parameters are optional.
  *
  * @param  cbVRAM               how much video RAM is allocated to the device
  * @param  poffVRAMBaseMapping  where to save the offset from the start of the
- *                              device VRAM of the whole area to map 
+ *                              device VRAM of the whole area to map
  * @param  pcbMapping           where to save the mapping size
  * @param  poffGuestHeapMemory  where to save the offset into the mapped area
@@ -357,14 +357,21 @@
                                          uint32_t *poffHostFlags)
 {
-    AssertPtrReturnVoid(poffVRAMBaseMapping);
-    AssertPtrReturnVoid(pcbMapping);
-    AssertPtrReturnVoid(poffGuestHeapMemory);
-    AssertPtrReturnVoid(pcbGuestHeapMemory);
-    AssertPtrReturnVoid(poffHostFlags);
-    *poffVRAMBaseMapping = cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE;
-    *pcbMapping = VBVA_ADAPTER_INFORMATION_SIZE;
-    *poffGuestHeapMemory = 0;
-    *pcbGuestHeapMemory = VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS);
-    *poffHostFlags = VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS);
+    AssertPtrNullReturnVoid(poffVRAMBaseMapping);
+    AssertPtrNullReturnVoid(pcbMapping);
+    AssertPtrNullReturnVoid(poffGuestHeapMemory);
+    AssertPtrNullReturnVoid(pcbGuestHeapMemory);
+    AssertPtrNullReturnVoid(poffHostFlags);
+    if (poffVRAMBaseMapping)
+        *poffVRAMBaseMapping = cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE;
+    if (pcbMapping)
+        *pcbMapping = VBVA_ADAPTER_INFORMATION_SIZE;
+    if (poffGuestHeapMemory)
+        *poffGuestHeapMemory = 0;
+    if (pcbGuestHeapMemory)
+        *pcbGuestHeapMemory =   VBVA_ADAPTER_INFORMATION_SIZE
+                              - sizeof(HGSMIHOSTFLAGS);
+    if (poffHostFlags)
+        *poffHostFlags =   VBVA_ADAPTER_INFORMATION_SIZE
+                         - sizeof(HGSMIHOSTFLAGS);
 }
 
Index: /trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp	(revision 34664)
+++ /trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp	(revision 34665)
@@ -49,5 +49,5 @@
 static bool vboxVBVAInformHost(PVBVABUFFERCONTEXT pCtx,
                                PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
-                               bool bEnable)
+                               int32_t cScreen, bool bEnable)
 {
     bool bRc = false;
@@ -58,5 +58,5 @@
     {
         void *p = VBoxHGSMIBufferAlloc(pHGSMICtx,
-                                       sizeof (VBVAENABLE),
+                                       sizeof (VBVAENABLE_EX),
                                        HGSMI_CH_VBVA,
                                        VBVA_ENABLE);
@@ -67,9 +67,14 @@
         else
         {
-            VBVAENABLE *pEnable = (VBVAENABLE *)p;
-
-            pEnable->u32Flags  = bEnable? VBVA_F_ENABLE: VBVA_F_DISABLE;
-            pEnable->u32Offset = pCtx->offVRAMBuffer;
-            pEnable->i32Result = VERR_NOT_SUPPORTED;
+            VBVAENABLE_EX *pEnable = (VBVAENABLE_EX *)p;
+
+            pEnable->Base.u32Flags  = bEnable? VBVA_F_ENABLE: VBVA_F_DISABLE;
+            pEnable->Base.u32Offset = pCtx->offVRAMBuffer;
+            pEnable->Base.i32Result = VERR_NOT_SUPPORTED;
+            if (cScreen >= 0)
+            {
+                pEnable->Base.u32Flags |= VBVA_F_EXTENDED | VBVA_F_ABSOFFSET;
+                pEnable->u32ScreenId    = cScreen;
+            }
 
             VBoxHGSMIBufferSubmit(pHGSMICtx, p);
@@ -77,5 +82,5 @@
             if (bEnable)
             {
-                bRc = RT_SUCCESS(pEnable->i32Result);
+                bRc = RT_SUCCESS(pEnable->Base.i32Result);
             }
             else
@@ -96,5 +101,5 @@
 RTDECL(bool) VBoxVBVAEnable(PVBVABUFFERCONTEXT pCtx,
                             PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
-                            VBVABUFFER *pVBVA)
+                            VBVABUFFER *pVBVA, int32_t cScreen)
 {
     bool bRc = false;
@@ -122,10 +127,10 @@
         pCtx->pVBVA      = pVBVA;
 
-        bRc = vboxVBVAInformHost(pCtx, pHGSMICtx, true);
+        bRc = vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, true);
     }
 
     if (!bRc)
     {
-        VBoxVBVADisable(pCtx, pHGSMICtx);
+        VBoxVBVADisable(pCtx, pHGSMICtx, cScreen);
     }
 
@@ -134,5 +139,6 @@
 
 RTDECL(void) VBoxVBVADisable(PVBVABUFFERCONTEXT pCtx,
-                             PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx)
+                             PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
+                             int32_t cScreen)
 {
     LogFlowFunc(("\n"));
@@ -142,5 +148,5 @@
     pCtx->pVBVA             = NULL;
 
-    vboxVBVAInformHost(pCtx, pHGSMICtx, false);
+    vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, false);
 
     return;
@@ -374,4 +380,12 @@
 
     return false;
+}
+
+RTDECL(void) VBoxVBVASetupBufferContext(PVBVABUFFERCONTEXT pCtx,
+                                        uint32_t offVRAMBuffer,
+                                        uint32_t cbBuffer)
+{
+    pCtx->offVRAMBuffer = offVRAMBuffer;
+    pCtx->cbBuffer      = cbBuffer;
 }
 
