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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_USER_PRIVATE_H
22 #define __WINE_USER_PRIVATE_H
33 extern WORD USER_HeapSel;
35 #define USER_HEAP_ALLOC(size) \
36 ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) ))
37 #define USER_HEAP_REALLOC(handle,size) \
38 ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED ))
39 #define USER_HEAP_FREE(handle) \
40 LOCAL_Free( USER_HeapSel, LOWORD(handle) )
41 #define USER_HEAP_LIN_ADDR(handle) \
42 ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL)
44 #define GET_WORD(ptr) (*(const WORD *)(ptr))
45 #define GET_DWORD(ptr) (*(const DWORD *)(ptr))
47 /* internal messages codes */
48 enum wine_internal_message
50 WM_WINE_DESTROYWINDOW = 0x80000000,
54 WM_WINE_SETWINDOWLONG,
56 WM_WINE_SETACTIVEWINDOW,
57 WM_WINE_KEYBOARD_LL_HOOK,
58 WM_WINE_MOUSE_LL_HOOK,
59 WM_WINE_FIRST_DRIVER_MSG = 0x80001000, /* range of messages reserved for the USER driver */
60 WM_WINE_LAST_DRIVER_MSG = 0x80001fff
63 struct tagCURSORICONINFO;
65 typedef struct tagUSER_DRIVER {
66 /* keyboard functions */
67 HKL (*pActivateKeyboardLayout)(HKL, UINT);
69 SHORT (*pGetAsyncKeyState)(INT);
70 INT (*pGetKeyNameText)(LONG, LPWSTR, INT);
71 HKL (*pGetKeyboardLayout)(DWORD);
72 UINT (*pGetKeyboardLayoutList)(INT, HKL *);
73 BOOL (*pGetKeyboardLayoutName)(LPWSTR);
74 HKL (*pLoadKeyboardLayout)(LPCWSTR, UINT);
75 UINT (*pMapVirtualKeyEx)(UINT, UINT, HKL);
76 UINT (*pSendInput)(UINT, LPINPUT, int);
77 INT (*pToUnicodeEx)(UINT, UINT, LPBYTE, LPWSTR, int, UINT, HKL);
78 BOOL (*pUnloadKeyboardLayout)(HKL);
79 SHORT (*pVkKeyScanEx)(WCHAR, HKL);
81 void (*pSetCursor)(struct tagCURSORICONINFO *);
82 BOOL (*pGetCursorPos)(LPPOINT);
83 BOOL (*pSetCursorPos)(INT,INT);
84 /* screen saver functions */
85 BOOL (*pGetScreenSaveActive)(void);
86 void (*pSetScreenSaveActive)(BOOL);
87 /* clipboard functions */
88 void (*pAcquireClipboard)(HWND); /* Acquire selection */
89 BOOL (*pCountClipboardFormats)(void); /* Count available clipboard formats */
90 void (*pEmptyClipboard)(BOOL); /* Empty clipboard data */
91 BOOL (*pEndClipboardUpdate)(void); /* End clipboard update */
92 BOOL (*pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */
93 BOOL (*pGetClipboardData)(UINT, HANDLE16*, HANDLE*); /* Get specified selection data */
94 BOOL (*pGetClipboardFormatName)(UINT, LPWSTR, UINT); /* Get a clipboard format name */
95 BOOL (*pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */
96 INT (*pRegisterClipboardFormat)(LPCWSTR); /* Register a clipboard format */
97 void (*pResetSelectionOwner)(HWND, BOOL);
98 BOOL (*pSetClipboardData)(UINT, HANDLE16, HANDLE, BOOL); /* Set specified selection data */
100 LONG (*pChangeDisplaySettingsExW)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
101 BOOL (*pEnumDisplaySettingsExW)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
102 /* windowing functions */
103 BOOL (*pCreateWindow)(HWND,CREATESTRUCTA*,BOOL);
104 BOOL (*pDestroyWindow)(HWND);
105 HDC (*pGetDCEx)(HWND,HRGN,DWORD);
106 DWORD (*pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
107 BOOL (*pReleaseDC)(HWND,HDC,BOOL);
108 BOOL (*pScrollDC)(HDC, INT, INT, const RECT *, const RECT *, HRGN, LPRECT);
109 void (*pSetFocus)(HWND);
110 HWND (*pSetParent)(HWND,HWND);
111 BOOL (*pSetWindowPos)(WINDOWPOS *);
112 int (*pSetWindowRgn)(HWND,HRGN,BOOL);
113 void (*pSetWindowIcon)(HWND,UINT,HICON);
114 void (*pSetWindowStyle)(HWND,DWORD);
115 BOOL (*pSetWindowText)(HWND,LPCWSTR);
116 BOOL (*pShowWindow)(HWND,INT);
117 void (*pSysCommandSizeMove)(HWND,WPARAM);
118 HWND (*pWindowFromDC)(HDC);
119 LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
122 extern USER_DRIVER USER_Driver;
124 struct received_message_info;
125 struct hook16_queue_info;
127 /* this is the structure stored in TEB->Win32ClientInfo */
128 /* no attempt is made to keep the layout compatible with the Windows one */
129 struct user_thread_info
131 HANDLE server_queue; /* 00 Handle to server-side queue */
132 DWORD recursion_count; /* 04 SendMessage recursion counter */
133 HHOOK hook; /* 08 Current hook */
134 struct received_message_info *receive_info; /* 0c Message being currently received */
135 struct hook16_queue_info *hook16_info; /* 10 Opaque pointer for 16-bit hook support */
136 DWORD GetMessageTimeVal; /* 14 Value for GetMessageTime */
137 DWORD GetMessagePosVal; /* 18 Value for GetMessagePos */
138 DWORD GetMessageExtraInfoVal; /* 1c Value for GetMessageExtraInfo */
139 HCURSOR cursor; /* 20 Current cursor */
140 INT cursor_count; /* 24 Cursor show count */
141 /* 28-7c Available for more data */
144 static inline struct user_thread_info *get_user_thread_info(void)
146 return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
149 /* check if hwnd is a broadcast magic handle */
150 static inline BOOL is_broadcast( HWND hwnd )
152 return (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST);
155 extern HMODULE user32_module;
156 extern DWORD USER16_AlertableWait;
157 extern HBRUSH SYSCOLOR_55AABrush;
159 extern BOOL CLIPBOARD_ReleaseOwner(void);
160 extern BOOL FOCUS_MouseActivate( HWND hwnd );
161 extern BOOL HOOK_IsHooked( INT id );
162 extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
163 UINT msg, WPARAM wparam, LPARAM lparam,
164 UINT flags, UINT timeout, PDWORD_PTR res_ptr );
165 extern void SYSCOLOR_Init(void);
166 extern HPEN SYSCOLOR_GetPen( INT index );
167 extern void SYSPARAMS_Init(void);
168 extern void USER_CheckNotLock(void);
169 extern BOOL USER_IsExitingThread( DWORD tid );
171 /* message spy definitions */
173 #define SPY_DISPATCHMESSAGE16 0x0100
174 #define SPY_DISPATCHMESSAGE 0x0101
175 #define SPY_SENDMESSAGE16 0x0102
176 #define SPY_SENDMESSAGE 0x0103
177 #define SPY_DEFWNDPROC16 0x0104
178 #define SPY_DEFWNDPROC 0x0105
180 #define SPY_RESULT_OK16 0x0000
181 #define SPY_RESULT_OK 0x0001
182 #define SPY_RESULT_INVALIDHWND16 0x0002
183 #define SPY_RESULT_INVALIDHWND 0x0003
184 #define SPY_RESULT_DEFWND16 0x0004
185 #define SPY_RESULT_DEFWND 0x0005
187 extern const char *SPY_GetMsgName( UINT msg, HWND hWnd );
188 extern const char *SPY_GetVKeyName(WPARAM wParam);
189 extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
190 extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
191 LRESULT lReturn, WPARAM wParam, LPARAM lParam );
192 extern int SPY_Init(void);
194 /* HANDLE16 <-> HANDLE conversions */
195 #define HCURSOR_16(h32) (LOWORD(h32))
196 #define HICON_16(h32) (LOWORD(h32))
197 #define HINSTANCE_16(h32) (LOWORD(h32))
199 #define HCURSOR_32(h16) ((HCURSOR)(ULONG_PTR)(h16))
200 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
201 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
202 #define HMODULE_32(h16) ((HMODULE)(ULONG_PTR)(h16))
204 #endif /* __WINE_USER_PRIVATE_H */