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
31 #include "wine/windef16.h"
32 #include "wine/winbase16.h"
34 extern WORD USER_HeapSel
;
36 static inline HLOCAL16
LOCAL_Alloc( HANDLE16 ds
, UINT16 flags
, WORD size
)
38 STACK16FRAME
* stack16
= MapSL((SEGPTR
)NtCurrentTeb()->WOW32Reserved
);
39 HANDLE16 oldDS
= stack16
->ds
;
43 ret
= LocalAlloc16 (flags
, size
);
48 static inline HLOCAL16
LOCAL_ReAlloc( HANDLE16 ds
, HLOCAL16 handle
, WORD size
, UINT16 flags
)
50 STACK16FRAME
* stack16
= MapSL((SEGPTR
)NtCurrentTeb()->WOW32Reserved
);
51 HANDLE16 oldDS
= stack16
->ds
;
55 ret
= LocalReAlloc16 (handle
, size
, flags
);
60 static inline HLOCAL16
LOCAL_Free( HANDLE16 ds
, HLOCAL16 handle
)
62 STACK16FRAME
* stack16
= MapSL((SEGPTR
)NtCurrentTeb()->WOW32Reserved
);
63 HANDLE16 oldDS
= stack16
->ds
;
67 ret
= LocalFree16 (handle
);
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)
81 #define GET_WORD(ptr) (*(const WORD *)(ptr))
82 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
84 #define WM_SYSTIMER 0x0118
86 /* internal messages codes */
87 enum wine_internal_message
89 WM_WINE_DESTROYWINDOW
= 0x80000000,
93 WM_WINE_SETWINDOWLONG
,
95 WM_WINE_SETACTIVEWINDOW
,
96 WM_WINE_KEYBOARD_LL_HOOK
,
97 WM_WINE_MOUSE_LL_HOOK
,
98 WM_WINE_FIRST_DRIVER_MSG
= 0x80001000, /* range of messages reserved for the USER driver */
99 WM_WINE_LAST_DRIVER_MSG
= 0x80001fff
102 struct tagCURSORICONINFO
;
104 typedef struct tagUSER_DRIVER
{
105 /* keyboard functions */
106 HKL (*pActivateKeyboardLayout
)(HKL
, UINT
);
108 SHORT (*pGetAsyncKeyState
)(INT
);
109 INT (*pGetKeyNameText
)(LONG
, LPWSTR
, INT
);
110 HKL (*pGetKeyboardLayout
)(DWORD
);
111 UINT (*pGetKeyboardLayoutList
)(INT
, HKL
*);
112 BOOL (*pGetKeyboardLayoutName
)(LPWSTR
);
113 HKL (*pLoadKeyboardLayout
)(LPCWSTR
, UINT
);
114 UINT (*pMapVirtualKeyEx
)(UINT
, UINT
, HKL
);
115 UINT (*pSendInput
)(UINT
, LPINPUT
, int);
116 INT (*pToUnicodeEx
)(UINT
, UINT
, LPBYTE
, LPWSTR
, int, UINT
, HKL
);
117 BOOL (*pUnloadKeyboardLayout
)(HKL
);
118 SHORT (*pVkKeyScanEx
)(WCHAR
, HKL
);
119 /* mouse functions */
120 void (*pSetCursor
)(struct tagCURSORICONINFO
*);
121 BOOL (*pGetCursorPos
)(LPPOINT
);
122 BOOL (*pSetCursorPos
)(INT
,INT
);
123 /* screen saver functions */
124 BOOL (*pGetScreenSaveActive
)(void);
125 void (*pSetScreenSaveActive
)(BOOL
);
126 /* clipboard functions */
127 INT (*pAcquireClipboard
)(HWND
); /* Acquire selection */
128 BOOL (*pCountClipboardFormats
)(void); /* Count available clipboard formats */
129 void (*pEmptyClipboard
)(BOOL
); /* Empty clipboard data */
130 void (*pEndClipboardUpdate
)(void); /* End clipboard update */
131 UINT (*pEnumClipboardFormats
)(UINT
); /* Enumerate clipboard formats */
132 BOOL (*pGetClipboardData
)(UINT
, HANDLE16
*, HANDLE
*); /* Get specified selection data */
133 INT (*pGetClipboardFormatName
)(UINT
, LPWSTR
, UINT
); /* Get a clipboard format name */
134 BOOL (*pIsClipboardFormatAvailable
)(UINT
); /* Check if specified format is available */
135 UINT (*pRegisterClipboardFormat
)(LPCWSTR
); /* Register a clipboard format */
136 BOOL (*pSetClipboardData
)(UINT
, HANDLE16
, HANDLE
, BOOL
); /* Set specified selection data */
138 LONG (*pChangeDisplaySettingsEx
)(LPCWSTR
,LPDEVMODEW
,HWND
,DWORD
,LPVOID
);
139 BOOL (*pEnumDisplayMonitors
)(HDC
,LPRECT
,MONITORENUMPROC
,LPARAM
);
140 BOOL (*pEnumDisplaySettingsEx
)(LPCWSTR
,DWORD
,LPDEVMODEW
,DWORD
);
141 BOOL (*pGetMonitorInfo
)(HMONITOR
,MONITORINFO
*);
142 /* windowing functions */
143 BOOL (*pCreateDesktopWindow
)(HWND
);
144 BOOL (*pCreateWindow
)(HWND
,CREATESTRUCTA
*,BOOL
);
145 void (*pDestroyWindow
)(HWND
);
146 HDC (*pGetDCEx
)(HWND
,HRGN
,DWORD
);
147 DWORD (*pMsgWaitForMultipleObjectsEx
)(DWORD
,const HANDLE
*,DWORD
,DWORD
,DWORD
);
148 INT (*pReleaseDC
)(HWND
,HDC
,BOOL
);
149 BOOL (*pScrollDC
)(HDC
, INT
, INT
, const RECT
*, const RECT
*, HRGN
, LPRECT
);
150 void (*pSetFocus
)(HWND
);
151 HWND (*pSetParent
)(HWND
,HWND
);
152 BOOL (*pSetWindowPos
)(WINDOWPOS
*);
153 int (*pSetWindowRgn
)(HWND
,HRGN
,BOOL
);
154 void (*pSetWindowIcon
)(HWND
,UINT
,HICON
);
155 void (*pSetWindowStyle
)(HWND
,DWORD
);
156 void (*pSetWindowText
)(HWND
,LPCWSTR
);
157 BOOL (*pShowWindow
)(HWND
,INT
);
158 void (*pSysCommandSizeMove
)(HWND
,WPARAM
);
159 HWND (*pWindowFromDC
)(HDC
);
160 LRESULT (*pWindowMessage
)(HWND
,UINT
,WPARAM
,LPARAM
);
163 extern const USER_DRIVER
*USER_Driver
;
165 extern void USER_unload_driver(void);
167 struct received_message_info
;
168 struct hook16_queue_info
;
170 /* this is the structure stored in TEB->Win32ClientInfo */
171 /* no attempt is made to keep the layout compatible with the Windows one */
172 struct user_thread_info
174 HANDLE server_queue
; /* Handle to server-side queue */
175 DWORD recursion_count
; /* SendMessage recursion counter */
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 hook16_queue_info
*hook16_info
; /* Opaque pointer for 16-bit hook support */
180 DWORD GetMessageTimeVal
; /* Value for GetMessageTime */
181 DWORD GetMessagePosVal
; /* Value for GetMessagePos */
182 ULONG_PTR GetMessageExtraInfoVal
; /* Value for GetMessageExtraInfo */
183 HCURSOR cursor
; /* Current cursor */
184 INT cursor_count
; /* Cursor show count */
185 UINT active_hooks
; /* Bitmap of active hooks */
186 HWND desktop
; /* Desktop window */
188 ULONG pad
[11]; /* Available for more data */
191 struct hook_extra_info
197 static inline struct user_thread_info
*get_user_thread_info(void)
199 return (struct user_thread_info
*)NtCurrentTeb()->Win32ClientInfo
;
202 /* check if hwnd is a broadcast magic handle */
203 static inline BOOL
is_broadcast( HWND hwnd
)
205 return (hwnd
== HWND_BROADCAST
|| hwnd
== HWND_TOPMOST
);
208 extern HMODULE user32_module
;
209 extern DWORD USER16_AlertableWait
;
210 extern HBRUSH SYSCOLOR_55AABrush
;
212 extern BOOL
CLIPBOARD_ReleaseOwner(void);
213 extern BOOL
FOCUS_MouseActivate( HWND hwnd
);
214 extern BOOL
HOOK_IsHooked( INT id
);
215 extern LRESULT
call_current_hook( HHOOK hhook
, INT code
, WPARAM wparam
, LPARAM lparam
);
216 extern LRESULT
MSG_SendInternalMessageTimeout( DWORD dest_pid
, DWORD dest_tid
,
217 UINT msg
, WPARAM wparam
, LPARAM lparam
,
218 UINT flags
, UINT timeout
, PDWORD_PTR res_ptr
);
219 extern HPEN
SYSCOLOR_GetPen( INT index
);
220 extern void SYSPARAMS_Init(void);
221 extern void USER_CheckNotLock(void);
222 extern BOOL
USER_IsExitingThread( DWORD tid
);
224 /* message spy definitions */
226 #define SPY_DISPATCHMESSAGE16 0x0100
227 #define SPY_DISPATCHMESSAGE 0x0101
228 #define SPY_SENDMESSAGE16 0x0102
229 #define SPY_SENDMESSAGE 0x0103
230 #define SPY_DEFWNDPROC16 0x0104
231 #define SPY_DEFWNDPROC 0x0105
233 #define SPY_RESULT_OK16 0x0000
234 #define SPY_RESULT_OK 0x0001
235 #define SPY_RESULT_INVALIDHWND16 0x0002
236 #define SPY_RESULT_INVALIDHWND 0x0003
237 #define SPY_RESULT_DEFWND16 0x0004
238 #define SPY_RESULT_DEFWND 0x0005
240 extern const char *SPY_GetMsgName( UINT msg
, HWND hWnd
);
241 extern const char *SPY_GetVKeyName(WPARAM wParam
);
242 extern void SPY_EnterMessage( INT iFlag
, HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
243 extern void SPY_ExitMessage( INT iFlag
, HWND hwnd
, UINT msg
,
244 LRESULT lReturn
, WPARAM wParam
, LPARAM lParam
);
245 extern int SPY_Init(void);
247 /* HANDLE16 <-> HANDLE conversions */
248 #define HCURSOR_16(h32) (LOWORD(h32))
249 #define HICON_16(h32) (LOWORD(h32))
250 #define HINSTANCE_16(h32) (LOWORD(h32))
252 #define HCURSOR_32(h16) ((HCURSOR)(ULONG_PTR)(h16))
253 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
254 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
255 #define HMODULE_32(h16) ((HMODULE)(ULONG_PTR)(h16))
257 #include "pshpack1.h"
282 } CURSORICONDIRENTRY
;
289 CURSORICONDIRENTRY idEntries
[1];
294 extern void CURSORICON_FreeModuleIcons( HMODULE16 hModule
);
296 #endif /* __WINE_USER_PRIVATE_H */