7001e985f042ee3f4ec1a50efbc29102cb946d32
[reactos.git] / sdk / include / reactos / undocuser.h
1 #ifndef _UNDOCUSER_H
2 #define _UNDOCUSER_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif /* defined(__cplusplus) */
7
8 /* Built in class atoms */
9 #define WC_MENU (MAKEINTATOM(0x8000))
10 #define WC_DESKTOP (MAKEINTATOM(0x8001))
11 #define WC_DIALOG (MAKEINTATOM(0x8002))
12 #define WC_SWITCH (MAKEINTATOM(0x8003))
13 #define WC_ICONTITLE (MAKEINTATOM(0x8004))
14
15 /* Non SDK Styles */
16 #define ES_COMBO 0x200 /* Parent is a combobox */
17 #define WS_MAXIMIZED WS_MAXIMIZE
18 #define WS_MINIMIZED WS_MINIMIZE
19
20 /* Non SDK ExStyles */
21 #define WS_EX_DRAGDETECT 0x00000002
22 #define WS_EX_MAKEVISIBLEWHENUNGHOSTED 0x00000800
23 #define WS_EX_FORCELEGACYRESIZENCMETR 0x00800000
24 #define WS_EX_UISTATEACTIVE 0x04000000
25 #define WS_EX_REDIRECTED 0x20000000
26 #define WS_EX_UISTATEKBACCELHIDDEN 0x40000000
27 #define WS_EX_UISTATEFOCUSRECTHIDDEN 0x80000000
28 #define WS_EX_SETANSICREATOR 0x80000000 // For WNDS_ANSICREATOR
29
30 /* Non SDK Window Message types. */
31 #define WM_SETVISIBLE 0x00000009
32 #define WM_ALTTABACTIVE 0x00000029
33 #define WM_ISACTIVEICON 0x00000035
34 #define WM_QUERYPARKICON 0x00000036
35 #define WM_CLIENTSHUTDOWN 0x0000003B
36 #define WM_COPYGLOBALDATA 0x00000049
37 #define WM_LOGONNOTIFY 0x0000004C
38 #define WM_KEYF1 0x0000004D
39 #define WM_KLUDGEMINRECT 0x0000008B
40 #define WM_UAHDRAWMENU 0x00000091
41 #define WM_UAHDRAWITEM 0x00000092 // WM_DRAWITEM
42 #define WM_UAHINITMENU 0x00000093
43 #define WM_UAHMEASUREITEM 0x00000094 // WM_MEASUREITEM
44 #define WM_UAHDRAWMENUNC 0x00000095
45 #define WM_NCUAHDRAWCAPTION 0x000000AE
46 #define WM_NCUAHDRAWFRAME 0x000000AF
47 #define WM_SYSTIMER 0x00000118
48 #define WM_LBTRACKPOINT 0x00000131
49 #define WM_CBLOSTTEXTFOCUS 0x00000167
50 #define LB_CARETON 0x000001a3
51 #define LB_CARETOFF 0x000001a4
52 #define MN_SETHMENU 0x000001e0
53 #define WM_DROPOBJECT 0x0000022A
54 #define WM_QUERYDROPOBJECT 0x0000022B
55 #define WM_BEGINDRAG 0x0000022C
56 #define WM_DRAGLOOP 0x0000022D
57 #define WM_DRAGSELECT 0x0000022E
58 #define WM_DRAGMOVE 0x0000022F
59 #define WM_POPUPSYSTEMMENU 0x00000313
60 #define WM_UAHINIT 0x0000031b
61 #define WM_CBT 0x000003FF // ReactOS only.
62 #define WM_MAXIMUM 0x0001FFFF
63
64 /* Non SDK DCE types.*/
65 #define DCX_USESTYLE 0x00010000
66 #define DCX_KEEPCLIPRGN 0x00040000
67 #define DCX_KEEPLAYOUT 0x40000000
68 #define DCX_PROCESSOWNED 0x80000000
69
70 /* Non SDK TPM types.*/
71 #define TPM_SYSTEM_MENU 0x00000200
72
73 /* NtUserCreateWindowEx dwFlags bits. */
74 #define NUCWE_ANSI 0x00000001
75 #define NUCWE_SIDEBYSIDE 0x40000000
76
77 /* Caret timer ID */
78 #define IDCARETTIMER (0xffff)
79 #define ID_TME_TIMER (0xFFFA)
80
81 /* SetWindowPos undocumented flags */
82 #define SWP_NOCLIENTSIZE 0x0800
83 #define SWP_NOCLIENTMOVE 0x1000
84 #define SWP_STATECHANGED 0x8000
85
86 /* NtUserSetScrollInfo mask to return original position before it is change */
87 #define SIF_PREVIOUSPOS 4096
88
89 /* ScrollWindow uses the window DC, ScrollWindowEx doesn't */
90 #define SW_SCROLLWNDDCE 0x8000
91
92 /* Non SDK Queue state flags. */
93 #define QS_SMRESULT 0x8000 /* see "Undoc. Windows" */
94 //
95 #define QS_EVENT 0x2000
96 #define QS_SYSEVENT (QS_EVENT|QS_SENDMESSAGE)
97 //
98
99 //
100 // Definitions used by WM_CLIENTSHUTDOWN
101 //
102 // Client Shutdown messages
103 #define MCS_ENDSESSION 1
104 #define MCS_QUERYENDSESSION 2
105 // Client Shutdown returns
106 #define MCSR_GOODFORSHUTDOWN 1
107 #define MCSR_SHUTDOWNFINISHED 2
108 #define MCSR_DONOTSHUTDOWN 3
109
110 //
111 // Definitions used by WM_LOGONNOTIFY
112 //
113 #define LN_LOGOFF 0x0
114 #define LN_SHELL_EXITED 0x2
115 #define LN_START_TASK_MANAGER 0x4
116 #define LN_LOCK_WORKSTATION 0x5
117 #define LN_UNLOCK_WORKSTATION 0x6
118 #define LN_MESSAGE_BEEP 0x9
119 #define LN_START_SCREENSAVE 0xA
120 #define LN_LOGOFF_CANCELED 0xB
121
122 //
123 // Undocumented flags for ExitWindowsEx
124 //
125 #define EWX_SHUTDOWN_CANCELED 0x0080
126 #define EWX_CALLER_SYSTEM 0x0100
127 #define EWX_CALLER_WINLOGON 0x0200
128 #define EWX_CALLER_WINLOGON_LOGOFF 0x1000 // WARNING!! Broken flag.
129 // All the range 0x0400 to 0x1000 is reserved for Winlogon.
130 // Flag 0x2000 appears to be a flag set when we call InitiateSystemShutdown* APIs (Winlogon shutdown APIs).
131 // 0x4000 is also reserved.
132 #define EWX_NOTIFY 0x8000
133 #define EWX_NONOTIFY 0x10000
134
135 // From WinCE 6.0 Imm.h SDK
136 // Returns for ImmProcessHotKey
137 #define IPHK_HOTKEY 0x0001
138 #define IPHK_PROCESSBYIME 0x0002
139 #define IPHK_CHECKCTRL 0x0004
140 #define IPHK_SKIPTHISKEY 0x0010
141
142 //
143 // Undocumented flags for DrawCaptionTemp
144 //
145 #define DC_NOVISIBLE 0x0800
146 #define DC_NOSENDMSG 0x2000
147 #define DC_FRAME 0x8000 // Missing from WinUser.H!
148
149 #define DC_DRAWCAPTIONMD 0x10000000
150 #define DC_REDRAWHUNGWND 0x20000000
151 #define DC_DRAWFRAMEMD 0x80000000
152
153 //
154 // Undocumented states for DrawFrameControl
155 //
156 #define DFCS_MENUARROWUP 0x0008
157 #define DFCS_MENUARROWDOWN 0x0010
158
159
160 #define STARTF_SCRNSAVER 0x80000000
161
162 #define MOD_WINLOGON_SAS 0x8000
163
164 #define CW_USEDEFAULT16 ((short)0x8000)
165
166 #define SBRG_SCROLLBAR 0 /* the scrollbar itself */
167 #define SBRG_TOPRIGHTBTN 1 /* the top or right button */
168 #define SBRG_PAGEUPRIGHT 2 /* the page up or page right region */
169 #define SBRG_SCROLLBOX 3 /* the scroll box */
170 #define SBRG_PAGEDOWNLEFT 4 /* the page down or page left region */
171 #define SBRG_BOTTOMLEFTBTN 5 /* the bottom or left button */
172
173 BOOL WINAPI UpdatePerUserSystemParameters(DWORD dwReserved, BOOL bEnable);
174 BOOL WINAPI SetLogonNotifyWindow(HWND Wnd);
175 BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);
176 UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
177 DWORD_PTR WINAPI SetSysColorsTemp(const COLORREF *, const HBRUSH *, DWORD_PTR);
178 BOOL WINAPI SetDeskWallPaper(LPCSTR);
179 VOID WINAPI ScrollChildren(HWND,UINT,WPARAM,LPARAM);
180 void WINAPI CalcChildScroll(HWND, INT);
181 BOOL WINAPI RegisterLogonProcess(DWORD,BOOL);
182 DWORD WINAPI GetAppCompatFlags(HTASK hTask);
183 DWORD WINAPI GetAppCompatFlags2(HTASK hTask);
184 LONG WINAPI CsrBroadcastSystemMessageExW(DWORD dwflags,
185 LPDWORD lpdwRecipients,
186 UINT uiMessage,
187 WPARAM wParam,
188 LPARAM lParam,
189 PBSMINFO pBSMInfo);
190 BOOL WINAPI CliImmSetHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKl);
191 HWND WINAPI SetTaskmanWindow(HWND);
192 HWND WINAPI GetTaskmanWindow(VOID);
193 HWND WINAPI GetProgmanWindow(VOID);
194 BOOL WINAPI SetShellWindow(HWND);
195 BOOL WINAPI SetShellWindowEx(HWND, HWND);
196
197 BOOL WINAPI DrawCaptionTempA(HWND,HDC,const RECT*,HFONT,HICON,LPCSTR,UINT);
198 BOOL WINAPI DrawCaptionTempW(HWND,HDC,const RECT*,HFONT,HICON,LPCWSTR,UINT);
199 BOOL WINAPI PaintMenuBar(HWND hWnd, HDC hDC, ULONG left, ULONG right, ULONG top, BOOL bActive);
200
201 #ifdef UNICODE
202 #define DrawCaptionTemp DrawCaptionTempW
203 #else
204 #define DrawCaptionTemp DrawCaptionTempA
205 #endif
206
207 //
208 // Hard error balloon package
209 //
210 typedef struct _BALLOON_HARD_ERROR_DATA
211 {
212 DWORD cbHeaderSize;
213 DWORD Status;
214 DWORD dwType; /* any combination of the MB_ message box types */
215 ULONG_PTR TitleOffset;
216 ULONG_PTR MessageOffset;
217 } BALLOON_HARD_ERROR_DATA, *PBALLOON_HARD_ERROR_DATA;
218
219 //
220 // Undocumented SoftModalMessageBox() API, which constitutes
221 // the basis of all implementations of the MessageBox*() APIs.
222 //
223 typedef struct _MSGBOXDATA
224 {
225 MSGBOXPARAMSW mbp; // Size: 0x28 (on x86), 0x50 (on x64)
226 HWND hwndOwner;
227 #if defined(_WIN32) && (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
228 DWORD dwPadding;
229 #endif
230 WORD wLanguageId;
231 INT* pidButton; // Array of button IDs
232 LPCWSTR* ppszButtonText; // Array of button text strings
233 DWORD dwButtons; // Number of buttons
234 UINT uDefButton; // Default button ID
235 UINT uCancelId; // Button ID for Cancel action
236 #if (_WIN32_WINNT >= _WIN32_WINNT_WINXP) /* (NTDDI_VERSION >= NTDDI_WINXP) */
237 DWORD dwTimeout; // Message box timeout
238 #endif
239 DWORD dwReserved0;
240 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
241 DWORD dwReserved[4];
242 #endif
243 } MSGBOXDATA, *PMSGBOXDATA, *LPMSGBOXDATA;
244
245 #if defined(_WIN64)
246
247 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
248 C_ASSERT(sizeof(MSGBOXDATA) == 0x98);
249 #elif (_WIN32_WINNT <= _WIN32_WINNT_WS03) /* (NTDDI_VERSION <= NTDDI_WS03) */
250 C_ASSERT(sizeof(MSGBOXDATA) == 0x88);
251 #endif
252
253 #else
254
255 #if (_WIN32_WINNT <= _WIN32_WINNT_WIN2K) /* (NTDDI_VERSION <= NTDDI_WIN2KSP4) */
256 C_ASSERT(sizeof(MSGBOXDATA) == 0x48);
257 #elif (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
258 C_ASSERT(sizeof(MSGBOXDATA) == 0x60);
259 #else // (_WIN32_WINNT == _WIN32_WINNT_WINXP || _WIN32_WINNT == _WIN32_WINNT_WS03) /* (NTDDI_VERSION == NTDDI_WS03) */
260 C_ASSERT(sizeof(MSGBOXDATA) == 0x4C);
261 #endif
262
263 #endif /* defined(_WIN64) */
264
265 int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData);
266
267 int
268 WINAPI
269 MessageBoxTimeoutA(
270 IN HWND hWnd,
271 IN LPCSTR lpText,
272 IN LPCSTR lpCaption,
273 IN UINT uType,
274 IN WORD wLanguageId,
275 IN DWORD dwTimeout);
276
277 int
278 WINAPI
279 MessageBoxTimeoutW(
280 IN HWND hWnd,
281 IN LPCWSTR lpText,
282 IN LPCWSTR lpCaption,
283 IN UINT uType,
284 IN WORD wLanguageId,
285 IN DWORD dwTimeout);
286
287 #ifdef UNICODE
288 #define MessageBoxTimeout MessageBoxTimeoutW
289 #else
290 #define MessageBoxTimeout MessageBoxTimeoutA
291 #endif
292
293 LPCWSTR WINAPI MB_GetString(IN UINT wBtn);
294
295
296 //
297 // User api hook
298 //
299
300 typedef LRESULT(CALLBACK *WNDPROC_OWP)(HWND,UINT,WPARAM,LPARAM,ULONG_PTR,PDWORD);
301 typedef int (WINAPI *SETWINDOWRGN)(HWND hWnd, HRGN hRgn, BOOL bRedraw);
302 typedef BOOL (WINAPI *GETSCROLLINFO)(HWND,INT,LPSCROLLINFO);
303 typedef INT (WINAPI *SETSCROLLINFO)(HWND,int,LPCSCROLLINFO,BOOL);
304 typedef BOOL (WINAPI *ENABLESCROLLBAR)(HWND,UINT,UINT);
305 typedef BOOL (WINAPI *ADJUSTWINDOWRECTEX)(LPRECT,DWORD,BOOL,DWORD);
306 typedef int (WINAPI *GETSYSTEMMETRICS)(int);
307 typedef BOOL (WINAPI *SYSTEMPARAMETERSINFOA)(UINT,UINT,PVOID,UINT);
308 typedef BOOL (WINAPI *SYSTEMPARAMETERSINFOW)(UINT,UINT,PVOID,UINT);
309 typedef BOOL (WINAPI *FORCERESETUSERAPIHOOK)(HINSTANCE);
310 typedef BOOL (WINAPI *DRAWFRAMECONTROL)(HDC,LPRECT,UINT,UINT);
311 typedef BOOL (WINAPI *DRAWCAPTION)(HWND,HDC,LPCRECT,UINT);
312 typedef BOOL (WINAPI *MDIREDRAWFRAME)(HWND,DWORD);
313 typedef DWORD (WINAPI *GETREALWINDOWOWNER)(HWND);
314
315 typedef struct _UAHOWP
316 {
317 BYTE* MsgBitArray;
318 DWORD Size;
319 } UAHOWP, *PUAHOWP;
320
321 #define UAH_HOOK_MESSAGE(uahowp, msg) uahowp.MsgBitArray[msg/8] |= (1 << (msg % 8));
322 #define UAH_IS_MESSAGE_HOOKED(uahowp, msg) (uahowp.MsgBitArray[msg/8] & (1 << (msg % 8)))
323 #define UAHOWP_MAX_SIZE WM_USER/8
324
325 typedef struct tagUSERAPIHOOK
326 {
327 DWORD size;
328 WNDPROC DefWindowProcA;
329 WNDPROC DefWindowProcW;
330 UAHOWP DefWndProcArray;
331 GETSCROLLINFO GetScrollInfo;
332 SETSCROLLINFO SetScrollInfo;
333 ENABLESCROLLBAR EnableScrollBar;
334 ADJUSTWINDOWRECTEX AdjustWindowRectEx;
335 SETWINDOWRGN SetWindowRgn;
336 WNDPROC_OWP PreWndProc;
337 WNDPROC_OWP PostWndProc;
338 UAHOWP WndProcArray;
339 WNDPROC_OWP PreDefDlgProc;
340 WNDPROC_OWP PostDefDlgProc;
341 UAHOWP DlgProcArray;
342 GETSYSTEMMETRICS GetSystemMetrics;
343 SYSTEMPARAMETERSINFOA SystemParametersInfoA;
344 SYSTEMPARAMETERSINFOW SystemParametersInfoW;
345 FORCERESETUSERAPIHOOK ForceResetUserApiHook;
346 DRAWFRAMECONTROL DrawFrameControl;
347 DRAWCAPTION DrawCaption;
348 MDIREDRAWFRAME MDIRedrawFrame;
349 GETREALWINDOWOWNER GetRealWindowOwner;
350 } USERAPIHOOK, *PUSERAPIHOOK;
351
352 typedef enum _UAPIHK
353 {
354 uahLoadInit,
355 uahStop,
356 uahShutdown
357 } UAPIHK, *PUAPIHK;
358
359 typedef BOOL(CALLBACK *USERAPIHOOKPROC)(UAPIHK State, PUSERAPIHOOK puah);
360
361 typedef struct _USERAPIHOOKINFO
362 {
363 DWORD m_size;
364 LPCWSTR m_dllname1;
365 LPCWSTR m_funname1;
366 LPCWSTR m_dllname2;
367 LPCWSTR m_funname2;
368 } USERAPIHOOKINFO,*PUSERAPIHOOKINFO;
369
370 #if (WINVER == _WIN32_WINNT_WINXP)
371 BOOL WINAPI RegisterUserApiHook(HINSTANCE hInstance, USERAPIHOOKPROC CallbackFunc);
372 #elif (WINVER == _WIN32_WINNT_WS03)
373 BOOL WINAPI RegisterUserApiHook(PUSERAPIHOOKINFO puah);
374 #endif
375
376 BOOL WINAPI UnregisterUserApiHook(VOID);
377
378 #ifdef __cplusplus
379 } /* extern "C" */
380 #endif /* defined(__cplusplus) */
381
382 #endif