2 * USER private 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_USER_PRIVATE_H
22 #define __WINE_USER_PRIVATE_H
32 #define GET_WORD(ptr) (*(const WORD *)(ptr))
33 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
35 #define WM_SYSTIMER 0x0118
36 #define WM_POPUPSYSTEMMENU 0x0313
38 #define WINE_MOUSE_HANDLE ((HANDLE)1)
39 #define WINE_KEYBOARD_HANDLE ((HANDLE)2)
41 struct window_surface
;
43 /* internal messages codes */
44 enum wine_internal_message
46 WM_WINE_DESTROYWINDOW
= 0x80000000,
50 WM_WINE_SETWINDOWLONG
,
52 WM_WINE_SETACTIVEWINDOW
,
53 WM_WINE_KEYBOARD_LL_HOOK
,
54 WM_WINE_MOUSE_LL_HOOK
,
56 WM_WINE_FIRST_DRIVER_MSG
= 0x80001000, /* range of messages reserved for the USER driver */
57 WM_WINE_LAST_DRIVER_MSG
= 0x80001fff
60 typedef struct tagUSER_DRIVER
{
61 /* keyboard functions */
62 HKL (CDECL
*pActivateKeyboardLayout
)(HKL
, UINT
);
63 void (CDECL
*pBeep
)(void);
64 SHORT (CDECL
*pGetAsyncKeyState
)(INT
);
65 INT (CDECL
*pGetKeyNameText
)(LONG
, LPWSTR
, INT
);
66 HKL (CDECL
*pGetKeyboardLayout
)(DWORD
);
67 UINT (CDECL
*pGetKeyboardLayoutList
)(INT
, HKL
*);
68 BOOL (CDECL
*pGetKeyboardLayoutName
)(LPWSTR
);
69 HKL (CDECL
*pLoadKeyboardLayout
)(LPCWSTR
, UINT
);
70 UINT (CDECL
*pMapVirtualKeyEx
)(UINT
, UINT
, HKL
);
71 BOOL (CDECL
*pRegisterHotKey
)(HWND
, UINT
, UINT
);
72 INT (CDECL
*pToUnicodeEx
)(UINT
, UINT
, const BYTE
*, LPWSTR
, int, UINT
, HKL
);
73 BOOL (CDECL
*pUnloadKeyboardLayout
)(HKL
);
74 void (CDECL
*pUnregisterHotKey
)(HWND
, UINT
, UINT
);
75 SHORT (CDECL
*pVkKeyScanEx
)(WCHAR
, HKL
);
76 /* cursor/icon functions */
77 void (CDECL
*pDestroyCursorIcon
)(HCURSOR
);
78 void (CDECL
*pSetCursor
)(HCURSOR
);
79 BOOL (CDECL
*pGetCursorPos
)(LPPOINT
);
80 BOOL (CDECL
*pSetCursorPos
)(INT
,INT
);
81 BOOL (CDECL
*pClipCursor
)(LPCRECT
);
82 /* clipboard functions */
83 void (CDECL
*pUpdateClipboard
)(void);
85 LONG (CDECL
*pChangeDisplaySettingsEx
)(LPCWSTR
,LPDEVMODEW
,HWND
,DWORD
,LPVOID
);
86 BOOL (CDECL
*pEnumDisplayMonitors
)(HDC
,LPRECT
,MONITORENUMPROC
,LPARAM
);
87 BOOL (CDECL
*pEnumDisplaySettingsEx
)(LPCWSTR
,DWORD
,LPDEVMODEW
,DWORD
);
88 BOOL (CDECL
*pGetMonitorInfo
)(HMONITOR
,MONITORINFO
*);
89 /* windowing functions */
90 BOOL (CDECL
*pCreateDesktopWindow
)(HWND
);
91 BOOL (CDECL
*pCreateWindow
)(HWND
);
92 void (CDECL
*pDestroyWindow
)(HWND
);
93 void (CDECL
*pFlashWindowEx
)(FLASHWINFO
*);
94 void (CDECL
*pGetDC
)(HDC
,HWND
,HWND
,const RECT
*,const RECT
*,DWORD
);
95 DWORD (CDECL
*pMsgWaitForMultipleObjectsEx
)(DWORD
,const HANDLE
*,DWORD
,DWORD
,DWORD
);
96 void (CDECL
*pReleaseDC
)(HWND
,HDC
);
97 BOOL (CDECL
*pScrollDC
)(HDC
,INT
,INT
,HRGN
);
98 void (CDECL
*pSetCapture
)(HWND
,UINT
);
99 void (CDECL
*pSetFocus
)(HWND
);
100 void (CDECL
*pSetLayeredWindowAttributes
)(HWND
,COLORREF
,BYTE
,DWORD
);
101 void (CDECL
*pSetParent
)(HWND
,HWND
,HWND
);
102 void (CDECL
*pSetWindowRgn
)(HWND
,HRGN
,BOOL
);
103 void (CDECL
*pSetWindowIcon
)(HWND
,UINT
,HICON
);
104 void (CDECL
*pSetWindowStyle
)(HWND
,INT
,STYLESTRUCT
*);
105 void (CDECL
*pSetWindowText
)(HWND
,LPCWSTR
);
106 UINT (CDECL
*pShowWindow
)(HWND
,INT
,RECT
*,UINT
);
107 LRESULT (CDECL
*pSysCommand
)(HWND
,WPARAM
,LPARAM
);
108 BOOL (CDECL
*pUpdateLayeredWindow
)(HWND
,const UPDATELAYEREDWINDOWINFO
*,const RECT
*);
109 LRESULT (CDECL
*pWindowMessage
)(HWND
,UINT
,WPARAM
,LPARAM
);
110 void (CDECL
*pWindowPosChanging
)(HWND
,HWND
,UINT
,const RECT
*,const RECT
*,RECT
*,struct window_surface
**);
111 void (CDECL
*pWindowPosChanged
)(HWND
,HWND
,UINT
,const RECT
*,const RECT
*,const RECT
*,const RECT
*,struct window_surface
*);
112 /* system parameters */
113 BOOL (CDECL
*pSystemParametersInfo
)(UINT
,UINT
,void*,UINT
);
114 /* thread management */
115 void (CDECL
*pThreadDetach
)(void);
118 extern const USER_DRIVER
*USER_Driver DECLSPEC_HIDDEN
;
120 extern void USER_unload_driver(void) DECLSPEC_HIDDEN
;
122 struct received_message_info
;
126 USER_WINDOW
= 1, /* window */
127 USER_MENU
, /* menu */
128 USER_ACCEL
, /* accelerator */
129 USER_ICON
, /* icon or cursor */
130 USER_DWP
/* DeferWindowPos structure */
136 enum user_obj_type type
;
139 #define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
141 HANDLE
alloc_user_handle( struct user_object
*ptr
, enum user_obj_type type
) DECLSPEC_HIDDEN
;
142 void *get_user_handle_ptr( HANDLE handle
, enum user_obj_type type
) DECLSPEC_HIDDEN
;
143 void release_user_handle_ptr( void *ptr
) DECLSPEC_HIDDEN
;
144 void *free_user_handle( HANDLE handle
, enum user_obj_type type
) DECLSPEC_HIDDEN
;
146 /* type of message-sending functions that need special WM_CHAR handling */
149 WMCHAR_MAP_POSTMESSAGE
,
150 WMCHAR_MAP_SENDMESSAGE
,
151 WMCHAR_MAP_SENDMESSAGETIMEOUT
,
152 WMCHAR_MAP_RECVMESSAGE
,
153 WMCHAR_MAP_DISPATCHMESSAGE
,
154 WMCHAR_MAP_CALLWINDOWPROC
,
156 WMCHAR_MAP_NOMAPPING
= WMCHAR_MAP_COUNT
159 /* data to store state for A/W mappings of WM_CHAR */
160 struct wm_char_mapping_data
162 BYTE lead_byte
[WMCHAR_MAP_COUNT
];
166 /* this is the structure stored in TEB->Win32ClientInfo */
167 /* no attempt is made to keep the layout compatible with the Windows one */
168 struct user_thread_info
170 HANDLE server_queue
; /* Handle to server-side queue */
171 DWORD wake_mask
; /* Current queue wake mask */
172 DWORD changed_mask
; /* Current queue changed mask */
173 WORD recursion_count
; /* SendMessage recursion counter */
174 WORD message_count
; /* Get/PeekMessage loop counter */
175 WORD hook_call_depth
; /* Number of recursively called hook procs */
176 BOOL hook_unicode
; /* Is current hook unicode? */
177 HHOOK hook
; /* Current hook */
178 struct received_message_info
*receive_info
; /* Message being currently received */
179 struct wm_char_mapping_data
*wmchar_data
; /* Data for WM_CHAR mappings */
180 DWORD GetMessageTimeVal
; /* Value for GetMessageTime */
181 DWORD GetMessagePosVal
; /* Value for GetMessagePos */
182 ULONG_PTR GetMessageExtraInfoVal
; /* Value for GetMessageExtraInfo */
183 UINT active_hooks
; /* Bitmap of active hooks */
184 struct user_key_state_info
*key_state
; /* Cache of global key state */
185 HWND top_window
; /* Desktop window */
186 HWND msg_window
; /* HWND_MESSAGE parent window */
190 C_ASSERT( sizeof(struct user_thread_info
) <= sizeof(((TEB
*)0)->Win32ClientInfo
) );
192 extern INT global_key_state_counter DECLSPEC_HIDDEN
;
193 extern BOOL (WINAPI
*imm_register_window
)(HWND
) DECLSPEC_HIDDEN
;
194 extern void (WINAPI
*imm_unregister_window
)(HWND
) DECLSPEC_HIDDEN
;
196 struct user_key_state_info
198 UINT time
; /* Time of last key state refresh */
199 INT counter
; /* Counter to invalidate the key state */
200 BYTE state
[256]; /* State for each key */
203 struct hook_extra_info
209 static inline struct user_thread_info
*get_user_thread_info(void)
211 return (struct user_thread_info
*)NtCurrentTeb()->Win32ClientInfo
;
214 /* check if hwnd is a broadcast magic handle */
215 static inline BOOL
is_broadcast( HWND hwnd
)
217 return (hwnd
== HWND_BROADCAST
|| hwnd
== HWND_TOPMOST
);
220 extern HMODULE user32_module DECLSPEC_HIDDEN
;
225 extern void CLIPBOARD_ReleaseOwner( HWND hwnd
) DECLSPEC_HIDDEN
;
226 extern BOOL
FOCUS_MouseActivate( HWND hwnd
) DECLSPEC_HIDDEN
;
227 extern BOOL
set_capture_window( HWND hwnd
, UINT gui_flags
, HWND
*prev_ret
) DECLSPEC_HIDDEN
;
228 extern void free_dce( struct dce
*dce
, HWND hwnd
) DECLSPEC_HIDDEN
;
229 extern void invalidate_dce( struct tagWND
*win
, const RECT
*rect
) DECLSPEC_HIDDEN
;
230 extern void erase_now( HWND hwnd
, UINT rdw_flags
) DECLSPEC_HIDDEN
;
231 extern void move_window_bits( HWND hwnd
, struct window_surface
*old_surface
,
232 struct window_surface
*new_surface
,
233 const RECT
*visible_rect
, const RECT
*old_visible_rect
,
234 const RECT
*window_rect
, const RECT
*valid_rects
) DECLSPEC_HIDDEN
;
235 extern void move_window_bits_parent( HWND hwnd
, HWND parent
, const RECT
*window_rect
,
236 const RECT
*valid_rects
) DECLSPEC_HIDDEN
;
237 extern void *get_hook_proc( void *proc
, const WCHAR
*module
, HMODULE
*free_module
) DECLSPEC_HIDDEN
;
238 extern RECT
get_virtual_screen_rect(void) DECLSPEC_HIDDEN
;
239 extern LRESULT
call_current_hook( HHOOK hhook
, INT code
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
240 extern DWORD
get_input_codepage( void ) DECLSPEC_HIDDEN
;
241 extern BOOL
map_wparam_AtoW( UINT message
, WPARAM
*wparam
, enum wm_char_mapping mapping
) DECLSPEC_HIDDEN
;
242 extern NTSTATUS
send_hardware_message( HWND hwnd
, const INPUT
*input
, UINT flags
) DECLSPEC_HIDDEN
;
243 extern LRESULT
MSG_SendInternalMessageTimeout( DWORD dest_pid
, DWORD dest_tid
,
244 UINT msg
, WPARAM wparam
, LPARAM lparam
,
245 UINT flags
, UINT timeout
, PDWORD_PTR res_ptr
) DECLSPEC_HIDDEN
;
246 extern HPEN
SYSCOLOR_GetPen( INT index
) DECLSPEC_HIDDEN
;
247 extern HBRUSH
SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN
;
248 extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN
;
249 extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN
;
250 extern BOOL
USER_IsExitingThread( DWORD tid
) DECLSPEC_HIDDEN
;
252 extern BOOL
USER_SetWindowPos( WINDOWPOS
* winpos
) DECLSPEC_HIDDEN
;
254 typedef LRESULT (*winproc_callback_t
)( HWND hwnd
, UINT msg
, WPARAM wp
, LPARAM lp
,
255 LRESULT
*result
, void *arg
);
257 extern WNDPROC
WINPROC_GetProc( WNDPROC proc
, BOOL unicode
) DECLSPEC_HIDDEN
;
258 extern WNDPROC
WINPROC_AllocProc( WNDPROC func
, BOOL unicode
) DECLSPEC_HIDDEN
;
259 extern BOOL
WINPROC_IsUnicode( WNDPROC proc
, BOOL def_val
) DECLSPEC_HIDDEN
;
261 extern LRESULT
WINPROC_CallProcAtoW( winproc_callback_t callback
, HWND hwnd
, UINT msg
,
262 WPARAM wParam
, LPARAM lParam
, LRESULT
*result
, void *arg
,
263 enum wm_char_mapping mapping
) DECLSPEC_HIDDEN
;
265 extern INT_PTR
WINPROC_CallDlgProcA( DLGPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
266 extern INT_PTR
WINPROC_CallDlgProcW( DLGPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
267 extern BOOL
WINPROC_call_window( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
268 LRESULT
*result
, BOOL unicode
, enum wm_char_mapping mapping
) DECLSPEC_HIDDEN
;
270 /* message spy definitions */
272 #define SPY_DISPATCHMESSAGE 0x0100
273 #define SPY_SENDMESSAGE 0x0101
274 #define SPY_DEFWNDPROC 0x0102
276 #define SPY_RESULT_OK 0x0001
277 #define SPY_RESULT_DEFWND 0x0002
279 extern const char *SPY_GetClassLongOffsetName( INT offset
) DECLSPEC_HIDDEN
;
280 extern const char *SPY_GetMsgName( UINT msg
, HWND hWnd
) DECLSPEC_HIDDEN
;
281 extern const char *SPY_GetVKeyName(WPARAM wParam
) DECLSPEC_HIDDEN
;
282 extern void SPY_EnterMessage( INT iFlag
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
283 extern void SPY_ExitMessage( INT iFlag
, HWND hwnd
, UINT msg
,
284 LRESULT lReturn
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
286 #include "pshpack1.h"
311 } CURSORICONDIRENTRY
;
318 CURSORICONDIRENTRY idEntries
[1];
330 } CURSORICONFILEDIRENTRY
;
337 CURSORICONFILEDIRENTRY idEntries
[1];
342 extern int bitmap_info_size( const BITMAPINFO
* info
, WORD coloruse
) DECLSPEC_HIDDEN
;
343 extern BOOL
get_icon_size( HICON handle
, SIZE
*size
) DECLSPEC_HIDDEN
;
345 /* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */
348 #define assert(expr) ((void)0)
351 #endif /* __WINE_USER_PRIVATE_H */