{
LIST_ENTRY ListEntry;
HANDLE Self;
- FAST_MUTEX Lock;
LIST_ENTRY ProcessList;
HMODULE hModule;
HRSRC hRsrc;
BOOL Enabled;
BOOL SwapButtons;
UINT ButtonsDown;
- FAST_MUTEX CursorMutex;
CURSORCLIP_INFO CursorClipInfo;
PCURICON_OBJECT CurrentCursorObject;
BYTE ShowingCursor;
#define IntReleaseCurIconObject(CurIconObj) \
ObmDereferenceObject(CurIconObj)
-#define IntLockProcessCursorIcons(W32Process) \
- ExAcquireFastMutex(&W32Process->CursorIconListLock)
-
-#define IntUnLockProcessCursorIcons(W32Process) \
- ExReleaseFastMutex(&W32Process->CursorIconListLock)
-
#endif /* _WIN32K_CURSORICON_H */
/* EOF */
typedef struct tagHOOKTABLE
{
- FAST_MUTEX Lock;
LIST_ENTRY Hooks[NB_HOOKS]; /* array of hook chains */
UINT Counts[NB_HOOKS]; /* use counts for each hook chain */
} HOOKTABLE, *PHOOKTABLE;
LRESULT FASTCALL co_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 */
LIST_ENTRY TimerListHead;
/* Lock for the hardware message list. */
KMUTEX HardwareLock;
- /* Lock for the queue. */
- FAST_MUTEX Lock;
/* Pointer to the current WM_MOUSEMOVE message */
PUSER_MESSAGE MouseMoveMsg;
/* True if a WM_QUIT message is pending. */
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
VOID STDCALL MsqRemoveWindowMessagesFromQueue(PVOID pWindow); /* F*(&$ headers, will be gone in the rewrite! */
-#define IntLockMessageQueue(MsgQueue) \
- ExAcquireFastMutex(&(MsgQueue)->Lock)
-
-#define IntUnLockMessageQueue(MsgQueue) \
- ExReleaseFastMutex(&(MsgQueue)->Lock)
-
#define IntLockHardwareMessageQueue(MsgQueue) \
KeWaitForMutexObject(&(MsgQueue)->HardwareLock, UserRequest, KernelMode, FALSE, NULL)
typedef struct _USER_HANDLE_TABLE
{
LIST_ENTRY ListHead;
- FAST_MUTEX ListLock;
} USER_HANDLE_TABLE, *PUSER_HANDLE_TABLE;
-#define ObmpLockHandleTable(HandleTable) \
- ExAcquireFastMutex(&HandleTable->ListLock)
-
-#define ObmpUnlockHandleTable(HandleTable) \
- ExReleaseFastMutex(&HandleTable->ListLock)
-
ULONG FASTCALL
ObmGetReferenceCount(
PVOID ObjectBody);
PVOID ObjectBody;
ULONG i;
- ObmpLockHandleTable(HandleTable);
-
CurrentEntry = HandleTable->ListHead.Flink;
while (CurrentEntry != &HandleTable->ListHead)
ObjectHeader->HandleCount--;
Current->Handles[i].ObjectBody = NULL;
- ObmpUnlockHandleTable(HandleTable);
-
ObmDereferenceObject(ObjectBody);
- ObmpLockHandleTable(HandleTable);
CurrentEntry = &HandleTable->ListHead;
break;
}
CurrentEntry = CurrentEntry->Flink;
}
- ObmpUnlockHandleTable(HandleTable);
}
VOID FASTCALL
PUSER_HANDLE Entry;
PVOID ObjectBody;
- ObmpLockHandleTable(HandleTable);
-
Entry = ObmpGetObjectByHandle(HandleTable, Handle);
if (Entry == NULL)
{
DPRINT1("Invalid handle\n");
- ObmpUnlockHandleTable(HandleTable);
return NULL;
}
Entry->ObjectBody = NULL;
}
- ObmpUnlockHandleTable(HandleTable);
-
return ObjectBody;
}
USER_BODY_TO_HEADER(ObjectBody)->HandleCount++;
}
- ObmpLockHandleTable(HandleTable);
-
Handle = 1;
Current = HandleTable->ListHead.Flink;
/*
if (!Block->Handles[i].ObjectBody)
{
Block->Handles[i].ObjectBody = ObjectBody;
- ObmpUnlockHandleTable(HandleTable);
*HandleReturn = (HANDLE)((Handle + i) << 2);
return STATUS_SUCCESS;
}
RtlZeroMemory(NewBlock, sizeof(USER_HANDLE_BLOCK));
NewBlock->Handles[0].ObjectBody = ObjectBody;
InsertTailList(&HandleTable->ListHead, &NewBlock->ListEntry);
- ObmpUnlockHandleTable(HandleTable);
*HandleReturn = (HANDLE)(Handle << 2);
return STATUS_SUCCESS;
PUSER_HANDLE UserHandle;
PVOID ObjectBody;
- ObmpLockHandleTable(HandleTable);
-
UserHandle = ObmpGetObjectByHandle(HandleTable, Handle);
if ((UserHandle == NULL) || (UserHandle->ObjectBody == NULL))
{
- ObmpUnlockHandleTable(HandleTable);
return STATUS_UNSUCCESSFUL;
}
ObjectBody = UserHandle->ObjectBody;
ObmReferenceObjectByPointer(ObjectBody, ObjectType);
- ObmpUnlockHandleTable(HandleTable);
-
ObjectHeader = USER_BODY_TO_HEADER(ObjectBody);
if ((ObjectType != otUnknown) && (ObjectHeader->Type != ObjectType))
ObmInitializeHandleTable(PUSER_HANDLE_TABLE HandleTable)
{
InitializeListHead(&HandleTable->ListHead);
- ExInitializeFastMutex(&HandleTable->ListLock);
}
VOID FASTCALL
static PAGED_LOOKASIDE_LIST ProcessLookasideList;
static LIST_ENTRY CurIconList;
-static FAST_MUTEX CurIconListLock;
/* Look up the location of the cursor in the GDIDEVICE structure
* when all we know is the window station object
0,
128);
InitializeListHead(&CurIconList);
- ExInitializeFastMutex(&CurIconListLock);
return TRUE;
}
Win32Process = PsGetWin32Process();
- ExAcquireFastMutex(&Object->Lock);
Search = Object->ProcessList.Flink;
while (Search != &Object->ProcessList)
{
if (Current->Process == Win32Process)
{
/* Already registered for this process */
- ExReleaseFastMutex(&Object->Lock);
return TRUE;
}
Search = Search->Flink;
InsertHeadList(&Object->ProcessList, &Current->ListEntry);
Current->Process = Win32Process;
- ExReleaseFastMutex(&Object->Lock);
return TRUE;
}
PLIST_ENTRY CurrentEntry;
PCURICON_OBJECT Object;
- ExAcquireFastMutex(&CurIconListLock);
-
CurrentEntry = CurIconList.Flink;
while (CurrentEntry != &CurIconList)
{
}
if (! ReferenceCurIconByProcess(Object))
{
- ExReleaseFastMutex(&CurIconListLock);
return NULL;
}
- ExReleaseFastMutex(&CurIconListLock);
+
return Object;
}
}
ObmDereferenceObject(Object);
}
- ExReleaseFastMutex(&CurIconListLock);
-
return NULL;
}
}
Object->Self = Handle;
- ExInitializeFastMutex(&Object->Lock);
InitializeListHead(&Object->ProcessList);
if (! ReferenceCurIconByProcess(Object))
return NULL;
}
- ExAcquireFastMutex(&CurIconListLock);
InsertHeadList(&CurIconList, &Object->ListEntry);
- ExReleaseFastMutex(&CurIconListLock);
ObmDereferenceObject(Object);
PCURICON_PROCESS Current = NULL;
PW32PROCESS W32Process = PsGetWin32Process();
- ExAcquireFastMutex(&Object->Lock);
-
/* Private objects can only be destroyed by their own process */
if (NULL == Object->hModule)
{
Current = CONTAINING_RECORD(Object->ProcessList.Flink, CURICON_PROCESS, ListEntry);
if (Current->Process != W32Process)
{
- ExReleaseFastMutex(&Object->Lock);
DPRINT1("Trying to destroy private icon/cursor of another process\n");
return FALSE;
}
}
else if (! ProcessCleanup)
{
- ExReleaseFastMutex(&Object->Lock);
DPRINT("Trying to destroy shared icon/cursor\n");
return FALSE;
}
/* If there are still processes referencing this object we can't destroy it yet */
if (! IsListEmpty(&Object->ProcessList))
{
- ExReleaseFastMutex(&Object->Lock);
return TRUE;
}
- ExReleaseFastMutex(&Object->Lock);
if (! ProcessCleanup)
{
- ExAcquireFastMutex(&CurIconListLock);
RemoveEntryList(&Object->ListEntry);
- ExReleaseFastMutex(&CurIconListLock);
}
CurInfo = IntGetSysCursorInfo(WinStaObject);
return;
}
- ExAcquireFastMutex(&CurIconListLock);
-
CurrentEntry = CurIconList.Flink;
while (CurrentEntry != &CurIconList)
{
CurrentEntry = CurrentEntry->Flink;
if(NT_SUCCESS(ObmReferenceObjectByPointer(Object, otCursorIcon)))
{
- ExAcquireFastMutex(&Object->Lock);
ProcessEntry = Object->ProcessList.Flink;
while (ProcessEntry != &Object->ProcessList)
{
ProcessData = CONTAINING_RECORD(ProcessEntry, CURICON_PROCESS, ListEntry);
if (Win32Process == ProcessData->Process)
{
- ExReleaseFastMutex(&Object->Lock);
RemoveEntryList(&Object->ListEntry);
IntDestroyCurIconObject(WinStaObject, Object, TRUE);
break;
}
ProcessEntry = ProcessEntry->Flink;
}
- if (ProcessEntry == &Object->ProcessList)
- {
- ExReleaseFastMutex(&Object->Lock);
- }
+
ObmDereferenceObject(Object);
}
}
- ExReleaseFastMutex(&CurIconListLock);
ObDereferenceObject(WinStaObject);
}
co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus);
IntSetFocusMessageQueue(Window->MessageQueue);
- IntLockMessageQueue(Window->MessageQueue);
if (Window->MessageQueue)
{
Window->MessageQueue->ActiveWindow = hWnd;
}
- IntUnLockMessageQueue(Window->MessageQueue);
- IntLockMessageQueue(FocusWindow->MessageQueue);
+
if (FocusWindow->MessageQueue)
{
FocusWindow->MessageQueue->FocusWindow = hWndFocus;
}
- IntUnLockMessageQueue(FocusWindow->MessageQueue);
if (PrevForegroundQueue != Window->MessageQueue)
{
/* FIXME: Call hooks. */
- IntLockMessageQueue(ThreadQueue);
ThreadQueue->ActiveWindow = hWnd;
- IntUnLockMessageQueue(ThreadQueue);
co_IntSendDeactivateMessages(hWndPrev, hWnd);
co_IntSendActivateMessages(hWndPrev, hWnd, FALSE);
return hWndPrev;
}
- IntLockMessageQueue(ThreadQueue);
ThreadQueue->FocusWindow = hWnd;
- IntUnLockMessageQueue(ThreadQueue);
co_IntSendKillFocusMessages(hWndPrev, hWnd);
co_IntSendSetFocusMessages(hWndPrev, hWnd);
}
co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
- IntLockMessageQueue(ThreadQueue);
ThreadQueue->CaptureWindow = hWnd;
- IntUnLockMessageQueue(ThreadQueue);
RETURN( hWndPrev);
Table = ExAllocatePoolWithTag(PagedPool, sizeof(HOOKTABLE), TAG_HOOK);
if (NULL != Table)
{
- ExInitializeFastMutex(&Table->Lock);
for (i = 0; i < NB_HOOKS; i++)
{
InitializeListHead(&Table->Hooks[i]);
Hook->HookId = HookId;
RtlInitUnicodeString(&Hook->ModuleName, NULL);
- IntLockHookTable(Table);
InsertHeadList(&Table->Hooks[HOOKID_TO_INDEX(HookId)], &Hook->Chain);
- IntUnLockHookTable(Table);
return Hook;
}
PHOOK Hook;
PLIST_ENTRY Elem;
- IntLockHookTable(Table);
Hook = IntGetFirstHook(Table, HookId);
while (NULL != Hook && NULL == Hook->Proc)
{
Hook = (Elem == &Table->Hooks[HOOKID_TO_INDEX(HookId)]
? NULL : CONTAINING_RECORD(Elem, HOOK, Chain));
}
- IntUnLockHookTable(Table);
return Hook;
}
int HookId = Hook->HookId;
PLIST_ENTRY Elem;
- IntLockHookTable(Table);
Elem = Hook->Chain.Flink;
while (Elem != &Table->Hooks[HOOKID_TO_INDEX(HookId)])
{
Hook = CONTAINING_RECORD(Elem, HOOK, Chain);
if (NULL != Hook->Proc)
{
- IntUnLockHookTable(Table);
return Hook;
}
}
- IntUnLockHookTable(Table);
if (NULL != GlobalHooks && Table != GlobalHooks) /* now search through the global table */
{
return;
}
- if (! TableAlreadyLocked)
- {
- IntLockHookTable(Table);
- }
if (0 != Table->Counts[HOOKID_TO_INDEX(Hook->HookId)])
{
Hook->Proc = NULL; /* chain is in use, just mark it and return */
{
IntFreeHook(Table, Hook, WinStaObj);
}
- if (! TableAlreadyLocked)
- {
- IntUnLockHookTable(Table);
- }
}
/* release a hook chain, removing deleted hooks if the use count drops to 0 */
return;
}
- 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)])
{
- IntUnLockHookTable(Table);
return;
}
if (0 == --Table->Counts[HOOKID_TO_INDEX(HookId)])
}
}
}
- IntUnLockHookTable(Table);
}
static LRESULT FASTCALL
return 0;
}
- IntLockHookTable(Table);
Table->Counts[HOOKID_TO_INDEX(HookId)]++;
- IntUnLockHookTable(Table);
if (Table != GlobalHooks && GlobalHooks != NULL)
{
- IntLockHookTable(GlobalHooks);
GlobalHooks->Counts[HOOKID_TO_INDEX(HookId)]++;
- IntUnLockHookTable(GlobalHooks);
}
Result = co_IntCallHookProc(HookId, Code, wParam, lParam, Hook->Proc,
DPRINT1("Invalid window station????\n");
return;
}
- IntLockHookTable(GlobalHooks);
+
for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++)
{
/* only low-level keyboard/mouse global hooks can be owned by a thread */
break;
}
}
- IntUnLockHookTable(GlobalHooks);
+
ObDereferenceObject(WinStaObj);
}
}
SwapButtons = CurInfo->SwapButtons;
DoMove = FALSE;
- ExAcquireFastMutex(&CurInfo->CursorMutex);
IntGetCursorLocation(WinSta, &MousePos);
OrgPos.x = MousePos.x;
OrgPos.y = MousePos.y;
DoMove = (MousePos.x != OrgPos.x || MousePos.y != OrgPos.y);
}
- ExReleaseFastMutex(&CurInfo->CursorMutex);
-
if (DoMove)
{
dc = DC_LockDc(hDC);
Queue = PsGetWin32Thread()->MessageQueue;
- IntLockMessageQueue(Queue);
-
Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
if (ClearChanges)
{
Queue->ChangedBits = 0;
}
- IntUnLockMessageQueue(Queue);
-
RETURN( Result);
CLEANUP:
return 0;
MessageQueue = Win32Thread->MessageQueue;
- IntLockMessageQueue(MessageQueue);
MessageQueue->WakeMask = WakeMask;
MessageEventHandle = MessageQueue->NewMessagesHandle;
- IntUnLockMessageQueue(MessageQueue);
return MessageEventHandle;
}
return FALSE;
MessageQueue = Win32Thread->MessageQueue;
- IntLockMessageQueue(MessageQueue);
MessageQueue->WakeMask = ~0;
- IntUnLockMessageQueue(MessageQueue);
return TRUE;
}
VOID FASTCALL
MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
{
- IntLockMessageQueue(Queue);
Queue->PaintCount++;
Queue->PaintPosted = TRUE;
Queue->QueueBits |= QS_PAINT;
Queue->ChangedBits |= QS_PAINT;
if (Queue->WakeMask & QS_PAINT)
KeSetEvent(Queue->NewMessages, IO_NO_INCREMENT, FALSE);
- IntUnLockMessageQueue(Queue);
}
VOID FASTCALL
MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
{
- IntLockMessageQueue(Queue);
Queue->PaintCount--;
if (Queue->PaintCount == 0)
{
Queue->PaintPosted = FALSE;
}
- IntUnLockMessageQueue(Queue);
}
ObmDereferenceObject(Window);
ObDereferenceObject (Thread);
-// IntLockMessageQueue(pThread->MessageQueue);
// InsertHeadList(&pThread->MessageQueue->PostedMessagesListHead,
// &Message->ListEntry);
// KeSetEvent(pThread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
-// IntUnLockMessageQueue(pThread->MessageQueue);
-
}
PUSER_MESSAGE FASTCALL
PLIST_ENTRY ListEntry;
PUSER_SENT_MESSAGE_NOTIFY Message;
- IntLockMessageQueue(MessageQueue);
while (!IsListEmpty(&MessageQueue->SentMessagesListHead))
{
ListEntry = RemoveHeadList(&MessageQueue->SentMessagesListHead);
Message = CONTAINING_RECORD(ListEntry, USER_SENT_MESSAGE_NOTIFY,
ListEntry);
- IntUnLockMessageQueue(MessageQueue);
co_IntCallSentMessageCallback(Message->CompletionCallback,
Message->hWnd,
Message->CompletionCallbackContext,
Message->Result);
- IntLockMessageQueue(MessageQueue);
}
- IntUnLockMessageQueue(MessageQueue);
+
}
BOOLEAN FASTCALL
BOOL SenderReturned;
PUSER_SENT_MESSAGE_NOTIFY NotifyMessage;
- IntLockMessageQueue(MessageQueue);
if (IsListEmpty(&MessageQueue->SentMessagesListHead))
{
- IntUnLockMessageQueue(MessageQueue);
return(FALSE);
}
InsertTailList(&MessageQueue->LocalDispatchingMessagesHead,
&Message->ListEntry);
- IntUnLockMessageQueue(MessageQueue);
-
if (Message->HookMessage)
{
Result = co_HOOK_CallHooks(Message->Msg.message,
/* remove the message from the local dispatching list, because it doesn't need
to be cleaned up on thread termination anymore */
- IntLockMessageQueue(MessageQueue);
RemoveEntryList(&Message->ListEntry);
- IntUnLockMessageQueue(MessageQueue);
/* remove the message from the dispatching list, so lock the sender's message queue */
- IntLockMessageQueue(Message->SenderQueue);
-
SenderReturned = (Message->DispatchingListEntry.Flink == NULL);
if(!SenderReturned)
{
KeSetEvent(Message->CompletionEvent, IO_NO_INCREMENT, FALSE);
}
- /* unlock the sender's message queue, the safe operation is done */
- IntUnLockMessageQueue(Message->SenderQueue);
-
/* Notify the sender if they specified a callback. */
if (!SenderReturned && Message->CompletionCallback != NULL)
{
MessageQueue = Window->MessageQueue;
ASSERT(MessageQueue);
- IntLockMessageQueue(MessageQueue);
-
/* remove the posted messages for this window */
CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
ListHead = &MessageQueue->PostedMessagesListHead;
ListEntry);
if(SentMessage->Msg.hwnd == Window->Self)
{
- IntLockMessageQueue(SentMessage->SenderQueue);
DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n");
/* remove the message from the dispatching list */
{
KeSetEvent(SentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
}
- IntUnLockMessageQueue(SentMessage->SenderQueue);
/* dereference our and the sender's message queue */
IntDereferenceMessageQueue(MessageQueue);
CurrentEntry = CurrentEntry->Flink;
}
}
- IntUnLockMessageQueue(MessageQueue);
}
VOID FASTCALL
MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
PUSER_SENT_MESSAGE_NOTIFY NotifyMessage)
{
- IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->NotifyMessagesListHead,
&NotifyMessage->ListEntry);
MessageQueue->QueueBits |= QS_SENDMESSAGE;
MessageQueue->ChangedBits |= QS_SENDMESSAGE;
if (MessageQueue->WakeMask & QS_SENDMESSAGE)
KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
- IntUnLockMessageQueue(MessageQueue);
}
NTSTATUS FASTCALL
IntReferenceMessageQueue(MessageQueue);
/* add it to the list of pending messages */
- IntLockMessageQueue(ThreadQueue);
InsertTailList(&ThreadQueue->DispatchingMessagesHead, &Message->DispatchingListEntry);
- IntUnLockMessageQueue(ThreadQueue);
/* queue it in the destination's message queue */
- IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->SentMessagesListHead, &Message->ListEntry);
- IntUnLockMessageQueue(MessageQueue);
MessageQueue->QueueBits |= QS_SENDMESSAGE;
MessageQueue->ChangedBits |= QS_SENDMESSAGE;
{
/* look up if the message has not yet dispatched, if so
make sure it can't pass a result and it must not set the completion event anymore */
- IntLockMessageQueue(MessageQueue);
Entry = MessageQueue->SentMessagesListHead.Flink;
while (Entry != &MessageQueue->SentMessagesListHead)
{
}
Entry = Entry->Flink;
}
- IntUnLockMessageQueue(MessageQueue);
/* remove from the local dispatching list so the other thread knows,
it can't pass a result and it must not set the completion event anymore */
- IntLockMessageQueue(ThreadQueue);
Entry = ThreadQueue->DispatchingMessagesHead.Flink;
while (Entry != &ThreadQueue->DispatchingMessagesHead)
{
}
Entry = Entry->Flink;
}
- IntUnLockMessageQueue(ThreadQueue);
DPRINT("MsqSendMessage (blocked) timed out\n");
}
{
/* look up if the message has not yet been dispatched, if so
make sure it can't pass a result and it must not set the completion event anymore */
- IntLockMessageQueue(MessageQueue);
Entry = MessageQueue->SentMessagesListHead.Flink;
while (Entry != &MessageQueue->SentMessagesListHead)
{
}
Entry = Entry->Flink;
}
- IntUnLockMessageQueue(MessageQueue);
/* remove from the local dispatching list so the other thread knows,
it can't pass a result and it must not set the completion event anymore */
- IntLockMessageQueue(ThreadQueue);
Entry = ThreadQueue->DispatchingMessagesHead.Flink;
while (Entry != &ThreadQueue->DispatchingMessagesHead)
{
}
Entry = Entry->Flink;
}
- IntUnLockMessageQueue(ThreadQueue);
DPRINT("MsqSendMessage timed out\n");
break;
{
return;
}
- IntLockMessageQueue(MessageQueue);
InsertTailList(&MessageQueue->PostedMessagesListHead,
&Message->ListEntry);
MessageQueue->QueueBits |= MessageBits;
MessageQueue->ChangedBits |= MessageBits;
if (MessageQueue->WakeMask & MessageBits)
KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
- IntUnLockMessageQueue(MessageQueue);
}
VOID FASTCALL
MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode)
{
- IntLockMessageQueue(MessageQueue);
MessageQueue->QuitPosted = TRUE;
MessageQueue->QuitExitCode = ExitCode;
MessageQueue->QueueBits |= QS_POSTMESSAGE;
MessageQueue->ChangedBits |= QS_POSTMESSAGE;
if (MessageQueue->WakeMask & QS_POSTMESSAGE)
KeSetEvent(MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
- IntUnLockMessageQueue(MessageQueue);
}
BOOLEAN STDCALL
Remove, Message));
}
- IntLockMessageQueue(MessageQueue);
CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
ListHead = &MessageQueue->PostedMessagesListHead;
while (CurrentEntry != ListHead)
{
RemoveEntryList(&CurrentMessage->ListEntry);
}
- IntUnLockMessageQueue(MessageQueue);
+
*Message = CurrentMessage;
return(TRUE);
}
CurrentEntry = CurrentEntry->Flink;
}
- IntUnLockMessageQueue(MessageQueue);
+
return(FALSE);
}
InitializeListHead(&MessageQueue->DispatchingMessagesHead);
InitializeListHead(&MessageQueue->LocalDispatchingMessagesHead);
KeInitializeMutex(&MessageQueue->HardwareLock, 0);
- ExInitializeFastMutex(&MessageQueue->Lock);
MessageQueue->QuitPosted = FALSE;
MessageQueue->QuitExitCode = 0;
KeQueryTickCount(&LargeTickCount);
PTIMER_ENTRY CurrentTimer;
PUSER_SENT_MESSAGE CurrentSentMessage;
- IntLockMessageQueue(MessageQueue);
-
/* cleanup posted messages */
while (!IsListEmpty(&MessageQueue->PostedMessagesListHead))
{
CurrentSentMessage = CONTAINING_RECORD(CurrentEntry, USER_SENT_MESSAGE,
ListEntry);
- IntLockMessageQueue(CurrentSentMessage->SenderQueue);
DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n");
/* remove the message from the dispatching list */
{
KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
}
- IntUnLockMessageQueue(CurrentSentMessage->SenderQueue);
/* dereference our and the sender's message queue */
IntDereferenceMessageQueue(MessageQueue);
CurrentSentMessage = CONTAINING_RECORD(CurrentEntry, USER_SENT_MESSAGE,
ListEntry);
- IntLockMessageQueue(CurrentSentMessage->SenderQueue);
/* remove the message from the dispatching list */
if(CurrentSentMessage->DispatchingListEntry.Flink != NULL)
{
{
KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE);
}
- IntUnLockMessageQueue(CurrentSentMessage->SenderQueue);
/* dereference our and the sender's message queue */
IntDereferenceMessageQueue(MessageQueue);
locked later */
}
- IntUnLockMessageQueue(MessageQueue);
}
PUSER_MESSAGE_QUEUE FASTCALL
DPRINT("MsqSetTimer queue %p wnd %x id %p period %u timerproc %p msg %d\n",
MessageQueue, Wnd, IDEvent, Period, TimerFunc, Msg);
- IntLockMessageQueue(MessageQueue);
Timer = RemoveTimer(MessageQueue, Wnd, IDEvent, Msg);
if (NULL == Timer)
{
Timer = ExAllocateFromPagedLookasideList(&TimerLookasideList);
if (NULL == Timer)
{
- IntUnLockMessageQueue(MessageQueue);
DPRINT1("Failed to allocate timer entry\n");
return FALSE;
}
DumpTimerList(MessageQueue);
#endif /* ! defined(NDEBUG) */
- IntUnLockMessageQueue(MessageQueue);
-
return TRUE;
}
DPRINT("MsqKillTimer queue %p wnd %x id %p msg %d\n",
MessageQueue, Wnd, IDEvent, Msg);
- IntLockMessageQueue(MessageQueue);
Timer = RemoveTimer(MessageQueue, Wnd, IDEvent, Msg);
if (NULL == Timer)
DumpTimerList(MessageQueue);
#endif /* ! defined(NDEBUG) */
- IntUnLockMessageQueue(MessageQueue);
-
return NULL != Timer;
}
DPRINT("MsqGetTimerMessage queue %p msg %p restart %s\n",
MessageQueue, Msg, Restart ? "TRUE" : "FALSE");
- IntLockMessageQueue(MessageQueue);
KeQuerySystemTime(&CurrentTime);
DPRINT("Current time %I64d\n", CurrentTime.QuadPart);
EnumEntry = MessageQueue->TimerListHead.Flink;
if (! GotMessage)
{
DPRINT("No timer pending\n");
- IntUnLockMessageQueue(MessageQueue);
return FALSE;
}
#endif /* ! defined(NDEBUG) */
}
- IntUnLockMessageQueue(MessageQueue);
-
DPRINT("Created message wnd %x msg %d wParam %u lParam %u\n", Msg->hwnd, Msg->message,
Msg->wParam, Msg->lParam);
DPRINT("MsqRemoveTimersWindow queue %p wnd %x\n", MessageQueue, Wnd);
- IntLockMessageQueue(MessageQueue);
EnumEntry = MessageQueue->TimerListHead.Flink;
while (EnumEntry != &MessageQueue->TimerListHead)
{
DumpTimerList(MessageQueue);
#endif /* ! defined(NDEBUG) */
- IntUnLockMessageQueue(MessageQueue);
}
BOOLEAN FASTCALL
DPRINT("MsqGetFirstTimerExpiry queue %p wndfilter %x msgfiltermin %d msgfiltermax %d expiry %p\n",
MessageQueue, WndFilter, MsgFilterMin, MsgFilterMax, FirstTimerExpiry);
- IntLockMessageQueue(MessageQueue);
EnumEntry = MessageQueue->TimerListHead.Flink;
while (EnumEntry != &MessageQueue->TimerListHead)
{
{
*FirstTimerExpiry = Timer->ExpiryTime;
DPRINT("First timer expires %I64d\n", Timer->ExpiryTime);
- IntUnLockMessageQueue(MessageQueue);
return TRUE;
}
}
- IntUnLockMessageQueue(MessageQueue);
-
return FALSE;
}
if (NULL == hWnd)
{
DPRINT1("PAINTING BUG: Thread marked as containing dirty windows, but no dirty windows found!\n");
- IntLockMessageQueue(MessageQueue);
MessageQueue->PaintPosted = 0;
MessageQueue->PaintCount = 0;
- IntUnLockMessageQueue(MessageQueue);
}
return FALSE;
}
co_WinPosActivateOtherWindow(Window);
}
}
- 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;
- IntUnLockMessageQueue(Window->MessageQueue);
+
IntDereferenceMessageQueue(Window->MessageQueue);
/* Call hooks */
#if 0 /* FIXME */
InitHotKeys(WindowStationObject);
- ExInitializeFastMutex(&CurInfo->CursorMutex);
CurInfo->Enabled = FALSE;
CurInfo->ButtonsDown = 0;
CurInfo->CursorClipInfo.IsClipped = FALSE;