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 struct window_surface
;
40 /* internal messages codes */
41 enum wine_internal_message
43 WM_WINE_DESTROYWINDOW
= 0x80000000,
47 WM_WINE_SETWINDOWLONG
,
49 WM_WINE_SETACTIVEWINDOW
,
50 WM_WINE_KEYBOARD_LL_HOOK
,
51 WM_WINE_MOUSE_LL_HOOK
,
53 WM_WINE_FIRST_DRIVER_MSG
= 0x80001000, /* range of messages reserved for the USER driver */
54 WM_WINE_LAST_DRIVER_MSG
= 0x80001fff
57 typedef struct tagUSER_DRIVER
{
58 /* keyboard functions */
59 HKL (CDECL
*pActivateKeyboardLayout
)(HKL
, UINT
);
60 void (CDECL
*pBeep
)(void);
61 SHORT (CDECL
*pGetAsyncKeyState
)(INT
);
62 INT (CDECL
*pGetKeyNameText
)(LONG
, LPWSTR
, INT
);
63 HKL (CDECL
*pGetKeyboardLayout
)(DWORD
);
64 BOOL (CDECL
*pGetKeyboardLayoutName
)(LPWSTR
);
65 HKL (CDECL
*pLoadKeyboardLayout
)(LPCWSTR
, UINT
);
66 UINT (CDECL
*pMapVirtualKeyEx
)(UINT
, UINT
, HKL
);
67 BOOL (CDECL
*pRegisterHotKey
)(HWND
, UINT
, UINT
);
68 INT (CDECL
*pToUnicodeEx
)(UINT
, UINT
, const BYTE
*, LPWSTR
, int, UINT
, HKL
);
69 BOOL (CDECL
*pUnloadKeyboardLayout
)(HKL
);
70 void (CDECL
*pUnregisterHotKey
)(HWND
, UINT
, UINT
);
71 SHORT (CDECL
*pVkKeyScanEx
)(WCHAR
, HKL
);
72 /* cursor/icon functions */
73 void (CDECL
*pCreateCursorIcon
)(HCURSOR
);
74 void (CDECL
*pDestroyCursorIcon
)(HCURSOR
);
75 void (CDECL
*pSetCursor
)(HCURSOR
);
76 BOOL (CDECL
*pGetCursorPos
)(LPPOINT
);
77 BOOL (CDECL
*pSetCursorPos
)(INT
,INT
);
78 BOOL (CDECL
*pClipCursor
)(LPCRECT
);
79 /* screen saver functions */
80 BOOL (CDECL
*pGetScreenSaveActive
)(void);
81 void (CDECL
*pSetScreenSaveActive
)(BOOL
);
82 /* clipboard functions */
83 INT (CDECL
*pAcquireClipboard
)(HWND
); /* Acquire selection */
84 BOOL (CDECL
*pCountClipboardFormats
)(void); /* Count available clipboard formats */
85 void (CDECL
*pEmptyClipboard
)(BOOL
); /* Empty clipboard data */
86 void (CDECL
*pEndClipboardUpdate
)(void); /* End clipboard update */
87 UINT (CDECL
*pEnumClipboardFormats
)(UINT
); /* Enumerate clipboard formats */
88 HANDLE (CDECL
*pGetClipboardData
)(UINT
); /* Get specified selection data */
89 BOOL (CDECL
*pIsClipboardFormatAvailable
)(UINT
); /* Check if specified format is available */
90 BOOL (CDECL
*pSetClipboardData
)(UINT
, HANDLE
, BOOL
); /* Set specified selection data */
92 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
*);
96 /* windowing functions */
97 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
*,struct window_surface
**);
116 void (CDECL
*pWindowPosChanged
)(HWND
,HWND
,UINT
,const RECT
*,const RECT
*,const RECT
*,const RECT
*,struct window_surface
*);
119 extern const USER_DRIVER
*USER_Driver DECLSPEC_HIDDEN
;
121 extern void USER_unload_driver(void) DECLSPEC_HIDDEN
;
123 struct received_message_info
;
127 USER_WINDOW
= 1, /* window */
128 USER_MENU
, /* menu */
129 USER_ACCEL
, /* accelerator */
130 USER_ICON
, /* icon or cursor */
131 USER_DWP
/* DeferWindowPos structure */
137 enum user_obj_type type
;
140 #define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */
142 HANDLE
alloc_user_handle( struct user_object
*ptr
, enum user_obj_type type
) DECLSPEC_HIDDEN
;
143 void *get_user_handle_ptr( HANDLE handle
, enum user_obj_type type
) DECLSPEC_HIDDEN
;
144 void release_user_handle_ptr( void *ptr
) DECLSPEC_HIDDEN
;
145 void *free_user_handle( HANDLE handle
, enum user_obj_type type
) DECLSPEC_HIDDEN
;
147 /* type of message-sending functions that need special WM_CHAR handling */
150 WMCHAR_MAP_POSTMESSAGE
,
151 WMCHAR_MAP_SENDMESSAGE
,
152 WMCHAR_MAP_SENDMESSAGETIMEOUT
,
153 WMCHAR_MAP_RECVMESSAGE
,
154 WMCHAR_MAP_DISPATCHMESSAGE
,
155 WMCHAR_MAP_CALLWINDOWPROC
,
157 WMCHAR_MAP_NOMAPPING
= WMCHAR_MAP_COUNT
160 /* data to store state for A/W mappings of WM_CHAR */
161 struct wm_char_mapping_data
163 BYTE lead_byte
[WMCHAR_MAP_COUNT
];
167 /* this is the structure stored in TEB->Win32ClientInfo */
168 /* no attempt is made to keep the layout compatible with the Windows one */
169 struct user_thread_info
171 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 */
176 struct wm_char_mapping_data
*wmchar_data
; /* Data for WM_CHAR mappings */
177 DWORD GetMessageTimeVal
; /* Value for GetMessageTime */
178 DWORD GetMessagePosVal
; /* Value for GetMessagePos */
179 ULONG_PTR GetMessageExtraInfoVal
; /* Value for GetMessageExtraInfo */
180 UINT active_hooks
; /* Bitmap of active hooks */
181 UINT key_state_time
; /* Time of last key state refresh */
182 BYTE
*key_state
; /* Cache of global key state */
183 HWND top_window
; /* Desktop window */
184 HWND msg_window
; /* HWND_MESSAGE parent window */
186 ULONG pad
[9]; /* Available for more data */
189 struct hook_extra_info
195 static inline struct user_thread_info
*get_user_thread_info(void)
197 return (struct user_thread_info
*)NtCurrentTeb()->Win32ClientInfo
;
200 /* check if hwnd is a broadcast magic handle */
201 static inline BOOL
is_broadcast( HWND hwnd
)
203 return (hwnd
== HWND_BROADCAST
|| hwnd
== HWND_TOPMOST
);
206 extern HMODULE user32_module DECLSPEC_HIDDEN
;
207 extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN
;
212 extern BOOL
CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN
;
213 extern BOOL
FOCUS_MouseActivate( HWND hwnd
) DECLSPEC_HIDDEN
;
214 extern BOOL
set_capture_window( HWND hwnd
, UINT gui_flags
, HWND
*prev_ret
) DECLSPEC_HIDDEN
;
215 extern void free_dce( struct dce
*dce
, HWND hwnd
) DECLSPEC_HIDDEN
;
216 extern void invalidate_dce( struct tagWND
*win
, const RECT
*rect
) DECLSPEC_HIDDEN
;
217 extern void erase_now( HWND hwnd
, UINT rdw_flags
) DECLSPEC_HIDDEN
;
218 extern void move_window_bits( HWND hwnd
, struct window_surface
*old_surface
,
219 struct window_surface
*new_surface
,
220 const RECT
*visible_rect
, const RECT
*old_visible_rect
,
221 const RECT
*client_rect
, const RECT
*valid_rects
) DECLSPEC_HIDDEN
;
222 extern void *get_hook_proc( void *proc
, const WCHAR
*module
) DECLSPEC_HIDDEN
;
223 extern RECT
get_virtual_screen_rect(void) DECLSPEC_HIDDEN
;
224 extern LRESULT
call_current_hook( HHOOK hhook
, INT code
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
225 extern BOOL
map_wparam_AtoW( UINT message
, WPARAM
*wparam
, enum wm_char_mapping mapping
) DECLSPEC_HIDDEN
;
226 extern NTSTATUS
send_hardware_message( HWND hwnd
, const INPUT
*input
, UINT flags
) DECLSPEC_HIDDEN
;
227 extern LRESULT
MSG_SendInternalMessageTimeout( DWORD dest_pid
, DWORD dest_tid
,
228 UINT msg
, WPARAM wparam
, LPARAM lparam
,
229 UINT flags
, UINT timeout
, PDWORD_PTR res_ptr
) DECLSPEC_HIDDEN
;
230 extern HPEN
SYSCOLOR_GetPen( INT index
) DECLSPEC_HIDDEN
;
231 extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN
;
232 extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN
;
233 extern BOOL
USER_IsExitingThread( DWORD tid
) DECLSPEC_HIDDEN
;
235 extern BOOL
USER_SetWindowPos( WINDOWPOS
* winpos
) DECLSPEC_HIDDEN
;
237 typedef LRESULT (*winproc_callback_t
)( HWND hwnd
, UINT msg
, WPARAM wp
, LPARAM lp
,
238 LRESULT
*result
, void *arg
);
240 extern WNDPROC
WINPROC_GetProc( WNDPROC proc
, BOOL unicode
) DECLSPEC_HIDDEN
;
241 extern WNDPROC
WINPROC_AllocProc( WNDPROC func
, BOOL unicode
) DECLSPEC_HIDDEN
;
242 extern BOOL
WINPROC_IsUnicode( WNDPROC proc
, BOOL def_val
) DECLSPEC_HIDDEN
;
244 extern LRESULT
WINPROC_CallProcAtoW( winproc_callback_t callback
, HWND hwnd
, UINT msg
,
245 WPARAM wParam
, LPARAM lParam
, LRESULT
*result
, void *arg
,
246 enum wm_char_mapping mapping
) DECLSPEC_HIDDEN
;
248 extern INT_PTR
WINPROC_CallDlgProcA( DLGPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
249 extern INT_PTR
WINPROC_CallDlgProcW( DLGPROC func
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
250 extern BOOL
WINPROC_call_window( HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
,
251 LRESULT
*result
, BOOL unicode
, enum wm_char_mapping mapping
) DECLSPEC_HIDDEN
;
253 /* message spy definitions */
255 #define SPY_DISPATCHMESSAGE 0x0100
256 #define SPY_SENDMESSAGE 0x0101
257 #define SPY_DEFWNDPROC 0x0102
259 #define SPY_RESULT_OK 0x0001
260 #define SPY_RESULT_DEFWND 0x0002
262 extern const char *SPY_GetClassLongOffsetName( INT offset
) DECLSPEC_HIDDEN
;
263 extern const char *SPY_GetMsgName( UINT msg
, HWND hWnd
) DECLSPEC_HIDDEN
;
264 extern const char *SPY_GetVKeyName(WPARAM wParam
) DECLSPEC_HIDDEN
;
265 extern void SPY_EnterMessage( INT iFlag
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
266 extern void SPY_ExitMessage( INT iFlag
, HWND hwnd
, UINT msg
,
267 LRESULT lReturn
, WPARAM wParam
, LPARAM lParam
) DECLSPEC_HIDDEN
;
268 extern int SPY_Init(void) DECLSPEC_HIDDEN
;
270 #include "pshpack1.h"
295 } CURSORICONDIRENTRY
;
302 CURSORICONDIRENTRY idEntries
[1];
307 extern BOOL
get_icon_size( HICON handle
, SIZE
*size
) DECLSPEC_HIDDEN
;
309 /* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */
312 #define assert(expr) ((void)0)
315 #endif /* __WINE_USER_PRIVATE_H */