Avoid infinite SendMessage recursion, just like Windows does.
[wine/multimedia.git] / include / queue.h
blob591146e50618153bccb4832af699776143fa021d
1 /*
2 * Message queues definitions
4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_QUEUE_H
22 #define __WINE_QUEUE_H
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "thread.h"
30 #define WH_NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1)
32 /* Per-queue data for the message queue
33 * Note that we currently only store the current values for
34 * Active, Capture and Focus windows currently.
35 * It might be necessary to store a pointer to the system message queue
36 * as well since windows 9x maintains per thread system message queues
38 typedef struct tagPERQUEUEDATA
40 HWND hWndFocus; /* Focus window */
41 HWND hWndActive; /* Active window */
42 HWND hWndCapture; /* Capture window */
43 INT16 nCaptureHT; /* Capture info (hit-test) */
44 ULONG ulRefCount; /* Reference count */
45 CRITICAL_SECTION cSection; /* Critical section for thread safe access */
46 } PERQUEUEDATA;
48 struct received_message_info;
50 /* Message queue */
51 typedef struct tagMESSAGEQUEUE
53 HQUEUE16 self; /* Handle to self (was: reserved) */
54 TEB* teb; /* Thread owning queue */
55 HANDLE server_queue; /* Handle to server-side queue */
56 DWORD recursion_count; /* Counter to prevent infinite SendMessage recursion */
57 struct received_message_info *receive_info; /* Info about message being currently received */
59 DWORD magic; /* magic number should be QUEUE_MAGIC */
60 DWORD lockCount; /* reference counter */
62 DWORD GetMessageTimeVal; /* Value for GetMessageTime */
63 DWORD GetMessagePosVal; /* Value for GetMessagePos */
64 DWORD GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
66 HCURSOR cursor; /* current cursor */
67 INT cursor_count; /* cursor show count */
69 HANDLE16 hCurHook; /* Current hook */
70 HANDLE16 hooks[WH_NB_HOOKS]; /* Task hooks list */
72 PERQUEUEDATA *pQData; /* pointer to (shared) PERQUEUEDATA structure */
74 } MESSAGEQUEUE;
77 #define QUEUE_MAGIC 0xD46E80AF
78 #define MAX_SENDMSG_RECURSION 64
80 /* Per queue data management methods */
81 HWND PERQDATA_GetFocusWnd( PERQUEUEDATA *pQData );
82 HWND PERQDATA_SetFocusWnd( PERQUEUEDATA *pQData, HWND hWndFocus );
83 HWND PERQDATA_GetActiveWnd( PERQUEUEDATA *pQData );
84 HWND PERQDATA_SetActiveWnd( PERQUEUEDATA *pQData, HWND hWndActive );
85 HWND PERQDATA_GetCaptureWnd( INT *hittest );
86 HWND PERQDATA_SetCaptureWnd( HWND hWndCapture, INT hittest );
88 /* Message queue management methods */
89 extern MESSAGEQUEUE *QUEUE_Current(void);
90 extern MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue );
91 extern void QUEUE_Unlock( MESSAGEQUEUE *queue );
92 extern void QUEUE_DeleteMsgQueue(void);
94 #endif /* __WINE_QUEUE_H */