Removed the MESSAGEQUEUE structure, and store the corresponding
[wine] / dlls / user / user_private.h
1 /*
2  * USER private definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_USER_PRIVATE_H
22 #define __WINE_USER_PRIVATE_H
23
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "winreg.h"
30 #include "winternl.h"
31 #include "local.h"
32
33 extern WORD USER_HeapSel;
34
35 #define USER_HEAP_ALLOC(size) \
36             ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ))
37 #define USER_HEAP_REALLOC(handle,size) \
38             ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED ))
39 #define USER_HEAP_FREE(handle) \
40             LOCAL_Free( USER_HeapSel, LOWORD(handle) )
41 #define USER_HEAP_LIN_ADDR(handle)  \
42          ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL)
43
44 #define GET_WORD(ptr)  (*(const WORD *)(ptr))
45 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
46
47 /* internal messages codes */
48 enum wine_internal_message
49 {
50     WM_WINE_DESTROYWINDOW = 0x80000000,
51     WM_WINE_SETWINDOWPOS,
52     WM_WINE_SHOWWINDOW,
53     WM_WINE_SETPARENT,
54     WM_WINE_SETWINDOWLONG,
55     WM_WINE_ENABLEWINDOW,
56     WM_WINE_SETACTIVEWINDOW,
57     WM_WINE_KEYBOARD_LL_HOOK,
58     WM_WINE_MOUSE_LL_HOOK,
59     WM_WINE_FIRST_DRIVER_MSG = 0x80001000,  /* range of messages reserved for the USER driver */
60     WM_WINE_LAST_DRIVER_MSG = 0x80001fff
61 };
62
63 struct tagCURSORICONINFO;
64
65 typedef struct tagUSER_DRIVER {
66     /* keyboard functions */
67     HKL    (*pActivateKeyboardLayout)(HKL, UINT);
68     void   (*pBeep)(void);
69     SHORT  (*pGetAsyncKeyState)(INT);
70     INT    (*pGetKeyNameText)(LONG, LPWSTR, INT);
71     HKL    (*pGetKeyboardLayout)(DWORD);
72     UINT   (*pGetKeyboardLayoutList)(INT, HKL *);
73     BOOL   (*pGetKeyboardLayoutName)(LPWSTR);
74     HKL    (*pLoadKeyboardLayout)(LPCWSTR, UINT);
75     UINT   (*pMapVirtualKeyEx)(UINT, UINT, HKL);
76     UINT   (*pSendInput)(UINT, LPINPUT, int);
77     INT    (*pToUnicodeEx)(UINT, UINT, LPBYTE, LPWSTR, int, UINT, HKL);
78     BOOL   (*pUnloadKeyboardLayout)(HKL);
79     SHORT  (*pVkKeyScanEx)(WCHAR, HKL);
80     /* mouse functions */
81     void   (*pSetCursor)(struct tagCURSORICONINFO *);
82     BOOL   (*pGetCursorPos)(LPPOINT);
83     BOOL   (*pSetCursorPos)(INT,INT);
84     /* screen saver functions */
85     BOOL   (*pGetScreenSaveActive)(void);
86     void   (*pSetScreenSaveActive)(BOOL);
87     /* clipboard functions */
88     void   (*pAcquireClipboard)(HWND);                     /* Acquire selection */
89     BOOL   (*pCountClipboardFormats)(void);                /* Count available clipboard formats */
90     void   (*pEmptyClipboard)(BOOL);                       /* Empty clipboard data */
91     BOOL   (*pEndClipboardUpdate)(void);                   /* End clipboard update */
92     BOOL   (*pEnumClipboardFormats)(UINT);                 /* Enumerate clipboard formats */
93     BOOL   (*pGetClipboardData)(UINT, HANDLE16*, HANDLE*); /* Get specified selection data */
94     BOOL   (*pGetClipboardFormatName)(UINT, LPWSTR, UINT); /* Get a clipboard format name */
95     BOOL   (*pIsClipboardFormatAvailable)(UINT);           /* Check if specified format is available */
96     INT    (*pRegisterClipboardFormat)(LPCWSTR);           /* Register a clipboard format */
97     void   (*pResetSelectionOwner)(HWND, BOOL);
98     BOOL   (*pSetClipboardData)(UINT, HANDLE16, HANDLE, BOOL);   /* Set specified selection data */
99     /* display modes */
100     LONG   (*pChangeDisplaySettingsExW)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
101     BOOL   (*pEnumDisplaySettingsExW)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
102     /* windowing functions */
103     BOOL   (*pCreateWindow)(HWND,CREATESTRUCTA*,BOOL);
104     BOOL   (*pDestroyWindow)(HWND);
105     HDC    (*pGetDCEx)(HWND,HRGN,DWORD);
106     DWORD  (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
107     BOOL   (*pReleaseDC)(HWND,HDC,BOOL);
108     BOOL   (*pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
109     void   (*pSetFocus)(HWND);
110     HWND   (*pSetParent)(HWND,HWND);
111     BOOL   (*pSetWindowPos)(WINDOWPOS *);
112     int    (*pSetWindowRgn)(HWND,HRGN,BOOL);
113     void   (*pSetWindowIcon)(HWND,UINT,HICON);
114     void   (*pSetWindowStyle)(HWND,DWORD);
115     BOOL   (*pSetWindowText)(HWND,LPCWSTR);
116     BOOL   (*pShowWindow)(HWND,INT);
117     void   (*pSysCommandSizeMove)(HWND,WPARAM);
118     HWND   (*pWindowFromDC)(HDC);
119     LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
120 } USER_DRIVER;
121
122 extern USER_DRIVER USER_Driver;
123
124 struct received_message_info;
125 struct hook16_queue_info;
126
127 /* this is the structure stored in TEB->Win32ClientInfo */
128 /* no attempt is made to keep the layout compatible with the Windows one */
129 struct user_thread_info
130 {
131     HANDLE                        server_queue;           /* 00 Handle to server-side queue */
132     DWORD                         recursion_count;        /* 04 SendMessage recursion counter */
133     HHOOK                         hook;                   /* 08 Current hook */
134     struct received_message_info *receive_info;           /* 0c Message being currently received */
135     struct hook16_queue_info     *hook16_info;            /* 10 Opaque pointer for 16-bit hook support */
136     DWORD                         GetMessageTimeVal;      /* 14 Value for GetMessageTime */
137     DWORD                         GetMessagePosVal;       /* 18 Value for GetMessagePos */
138     DWORD                         GetMessageExtraInfoVal; /* 1c Value for GetMessageExtraInfo */
139     HCURSOR                       cursor;                 /* 20 Current cursor */
140     INT                           cursor_count;           /* 24 Cursor show count */
141                                                           /* 28-7c Available for more data */
142 };
143
144 static inline struct user_thread_info *get_user_thread_info(void)
145 {
146     return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
147 }
148
149 extern HMODULE user32_module;
150 extern DWORD USER16_AlertableWait;
151 extern HBRUSH SYSCOLOR_55AABrush;
152
153 extern BOOL CLIPBOARD_ReleaseOwner(void);
154 extern BOOL FOCUS_MouseActivate( HWND hwnd );
155 extern BOOL HOOK_IsHooked( INT id );
156 extern void SYSCOLOR_Init(void);
157 extern HPEN SYSCOLOR_GetPen( INT index );
158 extern void SYSPARAMS_Init(void);
159 extern void USER_CheckNotLock(void);
160 extern BOOL USER_IsExitingThread( DWORD tid );
161
162 /* HANDLE16 <-> HANDLE conversions */
163 #define HCURSOR_16(h32)    (LOWORD(h32))
164 #define HICON_16(h32)      (LOWORD(h32))
165 #define HINSTANCE_16(h32)  (LOWORD(h32))
166
167 #define HCURSOR_32(h16)    ((HCURSOR)(ULONG_PTR)(h16))
168 #define HICON_32(h16)      ((HICON)(ULONG_PTR)(h16))
169 #define HINSTANCE_32(h16)  ((HINSTANCE)(ULONG_PTR)(h16))
170 #define HMODULE_32(h16)    ((HMODULE)(ULONG_PTR)(h16))
171
172 #endif /* __WINE_USER_PRIVATE_H */