Author: jimtabor
Date: Wed Feb 25 13:25:57 2015
New Revision: 66452
URL:
http://svn.reactos.org/svn/reactos?rev=66452&view=rev
Log:
[NtUser]
- Fix API GetDCEx tests! Dedicated to the great work by Timo Kreuzer.
- This uncovered a loop flaw, witch passed on any DCE last accessed.
Modified:
trunk/reactos/win32ss/user/ntuser/windc.c
Modified: trunk/reactos/win32ss/user/ntuser/windc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/windc.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] Wed Feb 25 13:25:57 2015
@@ -366,7 +366,7 @@
Flags |= DCX_CACHE;
}
- if (Flags & (DCX_WINDOW | DCX_PARENTCLIP)) Flags |= DCX_CACHE;
+ if (Flags & DCX_PARENTCLIP) Flags |= DCX_CACHE;
// When GetDC is called with hWnd nz, DCX_CACHE & _WINDOW are clear w _USESTYLE
set.
if (Flags & DCX_USESTYLE)
@@ -488,6 +488,7 @@
break;
}
}
+ Dce = NULL; // Loop issue?
}
KeLeaveCriticalRegion();
@@ -497,7 +498,7 @@
{
Dce = DceAllocDCE(NULL, DCE_CACHE_DC);
}
- if (!Dce) return NULL;
+ if (Dce == NULL) return NULL;
Dce->hwndCurrent = (Wnd ? Wnd->head.h : NULL);
Dce->pwndOrg = Dce->pwndClip = Wnd;
@@ -510,20 +511,31 @@
{
Dce = CONTAINING_RECORD(ListEntry, DCE, List);
ListEntry = ListEntry->Flink;
- // Check for Window handle than HDC match for CLASS.
- if (Dce->hwndCurrent == Wnd->head.h)
+
+ // Skip Cache DCE entries.
+ if (!(Dce->DCXFlags & DCX_CACHE))
{
- bUpdateVisRgn = FALSE;
- break;
+ // Check for Window handle than HDC match for CLASS.
+ if (Dce->hwndCurrent == Wnd->head.h)
+ {
+ bUpdateVisRgn = FALSE;
+ break;
+ }
+ else if (Dce->hDC == hDC) break;
}
- if (Dce->hDC == hDC) break;
+ Dce = NULL; // Loop issue?
}
KeLeaveCriticalRegion();
+
+ if (Dce == NULL)
+ {
+ return(NULL);
+ }
if ( (Flags & (DCX_INTERSECTRGN|DCX_EXCLUDERGN)) &&
(Dce->DCXFlags & (DCX_INTERSECTRGN|DCX_EXCLUDERGN)) )
{
- DceDeleteClipRgn(Dce);
+ DceDeleteClipRgn(Dce);
}
}
// First time use hax, need to use DceAllocDCE during window display init.