Added CriticalRegions at locations working with FirstDce.

svn path=/trunk/; revision=28272
This commit is contained in:
James Tabor 2007-08-10 18:14:38 +00:00
parent be5bce8b2a
commit 63316363bd

View file

@ -138,8 +138,10 @@ DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type)
pDce->hClipRgn = NULL; pDce->hClipRgn = NULL;
pDce->pProcess = NULL; pDce->pProcess = NULL;
KeEnterCriticalRegion();
pDce->next = FirstDce; pDce->next = FirstDce;
FirstDce = pDce; FirstDce = pDce;
KeLeaveCriticalRegion();
if (Type == DCE_WINDOW_DC) //Window DCE have ownership. if (Type == DCE_WINDOW_DC) //Window DCE have ownership.
{ {
@ -434,7 +436,7 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
{ {
DCE* DceEmpty = NULL; DCE* DceEmpty = NULL;
DCE* DceUnused = NULL; DCE* DceUnused = NULL;
KeEnterCriticalRegion();
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next) for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
{ {
if ((Dce->DCXFlags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE) if ((Dce->DCXFlags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE)
@ -456,7 +458,7 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
} }
} }
} }
KeLeaveCriticalRegion();
if (Dce == NULL) if (Dce == NULL)
{ {
@ -566,7 +568,7 @@ BOOL FASTCALL
DCE_Cleanup(PDCE pDce) DCE_Cleanup(PDCE pDce)
{ {
PDCE PrevInList; PDCE PrevInList;
KeEnterCriticalRegion();
if (pDce == FirstDce) if (pDce == FirstDce)
{ {
FirstDce = pDce->next; FirstDce = pDce->next;
@ -584,7 +586,7 @@ DCE_Cleanup(PDCE pDce)
} }
assert(NULL != PrevInList); assert(NULL != PrevInList);
} }
KeLeaveCriticalRegion();
return NULL != PrevInList; return NULL != PrevInList;
} }
@ -592,15 +594,16 @@ HWND FASTCALL
IntWindowFromDC(HDC hDc) IntWindowFromDC(HDC hDc)
{ {
DCE *Dce; DCE *Dce;
KeEnterCriticalRegion();
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next) for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
{ {
if(Dce->hDC == hDc) if(Dce->hDC == hDc)
{ {
KeLeaveCriticalRegion();
return Dce->hwndCurrent; return Dce->hwndCurrent;
} }
} }
KeLeaveCriticalRegion();
return 0; return 0;
} }
@ -614,12 +617,12 @@ UserReleaseDC(PWINDOW_OBJECT Window, HDC hDc, BOOL EndPaint)
dce = FirstDce; dce = FirstDce;
DPRINT("%p %p\n", Window, hDc); DPRINT("%p %p\n", Window, hDc);
KeEnterCriticalRegion();
while (dce && (dce->hDC != hDc)) while (dce && (dce->hDC != hDc))
{ {
dce = dce->next; dce = dce->next;
} }
KeLeaveCriticalRegion();
if (dce && (dce->DCXFlags & DCX_DCEBUSY)) if (dce && (dce->DCXFlags & DCX_DCEBUSY))
{ {
nRet = DceReleaseDC(dce, EndPaint); nRet = DceReleaseDC(dce, EndPaint);
@ -694,6 +697,7 @@ DceFreeWindowDCE(PWINDOW_OBJECT Window)
DCE *pDCE; DCE *pDCE;
pDCE = FirstDce; pDCE = FirstDce;
KeEnterCriticalRegion();
while (pDCE) while (pDCE)
{ {
if (pDCE->hwndCurrent == Window->hSelf) if (pDCE->hwndCurrent == Window->hSelf)
@ -734,15 +738,18 @@ DceFreeWindowDCE(PWINDOW_OBJECT Window)
} }
pDCE = pDCE->next; pDCE = pDCE->next;
} }
KeLeaveCriticalRegion();
} }
VOID FASTCALL VOID FASTCALL
DceEmptyCache() DceEmptyCache()
{ {
KeEnterCriticalRegion();
while (FirstDce != NULL) while (FirstDce != NULL)
{ {
FirstDce = DceFreeDCE(FirstDce, TRUE); FirstDce = DceFreeDCE(FirstDce, TRUE);
} }
KeLeaveCriticalRegion();
} }
VOID FASTCALL VOID FASTCALL
@ -758,7 +765,6 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window)
{ {
return; return;
} }
pDCE = FirstDce; pDCE = FirstDce;
while (pDCE) while (pDCE)
{ {
@ -825,10 +831,8 @@ DceResetActiveDCEs(PWINDOW_OBJECT Window)
// UserDerefObject(CurrentWindow); // UserDerefObject(CurrentWindow);
} }
} }
pDCE = pDCE->next; pDCE = pDCE->next;
} }
} }