ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

msgqueue.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #define MSQ_HUNG        5000
00004 #define MSQ_NORMAL      0
00005 #define MSQ_ISHOOK      1
00006 #define MSQ_ISEVENT     2
00007 #define MSQ_INJECTMODULE 3
00008 
00009 #define QSIDCOUNTS 6
00010 
00011 typedef enum _QS_ROS_TYPES
00012 {
00013     QSRosKey = 0,
00014     QSRosMouseMove,
00015     QSRosMouseButton,
00016     QSRosPostMessage,
00017     QSRosSendMessage,
00018     QSRosHotKey,
00019 }QS_ROS_TYPES,*PQS_ROS_TYPES;
00020 
00021 typedef struct _USER_MESSAGE
00022 {
00023   LIST_ENTRY ListEntry;
00024   MSG Msg;
00025   DWORD QS_Flags;
00026 } USER_MESSAGE, *PUSER_MESSAGE;
00027 
00028 struct _USER_MESSAGE_QUEUE;
00029 
00030 typedef struct _USER_SENT_MESSAGE
00031 {
00032   LIST_ENTRY ListEntry;
00033   MSG Msg;
00034   DWORD QS_Flags;  // Original QS bits used to create this message.
00035   PKEVENT CompletionEvent;
00036   LRESULT* Result;
00037   LRESULT lResult;
00038   struct _USER_MESSAGE_QUEUE* SenderQueue;
00039   struct _USER_MESSAGE_QUEUE* CallBackSenderQueue;
00040   SENDASYNCPROC CompletionCallback;
00041   ULONG_PTR CompletionCallbackContext;
00042   /* entry in the dispatching list of the sender's message queue */
00043   LIST_ENTRY DispatchingListEntry;
00044   INT HookMessage;
00045   BOOL HasPackedLParam;
00046 } USER_SENT_MESSAGE, *PUSER_SENT_MESSAGE;
00047 
00048 typedef struct _USER_MESSAGE_QUEUE
00049 {
00050   /* Reference counter, only access this variable with interlocked functions! */
00051   LONG References;
00052 
00053   /* Owner of the message queue */
00054   struct _ETHREAD *Thread;
00055   /* Queue of messages sent to the queue. */
00056   LIST_ENTRY SentMessagesListHead;
00057   /* Queue of messages posted to the queue. */
00058   LIST_ENTRY PostedMessagesListHead;
00059   /* Queue for hardware messages for the queue. */
00060   LIST_ENTRY HardwareMessagesListHead;
00061   /* True if a WM_MOUSEMOVE is pending */
00062   BOOLEAN MouseMoved;
00063   /* Current WM_MOUSEMOVE message */
00064   MSG MouseMoveMsg;
00065   /* Last click message for translating double clicks */
00066   MSG msgDblClk;
00067   /* True if a WM_QUIT message is pending. */
00068   BOOLEAN QuitPosted;
00069   /* The quit exit code. */
00070   ULONG QuitExitCode;
00071   /* Set if there are new messages specified by WakeMask in any of the queues. */
00072   PKEVENT NewMessages;
00073   /* Handle for the above event (in the context of the process owning the queue). */
00074   HANDLE NewMessagesHandle;
00075   /* Last time PeekMessage() was called. */
00076   ULONG LastMsgRead;
00077   /* Current capture window for this queue. */
00078   HWND CaptureWindow;
00079   PWND spwndCapture;
00080   /* Current window with focus (ie. receives keyboard input) for this queue. */
00081   PWND spwndFocus;
00082   /* Current active window for this queue. */
00083   PWND spwndActive;
00084   PWND spwndActivePrev;
00085   /* Current move/size window for this queue */
00086   HWND MoveSize;
00087   /* Current menu owner window for this queue */
00088   HWND MenuOwner;
00089   /* Identifes the menu state */
00090   BYTE MenuState;
00091   /* Caret information for this queue */
00092   PTHRDCARETINFO CaretInfo;
00093   /* Message Queue Flags */
00094   DWORD QF_flags;
00095 
00096   /* Queue state tracking */
00097   // Send list QS_SENDMESSAGE
00098   // Post list QS_POSTMESSAGE|QS_HOTKEY|QS_PAINT|QS_TIMER|QS_KEY
00099   // Hard list QS_MOUSE|QS_KEY only
00100   // Accounting of queue bit sets, the rest are flags. QS_TIMER QS_PAINT counts are handled in thread information.
00101   DWORD nCntsQBits[QSIDCOUNTS]; // QS_KEY QS_MOUSEMOVE QS_MOUSEBUTTON QS_POSTMESSAGE QS_SENDMESSAGE QS_HOTKEY
00102 
00103   /* Extra message information */
00104   LPARAM ExtraInfo;
00105 
00106   /* State of each key */
00107   BYTE afKeyRecentDown[256 / 8]; // 1 bit per key
00108   BYTE afKeyState[256 * 2 / 8]; // 2 bits per key
00109 
00110   /* Showing cursor counter (value>=0 - cursor visible, value<0 - cursor hidden) */
00111   INT ShowingCursor;
00112   /* Cursor object */
00113   PCURICON_OBJECT CursorObject;
00114 
00115   /* Messages that are currently dispatched by other threads */
00116   LIST_ENTRY DispatchingMessagesHead;
00117   /* Messages that are currently dispatched by this message queue, required for cleanup */
00118   LIST_ENTRY LocalDispatchingMessagesHead;
00119 
00120   /* Desktop that the message queue is attached to */
00121   struct _DESKTOP *Desktop;
00122 } USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
00123 
00124 #define QF_UPDATEKEYSTATE         0x00000001
00125 #define QF_FMENUSTATUSBREAK       0x00000004
00126 #define QF_FMENUSTATUS            0x00000008
00127 #define QF_FF10STATUS             0x00000010
00128 #define QF_MOUSEMOVED             0x00000020 // See MouseMoved.
00129 #define QF_ACTIVATIONCHANGE       0x00000040
00130 #define QF_TABSWITCHING           0x00000080
00131 #define QF_KEYSTATERESET          0x00000100
00132 #define QF_INDESTROY              0x00000200
00133 #define QF_LOCKNOREMOVE           0x00000400
00134 #define QF_FOCUSNULLSINCEACTIVE   0x00000800
00135 #define QF_DIALOGACTIVE           0x00004000
00136 #define QF_EVENTDEACTIVATEREMOVED 0x00008000
00137 #define QF_TRACKMOUSELEAVE        0x00020000
00138 #define QF_TRACKMOUSEHOVER        0x00040000
00139 #define QF_TRACKMOUSEFIRING       0x00080000
00140 #define QF_CAPTURELOCKED          0x00100000
00141 #define QF_ACTIVEWNDTRACKING      0x00200000
00142 
00143 /* Internal messages codes */
00144 enum internal_event_message
00145 {
00146     WM_ASYNC_SHOWWINDOW = 0x80000000,
00147     WM_ASYNC_SETWINDOWPOS,
00148     WM_ASYNC_SETACTIVEWINDOW
00149 };
00150 
00151 BOOL FASTCALL MsqIsHung(PUSER_MESSAGE_QUEUE MessageQueue);
00152 VOID CALLBACK HungAppSysTimerProc(HWND,UINT,UINT_PTR,DWORD);
00153 NTSTATUS FASTCALL co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
00154            HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam,
00155            UINT uTimeout, BOOL Block, INT HookMessage, ULONG_PTR *uResult);
00156 PUSER_MESSAGE FASTCALL MsqCreateMessage(LPMSG Msg);
00157 VOID FASTCALL MsqDestroyMessage(PUSER_MESSAGE Message);
00158 VOID FASTCALL MsqPostMessage(PUSER_MESSAGE_QUEUE MessageQueue, MSG* Msg, BOOLEAN HardwareMessage, DWORD MessageBits);
00159 VOID FASTCALL MsqPostQuitMessage(PUSER_MESSAGE_QUEUE MessageQueue, ULONG ExitCode);
00160 BOOLEAN APIENTRY
00161 MsqPeekMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
00162                   IN BOOLEAN Remove,
00163                   IN PWND Window,
00164                   IN UINT MsgFilterLow,
00165                   IN UINT MsgFilterHigh,
00166                   IN UINT QSflags,
00167                   OUT PMSG Message);
00168 BOOL APIENTRY
00169 co_MsqPeekHardwareMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
00170                           IN BOOL Remove,
00171                           IN PWND Window,
00172                           IN UINT MsgFilterLow,
00173                           IN UINT MsgFilterHigh,
00174                           IN UINT QSflags,
00175                           OUT MSG* pMsg);
00176 BOOL APIENTRY
00177 co_MsqPeekMouseMove(IN PUSER_MESSAGE_QUEUE MessageQueue,
00178                     IN BOOL Remove,
00179                     IN PWND Window,
00180                     IN UINT MsgFilterLow,
00181                     IN UINT MsgFilterHigh,
00182                     OUT MSG* pMsg);
00183 BOOLEAN FASTCALL MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
00184 PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(struct _ETHREAD *Thread);
00185 VOID FASTCALL MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
00186 INIT_FUNCTION NTSTATUS NTAPI MsqInitializeImpl(VOID);
00187 BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
00188 NTSTATUS FASTCALL
00189 co_MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue, PWND WndFilter,
00190                       UINT MsgFilterMin, UINT MsgFilterMax);
00191 VOID FASTCALL MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
00192 VOID FASTCALL MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue);
00193 LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
00194 LRESULT FASTCALL co_IntPostOrSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
00195 LRESULT FASTCALL
00196 co_IntSendMessageTimeout(HWND hWnd,
00197                       UINT Msg,
00198                       WPARAM wParam,
00199                       LPARAM lParam,
00200                       UINT uFlags,
00201                       UINT uTimeout,
00202                       ULONG_PTR *uResult);
00203 
00204 BOOL FASTCALL UserSendNotifyMessage( HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam );
00205 LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd,
00206                         UINT Msg,
00207                         WPARAM wParam,
00208                         LPARAM lParam);
00209 LRESULT FASTCALL
00210 co_IntSendMessageWithCallBack(HWND hWnd,
00211                               UINT Msg,
00212                               WPARAM wParam,
00213                               LPARAM lParam,
00214                               SENDASYNCPROC CompletionCallback,
00215                               ULONG_PTR CompletionCallbackContext,
00216                               ULONG_PTR *uResult);
00217 BOOL FASTCALL
00218 co_MsqSendMessageAsync(PTHREADINFO ptiReceiver,
00219                        HWND hwnd,
00220                        UINT Msg,
00221                        WPARAM wParam,
00222                        LPARAM lParam,
00223                        SENDASYNCPROC CompletionCallback,
00224                        ULONG_PTR CompletionCallbackContext,
00225                        BOOL HasPackedLParam,
00226                        INT HookMessage);
00227 
00228 LRESULT FASTCALL IntDispatchMessage(MSG* Msg);
00229 BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags);
00230 VOID FASTCALL MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam);
00231 VOID FASTCALL co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook);
00232 BOOL FASTCALL MsqIsClkLck(LPMSG Msg, BOOL Remove);
00233 BOOL FASTCALL MsqIsDblClk(LPMSG Msg, BOOL Remove);
00234 HWND FASTCALL MsqSetStateWindow(PUSER_MESSAGE_QUEUE MessageQueue, ULONG Type, HWND hWnd);
00235 BOOL APIENTRY IntInitMessagePumpHook(VOID);
00236 BOOL APIENTRY IntUninitMessagePumpHook(VOID);
00237 
00238 LPARAM FASTCALL MsqSetMessageExtraInfo(LPARAM lParam);
00239 LPARAM FASTCALL MsqGetMessageExtraInfo(VOID);
00240 VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PVOID pWindow); /* F*(&$ headers, will be gone in the rewrite! */
00241 
00242 #define IntReferenceMessageQueue(MsgQueue) \
00243   InterlockedIncrement(&(MsgQueue)->References)
00244 
00245 #define IntDereferenceMessageQueue(MsgQueue) \
00246   do { \
00247     if(InterlockedDecrement(&(MsgQueue)->References) == 0) \
00248     { \
00249       TRACE("Free message queue 0x%x\n", (MsgQueue)); \
00250       if ((MsgQueue)->NewMessages != NULL) \
00251         ObDereferenceObject((MsgQueue)->NewMessages); \
00252       ExFreePoolWithTag((MsgQueue), USERTAG_Q); \
00253     } \
00254   } while(0)
00255 
00256 #define IS_BTN_MESSAGE(message,code) \
00257   ((message) == WM_LBUTTON##code || \
00258    (message) == WM_MBUTTON##code || \
00259    (message) == WM_RBUTTON##code || \
00260    (message) == WM_XBUTTON##code || \
00261    (message) == WM_NCLBUTTON##code || \
00262    (message) == WM_NCMBUTTON##code || \
00263    (message) == WM_NCRBUTTON##code || \
00264    (message) == WM_NCXBUTTON##code )
00265 
00266 #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
00267 #define WM_NCMOUSELAST  (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST))
00268 
00269 #define IS_MOUSE_MESSAGE(message) \
00270     ((message >= WM_NCMOUSEFIRST && message <= WM_NCMOUSELAST) || \
00271             (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST))
00272 
00273 #define IS_KBD_MESSAGE(message) \
00274     (message >= WM_KEYFIRST && message <= WM_KEYLAST)
00275 
00276 HANDLE FASTCALL IntMsqSetWakeMask(DWORD WakeMask);
00277 BOOL FASTCALL IntMsqClearWakeMask(VOID);
00278 
00279 static __inline LONG
00280 MsqCalculateMessageTime(IN PLARGE_INTEGER TickCount)
00281 {
00282     return (LONG)(TickCount->QuadPart * (KeQueryTimeIncrement() / 10000));
00283 }
00284 
00285 VOID FASTCALL IdlePing(VOID);
00286 VOID FASTCALL IdlePong(VOID);
00287 BOOL FASTCALL co_MsqReplyMessage(LRESULT);
00288 VOID FASTCALL MsqWakeQueue(PUSER_MESSAGE_QUEUE,DWORD,BOOL);
00289 VOID FASTCALL ClearMsgBitsMask(PUSER_MESSAGE_QUEUE,UINT);
00290 
00291 int UserShowCursor(BOOL bShow);
00292 PCURICON_OBJECT
00293 FASTCALL
00294 UserSetCursor(PCURICON_OBJECT NewCursor,
00295               BOOL ForceChange);
00296 
00297 DWORD APIENTRY IntGetQueueStatus(DWORD);
00298 /* EOF */

Generated on Fri May 25 2012 04:36:51 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.