Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c	(revision 3560)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c	(revision 4027)
@@ -16,5 +16,5 @@
 
 #ifdef DEBUG
-#define LOG_ENABLED
+#define LOG_ENABLED 1
 #endif
 
@@ -65,4 +65,7 @@
 {
     PPDEV pDev = (PPDEV)dhpdev;
+    BOOL bDefineDDrawHeap = FALSE;
+    DWORD cHeaps = 0;
+    VIDEOMEMORY *pVm = NULL;
 
     DISPDBG((0, "%s: %p, %p, %p, %p, %p. %p\n", __FUNCTION__, dhpdev, pHalInfo, pdwNumHeaps, pvmList, pdwNumFourCCCodes, pdwFourCC));
@@ -77,4 +80,17 @@
     if (!(pvmList && pdwFourCC)) 
     {
+        memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS));
+        pHalInfo->ddCaps.dwSize         = sizeof(DDNTCORECAPS);
+        pHalInfo->ddCaps.dwVidMemTotal  = pDev->cScreenSize - pDev->cFrameBufferSize;
+        pHalInfo->ddCaps.dwVidMemFree   = pHalInfo->ddCaps.dwVidMemTotal;
+
+        pHalInfo->ddCaps.dwCaps         = 0;
+        pHalInfo->ddCaps.dwCaps2        = 0;
+
+        /* Declare we can handle textures wider than the primary */
+        pHalInfo->ddCaps.dwCaps2 |= DDCAPS2_WIDESURFACES;
+
+        pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+        
         /* Create primary surface attributes */
         pHalInfo->vmiData.pvPrimary                 = pDev->pjScreen;
@@ -108,16 +124,45 @@
         pHalInfo->vmiData.dwTextureAlign            = 4;
     }
-    memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS));
-    pHalInfo->ddCaps.dwSize         = sizeof(DDNTCORECAPS);
-    pHalInfo->ddCaps.dwVidMemTotal  = pDev->cScreenSize;
-    pHalInfo->ddCaps.dwVidMemFree   = pDev->cScreenSize;
-
-    pHalInfo->ddCaps.dwCaps         = 0;
-    pHalInfo->ddCaps.dwCaps2        = 0;
-
-    /* Declare we can handle textures wider than the primary */
-    pHalInfo->ddCaps.dwCaps2 |= DDCAPS2_WIDESURFACES;
-
-    pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+    
+    cHeaps = 0;
+
+    /* Do we have sufficient videomemory to create an off-screen heap for DDraw? */
+    if (pDev->cScreenSize > pDev->cFrameBufferSize)
+    {
+        bDefineDDrawHeap = TRUE;
+        cHeaps++;
+    }
+
+    pDev->cHeaps = cHeaps;
+    *pdwNumHeaps  = cHeaps;
+
+    // If pvmList is not NULL then we can go ahead and fill out the VIDEOMEMORY
+    // structures which define our requested heaps.
+
+    if(pvmList) {
+
+        pVm=pvmList;
+
+        //
+        // Snag a pointer to the video-memory list so that we can use it to
+        // call back to DirectDraw to allocate video memory:
+        //
+        pDev->pvmList = pVm;
+
+        //
+        // Define the heap for DirectDraw
+        //
+        if ( bDefineDDrawHeap )
+        {
+            pVm->dwFlags        = VIDMEM_ISLINEAR ;
+            pVm->fpStart        = pDev->cFrameBufferSize;
+            pVm->fpEnd          = pDev->cScreenSize;
+
+            pVm->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+            DISPDBG((0, "fpStart %ld fpEnd %ld\n", pVm->fpStart, pVm->fpEnd));
+
+            pVm++;
+        }
+    }
 
 #if 0 /* not mandatory */
@@ -172,13 +217,11 @@
     pCallBacks->dwFlags               = 0;
 
-    /*
     pCallBacks->dwFlags               = DDHAL_CB32_CREATESURFACE | DDHAL_CB32_CANCREATESURFACE;
     pCallBacks->CreateSurface         = DdCreateSurface;
     pCallBacks->CanCreateSurface      = DdCanCreateSurface;
-    pCallBacks->WaitForVerticalBlank  = DdWaitForVerticalBlank;
-    pCallBacks->GetScanLine           = DdGetScanLine;
-    pCallBacks->MapMemory             = DdMapMemory;
-    DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_MAPMEMORY | DDHAL_CB32_GETSCANLINE 
-    */
+    // pCallBacks->WaitForVerticalBlank  = DdWaitForVerticalBlank;
+    // pCallBacks->GetScanLine           = DdGetScanLine;
+    // pCallBacks->MapMemory             = DdMapMemory;
+    // DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_MAPMEMORY | DDHAL_CB32_GETSCANLINE 
     /* Note: pCallBacks->SetMode & pCallBacks->DestroyDriver are unused in Windows 2000 and up */
 
@@ -652,5 +695,5 @@
     DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev));
 
-    // remember setting of exclusive mode in ppdev,
+    // remember setting of exclusive mode in pDev,
     // so GDI can stop to promote DeviceBitmaps into
     // video memory
Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/debug.c
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/debug.c	(revision 3560)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/debug.c	(revision 4027)
@@ -15,5 +15,5 @@
 #include "driver.h"
 
-#ifdef DEBUG
+#ifdef LOG_ENABLED
 
 #ifdef VBOX
Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h	(revision 3560)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h	(revision 4027)
@@ -70,4 +70,5 @@
     ULONG   cScreenSize;                // size of video memory, including
                                         // offscreen memory.
+    ULONG   cFrameBufferSize;           // size of screen video memory
     PVOID   pOffscreenList;             // linked list of DCI offscreen surfaces.
     FLONG   flRed;                      // For bitfields device, Red Mask
@@ -98,7 +99,10 @@
     VBOXDISPLAYINFO *pInfo;
     ULONG iDevice;
+    ULONG cbDisplayInformation;
 #ifdef VBOX_WITH_DDRAW
     BOOL             bDdExclusiveMode;
     DWORD            dwNewDDSurfaceOffset;
+    DWORD            cHeaps;
+    VIDEOMEMORY*     pvmList;
 #endif
 };
Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c	(revision 3560)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c	(revision 4027)
@@ -13,5 +13,5 @@
 \**************************************************************************/
 #ifdef DEBUG
-#define LOG_ENABLED
+#define LOG_ENABLED 1
 #endif
 
@@ -1000,7 +1000,7 @@
 {
     PPDEV               pDev = (PPDEV)pDirectDraw->dhpdev;
-    HBITMAP             hbmDevice;
+//    HBITMAP             hbmDevice;
     DD_SURFACE_GLOBAL*  pSurfaceGlobal;
-    SIZEL               sizl;
+//    SIZEL               sizl;
 
     DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev));
Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c	(revision 3560)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c	(revision 4027)
@@ -66,8 +66,10 @@
                  DispInfo.u32DisplayInfoSize, pMemoryInformation->VideoRamLength));
         ppdev->pInfo = NULL;
+        ppdev->cbDisplayInformation = 0;
         return;
     }
     
     ppdev->iDevice = DispInfo.iDevice;
+    ppdev->cbDisplayInformation = DispInfo.u32DisplayInfoSize;
 
     pu8 = (uint8_t *)pMemoryInformation->VideoRamBase;
@@ -195,6 +197,4 @@
         }
 
-        ppdev->cScreenSize = videoMemoryInformation.VideoRamLength;
-        
         //
         // Initialize the head of the offscreen list to NULL.
@@ -246,4 +246,7 @@
         /* Setup the display information. */
         vboxSetupDisplayInfo (ppdev, &videoMemoryInformation);
+        
+        ppdev->cScreenSize = videoMemoryInformation.VideoRamLength - ppdev->cbDisplayInformation;
+        ppdev->cFrameBufferSize = videoMemoryInformation.FrameBufferLength;
     }
 
