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