ForegroundQueue = IntGetFocusMessageQueue();
if (ForegroundQueue)
- ptiForeground = ForegroundQueue->Thread->Tcb.Win32Thread;
+ ptiForeground = ForegroundQueue->ptiOwner;
pti = PsGetCurrentThreadWin32Thread();
}
}
- TRACE("IdlePing ppi 0x%x\n",ppi);
+ TRACE("IdlePing ppi %p\n", ppi);
if ( ppi && ppi->InputIdleEvent )
{
TRACE("InputIdleEvent\n");
{
PPROCESSINFO ppi = PsGetCurrentProcessWin32Process();
- TRACE("IdlePong ppi 0x%x\n",ppi);
+ TRACE("IdlePong ppi %p\n", ppi);
if ( ppi && ppi->InputIdleEvent )
{
KeClearEvent(ppi->InputIdleEvent);
pWnd == UserGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND
return 0;
- TRACE("Internal Event Msg %p hWnd 0x%x\n",msg,pWnd->head.h);
+ TRACE("Internal Event Msg %u hWnd %p\n", msg, pWnd->head.h);
switch(msg)
{
{
PTHREADINFO pti;
LARGE_INTEGER LargeTickCount;
- PUSER_MESSAGE_QUEUE ThreadQueue;
BOOL RemoveMessages;
UINT ProcessMask;
BOOL Hit = FALSE;
pti = PsGetCurrentThreadWin32Thread();
- ThreadQueue = pti->MessageQueue;
RemoveMessages = RemoveMsg & PM_REMOVE;
ProcessMask = HIWORD(RemoveMsg);
-
- if (ThreadQueue->ptiSysLock && ThreadQueue->ptiSysLock != pti)
- {
- ERR("PeekMessage: Thread Q 0x%p is locked 0x%p to another pti 0x%p!\n", ThreadQueue, ThreadQueue->ptiSysLock, pti );
- }
-
+
/* Hint, "If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns
all available messages (that is, no range filtering is performed)". */
if (!ProcessMask) ProcessMask = (QS_ALLPOSTMESSAGE|QS_ALLINPUT);
do
{
KeQueryTickCount(&LargeTickCount);
- ThreadQueue->LastMsgRead = LargeTickCount.u.LowPart;
+ pti->timeLast = LargeTickCount.u.LowPart;
pti->pcti->tickLastMsgChecked = LargeTickCount.u.LowPart;
/* Dispatch sent messages here. */
- while ( co_MsqDispatchOneSentMessage(ThreadQueue) )
+ while ( co_MsqDispatchOneSentMessage(pti) )
{
/* if some PM_QS* flags were specified, only handle sent messages from now on */
if (HIWORD(RemoveMsg) && !bGMSG) Hit = TRUE; // wine does this; ProcessMask = QS_SENDMESSAGE;
/* Now check for normal messages. */
if (( (ProcessMask & QS_POSTMESSAGE) ||
(ProcessMask & QS_HOTKEY) ) &&
- MsqPeekMessage( ThreadQueue,
+ MsqPeekMessage( pti,
RemoveMessages,
Window,
MsgFilterMin,
}
/* Now look for a quit message. */
- if (ThreadQueue->QuitPosted)
+ if (pti->QuitPosted)
{
/* According to the PSDK, WM_QUIT messages are always returned, regardless
of the filter specified */
Msg->hwnd = NULL;
Msg->message = WM_QUIT;
- Msg->wParam = ThreadQueue->QuitExitCode;
+ Msg->wParam = pti->exitCode;
Msg->lParam = 0;
if (RemoveMessages)
{
- ThreadQueue->QuitPosted = FALSE;
- ClearMsgBitsMask(ThreadQueue, QS_POSTMESSAGE);
+ pti->QuitPosted = FALSE;
+ ClearMsgBitsMask(pti, QS_POSTMESSAGE);
pti->pcti->fsWakeBits &= ~QS_ALLPOSTMESSAGE;
pti->pcti->fsChangeBits &= ~QS_ALLPOSTMESSAGE;
}
/* Check for hardware events. */
if ((ProcessMask & QS_MOUSE) &&
- co_MsqPeekMouseMove( ThreadQueue,
+ co_MsqPeekMouseMove( pti,
RemoveMessages,
Window,
MsgFilterMin,
}
if ((ProcessMask & QS_INPUT) &&
- co_MsqPeekHardwareMessage( ThreadQueue,
+ co_MsqPeekHardwareMessage( pti,
RemoveMessages,
Window,
MsgFilterMin,
}
/* Check for sent messages again. */
- while ( co_MsqDispatchOneSentMessage(ThreadQueue) )
+ while ( co_MsqDispatchOneSentMessage(pti) )
{
if (HIWORD(RemoveMsg) && !bGMSG) Hit = TRUE;
}
UINT MsgFilterMax )
{
PTHREADINFO pti;
- PUSER_MESSAGE_QUEUE ThreadQueue;
NTSTATUS Status = STATUS_SUCCESS;
MSG Msg;
pti = PsGetCurrentThreadWin32Thread();
- ThreadQueue = pti->MessageQueue;
do
{
}
/* Nothing found. Wait for new messages. */
- Status = co_MsqWaitForNewMessages( ThreadQueue,
+ Status = co_MsqWaitForNewMessages( pti,
Window,
MsgFilterMin,
MsgFilterMax);
if ( bGMSG )
{
- Status = co_MsqWaitForNewMessages( pti->MessageQueue,
+ Status = co_MsqWaitForNewMessages( pti,
Window,
MsgFilterMin,
MsgFilterMax);
KeQueryTickCount(&LargeTickCount);
Message.time = MsqCalculateMessageTime(&LargeTickCount);
- MsqPostMessage(pThread->MessageQueue, &Message, FALSE, QS_POSTMESSAGE, 0);
+ MsqPostMessage(pThread, &Message, FALSE, QS_POSTMESSAGE, 0);
ObDereferenceObject( peThread );
return TRUE;
}
pti = Window->head.pti;
if ( pti->TIF_flags & TIF_INCLEANUP )
{
- ERR("Attempted to post message to window 0x%x when the thread is in cleanup!\n", Wnd);
+ ERR("Attempted to post message to window %p when the thread is in cleanup!\n", Wnd);
return FALSE;
}
if ( Window->state & WNDS_DESTROYED )
{
- ERR("Attempted to post message to window 0x%x that is being destroyed!\n", Wnd);
+ ERR("Attempted to post message to window %p that is being destroyed!\n", Wnd);
/* FIXME: Last error code? */
return FALSE;
}
if (WM_QUIT == Msg)
{
- MsqPostQuitMessage(Window->head.pti->MessageQueue, wParam);
+ MsqPostQuitMessage(Window->head.pti, wParam);
}
else
{
- MsqPostMessage(Window->head.pti->MessageQueue, &Message, FALSE, QS_POSTMESSAGE, 0);
+ MsqPostMessage(Window->head.pti, &Message, FALSE, QS_POSTMESSAGE, 0);
}
}
return TRUE;
Win32Thread = PsGetCurrentThreadWin32Thread();
if ( Win32Thread &&
- Window->head.pti->MessageQueue == Win32Thread->MessageQueue)
+ Window->head.pti == Win32Thread)
{
if (Win32Thread->TIF_flags & TIF_INCLEANUP)
{
RETURN( TRUE);
}
- if (uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->head.pti->MessageQueue))
+ if (uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->head.pti))
{
// FIXME: Set window hung and add to a list.
/* FIXME: Set a LastError? */
if (Window->state & WNDS_DESTROYED)
{
/* FIXME: Last error? */
- ERR("Attempted to send message to window 0x%x that is being destroyed!\n", hWnd);
+ ERR("Attempted to send message to window %p that is being destroyed!\n", hWnd);
RETURN( FALSE);
}
do
{
- Status = co_MsqSendMessage( Window->head.pti->MessageQueue,
+ Status = co_MsqSendMessage( Window->head.pti,
hWnd,
Msg,
wParam,
}
while ((STATUS_TIMEOUT == Status) &&
(uFlags & SMTO_NOTIMEOUTIFNOTHUNG) &&
- !MsqIsHung(Window->head.pti->MessageQueue)); // FIXME: Set window hung and add to a list.
+ !MsqIsHung(Window->head.pti)); // FIXME: Set window hung and add to a list.
if (STATUS_TIMEOUT == Status)
{
if (Window->state & WNDS_DESTROYED)
{
/* FIXME: last error? */
- ERR("Attempted to send message to window 0x%x that is being destroyed!\n", hWnd);
+ ERR("Attempted to send message to window %p that is being destroyed!\n", hWnd);
RETURN(FALSE);
}
}
if (Msg & 0x80000000 &&
- Window->head.pti->MessageQueue == Win32Thread->MessageQueue)
+ Window->head.pti == Win32Thread)
{
if (Win32Thread->TIF_flags & TIF_INCLEANUP) RETURN( FALSE);
- ERR("SMWCB: Internal Message!\n");
+ TRACE("SMWCB: Internal Message!\n");
Result = (ULONG_PTR)handle_internal_message( Window, Msg, wParam, lParam );
if (uResult) *uResult = Result;
RETURN( TRUE);
lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
}
- if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, Window->head.pti->MessageQueue != Win32Thread->MessageQueue)))
+ if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, Window->head.pti != Win32Thread)))
{
ERR("Failed to pack message parameters\n");
RETURN( FALSE);
}
/* If it can be sent now, then send it. */
- if (Window->head.pti->MessageQueue == Win32Thread->MessageQueue)
+ if (Window->head.pti == Win32Thread)
{
if (Win32Thread->TIF_flags & TIF_INCLEANUP)
{
}
}
- if (Window->head.pti->MessageQueue == Win32Thread->MessageQueue)
+ if (Window->head.pti == Win32Thread)
{
if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
{
RETURN( FALSE);
}
- IntReferenceMessageQueue(Window->head.pti->MessageQueue);
- /* Take reference on this MessageQueue if its a callback. It will be released
- when message is processed or removed from target hwnd MessageQueue */
- if (CompletionCallback)
- IntReferenceMessageQueue(Win32Thread->MessageQueue);
-
Message->Msg.hwnd = hWnd;
Message->Msg.message = Msg;
Message->Msg.wParam = wParam;
Message->Result = 0;
Message->lResult = 0;
Message->QS_Flags = 0;
- Message->SenderQueue = NULL; // mjmartin, you are right! This is null.
- Message->CallBackSenderQueue = Win32Thread->MessageQueue;
+ Message->ptiReceiver = Window->head.pti;
+ Message->ptiSender = NULL; // mjmartin, you are right! This is null.
+ Message->ptiCallBackSender = Win32Thread;
Message->DispatchingListEntry.Flink = NULL;
Message->CompletionCallback = CompletionCallback;
Message->CompletionCallbackContext = CompletionCallbackContext;
Message->HasPackedLParam = (lParamBufferSize > 0);
Message->QS_Flags = QS_SENDMESSAGE;
- InsertTailList(&Window->head.pti->MessageQueue->SentMessagesListHead, &Message->ListEntry);
- MsqWakeQueue(Window->head.pti->MessageQueue, QS_SENDMESSAGE, TRUE);
- IntDereferenceMessageQueue(Window->head.pti->MessageQueue);
+ if (Msg & 0x80000000) // Higher priority event message!
+ InsertHeadList(&Window->head.pti->SentMessagesListHead, &Message->ListEntry);
+ else
+ InsertTailList(&Window->head.pti->SentMessagesListHead, &Message->ListEntry);
+ MsqWakeQueue(Window->head.pti, QS_SENDMESSAGE, TRUE);
RETURN(TRUE);
ULONG wDragWidth, wDragHeight;
DECLARE_RETURN(BOOL);
- TRACE("Enter NtUserDragDetect(%x)\n", hWnd);
+ TRACE("Enter NtUserDragDetect(%p)\n", hWnd);
UserEnterExclusive();
wDragWidth = UserGetSystemMetrics(SM_CXDRAG);
}
else
{
- TRACE("No Window for Translate. hwnd 0x%p Msg %d\n",SafeMsg.hwnd,SafeMsg.message);
+ TRACE("No Window for Translate. hwnd 0x%p Msg %u\n", SafeMsg.hwnd, SafeMsg.message);
Ret = FALSE;
}
UserLeave();
if ( parm.flags & BSF_IGNORECURRENTTASK )
{
- if ( pwnd->head.pti->MessageQueue == gptiCurrent->MessageQueue )
+ if ( pwnd->head.pti == gptiCurrent )
continue;
}
co_IntSendMessageTimeout( List[i],
if ( parm.flags & BSF_IGNORECURRENTTASK )
{
- if ( pwnd->head.pti->MessageQueue == gptiCurrent->MessageQueue )
+ if ( pwnd->head.pti == gptiCurrent )
continue;
}
UserPostMessage(List[i], Msg, wParam, lParam);
if ( parm.flags & BSF_IGNORECURRENTTASK )
{
- if ( pwnd->head.pti->MessageQueue == gptiCurrent->MessageQueue )
+ if ( pwnd->head.pti == gptiCurrent )
continue;
}
UserSendNotifyMessage(List[i], Msg, wParam, lParam);
if ( parm.flags & BSF_IGNORECURRENTTASK )
{
- if ( pwnd->head.pti->MessageQueue == gptiCurrent->MessageQueue )
+ if ( pwnd->head.pti == gptiCurrent )
continue;
}
co_IntSendMessageTimeout( List[i],
if ( parm.flags & BSF_IGNORECURRENTTASK )
{
- if ( pwnd->head.pti->MessageQueue == gptiCurrent->MessageQueue )
+ if ( pwnd->head.pti == gptiCurrent )
continue;
}
UserPostMessage(List[i], Msg, wParam, lParam);
if ( parm.flags & BSF_IGNORECURRENTTASK )
{
- if ( pwnd->head.pti->MessageQueue == gptiCurrent->MessageQueue )
+ if ( pwnd->head.pti == gptiCurrent )
continue;
}
UserSendNotifyMessage(List[i], Msg, wParam, lParam);
CWP.message = Msg;
CWP.wParam = wParam;
CWP.lParam = lParam;
- TRACE("WH_CALLWNDPROC: Hook %x NextHook %x\n", Hook, NextObj );
+ TRACE("WH_CALLWNDPROC: Hook %p NextHook %p\n", Hook, NextObj);
lResult = co_IntCallHookProc( Hook->HookId,
HC_ACTION,
((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
(LPARAM)&CWP,
Hook->Proc,
+ Hook->ihmod,
+ Hook->offPfn,
Hook->Ansi,
&Hook->ModuleName);
}
((ClientInfo->CI_flags & CI_CURTHPRHOOK) ? 1 : 0),
(LPARAM)&CWPR,
Hook->Proc,
+ Hook->ihmod,
+ Hook->offPfn,
Hook->Ansi,
&Hook->ModuleName);
}
Handles[0] = Process;
Handles[1] = W32Process->InputIdleEvent;
- Handles[2] = pti->MessageQueue->NewMessages; // pEventQueueServer; IntMsqSetWakeMask returns hEventQueueClient
+ Handles[2] = pti->pEventQueueServer; // IntMsqSetWakeMask returns hEventQueueClient
if (!Handles[1])
{
pti->pClientInfo->dwTIFlags = pti->TIF_flags;
}
- TRACE("WFII: ppi 0x%x\n",W32Process);
+ TRACE("WFII: ppi %p\n", W32Process);
TRACE("WFII: waiting for %p\n", Handles[1] );
do
{