mirror of
https://github.com/reactos/reactos.git
synced 2024-07-21 19:58:08 +00:00
[WIN32K]
NtGdiStretchDIBitsInternal: don't call NtGdiGetDCObject and NtGdiCreateCompatibleDC with a dc locked. These cases are not harmful, but generally Nt* and Gre* should never be called with an exclusive gdi lock held. Also don't return in failure case with the dc still locked. svn path=/trunk/; revision=50826
This commit is contained in:
parent
ebf22c9469
commit
3e75942b10
|
@ -1043,13 +1043,6 @@ NtGdiStretchDIBitsInternal(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pdc = DC_LockDc(hDC)))
|
|
||||||
{
|
|
||||||
ExFreePoolWithTag(safeBits, TAG_DIB);
|
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
ProbeForRead(BitsInfo, cjMaxInfo, 1);
|
ProbeForRead(BitsInfo, cjMaxInfo, 1);
|
||||||
|
@ -1076,6 +1069,13 @@ NtGdiStretchDIBitsInternal(
|
||||||
|
|
||||||
hBitmap = NtGdiGetDCObject(hDC, OBJ_BITMAP);
|
hBitmap = NtGdiGetDCObject(hDC, OBJ_BITMAP);
|
||||||
|
|
||||||
|
if (!(pdc = DC_LockDc(hDC)))
|
||||||
|
{
|
||||||
|
ExFreePoolWithTag(safeBits, TAG_DIB);
|
||||||
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (XDest == 0 && YDest == 0 && XSrc == 0 && XSrc == 0 &&
|
if (XDest == 0 && YDest == 0 && XSrc == 0 && XSrc == 0 &&
|
||||||
DestWidth == SrcWidth && DestHeight == SrcHeight &&
|
DestWidth == SrcWidth && DestHeight == SrcHeight &&
|
||||||
compr == BI_RGB &&
|
compr == BI_RGB &&
|
||||||
|
@ -1091,14 +1091,17 @@ NtGdiStretchDIBitsInternal(
|
||||||
{
|
{
|
||||||
/* fast path */
|
/* fast path */
|
||||||
ret = IntSetDIBits(pdc, hBitmap, 0, height, safeBits, BitsInfo, Usage);
|
ret = IntSetDIBits(pdc, hBitmap, 0, height, safeBits, BitsInfo, Usage);
|
||||||
|
DC_UnlockDc(pdc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* slow path - need to use StretchBlt */
|
/* slow path - need to use StretchBlt */
|
||||||
|
|
||||||
hdcMem = NtGdiCreateCompatibleDC(hDC);
|
|
||||||
hBitmap = DIB_CreateDIBSection(pdc, BitsInfo, Usage, &pvBits, NULL, 0, 0);
|
hBitmap = DIB_CreateDIBSection(pdc, BitsInfo, Usage, &pvBits, NULL, 0, 0);
|
||||||
|
DC_UnlockDc(pdc);
|
||||||
|
|
||||||
|
hdcMem = NtGdiCreateCompatibleDC(hDC);
|
||||||
if(!hBitmap)
|
if(!hBitmap)
|
||||||
{
|
{
|
||||||
DPRINT1("Error, failed to create a DIB section\n");
|
DPRINT1("Error, failed to create a DIB section\n");
|
||||||
|
@ -1123,7 +1126,6 @@ NtGdiStretchDIBitsInternal(
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ExFreePoolWithTag(safeBits, TAG_DIB);
|
ExFreePoolWithTag(safeBits, TAG_DIB);
|
||||||
DC_UnlockDc(pdc);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue