Index: /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp	(revision 23925)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp	(revision 23926)
@@ -211,4 +211,89 @@
     VP_STATUS status = 0;
 
+    /* Always add 800x600 video modes. Windows XP+ needs at least 800x600 resolution
+     * and fallbacks to 800x600x4bpp VGA mode if the driver did not report suitable modes.
+     * This resolution could be rejected by a low resolution host (netbooks, etc).
+     */
+    int cBytesPerPixel;
+    for (cBytesPerPixel = 1; cBytesPerPixel <= 4; cBytesPerPixel++)
+    {
+        int cBitsPerPixel = cBytesPerPixel * 8; /* 8, 16, 24, 32 */
+
+#ifndef VBOX_WITH_8BPP_MODES
+        if (cBitsPerPixel == 8)
+        {
+             continue;
+        }
+#endif /* !VBOX_WITH_8BPP_MODES */
+
+        /* does the mode fit into the VRAM? */
+        if (800 * 600 * cBytesPerPixel > (LONG)vramSize)
+        {
+            continue;
+        }
+
+        VideoModes[gNumVideoModes].Length                       = sizeof(VIDEO_MODE_INFORMATION);
+        VideoModes[gNumVideoModes].ModeIndex                    = gNumVideoModes + 1;
+        VideoModes[gNumVideoModes].VisScreenWidth               = 800;
+        VideoModes[gNumVideoModes].VisScreenHeight              = 600;
+        VideoModes[gNumVideoModes].ScreenStride                 = 800 * cBytesPerPixel;
+        VideoModes[gNumVideoModes].NumberOfPlanes               = 1;
+        VideoModes[gNumVideoModes].BitsPerPlane                 = cBitsPerPixel;
+        VideoModes[gNumVideoModes].Frequency                    = 60;
+        VideoModes[gNumVideoModes].XMillimeter                  = 320;
+        VideoModes[gNumVideoModes].YMillimeter                  = 240;
+        switch (cBytesPerPixel)
+        {
+            case 1:
+            {
+                VideoModes[gNumVideoModes].NumberRedBits                = 6;
+                VideoModes[gNumVideoModes].NumberGreenBits              = 6;
+                VideoModes[gNumVideoModes].NumberBlueBits               = 6;
+                VideoModes[gNumVideoModes].RedMask                      = 0;
+                VideoModes[gNumVideoModes].GreenMask                    = 0;
+                VideoModes[gNumVideoModes].BlueMask                     = 0;
+                VideoModes[gNumVideoModes].AttributeFlags               = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN |
+                                                                          VIDEO_MODE_PALETTE_DRIVEN | VIDEO_MODE_MANAGED_PALETTE;
+            } break;
+            case 2:
+            {
+                VideoModes[gNumVideoModes].NumberRedBits                = 5;
+                VideoModes[gNumVideoModes].NumberGreenBits              = 6;
+                VideoModes[gNumVideoModes].NumberBlueBits               = 5;
+                VideoModes[gNumVideoModes].RedMask                      = 0xF800;
+                VideoModes[gNumVideoModes].GreenMask                    = 0x7E0;
+                VideoModes[gNumVideoModes].BlueMask                     = 0x1F;
+                VideoModes[gNumVideoModes].AttributeFlags               = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN;
+            } break;
+            case 3:
+            {
+                VideoModes[gNumVideoModes].NumberRedBits                = 8;
+                VideoModes[gNumVideoModes].NumberGreenBits              = 8;
+                VideoModes[gNumVideoModes].NumberBlueBits               = 8;
+                VideoModes[gNumVideoModes].RedMask                      = 0xFF0000;
+                VideoModes[gNumVideoModes].GreenMask                    = 0xFF00;
+                VideoModes[gNumVideoModes].BlueMask                     = 0xFF;
+                VideoModes[gNumVideoModes].AttributeFlags               = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN;
+            } break;
+            default:
+            case 4:
+            {
+                VideoModes[gNumVideoModes].NumberRedBits                = 8;
+                VideoModes[gNumVideoModes].NumberGreenBits              = 8;
+                VideoModes[gNumVideoModes].NumberBlueBits               = 8;
+                VideoModes[gNumVideoModes].RedMask                      = 0xFF0000;
+                VideoModes[gNumVideoModes].GreenMask                    = 0xFF00;
+                VideoModes[gNumVideoModes].BlueMask                     = 0xFF;
+                VideoModes[gNumVideoModes].AttributeFlags               = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN;
+            } break;
+        }
+        VideoModes[gNumVideoModes].VideoMemoryBitmapWidth       = 800;
+        VideoModes[gNumVideoModes].VideoMemoryBitmapHeight      = 600;
+        VideoModes[gNumVideoModes].DriverSpecificAttributeFlags = 0;
+
+        /* a new mode has been filled in */
+        ++gNumVideoModes;
+    }
+
     /*
      * Query the y-offset from the host
@@ -231,4 +316,11 @@
         if (resolutionMatrix[matrixIndex].xRes * resolutionMatrix[matrixIndex].yRes * 1 > (LONG)vramSize)
         {
+            ++matrixIndex;
+            continue;
+        }
+
+        if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600)
+        {
+            /* This mode was already added. */
             ++matrixIndex;
             continue;
@@ -290,4 +382,11 @@
         }
 
+        if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600)
+        {
+            /* This mode was already added. */
+            ++matrixIndex;
+            continue;
+        }
+
         /* does the host like that mode? */
         if (!vboxLikesVideoMode(resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 16))
@@ -343,4 +442,11 @@
         }
 
+        if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600)
+        {
+            /* This mode was already added. */
+            ++matrixIndex;
+            continue;
+        }
+
         /* does the host like that mode? */
         if (!vboxLikesVideoMode(resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 24))
@@ -392,4 +498,11 @@
         if (resolutionMatrix[matrixIndex].xRes * resolutionMatrix[matrixIndex].yRes * 4 > (LONG)vramSize)
         {
+            ++matrixIndex;
+            continue;
+        }
+
+        if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600)
+        {
+            /* This mode was already added. */
             ++matrixIndex;
             continue;
@@ -561,5 +674,5 @@
      * registry key add it to the modes table.
      */
-    uint32_t xres, yres, bpp = 0;
+    uint32_t xres = 0, yres = 0, bpp = 0;
     if (   (   vboxQueryDisplayRequest(&xres, &yres, &bpp)
             && (xres || yres || bpp))
@@ -570,7 +683,13 @@
         if (DeviceExtension->CurrentMode == 0)
         {
-            xres = gCustomXRes;
-            yres = gCustomYRes;
-            bpp  = gCustomBPP;
+            /* Use the stored custom resolution values only if nothing was read from host.
+             * The custom mode might be not valid anymore and would block any hints from host.
+             */
+            if (!xres)
+                xres = gCustomXRes;
+            if (!yres)
+                yres = gCustomYRes;
+            if (!bpp)
+                bpp  = gCustomBPP;
             dprintf(("VBoxVideo: using stored custom resolution %dx%dx%d\n", xres, yres, bpp));
         }
@@ -589,4 +708,8 @@
                 bpp  = DeviceExtension->CurrentModeBPP;
         }
+
+        /* Use a default value. */
+        if (!bpp)
+            bpp = 32;
 
         /* does the host like that mode? */
@@ -719,5 +842,5 @@
                      xres, yres, bpp));
     }
-#ifdef DEBUG
+#ifdef LOG_ENABLED
     {
         int i;
