Author: tkreuzer
Date: Sun Mar 8 22:44:36 2015
New Revision: 66612
URL:
http://svn.reactos.org/svn/reactos?rev=66612&view=rev
Log:
[WIN32K]
NtGdiSetDIBitsToDeviceInternal: Check for ScanLines == 0 and clean up exit pathes. Fixes
assertion failure in gdi32_winetest:bitmap
Modified:
trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Sun Mar 8 22:44:36 2015
@@ -461,7 +461,7 @@
{
INT ret = 0;
NTSTATUS Status = STATUS_SUCCESS;
- PDC pDC;
+ PDC pDC = NULL;
HBITMAP hSourceBitmap = NULL, hMaskBitmap = NULL;
SURFOBJ *pDestSurf, *pSourceSurf = NULL, *pMaskSurf = NULL;
SURFACE *pSurf;
@@ -493,21 +493,25 @@
if (!NT_SUCCESS(Status))
{
- goto Exit2;
+ goto Exit;
}
ScanLines = min(ScanLines, abs(bmi->bmiHeader.biHeight) - StartScan);
+ if (ScanLines == 0)
+ {
+ DPRINT1("ScanLines == 0\n");
+ goto Exit;
+ }
pDC = DC_LockDc(hDC);
if (!pDC)
{
EngSetLastError(ERROR_INVALID_HANDLE);
- goto Exit2;
+ goto Exit;
}
if (pDC->dctype == DC_TYPE_INFO)
{
- DC_UnlockDc(pDC);
goto Exit;
}
@@ -637,14 +641,13 @@
}
if (ppalDIB) PALETTE_ShareUnlockPalette(ppalDIB);
-
if (pSourceSurf) EngUnlockSurface(pSourceSurf);
if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap);
if (pMaskSurf) EngUnlockSurface(pMaskSurf);
if (hMaskBitmap) EngDeleteSurface((HSURF)hMaskBitmap);
- DC_UnlockDc(pDC);
-Exit2:
+ if (pDC) DC_UnlockDc(pDC);
ExFreePoolWithTag(pbmiSafe, 'pmTG');
+
return ret;
}