Author: tkreuzer Date: Thu Sep 27 21:25:40 2007 New Revision: 29251
URL: http://svn.reactos.org/svn/reactos?rev=29251&view=rev Log: probe the pointer and some cleanup simplification
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c Thu Sep 27 21:25:40 2007 @@ -335,8 +335,8 @@ INT ret = 0; NTSTATUS Status = STATUS_SUCCESS; PDC pDC; - HBITMAP hSourceBitmap = NULL; - SURFOBJ *pDestSurf = NULL, *pSourceSurf = NULL; + HBITMAP hSourceBitmap; + SURFOBJ *pDestSurf, *pSourceSurf; RECTL rcDest; POINTL ptSource; INT DIBWidth; @@ -377,6 +377,7 @@ /* Enter SEH, as the bits are user mode */ _SEH_TRY { + ProbeForRead(Bits, DIBWidth * abs(bmi->bmiHeader.biHeight), 1); hSourceBitmap = EngCreateBitmap(SourceSize, DIBWidth, BitmapFormat(bmi->bmiHeader.biBitCount, bmi->bmiHeader.biCompression), @@ -392,6 +393,7 @@ pSourceSurf = EngLockSurface((HSURF)hSourceBitmap); if (!pSourceSurf) { + EngDeleteSurface((HSURF)hSourceBitmap); Status = STATUS_UNSUCCESSFUL; _SEH_LEAVE; } @@ -412,6 +414,8 @@ NULL, ROP3_TO_ROP4(SRCCOPY));
+ EngUnlockSurface(pSourceSurf); + EngDeleteSurface((HSURF)hSourceBitmap); } _SEH_HANDLE { @@ -425,21 +429,7 @@ ret = ScanLines; }
- if (pSourceSurf) - { - EngUnlockSurface(pSourceSurf); - } - - if (hSourceBitmap) - { - EngDeleteSurface((HSURF)hSourceBitmap); - } - - if (pDestSurf) - { - EngUnlockSurface(pDestSurf); - } - + EngUnlockSurface(pDestSurf); DC_UnlockDc(pDC);
return ret;