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
* 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
* PROJECT: ReactOS kernel
@ -40,6 +40,7 @@
#include <include/object.h>
#include <include/dib.h>
#include <include/surface.h>
#include <include/eng.h>
#include <include/inteng.h>
#define NDEBUG
@ -519,11 +520,11 @@ IntEngBitBlt(SURFOBJ *DestObj,
/* Call the driver's DrvBitBlt if available */
if (NULL != DestGDI->BitBlt)
{
ExAcquireFastMutex(DestGDI->DriverLock);
IntLockGDIDriver(DestGDI);
ret = DestGDI->BitBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
&OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin,
Rop4);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
}
if (! ret)
@ -837,10 +838,10 @@ IntEngStretchBlt(SURFOBJ *DestObj,
/* 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 */
// FIXME: MaskOrigin is always NULL !
ExAcquireFastMutex(DestGDI->DriverLock);
IntLockGDIDriver(DestGDI);
ret = DestGDI->StretchBlt(DestObj, SourceObj, Mask, ClipRegion, ColorTranslation,
&ca, BrushOrigin, &OutputRect, &InputRect, NULL, Mode);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
}
if (! ret)
@ -977,10 +978,10 @@ EngMaskBitBlt(SURFOBJ *DestObj,
}
DestGDI = (SURFGDI*)AccessInternalObjectFromUserObject(DestObj);
ExAcquireFastMutex(DestGDI->DriverLock);
IntLockGDIDriver(DestGDI);
if (! IntEngEnter(&EnterLeaveSource, NULL, &InputRect, TRUE, &Translate, &InputObj))
{
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
return FALSE;
}
@ -1036,14 +1037,14 @@ EngMaskBitBlt(SURFOBJ *DestObj,
if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
{
IntEngLeave(&EnterLeaveSource);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
return TRUE;
}
if (! IntEngEnter(&EnterLeaveDest, DestObj, &OutputRect, FALSE, &Translate, &OutputObj))
{
IntEngLeave(&EnterLeaveSource);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
return FALSE;
}
@ -1138,7 +1139,7 @@ EngMaskBitBlt(SURFOBJ *DestObj,
IntEngLeave(&EnterLeaveDest);
IntEngLeave(&EnterLeaveSource);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
/* Dummy BitBlt to let driver know that something has changed.
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
* 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
* PROJECT: ReactOS kernel
@ -75,9 +75,9 @@ EngCopyBits(SURFOBJ *Dest,
if (DestGDI->CopyBits!=NULL)
{
ExAcquireFastMutex(DestGDI->DriverLock);
IntLockGDIDriver(DestGDI);
ret = DestGDI->CopyBits(Dest, Source, Clip, ColorTranslation, DestRect, SourcePoint);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
MouseSafetyOnDrawEnd(Source, SourceGDI);
MouseSafetyOnDrawEnd(Dest, DestGDI);
@ -93,9 +93,9 @@ EngCopyBits(SURFOBJ *Dest,
if (SourceGDI->CopyBits!=NULL)
{
ExAcquireFastMutex(DestGDI->DriverLock);
IntLockGDIDriver(DestGDI);
ret = SourceGDI->CopyBits(Dest, Source, Clip, ColorTranslation, DestRect, SourcePoint);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
MouseSafetyOnDrawEnd(Source, SourceGDI);
MouseSafetyOnDrawEnd(Dest, DestGDI);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -29,6 +29,7 @@
#include <ddk/winddi.h>
#include <ddk/ntddmou.h>
#include <include/eng.h>
#include <include/object.h>
#include <include/paint.h>
#include <include/surface.h>
@ -549,10 +550,10 @@ IntEngGradientFill(
pco->rclBounds.right, pco->rclBounds.bottom);
if((psoDest->iType != STYPE_BITMAP) && SurfGDI->GradientFill)
{
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
Ret = SurfGDI->GradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
prclExtents, pptlDitherOrg, ulMode);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
MouseSafetyOnDrawEnd(psoDest, SurfGDI);
return Ret;
}
@ -564,10 +565,10 @@ IntEngGradientFill(
0x00AA0029 is the Rop for D (no-op) */
if(SurfGDI->BitBlt)
{
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->BitBlt(psoDest, NULL, NULL, pco, pxlo,
prclExtents, pptlDitherOrg, NULL, NULL, NULL, 0x00AA0029);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
MouseSafetyOnDrawEnd(psoDest, SurfGDI);
return TRUE;
}

View file

@ -16,12 +16,13 @@
* along with this program; if not, write to the Free Software
* 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/ntddmou.h>
#include <include/inteng.h>
#include <include/eng.h>
#include <include/dib.h>
#include "clip.h"
#include "objects.h"
@ -521,9 +522,9 @@ IntEngLineTo(SURFOBJ *DestSurf,
if (NULL != SurfGDI->LineTo)
{
/* Call the driver's DrvLineTo */
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
ret = SurfGDI->LineTo(DestSurf, Clip, Brush, x1, y1, x2, y2, /*RectBounds*/&b, mix);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
}
#if 0

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PURPOSE: Mouse
@ -154,9 +154,9 @@ MouseSafetyOnDrawStart(PSURFOBJ SurfObj, PSURFGDI SurfGDI, LONG HazardX1,
return FALSE;
}
CurInfo->SafetySwitch = TRUE;
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, -1, -1, NULL);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
ExReleaseFastMutex(&CurInfo->CursorMutex);
}
@ -224,9 +224,9 @@ MouseSafetyOnDrawEnd(PSURFOBJ SurfObj, PSURFGDI SurfGDI)
ObDereferenceObject(InputWindowStation);
return FALSE;
}
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect);
CurInfo->SafetySwitch = FALSE;
}
@ -280,9 +280,9 @@ MouseMoveCursor(LONG X, LONG Y)
if(CurInfo->Enabled)
{
ExAcquireFastMutex(&CurInfo->CursorMutex);
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect);
ExReleaseFastMutex(&CurInfo->CursorMutex);
}
@ -441,9 +441,9 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y)))
{
ExAcquireFastMutex(&CurInfo->CursorMutex);
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect);
ExReleaseFastMutex(&CurInfo->CursorMutex);
mouse_cx = 0;
@ -471,9 +471,9 @@ MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount)
((mouse_ox != CurInfo->x) || (mouse_oy != CurInfo->y)))
{
ExAcquireFastMutex(&CurInfo->CursorMutex);
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, CurInfo->x, CurInfo->y, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect);
ExReleaseFastMutex(&CurInfo->CursorMutex);
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -32,6 +32,7 @@
#include <include/object.h>
#include <include/paint.h>
#include <include/surface.h>
#include <include/eng.h>
#include "objects.h"
#include <include/mouse.h>
@ -141,9 +142,9 @@ IntEngPaint(IN SURFOBJ *Surface,
ClipRegion->rclBounds.top, ClipRegion->rclBounds.right,
ClipRegion->rclBounds.bottom);
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
ret = SurfGDI->Paint(Surface, ClipRegion, Brush, BrushOrigin, Mix);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
MouseSafetyOnDrawEnd(Surface, SurfGDI);
return ret;
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -32,6 +32,7 @@
#include <ddk/ntddmou.h>
#include <ntos/minmax.h>
#include <include/dib.h>
#include <include/eng.h>
#include <include/object.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
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,
TransparentColor, Reserved);
ExReleaseFastMutex(DestGDI->DriverLock);
IntUnLockGDIDriver(DestGDI);
MouseSafetyOnDrawEnd(Source, SourceGDI);
MouseSafetyOnDrawEnd(Dest, DestGDI);

View file

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

View file

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

View file

@ -1,6 +1,12 @@
#ifndef _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);
VOID FASTCALL EngDeleteXlate (XLATEOBJ *XlateObj);
BOOL STDCALL

View file

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

View file

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

View file

@ -44,8 +44,20 @@ typedef struct _MENU_OBJECT
PMENU_OBJECT FASTCALL
IntGetMenuObject(HMENU hMenu);
VOID FASTCALL
IntReleaseMenuObject(PMENU_OBJECT MenuObject);
#define IntLockMenuItems(MenuObj) \
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
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 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 */
/* EOF */

View file

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

View file

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

View file

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

View file

@ -6,4 +6,22 @@ BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
BOOL FASTCALL IntIsFontRenderingEnabled(VOID);
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 */

View file

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

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -36,32 +36,14 @@
#define NDEBUG
#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 *****************************************************************/
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
ObmpPerformRetentionChecks(PUSER_OBJECT_HEADER ObjectHeader)
{
@ -307,10 +289,7 @@ ObmDereferenceObject(PVOID ObjectBody)
ObjectHeader = BODY_TO_HEADER(ObjectBody);
ObjectHeader->RefCount--;
#if 0
if(ObjectHeader->Type == otWindow)
DbgPrint("Dereference 0x%x: %d\n", ((PWINDOW_OBJECT)ObjectBody)->Self, ObjectHeader->RefCount);
#endif
ObmpPerformRetentionChecks(ObjectHeader);
}
@ -333,10 +312,7 @@ ObmReferenceObjectByPointer(PVOID ObjectBody,
{
return STATUS_INVALID_PARAMETER;
}
#if 0
if(ObjectType == otWindow)
DbgPrint("Reference 0x%x: %d\n", ((PWINDOW_OBJECT)ObjectBody)->Self, ObjectHeader->RefCount);
#endif
ObjectHeader->RefCount++;
return STATUS_SUCCESS;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -66,7 +66,7 @@ ClassReferenceClassByAtom(PWNDCLASS_OBJECT* Class,
PLIST_ENTRY CurrentEntry;
PW32PROCESS Process = PsGetWin32Process();
ExAcquireFastMutexUnsafe (&Process->ClassListLock);
IntLockProcessClasses(Process);
CurrentEntry = Process->ClassListHead.Flink;
while (CurrentEntry != &Process->ClassListHead)
{
@ -76,13 +76,13 @@ ClassReferenceClassByAtom(PWNDCLASS_OBJECT* Class,
{
*Class = Current;
ObmReferenceObject(Current);
ExReleaseFastMutexUnsafe (&Process->ClassListLock);
IntUnLockProcessClasses(Process);
return(STATUS_SUCCESS);
}
CurrentEntry = CurrentEntry->Flink;
}
ExReleaseFastMutexUnsafe (&Process->ClassListLock);
IntUnLockProcessClasses(Process);
return(STATUS_NOT_FOUND);
}
@ -418,9 +418,9 @@ NtUserRegisterClassExWOW(
DPRINT("Failed creating window class object\n");
return((RTL_ATOM)0);
}
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock);
IntLockProcessClasses(PsGetWin32Process());
InsertTailList(&PsGetWin32Process()->ClassListHead, &ClassObject->ListEntry);
ExReleaseFastMutex(&PsGetWin32Process()->ClassListLock);
IntUnLockProcessClasses(PsGetWin32Process());
ObDereferenceObject(WinStaObject);
return(Atom);
}

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -106,9 +106,9 @@ IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinSt
Hook->HookId = HookId;
RtlInitUnicodeString(&Hook->ModuleName, NULL);
ExAcquireFastMutex(&Table->Lock);
IntLockHookTable(Table);
InsertHeadList(&Table->Hooks[HOOKID_TO_INDEX(HookId)], &Hook->Chain);
ExReleaseFastMutex(&Table->Lock);
IntUnLockHookTable(Table);
return Hook;
}
@ -142,7 +142,7 @@ IntGetFirstValidHook(PHOOKTABLE Table, int HookId)
PHOOK Hook;
PLIST_ENTRY Elem;
ExAcquireFastMutex(&Table->Lock);
IntLockHookTable(Table);
Hook = IntGetFirstHook(Table, HookId);
while (NULL != Hook && NULL == Hook->Proc)
{
@ -150,7 +150,7 @@ IntGetFirstValidHook(PHOOKTABLE Table, int HookId)
Hook = (Elem == &Table->Hooks[HOOKID_TO_INDEX(HookId)]
? NULL : CONTAINING_RECORD(Elem, HOOK, Chain));
}
ExReleaseFastMutex(&Table->Lock);
IntUnLockHookTable(Table);
return Hook;
}
@ -163,18 +163,18 @@ IntGetNextHook(PHOOK Hook)
int HookId = Hook->HookId;
PLIST_ENTRY Elem;
ExAcquireFastMutex(&Table->Lock);
IntLockHookTable(Table);
Elem = Hook->Chain.Flink;
while (Elem != &Table->Hooks[HOOKID_TO_INDEX(HookId)])
{
Hook = CONTAINING_RECORD(Elem, HOOK, Chain);
if (NULL != Hook->Proc)
{
ExReleaseFastMutex(&Table->Lock);
IntUnLockHookTable(Table);
return Hook;
}
}
ExReleaseFastMutex(&Table->Lock);
IntUnLockHookTable(Table);
if (NULL != GlobalHooks && Table != GlobalHooks) /* now search through the global table */
{
@ -206,7 +206,7 @@ IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj)
return;
}
ExAcquireFastMutex(&Table->Lock);
IntLockHookTable(Table);
if (0 != Table->Counts[HOOKID_TO_INDEX(Hook->HookId)])
{
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);
}
ExReleaseFastMutex(&Table->Lock);
IntUnLockHookTable(Table);
}
/* 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;
}
ExAcquireFastMutex(&Table->Lock);
IntLockHookTable(Table);
/* use count shouldn't already be 0 */
ASSERT(0 != Table->Counts[HOOKID_TO_INDEX(HookId)]);
if (0 == Table->Counts[HOOKID_TO_INDEX(HookId)])
{
ExReleaseFastMutex(&Table->Lock);
IntUnLockHookTable(Table);
return;
}
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
@ -281,14 +281,14 @@ HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
return 0;
}
ExAcquireFastMutex(&Table->Lock);
IntLockHookTable(Table);
Table->Counts[HOOKID_TO_INDEX(HookId)]++;
ExReleaseFastMutex(&Table->Lock);
IntUnLockHookTable(Table);
if (Table != GlobalHooks && GlobalHooks != NULL)
{
ExAcquireFastMutex(&GlobalHooks->Lock);
IntLockHookTable(GlobalHooks);
GlobalHooks->Counts[HOOKID_TO_INDEX(HookId)]++;
ExReleaseFastMutex(&GlobalHooks->Lock);
IntUnLockHookTable(GlobalHooks);
}
Result = IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc,
@ -334,7 +334,7 @@ HOOK_DestroyThreadHooks(PETHREAD Thread)
DPRINT1("Invalid window station????\n");
return;
}
ExAcquireFastMutex(&GlobalHooks->Lock);
IntLockHookTable(GlobalHooks);
for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++)
{
/* only low-level keyboard/mouse global hooks can be owned by a thread */
@ -355,7 +355,7 @@ HOOK_DestroyThreadHooks(PETHREAD Thread)
break;
}
}
ExReleaseFastMutex(&GlobalHooks->Lock);
IntUnLockHookTable(GlobalHooks);
ObDereferenceObject(WinStaObj);
}
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -80,7 +80,7 @@ GetHotKey (PWINSTATION_OBJECT WinStaObject,
return FALSE;
}
ExAcquireFastMutex (&WinStaObject->HotKeyListLock);
IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink;
while (Entry != &WinStaObject->HotKeyListHead)
@ -100,7 +100,7 @@ GetHotKey (PWINSTATION_OBJECT WinStaObject,
if (id != NULL)
*id = HotKeyItem->id;
ExReleaseFastMutex (&WinStaObject->HotKeyListLock);
IntUnLockHotKeys(WinStaObject);
return TRUE;
}
@ -108,7 +108,7 @@ GetHotKey (PWINSTATION_OBJECT WinStaObject,
Entry = Entry->Flink;
}
ExReleaseFastMutex (&WinStaObject->HotKeyListLock);
IntUnLockHotKeys(WinStaObject);
return FALSE;
}
@ -128,7 +128,7 @@ UnregisterWindowHotKeys(PWINDOW_OBJECT Window)
if(!WinStaObject)
return;
ExAcquireFastMutex (&WinStaObject->HotKeyListLock);
IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink;
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)
return;
ExAcquireFastMutex (&WinStaObject->HotKeyListLock);
IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink;
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;
}
ExAcquireFastMutex (&WinStaObject->HotKeyListLock);
IntLockHotKeys(WinStaObject);
/* Check for existing hotkey */
if (IsHotKey (WinStaObject, fsModifiers, vk))
{
ExReleaseFastMutex (&WinStaObject->HotKeyListLock);
IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window);
return FALSE;
}
@ -247,7 +247,7 @@ NtUserRegisterHotKey(HWND hWnd,
HotKeyItem = ExAllocatePoolWithTag (PagedPool, sizeof(HOT_KEY_ITEM), TAG_HOTKEY);
if (HotKeyItem == NULL)
{
ExReleaseFastMutex (&WinStaObject->HotKeyListLock);
IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window);
return FALSE;
}
@ -261,7 +261,7 @@ NtUserRegisterHotKey(HWND hWnd,
InsertHeadList (&WinStaObject->HotKeyListHead,
&HotKeyItem->ListEntry);
ExReleaseFastMutex (&WinStaObject->HotKeyListLock);
IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window);
return TRUE;
@ -293,7 +293,7 @@ NtUserUnregisterHotKey(HWND hWnd,
return FALSE;
}
ExAcquireFastMutex (&WinStaObject->HotKeyListLock);
IntLockHotKeys(WinStaObject);
Entry = WinStaObject->HotKeyListHead.Flink;
while (Entry != &WinStaObject->HotKeyListHead)
@ -306,7 +306,7 @@ NtUserUnregisterHotKey(HWND hWnd,
{
RemoveEntryList (&HotKeyItem->ListEntry);
ExFreePool (HotKeyItem);
ExReleaseFastMutex (&WinStaObject->HotKeyListLock);
IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window);
return TRUE;
@ -315,7 +315,7 @@ NtUserUnregisterHotKey(HWND hWnd,
Entry = Entry->Flink;
}
ExReleaseFastMutex (&WinStaObject->HotKeyListLock);
IntUnLockHotKeys(WinStaObject);
IntReleaseWindowObject(Window);
return FALSE;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -67,6 +67,12 @@ FAST_MUTEX QueueStateLock;
BYTE QueueKeyStateTable[256];
#define IntLockQueueState \
ExAcquireFastMutex(&QueueStateLock)
#define IntUnLockQueueState \
ExReleaseFastMutex(&QueueStateLock)
/* FUNCTIONS *****************************************************************/
/* Initialization -- Right now, just zero the key state and init the lock */
@ -314,12 +320,12 @@ NtUserGetKeyState(
{
DWORD ret = 0;
ExAcquireFastMutex(&QueueStateLock);
IntLockQueueState;
if( key < 0x100 ) {
ret = ((DWORD)(QueueKeyStateTable[key] & KS_DOWN_BIT) << 8 ) |
(QueueKeyStateTable[key] & KS_LOCK_BIT);
}
ExReleaseFastMutex(&QueueStateLock);
IntUnLockQueueState;
return ret;
}
@ -332,7 +338,7 @@ int STDCALL ToUnicodeEx( UINT wVirtKey,
HKL dwhkl ) {
int ToUnicodeResult = 0;
ExAcquireFastMutex(&QueueStateLock);
IntLockQueueState;
ToUnicodeResult = ToUnicodeInner( wVirtKey,
wScanCode,
lpKeyState,
@ -341,7 +347,7 @@ int STDCALL ToUnicodeEx( UINT wVirtKey,
wFlags,
PsGetWin32Thread() ?
PsGetWin32Thread()->KeyboardLayout : 0 );
ExReleaseFastMutex(&QueueStateLock);
IntUnLockQueueState;
return ToUnicodeResult;
}
@ -618,7 +624,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
ScanCode = (lpMsg->lParam >> 16) & 0xff;
ExAcquireFastMutex(&QueueStateLock);
IntLockQueueState;
UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
QueueKeyStateTable, wp, 2, 0,
@ -681,7 +687,7 @@ IntTranslateKbdMessage(LPMSG lpMsg,
Result = TRUE;
}
ExReleaseFastMutex(&QueueStateLock);
IntUnLockQueueState;
return Result;
}
@ -692,12 +698,12 @@ NtUserGetKeyboardState(
{
BOOL Result = TRUE;
ExAcquireFastMutex(&QueueStateLock);
IntLockQueueState;
if (lpKeyState) {
if(!NT_SUCCESS(MmCopyToCaller(lpKeyState, QueueKeyStateTable, 256)))
Result = FALSE;
}
ExReleaseFastMutex(&QueueStateLock);
IntUnLockQueueState;
return Result;
}
@ -708,12 +714,12 @@ NtUserSetKeyboardState(
{
BOOL Result = TRUE;
ExAcquireFastMutex(&QueueStateLock);
IntLockQueueState;
if (lpKeyState) {
if(! NT_SUCCESS(MmCopyFromCaller(QueueKeyStateTable, lpKeyState, 256)))
Result = FALSE;
}
ExReleaseFastMutex(&QueueStateLock);
IntUnLockQueueState;
return Result;
}
@ -964,7 +970,7 @@ VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) {
return;
}
ExAcquireFastMutex(&QueueStateLock);
IntLockQueueState;
/* arty -- handle numpad -- On real windows, the actual key produced
* 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;
}
ExReleaseFastMutex(&QueueStateLock);
IntUnLockQueueState;
}
/* EOF */

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -1018,7 +1018,7 @@ NtUserGetQueueStatus(BOOL ClearChanges)
Queue = PsGetWin32Thread()->MessageQueue;
ExAcquireFastMutex(&Queue->Lock);
IntLockMessageQueue(Queue);
Result = MAKELONG(Queue->ChangedBits, Queue->WakeBits);
if (ClearChanges)
@ -1026,7 +1026,7 @@ NtUserGetQueueStatus(BOOL ClearChanges)
Queue->ChangedBits = 0;
}
ExReleaseFastMutex(&Queue->Lock);
IntUnLockMessageQueue(Queue);
return Result;
}

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: 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
* PROJECT: ReactOS kernel
@ -65,7 +65,7 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN ValidRegion)
{
if (!(ParentWindow->Style & WS_CLIPCHILDREN))
{
ExAcquireFastMutex(&ParentWindow->UpdateLock);
IntLockWindowUpdate(ParentWindow);
if (ParentWindow->UpdateRegion != 0)
{
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 */
NtGdiOffsetRgn(ValidRegion, -OffsetX, -OffsetY);
}
ExReleaseFastMutex(&ParentWindow->UpdateLock);
IntUnLockWindowUpdate(ParentWindow);
}
OldWindow = ParentWindow;
ParentWindow = IntGetParentObject(ParentWindow);
@ -107,7 +107,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
{
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{
ExAcquireFastMutex(&Window->UpdateLock);
IntLockWindowUpdate(Window);
if (Window->NCUpdateRegion)
{
IntValidateParent(Window, Window->NCUpdateRegion);
@ -116,7 +116,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
Window->NCUpdateRegion = NULL;
Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
MsqDecPaintCountQueue(Window->MessageQueue);
ExReleaseFastMutex(&Window->UpdateLock);
IntUnLockWindowUpdate(Window);
IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
}
@ -144,7 +144,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{
IntSendMessage(hWnd, WM_PAINT, 0, 0);
ExAcquireFastMutex(&Window->UpdateLock);
IntLockWindowUpdate(Window);
if (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT)
{
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
@ -153,7 +153,7 @@ IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
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
*/
ExAcquireFastMutex(&Window->UpdateLock);
IntLockWindowUpdate(Window);
HadPaintMessage = Window->UpdateRegion != NULL ||
Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT;
HadNCPaintMessage = Window->Flags & WINDOWOBJECT_NEED_NCPAINT;
@ -399,7 +399,7 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
MsqIncPaintCountQueue(Window->MessageQueue);
}
ExReleaseFastMutex(&Window->UpdateLock);
IntUnLockWindowUpdate(Window);
}
/*
@ -612,17 +612,17 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
#if 0
DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n");
#endif
ExAcquireFastMutex(&MessageQueue->Lock);
IntLockMessageQueue(MessageQueue);
MessageQueue->PaintPosted = 0;
MessageQueue->PaintCount = 0;
ExReleaseFastMutex(&MessageQueue->Lock);
IntUnLockMessageQueue(MessageQueue);
return FALSE;
}
Window = IntGetWindowObject(Message->hwnd);
if (Window != NULL)
{
ExAcquireFastMutex(&Window->UpdateLock);
IntLockWindowUpdate(Window);
if (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)
{
Message->message = WM_NCPAINT;
@ -648,7 +648,7 @@ IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
}
}
}
ExReleaseFastMutex(&Window->UpdateLock);
IntUnLockWindowUpdate(Window);
IntReleaseWindowObject(Window);
return TRUE;
@ -726,7 +726,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
return NULL;
}
ExAcquireFastMutex(&Window->UpdateLock);
IntLockWindowUpdate(Window);
if (Window->UpdateRegion != NULL)
{
MsqDecPaintCountQueue(Window->MessageQueue);
@ -742,7 +742,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
{
NtUserGetClientRect(Window, &lPs->rcPaint);
}
ExReleaseFastMutex(&Window->UpdateLock);
IntUnLockWindowUpdate(Window);
if (Window->Flags & WINDOWOBJECT_NEED_ERASEBKGND)
{

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -100,7 +100,7 @@ NtUserBuildPropList(HWND hWnd,
}
/* copy list */
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock);
IntLockWindowProperties(WindowObject);
li = (PROPLISTITEM *)Buffer;
ListEntry = WindowObject->PropListHead.Flink;
@ -113,7 +113,7 @@ NtUserBuildPropList(HWND hWnd,
Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM));
if(!NT_SUCCESS(Status))
{
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock);
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject);
return Status;
}
@ -124,13 +124,13 @@ NtUserBuildPropList(HWND hWnd,
ListEntry = ListEntry->Flink;
}
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock);
IntUnLockWindowProperties(WindowObject);
}
else
{
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock);
IntLockWindowProperties(WindowObject);
Cnt = WindowObject->PropListItems * sizeof(PROPLISTITEM);
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock);
IntUnLockWindowProperties(WindowObject);
}
IntReleaseWindowObject(WindowObject);
@ -160,12 +160,12 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom)
return NULL;
}
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock);
IntLockWindowProperties(WindowObject);
Prop = IntGetProp(WindowObject, Atom);
if (Prop == NULL)
{
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock);
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject);
return(NULL);
}
@ -173,7 +173,7 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom)
RemoveEntryList(&Prop->PropListEntry);
ExFreePool(Prop);
WindowObject->PropListItems--;
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock);
IntUnLockWindowProperties(WindowObject);
IntReleaseWindowObject(WindowObject);
return(Data);
}
@ -191,9 +191,9 @@ NtUserGetProp(HWND hWnd, ATOM Atom)
return FALSE;
}
ExAcquireFastMutexUnsafe(&WindowObject->PropListLock);
IntLockWindowProperties(WindowObject);
Prop = IntGetProp(WindowObject, Atom);
ExReleaseFastMutexUnsafe(&WindowObject->PropListLock);
IntUnLockWindowProperties(WindowObject);
if (Prop != NULL)
{
Data = Prop->Data;
@ -238,9 +238,9 @@ NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)
return FALSE;
}
ExAcquireFastMutexUnsafe(&Wnd->PropListLock);
IntLockWindowProperties(Wnd);
ret = IntSetProp(Wnd, Atom, Data);
ExReleaseFastMutexUnsafe(&Wnd->PropListLock);
IntUnLockWindowProperties(Wnd);
return ret;
}

View file

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

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
* PROJECT: ReactOS kernel
@ -178,7 +178,7 @@ WinPosFindIconPos(HWND hWnd, POINT *Pos)
}
PINTERNALPOS FASTCALL
WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT *pt, PRECT RestoreRect)
{
PWINDOW_OBJECT Parent;
INT XInc, YInc;
@ -233,11 +233,11 @@ WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
}
if (WindowObject->Style & WS_MINIMIZE)
{
WindowObject->InternalPos->IconPos = pt;
WindowObject->InternalPos->IconPos = *pt;
}
else if (WindowObject->Style & WS_MAXIMIZE)
{
WindowObject->InternalPos->MaxPos = pt;
WindowObject->InternalPos->MaxPos = *pt;
}
else if (RestoreRect != NULL)
{
@ -255,7 +255,7 @@ WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
Size.x = WindowObject->WindowRect.left;
Size.y = WindowObject->WindowRect.top;
InternalPos = WinPosInitInternalPos(WindowObject, Size,
InternalPos = WinPosInitInternalPos(WindowObject, &Size,
&WindowObject->WindowRect);
if (InternalPos)
@ -1357,12 +1357,12 @@ WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, POINT *Point,
}
USHORT FASTCALL
WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT WinPoint,
WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT *WinPoint,
PWINDOW_OBJECT* Window)
{
HWND DesktopWindowHandle;
PWINDOW_OBJECT DesktopWindow;
POINT Point = WinPoint;
POINT Point = *WinPoint;
USHORT HitTest;
*Window = NULL;
@ -1417,7 +1417,7 @@ NtUserGetMinMaxInfo(
Size.x = Window->WindowRect.left;
Size.y = Window->WindowRect.top;
InternalPos = WinPosInitInternalPos(Window, Size,
InternalPos = WinPosInitInternalPos(Window, &Size,
&Window->WindowRect);
if(InternalPos)
{

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: 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
@ -31,6 +31,7 @@
#include <win32k/ntuser.h>
#include "../eng/handle.h"
#include <include/inteng.h>
#include <include/eng.h>
#include <include/color.h>
#include <include/palette.h>
#include <include/error.h>
@ -333,9 +334,9 @@ UINT STDCALL NtGdiRealizePalette(HDC hDC)
} else {
if(SurfGDI->SetPalette)
{
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
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
* 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
@ -146,9 +146,9 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
if (NULL != CurInfo->CurrentCursorObject && CurInfo->ShowingCursor)
{
/* Remove the cursor if it was displayed */
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->MovePointer(SurfObj, -1, -1, &PointerRect);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
SetPointerRect(CurInfo, &PointerRect);
}
@ -220,7 +220,7 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
CurInfo->CurrentCursorObject = NULL;
}
ExAcquireFastMutex(SurfGDI->DriverLock);
IntLockGDIDriver(SurfGDI);
SurfGDI->PointerStatus = SurfGDI->SetPointerShape(SurfObj, soMask, soColor, XlateObj,
NewCursor->IconInfo.xHotspot,
NewCursor->IconInfo.yHotspot,
@ -228,7 +228,7 @@ IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor,
CurInfo->y,
&PointerRect,
SPS_CHANGE);
ExReleaseFastMutex(SurfGDI->DriverLock);
IntUnLockGDIDriver(SurfGDI);
if(SurfGDI->PointerStatus == SPS_DECLINE)
{
@ -287,7 +287,7 @@ IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE hModule,
ULONG i;
HandleTable = (PUSER_HANDLE_TABLE)WinStaObject->SystemCursor.CurIconHandleTable;
ExAcquireFastMutex(&HandleTable->ListLock);
ObmpLockHandleTable(HandleTable);
CurrentEntry = HandleTable->ListHead.Flink;
while(CurrentEntry != &HandleTable->ListHead)
@ -303,14 +303,14 @@ IntFindExistingCurIconObject(PWINSTATION_OBJECT WinStaObject, HMODULE hModule,
continue;
}
ObmReferenceObject(Object);
ExReleaseFastMutex(&HandleTable->ListLock);
ObmpUnlockHandleTable(HandleTable);
return Object;
}
}
CurrentEntry = CurrentEntry->Flink;
}
ExReleaseFastMutex(&HandleTable->ListLock);
ObmpUnlockHandleTable(HandleTable);
return NULL;
}
@ -334,9 +334,9 @@ IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject)
Win32Process = PsGetWin32Process();
ExAcquireFastMutex(&Win32Process->CursorIconListLock);
IntLockProcessCursorIcons(Win32Process);
InsertTailList(&Win32Process->CursorIconListHead, &Object->ListEntry);
ExReleaseFastMutex(&Win32Process->CursorIconListLock);
IntUnLockProcessCursorIcons(Win32Process);
Object->Self = Handle;
Object->Process = PsGetWin32Process();
@ -373,9 +373,9 @@ IntDestroyCurIconObject(PWINSTATION_OBJECT WinStaObject, HANDLE Handle, BOOL Rem
if(Object->Process && RemoveFromProcess)
{
ExAcquireFastMutex(&Object->Process->CursorIconListLock);
IntLockProcessCursorIcons(Object->Process);
RemoveEntryList(&Object->ListEntry);
ExReleaseFastMutex(&Object->Process->CursorIconListLock);
IntUnLockProcessCursorIcons(Object->Process);
}
ObmDereferenceObject(Object);
@ -401,7 +401,7 @@ IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
if(!(WinStaObject = Win32Process->WindowStation))
return;
ExAcquireFastMutex(&Win32Process->CursorIconListLock);
IntLockProcessCursorIcons(Win32Process);
CurrentEntry = Win32Process->CursorIconListHead.Flink;
while(CurrentEntry != &Win32Process->CursorIconListHead)
{
@ -411,7 +411,7 @@ IntCleanupCurIcons(struct _EPROCESS *Process, PW32PROCESS Win32Process)
IntDestroyCurIconObject(WinStaObject, Current->Self, FALSE);
CurrentEntry = NextEntry;
}
ExReleaseFastMutex(&Win32Process->CursorIconListLock);
IntUnLockProcessCursorIcons(Win32Process);
}
/*

View file

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