ReactOS 0.4.15-dev-7788-g1ad9096
msgqueue.h
Go to the documentation of this file.
1#pragma once
2
3#define MSQ_HUNG 5000
4#define MSQ_NORMAL 0
5#define MSQ_ISHOOK 1
6#define MSQ_INJECTMODULE 2
7
8typedef struct _USER_MESSAGE
9{
17
19
20typedef struct _USER_SENT_MESSAGE
21{
24 DWORD QS_Flags; // Original QS bits used to create this message.
37
38#define SMF_RECEIVERDIED 0x00000002
39#define SMF_SENDERDIED 0x00000004
40#define SMF_RECEIVERFREE 0x00000008
41#define SMF_RECEIVEDMESSAGE 0x00000010
42#define SMF_RECEIVERBUSY 0x00004000
43
44typedef struct _USER_MESSAGE_QUEUE
45{
46 /* Reference counter, only access this variable with interlocked functions! */
48
49 /* Desktop that the message queue is attached to */
51
57
58 /* Queue for hardware messages for the queue. */
60 /* Last click message for translating double clicks */
62 /* Current capture window for this queue. */
64 /* Current window with focus (ie. receives keyboard input) for this queue. */
66 /* Current active window for this queue. */
69 /* Current move/size window for this queue */
71 /* Current menu owner window for this queue */
73 /* Identifes the menu state */
75 /* Message Queue Flags */
77 DWORD cThreads; // Shared message queue counter.
78
79 /* Extra message information */
81
82 /* State of each key */
83 BYTE afKeyRecentDown[256 / 8]; // 1 bit per key
84 BYTE afKeyState[256 * 2 / 8]; // 2 bits per key
85
86 /* Showing cursor counter (value>=0 - cursor visible, value<0 - cursor hidden) */
88 /* Cursor object */
90
91 /* Caret information for this queue */
94
95#define QF_UPDATEKEYSTATE 0x00000001
96#define QF_FMENUSTATUSBREAK 0x00000004
97#define QF_FMENUSTATUS 0x00000008
98#define QF_FF10STATUS 0x00000010
99#define QF_MOUSEMOVED 0x00000020
100#define QF_ACTIVATIONCHANGE 0x00000040
101#define QF_TABSWITCHING 0x00000080
102#define QF_KEYSTATERESET 0x00000100
103#define QF_INDESTROY 0x00000200
104#define QF_LOCKNOREMOVE 0x00000400
105#define QF_FOCUSNULLSINCEACTIVE 0x00000800
106#define QF_DIALOGACTIVE 0x00004000
107#define QF_EVENTDEACTIVATEREMOVED 0x00008000
108#define QF_TRACKMOUSELEAVE 0x00020000
109#define QF_TRACKMOUSEHOVER 0x00040000
110#define QF_TRACKMOUSEFIRING 0x00080000
111#define QF_CAPTURELOCKED 0x00100000
112#define QF_ACTIVEWNDTRACKING 0x00200000
113
114/* Internal messages codes */
116{
122
123#define POSTEVENT_DAW 4
124#define POSTEVENT_SAW 5
125#define POSTEVENT_NWE 14
126#define POSTEVENT_NONE 0xFFFF
127
128extern LIST_ENTRY usmList;
129
134 UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult);
142 IN PWND Window,
143 IN UINT MsgFilterLow,
144 IN UINT MsgFilterHigh,
145 IN UINT QSflags,
146 OUT LONG_PTR *ExtraInfo,
147 OUT DWORD *dwQEvent,
151 IN BOOL Remove,
152 IN PWND Window,
153 IN UINT MsgFilterLow,
154 IN UINT MsgFilterHigh,
155 IN UINT QSflags,
156 OUT MSG* pMsg);
165 UINT MsgFilterMin, UINT MsgFilterMax);
172 UINT Msg,
175 UINT uFlags,
176 UINT uTimeout,
177 ULONG_PTR *uResult);
178
181 UINT Msg,
183 LPARAM lParam);
186 UINT Msg,
190 ULONG_PTR CompletionCallbackContext,
191 ULONG_PTR *uResult);
194 HWND hwnd,
195 UINT Msg,
199 ULONG_PTR CompletionCallbackContext,
200 BOOL HasPackedLParam,
201 INT HookMessage);
202
212
216
217#define IntReferenceMessageQueue(MsgQueue) \
218 InterlockedIncrement(&(MsgQueue)->References)
219
220#define IntDereferenceMessageQueue(MsgQueue) \
221 do { \
222 if(InterlockedDecrement(&(MsgQueue)->References) == 0) \
223 { \
224 TRACE("Free message queue 0x%p\n", (MsgQueue)); \
225 ExFreePoolWithTag((MsgQueue), USERTAG_Q); \
226 } \
227 } while(0)
228
229#define IS_BTN_MESSAGE(message,code) \
230 ((message) == WM_LBUTTON##code || \
231 (message) == WM_MBUTTON##code || \
232 (message) == WM_RBUTTON##code || \
233 (message) == WM_XBUTTON##code || \
234 (message) == WM_NCLBUTTON##code || \
235 (message) == WM_NCMBUTTON##code || \
236 (message) == WM_NCRBUTTON##code || \
237 (message) == WM_NCXBUTTON##code )
238
239#define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
240#define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST))
241
242#define IS_MOUSE_MESSAGE(message) \
243 ((message >= WM_NCMOUSEFIRST && message <= WM_NCMOUSELAST) || \
244 (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST))
245
246#define IS_KBD_MESSAGE(message) \
247 (message >= WM_KEYFIRST && message <= WM_KEYLAST)
248
251
263
264int UserShowCursor(BOOL bShow);
268 BOOL ForceChange);
269
271
273
276 HWND hWnd,
277 UINT MsgFilterMin,
278 UINT MsgFilterMax,
279 UINT RemoveMsg,
280 BOOL bGMSG );
283 UINT Msg,
285 LPARAM lParam );
288 UINT MsgFilterMin,
289 UINT MsgFilterMax );
290
291/* EOF */
const TCHAR * CompletionCallback(unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pszContext, const TCHAR *pszBegin)
Definition: Completion.cpp:439
unsigned char BOOLEAN
Type
Definition: Type.h:7
HWND hWnd
Definition: settings.c:17
LONG NTSTATUS
Definition: precomp.h:26
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1627 Msg[]
#define APIENTRY
Definition: api.h:79
UINT uFlags
Definition: api.c:59
#define CALLBACK
Definition: compat.h:35
static const WCHAR Message[]
Definition: register.c:74
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define _In_
Definition: ms_sal.h:308
NTSTATUS NTAPI MsqInitializeImpl(VOID)
Definition: msgqueue.c:30
WPARAM FASTCALL MsqGetDownKeyState(PUSER_MESSAGE_QUEUE)
Definition: msgqueue.c:338
VOID FASTCALL MsqPostQuitMessage(PTHREADINFO pti, ULONG ExitCode)
Definition: msgqueue.c:1381
VOID FASTCALL MsqCleanupThreadMsgs(PTHREADINFO)
Definition: msgqueue.c:2209
VOID FASTCALL IdlePing(VOID)
Definition: message.c:526
VOID FASTCALL MsqDestroyMessage(PUSER_MESSAGE Message)
Definition: msgqueue.c:748
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1276
BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(_In_ PTHREADINFO pti)
Definition: msgqueue.c:873
LRESULT FASTCALL co_IntSendMessageWithCallBack(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, ULONG_PTR *uResult)
Definition: message.c:1735
BOOL APIENTRY IntInitMessagePumpHook(VOID)
Definition: message.c:2110
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2495
struct _USER_MESSAGE_QUEUE USER_MESSAGE_QUEUE
CODE_SEG("INIT") NTSTATUS NTAPI MsqInitializeImpl(VOID)
Definition: Interface.c:1810
BOOL APIENTRY co_MsqPeekHardwareMessage(IN PTHREADINFO pti, IN BOOL Remove, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, IN UINT QSflags, OUT MSG *pMsg)
Definition: msgqueue.c:1933
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
BOOL FASTCALL MsqIsDblClk(LPMSG Msg, BOOL Remove)
LRESULT FASTCALL IntDispatchMessage(MSG *Msg)
DWORD APIENTRY IntGetQueueStatus(DWORD)
Definition: message.c:2089
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1713
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:2040
struct _USER_SENT_MESSAGE USER_SENT_MESSAGE
VOID CALLBACK HungAppSysTimerProc(HWND, UINT, UINT_PTR, DWORD)
Definition: msgqueue.c:2181
VOID FASTCALL MsqDestroyMessageQueue(_In_ PTHREADINFO pti)
Definition: msgqueue.c:2411
NTSTATUS FASTCALL co_MsqSendMessage(PTHREADINFO ptirec, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult)
Definition: msgqueue.c:1056
VOID FASTCALL ClearMsgBitsMask(PTHREADINFO, UINT)
Definition: msgqueue.c:445
LRESULT FASTCALL co_IntPostOrSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
VOID FASTCALL FreeUserMessage(PUSER_SENT_MESSAGE)
Definition: msgqueue.c:786
BOOL FASTCALL IntMsqClearWakeMask(VOID)
Definition: msgqueue.c:392
VOID FASTCALL MsqIncPaintCountQueue(PTHREADINFO)
Definition: msgqueue.c:501
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO)
Definition: msgqueue.c:508
struct _USER_MESSAGE * PUSER_MESSAGE
BOOL FASTCALL IntCallMsgFilter(LPMSG, INT)
Definition: message.c:2140
BOOL FASTCALL co_IntWaitMessage(PWND Window, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: message.c:1130
struct _USER_SENT_MESSAGE * PUSER_SENT_MESSAGE
internal_event_message
Definition: msgqueue.h:116
@ WM_ASYNC_SETACTIVEWINDOW
Definition: msgqueue.h:119
@ WM_ASYNC_SHOWWINDOW
Definition: msgqueue.h:117
@ WM_ASYNC_SETWINDOWPOS
Definition: msgqueue.h:118
@ WM_ASYNC_DESTROYWINDOW
Definition: msgqueue.h:120
struct _USER_MESSAGE_QUEUE * PUSER_MESSAGE_QUEUE
LRESULT FASTCALL co_IntSendMessageTimeout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1657
VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PWND pWindow)
Definition: msgqueue.c:798
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1176
LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam)
Definition: msgqueue.c:2435
BOOL FASTCALL co_MsqSendMessageAsync(PTHREADINFO ptiReceiver, HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, BOOL HasPackedLParam, INT HookMessage)
Definition: msgqueue.c:1014
BOOL FASTCALL MsqIsHung(PTHREADINFO pti, DWORD TimeOut)
Definition: msgqueue.c:2137
VOID FASTCALL IdlePong(VOID)
Definition: message.c:556
VOID FASTCALL IntCoalesceMouseMove(PTHREADINFO)
Definition: msgqueue.c:551
BOOL APIENTRY IntUninitMessagePumpHook(VOID)
Definition: message.c:2123
HANDLE FASTCALL IntMsqSetWakeMask(DWORD WakeMask)
Definition: msgqueue.c:362
BOOL FASTCALL UserPostThreadMessage(PTHREADINFO pti, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1308
BOOL FASTCALL IsThreadSuspended(PTHREADINFO)
Definition: msgqueue.c:2168
NTSTATUS FASTCALL co_MsqWaitForNewMessages(PTHREADINFO pti, PWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: msgqueue.c:2107
BOOLEAN FASTCALL MsqInitializeMessageQueue(PTHREADINFO, PUSER_MESSAGE_QUEUE)
Definition: msgqueue.c:2189
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1445
BOOLEAN APIENTRY MsqPeekMessage(IN PTHREADINFO pti, IN BOOLEAN Remove, IN PWND Window, IN UINT MsgFilterLow, IN UINT MsgFilterHigh, IN UINT QSflags, OUT LONG_PTR *ExtraInfo, OUT DWORD *dwQEvent, OUT PMSG Message)
Definition: msgqueue.c:2050
VOID FASTCALL MsqWakeQueue(PTHREADINFO, DWORD, BOOL)
Definition: msgqueue.c:412
BOOL FASTCALL co_MsqReplyMessage(LRESULT)
Definition: msgqueue.c:2472
LIST_ENTRY usmList
Definition: msgqueue.c:23
struct _USER_MESSAGE USER_MESSAGE
PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(PTHREADINFO)
Definition: msgqueue.c:2384
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID)
Definition: msgqueue.c:2455
PUSER_SENT_MESSAGE FASTCALL AllocateUserMessage(BOOL)
Definition: msgqueue.c:763
UINT lParamMemorySize(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:254
VOID FASTCALL MsqPostMessage(PTHREADINFO, MSG *, BOOLEAN, DWORD, DWORD, LONG_PTR)
Definition: msgqueue.c:1337
BOOL FASTCALL MsqIsClkLck(LPMSG Msg, BOOL Remove)
PUSER_MESSAGE FASTCALL MsqCreateMessage(LPMSG Msg)
Definition: msgqueue.c:731
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define FASTCALL
Definition: nt_native.h:50
long LONG
Definition: pedump.c:60
Definition: window.c:28
Definition: typedefs.h:120
BYTE afKeyState[256 *2/8]
Definition: msgqueue.h:84
ULONG_PTR idSysPeek
Definition: msgqueue.h:54
PTHREADINFO ptiSysLock
Definition: msgqueue.h:52
ULONG_PTR idSysLock
Definition: msgqueue.h:53
PTHREADINFO ptiMouse
Definition: msgqueue.h:55
LIST_ENTRY HardwareMessagesListHead
Definition: msgqueue.h:59
THRDCARETINFO CaretInfo
Definition: msgqueue.h:92
struct _DESKTOP * Desktop
Definition: msgqueue.h:50
PCURICON_OBJECT CursorObject
Definition: msgqueue.h:89
PTHREADINFO ptiKeyboard
Definition: msgqueue.h:56
BYTE afKeyRecentDown[256/8]
Definition: msgqueue.h:83
PTHREADINFO pti
Definition: msgqueue.h:15
DWORD QS_Flags
Definition: msgqueue.h:12
LONG_PTR ExtraInfo
Definition: msgqueue.h:13
LIST_ENTRY ListEntry
Definition: msgqueue.h:10
DWORD dwQEvent
Definition: msgqueue.h:14
LIST_ENTRY ListEntry
Definition: msgqueue.h:22
KEVENT CompletionEvent
Definition: msgqueue.h:35
ULONG_PTR CompletionCallbackContext
Definition: msgqueue.h:32
SENDASYNCPROC CompletionCallback
Definition: msgqueue.h:30
BOOL HasPackedLParam
Definition: msgqueue.h:34
PTHREADINFO ptiReceiver
Definition: msgqueue.h:29
LRESULT lResult
Definition: msgqueue.h:26
PTHREADINFO ptiCallBackSender
Definition: msgqueue.h:31
PKEVENT pkCompletionEvent
Definition: msgqueue.h:25
PTHREADINFO ptiSender
Definition: msgqueue.h:28
Definition: ntuser.h:694
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define NTAPI
Definition: typedefs.h:36
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
void(CALLBACK * SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT)
Definition: winuser.h:2916
_In_ BOOLEAN Remove
Definition: psfuncs.h:110
unsigned char BYTE
Definition: xxhash.c:193