#define MSQ_ISEVENT 2
#define MSQ_INJECTMODULE 3
-#define QSIDCOUNTS 6
-
-typedef enum _QS_ROS_TYPES
-{
- QSRosKey = 0,
- QSRosMouseMove,
- QSRosMouseButton,
- QSRosPostMessage,
- QSRosSendMessage,
- QSRosHotKey,
-}QS_ROS_TYPES,*PQS_ROS_TYPES;
-
typedef struct _USER_MESSAGE
{
LIST_ENTRY ListEntry;
PKEVENT CompletionEvent;
LRESULT* Result;
LRESULT lResult;
- struct _USER_MESSAGE_QUEUE* SenderQueue;
- struct _USER_MESSAGE_QUEUE* CallBackSenderQueue;
+ PTHREADINFO ptiSender;
+ PTHREADINFO ptiReceiver;
SENDASYNCPROC CompletionCallback;
+ PTHREADINFO ptiCallBackSender;
ULONG_PTR CompletionCallbackContext;
/* entry in the dispatching list of the sender's message queue */
LIST_ENTRY DispatchingListEntry;
/* Reference counter, only access this variable with interlocked functions! */
LONG References;
+ /* Desktop that the message queue is attached to */
+ struct _DESKTOP *Desktop;
+
PTHREADINFO ptiSysLock;
- /* Owner of the message queue */
- struct _ETHREAD *Thread;
- /* Queue of messages sent to the queue. */
- LIST_ENTRY SentMessagesListHead;
- /* Queue of messages posted to the queue. */
- LIST_ENTRY PostedMessagesListHead;
+ PTHREADINFO ptiMouse;
+ PTHREADINFO ptiKeyboard;
+
/* Queue for hardware messages for the queue. */
LIST_ENTRY HardwareMessagesListHead;
- /* True if a WM_MOUSEMOVE is pending */
- BOOLEAN MouseMoved;
- /* Current WM_MOUSEMOVE message */
- MSG MouseMoveMsg;
/* Last click message for translating double clicks */
MSG msgDblClk;
- /* True if a WM_QUIT message is pending. */
- BOOLEAN QuitPosted;
- /* The quit exit code. */
- ULONG QuitExitCode;
- /* Set if there are new messages specified by WakeMask in any of the queues. */
- PKEVENT NewMessages;
- /* Handle for the above event (in the context of the process owning the queue). */
- HANDLE NewMessagesHandle;
- /* Last time PeekMessage() was called. */
- ULONG LastMsgRead;
/* Current capture window for this queue. */
PWND spwndCapture;
/* Current window with focus (ie. receives keyboard input) for this queue. */
DWORD QF_flags;
DWORD cThreads; // Shared message queue counter.
- /* Queue state tracking */
- // Send list QS_SENDMESSAGE
- // Post list QS_POSTMESSAGE|QS_HOTKEY|QS_PAINT|QS_TIMER|QS_KEY
- // Hard list QS_MOUSE|QS_KEY only
- // Accounting of queue bit sets, the rest are flags. QS_TIMER QS_PAINT counts are handled in thread information.
- DWORD nCntsQBits[QSIDCOUNTS]; // QS_KEY QS_MOUSEMOVE QS_MOUSEBUTTON QS_POSTMESSAGE QS_SENDMESSAGE QS_HOTKEY
-
/* Extra message information */
LPARAM ExtraInfo;
/* Cursor object */
PCURICON_OBJECT CursorObject;
- /* Messages that are currently dispatched by other threads */
- LIST_ENTRY DispatchingMessagesHead;
- /* Messages that are currently dispatched by this message queue, required for cleanup */
- LIST_ENTRY LocalDispatchingMessagesHead;
-
- /* Desktop that the message queue is attached to */
- struct _DESKTOP *Desktop;
} USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
#define QF_UPDATEKEYSTATE 0x00000001
#define QF_FMENUSTATUSBREAK 0x00000004
#define QF_FMENUSTATUS 0x00000008
#define QF_FF10STATUS 0x00000010
-#define QF_MOUSEMOVED 0x00000020 // See MouseMoved.
+#define QF_MOUSEMOVED 0x00000020
#define QF_ACTIVATIONCHANGE 0x00000040
#define QF_TABSWITCHING 0x00000080
#define QF_KEYSTATERESET 0x00000100
WM_ASYNC_SETACTIVEWINDOW
};
-BOOL FASTCALL MsqIsHung(PUSER_MESSAGE_QUEUE MessageQueue);
+BOOL FASTCALL MsqIsHung(PTHREADINFO pti);
VOID CALLBACK HungAppSysTimerProc(HWND,UINT,UINT_PTR,DWORD);
-NTSTATUS FASTCALL co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
+NTSTATUS FASTCALL co_MsqSendMessage(PTHREADINFO ptirec,
HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam,
UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult);
PUSER_MESSAGE FASTCALL MsqCreateMessage(LPMSG Msg);
VOID FASTCALL MsqDestroyMessage(PUSER_MESSAGE Message);
-VOID FASTCALL MsqPostMessage(PUSER_MESSAGE_QUEUE, MSG*, BOOLEAN, DWORD, DWORD);
-VOID FASTCALL MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode);
+VOID FASTCALL MsqPostMessage(PTHREADINFO, MSG*, BOOLEAN, DWORD, DWORD, LONG_PTR);
+VOID FASTCALL MsqPostQuitMessage(PTHREADINFO pti, ULONG ExitCode);
BOOLEAN APIENTRY
-MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
+MsqPeekMessage(IN PTHREADINFO pti,
IN BOOLEAN Remove,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT QSflags,
OUT PMSG Message);
BOOL APIENTRY
-co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
+co_MsqPeekHardwareMessage(IN PTHREADINFO pti,
IN BOOL Remove,
IN PWND Window,
IN UINT MsgFilterLow,
IN UINT MsgFilterHigh,
IN UINT QSflags,
OUT MSG* pMsg);
-BOOL APIENTRY
-co_MsqPeekMouseMove(IN PUSER_MESSAGE_QUEUE MessageQueue,
- IN BOOL Remove,
- IN PWND Window,
- IN UINT MsgFilterLow,
- IN UINT MsgFilterHigh,
- OUT MSG* pMsg);
BOOLEAN FASTCALL MsqInitializeMessageQueue(PTHREADINFO, PUSER_MESSAGE_QUEUE);
PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(PTHREADINFO);
+VOID FASTCALL MsqCleanupThreadMsgs(PTHREADINFO);
VOID FASTCALL MsqDestroyMessageQueue(PTHREADINFO);
INIT_FUNCTION NTSTATUS NTAPI MsqInitializeImpl(VOID);
-BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(_In_ PUSER_MESSAGE_QUEUE MessageQueue);
+BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(PTHREADINFO pti);
NTSTATUS FASTCALL
-co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWND WndFilter,
+co_MsqWaitForNewMessages(PTHREADINFO pti, PWND WndFilter,
UINT MsgFilterMin, UINT MsgFilterMax);
-VOID FASTCALL MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
-VOID FASTCALL MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
+VOID FASTCALL MsqIncPaintCountQueue(PTHREADINFO);
+VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO);
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT FASTCALL co_IntPostOrSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
LRESULT FASTCALL
BOOL HasPackedLParam,
INT HookMessage);
+VOID FASTCALL IntCoalesceMouseMove(PTHREADINFO);
LRESULT FASTCALL IntDispatchMessage(MSG* Msg);
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags);
-VOID FASTCALL MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam);
VOID FASTCALL co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook);
BOOL FASTCALL MsqIsClkLck(LPMSG Msg, BOOL Remove);
BOOL FASTCALL MsqIsDblClk(LPMSG Msg, BOOL Remove);
-HWND FASTCALL MsqSetStateWindow(PUSER_MESSAGE_QUEUE MessageQueue, ULONG Type, HWND hWnd);
+HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd);
BOOL APIENTRY IntInitMessagePumpHook(VOID);
BOOL APIENTRY IntUninitMessagePumpHook(VOID);
LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam);
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
-VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PVOID pWindow); /* F*(&$ headers, will be gone in the rewrite! */
+VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PWND pWindow);
#define IntReferenceMessageQueue(MsgQueue) \
InterlockedIncrement(&(MsgQueue)->References)
if(InterlockedDecrement(&(MsgQueue)->References) == 0) \
{ \
TRACE("Free message queue 0x%p\n", (MsgQueue)); \
- if ((MsgQueue)->NewMessages != NULL) \
- ObDereferenceObject((MsgQueue)->NewMessages); \
ExFreePoolWithTag((MsgQueue), USERTAG_Q); \
} \
} while(0)
VOID FASTCALL IdlePing(VOID);
VOID FASTCALL IdlePong(VOID);
BOOL FASTCALL co_MsqReplyMessage(LRESULT);
-VOID FASTCALL MsqWakeQueue(PUSER_MESSAGE_QUEUE,DWORD,BOOL);
-VOID FASTCALL ClearMsgBitsMask(PUSER_MESSAGE_QUEUE,UINT);
+VOID FASTCALL MsqWakeQueue(PTHREADINFO,DWORD,BOOL);
+VOID FASTCALL ClearMsgBitsMask(PTHREADINFO,UINT);
+BOOL FASTCALL IntCallMsgFilter(LPMSG,INT);
+WPARAM FASTCALL MsqGetDownKeyState(PUSER_MESSAGE_QUEUE);
int UserShowCursor(BOOL bShow);
PCURICON_OBJECT
UINT MsgFilterMax,
UINT RemoveMsg,
BOOL bGMSG );
+BOOL FASTCALL
+UserPostThreadMessage( PTHREADINFO pti,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam );
/* EOF */