winsta: fix spec file
[reactos.git] / reactos / dll / win32 / user32 / include / user32p.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS System Libraries
4 * FILE: lib/user32/include/user32p.h
5 * PURPOSE: Win32 User Library Private Headers
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #ifndef USER32_PRIVATE_H
12 #define USER32_PRIVATE_H
13
14 /* Private User32 Headers */
15 #include "accel.h"
16 #include "cursor.h"
17 #include "controls.h"
18 #include "draw.h"
19 #include "dde_private.h"
20 #include "menu.h"
21 #include "message.h"
22 #include "regcontrol.h"
23 #include "resource.h"
24 #include "scroll.h"
25 #include "window.h"
26 #include "winpos.h"
27 #include "winsta.h"
28 #include "ntwrapper.h"
29
30 /* One/Two Param Functions */
31 #define NtUserMsqSetWakeMask(dwWaitMask) \
32 (HANDLE)NtUserCallOneParam(dwWaitMask, ONEPARAM_ROUTINE_MSQSETWAKEMASK)
33
34 #define NtUserMsqClearWakeMask() \
35 NtUserCallNoParam(NOPARAM_ROUTINE_MSQCLEARWAKEMASK)
36
37 #define NtUserAnyPopup() \
38 (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ANYPOPUP)
39
40 #define NtUserValidateRgn(hWnd, hRgn) \
41 (BOOL)NtUserCallTwoParam((DWORD_PTR)hWnd, (DWORD_PTR)hRgn, TWOPARAM_ROUTINE_VALIDATERGN)
42
43 #define NtUserSetWindowContextHelpId(hWnd, dwContextHelpId) \
44 (BOOL)NtUserCallHwndParam(hWnd, dwContextHelpId, HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID)
45
46 #define NtUserSetCaretPos(X, Y) \
47 (BOOL)NtUserCallTwoParam((DWORD_PTR)X, (DWORD_PTR)Y, TWOPARAM_ROUTINE_SETCARETPOS)
48
49 #define NtUserSetGUIThreadHandle(field, hwnd) \
50 (BOOL)NtUserCallTwoParam((DWORD_PTR)field, (DWORD_PTR)hwnd, TWOPARAM_ROUTINE_SETGUITHRDHANDLE)
51
52 #define NtUserSetMenuItemRect(menu, mir) \
53 (BOOL)NtUserCallTwoParam((DWORD_PTR)menu, (DWORD_PTR)mir, TWOPARAM_ROUTINE_SETMENUITEMRECT)
54
55 #define NtUserSetMenuBarHeight(menu, height) \
56 (BOOL)NtUserCallTwoParam((DWORD_PTR)menu, (DWORD_PTR)height, TWOPARAM_ROUTINE_SETMENUBARHEIGHT)
57
58 #define NtUserRegisterLogonProcess(hproc, x) \
59 (BOOL)NtUserCallTwoParam((DWORD_PTR)hproc, (DWORD_PTR)x, TWOPARAM_ROUTINE_REGISTERLOGONPROC)
60
61 #define NtUserGetSysColorBrushes(HBrushes, count) \
62 (BOOL)NtUserCallTwoParam((DWORD_PTR)(HBrushes), (DWORD_PTR)(count), TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES)
63
64 #define NtUserGetSysColors(ColorRefs, count) \
65 (BOOL)NtUserCallTwoParam((DWORD_PTR)(ColorRefs), (DWORD_PTR)(count), TWOPARAM_ROUTINE_GETSYSCOLORS)
66
67 #define NtUserSetCaretBlinkTime(uMSeconds) \
68 (BOOL)NtUserCallOneParam((DWORD_PTR)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
69
70 /*
71 #define NtUserEnumClipboardFormats(format) \
72 (UINT)NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS)
73 */
74
75 #define NtUserWindowFromDC(hDC) \
76 (HWND)NtUserCallOneParam((DWORD_PTR)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC)
77
78 #define NtUserSwitchCaretShowing(CaretInfo) \
79 (BOOL)NtUserCallOneParam((DWORD_PTR)CaretInfo, ONEPARAM_ROUTINE_SWITCHCARETSHOWING)
80
81 #define NtUserSwapMouseButton(fSwap) \
82 (BOOL)NtUserCallOneParam((DWORD_PTR)fSwap, ONEPARAM_ROUTINE_SWAPMOUSEBUTTON)
83
84 #define NtUserGetMenu(hWnd) \
85 (HMENU)NtUserCallOneParam((DWORD_PTR)hWnd, ONEPARAM_ROUTINE_GETMENU)
86
87 #define NtUserSetMessageExtraInfo(lParam) \
88 (LPARAM)NtUserCallOneParam((DWORD_PTR)lParam, ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO)
89
90 #define NtUserIsWindowUnicode(hWnd) \
91 (BOOL)NtUserCallOneParam((DWORD_PTR)hWnd, ONEPARAM_ROUTINE_ISWINDOWUNICODE)
92
93 #define NtUserGetWindowContextHelpId(hwnd) \
94 NtUserCallOneParam((DWORD_PTR)hwnd, ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID)
95
96 #define NtUserGetWindowInstance(hwnd) \
97 (HINSTANCE)NtUserCallOneParam((DWORD_PTR)hwnd, ONEPARAM_ROUTINE_GETWINDOWINSTANCE)
98
99 #define NtUserGetCursorPos(lpPoint) \
100 (BOOL)NtUserCallOneParam((DWORD_PTR)lpPoint, ONEPARAM_ROUTINE_GETCURSORPOSITION)
101
102 #define NtUserIsWindowInDestroy(hWnd) \
103 (BOOL)NtUserCallOneParam((DWORD_PTR)hWnd, ONEPARAM_ROUTINE_ISWINDOWINDESTROY)
104
105 #define NtUserEnableProcessWindowGhosting(bEnable) \
106 NtUserCallOneParam((DWORD_PTR)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
107
108 #define NtUserShowCursor(bShow) \
109 NtUserCallOneParam((DWORD_PTR)bShow, ONEPARAM_ROUTINE_SHOWCURSOR)
110
111 #define NtUserGetDesktopMapping(Ptr) \
112 (PVOID)NtUserCallOneParam((DWORD_PTR)Ptr, ONEPARAM_ROUTINE_GETDESKTOPMAPPING)
113
114 #define ShowCaret(hwnd) \
115 NtUserShowCaret(hwnd)
116
117 #define HideCaret(hwnd) \
118 NtUserHideCaret(hwnd)
119
120 #define NtUserRegisterSystemClasses(Count,SysClasses) \
121 (BOOL)NtUserCallTwoParam(Count, (DWORD_PTR)SysClasses, TWOPARAM_ROUTINE_ROS_REGSYSCLASSES)
122
123 /* Internal Thread Data */
124 extern HINSTANCE User32Instance;
125 extern HINSTANCE hImmInstance;
126
127 /* Critical Section*/
128 extern RTL_CRITICAL_SECTION User32Crit;
129
130 typedef struct _USER32_TRACKINGLIST {
131 TRACKMOUSEEVENT tme;
132 POINT pos; /* center of hover rectangle */
133 UINT_PTR timer;
134 } USER32_TRACKINGLIST,*PUSER32_TRACKINGLIST;
135
136 typedef struct _USER32_THREAD_DATA
137 {
138 MSG LastMessage;
139 HKL KeyboardLayoutHandle;
140 USER32_TRACKINGLIST tracking_info; /* TrackMouseEvent stuff */
141 } USER32_THREAD_DATA, *PUSER32_THREAD_DATA;
142
143 PUSER32_THREAD_DATA User32GetThreadData();
144
145 DEVMODEW *
146 WINAPI
147 GdiConvertToDevmodeW(DEVMODEA *dm);
148
149 /* FIXME: Belongs to some header. */
150 BOOL WINAPI GdiDllInitialize(HANDLE, DWORD, LPVOID);
151 void InitStockObjects(void);
152 VOID DeleteFrameBrushes(VOID);
153
154 /* message spy definitions */
155 #define SPY_DISPATCHMESSAGE 0x0101
156 #define SPY_SENDMESSAGE 0x0103
157 #define SPY_DEFWNDPROC 0x0105
158
159 #define SPY_RESULT_OK 0x0001
160 #define SPY_RESULT_INVALIDHWND 0x0003
161 #define SPY_RESULT_DEFWND 0x0005
162
163
164 extern const char *SPY_GetMsgName(UINT msg, HWND hWnd);
165 extern const char *SPY_GetVKeyName(WPARAM wParam);
166 extern void SPY_EnterMessage(INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
167 extern void SPY_ExitMessage(INT iFlag, HWND hwnd, UINT msg,
168 LRESULT lReturn, WPARAM wParam, LPARAM lParam);
169 extern int SPY_Init(void);
170
171
172 /* Validate window handle types */
173 #define VALIDATE_TYPE_FREE 0
174 #define VALIDATE_TYPE_WIN 1
175 #define VALIDATE_TYPE_MENU 2
176 #define VALIDATE_TYPE_CURSOR 3
177 #define VALIDATE_TYPE_MWPOS 4
178 #define VALIDATE_TYPE_HOOK 5
179 #define VALIDATE_TYPE_CALLPROC 7
180 #define VALIDATE_TYPE_ACCEL 8
181 #define VALIDATE_TYPE_MONITOR 12
182 #define VALIDATE_TYPE_EVENT 15
183 #define VALIDATE_TYPE_TIMER 16
184
185 #define FIRST_USER_HANDLE 0x0020 /* first possible value for low word of user handle */
186 #define LAST_USER_HANDLE 0xffef /* last possible value for low word of user handle */
187 #define NB_USER_HANDLES ((LAST_USER_HANDLE - FIRST_USER_HANDLE + 1) >> 1)
188 #define USER_HANDLE_TO_INDEX(hwnd) ((LOWORD(hwnd) - FIRST_USER_HANDLE) >> 1)
189
190 #define USER_HEADER_TO_BODY(ObjectHeader) \
191 ((PVOID)(((PUSER_OBJECT_HEADER)ObjectHeader) + 1))
192
193 #define USER_BODY_TO_HEADER(ObjectBody) \
194 ((PUSER_OBJECT_HEADER)(((PUSER_OBJECT_HEADER)ObjectBody) - 1))
195
196 typedef struct _USER_HANDLE_ENTRY
197 {
198 void *ptr; /* pointer to object */
199 union
200 {
201 PVOID pi;
202 PTHREADINFO pti; // pointer to Win32ThreadInfo
203 PPROCESSINFO ppi; // pointer to W32ProcessInfo
204 };
205 unsigned short type; /* object type (0 if free) */
206 unsigned short generation; /* generation counter */
207 } USER_HANDLE_ENTRY, * PUSER_HANDLE_ENTRY;
208
209 typedef struct _USER_HANDLE_TABLE
210 {
211 PUSER_HANDLE_ENTRY handles;
212 PUSER_HANDLE_ENTRY freelist;
213 int nb_handles;
214 int allocated_handles;
215 } USER_HANDLE_TABLE, * PUSER_HANDLE_TABLE;
216
217 extern PUSER_HANDLE_TABLE gHandleTable;
218 extern PUSER_HANDLE_ENTRY gHandleEntries;
219
220 PUSER_HANDLE_ENTRY FASTCALL GetUser32Handle(HANDLE);
221 PVOID FASTCALL ValidateHandle(HANDLE, UINT);
222
223 #define WIN_GetFullHandle(h) ((HWND)(h))
224
225 #ifndef __ms_va_list
226 # if defined(__x86_64__) && defined (__GNUC__)
227 # define __ms_va_list __builtin_ms_va_list
228 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
229 # define __ms_va_end(list) __builtin_ms_va_end(list)
230 # else
231 # define __ms_va_list va_list
232 # define __ms_va_start(list,arg) va_start(list,arg)
233 # define __ms_va_end(list) va_end(list)
234 # endif
235 #endif
236
237 #ifdef _MSC_VER
238 #ifndef inline
239 #define inline __inline
240 #endif
241 #endif
242
243 /* Hack away wine hack */
244 #define __TRY if(1)
245 #define __EXCEPT_PAGE_FAULT else
246 #define __ENDTRY
247
248 #endif
249 /* EOF */