ReactOS  0.4.13-dev-464-g6b95727
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 
8 typedef struct _USER_MESSAGE
9 {
17 
18 struct _USER_MESSAGE_QUEUE;
19 
20 typedef 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 
44 typedef 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 */
50  struct _DESKTOP *Desktop;
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 {
117  WM_ASYNC_SHOWWINDOW = 0x80000000,
121 };
122 
123 #define POSTEVENT_DAW 4
124 #define POSTEVENT_SAW 5
125 #define POSTEVENT_NWE 14
126 #define POSTEVENT_NONE 0xFFFF
127 
128 extern LIST_ENTRY usmList;
129 
134  UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult);
141  IN BOOLEAN Remove,
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,
148  OUT PMSG Message);
151  IN BOOL Remove,
152  IN PWND Window,
153  IN UINT MsgFilterLow,
154  IN UINT MsgFilterHigh,
155  IN UINT QSflags,
156  OUT MSG* pMsg);
161 INIT_FUNCTION NTSTATUS NTAPI MsqInitializeImpl(VOID);
165  UINT MsgFilterMin, UINT MsgFilterMax);
172  UINT Msg,
173  WPARAM wParam,
174  LPARAM lParam,
175  UINT uFlags,
176  UINT uTimeout,
177  ULONG_PTR *uResult);
178 
181  UINT Msg,
182  WPARAM wParam,
183  LPARAM lParam);
186  UINT Msg,
187  WPARAM wParam,
188  LPARAM lParam,
190  ULONG_PTR CompletionCallbackContext,
191  ULONG_PTR *uResult);
194  HWND hwnd,
195  UINT Msg,
196  WPARAM wParam,
197  LPARAM lParam,
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 
264 int UserShowCursor(BOOL bShow);
266 FASTCALL
268  BOOL ForceChange);
269 
271 
273 
276  HWND hWnd,
277  UINT MsgFilterMin,
278  UINT MsgFilterMax,
279  UINT RemoveMsg,
280  BOOL bGMSG );
283  UINT Msg,
284  WPARAM wParam,
285  LPARAM lParam );
288  UINT MsgFilterMin,
289  UINT MsgFilterMax );
290 
291 /* EOF */
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:2107
LIST_ENTRY ListEntry
Definition: msgqueue.h:10
VOID FASTCALL MsqIncPaintCountQueue(PTHREADINFO)
Definition: msgqueue.c:501
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IN
Definition: typedefs.h:38
struct _USER_SENT_MESSAGE USER_SENT_MESSAGE
PTHREADINFO ptiSender
Definition: msgqueue.h:28
UINT lParamMemorySize(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:243
BOOL FASTCALL MsqIsDblClk(LPMSG Msg, BOOL Remove)
ULONG_PTR idSysLock
Definition: msgqueue.h:53
PUSER_MESSAGE FASTCALL MsqCreateMessage(LPMSG Msg)
Definition: msgqueue.c:731
BOOL FASTCALL IntCallMsgFilter(LPMSG, INT)
Definition: message.c:1974
VOID FASTCALL MsqPostQuitMessage(PTHREADINFO pti, ULONG ExitCode)
Definition: msgqueue.c:1380
PKEVENT pkCompletionEvent
Definition: msgqueue.h:25
Type
Definition: Type.h:6
LRESULT lResult
Definition: msgqueue.h:26
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1015
BOOL APIENTRY IntInitMessagePumpHook(VOID)
Definition: message.c:1944
VOID FASTCALL MsqDestroyMessageQueue(_In_ PTHREADINFO pti)
Definition: msgqueue.c:2449
LRESULT FASTCALL co_IntSendMessageWithCallBack(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, ULONG_PTR *uResult)
Definition: message.c:1569
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
LONG NTSTATUS
Definition: precomp.h:26
PTHREADINFO ptiKeyboard
Definition: msgqueue.h:56
PTHREADINFO pti
Definition: msgqueue.h:15
#define CALLBACK
Definition: compat.h:27
BOOL FASTCALL UserPostThreadMessage(PTHREADINFO pti, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1144
HWND hWnd
Definition: settings.c:17
LRESULT FASTCALL co_IntSendMessageTimeout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1491
LONG_PTR ExtraInfo
Definition: msgqueue.h:13
struct _USER_MESSAGE * PUSER_MESSAGE
LIST_ENTRY usmList
Definition: msgqueue.c:23
UINT_PTR WPARAM
Definition: windef.h:207
UINT uFlags
Definition: api.c:60
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:1996
LRESULT FASTCALL co_IntPostOrSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
SENDASYNCPROC CompletionCallback
Definition: msgqueue.h:30
#define FASTCALL
Definition: nt_native.h:50
int32_t INT
Definition: typedefs.h:56
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2533
WPARAM wParam
Definition: combotst.c:138
VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PWND pWindow)
Definition: msgqueue.c:798
BOOL FASTCALL MsqIsClkLck(LPMSG Msg, BOOL Remove)
VOID FASTCALL IdlePong(VOID)
Definition: message.c:545
LIST_ENTRY ListEntry
Definition: msgqueue.h:22
struct @1571 Msg[]
uint32_t ULONG_PTR
Definition: typedefs.h:63
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:1057
Definition: window.c:29
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOL FASTCALL IsThreadSuspended(PTHREADINFO)
Definition: msgqueue.c:2206
BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(_In_ PTHREADINFO pti)
Definition: msgqueue.c:873
BOOL FASTCALL IntMsqClearWakeMask(VOID)
Definition: msgqueue.c:392
unsigned char BOOLEAN
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1547
PTHREADINFO ptiReceiver
Definition: msgqueue.h:29
struct _USER_MESSAGE_QUEUE * PUSER_MESSAGE_QUEUE
LONG_PTR LPARAM
Definition: windef.h:208
DWORD QS_Flags
Definition: msgqueue.h:12
_In_ BOOLEAN Remove
Definition: psfuncs.h:110
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1136
ULONG_PTR CompletionCallbackContext
Definition: msgqueue.h:32
DWORD dwQEvent
Definition: msgqueue.h:14
VOID FASTCALL IntCoalesceMouseMove(PTHREADINFO)
Definition: msgqueue.c:551
WPARAM FASTCALL MsqGetDownKeyState(PUSER_MESSAGE_QUEUE)
Definition: msgqueue.c:338
BOOLEAN FASTCALL MsqInitializeMessageQueue(PTHREADINFO, PUSER_MESSAGE_QUEUE)
Definition: msgqueue.c:2227
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(PTHREADINFO)
Definition: msgqueue.c:2422
VOID FASTCALL MsqWakeQueue(PTHREADINFO, DWORD, BOOL)
Definition: msgqueue.c:412
BOOL FASTCALL co_IntWaitMessage(PWND Window, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: message.c:969
VOID FASTCALL MsqDestroyMessage(PUSER_MESSAGE Message)
Definition: msgqueue.c:748
void(CALLBACK * SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT)
Definition: winuser.h:2869
BOOL FASTCALL co_MsqReplyMessage(LRESULT)
Definition: msgqueue.c:2510
VOID CALLBACK HungAppSysTimerProc(HWND, UINT, UINT_PTR, DWORD)
Definition: msgqueue.c:2219
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
struct _USER_MESSAGE_QUEUE USER_MESSAGE_QUEUE
GLbitfield flags
Definition: glext.h:7161
PTHREADINFO ptiSysLock
Definition: msgqueue.h:52
CHAR Message[80]
Definition: alive.c:5
ULONG_PTR idSysPeek
Definition: msgqueue.h:54
NTSTATUS FASTCALL co_MsqWaitForNewMessages(PTHREADINFO pti, PWND WndFilter, UINT MsgFilterMin, UINT MsgFilterMax)
Definition: msgqueue.c:2164
VOID FASTCALL IdlePing(VOID)
Definition: message.c:515
BYTE afKeyState[256 *2/8]
Definition: msgqueue.h:84
LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam)
Definition: msgqueue.c:2473
unsigned char BYTE
Definition: mem.h:68
THRDCARETINFO CaretInfo
Definition: msgqueue.h:92
BOOL HasPackedLParam
Definition: msgqueue.h:34
BOOL FASTCALL UserSendNotifyMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1874
PTHREADINFO ptiCallBackSender
Definition: msgqueue.h:31
Definition: typedefs.h:117
INIT_FUNCTION NTSTATUS NTAPI MsqInitializeImpl(VOID)
Definition: msgqueue.c:30
PCURICON_OBJECT CursorObject
Definition: msgqueue.h:89
LRESULT FASTCALL IntDispatchMessage(MSG *Msg)
#define _In_
Definition: no_sal2.h:204
Definition: ntuser.h:657
DWORD APIENTRY IntGetQueueStatus(DWORD)
Definition: message.c:1923
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
HANDLE FASTCALL IntMsqSetWakeMask(DWORD WakeMask)
Definition: msgqueue.c:362
struct _USER_SENT_MESSAGE * PUSER_SENT_MESSAGE
BOOL FASTCALL MsqIsHung(PTHREADINFO pti)
Definition: msgqueue.c:2194
LPARAM FASTCALL MsqGetMessageExtraInfo(VOID)
Definition: msgqueue.c:2493
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO)
Definition: msgqueue.c:508
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
VOID FASTCALL MsqCleanupThreadMsgs(PTHREADINFO)
Definition: msgqueue.c:2247
VOID FASTCALL MsqPostMessage(PTHREADINFO, MSG *, BOOLEAN, DWORD, DWORD, LONG_PTR)
Definition: msgqueue.c:1338
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
PUSER_SENT_MESSAGE FASTCALL AllocateUserMessage(BOOL)
Definition: msgqueue.c:763
KEVENT CompletionEvent
Definition: msgqueue.h:35
internal_event_message
Definition: msgqueue.h:115
#define OUT
Definition: typedefs.h:39
BOOL APIENTRY IntUninitMessagePumpHook(VOID)
Definition: message.c:1957
unsigned int ULONG
Definition: retypes.h:1
VOID FASTCALL ClearMsgBitsMask(PTHREADINFO, UINT)
Definition: msgqueue.c:445
PTHREADINFO ptiMouse
Definition: msgqueue.h:55
const TCHAR * CompletionCallback(unsigned __int64 &rnIndex, const BOOL *pblnForward, const TCHAR *pszContext, const TCHAR *pszBegin)
Definition: Completion.cpp:439
BYTE afKeyRecentDown[256/8]
Definition: msgqueue.h:83
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
struct _DESKTOP * Desktop
Definition: msgqueue.h:50
LIST_ENTRY HardwareMessagesListHead
Definition: msgqueue.h:59
LPARAM lParam
Definition: combotst.c:139
VOID FASTCALL FreeUserMessage(PUSER_SENT_MESSAGE)
Definition: msgqueue.c:786
struct _USER_MESSAGE USER_MESSAGE
#define APIENTRY
Definition: api.h:79