[APPCOMPAT] Move sdbtagid.h and sdbtypes.h to a shared location
[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 // Undocumented flags for CreateProcess
161 //
162 #define STARTF_INHERITDESKTOP 0x40000000
163 #define STARTF_SCREENSAVER 0x80000000
164
165 #define MOD_WINLOGON_SAS 0x8000
166
167 #define CW_USEDEFAULT16 ((short)0x8000)
168
169 #define SBRG_SCROLLBAR 0 /* the scrollbar itself */
170 #define SBRG_TOPRIGHTBTN 1 /* the top or right button */
171 #define SBRG_PAGEUPRIGHT 2 /* the page up or page right region */
172 #define SBRG_SCROLLBOX 3 /* the scroll box */
173 #define SBRG_PAGEDOWNLEFT 4 /* the page down or page left region */
174 #define SBRG_BOTTOMLEFTBTN 5 /* the bottom or left button */
175
176 BOOL WINAPI UpdatePerUserSystemParameters(DWORD dwReserved, BOOL bEnable);
177 BOOL WINAPI SetLogonNotifyWindow(HWND Wnd);
178 BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);
179 UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
180 DWORD_PTR WINAPI SetSysColorsTemp(const COLORREF *, const HBRUSH *, DWORD_PTR);
181 BOOL WINAPI SetDeskWallPaper(LPCSTR);
182 VOID WINAPI ScrollChildren(HWND,UINT,WPARAM,LPARAM);
183 void WINAPI CalcChildScroll(HWND, INT);
184 BOOL WINAPI RegisterLogonProcess(DWORD,BOOL);
185 DWORD WINAPI GetAppCompatFlags(HTASK hTask);
186 DWORD WINAPI GetAppCompatFlags2(HTASK hTask);
187 LONG WINAPI CsrBroadcastSystemMessageExW(DWORD dwflags,
188 LPDWORD lpdwRecipients,
189 UINT uiMessage,
190 WPARAM wParam,
191 LPARAM lParam,
192 PBSMINFO pBSMInfo);
193 BOOL WINAPI CliImmSetHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKl);
194 HWND WINAPI SetTaskmanWindow(HWND);
195 HWND WINAPI GetTaskmanWindow(VOID);
196 HWND WINAPI GetProgmanWindow(VOID);
197 BOOL WINAPI SetShellWindow(HWND);
198 BOOL WINAPI SetShellWindowEx(HWND, HWND);
199
200 BOOL WINAPI DrawCaptionTempA(HWND,HDC,const RECT*,HFONT,HICON,LPCSTR,UINT);
201 BOOL WINAPI DrawCaptionTempW(HWND,HDC,const RECT*,HFONT,HICON,LPCWSTR,UINT);
202 BOOL WINAPI PaintMenuBar(HWND hWnd, HDC hDC, ULONG left, ULONG right, ULONG top, BOOL bActive);
203
204 #ifdef UNICODE
205 #define DrawCaptionTemp DrawCaptionTempW
206 #else
207 #define DrawCaptionTemp DrawCaptionTempA
208 #endif
209
210 //
211 // Hard error balloon package
212 //
213 typedef struct _BALLOON_HARD_ERROR_DATA
214 {
215 DWORD cbHeaderSize;
216 DWORD Status;
217 DWORD dwType; /* any combination of the MB_ message box types */
218 ULONG_PTR TitleOffset;
219 ULONG_PTR MessageOffset;
220 } BALLOON_HARD_ERROR_DATA, *PBALLOON_HARD_ERROR_DATA;
221
222 //
223 // Undocumented SoftModalMessageBox() API, which constitutes
224 // the basis of all implementations of the MessageBox*() APIs.
225 //
226 typedef struct _MSGBOXDATA
227 {
228 MSGBOXPARAMSW mbp; // Size: 0x28 (on x86), 0x50 (on x64)
229 HWND hwndOwner;
230 #if defined(_WIN32) && (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
231 DWORD dwPadding;
232 #endif
233 WORD wLanguageId;
234 INT* pidButton; // Array of button IDs
235 LPCWSTR* ppszButtonText; // Array of button text strings
236 DWORD dwButtons; // Number of buttons
237 UINT uDefButton; // Default button ID
238 UINT uCancelId; // Button ID for Cancel action
239 #if (_WIN32_WINNT >= _WIN32_WINNT_WINXP) /* (NTDDI_VERSION >= NTDDI_WINXP) */
240 DWORD dwTimeout; // Message box timeout
241 #endif
242 DWORD dwReserved0;
243 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
244 DWORD dwReserved[4];
245 #endif
246 } MSGBOXDATA, *PMSGBOXDATA, *LPMSGBOXDATA;
247
248 #if defined(_WIN64)
249
250 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
251 C_ASSERT(sizeof(MSGBOXDATA) == 0x98);
252 #elif (_WIN32_WINNT <= _WIN32_WINNT_WS03) /* (NTDDI_VERSION <= NTDDI_WS03) */
253 C_ASSERT(sizeof(MSGBOXDATA) == 0x88);
254 #endif
255
256 #else
257
258 #if (_WIN32_WINNT <= _WIN32_WINNT_WIN2K) /* (NTDDI_VERSION <= NTDDI_WIN2KSP4) */
259 C_ASSERT(sizeof(MSGBOXDATA) == 0x48);
260 #elif (_WIN32_WINNT >= _WIN32_WINNT_WIN7) /* (NTDDI_VERSION >= NTDDI_WIN7) */
261 C_ASSERT(sizeof(MSGBOXDATA) == 0x60);
262 #else // (_WIN32_WINNT == _WIN32_WINNT_WINXP || _WIN32_WINNT == _WIN32_WINNT_WS03) /* (NTDDI_VERSION == NTDDI_WS03) */
263 C_ASSERT(sizeof(MSGBOXDATA) == 0x4C);
264 #endif
265
266 #endif /* defined(_WIN64) */
267
268 int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData);
269
270 int
271 WINAPI
272 MessageBoxTimeoutA(
273 IN HWND hWnd,
274 IN LPCSTR lpText,
275 IN LPCSTR lpCaption,
276 IN UINT uType,
277 IN WORD wLanguageId,
278 IN DWORD dwTimeout);
279
280 int
281 WINAPI
282 MessageBoxTimeoutW(
283 IN HWND hWnd,
284 IN LPCWSTR lpText,
285 IN LPCWSTR lpCaption,
286 IN UINT uType,
287 IN WORD wLanguageId,
288 IN DWORD dwTimeout);
289
290 #ifdef UNICODE
291 #define MessageBoxTimeout MessageBoxTimeoutW
292 #else
293 #define MessageBoxTimeout MessageBoxTimeoutA
294 #endif
295
296 LPCWSTR WINAPI MB_GetString(IN UINT wBtn);
297
298
299 //
300 // User api hook
301 //
302
303 typedef LRESULT(CALLBACK *WNDPROC_OWP)(HWND,UINT,WPARAM,LPARAM,ULONG_PTR,PDWORD);
304 typedef int (WINAPI *SETWINDOWRGN)(HWND hWnd, HRGN hRgn, BOOL bRedraw);
305 typedef BOOL (WINAPI *GETSCROLLINFO)(HWND,INT,LPSCROLLINFO);
306 typedef INT (WINAPI *SETSCROLLINFO)(HWND,int,LPCSCROLLINFO,BOOL);
307 typedef BOOL (WINAPI *ENABLESCROLLBAR)(HWND,UINT,UINT);
308 typedef BOOL (WINAPI *ADJUSTWINDOWRECTEX)(LPRECT,DWORD,BOOL,DWORD);
309 typedef int (WINAPI *GETSYSTEMMETRICS)(int);
310 typedef BOOL (WINAPI *SYSTEMPARAMETERSINFOA)(UINT,UINT,PVOID,UINT);
311 typedef BOOL (WINAPI *SYSTEMPARAMETERSINFOW)(UINT,UINT,PVOID,UINT);
312 typedef BOOL (WINAPI *FORCERESETUSERAPIHOOK)(HINSTANCE);
313 typedef BOOL (WINAPI *DRAWFRAMECONTROL)(HDC,LPRECT,UINT,UINT);
314 typedef BOOL (WINAPI *DRAWCAPTION)(HWND,HDC,LPCRECT,UINT);
315 typedef BOOL (WINAPI *MDIREDRAWFRAME)(HWND,DWORD);
316 typedef DWORD (WINAPI *GETREALWINDOWOWNER)(HWND);
317
318 typedef struct _UAHOWP
319 {
320 BYTE* MsgBitArray;
321 DWORD Size;
322 } UAHOWP, *PUAHOWP;
323
324 #define UAH_HOOK_MESSAGE(uahowp, msg) uahowp.MsgBitArray[msg/8] |= (1 << (msg % 8));
325 #define UAH_IS_MESSAGE_HOOKED(uahowp, msg) (uahowp.MsgBitArray[msg/8] & (1 << (msg % 8)))
326 #define UAHOWP_MAX_SIZE WM_USER/8
327
328 typedef struct tagUSERAPIHOOK
329 {
330 DWORD size;
331 WNDPROC DefWindowProcA;
332 WNDPROC DefWindowProcW;
333 UAHOWP DefWndProcArray;
334 GETSCROLLINFO GetScrollInfo;
335 SETSCROLLINFO SetScrollInfo;
336 ENABLESCROLLBAR EnableScrollBar;
337 ADJUSTWINDOWRECTEX AdjustWindowRectEx;
338 SETWINDOWRGN SetWindowRgn;
339 WNDPROC_OWP PreWndProc;
340 WNDPROC_OWP PostWndProc;
341 UAHOWP WndProcArray;
342 WNDPROC_OWP PreDefDlgProc;
343 WNDPROC_OWP PostDefDlgProc;
344 UAHOWP DlgProcArray;
345 GETSYSTEMMETRICS GetSystemMetrics;
346 SYSTEMPARAMETERSINFOA SystemParametersInfoA;
347 SYSTEMPARAMETERSINFOW SystemParametersInfoW;
348 FORCERESETUSERAPIHOOK ForceResetUserApiHook;
349 DRAWFRAMECONTROL DrawFrameControl;
350 DRAWCAPTION DrawCaption;
351 MDIREDRAWFRAME MDIRedrawFrame;
352 GETREALWINDOWOWNER GetRealWindowOwner;
353 } USERAPIHOOK, *PUSERAPIHOOK;
354
355 typedef enum _UAPIHK
356 {
357 uahLoadInit,
358 uahStop,
359 uahShutdown
360 } UAPIHK, *PUAPIHK;
361
362 typedef BOOL(CALLBACK *USERAPIHOOKPROC)(UAPIHK State, PUSERAPIHOOK puah);
363
364 typedef struct _USERAPIHOOKINFO
365 {
366 DWORD m_size;
367 LPCWSTR m_dllname1;
368 LPCWSTR m_funname1;
369 LPCWSTR m_dllname2;
370 LPCWSTR m_funname2;
371 } USERAPIHOOKINFO,*PUSERAPIHOOKINFO;
372
373 #if (WINVER == _WIN32_WINNT_WINXP)
374 BOOL WINAPI RegisterUserApiHook(HINSTANCE hInstance, USERAPIHOOKPROC CallbackFunc);
375 #elif (WINVER == _WIN32_WINNT_WS03)
376 BOOL WINAPI RegisterUserApiHook(PUSERAPIHOOKINFO puah);
377 #endif
378
379 BOOL WINAPI UnregisterUserApiHook(VOID);
380
381 #ifdef __cplusplus
382 } /* extern "C" */
383 #endif /* defined(__cplusplus) */
384
385 #endif