winecoreaudio: Remove some unused structure fields.
[wine] / dlls / user32 / 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 "wine/windef16.h"
32 #include "wine/winbase16.h"
33
34 extern WORD USER_HeapSel DECLSPEC_HIDDEN;
35
36 static inline HLOCAL16 LOCAL_Alloc( HANDLE16 ds, UINT16 flags, WORD size )
37 {
38     STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved));
39     HANDLE16 oldDS = stack16->ds;
40     HLOCAL16 ret;
41
42     stack16->ds = ds;
43     ret = LocalAlloc16 (flags, size);
44     stack16->ds = oldDS;
45     return ret;
46 }
47
48 static inline  HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, UINT16 flags )
49 {
50     STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved));
51     HANDLE16 oldDS = stack16->ds;
52     HLOCAL16 ret;
53
54     stack16->ds = ds;
55     ret = LocalReAlloc16 (handle, size, flags);
56     stack16->ds = oldDS;
57     return ret;
58 }
59
60 static inline HLOCAL16 LOCAL_Free( HANDLE16 ds, HLOCAL16 handle )
61 {
62     STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved));
63     HANDLE16 oldDS = stack16->ds;
64     HLOCAL16 ret;
65
66     stack16->ds = ds;
67     ret = LocalFree16 (handle);
68     stack16->ds = oldDS;
69     return ret;
70 }
71
72 #define USER_HEAP_ALLOC(size) \
73             ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ))
74 #define USER_HEAP_REALLOC(handle,size) \
75             ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED ))
76 #define USER_HEAP_FREE(handle) \
77             LOCAL_Free( USER_HeapSel, LOWORD(handle) )
78 #define USER_HEAP_LIN_ADDR(handle)  \
79          ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL)
80
81 #define GET_WORD(ptr)  (*(const WORD *)(ptr))
82 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
83
84 #define WM_SYSTIMER         0x0118
85 #define WM_POPUPSYSTEMMENU  0x0313
86
87 /* internal messages codes */
88 enum wine_internal_message
89 {
90     WM_WINE_DESTROYWINDOW = 0x80000000,
91     WM_WINE_SETWINDOWPOS,
92     WM_WINE_SHOWWINDOW,
93     WM_WINE_SETPARENT,
94     WM_WINE_SETWINDOWLONG,
95     WM_WINE_ENABLEWINDOW,
96     WM_WINE_SETACTIVEWINDOW,
97     WM_WINE_KEYBOARD_LL_HOOK,
98     WM_WINE_MOUSE_LL_HOOK,
99     WM_WINE_FIRST_DRIVER_MSG = 0x80001000,  /* range of messages reserved for the USER driver */
100     WM_WINE_LAST_DRIVER_MSG = 0x80001fff
101 };
102
103 struct tagCURSORICONINFO;
104
105 typedef struct tagUSER_DRIVER {
106     /* keyboard functions */
107     HKL    (CDECL *pActivateKeyboardLayout)(HKL, UINT);
108     void   (CDECL *pBeep)(void);
109     SHORT  (CDECL *pGetAsyncKeyState)(INT);
110     INT    (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT);
111     HKL    (CDECL *pGetKeyboardLayout)(DWORD);
112     BOOL   (CDECL *pGetKeyboardLayoutName)(LPWSTR);
113     HKL    (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT);
114     UINT   (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL);
115     UINT   (CDECL *pSendInput)(UINT, LPINPUT, int);
116     INT    (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL);
117     BOOL   (CDECL *pUnloadKeyboardLayout)(HKL);
118     SHORT  (CDECL *pVkKeyScanEx)(WCHAR, HKL);
119     /* mouse functions */
120     void   (CDECL *pSetCursor)(struct tagCURSORICONINFO *);
121     BOOL   (CDECL *pGetCursorPos)(LPPOINT);
122     BOOL   (CDECL *pSetCursorPos)(INT,INT);
123     BOOL   (CDECL *pClipCursor)(LPCRECT);
124     /* screen saver functions */
125     BOOL   (CDECL *pGetScreenSaveActive)(void);
126     void   (CDECL *pSetScreenSaveActive)(BOOL);
127     /* clipboard functions */
128     INT    (CDECL *pAcquireClipboard)(HWND);                     /* Acquire selection */
129     BOOL   (CDECL *pCountClipboardFormats)(void);                /* Count available clipboard formats */
130     void   (CDECL *pEmptyClipboard)(BOOL);                       /* Empty clipboard data */
131     void   (CDECL *pEndClipboardUpdate)(void);                   /* End clipboard update */
132     UINT   (CDECL *pEnumClipboardFormats)(UINT);                 /* Enumerate clipboard formats */
133     BOOL   (CDECL *pGetClipboardData)(UINT, HANDLE16*, HANDLE*); /* Get specified selection data */
134     INT    (CDECL *pGetClipboardFormatName)(UINT, LPWSTR, UINT); /* Get a clipboard format name */
135     BOOL   (CDECL *pIsClipboardFormatAvailable)(UINT);           /* Check if specified format is available */
136     UINT   (CDECL *pRegisterClipboardFormat)(LPCWSTR);           /* Register a clipboard format */
137     BOOL   (CDECL *pSetClipboardData)(UINT, HANDLE16, HANDLE, BOOL);   /* Set specified selection data */
138     /* display modes */
139     LONG   (CDECL *pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
140     BOOL   (CDECL *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
141     BOOL   (CDECL *pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
142     BOOL   (CDECL *pGetMonitorInfo)(HMONITOR,MONITORINFO*);
143     /* windowing functions */
144     BOOL   (CDECL *pCreateDesktopWindow)(HWND);
145     BOOL   (CDECL *pCreateWindow)(HWND);
146     void   (CDECL *pDestroyWindow)(HWND);
147     void   (CDECL *pGetDC)(HDC,HWND,HWND,const RECT *,const RECT *,DWORD);
148     DWORD  (CDECL *pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
149     void   (CDECL *pReleaseDC)(HWND,HDC);
150     BOOL   (CDECL *pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
151     void   (CDECL *pSetCapture)(HWND,UINT);
152     void   (CDECL *pSetFocus)(HWND);
153     void   (CDECL *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
154     void   (CDECL *pSetParent)(HWND,HWND,HWND);
155     int    (CDECL *pSetWindowRgn)(HWND,HRGN,BOOL);
156     void   (CDECL *pSetWindowIcon)(HWND,UINT,HICON);
157     void   (CDECL *pSetWindowStyle)(HWND,INT,STYLESTRUCT*);
158     void   (CDECL *pSetWindowText)(HWND,LPCWSTR);
159     UINT   (CDECL *pShowWindow)(HWND,INT,RECT*,UINT);
160     LRESULT (CDECL *pSysCommand)(HWND,WPARAM,LPARAM);
161     LRESULT (CDECL *pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
162     void   (CDECL *pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *);
163     void   (CDECL *pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,const RECT *);
164 } USER_DRIVER;
165
166 extern const USER_DRIVER *USER_Driver DECLSPEC_HIDDEN;
167
168 extern void USER_unload_driver(void) DECLSPEC_HIDDEN;
169
170 struct received_message_info;
171 struct hook16_queue_info;
172
173 /* type of message-sending functions that need special WM_CHAR handling */
174 enum wm_char_mapping
175 {
176     WMCHAR_MAP_POSTMESSAGE,
177     WMCHAR_MAP_SENDMESSAGE,
178     WMCHAR_MAP_SENDMESSAGETIMEOUT,
179     WMCHAR_MAP_RECVMESSAGE,
180     WMCHAR_MAP_DISPATCHMESSAGE,
181     WMCHAR_MAP_CALLWINDOWPROC,
182     WMCHAR_MAP_COUNT,
183     WMCHAR_MAP_NOMAPPING = WMCHAR_MAP_COUNT
184 };
185
186 /* data to store state for A/W mappings of WM_CHAR */
187 struct wm_char_mapping_data
188 {
189     BYTE lead_byte[WMCHAR_MAP_COUNT];
190     MSG  get_msg;
191 };
192
193 /* this is the structure stored in TEB->Win32ClientInfo */
194 /* no attempt is made to keep the layout compatible with the Windows one */
195 struct user_thread_info
196 {
197     HANDLE                        server_queue;           /* Handle to server-side queue */
198     DWORD                         recursion_count;        /* SendMessage recursion counter */
199     BOOL                          hook_unicode;           /* Is current hook unicode? */
200     HHOOK                         hook;                   /* Current hook */
201     struct received_message_info *receive_info;           /* Message being currently received */
202     struct hook16_queue_info     *hook16_info;            /* Opaque pointer for 16-bit hook support */
203     struct wm_char_mapping_data  *wmchar_data;            /* Data for WM_CHAR mappings */
204     DWORD                         GetMessageTimeVal;      /* Value for GetMessageTime */
205     DWORD                         GetMessagePosVal;       /* Value for GetMessagePos */
206     ULONG_PTR                     GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
207     HCURSOR                       cursor;                 /* Current cursor */
208     INT                           cursor_count;           /* Cursor show count */
209     UINT                          active_hooks;           /* Bitmap of active hooks */
210     HWND                          top_window;             /* Desktop window */
211     HWND                          msg_window;             /* HWND_MESSAGE parent window */
212
213     ULONG                         pad[9];                 /* Available for more data */
214 };
215
216 struct hook_extra_info
217 {
218     HHOOK handle;
219     LPARAM lparam;
220 };
221
222 static inline struct user_thread_info *get_user_thread_info(void)
223 {
224     return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
225 }
226
227 /* check if hwnd is a broadcast magic handle */
228 static inline BOOL is_broadcast( HWND hwnd )
229 {
230     return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
231 }
232
233 extern HMODULE user32_module DECLSPEC_HIDDEN;
234 extern DWORD USER16_AlertableWait DECLSPEC_HIDDEN;
235 extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN;
236
237 struct dce;
238
239 extern BOOL CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN;
240 extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
241 extern BOOL HOOK_IsHooked( INT id ) DECLSPEC_HIDDEN;
242 extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret );
243 extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
244 extern void invalidate_dce( HWND hwnd, const RECT *rect ) DECLSPEC_HIDDEN;
245 extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
246 extern void *get_hook_proc( void *proc, const WCHAR *module );
247 extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
248 extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
249 extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
250                                                UINT msg, WPARAM wparam, LPARAM lparam,
251                                                UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
252 extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN;
253 extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
254 extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
255 extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
256
257 extern BOOL USER_SetWindowPos( WINDOWPOS * winpos ) DECLSPEC_HIDDEN;
258
259 typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
260                                        LRESULT *result, void *arg );
261 typedef LRESULT (*winproc_callback16_t)( HWND16 hwnd, UINT16 msg, WPARAM16 wp, LPARAM lp,
262                                          LRESULT *result, void *arg );
263
264 extern WNDPROC16 WINPROC_GetProc16( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
265 extern WNDPROC WINPROC_AllocProc16( WNDPROC16 func ) DECLSPEC_HIDDEN;
266 extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
267 extern WNDPROC WINPROC_AllocProc( WNDPROC funcA, WNDPROC funcW ) DECLSPEC_HIDDEN;
268 extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ) DECLSPEC_HIDDEN;
269
270 extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
271                                      WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg,
272                                      enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
273 extern LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT16 msg,
274                                         WPARAM16 wParam, LPARAM lParam, LRESULT *result, void *arg ) DECLSPEC_HIDDEN;
275 extern LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT msg,
276                                         WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg ) DECLSPEC_HIDDEN;
277
278 extern INT_PTR WINPROC_CallDlgProc16( DLGPROC16 func, HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
279 extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
280 extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
281 extern BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
282                                  LRESULT *result, BOOL unicode, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
283
284 /* message spy definitions */
285
286 #define SPY_DISPATCHMESSAGE16     0x0100
287 #define SPY_DISPATCHMESSAGE       0x0101
288 #define SPY_SENDMESSAGE16         0x0102
289 #define SPY_SENDMESSAGE           0x0103
290 #define SPY_DEFWNDPROC16          0x0104
291 #define SPY_DEFWNDPROC            0x0105
292
293 #define SPY_RESULT_OK16           0x0000
294 #define SPY_RESULT_OK             0x0001
295 #define SPY_RESULT_INVALIDHWND16  0x0002
296 #define SPY_RESULT_INVALIDHWND    0x0003
297 #define SPY_RESULT_DEFWND16       0x0004
298 #define SPY_RESULT_DEFWND         0x0005
299
300 extern const char *SPY_GetClassLongOffsetName( INT offset ) DECLSPEC_HIDDEN;
301 extern const char *SPY_GetMsgName( UINT msg, HWND hWnd ) DECLSPEC_HIDDEN;
302 extern const char *SPY_GetVKeyName(WPARAM wParam) DECLSPEC_HIDDEN;
303 extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
304 extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
305                              LRESULT lReturn, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
306 extern int SPY_Init(void) DECLSPEC_HIDDEN;
307
308 /* HANDLE16 <-> HANDLE conversions */
309 #define HCURSOR_16(h32)    (LOWORD(h32))
310 #define HICON_16(h32)      (LOWORD(h32))
311 #define HINSTANCE_16(h32)  (LOWORD(h32))
312
313 #define HCURSOR_32(h16)    ((HCURSOR)(ULONG_PTR)(h16))
314 #define HICON_32(h16)      ((HICON)(ULONG_PTR)(h16))
315 #define HINSTANCE_32(h16)  ((HINSTANCE)(ULONG_PTR)(h16))
316 #define HMODULE_32(h16)    ((HMODULE)(ULONG_PTR)(h16))
317
318 #include "pshpack1.h"
319
320 typedef struct
321 {
322     BYTE   bWidth;
323     BYTE   bHeight;
324     BYTE   bColorCount;
325     BYTE   bReserved;
326 } ICONRESDIR;
327
328 typedef struct
329 {
330     WORD   wWidth;
331     WORD   wHeight;
332 } CURSORDIR;
333
334 typedef struct
335 {   union
336     { ICONRESDIR icon;
337       CURSORDIR  cursor;
338     } ResInfo;
339     WORD   wPlanes;
340     WORD   wBitCount;
341     DWORD  dwBytesInRes;
342     WORD   wResId;
343 } CURSORICONDIRENTRY;
344
345 typedef struct
346 {
347     WORD                idReserved;
348     WORD                idType;
349     WORD                idCount;
350     CURSORICONDIRENTRY  idEntries[1];
351 } CURSORICONDIR;
352
353 #include "poppack.h"
354
355 extern void CURSORICON_FreeModuleIcons( HMODULE16 hModule ) DECLSPEC_HIDDEN;
356
357 /* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */
358 #ifdef __MINGW32__
359 #undef assert
360 #define assert(expr) ((void)0)
361 #endif
362
363 #endif /* __WINE_USER_PRIVATE_H */