| 1 | /* $Id: queue.h,v 1.1 1999-05-24 20:19:18 ktk Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Message queues definitions
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1993 Alexandre Julliard
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | #ifndef __WINE_QUEUE_H
|
|---|
| 10 | #define __WINE_QUEUE_H
|
|---|
| 11 |
|
|---|
| 12 | #include "windef.h"
|
|---|
| 13 | #include "winuser.h"
|
|---|
| 14 | #include "thread.h"
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | /* Message as stored in the queue (contains the extraInfo field) */
|
|---|
| 18 | typedef struct tagQMSG
|
|---|
| 19 | {
|
|---|
| 20 | MSG msg;
|
|---|
| 21 | DWORD extraInfo; /* Only in 3.1 */
|
|---|
| 22 |
|
|---|
| 23 | struct tagQMSG *nextMsg;
|
|---|
| 24 | struct tagQMSG *prevMsg;
|
|---|
| 25 | } QMSG;
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | typedef struct tagSMSG
|
|---|
| 29 | {
|
|---|
| 30 | struct tagSMSG *nextProcessing; /* next SMSG in the processing list */
|
|---|
| 31 | struct tagSMSG *nextPending; /* next SMSG in the pending list */
|
|---|
| 32 | struct tagSMSG *nextWaiting; /* next SMSG in the waiting list */
|
|---|
| 33 |
|
|---|
| 34 | HQUEUE16 hSrcQueue; /* sending Queue, (NULL if it didn't wait) */
|
|---|
| 35 | HQUEUE16 hDstQueue; /* destination Queue */
|
|---|
| 36 |
|
|---|
| 37 | HWND hWnd; /* destinantion window */
|
|---|
| 38 | UINT msg; /* message sent */
|
|---|
| 39 | WPARAM wParam; /* wParam of the sent message */
|
|---|
| 40 | LPARAM lParam; /* lParam of the sent message */
|
|---|
| 41 |
|
|---|
| 42 | LRESULT lResult; /* result of SendMessage */
|
|---|
| 43 | WORD flags; /* see below SMSG_XXXX */
|
|---|
| 44 | } SMSG;
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | /* SMSG -> flags values */
|
|---|
| 48 | /* set when lResult contains a good value */
|
|---|
| 49 | #define SMSG_HAVE_RESULT 0x0001
|
|---|
| 50 | /* protection for multiple call to ReplyMessage16() */
|
|---|
| 51 | #define SMSG_ALREADY_REPLIED 0x0002
|
|---|
| 52 | /* use with EARLY_REPLY for forcing the receiver to clean SMSG */
|
|---|
| 53 | #define SMSG_RECEIVER_CLEANS 0x0010
|
|---|
| 54 | /* used with EARLY_REPLY to indicate to sender, receiver is done with SMSG */
|
|---|
| 55 | #define SMSG_RECEIVED 0x0020
|
|---|
| 56 | /* set in ReceiveMessage() to indicate it's not an early reply */
|
|---|
| 57 | #define SMSG_SENDING_REPLY 0x0040
|
|---|
| 58 | /* set when ReplyMessage16() is called by the application */
|
|---|
| 59 | #define SMSG_EARLY_REPLY 0x0080
|
|---|
| 60 | /* set when sender is Win32 thread */
|
|---|
| 61 | #define SMSG_WIN32 0x1000
|
|---|
| 62 | /* set when sender is a unnicode thread */
|
|---|
| 63 | #define SMSG_UNICODE 0x2000
|
|---|
| 64 |
|
|---|
| 65 | /* Per-queue data for the message queue
|
|---|
| 66 | * Note that we currently only store the current values for
|
|---|
| 67 | * Active, Capture and Focus windows currently.
|
|---|
| 68 | * It might be necessary to store a pointer to the system message queue
|
|---|
| 69 | * as well since windows 9x maintains per thread system message queues
|
|---|
| 70 | */
|
|---|
| 71 | typedef struct tagPERQUEUEDATA
|
|---|
| 72 | {
|
|---|
| 73 | HWND hWndFocus; /* Focus window */
|
|---|
| 74 | HWND hWndActive; /* Active window */
|
|---|
| 75 | HWND hWndCapture; /* Capture window */
|
|---|
| 76 | INT16 nCaptureHT; /* Capture info (hit-test) */
|
|---|
| 77 | ULONG ulRefCount; /* Reference count */
|
|---|
| 78 | CRITICAL_SECTION cSection; /* Critical section for thread safe access */
|
|---|
| 79 | } PERQUEUEDATA;
|
|---|
| 80 |
|
|---|
| 81 | /* Message queue */
|
|---|
| 82 | typedef struct tagMESSAGEQUEUE
|
|---|
| 83 | {
|
|---|
| 84 | HQUEUE16 next; /* Next queue */
|
|---|
| 85 | HQUEUE16 self; /* Handle to self (was: reserved) */
|
|---|
| 86 | THDB* thdb; /* Thread owning queue */
|
|---|
| 87 | HANDLE hEvent; /* Event handle */
|
|---|
| 88 | CRITICAL_SECTION cSection; /* Queue access critical section */
|
|---|
| 89 |
|
|---|
| 90 | DWORD magic; /* magic number should be QUEUE_MAGIC */
|
|---|
| 91 | DWORD lockCount; /* reference counter */
|
|---|
| 92 | WORD wWinVersion; /* Expected Windows version */
|
|---|
| 93 |
|
|---|
| 94 | WORD msgCount; /* Number of waiting messages */
|
|---|
| 95 | QMSG* firstMsg; /* First message in linked list */
|
|---|
| 96 | QMSG* lastMsg; /* Last message in linked list */
|
|---|
| 97 |
|
|---|
| 98 | WORD wPostQMsg; /* PostQuitMessage flag */
|
|---|
| 99 | WORD wExitCode; /* PostQuitMessage exit code */
|
|---|
| 100 | WORD wPaintCount; /* Number of WM_PAINT needed */
|
|---|
| 101 | WORD wTimerCount; /* Number of timers for this task */
|
|---|
| 102 |
|
|---|
| 103 | WORD changeBits; /* Changed wake-up bits */
|
|---|
| 104 | WORD wakeBits; /* Queue wake-up bits */
|
|---|
| 105 | WORD wakeMask; /* Queue wake-up mask */
|
|---|
| 106 |
|
|---|
| 107 | DWORD GetMessageTimeVal; /* Value for GetMessageTime */
|
|---|
| 108 | DWORD GetMessagePosVal; /* Value for GetMessagePos */
|
|---|
| 109 | DWORD GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
|
|---|
| 110 |
|
|---|
| 111 | SMSG* smWaiting; /* SendMessage waiting for reply */
|
|---|
| 112 | SMSG* smProcessing; /* SendMessage currently being processed */
|
|---|
| 113 | SMSG* smPending; /* SendMessage waiting to be received */
|
|---|
| 114 |
|
|---|
| 115 | HANDLE16 hCurHook; /* Current hook */
|
|---|
| 116 | HANDLE16 hooks[WH_NB_HOOKS]; /* Task hooks list */
|
|---|
| 117 |
|
|---|
| 118 | PERQUEUEDATA *pQData; /* pointer to (shared) PERQUEUEDATA structure */
|
|---|
| 119 |
|
|---|
| 120 | } MESSAGEQUEUE;
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 | /* Extra (undocumented) queue wake bits - see "Undoc. Windows" */
|
|---|
| 124 | #define QS_SMRESULT 0x8000 /* Queue has a SendMessage() result */
|
|---|
| 125 |
|
|---|
| 126 | /* Types of SMSG stack */
|
|---|
| 127 | #define SM_PROCESSING_LIST 1 /* list of SM currently being processed */
|
|---|
| 128 | #define SM_PENDING_LIST 2 /* list of SM wating to be received */
|
|---|
| 129 | #define SM_WAITING_LIST 3 /* list of SM waiting for reply */
|
|---|
| 130 |
|
|---|
| 131 | #define QUEUE_MAGIC 0xD46E80AF
|
|---|
| 132 |
|
|---|
| 133 | /* Per queue data management methods */
|
|---|
| 134 | PERQUEUEDATA* PERQDATA_CreateInstance( void );
|
|---|
| 135 | ULONG PERQDATA_Addref( PERQUEUEDATA* pQData );
|
|---|
| 136 | ULONG PERQDATA_Release( PERQUEUEDATA* pQData );
|
|---|
| 137 | HWND PERQDATA_GetFocusWnd( PERQUEUEDATA *pQData );
|
|---|
| 138 | HWND PERQDATA_SetFocusWnd( PERQUEUEDATA *pQData, HWND hWndFocus );
|
|---|
| 139 | HWND PERQDATA_GetActiveWnd( PERQUEUEDATA *pQData );
|
|---|
| 140 | HWND PERQDATA_SetActiveWnd( PERQUEUEDATA *pQData, HWND hWndActive );
|
|---|
| 141 | HWND PERQDATA_GetCaptureWnd( PERQUEUEDATA *pQData );
|
|---|
| 142 | HWND PERQDATA_SetCaptureWnd( PERQUEUEDATA *pQData, HWND hWndCapture );
|
|---|
| 143 | INT16 PERQDATA_GetCaptureInfo( PERQUEUEDATA *pQData );
|
|---|
| 144 | INT16 PERQDATA_SetCaptureInfo( PERQUEUEDATA *pQData, INT16 nCaptureHT );
|
|---|
| 145 |
|
|---|
| 146 | /* Message queue management methods */
|
|---|
| 147 | extern MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue );
|
|---|
| 148 | extern void QUEUE_Unlock( MESSAGEQUEUE *queue );
|
|---|
| 149 | extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
|
|---|
| 150 | extern void QUEUE_WalkQueues(void);
|
|---|
| 151 | extern BOOL QUEUE_IsExitingQueue( HQUEUE16 hQueue );
|
|---|
| 152 | extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
|
|---|
| 153 | extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
|
|---|
| 154 | extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
|
|---|
| 155 | extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
|
|---|
| 156 | extern void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue );
|
|---|
| 157 | extern int QUEUE_WaitBits( WORD bits, DWORD timeout );
|
|---|
| 158 | extern void QUEUE_IncPaintCount( HQUEUE16 hQueue );
|
|---|
| 159 | extern void QUEUE_DecPaintCount( HQUEUE16 hQueue );
|
|---|
| 160 | extern void QUEUE_IncTimerCount( HQUEUE16 hQueue );
|
|---|
| 161 | extern void QUEUE_DecTimerCount( HQUEUE16 hQueue );
|
|---|
| 162 | extern BOOL QUEUE_CreateSysMsgQueue( int size );
|
|---|
| 163 | extern BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
|
|---|
| 164 | extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
|
|---|
| 165 | extern BOOL QUEUE_AddMsg( HQUEUE16 hQueue, MSG * msg, DWORD extraInfo );
|
|---|
| 166 | extern QMSG* QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND hwnd,
|
|---|
| 167 | int first, int last );
|
|---|
| 168 | extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, QMSG *qmsg );
|
|---|
| 169 | extern SMSG *QUEUE_RemoveSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg );
|
|---|
| 170 | extern BOOL QUEUE_AddSMSG( MESSAGEQUEUE *queue, int list, SMSG *smsg );
|
|---|
| 171 | extern void hardware_event( WORD message, WORD wParam, LONG lParam,
|
|---|
| 172 | int xPos, int yPos, DWORD time, DWORD extraInfo );
|
|---|
| 173 |
|
|---|
| 174 | extern HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags );
|
|---|
| 175 |
|
|---|
| 176 | #endif /* __WINE_QUEUE_H */
|
|---|