blob: bd7d39e5d298b4ffe945f11ba5bcaaa0bc186d39 [file] [log] [blame]
Alexandre Julliard401710d1993-09-04 10:09:32 +00001/*
Alexandre Julliard6a78c162004-12-08 18:06:14 +00002 * USER private definitions
Alexandre Julliard401710d1993-09-04 10:09:32 +00003 *
4 * Copyright 1993 Alexandre Julliard
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00005 *
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
Jonathan Ernst360a3f92006-05-18 14:49:52 +020018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard401710d1993-09-04 10:09:32 +000019 */
20
Alexandre Julliard6a78c162004-12-08 18:06:14 +000021#ifndef __WINE_USER_PRIVATE_H
22#define __WINE_USER_PRIVATE_H
Alexandre Julliard401710d1993-09-04 10:09:32 +000023
Alexandre Julliarde37c6e12003-09-05 23:08:26 +000024#include <stdarg.h>
Alexandre Julliard6a78c162004-12-08 18:06:14 +000025#include "windef.h"
26#include "winbase.h"
27#include "wingdi.h"
28#include "winuser.h"
Alexandre Julliard86be9f22005-04-27 08:18:20 +000029#include "winreg.h"
30#include "winternl.h"
Alexandre Julliard401710d1993-09-04 10:09:32 +000031
Eric Pouech294835a2004-12-06 20:43:55 +000032#define GET_WORD(ptr) (*(const WORD *)(ptr))
33#define GET_DWORD(ptr) (*(const DWORD *)(ptr))
Alexandre Julliard7fbd74e2002-05-23 02:53:10 +000034
Francois Gougeteab56a52006-11-09 11:24:16 +010035#define WM_SYSTIMER 0x0118
Vincent Povirka2742972008-08-28 14:32:41 -050036#define WM_POPUPSYSTEMMENU 0x0313
Francois Gougeteab56a52006-11-09 11:24:16 +010037
Alexandre Julliardfb0ff052001-10-16 21:58:58 +000038/* internal messages codes */
39enum wine_internal_message
40{
41 WM_WINE_DESTROYWINDOW = 0x80000000,
42 WM_WINE_SETWINDOWPOS,
43 WM_WINE_SHOWWINDOW,
Alexandre Julliardddc33172001-10-22 19:08:33 +000044 WM_WINE_SETPARENT,
45 WM_WINE_SETWINDOWLONG,
Alexandre Julliard5030bda2002-10-11 23:41:06 +000046 WM_WINE_ENABLEWINDOW,
Alexandre Julliardca3ac8f2003-07-11 21:55:58 +000047 WM_WINE_SETACTIVEWINDOW,
48 WM_WINE_KEYBOARD_LL_HOOK,
Alexandre Julliard97d6e7f2005-03-07 17:19:24 +000049 WM_WINE_MOUSE_LL_HOOK,
Alexandre Julliard21e86f62011-03-31 20:27:29 +020050 WM_WINE_CLIPCURSOR,
Alexandre Julliard97d6e7f2005-03-07 17:19:24 +000051 WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */
52 WM_WINE_LAST_DRIVER_MSG = 0x80001fff
Alexandre Julliardfb0ff052001-10-16 21:58:58 +000053};
Alexandre Julliard42d20f92000-08-10 01:16:19 +000054
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +000055typedef struct tagUSER_DRIVER {
Alexandre Julliard28c3a1b2000-03-20 18:21:19 +000056 /* keyboard functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010057 HKL (CDECL *pActivateKeyboardLayout)(HKL, UINT);
58 void (CDECL *pBeep)(void);
59 SHORT (CDECL *pGetAsyncKeyState)(INT);
60 INT (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT);
61 HKL (CDECL *pGetKeyboardLayout)(DWORD);
62 BOOL (CDECL *pGetKeyboardLayoutName)(LPWSTR);
63 HKL (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT);
64 UINT (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL);
Maarten Lankhorst0a645952008-12-16 15:32:08 +010065 INT (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL);
66 BOOL (CDECL *pUnloadKeyboardLayout)(HKL);
67 SHORT (CDECL *pVkKeyScanEx)(WCHAR, HKL);
Alexandre Julliardd676bf22010-04-20 14:10:46 +020068 /* cursor/icon functions */
Alexandre Julliard86c4a362010-05-21 13:30:15 +020069 void (CDECL *pCreateCursorIcon)(HCURSOR);
Alexandre Julliardd676bf22010-04-20 14:10:46 +020070 void (CDECL *pDestroyCursorIcon)(HCURSOR);
Alexandre Julliard8ec63592010-04-20 21:14:31 +020071 void (CDECL *pSetCursor)(HCURSOR);
Maarten Lankhorst0a645952008-12-16 15:32:08 +010072 BOOL (CDECL *pGetCursorPos)(LPPOINT);
73 BOOL (CDECL *pSetCursorPos)(INT,INT);
74 BOOL (CDECL *pClipCursor)(LPCRECT);
Alexandre Julliard7f3418f2000-03-25 17:30:13 +000075 /* screen saver functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010076 BOOL (CDECL *pGetScreenSaveActive)(void);
77 void (CDECL *pSetScreenSaveActive)(BOOL);
Alexandre Julliard42d20f92000-08-10 01:16:19 +000078 /* clipboard functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010079 INT (CDECL *pAcquireClipboard)(HWND); /* Acquire selection */
80 BOOL (CDECL *pCountClipboardFormats)(void); /* Count available clipboard formats */
81 void (CDECL *pEmptyClipboard)(BOOL); /* Empty clipboard data */
82 void (CDECL *pEndClipboardUpdate)(void); /* End clipboard update */
83 UINT (CDECL *pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */
Alexandre Julliard83b66542009-12-22 21:18:40 +010084 HANDLE (CDECL *pGetClipboardData)(UINT); /* Get specified selection data */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010085 BOOL (CDECL *pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */
Alexandre Julliard83b66542009-12-22 21:18:40 +010086 BOOL (CDECL *pSetClipboardData)(UINT, HANDLE, BOOL); /* Set specified selection data */
Alex Pasadyn330179f2003-04-22 00:15:48 +000087 /* display modes */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010088 LONG (CDECL *pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
89 BOOL (CDECL *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
90 BOOL (CDECL *pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
91 BOOL (CDECL *pGetMonitorInfo)(HMONITOR,MONITORINFO*);
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +000092 /* windowing functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010093 BOOL (CDECL *pCreateDesktopWindow)(HWND);
94 BOOL (CDECL *pCreateWindow)(HWND);
95 void (CDECL *pDestroyWindow)(HWND);
96 void (CDECL *pGetDC)(HDC,HWND,HWND,const RECT *,const RECT *,DWORD);
97 DWORD (CDECL *pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
98 void (CDECL *pReleaseDC)(HWND,HDC);
99 BOOL (CDECL *pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
100 void (CDECL *pSetCapture)(HWND,UINT);
101 void (CDECL *pSetFocus)(HWND);
102 void (CDECL *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
103 void (CDECL *pSetParent)(HWND,HWND,HWND);
104 int (CDECL *pSetWindowRgn)(HWND,HRGN,BOOL);
105 void (CDECL *pSetWindowIcon)(HWND,UINT,HICON);
106 void (CDECL *pSetWindowStyle)(HWND,INT,STYLESTRUCT*);
107 void (CDECL *pSetWindowText)(HWND,LPCWSTR);
108 UINT (CDECL *pShowWindow)(HWND,INT,RECT*,UINT);
109 LRESULT (CDECL *pSysCommand)(HWND,WPARAM,LPARAM);
110 LRESULT (CDECL *pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
111 void (CDECL *pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *);
112 void (CDECL *pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,const RECT *);
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +0000113} USER_DRIVER;
114
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100115extern const USER_DRIVER *USER_Driver DECLSPEC_HIDDEN;
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +0000116
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100117extern void USER_unload_driver(void) DECLSPEC_HIDDEN;
Alexandre Julliard1f90b5c2005-08-10 09:56:23 +0000118
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000119struct received_message_info;
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000120
Alexandre Julliardd996f7e2009-10-12 14:27:55 +0200121enum user_obj_type
122{
123 USER_WINDOW = 1, /* window */
Alexandre Julliarddb79a9f2009-10-12 14:30:34 +0200124 USER_MENU, /* menu */
Alexandre Julliarda7adbf72009-10-15 17:35:06 +0200125 USER_ACCEL, /* accelerator */
Alexandre Julliardcecb3a92009-12-22 17:16:50 +0100126 USER_ICON, /* icon or cursor */
Alexandre Julliardd996f7e2009-10-12 14:27:55 +0200127 USER_DWP /* DeferWindowPos structure */
128};
129
130struct user_object
131{
132 HANDLE handle;
133 enum user_obj_type type;
134};
135
136#define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
137
138HANDLE alloc_user_handle( struct user_object *ptr, enum user_obj_type type ) DECLSPEC_HIDDEN;
139void *get_user_handle_ptr( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
140void release_user_handle_ptr( void *ptr ) DECLSPEC_HIDDEN;
141void *free_user_handle( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
142
Alexandre Julliard82964f52007-08-08 18:25:38 +0200143/* type of message-sending functions that need special WM_CHAR handling */
144enum wm_char_mapping
145{
146 WMCHAR_MAP_POSTMESSAGE,
147 WMCHAR_MAP_SENDMESSAGE,
148 WMCHAR_MAP_SENDMESSAGETIMEOUT,
149 WMCHAR_MAP_RECVMESSAGE,
150 WMCHAR_MAP_DISPATCHMESSAGE,
151 WMCHAR_MAP_CALLWINDOWPROC,
152 WMCHAR_MAP_COUNT,
153 WMCHAR_MAP_NOMAPPING = WMCHAR_MAP_COUNT
154};
155
156/* data to store state for A/W mappings of WM_CHAR */
157struct wm_char_mapping_data
158{
159 BYTE lead_byte[WMCHAR_MAP_COUNT];
Alexandre Julliard2ce799c2007-08-08 20:35:24 +0200160 MSG get_msg;
Alexandre Julliard82964f52007-08-08 18:25:38 +0200161};
162
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000163/* this is the structure stored in TEB->Win32ClientInfo */
164/* no attempt is made to keep the layout compatible with the Windows one */
165struct user_thread_info
166{
Alexandre Julliard533f5192006-10-05 14:04:25 +0200167 HANDLE server_queue; /* Handle to server-side queue */
168 DWORD recursion_count; /* SendMessage recursion counter */
169 BOOL hook_unicode; /* Is current hook unicode? */
170 HHOOK hook; /* Current hook */
171 struct received_message_info *receive_info; /* Message being currently received */
Alexandre Julliard82964f52007-08-08 18:25:38 +0200172 struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */
Alexandre Julliard533f5192006-10-05 14:04:25 +0200173 DWORD GetMessageTimeVal; /* Value for GetMessageTime */
174 DWORD GetMessagePosVal; /* Value for GetMessagePos */
175 ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
Alexandre Julliard533f5192006-10-05 14:04:25 +0200176 UINT active_hooks; /* Bitmap of active hooks */
Alexandre Julliardd71303e2008-06-25 14:26:06 +0200177 HWND top_window; /* Desktop window */
178 HWND msg_window; /* HWND_MESSAGE parent window */
Alexandre Julliard533f5192006-10-05 14:04:25 +0200179
Alexandre Julliard49de5ca2010-03-22 17:54:21 +0100180 ULONG pad[11]; /* Available for more data */
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000181};
182
Vitaliy Margolenbc55b752006-10-04 21:27:09 -0600183struct hook_extra_info
184{
185 HHOOK handle;
186 LPARAM lparam;
187};
188
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000189static inline struct user_thread_info *get_user_thread_info(void)
190{
191 return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
192}
193
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000194/* check if hwnd is a broadcast magic handle */
195static inline BOOL is_broadcast( HWND hwnd )
196{
197 return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
198}
199
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100200extern HMODULE user32_module DECLSPEC_HIDDEN;
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100201extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN;
Alexandre Julliard18d02972002-12-03 23:34:52 +0000202
Alexandre Julliard1642fbc2008-02-25 15:59:19 +0100203struct dce;
204
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100205extern BOOL CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN;
206extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
Alexandre Julliard4e129f82008-03-12 14:54:03 +0100207extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret );
Alexandre Julliard1642fbc2008-02-25 15:59:19 +0100208extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
209extern void invalidate_dce( HWND hwnd, const RECT *rect ) DECLSPEC_HIDDEN;
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100210extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
Michael Stefaniuc4715dbe2008-01-31 14:35:27 +0100211extern void *get_hook_proc( void *proc, const WCHAR *module );
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100212extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
213extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
Alexandre Julliardae895a12011-03-02 19:43:53 +0100214extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags ) DECLSPEC_HIDDEN;
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000215extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
216 UINT msg, WPARAM wparam, LPARAM lparam,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100217 UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
218extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN;
219extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
220extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
221extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
Mike McCormack096524c2001-12-26 19:46:40 +0000222
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100223extern BOOL USER_SetWindowPos( WINDOWPOS * winpos ) DECLSPEC_HIDDEN;
Pierre d'Herbemonte5e58a62006-11-26 23:21:02 +0100224
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200225typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
226 LRESULT *result, void *arg );
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200227
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100228extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
Alexandre Julliard77ab4352009-12-18 12:41:59 +0100229extern WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) DECLSPEC_HIDDEN;
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100230extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ) DECLSPEC_HIDDEN;
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200231
232extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
Alexandre Julliard82964f52007-08-08 18:25:38 +0200233 WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100234 enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200235
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100236extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
237extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
Alexandre Julliard334ede42007-08-08 17:02:42 +0200238extern BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100239 LRESULT *result, BOOL unicode, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200240
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000241/* message spy definitions */
242
Alexandre Julliardb63d0e12009-12-23 19:45:03 +0100243#define SPY_DISPATCHMESSAGE 0x0100
244#define SPY_SENDMESSAGE 0x0101
245#define SPY_DEFWNDPROC 0x0102
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000246
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000247#define SPY_RESULT_OK 0x0001
Alexandre Julliarda0f9da12009-12-22 14:50:58 +0100248#define SPY_RESULT_DEFWND 0x0002
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000249
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100250extern const char *SPY_GetClassLongOffsetName( INT offset ) DECLSPEC_HIDDEN;
251extern const char *SPY_GetMsgName( UINT msg, HWND hWnd ) DECLSPEC_HIDDEN;
252extern const char *SPY_GetVKeyName(WPARAM wParam) DECLSPEC_HIDDEN;
253extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000254extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100255 LRESULT lReturn, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
256extern int SPY_Init(void) DECLSPEC_HIDDEN;
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000257
Alexandre Julliarddac19762005-07-20 10:31:37 +0000258#include "pshpack1.h"
259
260typedef struct
261{
262 BYTE bWidth;
263 BYTE bHeight;
264 BYTE bColorCount;
265 BYTE bReserved;
266} ICONRESDIR;
267
268typedef struct
269{
270 WORD wWidth;
271 WORD wHeight;
272} CURSORDIR;
273
274typedef struct
275{ union
276 { ICONRESDIR icon;
277 CURSORDIR cursor;
278 } ResInfo;
279 WORD wPlanes;
280 WORD wBitCount;
281 DWORD dwBytesInRes;
282 WORD wResId;
283} CURSORICONDIRENTRY;
284
285typedef struct
286{
287 WORD idReserved;
288 WORD idType;
289 WORD idCount;
290 CURSORICONDIRENTRY idEntries[1];
291} CURSORICONDIR;
292
293#include "poppack.h"
294
Alexandre Julliard62ac0362009-10-15 19:44:45 +0200295extern BOOL get_icon_size( HICON handle, SIZE *size ) DECLSPEC_HIDDEN;
Alexandre Julliarddac19762005-07-20 10:31:37 +0000296
Alexandre Julliard031c73a2009-06-08 16:45:54 +0200297/* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */
298#ifdef __MINGW32__
299#undef assert
300#define assert(expr) ((void)0)
301#endif
302
Alexandre Julliard6a78c162004-12-08 18:06:14 +0000303#endif /* __WINE_USER_PRIVATE_H */