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