probe the pointer and some cleanup simplification

svn path=/trunk/; revision=29251
This commit is contained in:
Timo Kreuzer 2007-09-27 17:25:40 +00:00
parent 466ad8f165
commit 9c009fef95

View file

@ -335,8 +335,8 @@ NtGdiSetDIBitsToDeviceInternal(
INT ret = 0; INT ret = 0;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
PDC pDC; PDC pDC;
HBITMAP hSourceBitmap = NULL; HBITMAP hSourceBitmap;
SURFOBJ *pDestSurf = NULL, *pSourceSurf = NULL; SURFOBJ *pDestSurf, *pSourceSurf;
RECTL rcDest; RECTL rcDest;
POINTL ptSource; POINTL ptSource;
INT DIBWidth; INT DIBWidth;
@ -377,6 +377,7 @@ NtGdiSetDIBitsToDeviceInternal(
/* Enter SEH, as the bits are user mode */ /* Enter SEH, as the bits are user mode */
_SEH_TRY _SEH_TRY
{ {
ProbeForRead(Bits, DIBWidth * abs(bmi->bmiHeader.biHeight), 1);
hSourceBitmap = EngCreateBitmap(SourceSize, hSourceBitmap = EngCreateBitmap(SourceSize,
DIBWidth, DIBWidth,
BitmapFormat(bmi->bmiHeader.biBitCount, bmi->bmiHeader.biCompression), BitmapFormat(bmi->bmiHeader.biBitCount, bmi->bmiHeader.biCompression),
@ -392,6 +393,7 @@ NtGdiSetDIBitsToDeviceInternal(
pSourceSurf = EngLockSurface((HSURF)hSourceBitmap); pSourceSurf = EngLockSurface((HSURF)hSourceBitmap);
if (!pSourceSurf) if (!pSourceSurf)
{ {
EngDeleteSurface((HSURF)hSourceBitmap);
Status = STATUS_UNSUCCESSFUL; Status = STATUS_UNSUCCESSFUL;
_SEH_LEAVE; _SEH_LEAVE;
} }
@ -412,6 +414,8 @@ NtGdiSetDIBitsToDeviceInternal(
NULL, NULL,
ROP3_TO_ROP4(SRCCOPY)); ROP3_TO_ROP4(SRCCOPY));
EngUnlockSurface(pSourceSurf);
EngDeleteSurface((HSURF)hSourceBitmap);
} }
_SEH_HANDLE _SEH_HANDLE
{ {
@ -425,21 +429,7 @@ NtGdiSetDIBitsToDeviceInternal(
ret = ScanLines; ret = ScanLines;
} }
if (pSourceSurf) EngUnlockSurface(pDestSurf);
{
EngUnlockSurface(pSourceSurf);
}
if (hSourceBitmap)
{
EngDeleteSurface((HSURF)hSourceBitmap);
}
if (pDestSurf)
{
EngUnlockSurface(pDestSurf);
}
DC_UnlockDc(pDC); DC_UnlockDc(pDC);
return ret; return ret;