/* FUNCTIONS *****************************************************************/
-//
-// Wakeup any thread/process waiting on idle input.
-//
-static VOID FASTCALL
-IdlePing(VOID)
-{
- HWND hWnd;
- PWND Window;
- PPROCESSINFO W32d = PsGetCurrentProcessWin32Process();
-
- hWnd = UserGetForegroundWindow();
-
- Window = UserGetWindowObject(hWnd);
-
- if (Window && Window->head.pti)
- {
- if (Window->head.pti->fsHooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE))
- {
- co_HOOK_CallHooks(WH_FOREGROUNDIDLE,HC_ACTION,0,0);
- }
- }
-
- if (W32d && W32d->InputIdleEvent)
- KePulseEvent( W32d->InputIdleEvent, EVENT_INCREMENT, TRUE);
-}
-
HANDLE FASTCALL
IntMsqSetWakeMask(DWORD WakeMask)
{
}
-NTSTATUS FASTCALL
+INIT_FUNCTION
+NTSTATUS
+NTAPI
MsqInitializeImpl(VOID)
{
/*CurrentFocusMessageQueue = NULL;*/
}
VOID FASTCALL
-MsqInsertSystemMessage(MSG* Msg)
+MsqInsertMouseMessage(MSG* Msg)
{
LARGE_INTEGER LargeTickCount;
KIRQL OldIrql;
BOOL APIENTRY
co_MsqPeekHardwareMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWND Window,
UINT FilterLow, UINT FilterHigh, BOOL Remove,
- PUSER_MESSAGE* Message)
+ PMSG Message)
{
KIRQL OldIrql;
POINT ScreenPoint;
WaitObjects[0] = &HardwareMessageQueueLock;
do
{
- IdlePing();
-
UserLeaveCo();
WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest,
DesktopWindow, &ScreenPoint, FALSE, &CurrentEntry);
if (Accept)
{
+ *Message = Current->Msg;
if (Remove)
{
RemoveEntryList(&Current->ListEntry);
+ MsqDestroyMessage(Current);
}
IntUnLockHardwareMessageQueue(MessageQueue);
IntUnLockSystemHardwareMessageQueueLock(FALSE);
- *Message = Current;
-
+
if (Desk)
Desk->LastInputWasKbd = FALSE;
}
else
{
+ *Message = Current->Msg;
if (Remove)
{
RemoveEntryList(&Current->ListEntry);
+ MsqDestroyMessage(Current);
}
IntUnLockHardwareMessageQueue(MessageQueue);
IntUnLockSystemHardwareMessageQueueLock(FALSE);
- *Message = Current;
RETURN(TRUE);
}
IntUnLockHardwareMessageQueue(MessageQueue);
}
IntUnLockSystemHardwareMessageQueueLock(FALSE);
- *Message = Current;
+ *Message = Current->Msg;
+
+ if (Remove)
+ {
+ MsqDestroyMessage(Current);
+ }
RETURN(TRUE);
}
KbdHookData.dwExtraInfo = 0;
if (co_HOOK_CallHooks(WH_KEYBOARD_LL, HC_ACTION, Msg.message, (LPARAM) &KbdHookData))
{
- DPRINT("Kbd msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL hook\n",
+ DPRINT1("Kbd msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL hook\n",
Msg.message, Msg.wParam, Msg.lParam);
if (Entered) UserLeave();
return;
&Message->ListEntry);
if (Message->HookMessage == MSQ_ISHOOK)
- {
- Result = co_HOOK_CallHooks(Message->Msg.message,
- (INT)(INT_PTR)Message->Msg.hwnd,
- Message->Msg.wParam,
- Message->Msg.lParam);
+ { // Direct Hook Call processor
+ Result = co_CallHook( Message->Msg.message, // HookId
+ (INT)(INT_PTR)Message->Msg.hwnd, // Code
+ Message->Msg.wParam,
+ Message->Msg.lParam);
}
else if (Message->HookMessage == MSQ_ISEVENT)
- {
+ { // Direct Event Call processor
Result = co_EVENT_CallEvents( Message->Msg.message,
Message->Msg.hwnd,
Message->Msg.wParam,
Message->Msg.lParam);
}
else
- {
- /* Call the window procedure. */
- Result = co_IntSendMessage(Message->Msg.hwnd,
- Message->Msg.message,
- Message->Msg.wParam,
- Message->Msg.lParam);
+ { /* Call the window procedure. */
+ Result = co_IntSendMessage( Message->Msg.hwnd,
+ Message->Msg.message,
+ Message->Msg.wParam,
+ Message->Msg.lParam);
}
/* remove the message from the local dispatching list, because it doesn't need
PUSER_SENT_MESSAGE Message;
KEVENT CompletionEvent;
NTSTATUS WaitStatus;
- LRESULT Result;
PUSER_MESSAGE_QUEUE ThreadQueue;
LARGE_INTEGER Timeout;
PLIST_ENTRY Entry;
+ LRESULT Result = 0; //// Result could be trashed. ////
if(!(Message = ExAllocatePoolWithTag(PagedPool, sizeof(USER_SENT_MESSAGE), TAG_USRMSG)))
{
/* FIXME - increase reference counter of sender's message queue here */
- Result = 0;
Message->Msg.hwnd = Wnd;
Message->Msg.message = Msg;
Message->Msg.wParam = wParam;
Message->SenderQueue = ThreadQueue;
IntReferenceMessageQueue(ThreadQueue);
Message->CompletionCallback = NULL;
+ Message->CompletionCallbackContext = 0;
Message->HookMessage = HookMessage;
Message->HasPackedLParam = FALSE;
if(Block)
{
- IdlePing();
-
UserLeaveCo();
/* don't process messages sent to the thread */
WaitObjects[1] = ThreadQueue->NewMessages;
do
{
- IdlePing();
-
UserLeaveCo();
WaitStatus = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, UserRequest,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
- OUT PUSER_MESSAGE* Message)
+ OUT PMSG Message)
{
PLIST_ENTRY CurrentEntry;
PUSER_MESSAGE CurrentMessage;
RemoveEntryList(&CurrentMessage->ListEntry);
}
- *Message = CurrentMessage;
+ *Message= CurrentMessage->Msg;
+
+ if (Remove)
+ {
+ MsqDestroyMessage(CurrentMessage);
+ }
+
return(TRUE);
}
CurrentEntry = CurrentEntry->Flink;
PVOID WaitObjects[2] = {MessageQueue->NewMessages, &HardwareMessageEvent};
NTSTATUS ret;
- IdlePing(); // Going to wait so send Idle ping.
-
UserLeaveCo();
ret = KeWaitForMultipleObjects(2,
IntDereferenceMessageQueue(MessageQueue);
}
-PHOOKTABLE FASTCALL
-MsqGetHooks(PUSER_MESSAGE_QUEUE Queue)
-{
- return Queue->Hooks;
-}
-
-VOID FASTCALL
-MsqSetHooks(PUSER_MESSAGE_QUEUE Queue, PHOOKTABLE Hooks)
-{
- Queue->Hooks = Hooks;
-}
-
LPARAM FASTCALL
MsqSetMessageExtraInfo(LPARAM lParam)
{