1996-03-14 19:08:34 +01:00
|
|
|
/*
|
|
|
|
* Message queues definitions
|
|
|
|
*
|
|
|
|
* Copyright 1993 Alexandre Julliard
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_QUEUE_H
|
|
|
|
#define __WINE_QUEUE_H
|
|
|
|
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "wintypes.h"
|
1999-01-01 19:57:33 +01:00
|
|
|
#include "wine/winuser16.h"
|
1999-01-26 10:30:05 +01:00
|
|
|
#include "thread.h"
|
|
|
|
|
1996-03-14 19:08:34 +01:00
|
|
|
|
|
|
|
/* Message as stored in the queue (contains the extraInfo field) */
|
|
|
|
typedef struct tagQMSG
|
|
|
|
{
|
1999-01-26 10:30:05 +01:00
|
|
|
MSG32 msg;
|
1996-03-14 19:08:34 +01:00
|
|
|
DWORD extraInfo; /* Only in 3.1 */
|
1999-01-26 10:30:05 +01:00
|
|
|
|
|
|
|
struct tagQMSG *nextMsg;
|
|
|
|
struct tagQMSG *prevMsg;
|
1996-03-14 19:08:34 +01:00
|
|
|
} QMSG;
|
|
|
|
|
1999-02-18 18:34:09 +01:00
|
|
|
|
|
|
|
typedef struct tagSMSG
|
1996-09-28 20:11:01 +02:00
|
|
|
{
|
1999-02-18 18:34:09 +01:00
|
|
|
struct tagSMSG *nextProcessing; /* next SMSG in the processing list */
|
|
|
|
struct tagSMSG *nextPending; /* next SMSG in the pending list */
|
|
|
|
struct tagSMSG *nextWaiting; /* next SMSG in the waiting list */
|
|
|
|
|
|
|
|
HQUEUE16 hSrcQueue; /* sending Queue, (NULL if it didn't wait) */
|
|
|
|
HQUEUE16 hDstQueue; /* destination Queue */
|
|
|
|
|
|
|
|
HWND32 hWnd; /* destinantion window */
|
|
|
|
UINT32 msg; /* message sent */
|
|
|
|
WPARAM32 wParam; /* wParam of the sent message */
|
|
|
|
LPARAM lParam; /* lParam of the sent message */
|
|
|
|
|
|
|
|
LRESULT lResult; /* result of SendMessage */
|
|
|
|
WORD flags; /* see below SMSG_XXXX */
|
|
|
|
} SMSG;
|
|
|
|
|
|
|
|
|
|
|
|
/* SMSG -> flags values */
|
|
|
|
/* set when lResult contains a good value */
|
|
|
|
#define SMSG_HAVE_RESULT 0x0001
|
|
|
|
/* protection for multiple call to ReplyMessage16() */
|
|
|
|
#define SMSG_ALREADY_REPLIED 0x0002
|
|
|
|
/* use with EARLY_REPLY for forcing the receiver to clean SMSG */
|
|
|
|
#define SMSG_RECEIVER_CLEANS 0x0010
|
|
|
|
/* used with EARLY_REPLY to indicate to sender, receiver is done with SMSG */
|
|
|
|
#define SMSG_RECEIVED 0x0020
|
|
|
|
/* set in ReceiveMessage() to indicate it's not an early reply */
|
|
|
|
#define SMSG_SENDING_REPLY 0x0040
|
|
|
|
/* set when ReplyMessage16() is called by the application */
|
|
|
|
#define SMSG_EARLY_REPLY 0x0080
|
|
|
|
/* set when sender is Win32 thread */
|
|
|
|
#define SMSG_WIN32 0x1000
|
|
|
|
/* set when sender is a unnicode thread */
|
|
|
|
#define SMSG_UNICODE 0x2000
|
1996-09-28 20:11:01 +02:00
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
/* Per-queue data for the message queue
|
|
|
|
* Note that we currently only store the current values for
|
|
|
|
* Active, Capture and Focus windows currently.
|
|
|
|
* It might be necessary to store a pointer to the system message queue
|
|
|
|
* as well since windows 9x maintains per thread system message queues
|
|
|
|
*/
|
1999-01-26 10:30:05 +01:00
|
|
|
typedef struct tagPERQUEUEDATA
|
|
|
|
{
|
1999-02-05 11:37:53 +01:00
|
|
|
HWND32 hWndFocus; /* Focus window */
|
|
|
|
HWND32 hWndActive; /* Active window */
|
|
|
|
HWND32 hWndCapture; /* Capture window */
|
|
|
|
INT16 nCaptureHT; /* Capture info (hit-test) */
|
|
|
|
ULONG ulRefCount; /* Reference count */
|
|
|
|
CRITICAL_SECTION cSection; /* Critical section for thread safe access */
|
1999-01-26 10:30:05 +01:00
|
|
|
} PERQUEUEDATA;
|
1996-03-14 19:08:34 +01:00
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
/* Message queue */
|
1996-03-14 19:08:34 +01:00
|
|
|
typedef struct tagMESSAGEQUEUE
|
|
|
|
{
|
1999-02-05 11:37:53 +01:00
|
|
|
HQUEUE16 next; /* Next queue */
|
1999-01-26 10:30:05 +01:00
|
|
|
HQUEUE16 self; /* Handle to self (was: reserved) */
|
|
|
|
THDB* thdb; /* Thread owning queue */
|
|
|
|
HANDLE32 hEvent; /* Event handle */
|
|
|
|
CRITICAL_SECTION cSection; /* Queue access critical section */
|
|
|
|
|
1999-01-28 11:54:11 +01:00
|
|
|
DWORD magic; /* magic number should be QUEUE_MAGIC */
|
|
|
|
DWORD lockCount; /* reference counter */
|
1999-01-26 10:30:05 +01:00
|
|
|
WORD wWinVersion; /* Expected Windows version */
|
|
|
|
|
|
|
|
WORD msgCount; /* Number of waiting messages */
|
|
|
|
QMSG* firstMsg; /* First message in linked list */
|
|
|
|
QMSG* lastMsg; /* Last message in linked list */
|
|
|
|
|
|
|
|
WORD wPostQMsg; /* PostQuitMessage flag */
|
|
|
|
WORD wExitCode; /* PostQuitMessage exit code */
|
|
|
|
WORD wPaintCount; /* Number of WM_PAINT needed */
|
|
|
|
WORD wTimerCount; /* Number of timers for this task */
|
|
|
|
|
|
|
|
WORD changeBits; /* Changed wake-up bits */
|
|
|
|
WORD wakeBits; /* Queue wake-up bits */
|
|
|
|
WORD wakeMask; /* Queue wake-up mask */
|
|
|
|
|
|
|
|
DWORD GetMessageTimeVal; /* Value for GetMessageTime */
|
|
|
|
DWORD GetMessagePosVal; /* Value for GetMessagePos */
|
|
|
|
DWORD GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
|
|
|
|
|
1999-02-18 18:34:09 +01:00
|
|
|
SMSG* smWaiting; /* SendMessage waiting for reply */
|
|
|
|
SMSG* smProcessing; /* SendMessage currently being processed */
|
|
|
|
SMSG* smPending; /* SendMessage waiting to be received */
|
1999-01-26 10:30:05 +01:00
|
|
|
|
|
|
|
HANDLE16 hCurHook; /* Current hook */
|
|
|
|
HANDLE16 hooks[WH_NB_HOOKS]; /* Task hooks list */
|
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
PERQUEUEDATA *pQData; /* pointer to (shared) PERQUEUEDATA structure */
|
1999-01-26 10:30:05 +01:00
|
|
|
|
1996-03-14 19:08:34 +01:00
|
|
|
} MESSAGEQUEUE;
|
|
|
|
|
|
|
|
|
1996-09-28 20:11:01 +02:00
|
|
|
/* Extra (undocumented) queue wake bits - see "Undoc. Windows" */
|
|
|
|
#define QS_SMRESULT 0x8000 /* Queue has a SendMessage() result */
|
1996-05-28 20:54:58 +02:00
|
|
|
|
1999-02-18 18:34:09 +01:00
|
|
|
/* Types of SMSG stack */
|
|
|
|
#define SM_PROCESSING_LIST 1 /* list of SM currently being processed */
|
|
|
|
#define SM_PENDING_LIST 2 /* list of SM wating to be received */
|
|
|
|
#define SM_WAITING_LIST 3 /* list of SM waiting for reply */
|
1996-05-28 20:54:58 +02:00
|
|
|
|
1999-01-28 11:54:11 +01:00
|
|
|
#define QUEUE_MAGIC 0xD46E80AF
|
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
/* Per queue data management methods */
|
1999-02-19 17:29:05 +01:00
|
|
|
PERQUEUEDATA* PERQDATA_CreateInstance( void );
|
1999-02-05 11:37:53 +01:00
|
|
|
ULONG PERQDATA_Addref( PERQUEUEDATA* pQData );
|
|
|
|
ULONG PERQDATA_Release( PERQUEUEDATA* pQData );
|
|
|
|
HWND32 PERQDATA_GetFocusWnd( PERQUEUEDATA *pQData );
|
|
|
|
HWND32 PERQDATA_SetFocusWnd( PERQUEUEDATA *pQData, HWND32 hWndFocus );
|
|
|
|
HWND32 PERQDATA_GetActiveWnd( PERQUEUEDATA *pQData );
|
|
|
|
HWND32 PERQDATA_SetActiveWnd( PERQUEUEDATA *pQData, HWND32 hWndActive );
|
|
|
|
HWND32 PERQDATA_GetCaptureWnd( PERQUEUEDATA *pQData );
|
|
|
|
HWND32 PERQDATA_SetCaptureWnd( PERQUEUEDATA *pQData, HWND32 hWndCapture );
|
|
|
|
INT16 PERQDATA_GetCaptureInfo( PERQUEUEDATA *pQData );
|
|
|
|
INT16 PERQDATA_SetCaptureInfo( PERQUEUEDATA *pQData, INT16 nCaptureHT );
|
|
|
|
|
|
|
|
/* Message queue management methods */
|
1999-01-28 11:54:11 +01:00
|
|
|
extern MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue );
|
|
|
|
extern void QUEUE_Unlock( MESSAGEQUEUE *queue );
|
1996-07-12 21:02:39 +02:00
|
|
|
extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
|
1996-03-14 19:08:34 +01:00
|
|
|
extern void QUEUE_WalkQueues(void);
|
1997-05-25 15:58:18 +02:00
|
|
|
extern BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue );
|
|
|
|
extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
|
1996-03-14 19:08:34 +01:00
|
|
|
extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
|
1996-05-28 20:54:58 +02:00
|
|
|
extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
|
1996-06-16 18:16:05 +02:00
|
|
|
extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
|
1996-05-28 20:54:58 +02:00
|
|
|
extern void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue );
|
|
|
|
extern void QUEUE_WaitBits( WORD bits );
|
1996-07-12 21:02:39 +02:00
|
|
|
extern void QUEUE_IncPaintCount( HQUEUE16 hQueue );
|
|
|
|
extern void QUEUE_DecPaintCount( HQUEUE16 hQueue );
|
|
|
|
extern void QUEUE_IncTimerCount( HQUEUE16 hQueue );
|
|
|
|
extern void QUEUE_DecTimerCount( HQUEUE16 hQueue );
|
1999-02-09 16:35:12 +01:00
|
|
|
extern BOOL32 QUEUE_CreateSysMsgQueue( int size );
|
1996-07-12 21:02:39 +02:00
|
|
|
extern BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
|
|
|
|
extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
|
1999-01-26 10:30:05 +01:00
|
|
|
extern BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG32 * msg, DWORD extraInfo );
|
|
|
|
extern QMSG* QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND32 hwnd,
|
1996-03-14 19:08:34 +01:00
|
|
|
int first, int last );
|
1999-01-26 10:30:05 +01:00
|
|
|
extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, QMSG *qmsg );
|
1999-02-18 18:34:09 +01:00
|
|
|
extern SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg );
|
|
|
|
extern BOOL32 QUEUE_AddSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg );
|
1996-03-14 19:08:34 +01:00
|
|
|
extern void hardware_event( WORD message, WORD wParam, LONG lParam,
|
|
|
|
int xPos, int yPos, DWORD time, DWORD extraInfo );
|
|
|
|
|
1998-12-24 16:15:00 +01:00
|
|
|
extern HQUEUE16 WINAPI InitThreadInput( WORD unknown, WORD flags );
|
|
|
|
|
1996-03-14 19:08:34 +01:00
|
|
|
#endif /* __WINE_QUEUE_H */
|