reactos/subsys/win32k/ntuser
diff -u -r1.61 -r1.62
--- windc.c 23 Mar 2004 18:08:07 -0000 1.61
+++ windc.c 5 Apr 2004 20:46:15 -0000 1.62
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: windc.c,v 1.61 2004/03/23 18:08:07 weiden Exp $
+/* $Id: windc.c,v 1.62 2004/04/05 20:46:15 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -49,14 +49,26 @@
/* GLOBALS *******************************************************************/
+/* NOTE - I think we should store this per window station (including gdi objects) */
+
+static FAST_MUTEX DceListLock;
static PDCE FirstDce = NULL;
static HDC defaultDCstate;
+#define DCE_LockList ExAcquireFastMutex(&DceListLock)
+#define DCE_UnlockList ExReleaseFastMutex(&DceListLock)
+
#define DCX_CACHECOMPAREMASK (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | \
DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)
/* FUNCTIONS *****************************************************************/
+VOID FASTCALL
+DceInit(VOID)
+{
+ ExInitializeFastMutex(&DceListLock);
+}
+
HRGN STDCALL
DceGetVisRgn(HWND hWnd, ULONG Flags, HWND hWndChild, ULONG CFlags)
{
@@ -111,8 +123,10 @@
}
Dce->hwndCurrent = hWnd;
Dce->hClipRgn = NULL;
+ DCE_LockList;
Dce->next = FirstDce;
FirstDce = Dce;
+ DCE_UnlockList;
if (Type != DCE_CACHE_DC)
{
@@ -408,6 +422,8 @@
{
DCE* DceEmpty = NULL;
DCE* DceUnused = NULL;
+
+ DCE_LockList;
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
{
@@ -430,6 +446,8 @@
}
}
+ DCE_UnlockList;
+
if (Dce == NULL)
{
Dce = (DceEmpty == NULL) ? DceEmpty : DceUnused;
@@ -555,7 +573,9 @@
DCE_InternalDelete(PDCE Dce)
{
PDCE PrevInList;
-
+
+ DCE_LockList;
+
if (Dce == FirstDce)
{
FirstDce = Dce->next;
@@ -574,6 +594,8 @@
assert(NULL != PrevInList);
}
+ DCE_UnlockList;
+
return NULL != PrevInList;
}
@@ -581,13 +603,17 @@
IntWindowFromDC(HDC hDc)
{
DCE *Dce;
+
+ DCE_LockList;
for (Dce = FirstDce; Dce != NULL; Dce = Dce->next)
{
if(Dce->hDC == hDc)
{
+ DCE_UnlockList;
return Dce->hwndCurrent;
}
}
+ DCE_UnlockList;
return 0;
}
@@ -597,7 +623,8 @@
DCE *dce;
INT nRet = 0;
- /* FIXME USER_Lock(); */
+ DCE_LockList;
+
dce = FirstDce;
DPRINT("%p %p\n", hWnd, hDc);
@@ -612,7 +639,7 @@
nRet = DceReleaseDC(dce);
}
- /* FIXME USER_Unlock(); */
+ DCE_UnlockList;
return nRet;
}
@@ -631,17 +658,9 @@
return NULL;
}
-#if 0 /* FIXME */
- USER_Lock();
-#endif
-
ret = dce->next;
#if 0 /* FIXME */
- USER_Unlock();
-#endif
-
-#if 0 /* FIXME */
SetDCHook(dce->hDC, NULL, 0L);
#endif
@@ -668,6 +687,8 @@
{
DCE *pDCE;
+ DCE_LockList;
+
pDCE = FirstDce;
while (pDCE)
{
@@ -709,15 +730,18 @@
}
pDCE = pDCE->next;
}
+ DCE_UnlockList;
}
void FASTCALL
DceEmptyCache()
{
+ DCE_LockList;
while (FirstDce != NULL)
{
DceFreeDCE(FirstDce);
}
+ DCE_UnlockList;
}
VOID FASTCALL
@@ -732,6 +756,8 @@
return;
}
+ DCE_LockList;
+
pDCE = FirstDce;
while (pDCE)
{
@@ -785,6 +811,8 @@
}
pDCE = pDCE->next;
}
+
+ DCE_UnlockList;
}
/* EOF */