Author: jimtabor Date: Fri Aug 10 22:14:38 2007 New Revision: 28272
URL: http://svn.reactos.org/svn/reactos?rev=28272&view=rev Log: Added CriticalRegions at locations working with FirstDce.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Fri Aug 10 22:14:38 2007 @@ -137,10 +137,12 @@ pDce->hwndCurrent = (Window ? Window->hSelf : NULL); pDce->hClipRgn = NULL; pDce->pProcess = NULL; - + + KeEnterCriticalRegion(); pDce->next = FirstDce; FirstDce = pDce; - + KeLeaveCriticalRegion(); + if (Type == DCE_WINDOW_DC) //Window DCE have ownership. { DC_SetOwnership(pDce->hDC, PsGetCurrentProcess()); @@ -434,7 +436,7 @@ { DCE* DceEmpty = NULL; DCE* DceUnused = NULL; - + KeEnterCriticalRegion(); for (Dce = FirstDce; Dce != NULL; Dce = Dce->next) { if ((Dce->DCXFlags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE) @@ -456,7 +458,7 @@ } } } - + KeLeaveCriticalRegion();
if (Dce == NULL) { @@ -566,7 +568,7 @@ DCE_Cleanup(PDCE pDce) { PDCE PrevInList; - + KeEnterCriticalRegion(); if (pDce == FirstDce) { FirstDce = pDce->next; @@ -584,7 +586,7 @@ } assert(NULL != PrevInList); } - + KeLeaveCriticalRegion(); return NULL != PrevInList; }
@@ -592,15 +594,16 @@ IntWindowFromDC(HDC hDc) { DCE *Dce; - + KeEnterCriticalRegion(); for (Dce = FirstDce; Dce != NULL; Dce = Dce->next) { if(Dce->hDC == hDc) { + KeLeaveCriticalRegion(); return Dce->hwndCurrent; } } - + KeLeaveCriticalRegion(); return 0; }
@@ -614,12 +617,12 @@ dce = FirstDce;
DPRINT("%p %p\n", Window, hDc); - + KeEnterCriticalRegion(); while (dce && (dce->hDC != hDc)) { dce = dce->next; } - + KeLeaveCriticalRegion(); if (dce && (dce->DCXFlags & DCX_DCEBUSY)) { nRet = DceReleaseDC(dce, EndPaint); @@ -654,7 +657,7 @@ DceFreeDCE(PDCE pdce, BOOLEAN Force) { DCE *ret; - + if (NULL == pdce) { return NULL; @@ -694,6 +697,7 @@ DCE *pDCE;
pDCE = FirstDce; + KeEnterCriticalRegion(); while (pDCE) { if (pDCE->hwndCurrent == Window->hSelf) @@ -734,15 +738,18 @@ } pDCE = pDCE->next; } + KeLeaveCriticalRegion(); }
VOID FASTCALL DceEmptyCache() { + KeEnterCriticalRegion(); while (FirstDce != NULL) { FirstDce = DceFreeDCE(FirstDce, TRUE); } + KeLeaveCriticalRegion(); }
VOID FASTCALL @@ -758,7 +765,6 @@ { return; } - pDCE = FirstDce; while (pDCE) { @@ -825,10 +831,8 @@ // UserDerefObject(CurrentWindow); } } - pDCE = pDCE->next; } - }