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