blob: 953812bab98001d1b8e3a7624431df4af1195b72 [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,
50 WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */
51 WM_WINE_LAST_DRIVER_MSG = 0x80001fff
Alexandre Julliardfb0ff052001-10-16 21:58:58 +000052};
Alexandre Julliard42d20f92000-08-10 01:16:19 +000053
Alexandre Julliard6a78c162004-12-08 18:06:14 +000054struct tagCURSORICONINFO;
Alexandre Julliard32fb5802001-10-18 21:38:59 +000055
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +000056typedef struct tagUSER_DRIVER {
Alexandre Julliard28c3a1b2000-03-20 18:21:19 +000057 /* keyboard functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010058 HKL (CDECL *pActivateKeyboardLayout)(HKL, UINT);
59 void (CDECL *pBeep)(void);
60 SHORT (CDECL *pGetAsyncKeyState)(INT);
61 INT (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT);
62 HKL (CDECL *pGetKeyboardLayout)(DWORD);
63 BOOL (CDECL *pGetKeyboardLayoutName)(LPWSTR);
64 HKL (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT);
65 UINT (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL);
66 UINT (CDECL *pSendInput)(UINT, LPINPUT, int);
67 INT (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL);
68 BOOL (CDECL *pUnloadKeyboardLayout)(HKL);
69 SHORT (CDECL *pVkKeyScanEx)(WCHAR, HKL);
Alexandre Julliardd676bf22010-04-20 14:10:46 +020070 /* cursor/icon functions */
71 void (CDECL *pCreateCursorIcon)(HCURSOR,struct tagCURSORICONINFO *);
72 void (CDECL *pDestroyCursorIcon)(HCURSOR);
73 void (CDECL *pSetCursor)(HCURSOR,struct tagCURSORICONINFO *);
Maarten Lankhorst0a645952008-12-16 15:32:08 +010074 BOOL (CDECL *pGetCursorPos)(LPPOINT);
75 BOOL (CDECL *pSetCursorPos)(INT,INT);
76 BOOL (CDECL *pClipCursor)(LPCRECT);
Alexandre Julliard7f3418f2000-03-25 17:30:13 +000077 /* screen saver functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010078 BOOL (CDECL *pGetScreenSaveActive)(void);
79 void (CDECL *pSetScreenSaveActive)(BOOL);
Alexandre Julliard42d20f92000-08-10 01:16:19 +000080 /* clipboard functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010081 INT (CDECL *pAcquireClipboard)(HWND); /* Acquire selection */
82 BOOL (CDECL *pCountClipboardFormats)(void); /* Count available clipboard formats */
83 void (CDECL *pEmptyClipboard)(BOOL); /* Empty clipboard data */
84 void (CDECL *pEndClipboardUpdate)(void); /* End clipboard update */
85 UINT (CDECL *pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */
Alexandre Julliard83b66542009-12-22 21:18:40 +010086 HANDLE (CDECL *pGetClipboardData)(UINT); /* Get specified selection data */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010087 INT (CDECL *pGetClipboardFormatName)(UINT, LPWSTR, UINT); /* Get a clipboard format name */
88 BOOL (CDECL *pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */
89 UINT (CDECL *pRegisterClipboardFormat)(LPCWSTR); /* Register a clipboard format */
Alexandre Julliard83b66542009-12-22 21:18:40 +010090 BOOL (CDECL *pSetClipboardData)(UINT, HANDLE, BOOL); /* Set specified selection data */
Alex Pasadyn330179f2003-04-22 00:15:48 +000091 /* display modes */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010092 LONG (CDECL *pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
93 BOOL (CDECL *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
94 BOOL (CDECL *pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
95 BOOL (CDECL *pGetMonitorInfo)(HMONITOR,MONITORINFO*);
Alexandre Julliard9ae0fe52001-04-24 23:28:52 +000096 /* windowing functions */
Maarten Lankhorst0a645952008-12-16 15:32:08 +010097 BOOL (CDECL *pCreateDesktopWindow)(HWND);
98 BOOL (CDECL *pCreateWindow)(HWND);
99 void (CDECL *pDestroyWindow)(HWND);
100 void (CDECL *pGetDC)(HDC,HWND,HWND,const RECT *,const RECT *,DWORD);
101 DWORD (CDECL *pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
102 void (CDECL *pReleaseDC)(HWND,HDC);
103 BOOL (CDECL *pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
104 void (CDECL *pSetCapture)(HWND,UINT);
105 void (CDECL *pSetFocus)(HWND);
106 void (CDECL *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
107 void (CDECL *pSetParent)(HWND,HWND,HWND);
108 int (CDECL *pSetWindowRgn)(HWND,HRGN,BOOL);
109 void (CDECL *pSetWindowIcon)(HWND,UINT,HICON);
110 void (CDECL *pSetWindowStyle)(HWND,INT,STYLESTRUCT*);
111 void (CDECL *pSetWindowText)(HWND,LPCWSTR);
112 UINT (CDECL *pShowWindow)(HWND,INT,RECT*,UINT);
113 LRESULT (CDECL *pSysCommand)(HWND,WPARAM,LPARAM);
114 LRESULT (CDECL *pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
115 void (CDECL *pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *);
116 void (CDECL *pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,const RECT *);
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +0000117} USER_DRIVER;
118
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100119extern const USER_DRIVER *USER_Driver DECLSPEC_HIDDEN;
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +0000120
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100121extern void USER_unload_driver(void) DECLSPEC_HIDDEN;
Alexandre Julliard1f90b5c2005-08-10 09:56:23 +0000122
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000123struct received_message_info;
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000124
Alexandre Julliardd996f7e2009-10-12 14:27:55 +0200125enum user_obj_type
126{
127 USER_WINDOW = 1, /* window */
Alexandre Julliarddb79a9f2009-10-12 14:30:34 +0200128 USER_MENU, /* menu */
Alexandre Julliarda7adbf72009-10-15 17:35:06 +0200129 USER_ACCEL, /* accelerator */
Alexandre Julliardcecb3a92009-12-22 17:16:50 +0100130 USER_ICON, /* icon or cursor */
Alexandre Julliardd996f7e2009-10-12 14:27:55 +0200131 USER_DWP /* DeferWindowPos structure */
132};
133
134struct user_object
135{
136 HANDLE handle;
137 enum user_obj_type type;
138};
139
140#define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
141
142HANDLE alloc_user_handle( struct user_object *ptr, enum user_obj_type type ) DECLSPEC_HIDDEN;
143void *get_user_handle_ptr( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
144void release_user_handle_ptr( void *ptr ) DECLSPEC_HIDDEN;
145void *free_user_handle( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN;
146
Alexandre Julliard82964f52007-08-08 18:25:38 +0200147/* type of message-sending functions that need special WM_CHAR handling */
148enum wm_char_mapping
149{
150 WMCHAR_MAP_POSTMESSAGE,
151 WMCHAR_MAP_SENDMESSAGE,
152 WMCHAR_MAP_SENDMESSAGETIMEOUT,
153 WMCHAR_MAP_RECVMESSAGE,
154 WMCHAR_MAP_DISPATCHMESSAGE,
155 WMCHAR_MAP_CALLWINDOWPROC,
156 WMCHAR_MAP_COUNT,
157 WMCHAR_MAP_NOMAPPING = WMCHAR_MAP_COUNT
158};
159
160/* data to store state for A/W mappings of WM_CHAR */
161struct wm_char_mapping_data
162{
163 BYTE lead_byte[WMCHAR_MAP_COUNT];
Alexandre Julliard2ce799c2007-08-08 20:35:24 +0200164 MSG get_msg;
Alexandre Julliard82964f52007-08-08 18:25:38 +0200165};
166
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000167/* this is the structure stored in TEB->Win32ClientInfo */
168/* no attempt is made to keep the layout compatible with the Windows one */
169struct user_thread_info
170{
Alexandre Julliard533f5192006-10-05 14:04:25 +0200171 HANDLE server_queue; /* Handle to server-side queue */
172 DWORD recursion_count; /* SendMessage recursion counter */
173 BOOL hook_unicode; /* Is current hook unicode? */
174 HHOOK hook; /* Current hook */
175 struct received_message_info *receive_info; /* Message being currently received */
Alexandre Julliard82964f52007-08-08 18:25:38 +0200176 struct wm_char_mapping_data *wmchar_data; /* Data for WM_CHAR mappings */
Alexandre Julliard533f5192006-10-05 14:04:25 +0200177 DWORD GetMessageTimeVal; /* Value for GetMessageTime */
178 DWORD GetMessagePosVal; /* Value for GetMessagePos */
179 ULONG_PTR GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
Alexandre Julliard533f5192006-10-05 14:04:25 +0200180 UINT active_hooks; /* Bitmap of active hooks */
Alexandre Julliardd71303e2008-06-25 14:26:06 +0200181 HWND top_window; /* Desktop window */
182 HWND msg_window; /* HWND_MESSAGE parent window */
Alexandre Julliard533f5192006-10-05 14:04:25 +0200183
Alexandre Julliard49de5ca2010-03-22 17:54:21 +0100184 ULONG pad[11]; /* Available for more data */
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000185};
186
Vitaliy Margolenbc55b752006-10-04 21:27:09 -0600187struct hook_extra_info
188{
189 HHOOK handle;
190 LPARAM lparam;
191};
192
Alexandre Julliard86be9f22005-04-27 08:18:20 +0000193static inline struct user_thread_info *get_user_thread_info(void)
194{
195 return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
196}
197
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000198/* check if hwnd is a broadcast magic handle */
199static inline BOOL is_broadcast( HWND hwnd )
200{
201 return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
202}
203
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100204extern HMODULE user32_module DECLSPEC_HIDDEN;
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100205extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN;
Alexandre Julliard18d02972002-12-03 23:34:52 +0000206
Alexandre Julliard1642fbc2008-02-25 15:59:19 +0100207struct dce;
208
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100209extern BOOL CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN;
210extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
Alexandre Julliard4e129f82008-03-12 14:54:03 +0100211extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret );
Alexandre Julliard1642fbc2008-02-25 15:59:19 +0100212extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
213extern void invalidate_dce( HWND hwnd, const RECT *rect ) DECLSPEC_HIDDEN;
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100214extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
Michael Stefaniuc4715dbe2008-01-31 14:35:27 +0100215extern void *get_hook_proc( void *proc, const WCHAR *module );
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100216extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
217extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000218extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
219 UINT msg, WPARAM wparam, LPARAM lparam,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100220 UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
221extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN;
222extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
223extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
224extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;
Mike McCormack096524c2001-12-26 19:46:40 +0000225
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100226extern BOOL USER_SetWindowPos( WINDOWPOS * winpos ) DECLSPEC_HIDDEN;
Pierre d'Herbemonte5e58a62006-11-26 23:21:02 +0100227
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200228typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
229 LRESULT *result, void *arg );
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200230
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100231extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN;
Alexandre Julliard77ab4352009-12-18 12:41:59 +0100232extern WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) DECLSPEC_HIDDEN;
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100233extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ) DECLSPEC_HIDDEN;
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200234
235extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
Alexandre Julliard82964f52007-08-08 18:25:38 +0200236 WPARAM wParam, LPARAM lParam, LRESULT *result, void *arg,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100237 enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200238
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100239extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
240extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
Alexandre Julliard334ede42007-08-08 17:02:42 +0200241extern BOOL WINPROC_call_window( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100242 LRESULT *result, BOOL unicode, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
Alexandre Julliardd00d54e2007-08-07 21:01:55 +0200243
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000244/* message spy definitions */
245
Alexandre Julliardb63d0e12009-12-23 19:45:03 +0100246#define SPY_DISPATCHMESSAGE 0x0100
247#define SPY_SENDMESSAGE 0x0101
248#define SPY_DEFWNDPROC 0x0102
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000249
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000250#define SPY_RESULT_OK 0x0001
Alexandre Julliarda0f9da12009-12-22 14:50:58 +0100251#define SPY_RESULT_DEFWND 0x0002
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000252
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100253extern const char *SPY_GetClassLongOffsetName( INT offset ) DECLSPEC_HIDDEN;
254extern const char *SPY_GetMsgName( UINT msg, HWND hWnd ) DECLSPEC_HIDDEN;
255extern const char *SPY_GetVKeyName(WPARAM wParam) DECLSPEC_HIDDEN;
256extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000257extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
Alexandre Julliardc57b5052007-11-07 18:05:49 +0100258 LRESULT lReturn, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
259extern int SPY_Init(void) DECLSPEC_HIDDEN;
Alexandre Julliard6b4c02e2005-04-27 10:23:24 +0000260
Alexandre Julliarddac19762005-07-20 10:31:37 +0000261#include "pshpack1.h"
262
263typedef struct
264{
265 BYTE bWidth;
266 BYTE bHeight;
267 BYTE bColorCount;
268 BYTE bReserved;
269} ICONRESDIR;
270
271typedef struct
272{
273 WORD wWidth;
274 WORD wHeight;
275} CURSORDIR;
276
277typedef struct
278{ union
279 { ICONRESDIR icon;
280 CURSORDIR cursor;
281 } ResInfo;
282 WORD wPlanes;
283 WORD wBitCount;
284 DWORD dwBytesInRes;
285 WORD wResId;
286} CURSORICONDIRENTRY;
287
288typedef struct
289{
290 WORD idReserved;
291 WORD idType;
292 WORD idCount;
293 CURSORICONDIRENTRY idEntries[1];
294} CURSORICONDIR;
295
296#include "poppack.h"
297
Alexandre Julliard62ac0362009-10-15 19:44:45 +0200298extern BOOL get_icon_size( HICON handle, SIZE *size ) DECLSPEC_HIDDEN;
Alexandre Julliarddac19762005-07-20 10:31:37 +0000299
Alexandre Julliard031c73a2009-06-08 16:45:54 +0200300/* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */
301#ifdef __MINGW32__
302#undef assert
303#define assert(expr) ((void)0)
304#endif
305
Alexandre Julliard6a78c162004-12-08 18:06:14 +0000306#endif /* __WINE_USER_PRIVATE_H */