Author: tkreuzer Date: Sat Feb 19 22:29:31 2011 New Revision: 50826
URL: http://svn.reactos.org/svn/reactos?rev=50826&view=rev Log: [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.
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 [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Sat Feb 19 22:29:31 2011 @@ -1043,13 +1043,6 @@ return 0; }
- if (!(pdc = DC_LockDc(hDC))) - { - ExFreePoolWithTag(safeBits, TAG_DIB); - EngSetLastError(ERROR_INVALID_HANDLE); - return 0; - } - _SEH2_TRY { ProbeForRead(BitsInfo, cjMaxInfo, 1); @@ -1075,6 +1068,13 @@ }
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 && DestWidth == SrcWidth && DestHeight == SrcHeight && @@ -1091,14 +1091,17 @@ { /* fast path */ ret = IntSetDIBits(pdc, hBitmap, 0, height, safeBits, BitsInfo, Usage); + DC_UnlockDc(pdc); goto cleanup; } }
/* slow path - need to use StretchBlt */
+ hBitmap = DIB_CreateDIBSection(pdc, BitsInfo, Usage, &pvBits, NULL, 0, 0); + DC_UnlockDc(pdc); + hdcMem = NtGdiCreateCompatibleDC(hDC); - hBitmap = DIB_CreateDIBSection(pdc, BitsInfo, Usage, &pvBits, NULL, 0, 0); if(!hBitmap) { DPRINT1("Error, failed to create a DIB section\n"); @@ -1123,7 +1126,6 @@
cleanup: ExFreePoolWithTag(safeBits, TAG_DIB); - DC_UnlockDc(pdc); return ret; }