svn path=/trunk/; revision=8350
This commit is contained in:
Thomas Bluemel 2004-02-24 13:27:03 +00:00
parent e3ead6ead5
commit 5299e2afd5
37 changed files with 465 additions and 370 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: bitblt.c,v 1.41 2004/02/06 20:36:31 gvg Exp $ /* $Id: bitblt.c,v 1.42 2004/02/24 13:27:02 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -40,6 +40,7 @@
#include <include/object.h> #include <include/object.h>
#include <include/dib.h> #include <include/dib.h>
#include <include/surface.h> #include <include/surface.h>
#include <include/eng.h>
#include <include/inteng.h> #include <include/inteng.h>
#define NDEBUG #define NDEBUG
@ -519,11 +520,11 @@ IntEngBitBlt(SURFOBJ *DestObj,
/* Call the driver's DrvBitBlt if available */ /* Call the driver's DrvBitBlt if available */
if (NULL != DestGDI->BitBlt) if (NULL != DestGDI->BitBlt)
{ {
ExAcquireFastMutex(DestGDI->DriverLock); IntLockGDIDriver(DestGDI);
ret = DestGDI->BitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation, ret = DestGDI->BitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
&OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin, &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin,
Rop4); Rop4);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
} }
if (! ret) if (! ret)
@ -837,10 +838,10 @@ IntEngStretchBlt(SURFOBJ *DestObj,
/* Drv->StretchBlt (look at http://www.osr.com/ddk/graphics/ddifncs_3ew7.htm ) /* Drv->StretchBlt (look at http://www.osr.com/ddk/graphics/ddifncs_3ew7.htm )
SURFOBJ *psoMask // optional, if it exists, then rop4=0xCCAA, otherwise rop4=0xCCCC */ SURFOBJ *psoMask // optional, if it exists, then rop4=0xCCAA, otherwise rop4=0xCCCC */
// FIXME: MaskOrigin is always NULL ! // FIXME: MaskOrigin is always NULL !
ExAcquireFastMutex(DestGDI->DriverLock); IntLockGDIDriver(DestGDI);
ret = DestGDI->StretchBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation, ret = DestGDI->StretchBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
&ca, BrushOrigin, &OutputRect, &InputRect, NULL, Mode); &ca, BrushOrigin, &OutputRect, &InputRect, NULL, Mode);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
} }
if (! ret) if (! ret)
@ -977,10 +978,10 @@ EngMaskBitBlt(SURFOBJ *DestObj,
} }
DestGDI = (SURFGDI*)AccessInternalObjectFromUserObject(DestObj); DestGDI = (SURFGDI*)AccessInternalObjectFromUserObject(DestObj);
ExAcquireFastMutex(DestGDI->DriverLock); IntLockGDIDriver(DestGDI);
if (! IntEngEnter(&EnterLeaveSource, NULL, &InputRect, TRUE, &Translate, &InputObj)) if (! IntEngEnter(&EnterLeaveSource, NULL, &InputRect, TRUE, &Translate, &InputObj))
{ {
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
return FALSE; return FALSE;
} }
@ -1036,14 +1037,14 @@ EngMaskBitBlt(SURFOBJ *DestObj,
if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top) if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
{ {
IntEngLeave(&EnterLeaveSource); IntEngLeave(&EnterLeaveSource);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
return TRUE; return TRUE;
} }
if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj)) if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj))
{ {
IntEngLeave(&EnterLeaveSource); IntEngLeave(&EnterLeaveSource);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
return FALSE; return FALSE;
} }
@ -1138,7 +1139,7 @@ EngMaskBitBlt(SURFOBJ *DestObj,
IntEngLeave(&EnterLeaveDest); IntEngLeave(&EnterLeaveDest);
IntEngLeave(&EnterLeaveSource); IntEngLeave(&EnterLeaveSource);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
/* Dummy BitBlt to let driver know that something has changed. /* Dummy BitBlt to let driver know that something has changed.
0x00AA0029 is the Rop for D (no-op) */ 0x00AA0029 is the Rop for D (no-op) */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: copybits.c,v 1.20 2004/01/16 19:32:00 gvg Exp $ /* $Id: copybits.c,v 1.21 2004/02/24 13:27:02 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -75,9 +75,9 @@ EngCopyBits(SURFOBJ *Dest,
if (DestGDI->CopyBits!=NULL) if (DestGDI->CopyBits!=NULL)
{ {
ExAcquireFastMutex(DestGDI->DriverLock); IntLockGDIDriver(DestGDI);
ret = DestGDI->CopyBits(Dest, Source, Clip, ColorTranslation, DestRect, SourcePoint); ret = DestGDI->CopyBits(Dest, Source, Clip, ColorTranslation, DestRect, SourcePoint);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
MouseSafetyOnDrawEnd(Source, SourceGDI); MouseSafetyOnDrawEnd(Source, SourceGDI);
MouseSafetyOnDrawEnd(Dest, DestGDI); MouseSafetyOnDrawEnd(Dest, DestGDI);
@ -93,9 +93,9 @@ EngCopyBits(SURFOBJ *Dest,
if (SourceGDI->CopyBits!=NULL) if (SourceGDI->CopyBits!=NULL)
{ {
ExAcquireFastMutex(DestGDI->DriverLock); IntLockGDIDriver(DestGDI);
ret = SourceGDI->CopyBits(Dest, Source, Clip, ColorTranslation, DestRect, SourcePoint); ret = SourceGDI->CopyBits(Dest, Source, Clip, ColorTranslation, DestRect, SourcePoint);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
MouseSafetyOnDrawEnd(Source, SourceGDI); MouseSafetyOnDrawEnd(Source, SourceGDI);
MouseSafetyOnDrawEnd(Dest, DestGDI); MouseSafetyOnDrawEnd(Dest, DestGDI);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: gradient.c,v 1.4 2004/02/09 22:16:50 weiden Exp $ /* $Id: gradient.c,v 1.5 2004/02/24 13:27:02 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -29,6 +29,7 @@
#include <ddk/winddi.h> #include <ddk/winddi.h>
#include <ddk/ntddmou.h> #include <ddk/ntddmou.h>
#include <include/eng.h>
#include <include/object.h> #include <include/object.h>
#include <include/paint.h> #include <include/paint.h>
#include <include/surface.h> #include <include/surface.h>
@ -549,10 +550,10 @@ IntEngGradientFill(
pco->rclBounds.right, pco->rclBounds.bottom); pco->rclBounds.right, pco->rclBounds.bottom);
if((psoDest->iType != STYPE_BITMAP) && SurfGDI->GradientFill) if((psoDest->iType != STYPE_BITMAP) && SurfGDI->GradientFill)
{ {
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
Ret = SurfGDI->GradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, Ret = SurfGDI->GradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
prclExtents, pptlDitherOrg, ulMode); prclExtents, pptlDitherOrg, ulMode);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
MouseSafetyOnDrawEnd(psoDest, SurfGDI); MouseSafetyOnDrawEnd(psoDest, SurfGDI);
return Ret; return Ret;
} }
@ -564,10 +565,10 @@ IntEngGradientFill(
0x00AA0029 is the Rop for D (no-op) */ 0x00AA0029 is the Rop for D (no-op) */
if(SurfGDI->BitBlt) if(SurfGDI->BitBlt)
{ {
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->BitBlt(psoDest, NULL, NULL, pco, pxlo, SurfGDI->BitBlt(psoDest, NULL, NULL, pco, pxlo,
prclExtents, pptlDitherOrg, NULL, NULL, NULL, 0x00AA0029); prclExtents, pptlDitherOrg, NULL, NULL, NULL, 0x00AA0029);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
MouseSafetyOnDrawEnd(psoDest, SurfGDI); MouseSafetyOnDrawEnd(psoDest, SurfGDI);
return TRUE; return TRUE;
} }

View file

@ -16,12 +16,13 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Id: lineto.c,v 1.29 2004/01/16 19:32:00 gvg Exp $ * $Id: lineto.c,v 1.30 2004/02/24 13:27:02 weiden Exp $
*/ */
#include <ddk/winddi.h> #include <ddk/winddi.h>
#include <ddk/ntddmou.h> #include <ddk/ntddmou.h>
#include <include/inteng.h> #include <include/inteng.h>
#include <include/eng.h>
#include <include/dib.h> #include <include/dib.h>
#include "clip.h" #include "clip.h"
#include "objects.h" #include "objects.h"
@ -521,9 +522,9 @@ IntEngLineTo(SURFOBJ *DestSurf,
if (NULL != SurfGDI->LineTo) if (NULL != SurfGDI->LineTo)
{ {
/* Call the driver's DrvLineTo */ /* Call the driver's DrvLineTo */
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
ret = SurfGDI->LineTo(DestSurf, Clip, Brush, x1, y1, x2, y2, /*RectBounds*/&b, mix); ret = SurfGDI->LineTo(DestSurf, Clip, Brush, x1, y1, x2, y2, /*RectBounds*/&b, mix);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
} }
#if 0 #if 0

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: mouse.c,v 1.61 2004/02/19 21:12:09 weiden Exp $ /* $Id: mouse.c,v 1.62 2004/02/24 13:27:02 weiden Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -154,9 +154,9 @@ MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
return FALSE; return FALSE;
} }
CurInfo->SafetySwitch = TRUE; CurInfo->SafetySwitch = TRUE;
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, -1, -1, NULL); SurfGDI->MovePointer(SurfObj, -1, -1, NULL);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
ExReleaseFastMutex(&CurInfo->CursorMutex); ExReleaseFastMutex(&CurInfo->CursorMutex);
} }
@ -224,9 +224,9 @@ MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI)
ObDereferenceObject(InputWindowStation); ObDereferenceObject(InputWindowStation);
return FALSE; return FALSE;
} }
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect); SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect); SetPointerRect(CurInfo, &PointerRect);
CurInfo->SafetySwitch = FALSE; CurInfo->SafetySwitch = FALSE;
} }
@ -280,9 +280,9 @@ MouseMoveCursor(LONG X, LONG Y)
if(CurInfo->Enabled) if(CurInfo->Enabled)
{ {
ExAcquireFastMutex(&CurInfo->CursorMutex); ExAcquireFastMutex(&CurInfo->CursorMutex);
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect); SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect); SetPointerRect(CurInfo, &PointerRect);
ExReleaseFastMutex(&CurInfo->CursorMutex); ExReleaseFastMutex(&CurInfo->CursorMutex);
} }
@ -441,9 +441,9 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y))) ((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y)))
{ {
ExAcquireFastMutex(&CurInfo->CursorMutex); ExAcquireFastMutex(&CurInfo->CursorMutex);
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect); SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect); SetPointerRect(CurInfo, &PointerRect);
ExReleaseFastMutex(&CurInfo->CursorMutex); ExReleaseFastMutex(&CurInfo->CursorMutex);
mouse_cx = 0; mouse_cx = 0;
@ -471,9 +471,9 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y))) ((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y)))
{ {
ExAcquireFastMutex(&CurInfo->CursorMutex); ExAcquireFastMutex(&CurInfo->CursorMutex);
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect); SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect); SetPointerRect(CurInfo, &PointerRect);
ExReleaseFastMutex(&CurInfo->CursorMutex); ExReleaseFastMutex(&CurInfo->CursorMutex);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: paint.c,v 1.17 2004/01/16 19:32:00 gvg Exp $ /* $Id: paint.c,v 1.18 2004/02/24 13:27:02 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -32,6 +32,7 @@
#include <include/object.h> #include <include/object.h>
#include <include/paint.h> #include <include/paint.h>
#include <include/surface.h> #include <include/surface.h>
#include <include/eng.h>
#include "objects.h" #include "objects.h"
#include <include/mouse.h> #include <include/mouse.h>
@ -141,9 +142,9 @@ IntEngPaint(IN SURFOBJ *Surface,
ClipRegion->rclBounds.top, ClipRegion->rclBounds.right, ClipRegion->rclBounds.top, ClipRegion->rclBounds.right,
ClipRegion->rclBounds.bottom); ClipRegion->rclBounds.bottom);
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
ret = SurfGDI->Paint(Surface, ClipRegion, Brush, BrushOrigin, Mix); ret = SurfGDI->Paint(Surface, ClipRegion, Brush, BrushOrigin, Mix);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
MouseSafetyOnDrawEnd(Surface, SurfGDI); MouseSafetyOnDrawEnd(Surface, SurfGDI);
return ret; return ret;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: transblt.c,v 1.10 2004/01/16 19:32:00 gvg Exp $ /* $Id: transblt.c,v 1.11 2004/02/24 13:27:02 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -32,6 +32,7 @@
#include <ddk/ntddmou.h> #include <ddk/ntddmou.h>
#include <ntos/minmax.h> #include <ntos/minmax.h>
#include <include/dib.h> #include <include/dib.h>
#include <include/eng.h>
#include <include/object.h> #include <include/object.h>
#include <include/surface.h> #include <include/surface.h>
@ -96,10 +97,10 @@ EngTransparentBlt(PSURFOBJ Dest,
// FIXME: Skip creating a TempSurf if we have the same BPP and palette // FIXME: Skip creating a TempSurf if we have the same BPP and palette
EngBitBlt(TempSurf, Source, NULL, NULL, ColorTranslation, &TempRect, &SourcePoint, NULL, NULL, NULL, 0); EngBitBlt(TempSurf, Source, NULL, NULL, ColorTranslation, &TempRect, &SourcePoint, NULL, NULL, NULL, 0);
ExAcquireFastMutex(DestGDI->DriverLock); IntLockGDIDriver(DestGDI);
ret = DestGDI->TransparentBlt(Dest, TempSurf, Clip, NULL, DestRect, SourceRect, ret = DestGDI->TransparentBlt(Dest, TempSurf, Clip, NULL, DestRect, SourceRect,
TransparentColor, Reserved); TransparentColor, Reserved);
ExReleaseFastMutex(DestGDI->DriverLock); IntUnLockGDIDriver(DestGDI);
MouseSafetyOnDrawEnd(Source, SourceGDI); MouseSafetyOnDrawEnd(Source, SourceGDI);
MouseSafetyOnDrawEnd(Dest, DestGDI); MouseSafetyOnDrawEnd(Dest, DestGDI);

View file

@ -34,6 +34,12 @@ InitClassImpl(VOID);
NTSTATUS FASTCALL NTSTATUS FASTCALL
CleanupClassImpl(VOID); CleanupClassImpl(VOID);
#define IntLockProcessClasses(W32Process) \
ExAcquireFastMutex(&W32Process->ClassListLock)
#define IntUnLockProcessClasses(W32Process) \
ExReleaseFastMutex(&W32Process->ClassListLock)
NTSTATUS STDCALL NTSTATUS STDCALL
ClassReferenceClassByName(PWNDCLASS_OBJECT *Class, ClassReferenceClassByName(PWNDCLASS_OBJECT *Class,
LPCWSTR ClassName); LPCWSTR ClassName);

View file

@ -23,6 +23,12 @@ VOID FASTCALL IntReleaseCurIconObject(PCURICON_OBJECT Object);
PCURICON_OBJECT FASTCALL IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject); PCURICON_OBJECT FASTCALL IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject);
VOID FASTCALL IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process); VOID FASTCALL IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process);
#define IntLockProcessCursorIcons(W32Process) \
ExAcquireFastMutex(&W32Process->CursorIconListLock)
#define IntUnLockProcessCursorIcons(W32Process) \
ExReleaseFastMutex(&W32Process->CursorIconListLock)
#endif /* _WIN32K_CURSORICON_H */ #endif /* _WIN32K_CURSORICON_H */
/* EOF */ /* EOF */

View file

@ -1,6 +1,12 @@
#ifndef _WIN32K_ENG_H #ifndef _WIN32K_ENG_H
#define _WIN32K_ENG_H #define _WIN32K_ENG_H
#define IntLockGDIDriver(SurfGDI) \
ExAcquireFastMutex(SurfGDI->DriverLock)
#define IntUnLockGDIDriver(SurfGDI) \
ExReleaseFastMutex(SurfGDI->DriverLock)
BOOL STDCALL EngIntersectRect (PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2); BOOL STDCALL EngIntersectRect (PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2);
VOID FASTCALL EngDeleteXlate (XLATEOBJ *XlateObj); VOID FASTCALL EngDeleteXlate (XLATEOBJ *XlateObj);
BOOL STDCALL BOOL STDCALL

View file

@ -27,6 +27,12 @@ typedef struct tagHOOKTABLE
LRESULT FASTCALL HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam); LRESULT FASTCALL HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam);
VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread); VOID FASTCALL HOOK_DestroyThreadHooks(PETHREAD Thread);
#define IntLockHookTable(HookTable) \
ExAcquireFastMutex(&HookTable->Lock)
#define IntUnLockHookTable(HookTable) \
ExReleaseFastMutex(&HookTable->Lock)
#endif /* _WIN32K_HOOK_H */ #endif /* _WIN32K_HOOK_H */
/* EOF */ /* EOF */

View file

@ -36,6 +36,12 @@ UnregisterWindowHotKeys(PWINDOW_OBJECT Window);
VOID VOID
UnregisterThreadHotKeys(struct _ETHREAD *Thread); UnregisterThreadHotKeys(struct _ETHREAD *Thread);
#define IntLockHotKeys(WinStaObject) \
ExAcquireFastMutex(&WinStaObject->HotKeyListLock)
#define IntUnLockHotKeys(WinStaObject) \
ExReleaseFastMutex(&WinStaObject->HotKeyListLock)
#endif /* _WIN32K_HOTKEY_H */ #endif /* _WIN32K_HOTKEY_H */
/* EOF */ /* EOF */

View file

@ -44,8 +44,20 @@ typedef struct _MENU_OBJECT
PMENU_OBJECT FASTCALL PMENU_OBJECT FASTCALL
IntGetMenuObject(HMENU hMenu); IntGetMenuObject(HMENU hMenu);
VOID FASTCALL #define IntLockMenuItems(MenuObj) \
IntReleaseMenuObject(PMENU_OBJECT MenuObject); ExAcquireFastMutex(&MenuObj->MenuItemsLock)
#define IntUnLockMenuItems(MenuObj) \
ExReleaseFastMutex(&MenuObj->MenuItemsLock)
#define IntLockProcessMenus(W32Process) \
ExAcquireFastMutex(&W32Process->MenuListLock)
#define IntUnLockProcessMenus(W32Process) \
ExReleaseFastMutex(&W32Process->MenuListLock)
#define IntReleaseMenuObject(MenuObj) \
ObmDereferenceObject(MenuObj)
BOOL FASTCALL BOOL FASTCALL
IntFreeMenuItem(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, IntFreeMenuItem(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem,

View file

@ -170,6 +170,22 @@ VOID FASTCALL MsqSetHooks(PUSER_MESSAGE_QUEUE Queue, PHOOKTABLE Hooks);
LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam); LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam);
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID); LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
#define IntLockMessageQueue(MsgQueue) \
ExAcquireFastMutex(&MsgQueue->Lock)
#define IntUnLockMessageQueue(MsgQueue) \
ExReleaseFastMutex(&MsgQueue->Lock)
#define IntLockHardwareMessageQueue(MsgQueue) \
ExAcquireFastMutex(&MsgQueue->HardwareLock)
#define IntUnLockHardwareMessageQueue(MsgQueue) \
ExReleaseFastMutex(&MsgQueue->HardwareLock)
/* check the queue status */
#define MsqIsSignaled(MsgQueue) \
((MsgQueue->WakeBits & MsgQueue->WakeMask) || (MsgQueue->ChangedBits & MsgQueue->ChangedMask))
#endif /* _WIN32K_MSGQUEUE_H */ #endif /* _WIN32K_MSGQUEUE_H */
/* EOF */ /* EOF */

View file

@ -47,6 +47,12 @@ typedef struct _USER_HANDLE_TABLE
} USER_HANDLE_TABLE, *PUSER_HANDLE_TABLE; } USER_HANDLE_TABLE, *PUSER_HANDLE_TABLE;
#define ObmpLockHandleTable(HandleTable) \
ExAcquireFastMutex(&HandleTable->ListLock)
#define ObmpUnlockHandleTable(HandleTable) \
ExReleaseFastMutex(&HandleTable->ListLock)
ULONG FASTCALL ULONG FASTCALL
ObmGetReferenceCount( ObmGetReferenceCount(
PVOID ObjectBody); PVOID ObjectBody);

View file

@ -16,4 +16,10 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message, BOOL Remove);
BOOL STDCALL BOOL STDCALL
NtUserValidateRgn(HWND hWnd, HRGN hRgn); NtUserValidateRgn(HWND hWnd, HRGN hRgn);
#define IntLockWindowUpdate(Window) \
ExAcquireFastMutex(&Window->UpdateLock)
#define IntUnLockWindowUpdate(Window) \
ExReleaseFastMutex(&Window->UpdateLock)
#endif /* _WIN32K_PAINTING_H */ #endif /* _WIN32K_PAINTING_H */

View file

@ -8,5 +8,11 @@ typedef struct _PROPERTY
ATOM Atom; ATOM Atom;
} PROPERTY, *PPROPERTY; } PROPERTY, *PPROPERTY;
#define IntLockWindowProperties(Window) \
ExAcquireFastMutex(&Window->PropListLock)
#define IntUnLockWindowProperties(Window) \
ExReleaseFastMutex(&Window->PropListLock)
#endif /* _WIN32K_PROP_H */ #endif /* _WIN32K_PROP_H */

View file

@ -6,4 +6,22 @@ BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
BOOL FASTCALL IntIsFontRenderingEnabled(VOID); BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
VOID FASTCALL IntEnableFontRendering(BOOL Enable); VOID FASTCALL IntEnableFontRendering(BOOL Enable);
#define IntLockProcessPrivateFonts(W32Process) \
ExAcquireFastMutex(&W32Process->PrivateFontListLock)
#define IntUnLockProcessPrivateFonts(W32Process) \
ExReleaseFastMutex(&W32Process->PrivateFontListLock)
#define IntLockGlobalFonts \
ExAcquireFastMutex(&FontListLock)
#define IntUnLockGlobalFonts \
ExReleaseFastMutex(&FontListLock)
#define IntLockFreeType \
ExAcquireFastMutex(&FreeTypeLock)
#define IntUnLockFreeType \
ExReleaseFastMutex(&FreeTypeLock)
#endif /* _WIN32K_TEXT_H */ #endif /* _WIN32K_TEXT_H */

View file

@ -128,10 +128,16 @@ typedef struct _WINDOW_OBJECT
WndObj->OwnerThread->ThreadsProcess->UniqueProcessId WndObj->OwnerThread->ThreadsProcess->UniqueProcessId
#define IntLockRelatives(WndObj) \ #define IntLockRelatives(WndObj) \
ExAcquireFastMutexUnsafe(&WndObj->RelativesLock) ExAcquireFastMutex(&WndObj->RelativesLock)
#define IntUnLockRelatives(WndObj) \ #define IntUnLockRelatives(WndObj) \
ExReleaseFastMutexUnsafe(&WndObj->RelativesLock) ExReleaseFastMutex(&WndObj->RelativesLock)
#define IntLockThreadWindows(Thread) \
ExAcquireFastMutex(&Thread->WindowListLock)
#define IntUnLockThreadWindows(Thread) \
ExReleaseFastMutex(&Thread->WindowListLock)
PWINDOW_OBJECT FASTCALL PWINDOW_OBJECT FASTCALL

View file

@ -20,11 +20,11 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
BOOLEAN FASTCALL BOOLEAN FASTCALL
WinPosShowWindow(HWND Wnd, INT Cmd); WinPosShowWindow(HWND Wnd, INT Cmd);
USHORT FASTCALL USHORT FASTCALL
WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT WinPoint, WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT *WinPoint,
PWINDOW_OBJECT* Window); PWINDOW_OBJECT* Window);
VOID FASTCALL WinPosActivateOtherWindow(PWINDOW_OBJECT Window); VOID FASTCALL WinPosActivateOtherWindow(PWINDOW_OBJECT Window);
PINTERNALPOS FASTCALL WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, PINTERNALPOS FASTCALL WinPosInitInternalPos(PWINDOW_OBJECT WindowObject,
POINT pt, PRECT RestoreRect); POINT *pt, PRECT RestoreRect);
#endif /* _WIN32K_WINPOS_H */ #endif /* _WIN32K_WINPOS_H */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: object.c,v 1.9 2004/02/24 01:30:57 weiden Exp $ /* $Id: object.c,v 1.10 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -36,32 +36,14 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#define HEADER_TO_BODY(ObjectHeader) \
((PVOID)(((PUSER_OBJECT_HEADER)ObjectHeader) + 1))
#define BODY_TO_HEADER(ObjectBody) \
((PUSER_OBJECT_HEADER)(((PUSER_OBJECT_HEADER)ObjectBody) - 1))
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
PVOID FASTCALL
HEADER_TO_BODY(PUSER_OBJECT_HEADER ObjectHeader)
{
return (((PUSER_OBJECT_HEADER)ObjectHeader) + 1);
}
PUSER_OBJECT_HEADER FASTCALL
BODY_TO_HEADER(PVOID ObjectBody)
{
return (((PUSER_OBJECT_HEADER)ObjectBody) - 1);
}
VOID STATIC FASTCALL
ObmpLockHandleTable(PUSER_HANDLE_TABLE HandleTable)
{
ExAcquireFastMutex(&HandleTable->ListLock);
}
VOID STATIC FASTCALL
ObmpUnlockHandleTable(PUSER_HANDLE_TABLE HandleTable)
{
ExReleaseFastMutex(&HandleTable->ListLock);
}
VOID FASTCALL VOID FASTCALL
ObmpPerformRetentionChecks(PUSER_OBJECT_HEADER ObjectHeader) ObmpPerformRetentionChecks(PUSER_OBJECT_HEADER ObjectHeader)
{ {
@ -307,10 +289,7 @@ ObmDereferenceObject(PVOID ObjectBody)
ObjectHeader = BODY_TO_HEADER(ObjectBody); ObjectHeader = BODY_TO_HEADER(ObjectBody);
ObjectHeader->RefCount--; ObjectHeader->RefCount--;
#if 0
if(ObjectHeader->Type == otWindow)
DbgPrint("Dereference 0x%x: %d\n", ((PWINDOW_OBJECT)ObjectBody)->Self, ObjectHeader->RefCount);
#endif
ObmpPerformRetentionChecks(ObjectHeader); ObmpPerformRetentionChecks(ObjectHeader);
} }
@ -333,10 +312,7 @@ ObmReferenceObjectByPointer(PVOID ObjectBody,
{ {
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
} }
#if 0
if(ObjectType == otWindow)
DbgPrint("Reference 0x%x: %d\n", ((PWINDOW_OBJECT)ObjectBody)->Self, ObjectHeader->RefCount);
#endif
ObjectHeader->RefCount++; ObjectHeader->RefCount++;
return STATUS_SUCCESS; return STATUS_SUCCESS;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: class.c,v 1.47 2004/02/19 21:12:09 weiden Exp $ /* $Id: class.c,v 1.48 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -66,7 +66,7 @@ ClassReferenceClassByAtom(PWNDCLASS_OBJECT* Class,
PLIST_ENTRY CurrentEntry; PLIST_ENTRY CurrentEntry;
PW32PROCESS Process = PsGetWin32Process(); PW32PROCESS Process = PsGetWin32Process();
ExAcquireFastMutexUnsafe (&Process->ClassListLock); IntLockProcessClasses(Process);
CurrentEntry = Process->ClassListHead.Flink; CurrentEntry = Process->ClassListHead.Flink;
while (CurrentEntry != &Process->ClassListHead) while (CurrentEntry != &Process->ClassListHead)
{ {
@ -76,13 +76,13 @@ ClassReferenceClassByAtom(PWNDCLASS_OBJECT* Class,
{ {
*Class = Current; *Class = Current;
ObmReferenceObject(Current); ObmReferenceObject(Current);
ExReleaseFastMutexUnsafe (&Process->ClassListLock); IntUnLockProcessClasses(Process);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
CurrentEntry = CurrentEntry->Flink; CurrentEntry = CurrentEntry->Flink;
} }
ExReleaseFastMutexUnsafe (&Process->ClassListLock); IntUnLockProcessClasses(Process);
return(STATUS_NOT_FOUND); return(STATUS_NOT_FOUND);
} }
@ -418,9 +418,9 @@ NtUserRegisterClassExWOW(
DPRINT("Failed creating window class object\n"); DPRINT("Failed creating window class object\n");
return((RTL_ATOM)0); return((RTL_ATOM)0);
} }
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock); IntLockProcessClasses(PsGetWin32Process());
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry); InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
ExReleaseFastMutex(&PsGetWin32Process()->ClassListLock); IntUnLockProcessClasses(PsGetWin32Process());
ObDereferenceObject(WinStaObject); ObDereferenceObject(WinStaObject);
return(Atom); return(Atom);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Id: focus.c,v 1.18 2004/02/24 01:30:57 weiden Exp $ * $Id: focus.c,v 1.19 2004/02/24 13:27:03 weiden Exp $
*/ */
#include <win32k/win32k.h> #include <win32k/win32k.h>
@ -26,6 +26,7 @@
#include <include/focus.h> #include <include/focus.h>
#include <include/error.h> #include <include/error.h>
#include <include/winpos.h> #include <include/winpos.h>
#include <include/msgqueue.h>
#define NDEBUG #define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
#include <debug.h> #include <debug.h>
@ -174,18 +175,18 @@ IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWindow
/* FIXME: Call hooks. */ /* FIXME: Call hooks. */
IntSetFocusMessageQueue(Window->MessageQueue); IntSetFocusMessageQueue(Window->MessageQueue);
ExAcquireFastMutex(&Window->MessageQueue->Lock); IntLockMessageQueue(Window->MessageQueue);
if (Window->MessageQueue) if (Window->MessageQueue)
{ {
Window->MessageQueue->ActiveWindow = hWnd; Window->MessageQueue->ActiveWindow = hWnd;
} }
ExReleaseFastMutex(&Window->MessageQueue->Lock); IntUnLockMessageQueue(Window->MessageQueue);
ExAcquireFastMutex(&FocusWindow->MessageQueue->Lock); IntLockMessageQueue(FocusWindow->MessageQueue);
if (FocusWindow->MessageQueue) if (FocusWindow->MessageQueue)
{ {
FocusWindow->MessageQueue->FocusWindow = hWndFocus; FocusWindow->MessageQueue->FocusWindow = hWndFocus;
} }
ExReleaseFastMutex(&FocusWindow->MessageQueue->Lock); IntUnLockMessageQueue(FocusWindow->MessageQueue);
IntSendDeactivateMessages(hWndPrev, hWnd); IntSendDeactivateMessages(hWndPrev, hWnd);
IntSendKillFocusMessages(hWndFocusPrev, hWndFocus); IntSendKillFocusMessages(hWndFocusPrev, hWndFocus);
@ -278,9 +279,9 @@ IntSetActiveWindow(PWINDOW_OBJECT Window)
/* FIXME: Call hooks. */ /* FIXME: Call hooks. */
ExAcquireFastMutex(&ThreadQueue->Lock); IntLockMessageQueue(ThreadQueue);
ThreadQueue->ActiveWindow = hWnd; ThreadQueue->ActiveWindow = hWnd;
ExReleaseFastMutex(&ThreadQueue->Lock); IntUnLockMessageQueue(ThreadQueue);
IntSendDeactivateMessages(hWndPrev, hWnd); IntSendDeactivateMessages(hWndPrev, hWnd);
IntSendActivateMessages(hWndPrev, hWnd, FALSE); IntSendActivateMessages(hWndPrev, hWnd, FALSE);
@ -305,9 +306,9 @@ IntSetFocusWindow(HWND hWnd)
return hWndPrev; return hWndPrev;
} }
ExAcquireFastMutex(&ThreadQueue->Lock); IntLockMessageQueue(ThreadQueue);
ThreadQueue->FocusWindow = hWnd; ThreadQueue->FocusWindow = hWnd;
ExReleaseFastMutex(&ThreadQueue->Lock); IntUnLockMessageQueue(ThreadQueue);
IntSendKillFocusMessages(hWndPrev, hWnd); IntSendKillFocusMessages(hWndPrev, hWnd);
IntSendSetFocusMessages(hWndPrev, hWnd); IntSendSetFocusMessages(hWndPrev, hWnd);
@ -411,9 +412,9 @@ NtUserSetCapture(HWND hWnd)
} }
hWndPrev = ThreadQueue->CaptureWindow; hWndPrev = ThreadQueue->CaptureWindow;
IntSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd); IntSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
ExAcquireFastMutex(&ThreadQueue->Lock); IntLockMessageQueue(ThreadQueue);
ThreadQueue->CaptureWindow = hWnd; ThreadQueue->CaptureWindow = hWnd;
ExReleaseFastMutex(&ThreadQueue->Lock); IntUnLockMessageQueue(ThreadQueue);
return hWndPrev; return hWndPrev;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: hook.c,v 1.5 2004/02/19 21:12:09 weiden Exp $ /* $Id: hook.c,v 1.6 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -106,9 +106,9 @@ IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinSt
Hook->HookId = HookId; Hook->HookId = HookId;
RtlInitUnicodeString(&Hook->ModuleName, NULL); RtlInitUnicodeString(&Hook->ModuleName, NULL);
ExAcquireFastMutex(&Table->Lock); IntLockHookTable(Table);
InsertHeadList(&Table->Hooks[HOOKID_TO_INDEX(HookId)], &Hook->Chain); InsertHeadList(&Table->Hooks[HOOKID_TO_INDEX(HookId)], &Hook->Chain);
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
return Hook; return Hook;
} }
@ -142,7 +142,7 @@ IntGetFirstValidHook(PHOOKTABLE Table, int HookId)
PHOOK Hook; PHOOK Hook;
PLIST_ENTRY Elem; PLIST_ENTRY Elem;
ExAcquireFastMutex(&Table->Lock); IntLockHookTable(Table);
Hook = IntGetFirstHook(Table, HookId); Hook = IntGetFirstHook(Table, HookId);
while (NULL != Hook && NULL == Hook->Proc) while (NULL != Hook && NULL == Hook->Proc)
{ {
@ -150,7 +150,7 @@ IntGetFirstValidHook(PHOOKTABLE Table, int HookId)
Hook = (Elem == &Table->Hooks[HOOKID_TO_INDEX(HookId)] Hook = (Elem == &Table->Hooks[HOOKID_TO_INDEX(HookId)]
? NULL : CONTAINING_RECORD(Elem, HOOK, Chain)); ? NULL : CONTAINING_RECORD(Elem, HOOK, Chain));
} }
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
return Hook; return Hook;
} }
@ -163,18 +163,18 @@ IntGetNextHook(PHOOK Hook)
int HookId = Hook->HookId; int HookId = Hook->HookId;
PLIST_ENTRY Elem; PLIST_ENTRY Elem;
ExAcquireFastMutex(&Table->Lock); IntLockHookTable(Table);
Elem = Hook->Chain.Flink; Elem = Hook->Chain.Flink;
while (Elem != &Table->Hooks[HOOKID_TO_INDEX(HookId)]) while (Elem != &Table->Hooks[HOOKID_TO_INDEX(HookId)])
{ {
Hook = CONTAINING_RECORD(Elem, HOOK, Chain); Hook = CONTAINING_RECORD(Elem, HOOK, Chain);
if (NULL != Hook->Proc) if (NULL != Hook->Proc)
{ {
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
return Hook; return Hook;
} }
} }
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
if (NULL != GlobalHooks && Table != GlobalHooks) /* now search through the global table */ if (NULL != GlobalHooks && Table != GlobalHooks) /* now search through the global table */
{ {
@ -206,7 +206,7 @@ IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj)
return; return;
} }
ExAcquireFastMutex(&Table->Lock); IntLockHookTable(Table);
if (0 != Table->Counts[HOOKID_TO_INDEX(Hook->HookId)]) if (0 != Table->Counts[HOOKID_TO_INDEX(Hook->HookId)])
{ {
Hook->Proc = NULL; /* chain is in use, just mark it and return */ Hook->Proc = NULL; /* chain is in use, just mark it and return */
@ -215,7 +215,7 @@ IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj)
{ {
IntFreeHook(Table, Hook, WinStaObj); IntFreeHook(Table, Hook, WinStaObj);
} }
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
} }
/* release a hook chain, removing deleted hooks if the use count drops to 0 */ /* release a hook chain, removing deleted hooks if the use count drops to 0 */
@ -230,12 +230,12 @@ IntReleaseHookChain(PHOOKTABLE Table, int HookId, PWINSTATION_OBJECT WinStaObj)
return; return;
} }
ExAcquireFastMutex(&Table->Lock); IntLockHookTable(Table);
/* use count shouldn't already be 0 */ /* use count shouldn't already be 0 */
ASSERT(0 != Table->Counts[HOOKID_TO_INDEX(HookId)]); ASSERT(0 != Table->Counts[HOOKID_TO_INDEX(HookId)]);
if (0 == Table->Counts[HOOKID_TO_INDEX(HookId)]) if (0 == Table->Counts[HOOKID_TO_INDEX(HookId)])
{ {
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
return; return;
} }
if (0 == --Table->Counts[HOOKID_TO_INDEX(HookId)]) if (0 == --Table->Counts[HOOKID_TO_INDEX(HookId)])
@ -251,7 +251,7 @@ IntReleaseHookChain(PHOOKTABLE Table, int HookId, PWINSTATION_OBJECT WinStaObj)
} }
} }
} }
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
} }
LRESULT FASTCALL LRESULT FASTCALL
@ -281,14 +281,14 @@ HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
ExAcquireFastMutex(&Table->Lock); IntLockHookTable(Table);
Table->Counts[HOOKID_TO_INDEX(HookId)]++; Table->Counts[HOOKID_TO_INDEX(HookId)]++;
ExReleaseFastMutex(&Table->Lock); IntUnLockHookTable(Table);
if (Table != GlobalHooks && GlobalHooks != NULL) if (Table != GlobalHooks && GlobalHooks != NULL)
{ {
ExAcquireFastMutex(&GlobalHooks->Lock); IntLockHookTable(GlobalHooks);
GlobalHooks->Counts[HOOKID_TO_INDEX(HookId)]++; GlobalHooks->Counts[HOOKID_TO_INDEX(HookId)]++;
ExReleaseFastMutex(&GlobalHooks->Lock); IntUnLockHookTable(GlobalHooks);
} }
Result = IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc, Result = IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc,
@ -334,7 +334,7 @@ HOOK_DestroyThreadHooks(PETHREAD Thread)
DPRINT1("Invalid window station????\n"); DPRINT1("Invalid window station????\n");
return; return;
} }
ExAcquireFastMutex(&GlobalHooks->Lock); IntLockHookTable(GlobalHooks);
for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++) for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++)
{ {
/* only low-level keyboard/mouse global hooks can be owned by a thread */ /* only low-level keyboard/mouse global hooks can be owned by a thread */
@ -355,7 +355,7 @@ HOOK_DestroyThreadHooks(PETHREAD Thread)
break; break;
} }
} }
ExReleaseFastMutex(&GlobalHooks->Lock); IntUnLockHookTable(GlobalHooks);
ObDereferenceObject(WinStaObj); ObDereferenceObject(WinStaObj);
} }
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: hotkey.c,v 1.7 2004/02/19 21:12:09 weiden Exp $ /* $Id: hotkey.c,v 1.8 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -80,7 +80,7 @@ GetHotKey (PWINSTATION_OBJECT WinStaObject,
return FALSE; return FALSE;
} }
ExAcquireFastMutex (&WinStaObject->HotKeyListLock); IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink; Entry = WinStaObject->HotKeyListHead.Flink;
while (Entry != &WinStaObject->HotKeyListHead) while (Entry != &WinStaObject->HotKeyListHead)
@ -100,7 +100,7 @@ GetHotKey (PWINSTATION_OBJECT WinStaObject,
if (id != NULL) if (id != NULL)
*id = HotKeyItem->id; *id = HotKeyItem->id;
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
return TRUE; return TRUE;
} }
@ -108,7 +108,7 @@ GetHotKey (PWINSTATION_OBJECT WinStaObject,
Entry = Entry->Flink; Entry = Entry->Flink;
} }
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
return FALSE; return FALSE;
} }
@ -128,7 +128,7 @@ UnregisterWindowHotKeys(PWINDOW_OBJECT Window)
if(!WinStaObject) if(!WinStaObject)
return; return;
ExAcquireFastMutex (&WinStaObject->HotKeyListLock); IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink; Entry = WinStaObject->HotKeyListHead.Flink;
while (Entry != &WinStaObject->HotKeyListHead) while (Entry != &WinStaObject->HotKeyListHead)
@ -144,7 +144,7 @@ UnregisterWindowHotKeys(PWINDOW_OBJECT Window)
} }
} }
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
} }
@ -161,7 +161,7 @@ UnregisterThreadHotKeys(struct _ETHREAD *Thread)
if(!WinStaObject) if(!WinStaObject)
return; return;
ExAcquireFastMutex (&WinStaObject->HotKeyListLock); IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink; Entry = WinStaObject->HotKeyListHead.Flink;
while (Entry != &WinStaObject->HotKeyListHead) while (Entry != &WinStaObject->HotKeyListHead)
@ -177,7 +177,7 @@ UnregisterThreadHotKeys(struct _ETHREAD *Thread)
} }
} }
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
} }
@ -234,12 +234,12 @@ NtUserRegisterHotKey(HWND hWnd,
return FALSE; return FALSE;
} }
ExAcquireFastMutex (&WinStaObject->HotKeyListLock); IntLockHotKeys(WinStaObject);
/* Check for existing hotkey */ /* Check for existing hotkey */
if (IsHotKey (WinStaObject, fsModifiers, vk)) if (IsHotKey (WinStaObject, fsModifiers, vk))
{ {
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return FALSE; return FALSE;
} }
@ -247,7 +247,7 @@ NtUserRegisterHotKey(HWND hWnd,
HotKeyItem = ExAllocatePoolWithTag (PagedPool, sizeof(HOT_KEY_ITEM), TAG_HOTKEY); HotKeyItem = ExAllocatePoolWithTag (PagedPool, sizeof(HOT_KEY_ITEM), TAG_HOTKEY);
if (HotKeyItem == NULL) if (HotKeyItem == NULL)
{ {
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return FALSE; return FALSE;
} }
@ -261,7 +261,7 @@ NtUserRegisterHotKey(HWND hWnd,
InsertHeadList (&WinStaObject->HotKeyListHead, InsertHeadList (&WinStaObject->HotKeyListHead,
&HotKeyItem->ListEntry); &HotKeyItem->ListEntry);
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return TRUE; return TRUE;
@ -293,7 +293,7 @@ NtUserUnregisterHotKey(HWND hWnd,
return FALSE; return FALSE;
} }
ExAcquireFastMutex (&WinStaObject->HotKeyListLock); IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink; Entry = WinStaObject->HotKeyListHead.Flink;
while (Entry != &WinStaObject->HotKeyListHead) while (Entry != &WinStaObject->HotKeyListHead)
@ -306,7 +306,7 @@ NtUserUnregisterHotKey(HWND hWnd,
{ {
RemoveEntryList (&HotKeyItem->ListEntry); RemoveEntryList (&HotKeyItem->ListEntry);
ExFreePool (HotKeyItem); ExFreePool (HotKeyItem);
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return TRUE; return TRUE;
@ -315,7 +315,7 @@ NtUserUnregisterHotKey(HWND hWnd,
Entry = Entry->Flink; Entry = Entry->Flink;
} }
ExReleaseFastMutex (&WinStaObject->HotKeyListLock); IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return FALSE; return FALSE;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: keyboard.c,v 1.24 2004/02/19 21:12:09 weiden Exp $ /* $Id: keyboard.c,v 1.25 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -67,6 +67,12 @@ FAST_MUTEX QueueStateLock;
BYTE QueueKeyStateTable[256]; BYTE QueueKeyStateTable[256];
#define IntLockQueueState \
ExAcquireFastMutex(&QueueStateLock)
#define IntUnLockQueueState \
ExReleaseFastMutex(&QueueStateLock)
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/* Initialization -- Right now, just zero the key state and init the lock */ /* Initialization -- Right now, just zero the key state and init the lock */
@ -314,12 +320,12 @@ NtUserGetKeyState(
{ {
DWORD ret = 0; DWORD ret = 0;
ExAcquireFastMutex(&QueueStateLock); IntLockQueueState;
if( key < 0x100 ) { if( key < 0x100 ) {
ret = ((DWORD)(QueueKeyStateTable[key] & KS_DOWN_BIT) << 8 ) | ret = ((DWORD)(QueueKeyStateTable[key] & KS_DOWN_BIT) << 8 ) |
(QueueKeyStateTable[key] & KS_LOCK_BIT); (QueueKeyStateTable[key] & KS_LOCK_BIT);
} }
ExReleaseFastMutex(&QueueStateLock); IntUnLockQueueState;
return ret; return ret;
} }
@ -332,7 +338,7 @@ int STDCALL ToUnicodeEx( UINT wVirtKey,
HKL dwhkl ) { HKL dwhkl ) {
int ToUnicodeResult = 0; int ToUnicodeResult = 0;
ExAcquireFastMutex(&QueueStateLock); IntLockQueueState;
ToUnicodeResult = ToUnicodeInner( wVirtKey, ToUnicodeResult = ToUnicodeInner( wVirtKey,
wScanCode, wScanCode,
lpKeyState, lpKeyState,
@ -341,7 +347,7 @@ int STDCALL ToUnicodeEx( UINT wVirtKey,
wFlags, wFlags,
PsGetWin32Thread() ? PsGetWin32Thread() ?
PsGetWin32Thread()->KeyboardLayout : 0 ); PsGetWin32Thread()->KeyboardLayout : 0 );
ExReleaseFastMutex(&QueueStateLock); IntUnLockQueueState;
return ToUnicodeResult; return ToUnicodeResult;
} }
@ -618,7 +624,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
ScanCode = (lpMsg->lParam >> 16) & 0xff; ScanCode = (lpMsg->lParam >> 16) & 0xff;
ExAcquireFastMutex(&QueueStateLock); IntLockQueueState;
UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff, UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
QueueKeyStateTable, wp, 2, 0, QueueKeyStateTable, wp, 2, 0,
@ -681,7 +687,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
Result = TRUE; Result = TRUE;
} }
ExReleaseFastMutex(&QueueStateLock); IntUnLockQueueState;
return Result; return Result;
} }
@ -692,12 +698,12 @@ NtUserGetKeyboardState(
{ {
BOOL Result = TRUE; BOOL Result = TRUE;
ExAcquireFastMutex(&QueueStateLock); IntLockQueueState;
if (lpKeyState) { if (lpKeyState) {
if(!NT_SUCCESS(MmCopyToCaller(lpKeyState, QueueKeyStateTable, 256))) if(!NT_SUCCESS(MmCopyToCaller(lpKeyState, QueueKeyStateTable, 256)))
Result = FALSE; Result = FALSE;
} }
ExReleaseFastMutex(&QueueStateLock); IntUnLockQueueState;
return Result; return Result;
} }
@ -708,12 +714,12 @@ NtUserSetKeyboardState(
{ {
BOOL Result = TRUE; BOOL Result = TRUE;
ExAcquireFastMutex(&QueueStateLock); IntLockQueueState;
if (lpKeyState) { if (lpKeyState) {
if(! NT_SUCCESS(MmCopyFromCaller(QueueKeyStateTable, lpKeyState, 256))) if(! NT_SUCCESS(MmCopyFromCaller(QueueKeyStateTable, lpKeyState, 256)))
Result = FALSE; Result = FALSE;
} }
ExReleaseFastMutex(&QueueStateLock); IntUnLockQueueState;
return Result; return Result;
} }
@ -964,7 +970,7 @@ VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) {
return; return;
} }
ExAcquireFastMutex(&QueueStateLock); IntLockQueueState;
/* arty -- handle numpad -- On real windows, the actual key produced /* arty -- handle numpad -- On real windows, the actual key produced
* by the messaging layer is different based on the state of numlock. */ * by the messaging layer is different based on the state of numlock. */
@ -1017,6 +1023,6 @@ VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) {
else Msg->message = WM_KEYUP; else Msg->message = WM_KEYUP;
} }
ExReleaseFastMutex(&QueueStateLock); IntUnLockQueueState;
} }
/* EOF */ /* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: menu.c,v 1.49 2004/02/23 21:18:45 gvg Exp $ /* $Id: menu.c,v 1.50 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -163,12 +163,6 @@ IntGetMenuObject(HMENU hMenu)
return MenuObject; return MenuObject;
} }
VOID FASTCALL
IntReleaseMenuObject(PMENU_OBJECT MenuObject)
{
ObmDereferenceObject(MenuObject);
}
BOOL FASTCALL BOOL FASTCALL
IntFreeMenuItem(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, IntFreeMenuItem(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem,
BOOL RemoveFromList, BOOL bRecurse) BOOL RemoveFromList, BOOL bRecurse)
@ -243,15 +237,15 @@ IntDestroyMenuObject(PMENU_OBJECT MenuObject,
if(MenuObject) if(MenuObject)
{ {
/* remove all menu items */ /* remove all menu items */
ExAcquireFastMutexUnsafe (&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */ IntDeleteMenuItems(MenuObject, bRecurse); /* do not destroy submenus */
ExReleaseFastMutexUnsafe (&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
if(RemoveFromProcess) if(RemoveFromProcess)
{ {
ExAcquireFastMutexUnsafe(&MenuObject->W32Process->MenuListLock); IntLockProcessMenus(MenuObject->W32Process);
RemoveEntryList(&MenuObject->ListEntry); RemoveEntryList(&MenuObject->ListEntry);
ExReleaseFastMutexUnsafe(&MenuObject->W32Process->MenuListLock); IntUnLockProcessMenus(MenuObject->W32Process);
} }
ObmCloseHandle(MenuObject->W32Process->WindowStation->HandleTable, MenuObject->MenuInfo.Self); ObmCloseHandle(MenuObject->W32Process->WindowStation->HandleTable, MenuObject->MenuInfo.Self);
@ -301,9 +295,9 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar)
ExInitializeFastMutex(&MenuObject->MenuItemsLock); ExInitializeFastMutex(&MenuObject->MenuItemsLock);
/* Insert menu item into process menu handle list */ /* Insert menu item into process menu handle list */
ExAcquireFastMutexUnsafe(&Win32Process->MenuListLock); IntLockProcessMenus(Win32Process);
InsertTailList(&Win32Process->MenuListHead, &MenuObject->ListEntry); InsertTailList(&Win32Process->MenuListHead, &MenuObject->ListEntry);
ExReleaseFastMutexUnsafe(&Win32Process->MenuListLock); IntUnLockProcessMenus(Win32Process);
return MenuObject; return MenuObject;
} }
@ -317,8 +311,8 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source)
if(!Source->MenuInfo.MenuItemCount) if(!Source->MenuInfo.MenuItemCount)
return FALSE; return FALSE;
ExAcquireFastMutexUnsafe(&Destination->MenuItemsLock); IntLockMenuItems(Destination);
ExAcquireFastMutexUnsafe(&Source->MenuItemsLock); IntLockMenuItems(Source);
MenuItem = Source->MenuItemList; MenuItem = Source->MenuItemList;
while(MenuItem) while(MenuItem)
@ -370,8 +364,8 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source)
MenuItem = MenuItem->Next; MenuItem = MenuItem->Next;
} }
ExReleaseFastMutexUnsafe(&Source->MenuItemsLock); IntUnLockMenuItems(Source);
ExReleaseFastMutexUnsafe(&Destination->MenuItemsLock); IntUnLockMenuItems(Destination);
return TRUE; return TRUE;
} }
@ -413,9 +407,9 @@ IntCloneMenu(PMENU_OBJECT Source)
ExInitializeFastMutex(&MenuObject->MenuItemsLock); ExInitializeFastMutex(&MenuObject->MenuItemsLock);
/* Insert menu item into process menu handle list */ /* Insert menu item into process menu handle list */
ExAcquireFastMutexUnsafe(&Process->MenuListLock); IntLockProcessMenus(Process);
InsertTailList(&Process->MenuListHead, &MenuObject->ListEntry); InsertTailList(&Process->MenuListHead, &MenuObject->ListEntry);
ExReleaseFastMutexUnsafe(&Process->MenuListLock); IntUnLockProcessMenus(Process);
IntCloneMenuItems(MenuObject, Source); IntCloneMenuItems(MenuObject, Source);
@ -1142,15 +1136,15 @@ IntGetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT fByPos, UINT gmdiFlags,
if(!SubMenuObject || (SubMenuObject == MenuObject)) if(!SubMenuObject || (SubMenuObject == MenuObject))
break; break;
ExAcquireFastMutexUnsafe(&SubMenuObject->MenuItemsLock); IntLockMenuItems(SubMenuObject);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
(*gismc)++; (*gismc)++;
sres = IntGetMenuDefaultItem(SubMenuObject, fByPos, gmdiFlags, gismc); sres = IntGetMenuDefaultItem(SubMenuObject, fByPos, gmdiFlags, gismc);
(*gismc)--; (*gismc)--;
ExReleaseFastMutexUnsafe(&SubMenuObject->MenuItemsLock); IntUnLockMenuItems(SubMenuObject);
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
IntReleaseMenuObject(SubMenuObject); IntReleaseMenuObject(SubMenuObject);
if(sres > (UINT)-1) if(sres > (UINT)-1)
@ -1239,18 +1233,18 @@ IntCleanupMenus(struct _EPROCESS *Process, PW32PROCESS Win32Process)
KeAttachProcess(Process); KeAttachProcess(Process);
} }
ExAcquireFastMutexUnsafe(&Win32Process->MenuListLock); IntLockProcessMenus(Win32Process);
while (Win32Process->MenuListHead.Flink != &(Win32Process->MenuListHead) && while (Win32Process->MenuListHead.Flink != &(Win32Process->MenuListHead) &&
Win32Process->MenuListHead.Flink != LastHead) Win32Process->MenuListHead.Flink != LastHead)
{ {
LastHead = Win32Process->MenuListHead.Flink; LastHead = Win32Process->MenuListHead.Flink;
MenuObject = CONTAINING_RECORD(Win32Process->MenuListHead.Flink, MENU_OBJECT, ListEntry); MenuObject = CONTAINING_RECORD(Win32Process->MenuListHead.Flink, MENU_OBJECT, ListEntry);
ExReleaseFastMutexUnsafe(&Win32Process->MenuListLock); IntUnLockProcessMenus(Win32Process);
IntDestroyMenuObject(MenuObject, FALSE, TRUE); IntDestroyMenuObject(MenuObject, FALSE, TRUE);
ExAcquireFastMutexUnsafe(&Win32Process->MenuListLock); IntLockProcessMenus(Win32Process);
} }
ExReleaseFastMutexUnsafe(&Win32Process->MenuListLock); IntUnLockProcessMenus(Win32Process);
if (CurrentProcess != Process) if (CurrentProcess != Process)
{ {
@ -1283,9 +1277,9 @@ NtUserBuildMenuItemList(
if(Buffer) if(Buffer)
{ {
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
res = IntBuildMenuItemList(MenuObject, Buffer, nBufSize); res = IntBuildMenuItemList(MenuObject, Buffer, nBufSize);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
} }
else else
{ {
@ -1314,9 +1308,9 @@ NtUserCheckMenuItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
return (DWORD)-1; return (DWORD)-1;
} }
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
res = IntCheckMenuItem(MenuObject, uIDCheckItem, uCheck); res = IntCheckMenuItem(MenuObject, uIDCheckItem, uCheck);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
return res; return res;
} }
@ -1421,9 +1415,9 @@ NtUserEnableMenuItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
return res; return res;
} }
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
res = IntEnableMenuItem(MenuObject, uIDEnableItem, uEnable); res = IntEnableMenuItem(MenuObject, uIDEnableItem, uEnable);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
return res; return res;
@ -1466,9 +1460,9 @@ NtUserInsertMenuItem(
return FALSE; return FALSE;
} }
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
Res = IntInsertMenuItem(MenuObject, uItem, fByPosition, &ItemInfo); Res = IntInsertMenuItem(MenuObject, uItem, fByPosition, &ItemInfo);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
return Res; return Res;
@ -1505,9 +1499,9 @@ NtUserGetMenuDefaultItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
return res; return res;
} }
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
res = IntGetMenuDefaultItem(MenuObject, fByPos, gmdiFlags, &gismc); res = IntGetMenuDefaultItem(MenuObject, fByPos, gmdiFlags, &gismc);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
return res; return res;
} }
@ -1586,9 +1580,9 @@ NtUserHiliteMenuItem(
} }
if(WindowObject->IDMenu == (UINT)hmenu) if(WindowObject->IDMenu == (UINT)hmenu)
{ {
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
res = IntHiliteMenuItem(WindowObject, MenuObject, uItemHilite, uHilite); res = IntHiliteMenuItem(WindowObject, MenuObject, uItemHilite, uHilite);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
} }
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
@ -1697,7 +1691,7 @@ NtUserMenuItemFromPoint(
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
} }
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
mi = MenuObject->MenuItemList; mi = MenuObject->MenuItemList;
for (i = 0; NULL != mi; i++) for (i = 0; NULL != mi; i++)
{ {
@ -1707,7 +1701,7 @@ NtUserMenuItemFromPoint(
} }
mi = mi->Next; mi = mi->Next;
} }
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
@ -1857,9 +1851,9 @@ NtUserSetMenuDefaultItem(
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE); SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
return FALSE; return FALSE;
} }
ExAcquireFastMutexUnsafe(&MenuObject->MenuItemsLock); IntLockMenuItems(MenuObject);
res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos); res = IntSetMenuDefaultItem(MenuObject, uItem, fByPos);
ExReleaseFastMutexUnsafe(&MenuObject->MenuItemsLock); IntUnLockMenuItems(MenuObject);
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
return res; return res;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: message.c,v 1.51 2004/02/24 01:30:57 weiden Exp $ /* $Id: message.c,v 1.52 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1018,7 +1018,7 @@ NtUserGetQueueStatus(BOOL ClearChanges)
Queue = PsGetWin32Thread()->MessageQueue; Queue = PsGetWin32Thread()->MessageQueue;
ExAcquireFastMutex(&Queue->Lock); IntLockMessageQueue(Queue);
Result = MAKELONG(Queue->ChangedBits, Queue->WakeBits); Result = MAKELONG(Queue->ChangedBits, Queue->WakeBits);
if (ClearChanges) if (ClearChanges)
@ -1026,7 +1026,7 @@ NtUserGetQueueStatus(BOOL ClearChanges)
Queue->ChangedBits = 0; Queue->ChangedBits = 0;
} }
ExReleaseFastMutex(&Queue->Lock); IntUnLockMessageQueue(Queue);
return Result; return Result;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: msgqueue.c,v 1.70 2004/02/24 01:30:57 weiden Exp $ /* $Id: msgqueue.c,v 1.71 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -68,13 +68,16 @@ static KEVENT HardwareMessageEvent;
static PAGED_LOOKASIDE_LIST MessageLookasideList; static PAGED_LOOKASIDE_LIST MessageLookasideList;
/* FUNCTIONS *****************************************************************/ #define IntLockSystemMessageQueue(OldIrql) \
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql)
/* check the queue status */ #define IntUnLockSystemMessageQueue(OldIrql) \
inline BOOL MsqIsSignaled( PUSER_MESSAGE_QUEUE Queue ) KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql)
{
return ((Queue->WakeBits & Queue->WakeMask) || (Queue->ChangedBits & Queue->ChangedMask)); #define IntUnLockSystemHardwareMessageQueueLock(Wait) \
} KeReleaseMutex(&HardwareMessageQueueLock, Wait)
/* FUNCTIONS *****************************************************************/
/* set some queue bits */ /* set some queue bits */
inline VOID MsqSetQueueBits( PUSER_MESSAGE_QUEUE Queue, WORD Bits ) inline VOID MsqSetQueueBits( PUSER_MESSAGE_QUEUE Queue, WORD Bits )
@ -94,23 +97,23 @@ inline VOID MsqClearQueueBits( PUSER_MESSAGE_QUEUE Queue, WORD Bits )
VOID FASTCALL VOID FASTCALL
MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue) MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
{ {
ExAcquireFastMutex(&Queue->Lock); IntLockMessageQueue(Queue);
Queue->PaintCount++; Queue->PaintCount++;
Queue->PaintPosted = TRUE; Queue->PaintPosted = TRUE;
KeSetEvent(&Queue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&Queue->NewMessages, IO_NO_INCREMENT, FALSE);
ExReleaseFastMutex(&Queue->Lock); IntUnLockMessageQueue(Queue);
} }
VOID FASTCALL VOID FASTCALL
MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue) MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
{ {
ExAcquireFastMutex(&Queue->Lock); IntLockMessageQueue(Queue);
Queue->PaintCount--; Queue->PaintCount--;
if (Queue->PaintCount == 0) if (Queue->PaintCount == 0)
{ {
Queue->PaintPosted = FALSE; Queue->PaintPosted = FALSE;
} }
ExReleaseFastMutex(&Queue->Lock); IntUnLockMessageQueue(Queue);
} }
@ -144,7 +147,7 @@ MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
KeQueryTickCount(&LargeTickCount); KeQueryTickCount(&LargeTickCount);
Msg->time = LargeTickCount.u.LowPart; Msg->time = LargeTickCount.u.LowPart;
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql); IntLockSystemMessageQueue(OldIrql);
/* only insert WM_MOUSEMOVE messages if not already in system message queue */ /* only insert WM_MOUSEMOVE messages if not already in system message queue */
if((Msg->message == WM_MOUSEMOVE) && RemMouseMoveMsg) if((Msg->message == WM_MOUSEMOVE) && RemMouseMoveMsg)
@ -167,7 +170,7 @@ MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
{ {
if (SystemMessageQueueCount == SYSTEM_MESSAGE_QUEUE_SIZE) if (SystemMessageQueueCount == SYSTEM_MESSAGE_QUEUE_SIZE)
{ {
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql); IntUnLockSystemMessageQueue(OldIrql);
return; return;
} }
SystemMessageQueue[SystemMessageQueueTail] = *Msg; SystemMessageQueue[SystemMessageQueueTail] = *Msg;
@ -177,7 +180,7 @@ MsqInsertSystemMessage(MSG* Msg, BOOL RemMouseMoveMsg)
(SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE; (SystemMessageQueueTail + 1) % SYSTEM_MESSAGE_QUEUE_SIZE;
SystemMessageQueueCount++; SystemMessageQueueCount++;
} }
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql); IntUnLockSystemMessageQueue(OldIrql);
KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE); KeSetEvent(&HardwareMessageEvent, IO_NO_INCREMENT, FALSE);
} }
@ -253,7 +256,7 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
Msg == WM_XBUTTONDOWN) Msg == WM_XBUTTONDOWN)
{ {
USHORT Hit = WinPosWindowFromPoint(ScopeWin, USHORT Hit = WinPosWindowFromPoint(ScopeWin,
Message->Msg.pt, &Message->Msg.pt,
&Window); &Window);
/* /*
**Make sure that we have a window that is not already in focus **Make sure that we have a window that is not already in focus
@ -312,7 +315,7 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
} }
else else
{ {
*HitTest = WinPosWindowFromPoint(ScopeWin, Message->Msg.pt, &Window); *HitTest = WinPosWindowFromPoint(ScopeWin, &Message->Msg.pt, &Window);
if(!Window) if(!Window)
{ {
/* change the cursor on desktop background */ /* change the cursor on desktop background */
@ -346,10 +349,10 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
* old queue */ * old queue */
RemoveEntryList(&Message->ListEntry); RemoveEntryList(&Message->ListEntry);
} }
ExAcquireFastMutex(&Window->MessageQueue->HardwareLock); IntLockHardwareMessageQueue(Window->MessageQueue);
InsertTailList(&Window->MessageQueue->HardwareMessagesListHead, InsertTailList(&Window->MessageQueue->HardwareMessagesListHead,
&Message->ListEntry); &Message->ListEntry);
ExReleaseFastMutex(&Window->MessageQueue->HardwareLock); IntUnLockHardwareMessageQueue(Window->MessageQueue);
KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
*Freed = FALSE; *Freed = FALSE;
@ -359,10 +362,10 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
if (hWnd != NULL && Window->Self != hWnd && if (hWnd != NULL && Window->Self != hWnd &&
!IntIsChildWindow(hWnd, Window->Self)) !IntIsChildWindow(hWnd, Window->Self))
{ {
ExAcquireFastMutex(&Window->MessageQueue->HardwareLock); IntLockHardwareMessageQueue(Window->MessageQueue);
InsertTailList(&Window->MessageQueue->HardwareMessagesListHead, InsertTailList(&Window->MessageQueue->HardwareMessagesListHead,
&Message->ListEntry); &Message->ListEntry);
ExReleaseFastMutex(&Window->MessageQueue->HardwareLock); IntUnLockHardwareMessageQueue(Window->MessageQueue);
KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&Window->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
*Freed = FALSE; *Freed = FALSE;
@ -463,7 +466,7 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
while (NT_SUCCESS(WaitStatus) && STATUS_WAIT_0 != WaitStatus); while (NT_SUCCESS(WaitStatus) && STATUS_WAIT_0 != WaitStatus);
/* Process messages in the message queue itself. */ /* Process messages in the message queue itself. */
ExAcquireFastMutex(&MessageQueue->HardwareLock); IntLockHardwareMessageQueue(MessageQueue);
CurrentEntry = MessageQueue->HardwareMessagesListHead.Flink; CurrentEntry = MessageQueue->HardwareMessagesListHead.Flink;
while (CurrentEntry != &MessageQueue->HardwareMessagesListHead) while (CurrentEntry != &MessageQueue->HardwareMessagesListHead)
{ {
@ -483,8 +486,8 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
{ {
RemoveEntryList(&Current->ListEntry); RemoveEntryList(&Current->ListEntry);
} }
ExReleaseFastMutex(&MessageQueue->HardwareLock); IntUnLockHardwareMessageQueue(MessageQueue);
KeReleaseMutex(&HardwareMessageQueueLock, FALSE); IntUnLockSystemHardwareMessageQueueLock(FALSE);
*Message = Current; *Message = Current;
IntReleaseWindowObject(DesktopWindow); IntReleaseWindowObject(DesktopWindow);
return(TRUE); return(TRUE);
@ -494,12 +497,12 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
RemoveEntryList(&Current->ListEntry); RemoveEntryList(&Current->ListEntry);
} }
} }
ExReleaseFastMutex(&MessageQueue->HardwareLock); IntUnLockHardwareMessageQueue(MessageQueue);
/* Now try the global queue. */ /* Now try the global queue. */
/* Transfer all messages from the DPC accessible queue to the main queue. */ /* Transfer all messages from the DPC accessible queue to the main queue. */
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql); IntLockSystemMessageQueue(OldIrql);
while (SystemMessageQueueCount > 0) while (SystemMessageQueueCount > 0)
{ {
PUSER_MESSAGE UserMsg; PUSER_MESSAGE UserMsg;
@ -510,13 +513,13 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
SystemMessageQueueHead = SystemMessageQueueHead =
(SystemMessageQueueHead + 1) % SYSTEM_MESSAGE_QUEUE_SIZE; (SystemMessageQueueHead + 1) % SYSTEM_MESSAGE_QUEUE_SIZE;
SystemMessageQueueCount--; SystemMessageQueueCount--;
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql); IntUnLockSystemMessageQueue(OldIrql);
UserMsg = ExAllocateFromPagedLookasideList(&MessageLookasideList); UserMsg = ExAllocateFromPagedLookasideList(&MessageLookasideList);
/* What to do if out of memory? For now we just panic a bit in debug */ /* What to do if out of memory? For now we just panic a bit in debug */
ASSERT(UserMsg); ASSERT(UserMsg);
UserMsg->Msg = Msg; UserMsg->Msg = Msg;
InsertTailList(&HardwareMessageQueueHead, &UserMsg->ListEntry); InsertTailList(&HardwareMessageQueueHead, &UserMsg->ListEntry);
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql); IntLockSystemMessageQueue(OldIrql);
} }
/* /*
* we could set this to -1 conditionally if we find one, but * we could set this to -1 conditionally if we find one, but
@ -524,7 +527,7 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
*/ */
SystemMessageQueueMouseMove = -1; SystemMessageQueueMouseMove = -1;
HardwareMessageQueueStamp++; HardwareMessageQueueStamp++;
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql); IntUnLockSystemMessageQueue(OldIrql);
/* Process messages in the queue until we find one to return. */ /* Process messages in the queue until we find one to return. */
CurrentEntry = HardwareMessageQueueHead.Flink; CurrentEntry = HardwareMessageQueueHead.Flink;
@ -547,13 +550,13 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
if (Accept) if (Accept)
{ {
/* Check for no more messages in the system queue. */ /* Check for no more messages in the system queue. */
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql); IntLockSystemMessageQueue(OldIrql);
if (SystemMessageQueueCount == 0 && if (SystemMessageQueueCount == 0 &&
IsListEmpty(&HardwareMessageQueueHead)) IsListEmpty(&HardwareMessageQueueHead))
{ {
KeClearEvent(&HardwareMessageEvent); KeClearEvent(&HardwareMessageEvent);
} }
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql); IntUnLockSystemMessageQueue(OldIrql);
/* /*
If we aren't removing the message then add it to the private If we aren't removing the message then add it to the private
@ -561,12 +564,12 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
*/ */
if (!Remove) if (!Remove)
{ {
ExAcquireFastMutex(&MessageQueue->HardwareLock); IntLockHardwareMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->HardwareMessagesListHead, InsertTailList(&MessageQueue->HardwareMessagesListHead,
&Current->ListEntry); &Current->ListEntry);
ExReleaseFastMutex(&MessageQueue->HardwareLock); IntUnLockHardwareMessageQueue(MessageQueue);
} }
KeReleaseMutex(&HardwareMessageQueueLock, FALSE); IntUnLockSystemHardwareMessageQueueLock(FALSE);
*Message = Current; *Message = Current;
IntReleaseWindowObject(DesktopWindow); IntReleaseWindowObject(DesktopWindow);
return(TRUE); return(TRUE);
@ -581,13 +584,13 @@ MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd,
} }
IntReleaseWindowObject(DesktopWindow); IntReleaseWindowObject(DesktopWindow);
/* Check if the system message queue is now empty. */ /* Check if the system message queue is now empty. */
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql); IntLockSystemMessageQueue(OldIrql);
if (SystemMessageQueueCount == 0 && IsListEmpty(&HardwareMessageQueueHead)) if (SystemMessageQueueCount == 0 && IsListEmpty(&HardwareMessageQueueHead))
{ {
KeClearEvent(&HardwareMessageEvent); KeClearEvent(&HardwareMessageEvent);
} }
KeReleaseSpinLock(&SystemMessageQueueLock, OldIrql); IntUnLockSystemMessageQueue(OldIrql);
KeReleaseMutex(&HardwareMessageQueueLock, FALSE); IntUnLockSystemHardwareMessageQueueLock(FALSE);
return(FALSE); return(FALSE);
} }
@ -687,11 +690,11 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
ObmDereferenceObject(Window); ObmDereferenceObject(Window);
ObDereferenceObject (Thread); ObDereferenceObject (Thread);
// ExAcquireFastMutex(&pThread->MessageQueue->Lock); // IntLockMessageQueue(pThread->MessageQueue);
// InsertHeadList(&pThread->MessageQueue->PostedMessagesListHead, // InsertHeadList(&pThread->MessageQueue->PostedMessagesListHead,
// &Message->ListEntry); // &Message->ListEntry);
// KeSetEvent(&pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); // KeSetEvent(&pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
// ExReleaseFastMutex(&pThread->MessageQueue->Lock); // IntUnLockMessageQueue(pThread->MessageQueue);
} }
@ -732,11 +735,11 @@ MsqDispatchSentNotifyMessages(PUSER_MESSAGE_QUEUE MessageQueue)
while (!IsListEmpty(&MessageQueue->SentMessagesListHead)) while (!IsListEmpty(&MessageQueue->SentMessagesListHead))
{ {
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
ListEntry = RemoveHeadList(&MessageQueue->SentMessagesListHead); ListEntry = RemoveHeadList(&MessageQueue->SentMessagesListHead);
Message = CONTAINING_RECORD(ListEntry, USER_SENT_MESSAGE_NOTIFY, Message = CONTAINING_RECORD(ListEntry, USER_SENT_MESSAGE_NOTIFY,
ListEntry); ListEntry);
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
IntCallSentMessageCallback(Message->CompletionCallback, IntCallSentMessageCallback(Message->CompletionCallback,
Message->hWnd, Message->hWnd,
@ -760,7 +763,7 @@ MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
LRESULT Result; LRESULT Result;
PUSER_SENT_MESSAGE_NOTIFY NotifyMessage; PUSER_SENT_MESSAGE_NOTIFY NotifyMessage;
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
if (IsListEmpty(&MessageQueue->SentMessagesListHead)) if (IsListEmpty(&MessageQueue->SentMessagesListHead))
{ {
ExReleaseFastMutex(&MessageQueue->Lock); ExReleaseFastMutex(&MessageQueue->Lock);
@ -768,7 +771,7 @@ MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
} }
Entry = RemoveHeadList(&MessageQueue->SentMessagesListHead); Entry = RemoveHeadList(&MessageQueue->SentMessagesListHead);
Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry); Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry);
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
/* Call the window procedure. */ /* Call the window procedure. */
Result = IntSendMessage(Message->Msg.hwnd, Result = IntSendMessage(Message->Msg.hwnd,
@ -811,11 +814,11 @@ VOID FASTCALL
MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue, MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
PUSER_SENT_MESSAGE_NOTIFY NotifyMessage) PUSER_SENT_MESSAGE_NOTIFY NotifyMessage)
{ {
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->NotifyMessagesListHead, InsertTailList(&MessageQueue->NotifyMessagesListHead,
&NotifyMessage->ListEntry); &NotifyMessage->ListEntry);
KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
} }
LRESULT FASTCALL LRESULT FASTCALL
@ -841,10 +844,10 @@ MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
Message->CompletionQueue = NULL; Message->CompletionQueue = NULL;
Message->CompletionCallback = NULL; Message->CompletionCallback = NULL;
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->SentMessagesListHead, &Message->ListEntry); InsertTailList(&MessageQueue->SentMessagesListHead, &Message->ListEntry);
KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
ThreadQueue = PsGetWin32Thread()->MessageQueue; ThreadQueue = PsGetWin32Thread()->MessageQueue;
WaitObjects[1] = &ThreadQueue->NewMessages; WaitObjects[1] = &ThreadQueue->NewMessages;
@ -866,21 +869,21 @@ MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
VOID FASTCALL VOID FASTCALL
MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, PUSER_MESSAGE Message) MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, PUSER_MESSAGE Message)
{ {
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->PostedMessagesListHead, InsertTailList(&MessageQueue->PostedMessagesListHead,
&Message->ListEntry); &Message->ListEntry);
KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
} }
VOID FASTCALL VOID FASTCALL
MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode) MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode)
{ {
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
MessageQueue->QuitPosted = TRUE; MessageQueue->QuitPosted = TRUE;
MessageQueue->QuitExitCode = ExitCode; MessageQueue->QuitExitCode = ExitCode;
KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(&MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
} }
BOOLEAN STDCALL BOOLEAN STDCALL
@ -903,7 +906,7 @@ MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
Remove, Message)); Remove, Message));
} }
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
CurrentEntry = MessageQueue->PostedMessagesListHead.Flink; CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
ListHead = &MessageQueue->PostedMessagesListHead; ListHead = &MessageQueue->PostedMessagesListHead;
while (CurrentEntry != ListHead) while (CurrentEntry != ListHead)
@ -919,13 +922,13 @@ MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
{ {
RemoveEntryList(&CurrentMessage->ListEntry); RemoveEntryList(&CurrentMessage->ListEntry);
} }
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
*Message = CurrentMessage; *Message = CurrentMessage;
return(TRUE); return(TRUE);
} }
CurrentEntry = CurrentEntry->Flink; CurrentEntry = CurrentEntry->Flink;
} }
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
return(FALSE); return(FALSE);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Id: painting.c,v 1.73 2004/02/24 01:30:57 weiden Exp $ * $Id: painting.c,v 1.74 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -65,7 +65,7 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion)
{ {
if (!(ParentWindow->Style & WS_CLIPCHILDREN)) if (!(ParentWindow->Style & WS_CLIPCHILDREN))
{ {
ExAcquireFastMutex(&ParentWindow->UpdateLock); IntLockWindowUpdate(ParentWindow);
if (ParentWindow->UpdateRegion != 0) if (ParentWindow->UpdateRegion != 0)
{ {
INT OffsetX, OffsetY; INT OffsetX, OffsetY;
@ -82,7 +82,7 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion)
/* FIXME: If the resulting region is empty, remove fake posted paint message */ /* FIXME: If the resulting region is empty, remove fake posted paint message */
NtGdiOffsetRgn(ValidRegion, -OffsetX, -OffsetY); NtGdiOffsetRgn(ValidRegion, -OffsetX, -OffsetY);
} }
ExReleaseFastMutex(&ParentWindow->UpdateLock); IntUnLockWindowUpdate(ParentWindow);
} }
OldWindow = ParentWindow; OldWindow = ParentWindow;
ParentWindow = IntGetParentObject(ParentWindow); ParentWindow = IntGetParentObject(ParentWindow);
@ -107,7 +107,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
{ {
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{ {
ExAcquireFastMutex(&Window->UpdateLock); IntLockWindowUpdate(Window);
if (Window->NCUpdateRegion) if (Window->NCUpdateRegion)
{ {
IntValidateParent(Window, Window->NCUpdateRegion); IntValidateParent(Window, Window->NCUpdateRegion);
@ -116,7 +116,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
Window->NCUpdateRegion = NULL; Window->NCUpdateRegion = NULL;
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT; Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->MessageQueue);
ExReleaseFastMutex(&Window->UpdateLock); IntUnLockWindowUpdate(Window);
IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0); IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
} }
@ -144,7 +144,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{ {
IntSendMessage(hWnd, WM_PAINT, 0, 0); IntSendMessage(hWnd, WM_PAINT, 0, 0);
ExAcquireFastMutex(&Window->UpdateLock); IntLockWindowUpdate(Window);
if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{ {
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT; Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
@ -153,7 +153,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->MessageQueue);
} }
} }
ExReleaseFastMutex(&Window->UpdateLock); IntUnLockWindowUpdate(Window);
} }
} }
} }
@ -232,7 +232,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
* Save current state of pending updates * Save current state of pending updates
*/ */
ExAcquireFastMutex(&Window->UpdateLock); IntLockWindowUpdate(Window);
HadPaintMessage = Window->UpdateRegion != NULL || HadPaintMessage = Window->UpdateRegion != NULL ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT; Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
HadNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT; HadNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
@ -399,7 +399,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
MsqIncPaintCountQueue(Window->MessageQueue); MsqIncPaintCountQueue(Window->MessageQueue);
} }
ExReleaseFastMutex(&Window->UpdateLock); IntUnLockWindowUpdate(Window);
} }
/* /*
@ -612,17 +612,17 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
#if 0 #if 0
DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n"); DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n");
#endif #endif
ExAcquireFastMutex(&MessageQueue->Lock); IntLockMessageQueue(MessageQueue);
MessageQueue->PaintPosted = 0; MessageQueue->PaintPosted = 0;
MessageQueue->PaintCount = 0; MessageQueue->PaintCount = 0;
ExReleaseFastMutex(&MessageQueue->Lock); IntUnLockMessageQueue(MessageQueue);
return FALSE; return FALSE;
} }
Window = IntGetWindowObject(Message->hwnd); Window = IntGetWindowObject(Message->hwnd);
if (Window != NULL) if (Window != NULL)
{ {
ExAcquireFastMutex(&Window->UpdateLock); IntLockWindowUpdate(Window);
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{ {
Message->message = WM_NCPAINT; Message->message = WM_NCPAINT;
@ -648,7 +648,7 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
} }
} }
} }
ExReleaseFastMutex(&Window->UpdateLock); IntUnLockWindowUpdate(Window);
IntReleaseWindowObject(Window); IntReleaseWindowObject(Window);
return TRUE; return TRUE;
@ -726,7 +726,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
return NULL; return NULL;
} }
ExAcquireFastMutex(&Window->UpdateLock); IntLockWindowUpdate(Window);
if (Window->UpdateRegion != NULL) if (Window->UpdateRegion != NULL)
{ {
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->MessageQueue);
@ -742,7 +742,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
{ {
NtUserGetClientRect(Window, &lPs->rcPaint); NtUserGetClientRect(Window, &lPs->rcPaint);
} }
ExReleaseFastMutex(&Window->UpdateLock); IntUnLockWindowUpdate(Window);
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND) if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
{ {

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: prop.c,v 1.8 2004/02/22 14:09:51 weiden Exp $ /* $Id: prop.c,v 1.9 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -100,7 +100,7 @@ NtUserBuildPropList(HWND hWnd,
} }
/* copy list */ /* copy list */
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock); IntLockWindowProperties(WindowObject);
li = (PROPLISTITEM *)Buffer; li = (PROPLISTITEM *)Buffer;
ListEntry = WindowObject->PropListHead.Flink; ListEntry = WindowObject->PropListHead.Flink;
@ -113,7 +113,7 @@ NtUserBuildPropList(HWND hWnd,
Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM)); Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM));
if(!NT_SUCCESS(Status)) if(!NT_SUCCESS(Status))
{ {
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock); IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
return Status; return Status;
} }
@ -124,13 +124,13 @@ NtUserBuildPropList(HWND hWnd,
ListEntry = ListEntry->Flink; ListEntry = ListEntry->Flink;
} }
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock); IntUnLockWindowProperties(WindowObject);
} }
else else
{ {
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock); IntLockWindowProperties(WindowObject);
Cnt = WindowObject->PropListItems * sizeof(PROPLISTITEM); Cnt = WindowObject->PropListItems * sizeof(PROPLISTITEM);
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock); IntUnLockWindowProperties(WindowObject);
} }
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
@ -160,12 +160,12 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom)
return NULL; return NULL;
} }
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock); IntLockWindowProperties(WindowObject);
Prop = IntGetProp(WindowObject, Atom); Prop = IntGetProp(WindowObject, Atom);
if (Prop == NULL) if (Prop == NULL)
{ {
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock); IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
return(NULL); return(NULL);
} }
@ -173,7 +173,7 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom)
RemoveEntryList(&Prop->PropListEntry); RemoveEntryList(&Prop->PropListEntry);
ExFreePool(Prop); ExFreePool(Prop);
WindowObject->PropListItems--; WindowObject->PropListItems--;
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock); IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
return(Data); return(Data);
} }
@ -191,9 +191,9 @@ NtUserGetProp(HWND hWnd, ATOM Atom)
return FALSE; return FALSE;
} }
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock); IntLockWindowProperties(WindowObject);
Prop = IntGetProp(WindowObject, Atom); Prop = IntGetProp(WindowObject, Atom);
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock); IntUnLockWindowProperties(WindowObject);
if (Prop != NULL) if (Prop != NULL)
{ {
Data = Prop->Data; Data = Prop->Data;
@ -238,9 +238,9 @@ NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)
return FALSE; return FALSE;
} }
ExAcquireFastMutexUnsafe(&Wnd->PropListLock); IntLockWindowProperties(Wnd);
ret = IntSetProp(Wnd, Atom, Data); ret = IntSetProp(Wnd, Atom, Data);
ExReleaseFastMutexUnsafe(&Wnd->PropListLock); IntUnLockWindowProperties(Wnd);
return ret; return ret;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: timer.c,v 1.23 2004/02/19 21:12:09 weiden Exp $ /* $Id: timer.c,v 1.24 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -62,6 +62,12 @@ static HANDLE MsgTimerThreadHandle;
static CLIENT_ID MsgTimerThreadId; static CLIENT_ID MsgTimerThreadId;
#define IntLockTimerList \
ExAcquireFastMutex(&Mutex)
#define IntUnLockTimerList \
ExReleaseFastMutex(&Mutex)
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -140,7 +146,7 @@ RemoveTimersThread(HANDLE ThreadID)
PMSG_TIMER_ENTRY MsgTimer; PMSG_TIMER_ENTRY MsgTimer;
PLIST_ENTRY EnumEntry; PLIST_ENTRY EnumEntry;
ExAcquireFastMutex(&Mutex); IntLockTimerList;
EnumEntry = SysTimerListHead.Flink; EnumEntry = SysTimerListHead.Flink;
while (EnumEntry != &SysTimerListHead) while (EnumEntry != &SysTimerListHead)
@ -173,7 +179,7 @@ RemoveTimersThread(HANDLE ThreadID)
} }
} }
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
} }
UINT_PTR FASTCALL UINT_PTR FASTCALL
@ -190,7 +196,7 @@ IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, B
ThreadID = PsGetCurrentThreadId(); ThreadID = PsGetCurrentThreadId();
KeQuerySystemTime(&CurrentTime); KeQuerySystemTime(&CurrentTime);
ExAcquireFastMutex(&Mutex); IntLockTimerList;
if((hWnd == NULL) && !SystemTimer) if((hWnd == NULL) && !SystemTimer)
{ {
@ -199,12 +205,12 @@ IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, B
if(Index == (ULONG) -1) if(Index == (ULONG) -1)
{ {
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
return 0; return 0;
} }
HintIndex = ++Index; HintIndex = ++Index;
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
return Index; return Index;
} }
else else
@ -212,15 +218,15 @@ IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, B
WindowObject = IntGetWindowObject(hWnd); WindowObject = IntGetWindowObject(hWnd);
if(!WindowObject) if(!WindowObject)
{ {
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return 0; return 0;
} }
if(WindowObject->OwnerThread != PsGetCurrentThread()) if(WindowObject->OwnerThread != PsGetCurrentThread())
{ {
IntUnLockTimerList;
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
ExReleaseFastMutex(&Mutex);
SetLastWin32Error(ERROR_ACCESS_DENIED); SetLastWin32Error(ERROR_ACCESS_DENIED);
return 0; return 0;
} }
@ -263,7 +269,7 @@ IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, B
NewTimer = ExAllocatePoolWithTag(PagedPool, sizeof(MSG_TIMER_ENTRY), TAG_TIMER); NewTimer = ExAllocatePoolWithTag(PagedPool, sizeof(MSG_TIMER_ENTRY), TAG_TIMER);
if(!NewTimer) if(!NewTimer)
{ {
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return 0; return 0;
} }
@ -322,7 +328,7 @@ IntSetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, B
} }
} }
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
return Ret; return Ret;
} }
@ -333,16 +339,16 @@ IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
PMSG_TIMER_ENTRY MsgTimer; PMSG_TIMER_ENTRY MsgTimer;
PWINDOW_OBJECT WindowObject; PWINDOW_OBJECT WindowObject;
ExAcquireFastMutex(&Mutex); IntLockTimerList;
/* handle-less timer? */ /* handle-less timer? */
if((hWnd == NULL) && !SystemTimer) if((hWnd == NULL) && !SystemTimer)
{ {
if(!RtlAreBitsSet(&HandleLessTimersBitMap, uIDEvent - 1, 1)) if(!RtlAreBitsSet(&HandleLessTimersBitMap, uIDEvent - 1, 1))
{ {
IntUnLockTimerList;
/* bit was not set */ /* bit was not set */
/* FIXME: set the last error */ /* FIXME: set the last error */
ExReleaseFastMutex(&Mutex);
return FALSE; return FALSE;
} }
@ -353,14 +359,14 @@ IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
WindowObject = IntGetWindowObject(hWnd); WindowObject = IntGetWindowObject(hWnd);
if(!WindowObject) if(!WindowObject)
{ {
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return FALSE; return FALSE;
} }
if(WindowObject->OwnerThread != PsGetCurrentThread()) if(WindowObject->OwnerThread != PsGetCurrentThread())
{ {
IntUnLockTimerList;
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
ExReleaseFastMutex(&Mutex);
SetLastWin32Error(ERROR_ACCESS_DENIED); SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE; return FALSE;
} }
@ -369,7 +375,7 @@ IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
MsgTimer = IntRemoveTimer(hWnd, uIDEvent, PsGetCurrentThreadId(), SystemTimer); MsgTimer = IntRemoveTimer(hWnd, uIDEvent, PsGetCurrentThreadId(), SystemTimer);
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
if(MsgTimer == NULL) if(MsgTimer == NULL)
{ {
@ -409,11 +415,11 @@ TimerThreadMain(PVOID StartContext)
KEBUGCHECK(0); KEBUGCHECK(0);
} }
ExAcquireFastMutex(&Mutex); ThreadsToDereferenceCount = ThreadsToDereferencePos = 0;
IntLockTimerList;
KeQuerySystemTime(&CurrentTime); KeQuerySystemTime(&CurrentTime);
ThreadsToDereferenceCount = ThreadsToDereferencePos = 0;
for (EnumEntry = TimerListHead.Flink; for (EnumEntry = TimerListHead.Flink;
EnumEntry != &TimerListHead; EnumEntry != &TimerListHead;
@ -552,7 +558,7 @@ TimerThreadMain(PVOID StartContext)
} }
} }
ExReleaseFastMutex(&Mutex); IntUnLockTimerList;
for (i = 0; i < ThreadsToDereferencePos; i++) for (i = 0; i < ThreadsToDereferencePos; i++)
ObDereferenceObject(ThreadsToDereference[i]); ObDereferenceObject(ThreadsToDereference[i]);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: window.c,v 1.191 2004/02/24 01:30:57 weiden Exp $ /* $Id: window.c,v 1.192 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -390,9 +390,9 @@ static LRESULT IntDestroyWindow(PWINDOW_OBJECT Window,
IntUnlinkWindow(Window); IntUnlinkWindow(Window);
ExAcquireFastMutexUnsafe (&ThreadData->WindowListLock); IntLockThreadWindows(ThreadData);
RemoveEntryList(&Window->ThreadListEntry); RemoveEntryList(&Window->ThreadListEntry);
ExReleaseFastMutexUnsafe (&ThreadData->WindowListLock); IntUnLockThreadWindows(ThreadData);
IntDestroyScrollBar(Window, SB_VERT); IntDestroyScrollBar(Window, SB_VERT);
IntDestroyScrollBar(Window, SB_HORZ); IntDestroyScrollBar(Window, SB_HORZ);
@ -482,24 +482,24 @@ DestroyThreadWindows(struct _ETHREAD *Thread)
Win32Thread = Thread->Win32Thread; Win32Thread = Thread->Win32Thread;
Win32Process = Thread->ThreadsProcess->Win32Process; Win32Process = Thread->ThreadsProcess->Win32Process;
ExAcquireFastMutexUnsafe(&Win32Thread->WindowListLock); IntLockThreadWindows(Win32Thread);
LastHead = NULL; LastHead = NULL;
while (Win32Thread->WindowListHead.Flink != &(Win32Thread->WindowListHead) && while (Win32Thread->WindowListHead.Flink != &(Win32Thread->WindowListHead) &&
Win32Thread->WindowListHead.Flink != LastHead) Win32Thread->WindowListHead.Flink != LastHead)
{ {
LastHead = Win32Thread->WindowListHead.Flink; LastHead = Win32Thread->WindowListHead.Flink;
Window = CONTAINING_RECORD(Win32Thread->WindowListHead.Flink, WINDOW_OBJECT, ThreadListEntry); Window = CONTAINING_RECORD(Win32Thread->WindowListHead.Flink, WINDOW_OBJECT, ThreadListEntry);
ExReleaseFastMutexUnsafe(&Win32Thread->WindowListLock); IntUnLockThreadWindows(Win32Thread);
WinPosShowWindow(Window->Self, SW_HIDE); WinPosShowWindow(Window->Self, SW_HIDE);
IntDestroyWindow(Window, Win32Process, Win32Thread, FALSE); IntDestroyWindow(Window, Win32Process, Win32Thread, FALSE);
ExAcquireFastMutexUnsafe(&Win32Thread->WindowListLock); IntLockThreadWindows(Win32Thread);
} }
if (Win32Thread->WindowListHead.Flink == LastHead) if (Win32Thread->WindowListHead.Flink == LastHead)
{ {
/* Window at head of list was not removed, should never happen, infinite loop */ /* Window at head of list was not removed, should never happen, infinite loop */
KEBUGCHECK(0); KEBUGCHECK(0);
} }
ExReleaseFastMutexUnsafe(&Win32Thread->WindowListLock); IntUnLockThreadWindows(Win32Thread);
} }
@ -1009,7 +1009,7 @@ NtUserBuildHwndList(
ObDereferenceObject(Thread); ObDereferenceObject(Thread);
ExAcquireFastMutex(&HandleTable->ListLock); ObmpLockHandleTable(HandleTable);
Current = HandleTable->ListHead.Flink; Current = HandleTable->ListHead.Flink;
while ( Current != &HandleTable->ListHead ) while ( Current != &HandleTable->ListHead )
@ -1031,7 +1031,7 @@ NtUserBuildHwndList(
Current = Current->Flink; Current = Current->Flink;
} }
ExReleaseFastMutex(&HandleTable->ListLock); ObmpUnlockHandleTable(HandleTable);
} }
else else
{ {
@ -1383,10 +1383,10 @@ NtUserCreateWindowEx(DWORD dwExStyle,
} }
/* Insert the window into the thread's window list. */ /* Insert the window into the thread's window list. */
ExAcquireFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock); IntLockThreadWindows(PsGetWin32Thread());
InsertTailList (&PsGetWin32Thread()->WindowListHead, InsertTailList (&PsGetWin32Thread()->WindowListHead,
&WindowObject->ThreadListEntry); &WindowObject->ThreadListEntry);
ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock); IntUnLockThreadWindows(PsGetWin32Thread());
/* Allocate a DCE for this window. */ /* Allocate a DCE for this window. */
if (dwStyle & CS_OWNDC) if (dwStyle & CS_OWNDC)
@ -1668,14 +1668,14 @@ NtUserDestroyWindow(HWND Wnd)
WinPosActivateOtherWindow(Window); WinPosActivateOtherWindow(Window);
} }
} }
ExAcquireFastMutex(&Window->MessageQueue->Lock); IntLockMessageQueue(Window->MessageQueue);
if (Window->MessageQueue->ActiveWindow == Window->Self) if (Window->MessageQueue->ActiveWindow == Window->Self)
Window->MessageQueue->ActiveWindow = NULL; Window->MessageQueue->ActiveWindow = NULL;
if (Window->MessageQueue->FocusWindow == Window->Self) if (Window->MessageQueue->FocusWindow == Window->Self)
Window->MessageQueue->FocusWindow = NULL; Window->MessageQueue->FocusWindow = NULL;
if (Window->MessageQueue->CaptureWindow == Window->Self) if (Window->MessageQueue->CaptureWindow == Window->Self)
Window->MessageQueue->CaptureWindow = NULL; Window->MessageQueue->CaptureWindow = NULL;
ExReleaseFastMutex(&Window->MessageQueue->Lock); IntUnLockMessageQueue(Window->MessageQueue);
/* Call hooks */ /* Call hooks */
#if 0 /* FIXME */ #if 0 /* FIXME */
@ -2858,7 +2858,7 @@ NtUserGetWindowPlacement(HWND hWnd,
Size.x = WindowObject->WindowRect.left; Size.x = WindowObject->WindowRect.left;
Size.y = WindowObject->WindowRect.top; Size.y = WindowObject->WindowRect.top;
InternalPos = WinPosInitInternalPos(WindowObject, Size, InternalPos = WinPosInitInternalPos(WindowObject, &Size,
&WindowObject->WindowRect); &WindowObject->WindowRect);
if (InternalPos) if (InternalPos)
{ {
@ -3373,7 +3373,7 @@ NtUserWindowFromPoint(LONG X, LONG Y)
pt.x = X; pt.x = X;
pt.y = Y; pt.y = Y;
Hit = WinPosWindowFromPoint(DesktopWindow, pt, &Window); Hit = WinPosWindowFromPoint(DesktopWindow, &pt, &Window);
if(Window) if(Window)
{ {

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: winpos.c,v 1.98 2004/02/24 01:30:58 weiden Exp $ /* $Id: winpos.c,v 1.99 2004/02/24 13:27:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -178,7 +178,7 @@ WinPosFindIconPos(HWND hWnd, POINT *Pos)
} }
PINTERNALPOS FASTCALL PINTERNALPOS FASTCALL
WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect) WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT *pt, PRECT RestoreRect)
{ {
PWINDOW_OBJECT Parent; PWINDOW_OBJECT Parent;
INT XInc, YInc; INT XInc, YInc;
@ -233,11 +233,11 @@ WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
} }
if (WindowObject->Style & WS_MINIMIZE) if (WindowObject->Style & WS_MINIMIZE)
{ {
WindowObject->InternalPos->IconPos = pt; WindowObject->InternalPos->IconPos = *pt;
} }
else if (WindowObject->Style & WS_MAXIMIZE) else if (WindowObject->Style & WS_MAXIMIZE)
{ {
WindowObject->InternalPos->MaxPos = pt; WindowObject->InternalPos->MaxPos = *pt;
} }
else if (RestoreRect != NULL) else if (RestoreRect != NULL)
{ {
@ -255,7 +255,7 @@ WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
Size.x = WindowObject->WindowRect.left; Size.x = WindowObject->WindowRect.left;
Size.y = WindowObject->WindowRect.top; Size.y = WindowObject->WindowRect.top;
InternalPos = WinPosInitInternalPos(WindowObject, Size, InternalPos = WinPosInitInternalPos(WindowObject, &Size,
&WindowObject->WindowRect); &WindowObject->WindowRect);
if (InternalPos) if (InternalPos)
@ -1357,12 +1357,12 @@ WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, POINT *Point,
} }
USHORT FASTCALL USHORT FASTCALL
WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT WinPoint, WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT *WinPoint,
PWINDOW_OBJECT* Window) PWINDOW_OBJECT* Window)
{ {
HWND DesktopWindowHandle; HWND DesktopWindowHandle;
PWINDOW_OBJECT DesktopWindow; PWINDOW_OBJECT DesktopWindow;
POINT Point = WinPoint; POINT Point = *WinPoint;
USHORT HitTest; USHORT HitTest;
*Window = NULL; *Window = NULL;
@ -1417,7 +1417,7 @@ NtUserGetMinMaxInfo(
Size.x = Window->WindowRect.left; Size.x = Window->WindowRect.left;
Size.y = Window->WindowRect.top; Size.y = Window->WindowRect.top;
InternalPos = WinPosInitInternalPos(Window, Size, InternalPos = WinPosInitInternalPos(Window, &Size,
&Window->WindowRect); &Window->WindowRect);
if(InternalPos) if(InternalPos)
{ {

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: color.c,v 1.33 2004/01/16 19:32:00 gvg Exp $ */ /* $Id: color.c,v 1.34 2004/02/24 13:27:03 weiden Exp $ */
// FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping // FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping
@ -31,6 +31,7 @@
#include <win32k/ntuser.h> #include <win32k/ntuser.h>
#include "../eng/handle.h" #include "../eng/handle.h"
#include <include/inteng.h> #include <include/inteng.h>
#include <include/eng.h>
#include <include/color.h> #include <include/color.h>
#include <include/palette.h> #include <include/palette.h>
#include <include/error.h> #include <include/error.h>
@ -333,9 +334,9 @@ UINT STDCALL NtGdiRealizePalette(HDC hDC)
} else { } else {
if(SurfGDI->SetPalette) if(SurfGDI->SetPalette)
{ {
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
success = SurfGDI->SetPalette(dc->PDev, sysPtr, 0, 0, sysGDI->NumColors); success = SurfGDI->SetPalette(dc->PDev, sysPtr, 0, 0, sysGDI->NumColors);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
} }
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: cursoricon.c,v 1.47 2004/02/10 23:40:01 gvg Exp $ */ /* $Id: cursoricon.c,v 1.48 2004/02/24 13:27:03 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
@ -146,9 +146,9 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
if (NULL != CurInfo->CurrentCursorObject && CurInfo->ShowingCursor) if (NULL != CurInfo->CurrentCursorObject && CurInfo->ShowingCursor)
{ {
/* Remove the cursor if it was displayed */ /* Remove the cursor if it was displayed */
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, -1, -1, &PointerRect); SurfGDI->MovePointer(SurfObj, -1, -1, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect); SetPointerRect(CurInfo, &PointerRect);
} }
@ -220,7 +220,7 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
CurInfo->CurrentCursorObject = NULL; CurInfo->CurrentCursorObject = NULL;
} }
ExAcquireFastMutex(SurfGDI->DriverLock); IntLockGDIDriver(SurfGDI);
SurfGDI->PointerStatus = SurfGDI->SetPointerShape(SurfObj, soMask, soColor, XlateObj, SurfGDI->PointerStatus = SurfGDI->SetPointerShape(SurfObj, soMask, soColor, XlateObj,
NewCursor->IconInfo.xHotspot, NewCursor->IconInfo.xHotspot,
NewCursor->IconInfo.yHotspot, NewCursor->IconInfo.yHotspot,
@ -228,7 +228,7 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
CurInfo->y, CurInfo->y,
&PointerRect, &PointerRect,
SPS_CHANGE); SPS_CHANGE);
ExReleaseFastMutex(SurfGDI->DriverLock); IntUnLockGDIDriver(SurfGDI);
if(SurfGDI->PointerStatus == SPS_DECLINE) if(SurfGDI->PointerStatus == SPS_DECLINE)
{ {
@ -287,7 +287,7 @@ IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE hModule,
ULONG i; ULONG i;
HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable; HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable;
ExAcquireFastMutex(&HandleTable->ListLock); ObmpLockHandleTable(HandleTable);
CurrentEntry = HandleTable->ListHead.Flink; CurrentEntry = HandleTable->ListHead.Flink;
while(CurrentEntry != &HandleTable->ListHead) while(CurrentEntry != &HandleTable->ListHead)
@ -303,14 +303,14 @@ IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE hModule,
continue; continue;
} }
ObmReferenceObject(Object); ObmReferenceObject(Object);
ExReleaseFastMutex(&HandleTable->ListLock); ObmpUnlockHandleTable(HandleTable);
return Object; return Object;
} }
} }
CurrentEntry = CurrentEntry->Flink; CurrentEntry = CurrentEntry->Flink;
} }
ExReleaseFastMutex(&HandleTable->ListLock); ObmpUnlockHandleTable(HandleTable);
return NULL; return NULL;
} }
@ -334,9 +334,9 @@ IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject)
Win32Process = PsGetWin32Process(); Win32Process = PsGetWin32Process();
ExAcquireFastMutex(&Win32Process->CursorIconListLock); IntLockProcessCursorIcons(Win32Process);
InsertTailList(&Win32Process->CursorIconListHead, &Object->ListEntry); InsertTailList(&Win32Process->CursorIconListHead, &Object->ListEntry);
ExReleaseFastMutex(&Win32Process->CursorIconListLock); IntUnLockProcessCursorIcons(Win32Process);
Object->Self = Handle; Object->Self = Handle;
Object->Process = PsGetWin32Process(); Object->Process = PsGetWin32Process();
@ -373,9 +373,9 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, HANDLE Handle, BOOL Rem
if(Object->Process && RemoveFromProcess) if(Object->Process && RemoveFromProcess)
{ {
ExAcquireFastMutex(&Object->Process->CursorIconListLock); IntLockProcessCursorIcons(Object->Process);
RemoveEntryList(&Object->ListEntry); RemoveEntryList(&Object->ListEntry);
ExReleaseFastMutex(&Object->Process->CursorIconListLock); IntUnLockProcessCursorIcons(Object->Process);
} }
ObmDereferenceObject(Object); ObmDereferenceObject(Object);
@ -401,7 +401,7 @@ IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
if(!(WinStaObject = Win32Process->WindowStation)) if(!(WinStaObject = Win32Process->WindowStation))
return; return;
ExAcquireFastMutex(&Win32Process->CursorIconListLock); IntLockProcessCursorIcons(Win32Process);
CurrentEntry = Win32Process->CursorIconListHead.Flink; CurrentEntry = Win32Process->CursorIconListHead.Flink;
while(CurrentEntry != &Win32Process->CursorIconListHead) while(CurrentEntry != &Win32Process->CursorIconListHead)
{ {
@ -411,7 +411,7 @@ IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
IntDestroyCurIconObject(WinStaObject, Current->Self, FALSE); IntDestroyCurIconObject(WinStaObject, Current->Self, FALSE);
CurrentEntry = NextEntry; CurrentEntry = NextEntry;
} }
ExReleaseFastMutex(&Win32Process->CursorIconListLock); IntUnLockProcessCursorIcons(Win32Process);
} }
/* /*

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: text.c,v 1.77 2004/02/22 08:35:21 navaraf Exp $ */ /* $Id: text.c,v 1.78 2004/02/24 13:27:03 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
@ -184,9 +184,9 @@ IntGdiAddFontResource(PUNICODE_STRING Filename, DWORD fl)
ZwClose(FileHandle); ZwClose(FileHandle);
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
error = FT_New_Memory_Face(library, buffer, size, 0, &face); error = FT_New_Memory_Face(library, buffer, size, 0, &face);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error == FT_Err_Unknown_File_Format) if (error == FT_Err_Unknown_File_Format)
{ {
DPRINT1("Unknown font file format\n"); DPRINT1("Unknown font file format\n");
@ -226,17 +226,17 @@ IntGdiAddFontResource(PUNICODE_STRING Filename, DWORD fl)
{ {
PW32PROCESS Win32Process = PsGetWin32Process(); PW32PROCESS Win32Process = PsGetWin32Process();
ExAcquireFastMutex(&Win32Process->PrivateFontListLock); IntLockProcessPrivateFonts(Win32Process);
InsertTailList(&Win32Process->PrivateFontListHead, &entry->ListEntry); InsertTailList(&Win32Process->PrivateFontListHead, &entry->ListEntry);
FontsLoaded++; FontsLoaded++;
ExReleaseFastMutex(&Win32Process->PrivateFontListLock); IntUnLockProcessPrivateFonts(Win32Process);
} }
else else
{ {
ExAcquireFastMutex(&FontListLock); IntLockGlobalFonts;
InsertTailList(&FontListHead, &entry->ListEntry); InsertTailList(&FontListHead, &entry->ListEntry);
FontsLoaded++; FontsLoaded++;
ExReleaseFastMutex(&FontListLock); IntUnLockGlobalFonts;
} }
return 1; return 1;
@ -637,9 +637,9 @@ NtGdiExtTextOut(
} }
if (!found) if (!found)
DPRINT1("WARNING: Could not find desired charmap!\n"); DPRINT1("WARNING: Could not find desired charmap!\n");
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
error = FT_Set_Charmap(face, found); error = FT_Set_Charmap(face, found);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
DPRINT1("WARNING: Could not set the charmap!\n"); DPRINT1("WARNING: Could not set the charmap!\n");
} }
@ -650,7 +650,7 @@ NtGdiExtTextOut(
else else
RenderMode = FT_RENDER_MODE_MONO; RenderMode = FT_RENDER_MODE_MONO;
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
error = FT_Set_Pixel_Sizes( error = FT_Set_Pixel_Sizes(
face, face,
/* FIXME should set character height if neg */ /* FIXME should set character height if neg */
@ -658,7 +658,7 @@ NtGdiExtTextOut(
- TextObj->logfont.lfHeight : - TextObj->logfont.lfHeight :
TextObj->logfont.lfHeight), TextObj->logfont.lfHeight),
TextObj->logfont.lfWidth); TextObj->logfont.lfWidth);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
{ {
DPRINT1("Error in setting pixel sizes: %u\n", error); DPRINT1("Error in setting pixel sizes: %u\n", error);
@ -752,10 +752,10 @@ NtGdiExtTextOut(
for (i = 0; i < Count; i++) for (i = 0; i < Count; i++)
{ {
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
glyph_index = FT_Get_Char_Index(face, *TempText); glyph_index = FT_Get_Char_Index(face, *TempText);
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
{ {
@ -768,9 +768,9 @@ NtGdiExtTextOut(
if (use_kerning && previous && glyph_index) if (use_kerning && previous && glyph_index)
{ {
FT_Vector delta; FT_Vector delta;
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
FT_Get_Kerning(face, previous, glyph_index, 0, &delta); FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
TextWidth += delta.x >> 6; TextWidth += delta.x >> 6;
} }
@ -802,10 +802,10 @@ NtGdiExtTextOut(
for (i = 0; i < Count; i++) for (i = 0; i < Count; i++)
{ {
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
glyph_index = FT_Get_Char_Index(face, *String); glyph_index = FT_Get_Char_Index(face, *String);
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
{ {
@ -821,17 +821,17 @@ NtGdiExtTextOut(
if (use_kerning && previous && glyph_index) if (use_kerning && previous && glyph_index)
{ {
FT_Vector delta; FT_Vector delta;
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
FT_Get_Kerning(face, previous, glyph_index, 0, &delta); FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
TextLeft += delta.x >> 6; TextLeft += delta.x >> 6;
} }
if (glyph->format == ft_glyph_format_outline) if (glyph->format == ft_glyph_format_outline)
{ {
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
error = FT_Render_Glyph(glyph, RenderMode); error = FT_Render_Glyph(glyph, RenderMode);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
{ {
EngDeleteXlate(XlateObj); EngDeleteXlate(XlateObj);
@ -1054,12 +1054,12 @@ NtGdiGetCharWidth32(HDC hDC,
return FALSE; return FALSE;
} }
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
FT_Set_Charmap(face, found); FT_Set_Charmap(face, found);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
} }
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
FT_Set_Pixel_Sizes(face, FT_Set_Pixel_Sizes(face,
/* FIXME should set character height if neg */ /* FIXME should set character height if neg */
(TextObj->logfont.lfHeight < 0 ? (TextObj->logfont.lfHeight < 0 ?
@ -1073,7 +1073,7 @@ NtGdiGetCharWidth32(HDC hDC,
FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
SafeBuffer[i] = face->glyph->advance.x >> 6; SafeBuffer[i] = face->glyph->advance.x >> 6;
} }
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
TEXTOBJ_UnlockText(dc->w.hFont); TEXTOBJ_UnlockText(dc->w.hFont);
MmCopyToCaller(Buffer, SafeBuffer, BufferSize); MmCopyToCaller(Buffer, SafeBuffer, BufferSize);
ExFreePool(SafeBuffer); ExFreePool(SafeBuffer);
@ -1201,23 +1201,23 @@ TextIntGetTextExtentPoint(HDC hDC,
DPRINT1("WARNING: Could not find desired charmap!\n"); DPRINT1("WARNING: Could not find desired charmap!\n");
} }
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
error = FT_Set_Charmap(face, found); error = FT_Set_Charmap(face, found);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
{ {
DPRINT1("WARNING: Could not set the charmap!\n"); DPRINT1("WARNING: Could not set the charmap!\n");
} }
} }
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
error = FT_Set_Pixel_Sizes(face, error = FT_Set_Pixel_Sizes(face,
/* FIXME should set character height if neg */ /* FIXME should set character height if neg */
(TextObj->logfont.lfHeight < 0 ? (TextObj->logfont.lfHeight < 0 ?
- TextObj->logfont.lfHeight : - TextObj->logfont.lfHeight :
TextObj->logfont.lfHeight), TextObj->logfont.lfHeight),
TextObj->logfont.lfWidth); TextObj->logfont.lfWidth);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
{ {
DPRINT1("Error in setting pixel sizes: %u\n", error); DPRINT1("Error in setting pixel sizes: %u\n", error);
@ -1228,10 +1228,10 @@ TextIntGetTextExtentPoint(HDC hDC,
for (i = 0; i < Count; i++) for (i = 0; i < Count; i++)
{ {
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
glyph_index = FT_Get_Char_Index(face, *String); glyph_index = FT_Get_Char_Index(face, *String);
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (error) if (error)
{ {
DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index); DPRINT1("WARNING: Failed to load and render glyph! [index: %u]\n", glyph_index);
@ -1242,9 +1242,9 @@ TextIntGetTextExtentPoint(HDC hDC,
if (use_kerning && previous && glyph_index) if (use_kerning && previous && glyph_index)
{ {
FT_Vector delta; FT_Vector delta;
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
FT_Get_Kerning(face, previous, glyph_index, 0, &delta); FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
TotalWidth += delta.x >> 6; TotalWidth += delta.x >> 6;
} }
@ -1536,14 +1536,14 @@ NtGdiGetTextMetrics(HDC hDC,
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
Face = FontGDI->face; Face = FontGDI->face;
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
Error = FT_Set_Pixel_Sizes(Face, Error = FT_Set_Pixel_Sizes(Face,
/* FIXME should set character height if neg */ /* FIXME should set character height if neg */
(TextObj->logfont.lfHeight < 0 ? (TextObj->logfont.lfHeight < 0 ?
- TextObj->logfont.lfHeight : - TextObj->logfont.lfHeight :
TextObj->logfont.lfHeight), TextObj->logfont.lfHeight),
TextObj->logfont.lfWidth); TextObj->logfont.lfWidth);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (0 != Error) if (0 != Error)
{ {
DPRINT1("Error in setting pixel sizes: %u\n", Error); DPRINT1("Error in setting pixel sizes: %u\n", Error);
@ -1552,9 +1552,9 @@ NtGdiGetTextMetrics(HDC hDC,
else else
{ {
memcpy(&SafeTm, &FontGDI->TextMetric, sizeof(TEXTMETRICW)); memcpy(&SafeTm, &FontGDI->TextMetric, sizeof(TEXTMETRICW));
ExAcquireFastMutex(&FreeTypeLock); IntLockFreeType;
pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2); pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
ExReleaseFastMutex(&FreeTypeLock); IntUnLockFreeType;
if (NULL == pOS2) if (NULL == pOS2)
{ {
DPRINT1("Can't find OS/2 table - not TT font?\n"); DPRINT1("Can't find OS/2 table - not TT font?\n");
@ -1695,7 +1695,7 @@ TextIntRealizeFont(HFONT FontHandle)
/* find font in private fonts */ /* find font in private fonts */
Win32Process = PsGetWin32Process(); Win32Process = PsGetWin32Process();
ExAcquireFastMutex(&Win32Process->PrivateFontListLock); IntLockProcessPrivateFonts(Win32Process);
Entry = Win32Process->PrivateFontListHead.Flink; Entry = Win32Process->PrivateFontListHead.Flink;
while(Entry != &Win32Process->PrivateFontListHead) while(Entry != &Win32Process->PrivateFontListHead)
@ -1710,10 +1710,10 @@ TextIntRealizeFont(HFONT FontHandle)
} }
Entry = Entry->Flink; Entry = Entry->Flink;
} }
ExReleaseFastMutex(&Win32Process->PrivateFontListLock); IntUnLockProcessPrivateFonts(Win32Process);
/* find font in system fonts */ /* find font in system fonts */
ExAcquireFastMutex(&FontListLock); IntLockGlobalFonts;
Entry = FontListHead.Flink; Entry = FontListHead.Flink;
while(Entry != &FontListHead) while(Entry != &FontListHead)
@ -1749,7 +1749,10 @@ TextIntRealizeFont(HFONT FontHandle)
} }
ExReleaseFastMutex((Private ? &Win32Process->PrivateFontListLock : &FontListLock)); if(Private)
IntUnLockProcessPrivateFonts(Win32Process);
else
IntUnLockGlobalFonts;
ASSERT(! NT_SUCCESS(Status) || NULL != TextObj->GDIFontHandle); ASSERT(! NT_SUCCESS(Status) || NULL != TextObj->GDIFontHandle);