Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h	(revision 71860)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/common/wddm/VBoxMPIf.h	(revision 71862)
@@ -33,5 +33,14 @@
 
 /* One would increase this whenever definitions in this file are changed */
-#define VBOXVIDEOIF_VERSION 20
+#define VBOXVIDEOIF_VERSION 21
+
+/** @todo VBOXVIDEO_HWTYPE probably needs to be in VBoxVideo.h */
+typedef enum VBOXVIDEO_HWTYPE
+{
+    VBOXVIDEO_HWTYPE_CROGL  = 0,
+    VBOXVIDEO_HWTYPE_VMSVGA = 1,
+    VBOXVIDEO_HWTYPE_32BIT  = 0x7fffffff
+} VBOXVIDEO_HWTYPE;
+AssertCompileSize(VBOXVIDEO_HWTYPE, 4);
 
 #define VBOXWDDM_NODE_ID_SYSTEM             0
@@ -491,12 +500,23 @@
 } VBOXDISPIFESCAPE_CRHGSMICTLCON_CALL, *PVBOXDISPIFESCAPE_CRHGSMICTLCON_CALL;
 
-/* query info func */
-typedef struct VBOXWDDM_QI
-{
-    uint32_t u32Version;
-    uint32_t u32VBox3DCaps;
-    uint32_t cInfos;
-    VBOXVHWA_INFO aInfos[VBOX_VIDEO_MAX_SCREENS];
-} VBOXWDDM_QI;
+
+/* D3DDDICB_QUERYADAPTERINFO::pPrivateDriverData */
+typedef struct VBOXWDDM_QAI
+{
+    uint32_t            u32Version;      /* VBOXVIDEOIF_VERSION */
+    uint32_t            u32Reserved;     /* Must be 0. */
+    VBOXVIDEO_HWTYPE    enmHwType;       /* Hardware type. Determines what kind of data is returned. */
+    uint32_t            cInfos;          /* Number of initialized elements in aInfos (equal to number of guest
+                                          * displays). 0 if VBOX_WITH_VIDEOHWACCEL is not defined. */
+    VBOXVHWA_INFO       aInfos[VBOX_VIDEO_MAX_SCREENS]; /* cInfos elements are initialized. */
+    union
+    {
+        struct
+        {
+            /* VBOXVIDEO_HWTYPE_CROGL */
+            uint32_t    u32VBox3DCaps;   /* CR_VBOX_CAP_* */
+        } crogl;
+    } u;
+} VBOXWDDM_QAI;
 
 /** Convert a given FourCC code to a D3DDDIFORMAT enum. */
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp	(revision 71860)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp	(revision 71862)
@@ -6646,5 +6646,5 @@
     LOGREL(("Built %s %s", __DATE__, __TIME__));
 
-    VBOXWDDM_QI Query;
+    VBOXWDDM_QAI Query;
     D3DDDICB_QUERYADAPTERINFO DdiQuery;
     DdiQuery.PrivateDriverDataSize = sizeof(Query);
@@ -6673,5 +6673,6 @@
     PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_ADAPTER, aHeads[Query.cInfos]));
 #else
-    PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(sizeof (VBOXWDDMDISP_ADAPTER));
+    Assert(Query.cInfos == 0);
+    PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(sizeof(VBOXWDDMDISP_ADAPTER));
 #endif
     Assert(pAdapter);
@@ -6683,7 +6684,12 @@
         pAdapter->RtCallbacks = *pOpenData->pAdapterCallbacks;
 
-        pAdapter->u32VBox3DCaps = Query.u32VBox3DCaps;
-
+        pAdapter->enmHwType = Query.enmHwType;
+
+        if (Query.enmHwType == VBOXVIDEO_HWTYPE_CROGL)
+            pAdapter->u32VBox3DCaps = Query.u.crogl.u32VBox3DCaps;
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
         pAdapter->cHeads = Query.cInfos;
+#endif
 
         pOpenData->hAdapter = pAdapter;
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h	(revision 71860)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.h	(revision 71862)
@@ -76,4 +76,7 @@
     UINT uRtVersion;
     D3DDDI_ADAPTERCALLBACKS RtCallbacks;
+
+    VBOXVIDEO_HWTYPE enmHwType;     /* VBOXVIDEO_HWTYPE* */
+
     VBOXWDDMDISP_D3D D3D;
     VBOXWDDMDISP_FORMATS Formats;
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.cpp	(revision 71860)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxUhgsmiKmt.cpp	(revision 71862)
@@ -309,5 +309,5 @@
 static HRESULT vboxUhgsmiKmtQueryCaps(PVBOXUHGSMI_PRIVATE_KMT pHgsmi, uint32_t *pu32Caps)
 {
-    VBOXWDDM_QI Query;
+    VBOXWDDM_QAI Query;
     D3DKMT_QUERYADAPTERINFO Info;
     Info.hAdapter = pHgsmi->Adapter.hAdapter;
@@ -329,5 +329,8 @@
     }
 
-    *pu32Caps = Query.u32VBox3DCaps;
+    if (Query.enmHwType == VBOXVIDEO_HWTYPE_CROGL)
+        *pu32Caps = Query.u.crogl.u32VBox3DCaps;
+    else
+        *pu32Caps = 0;
 
     return S_OK;
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h	(revision 71860)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h	(revision 71862)
@@ -34,10 +34,4 @@
 # include "wddm/VBoxMPTypes.h"
 #endif
-
-typedef enum VBOX_HWTYPE
-{
-    VBOX_HWTYPE_CROGL = 0,
-    VBOX_HWTYPE_VMSVGA = 1
-} VBOX_HWTYPE;
 
 #ifdef VBOX_WDDM_MINIPORT
@@ -218,6 +212,6 @@
    HGSMIAREA areaDisplay;                      /* Entire VRAM chunk for this display device. */
 
-   VBOX_HWTYPE enmHwType;
-#ifdef VBOX_WDDM_MINIPORT
+#ifdef VBOX_WDDM_MINIPORT
+   VBOXVIDEO_HWTYPE enmHwType;
    VBOXWDDM_HWRESOURCES HwResources;
 #endif
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp	(revision 71860)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp	(revision 71862)
@@ -1182,5 +1182,5 @@
 static NTSTATUS vboxVdmaCrCtlGetDefaultClientId(PVBOXMP_DEVEXT pDevExt, uint32_t *pu32ClienID)
 {
-    if (pDevExt->enmHwType != VBOX_HWTYPE_CROGL)
+    if (pDevExt->enmHwType != VBOXVIDEO_HWTYPE_CROGL)
     {
         /* Should not be called at all in this case. */
@@ -1336,5 +1336,5 @@
 NTSTATUS vboxVdmaTexPresentSetAlloc(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData)
 {
-    if (pDevExt->enmHwType != VBOX_HWTYPE_CROGL)
+    if (pDevExt->enmHwType != VBOXVIDEO_HWTYPE_CROGL)
     {
         /* Not used in this case. */
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp	(revision 71860)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp	(revision 71862)
@@ -816,7 +816,7 @@
     }
 
-    pDevExt->enmHwType = u32 ? VBOX_HWTYPE_VMSVGA : VBOX_HWTYPE_CROGL;
-
-    if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
+    pDevExt->enmHwType = u32 ? VBOXVIDEO_HWTYPE_VMSVGA : VBOXVIDEO_HWTYPE_CROGL;
+
+    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
     {
         pDevExt->f3DEnabled = VBoxMpCrCtlConIs3DSupported();
@@ -1149,5 +1149,5 @@
             {
 #ifdef VBOX_WITH_CROGL
-                if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
+                if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
                 {
                     if (pDevExt->f3DEnabled)
@@ -1377,5 +1377,5 @@
 
 #ifdef VBOX_WITH_CROGL
-    if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL && pDevExt->u32CrConDefaultClientID)
+    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL && pDevExt->u32CrConDefaultClientID)
         VBoxMpCrCtlConDisconnect(pDevExt, &pDevExt->CrCtlCon, pDevExt->u32CrConDefaultClientID);
 
@@ -2330,22 +2330,22 @@
             if (!g_VBoxDisplayOnly)
             {
-                if (pQueryAdapterInfo->OutputDataSize == sizeof (VBOXWDDM_QI))
-                {
-                    VBOXWDDM_QI * pQi = (VBOXWDDM_QI*)pQueryAdapterInfo->pOutputData;
-                    memset (pQi, 0, sizeof (VBOXWDDM_QI));
-                    pQi->u32Version = VBOXVIDEOIF_VERSION;
-                    if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
+                if (pQueryAdapterInfo->OutputDataSize >= sizeof(VBOXWDDM_QAI))
+                {
+                    VBOXWDDM_QAI *pQAI = (VBOXWDDM_QAI *)pQueryAdapterInfo->pOutputData;
+                    memset(pQAI, 0, sizeof(VBOXWDDM_QAI));
+
+                    pQAI->u32Version = VBOXVIDEOIF_VERSION;
+                    pQAI->enmHwType = pDevExt->enmHwType;
+                    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
                     {
 #ifdef VBOX_WITH_CROGL
-                        pQi->u32VBox3DCaps = VBoxMpCrGetHostCaps();
+                        pQAI->u.crogl.u32VBox3DCaps = VBoxMpCrGetHostCaps();
 #endif
                     }
-                    else
-                        pQi->u32VBox3DCaps = 0;
-                    pQi->cInfos = VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
 #ifdef VBOX_WITH_VIDEOHWACCEL
-                    for (int i = 0; i < VBoxCommonFromDeviceExt(pDevExt)->cDisplays; ++i)
+                    pQAI->cInfos = VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
+                    for (uint32_t i = 0; i < pQAI->cInfos; ++i)
                     {
-                        pQi->aInfos[i] = pDevExt->aSources[i].Vhwa.Settings;
+                        pQAI->aInfos[i] = pDevExt->aSources[i].Vhwa.Settings;
                     }
 #endif
@@ -2353,5 +2353,5 @@
                 else
                 {
-                    WARN(("incorrect buffer size %d, expected %d", pQueryAdapterInfo->OutputDataSize, sizeof (VBOXWDDM_QI)));
+                    WARN(("incorrect buffer size %d, expected %d", pQueryAdapterInfo->OutputDataSize, sizeof(VBOXWDDM_QAI)));
                     Status = STATUS_BUFFER_TOO_SMALL;
                 }
@@ -2854,5 +2854,5 @@
         /* wait for all current allocation-related ops are completed */
         vboxWddmAllocationCleanup(pDevExt, pAlloc);
-        if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL && pAlloc->hSharedHandle && pAlloc->AllocData.hostID)
+        if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL && pAlloc->hSharedHandle && pAlloc->AllocData.hostID)
             VBoxVdmaChromiumParameteriCRSubmit(pDevExt, GL_PIN_TEXTURE_CLEAR_CR, pAlloc->AllocData.hostID);
         vboxWddmAllocationDestroy(pAlloc);
@@ -4560,5 +4560,5 @@
                 if (pEscape->PrivateDriverDataSize == sizeof (*pEscapeHdr))
                 {
-                    if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
+                    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
                         pEscapeHdr->u32CmdSpecific = VBoxMpCrGetHostCaps();
                     else
@@ -6899,5 +6899,5 @@
             }
 
-            if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
+            if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
             {
 #ifdef VBOX_WITH_CROGL
@@ -6950,5 +6950,5 @@
                                         if (pDevExt->f3DEnabled)
                                         {
-                                            if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
+                                            if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
                                             {
                                                 int rc = VBoxMpCrCtlConConnect(pDevExt, &pDevExt->CrCtlCon,
@@ -7005,5 +7005,5 @@
                                 if (pDevExt->f3DEnabled)
                                 {
-                                    if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL)
+                                    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
                                     {
                                         int rc = VBoxMpCrCtlConConnect(pDevExt, &pDevExt->CrCtlCon,
@@ -7145,5 +7145,5 @@
 
 #ifdef VBOX_WITH_CROGL
-    if (pDevExt->enmHwType == VBOX_HWTYPE_CROGL && pContext->u32CrConClientID)
+    if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL && pContext->u32CrConClientID)
     {
         VBoxMpCrCtlConDisconnect(pDevExt, &pDevExt->CrCtlCon, pContext->u32CrConClientID);
@@ -7317,5 +7317,6 @@
     if (bUpdateRectInited && pSource->bVisible)
     {
-        VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect);
+        if (pDevExt->enmHwType == VBOXVIDEO_HWTYPE_CROGL)
+            VBOXVBVA_OP_WITHLOCK(ReportDirtyRect, pDevExt, pSource, &UpdateRect);
     }
 
@@ -7657,5 +7658,5 @@
 
         /* Check whether 3D is provided by the host. */
-        VBOX_HWTYPE enmHwType = VBOX_HWTYPE_CROGL;
+        VBOXVIDEO_HWTYPE enmHwType = VBOXVIDEO_HWTYPE_CROGL;
         BOOL f3DSupported = FALSE;
 
@@ -7675,10 +7676,10 @@
             if (u32)
             {
-                enmHwType = VBOX_HWTYPE_VMSVGA;
+                enmHwType = VBOXVIDEO_HWTYPE_VMSVGA;
             }
         }
 
         BOOL fCmdVbva = FALSE;
-        if (enmHwType == VBOX_HWTYPE_CROGL)
+        if (enmHwType == VBOXVIDEO_HWTYPE_CROGL)
         {
             /* Try to establish connection to the host 3D service. */
@@ -7693,5 +7694,5 @@
 #endif
         }
-        else if (enmHwType == VBOX_HWTYPE_VMSVGA)
+        else if (enmHwType == VBOXVIDEO_HWTYPE_VMSVGA)
         {
             fCmdVbva = TRUE;
