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