Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp	(revision 30484)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp	(revision 30505)
@@ -3171,5 +3171,5 @@
 #endif
     }
-#if 1
+#if 0
     else
 #endif
Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMp.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMp.cpp	(revision 30484)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispMp.cpp	(revision 30505)
@@ -41,8 +41,9 @@
     if (pIter->cbRemain)
     {
+        PVBOXVIDEOCM_CMD_HDR pCur = pIter->pCur;
         Assert(pIter->cbRemain  >= pIter->pCur->cbCmd);
         pIter->cbRemain -= pIter->pCur->cbCmd;
         pIter->pCur = (PVBOXVIDEOCM_CMD_HDR)(((uint8_t*)pIter->pCur) + pIter->pCur->cbCmd);
-        return pIter->pCur;
+        return pCur;
     }
     return NULL;
@@ -100,5 +101,5 @@
                 if (g_VBoxDispMp.pEscapeCmd->Hdr.cbCmdsReturned)
                 {
-                    PVBOXVIDEOCM_CMD_HDR pHdr = (PVBOXVIDEOCM_CMD_HDR)(((uint8_t*)g_VBoxDispMp.pEscapeCmd) + sizeof (VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD));
+                    pHdr = (PVBOXVIDEOCM_CMD_HDR)(((uint8_t*)g_VBoxDispMp.pEscapeCmd) + sizeof (VBOXDISPIFESCAPE_GETVBOXVIDEOCMCMD));
                     vboxVideoCmIterInit(&g_VBoxDispMp.Iterator, pHdr, g_VBoxDispMp.pEscapeCmd->Hdr.cbCmdsReturned);
                     pHdr = vboxVideoCmIterNext(&g_VBoxDispMp.Iterator);
Index: trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoCm.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoCm.cpp	(revision 30484)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoCm.cpp	(revision 30505)
@@ -367,5 +367,5 @@
     PVBOXVIDEOCM_CMD_DR pHdr;
     LIST_ENTRY DetachedList;
-    PLIST_ENTRY pCurEntry;
+    PLIST_ENTRY pCurEntry = NULL;
     uint32_t cbCmdsReturned = 0;
     uint32_t cbRemainingCmds = 0;
@@ -386,5 +386,5 @@
             if (!IsListEmpty(&pSession->CommandsList))
             {
-                Assert(pCurEntry == &pSession->CommandsList);
+                Assert(!pCurEntry);
                 pHdr = VBOXCMENTRY_2_CMD(pSession->CommandsList.Blink);
                 Assert(pHdr->CmdHdr.cbCmd);
@@ -411,4 +411,5 @@
         else
         {
+            Assert(pCurEntry);
             if (pCurEntry != &pSession->CommandsList)
             {
@@ -429,9 +430,11 @@
 
     pCmd->Hdr.cbCmdsReturned = 0;
-    for (pCurEntry = DetachedList.Blink; DetachedList.Blink != &DetachedList; pCurEntry = pCurEntry->Blink)
-    {
+    for (pCurEntry = DetachedList.Blink; pCurEntry != &DetachedList; pCurEntry = DetachedList.Blink)
+    {
+        pHdr = VBOXCMENTRY_2_CMD(pCurEntry);
         memcpy(pvData, &pHdr->CmdHdr, pHdr->CmdHdr.cbCmd);
         pvData += pHdr->CmdHdr.cbCmd;
         pCmd->Hdr.cbCmdsReturned += pHdr->CmdHdr.cbCmd;
+        RemoveEntryList(pCurEntry);
         vboxVideoCmCmdReleaseByHdr(pHdr);
     }
Index: trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp	(revision 30484)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVdma.cpp	(revision 30505)
@@ -301,5 +301,5 @@
             }
 
-            vboxVdmaDirtyRectsCalcIntersection(&pContext->ViewRect, pRects, &pCmd->RectsInfo);
+            vboxVdmaDirtyRectsCalcIntersection(&pCurContext->ViewRect, pRects, &pCmd->RectsInfo);
             if (pCmd->RectsInfo.cRects)
             {
@@ -357,8 +357,10 @@
                 pDrCmd->RectsInfo.aRects[0] = *pContextRect;
                 pDirtyRect = &pDrCmd->RectsInfo.aRects[1];
+                pContext->ViewRect = *pContextRect;
             }
             else
                 pDirtyRect = &pDrCmd->RectsInfo.aRects[0];
 
+            Assert(pRects->cRects);
             pDrCmd->fFlags.bAddVisibleRects = 1;
             memcpy (pDirtyRect, pRects->aRects, sizeof (RECT) * pRects->cRects);
