Author: greatlrd
Date: Wed Dec  8 17:50:17 2010
New Revision: 49988

URL: http://svn.reactos.org/svn/reactos?rev=49988&view=rev
Log:
Do not try map video memory for no linear video mode.
Fix error processing for VBEMapVideoMemory and VBEUnmapVideoMemory

Modified:
    branches/reactx/reactos/drivers/video/miniport/vbe/vbemp.c

Modified: branches/reactx/reactos/drivers/video/miniport/vbe/vbemp.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/drivers/video/miniport/vbe/vbemp.c?rev=49988&r1=49987&r2=49988&view=diff
==============================================================================
--- branches/reactx/reactos/drivers/video/miniport/vbe/vbemp.c [iso-8859-1] 
(original)
+++ branches/reactx/reactos/drivers/video/miniport/vbe/vbemp.c [iso-8859-1] Wed 
Dec  8 17:50:17 2010
@@ -532,7 +532,14 @@
    }
 
    if (Result)
+   {
       RequestPacket->StatusBlock->Status = NO_ERROR;
+   }
+   else
+   {
+      RequestPacket->StatusBlock->Information = 0;
+      StatusBlock->Status = ERROR_INVALID_FUNCTION;
+    }
 
    return TRUE;
 }
@@ -755,6 +762,7 @@
 {
    PHYSICAL_ADDRESS FrameBuffer;
    ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
+   BOOLEAN retvalue;
 
    StatusBlock->Information = sizeof(VIDEO_MEMORY_INFORMATION);
 
@@ -776,24 +784,31 @@
             
DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].LinBytesPerScanLine *
             
DeviceExtension->ModeInfo[DeviceExtension->CurrentMode].YResolution;
       }
-   }
-#ifdef VBE12_SUPPORT
+
+       StatusBlock->Status = VideoPortMapMemory(DeviceExtension, 
+                                                FrameBuffer,
+                                                
&MapInformation->VideoRamLength,
+                                                &inIoSpace,
+                                                &MapInformation->VideoRamBase);
+       if (StatusBlock->Status == NO_ERROR)
+       {
+            /* The frame buffer and virtual memory and equivalent in this 
case.*/
+            MapInformation->FrameBufferBase = MapInformation->VideoRamBase;
+            MapInformation->FrameBufferLength = MapInformation->VideoRamLength;
+            retvalue = TRUE;
+       }
+       else
+       {
+           retvalue = FALSE;
+       }
+   }
    else
    {
-      FrameBuffer.QuadPart = 0xA0000;
-      MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress;
-      MapInformation->VideoRamLength = 0x10000;
-   }
-#endif
-
-   VideoPortMapMemory(DeviceExtension, FrameBuffer,
-      &MapInformation->VideoRamLength, &inIoSpace,
-      &MapInformation->VideoRamBase);
-
-   MapInformation->FrameBufferBase = MapInformation->VideoRamBase;
-   MapInformation->FrameBufferLength = MapInformation->VideoRamLength;
-
-   return TRUE;
+      /*  we can not map no linear video mode for VBE 2.0 and higher */
+      retvalue = FALSE;
+   }
+
+   return retvalue;
 }
 
 /*
@@ -809,9 +824,20 @@
    PVIDEO_MEMORY VideoMemory,
    PSTATUS_BLOCK StatusBlock)
 {
-   VideoPortUnmapMemory(DeviceExtension, VideoMemory->RequestedVirtualAddress,
+   BOOLEAN retvalue;
+   StatusBlock->Status VideoPortUnmapMemory(DeviceExtension, 
VideoMemory->RequestedVirtualAddress,
       NULL);
-   return TRUE;
+
+   if (StatusBlock->Status == NO_ERROR)
+   {
+      retvalue = TRUE;
+   }
+   else
+   {
+      retvalue = FALSE;
+   }
+
+   return retvalue;
 }
 
 /*


Reply via email to