[ros-diffs] [jimtabor] 37522: - Pass more bitmap cross tests, 16 bit is down to 52. I have more fixes that relate to that number, need more time to work on it. Fixed SEH abuse in CreateBitmap.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Fri Nov 21 19:34:31 CET 2008


Author: jimtabor
Date: Fri Nov 21 12:34:31 2008
New Revision: 37522

URL: http://svn.reactos.org/svn/reactos?rev=37522&view=rev
Log:
- Pass more bitmap cross tests, 16 bit is down to 52. I have more fixes that relate to that number, need more time to work on it. Fixed SEH abuse in CreateBitmap.

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/surface.c
    trunk/reactos/subsystems/win32/win32k/include/dc.h
    trunk/reactos/subsystems/win32/win32k/include/misc.h
    trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c

Modified: trunk/reactos/subsystems/win32/win32k/eng/surface.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/surface.c?rev=37522&r1=37521&r2=37522&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/surface.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/surface.c [iso-8859-1] Fri Nov 21 12:34:31 2008
@@ -362,6 +362,7 @@
             {
                 BITMAPOBJ_UnlockBitmap(BitmapObj);
                 BITMAPOBJ_FreeBitmapByHandle(NewBitmap);
+                SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
                 return 0;
             }
         }

Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/dc.h?rev=37522&r1=37521&r2=37522&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Fri Nov 21 12:34:31 2008
@@ -185,12 +185,12 @@
 
   PVOID         pvGammaRamp;    // Gamma ramp pointer.
 
+  HSURF         FillPatterns[HS_DDI_MAX];
+
+  ULONG         DxDd_nCount;
+
   DHPDEV        hPDev;          // DHPDEV for device.
-
-  HSURF         FillPatterns[HS_DDI_MAX];
-
-  ULONG         DxDd_nCount;
-
+  PVOID         ppalSurf;       // PEPALOBJ/PPALGDI for this device.
   DEVINFO       DevInfo;
   GDIINFO       GDIInfo;
   HSURF         pSurface;       // SURFACE for this device.

Modified: trunk/reactos/subsystems/win32/win32k/include/misc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/misc.h?rev=37522&r1=37521&r2=37522&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/misc.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/misc.h [iso-8859-1] Fri Nov 21 12:34:31 2008
@@ -37,5 +37,7 @@
 ULONG FASTCALL IntSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
 DWORD STDCALL IntGetQueueStatus(BOOL ClearChanges);
 VOID FASTCALL IntUserManualGuiCheck(LONG Check);
+PVOID NTAPI HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *);
+VOID NTAPI HackUnsecureVirtualMemory(IN PVOID);
 
 #endif /* __WIN32K_MISC_H */

Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c?rev=37522&r1=37521&r2=37522&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Fri Nov 21 12:34:31 2008
@@ -110,26 +110,25 @@
     UINT  BitsPixel,
     IN OPTIONAL LPBYTE pUnsafeBits)
 {
-   HBITMAP hBitmap;
-
-   _SEH_TRY
+   if (pUnsafeBits)
    {
-      if (pUnsafeBits)
+      BOOL Hit = FALSE;
+      UINT cjBits = BITMAPOBJ_GetWidthBytes(Width, BitsPixel) * abs(Height);
+
+      _SEH_TRY
       {
-         UINT cjBits = BITMAPOBJ_GetWidthBytes(Width, BitsPixel) * abs(Height);
          ProbeForRead(pUnsafeBits, cjBits, 1);
       }
-
-      hBitmap = IntGdiCreateBitmap(Width, Height, Planes, BitsPixel, pUnsafeBits);
-
+      _SEH_HANDLE
+      {
+         Hit = TRUE;
+      }
+      _SEH_END
+
+      if (Hit) return 0;
    }
-   _SEH_HANDLE
-   {
-      hBitmap = 0;
-   }
-   _SEH_END
-
-   return hBitmap;
+
+   return IntGdiCreateBitmap(Width, Height, Planes, BitsPixel, pUnsafeBits);
 }
 
 BOOL INTERNAL_CALL
@@ -195,6 +194,12 @@
 {
 	HBITMAP Bmp;
 	PDC Dc;
+
+	if ( Width <= 0 || Height <= 0 || (Width * Height) > 0x3FFFFFFF )
+	{
+           SetLastWin32Error(ERROR_INVALID_PARAMETER);
+           return NULL;
+        }
 
 	Dc = DC_LockDc(hDC);
 



More information about the Ros-diffs mailing list