Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

user.h

Go to the documentation of this file.
00001 /*++ build version: 0002 // increment this if a change has global effects 00002 00003 /****************************** Module Header ******************************\ 00004 * Module Name: user.h 00005 * 00006 * Copyright (c) 1985-95, Microsoft Corporation 00007 * 00008 * This header file contains stuff shared by all the modules of the USER.DLL. 00009 * 00010 * History: 00011 * 09-18-90 DarrinM Created. 00012 * 04-27-91 DarrinM Merged in USERCALL.H, removed some dead wood. 00013 \***************************************************************************/ 00014 00015 #ifndef _USER_ 00016 #define _USER_ 00017 00018 #include "winerrp.h" 00019 00020 /* 00021 * Enable warnings that are turned off default for NT but we want on 00022 */ 00023 #ifndef RC_INVOKED // RC can't handle #pragmas 00024 #pragma warning(error:4100) // Unreferenced formal parameter 00025 #pragma warning(error:4101) // Unreferenced local variable 00026 // #pragma warning(error:4702) // Unreachable code 00027 #pragma warning(error:4705) // Statement has no effect 00028 #endif // RC_INVOKED 00029 00030 #if !defined(FASTCALL) 00031 #if defined(_X86_) 00032 #define FASTCALL _fastcall 00033 #else // defined(_X86_) 00034 #define FASTCALL 00035 #endif // defined(_X86_) 00036 #endif // !defined(FASTCALL) 00037 00038 #ifdef UNICODE 00039 #define UTCHAR WCHAR 00040 #else // UINCODE 00041 #define UTCHAR UCHAR 00042 #endif // UINCODE 00043 00044 /* 00045 * These types are needed before they are fully defined. 00046 */ 00047 typedef struct tagWINDOWSTATION *PWINDOWSTATION; 00048 typedef struct _LOCKRECORD *PLR; 00049 typedef struct _TL *PTL; 00050 typedef struct tagDESKTOP *PDESKTOP; 00051 typedef struct tagTDB *PTDB; 00052 typedef struct tagSVR_INSTANCE_INFO *PSVR_INSTANCE_INFO; 00053 typedef struct _MOVESIZEDATA *PMOVESIZEDATA; 00054 typedef struct tagCURSOR *PCURSOR; 00055 typedef struct tagPOPUPMENU *PPOPUPMENU; 00056 typedef struct tagQMSG *PQMSG; 00057 typedef struct tagWND *PWND; 00058 typedef struct _ETHREAD *PETHREAD; 00059 typedef struct tagDESKTOPINFO *PDESKTOPINFO; 00060 typedef struct tagDISPLAYINFO *PDISPLAYINFO; 00061 typedef struct tagCLIENTTHREADINFO *PCLIENTTHREADINFO; 00062 typedef struct tagDCE *PDCE; 00063 typedef struct tagSPB *PSPB; 00064 typedef struct tagQ *PQ; 00065 typedef struct tagTHREADINFO *PTHREADINFO; 00066 typedef struct tagPROCESSINFO *PPROCESSINFO; 00067 typedef struct tagWOWTHREADINFO *PWOWTHREADINFO; 00068 typedef struct tagPERUSERDATA *PPERUSERDATA; 00069 typedef struct tagPERUSERSERVERINFO *PPERUSERSERVERINFO; 00070 typedef struct tagTERMINAL *PTERMINAL; 00071 typedef struct _CLIENTINFO *PCLIENTINFO; 00072 00073 DECLARE_HANDLE(HQ); 00074 00075 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 00076 00077 /* 00078 * This name is used both in kernel\server.c and ntuser\server\exitwin.c 00079 */ 00080 #define ICON_PROP_NAME L"SysIC" 00081 00082 /* 00083 * Define DbgPrint to be something bogus on free builds so we won't 00084 * include it accidentally. 00085 */ 00086 #if DBG 00087 #else 00088 #define DbgPrint UserDbgPrint 00089 #endif 00090 00091 /* 00092 * Provides zero'd memory so you don't have to create zero'd memory on the 00093 * stack. The zero'd memory should never be modified. Use the ZERO and PZERO 00094 * macros to access the memory to ensure it is zero before it is used. 00095 * 00096 * Feel free to add more fields to the union as you need them. 00097 */ 00098 typedef union tagALWAYSZERO 00099 { 00100 BYTE b; 00101 WORD w; 00102 DWORD dw; 00103 int i; 00104 POINT pt; 00105 POINTL ptl; 00106 RECT rc; 00107 RECTL rcl; 00108 } ALWAYSZERO; 00109 00110 #if DBG 00111 extern void ValidateZero(void); 00112 #define ZERO(t) (ValidateZero(), (*(t *)(void *)&gZero)) 00113 #define PZERO(t) (ValidateZero(), ((t *)(void *)&gZero)) 00114 #else 00115 #define ZERO(t) ((*(t *)&gZero)) 00116 #define PZERO(t) ((t *)&gZero) 00117 #endif 00118 00119 /* 00120 * SIZERECT is a rectangle represented by a top-left coordinate, width, 00121 * and height. 00122 * 00123 * Hungarian is "src". 00124 */ 00125 typedef struct tagSIZERECT { 00126 int x; 00127 int y; 00128 int cx; 00129 int cy; 00130 } SIZERECT, *PSIZERECT, *LPSIZERECT; 00131 00132 typedef const SIZERECT * PCSIZERECT; 00133 typedef const SIZERECT * LPCSIZERECT; 00134 00135 00136 void RECTFromSIZERECT(PRECT prc, PCSIZERECT psrc); 00137 void SIZERECTFromRECT(PSIZERECT psrc, LPCRECT prc); 00138 00139 /* 00140 * Use these macros to unpack things packed by MAKELPARAM. 00141 */ 00142 #ifndef GET_X_LPARAM 00143 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) 00144 #endif 00145 00146 #ifndef GET_Y_LPARAM 00147 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) 00148 #endif 00149 00150 /* 00151 * Macros for manipulating flag fields. All work for multiple flags. 00152 */ 00153 #define TEST_FLAG(field, flag) ((field) & (flag)) 00154 #define TEST_BOOL_FLAG(field, flag) (((field) & (flag)) != 0) 00155 #define SET_FLAG(field, flag) ((field) |= (flag)) 00156 #define CLEAR_FLAG(field, flag) ((field) &= ~(flag)) 00157 #define TOGGLE_FLAG(field, flag) ((field ^= (flag)) 00158 00159 /* 00160 * COPY_FLAG copies the value of flags from a source field 00161 * into a destination field. 00162 * 00163 * In the macro: 00164 * + "&flag" limits the outer xor operation to just the flag we're interested in. 00165 * + These are the results of the two xor operations: 00166 * 00167 * fieldDst fieldSrc inner xor outer xor 00168 * 0 0 0 0 00169 * 0 1 1 1 00170 * 1 0 1 0 00171 * 1 1 0 1 00172 */ 00173 #define COPY_FLAG(fieldDst, fieldSrc, flag) ((fieldDst) ^= ((fieldDst) ^ (fieldSrc)) & (flag)) 00174 00175 /* 00176 * Define SET_OR_CLEAR_FLAG to do the following logically: 00177 * 00178 * #define SET_OR_CLEAR_FLAG(field, flag, fset) ((fset) ? SET_FLAG(field, flag) : CLEAR_FLAG(field, flag)) 00179 * 00180 * but with 5 fewer bytes. 00181 * 00182 * In the macro, 00183 * + "-!!(fset)" sets all bits in the source field to 1 if setting, 00184 * 0 if clearing. 00185 */ 00186 #define SET_OR_CLEAR_FLAG(field, flag, fset) COPY_FLAG((field), -!!(fset), (flag)) 00187 00188 #ifdef _USERK_ 00189 #define GetClientInfo() ((PTHREADINFO)(W32GetCurrentThread()))->pClientInfo; 00190 #else 00191 // We don't grab it this way in the kernel in case it is a kernel only thread 00192 #define GetClientInfo() ((PCLIENTINFO)((NtCurrentTeb())->Win32ClientInfo)) 00193 #endif 00194 00195 /* Used by xxxSleepTask */ 00196 #define HEVENT_REMOVEME ((HANDLE)IntToPtr( 0xFFFFFFFF )) 00197 00198 00199 /* 00200 * Access to system metrics, colors, and brushes. 00201 */ 00202 #define SYSMET(i) ((int)gpsi->aiSysMet[SM_##i]) 00203 #define SYSMETRTL(i) ((int)gpsi->aiSysMet[SM_##i]) 00204 #define SYSRGB(i) gpsi->argbSystem[COLOR_##i] 00205 #define SYSRGBRTL(i) gpsi->argbSystem[COLOR_##i] 00206 00207 #ifdef _USERK_ 00208 #define SYSMETFROMPROCESS(i) gpsi->aiSysMet[SM_##i] 00209 #define SYSHBR(i) gahbrSystem[COLOR_##i] 00210 #define SYSHBRRTL(i) gahbrSystem[COLOR_##i] 00211 #else 00212 #define SYSHBR(i) ahbrSystem[COLOR_##i] 00213 #define SYSHBRRTL(i) ahbrSystem[COLOR_##i] 00214 #endif 00215 00216 /***************************************************************************\ 00217 * These cool constants can be used to specify rops 00218 \***************************************************************************/ 00219 00220 #define DESTINATION (DWORD)0x00AA0000 00221 #define SOURCE (DWORD)0x00CC0000 00222 #define PATTERN (DWORD)0x00F00000 00223 00224 /************************** 00225 * Chicago equates 00226 ***************************/ 00227 #define BI_CHECKBOX 0 00228 #define BI_RADIOBUTTON 1 00229 #define BI_3STATE 2 00230 00231 #define NUM_BUTTON_TYPES 3 00232 #define NUM_BUTTON_STATES 4 00233 00234 /* 00235 * Total number of strings used as button strings in MessageBoxes 00236 */ 00237 #define MAX_MB_STRINGS 9 00238 00239 00240 /* 00241 * Rectangle macros. Inlining these is both faster and smaller 00242 */ 00243 #define CopyRect CopyRectInl 00244 #define EqualRect EqualRectInl 00245 #define SetRectEmpty SetRectEmptyInl 00246 00247 __inline void 00248 CopyRectInl(LPRECT prcDest, LPCRECT prcSrc) 00249 { 00250 *prcDest = *prcSrc; 00251 } 00252 00253 __inline DWORD 00254 EqualRectInl(LPCRECT prc1, LPCRECT prc2) 00255 { 00256 return RtlEqualMemory(prc1, prc2, sizeof(*prc1)); 00257 } 00258 00259 __inline void 00260 SetRectEmptyInl(LPRECT prc) 00261 { 00262 RtlZeroMemory(prc, sizeof(*prc)); 00263 } 00264 00265 /***************************************************************************\ 00266 * ANSI/Unicode function names 00267 * 00268 * For non-API Client/Server stubs, an "A" or "W" suffix must be added. 00269 * (API function names are generated by running wcshdr.exe over winuser.x) 00270 * 00271 \***************************************************************************/ 00272 #ifdef UNICODE 00273 #define TEXT_FN(fn) fn##W 00274 #else // UNICODE 00275 #define TEXT_FN(fn) fn##A 00276 #endif // UNICODE 00277 00278 #ifdef UNICODE 00279 #define BYTESTOCHARS(cb) ((cb) / sizeof(TCHAR)) 00280 #define CHARSTOBYTES(cch) ((cch) * sizeof(TCHAR)) 00281 #else // UNICODE 00282 #define BYTESTOCHARS(cb) (cb) 00283 #define CHARSTOBYTES(cch) (cch) 00284 #endif // UNICODE 00285 00286 /* 00287 * Internal window class names 00288 */ 00289 #define DESKTOPCLASS MAKEINTATOM(0x8001) 00290 #define DIALOGCLASS MAKEINTATOM(0x8002) 00291 #define SWITCHWNDCLASS MAKEINTATOM(0x8003) 00292 #define ICONTITLECLASS MAKEINTATOM(0x8004) 00293 #define INFOCLASS MAKEINTATOM(0x8005) 00294 #define TOOLTIPCLASS MAKEINTATOM(0x8006) 00295 #define MENUCLASS MAKEINTATOM(0x8000) /* Public Knowledge */ 00296 00297 // 00298 // System timer IDs 00299 // 00300 #define IDSYS_WNDTRACKING 0x0000FFF7L 00301 #define IDSYS_FLASHWND 0x0000FFF8L 00302 #define IDSYS_MNAUTODISMISS 0x0000FFF9L 00303 #define IDSYS_MOUSEHOVER 0x0000FFFAL 00304 #define IDSYS_MNANIMATE 0x0000FFFBL 00305 #define IDSYS_MNDOWN MFMWFP_DOWNARROW /* 0xFFFFFFFC */ 00306 #define IDSYS_LBSEARCH 0x0000FFFCL 00307 #define IDSYS_MNUP MFMWFP_UPARROW /* 0xFFFFFFFD */ 00308 #define IDSYS_STANIMATE 0x0000FFFDL 00309 #define IDSYS_MNSHOW 0x0000FFFEL 00310 #define IDSYS_SCROLL 0x0000FFFEL 00311 #define IDSYS_MNHIDE 0x0000FFFFL 00312 #define IDSYS_CARET 0x0000FFFFL 00313 00314 00315 /* 00316 * Special case string token codes. These must be the same as in the resource 00317 * compiler's RC.H file. 00318 */ 00319 /* 00320 * NOTE: Order is assumed and much be this way for applications to be 00321 * compatable with windows 2.0 00322 */ 00323 #define CODEBIT 0x80 00324 #define BUTTONCODE 0x80 00325 #define EDITCODE 0x81 00326 #define STATICCODE 0x82 00327 #define LISTBOXCODE 0x83 00328 #define SCROLLBARCODE 0x84 00329 #define COMBOBOXCODE 0x85 00330 #define MDICLIENTCODE 0x86 00331 #define COMBOLISTBOXCODE 0x87 00332 00333 /* 00334 * Internal window classes. These numbers serve as indices into the 00335 * atomSysClass table so that we can get the atoms for the various classes. 00336 * The order of the control classes (through COMBOLISTBOXCLASS) is assumed 00337 * to be the same as the class codes above. 00338 */ 00339 #define ICLS_BUTTON 0 00340 #define ICLS_EDIT 1 00341 #define ICLS_STATIC 2 00342 #define ICLS_LISTBOX 3 00343 #define ICLS_SCROLLBAR 4 00344 #define ICLS_COMBOBOX 5 // End of special dlgmgr indices 00345 00346 #define ICLS_CTL_MAX 6 // Number of public control classes 00347 00348 #define ICLS_DESKTOP 6 00349 #define ICLS_DIALOG 7 00350 #define ICLS_MENU 8 00351 #define ICLS_SWITCH 9 00352 #define ICLS_ICONTITLE 10 00353 #define ICLS_MDICLIENT 11 00354 #define ICLS_COMBOLISTBOX 12 00355 #define ICLS_DDEMLEVENT 13 00356 #define ICLS_DDEMLMOTHER 14 00357 #define ICLS_DDEML16BIT 15 00358 #define ICLS_DDEMLCLIENTA 16 00359 #define ICLS_DDEMLCLIENTW 17 00360 #define ICLS_DDEMLSERVERA 18 00361 #define ICLS_DDEMLSERVERW 19 00362 #define ICLS_IME 20 00363 #define ICLS_TOOLTIP 21 00364 #define ICLS_MAX 22 // Number of system classes 00365 00366 /* 00367 * Directory name for windowstations and desktops 00368 */ 00369 #define WINSTA_DIR L"\\Windows\\WindowStations" 00370 #define WINSTA_SESSION_DIR L"\\Sessions\\xxxxxxxxxxx\\Windows\\WindowStations" 00371 #define WINSTA_NAME L"Service-0x0000-0000$" 00372 #define MAX_SESSION_PATH 256 00373 #define SESSION_ROOT L"\\Sessions" 00374 00375 /***************************************************************************\ 00376 * Normal Stuff 00377 * 00378 * Nice normal typedefs, defines, prototypes, etc that everyone wants to share. 00379 * 00380 \***************************************************************************/ 00381 00382 /* 00383 * Define size limit of callback data. Below or equal to this limit, put data 00384 * on the client-side stack. Above this limit allocate virtual memory 00385 * for the data 00386 */ 00387 #define CALLBACKSTACKLIMIT (PAGE_SIZE / 2) 00388 00389 /* 00390 * Capture buffer definition for callbacks 00391 */ 00392 typedef struct _CAPTUREBUF { 00393 DWORD cbCallback; 00394 DWORD cbCapture; 00395 DWORD cCapturedPointers; 00396 PBYTE pbFree; 00397 DWORD offPointers; 00398 PVOID pvVirtualAddress; 00399 } CAPTUREBUF, *PCAPTUREBUF; 00400 00401 /* 00402 * Callback return status 00403 */ 00404 typedef struct _CALLBACKSTATUS { 00405 ULONG_PTR retval; 00406 DWORD cbOutput; 00407 PVOID pOutput; 00408 } CALLBACKSTATUS, *PCALLBACKSTATUS; 00409 00410 #define IS_PTR(p) ((((ULONG_PTR)(p)) & ~MAXUSHORT) != 0) 00411 #define PTR_TO_ID(p) ((USHORT)(((ULONG_PTR)(p)) & MAXUSHORT)) 00412 00413 // 00414 // Strings are counted 16-bit character strings. If they are 00415 // NULL terminated, Length does not include trailing NULL. 00416 // 00417 typedef struct _LARGE_STRING { 00418 ULONG Length; 00419 ULONG MaximumLength : 31; 00420 ULONG bAnsi : 1; 00421 PVOID Buffer; 00422 } LARGE_STRING, *PLARGE_STRING; 00423 00424 typedef struct _LARGE_ANSI_STRING { 00425 ULONG Length; 00426 ULONG MaximumLength : 31; 00427 ULONG bAnsi : 1; 00428 PSTR Buffer; 00429 } LARGE_ANSI_STRING, *PLARGE_ANSI_STRING; 00430 00431 typedef struct _LARGE_UNICODE_STRING { 00432 ULONG Length; 00433 ULONG MaximumLength : 31; 00434 ULONG bAnsi : 1; 00435 PWSTR Buffer; 00436 } LARGE_UNICODE_STRING, *PLARGE_UNICODE_STRING; 00437 00438 /* 00439 * String macros 00440 */ 00441 __inline BOOL IsEmptyString(PVOID p, ULONG bAnsi) 00442 { 00443 return (BOOL)!(bAnsi ? *(LPSTR)p : *(LPWSTR)p); 00444 } 00445 __inline void NullTerminateString(PVOID p, ULONG bAnsi) 00446 { 00447 if (bAnsi) *(LPSTR)p = (CHAR)0; else *(LPWSTR)p = (WCHAR)0; 00448 } 00449 __inline UINT StringLength(PVOID p, ULONG bAnsi) 00450 { 00451 return (bAnsi ? strlen((LPSTR)p) : wcslen((LPWSTR)p)); 00452 } 00453 00454 typedef struct _CTLCOLOR { 00455 COLORREF crText; 00456 COLORREF crBack; 00457 int iBkMode; 00458 } CTLCOLOR, *PCTLCOLOR; 00459 00460 00461 /* 00462 * This is used by the cool client side DrawIcon code 00463 */ 00464 typedef struct _DRAWICONEXDATA { 00465 HBITMAP hbmMask; 00466 HBITMAP hbmColor; 00467 int cx; 00468 int cy; 00469 } DRAWICONEXDATA; 00470 00471 /* 00472 * Version macros 00473 */ 00474 #define VER50 0x0500 00475 #define VER40 0x0400 00476 #define VER31 0x030A 00477 #define VER30 0x0300 00478 00479 #define Is500Compat(dwExpWinVer) (LOWORD(dwExpWinVer) >= VER50) 00480 #define Is400Compat(dwExpWinVer) (LOWORD(dwExpWinVer) >= VER40) 00481 #define Is310Compat(dwExpWinVer) (LOWORD(dwExpWinVer) >= VER31) 00482 #define Is300Compat(dwExpWinVer) (LOWORD(dwExpWinVer) >= VER30) 00483 00484 /* 00485 * Static items stored in the TEB 00486 */ 00487 typedef struct _CALLBACKWND { 00488 HWND hwnd; 00489 PWND pwnd; 00490 } CALLBACKWND, *PCALLBACKWND; 00491 00492 #define CVKKEYCACHE 32 00493 #define CBKEYCACHE (CVKKEYCACHE >> 2) 00494 00495 #define CVKASYNCKEYCACHE 16 00496 #define CBASYNCKEYCACHE (CVKASYNCKEYCACHE >> 2) 00497 00498 /* 00499 * The offset to cSpins must match WIN32_CLIENT_INFO_SPIN_COUNT defined 00500 * in ntpsapi.h. GDI uses this offset to reset the spin count. 00501 * WARNING! This struct cannot be made larger without changing the TEB struct: 00502 * It must fit in ULONG Win32ClientInfo[WIN32_CLIENT_INFO_LENGTH]; (ntpsapi.h) 00503 * (ifdef FE_SB, sizeof(CLIENTINFO) == 0x7c == 4 * WIN32_CLIENT_INFO_LENGTH) 00504 */ 00505 #pragma pack(1) 00506 00507 typedef struct _CLIENTINFO { 00508 DWORD CI_flags; // Needs to be first because CSR 00509 DWORD cSpins; 00510 DWORD dwExpWinVer; 00511 DWORD dwCompatFlags; 00512 DWORD dwTIFlags; 00513 PDESKTOPINFO pDeskInfo; 00514 ULONG ulClientDelta; 00515 struct tagHOOK *phkCurrent; 00516 DWORD fsHooks; 00517 CALLBACKWND CallbackWnd; 00518 DWORD dwHookCurrent; 00519 int cInDDEMLCallback; 00520 HANDLE hDdemlCallbackInst; 00521 PCLIENTTHREADINFO pClientThreadInfo; 00522 DWORD dwHookData; 00523 DWORD dwKeyCache; 00524 BYTE afKeyState[CBKEYCACHE]; 00525 DWORD dwAsyncKeyCache; 00526 BYTE afAsyncKeyState[CBASYNCKEYCACHE]; 00527 BYTE afAsyncKeyStateRecentDown[CBASYNCKEYCACHE]; 00528 WORD CodePage; 00529 HKL hKL; 00530 00531 BYTE achDbcsCF[2]; // Save ANSI DBCS LeadByte character code 00532 // in this field for ANSI to Unicode. 00533 // Uses SendMessageA/PostMessageA from CLIENT 00534 // to SERVER (index 0) 00535 // And... 00536 // Uses SendMessageA/DispatchMessageA 00537 // for CLIENT to CLIENT (index 1) 00538 MSG msgDbcsCB; // Save ANSI DBCS character message in 00539 // this field for convert Unicode to ANSI. 00540 // Uses GetMessageA/PeekMessageA from 00541 // SERVER to CLIENT 00542 } CLIENTINFO, *PCLIENTINFO; 00543 00544 00545 #pragma pack() 00546 00547 #define CI_IN_SYNC_TRANSACTION 0x00000001 00548 #define CI_PROCESSING_QUEUE 0x00000002 00549 #define CI_16BIT 0x00000004 00550 #define CI_INITIALIZED 0x00000008 00551 #define CI_INTERTHREAD_HOOK 0x00000010 00552 #define CI_REGISTERCLASSES 0x00000020 00553 00554 // moved from rtl/chartran.c 00555 #ifdef _USERK_ 00556 #define THREAD_CODEPAGE() (PtiCurrent()->pClientInfo->CodePage) 00557 #else // _USERK_ 00558 #define THREAD_CODEPAGE() (GetClientInfo()->CodePage) 00559 #endif // _USERK_ 00560 00561 // WMCR_IR_DBCSCHAR and DBCS Macros 00562 /* 00563 * Flags used for the WM_CHAR HIWORD of wParam for DBCS messaging. 00564 * (LOWORD of wParam will have character codepoint) 00565 */ 00566 #define WMCR_IR_DBCSCHAR 0x80000000 00567 /* 00568 * Macros to determine this is DBCS message or not. 00569 */ 00570 #define IS_DBCS_MESSAGE(DbcsChar) (((DWORD)(DbcsChar)) & 0x0000FF00) 00571 00572 /* 00573 * Macros for IR_DBCSCHAR format to/from regular format. 00574 */ 00575 #define MAKE_IR_DBCSCHAR(DbcsChar) \ 00576 (IS_DBCS_MESSAGE((DbcsChar)) ? \ 00577 (MAKEWPARAM(MAKEWORD(HIBYTE((DbcsChar)),LOBYTE((DbcsChar))),0)) : \ 00578 ((WPARAM)((DbcsChar) & 0x00FF)) \ 00579 ) 00580 00581 #define MAKE_WPARAM_DBCSCHAR(DbcsChar) \ 00582 (IS_DBCS_MESSAGE((DbcsChar)) ? \ 00583 (MAKEWPARAM(MAKEWORD(HIBYTE((DbcsChar)),LOBYTE((DbcsChar))),0)) : \ 00584 ((WPARAM)((DbcsChar) & 0x00FF)) \ 00585 ) 00586 00587 #define DBCS_CHARSIZE (2) 00588 00589 #define IS_DBCS_SYSTEM() (TEST_SRVIF(SRVIF_DBCS)) 00590 #define IS_DBCS_ENABLED() (TEST_SRVIF(SRVIF_DBCS)) 00591 #define IS_IME_ENABLED() (TEST_SRVIF(SRVIF_IME)) 00592 00593 // IMM dynamic loading support 00594 #define IMM_MAGIC_CALLER_ID (0x19650412) 00595 00596 VOID User32InitializeImmEntryTable(DWORD dwMagic); 00597 00598 #define IS_MIDEAST_ENABLED() (TEST_SRVIF(SRVIF_MIDEAST)) 00599 00600 /* 00601 * Flags used for the WM_CLIENTSHUTDOWN wParam. 00602 */ 00603 #define WMCS_EXIT 0x0001 00604 #define WMCS_QUERYEND 0x0002 00605 #define WMCS_SHUTDOWN 0x0004 00606 #define WMCS_CONTEXTLOGOFF 0x0008 00607 #define WMCS_ENDTASK 0x0010 00608 #define WMCS_CONSOLE 0x0020 00609 #define WMCS_NODLGIFHUNG 0x0040 00610 #define WMCS_NORETRY 0x0080 00611 #define WMCS_LOGOFF ENDSESSION_LOGOFF /* from winuser.w */ 00612 00613 /* 00614 * WM_CLIENTSHUTDOWN return value 00615 */ 00616 #define WMCSR_ALLOWSHUTDOWN 1 00617 #define WMCSR_DONE 2 00618 #define WMCSR_CANCEL 3 00619 00620 /* 00621 * We don't need 64-bit intermediate precision so we use this macro 00622 * instead of calling MulDiv. 00623 */ 00624 #define MultDiv(x, y, z) (((INT)(x) * (INT)(y) + (INT)(z) / 2) / (INT)(z)) 00625 00626 typedef DWORD ICH; 00627 typedef ICH *LPICH; 00628 00629 typedef struct _PROPSET { 00630 HANDLE hData; 00631 ATOM atom; 00632 } PROPSET, *PPROPSET; 00633 00634 /* 00635 * Old MENUHBM used to be here. They are now public for NT5 and defined 00636 * in winuser.w as HBMMENU_* 00637 */ 00638 00639 /* 00640 * Internal menu flags stored in pMenu->fFlags. 00641 * High order bits are used for public MNS_ flags defined in winuser.w 00642 */ 00643 #define MFISPOPUP 0x00000001 00644 #define MFMULTIROW 0x00000002 00645 #define MFUNDERLINE 0x00000004 00646 #define MFWINDOWDC 0x00000008 /* Window DC vs Client area DC when drawing*/ 00647 #define MFINACTIVE 0x00000010 00648 #define MFRTL 0x00000020 00649 #define MFDESKTOP 0x00000040 00650 #define MFSYSMENU 0x00000080 00651 #define MFLAST 0x00000080 00652 00653 #if (MNS_LAST <= MFLAST) 00654 #error MNS_ AND MF defines conflict 00655 #endif // (MNS_LAST <= MFLAST) 00656 00657 // Event stuff -------------------------------------------- 00658 00659 typedef struct tagEVENT_PACKET { 00660 DWORD EventType; // == apropriate afCmd filter flag 00661 WORD fSense; // TRUE means flag on is passed. 00662 WORD cbEventData; // size of data starting at Data field. 00663 DWORD Data; // event specific data - must be last 00664 } EVENT_PACKET, *PEVENT_PACKET; 00665 00666 // Window long offsets in mother window (szDDEMLMOTHERCLASS) 00667 00668 #define GWLP_INSTANCE_INFO 0 // PCL_INSTANCE_INFO 00669 00670 00671 // Window long offsets in client window (szDDEMLCLIENTCLASS) 00672 00673 #define GWLP_PCI 0 00674 #define GWL_CONVCONTEXT GWLP_PCI + sizeof(PVOID) 00675 #define GWL_CONVSTATE GWL_CONVCONTEXT + sizeof(CONVCONTEXT) // See CLST_ flags 00676 #define GWLP_SHINST GWL_CONVSTATE + sizeof(LONG) 00677 #define GWLP_CHINST GWLP_SHINST + sizeof(HANDLE) 00678 00679 #define CLST_CONNECTED 0 00680 #define CLST_SINGLE_INITIALIZING 1 00681 #define CLST_MULT_INITIALIZING 2 00682 00683 // Window long offsets in server window (szDDEMLSERVERCLASS) 00684 00685 #define GWLP_PSI 0 00686 00687 // Window long offsets in event window (szDDEMLEVENTCLASS) 00688 00689 #define GWLP_PSII 0 00690 00691 00692 /* 00693 * DrawFrame defines 00694 */ 00695 #define DF_SHIFT0 0x0000 00696 #define DF_SHIFT1 0x0001 00697 #define DF_SHIFT2 0x0002 00698 #define DF_SHIFT3 0x0003 00699 #define DF_PATCOPY 0x0000 00700 #define DF_PATINVERT 0x0004 00701 #define DF_SHIFTMASK (DF_SHIFT0 | DF_SHIFT1 | DF_SHIFT2 | DF_SHIFT3) 00702 #define DF_ROPMASK (DF_PATCOPY | DF_PATINVERT) 00703 #define DF_HBRMASK ~(DF_SHIFTMASK | DF_ROPMASK) 00704 00705 #define DF_SCROLLBAR (COLOR_SCROLLBAR << 3) 00706 #define DF_BACKGROUND (COLOR_BACKGROUND << 3) 00707 #define DF_ACTIVECAPTION (COLOR_ACTIVECAPTION << 3) 00708 #define DF_INACTIVECAPTION (COLOR_INACTIVECAPTION << 3) 00709 #define DF_MENU (COLOR_MENU << 3) 00710 #define DF_WINDOW (COLOR_WINDOW << 3) 00711 #define DF_WINDOWFRAME (COLOR_WINDOWFRAME << 3) 00712 #define DF_MENUTEXT (COLOR_MENUTEXT << 3) 00713 #define DF_WINDOWTEXT (COLOR_WINDOWTEXT << 3) 00714 #define DF_CAPTIONTEXT (COLOR_CAPTIONTEXT << 3) 00715 #define DF_ACTIVEBORDER (COLOR_ACTIVEBORDER << 3) 00716 #define DF_INACTIVEBORDER (COLOR_INACTIVEBORDER << 3) 00717 #define DF_APPWORKSPACE (COLOR_APPWORKSPACE << 3) 00718 #define DF_3DSHADOW (COLOR_3DSHADOW << 3) 00719 #define DF_3DFACE (COLOR_3DFACE << 3) 00720 #define DF_GRAY (COLOR_MAX << 3) 00721 00722 00723 /* 00724 * CreateWindowEx internal flags for dwExStyle 00725 */ 00726 00727 #define WS_EX_MDICHILD 0x00000040L // Internal 00728 #define WS_EX_ANSICREATOR 0x80000000L // Internal 00729 00730 /* 00731 * Calculate the size of a field in a structure of type type. 00732 */ 00733 #define FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) 00734 00735 #define FLASTKEY 0x80 00736 00737 /* 00738 * Special types we've fabricated for special thunks. 00739 */ 00740 typedef struct { 00741 POINT point1; 00742 POINT point2; 00743 POINT point3; 00744 POINT point4; 00745 POINT point5; 00746 } POINT5, *LPPOINT5; 00747 00748 typedef struct { 00749 DWORD dwRecipients; 00750 DWORD dwFlags; 00751 } BROADCASTSYSTEMMSGPARAMS, *LPBROADCASTSYSTEMMSGPARAMS; 00752 /* 00753 * Server side address constants. When we want to call a server side proc, 00754 * we pass an index indentifying the function, rather than the server side 00755 * address itself. More robust. The functions between WNDPROCSTART/END 00756 * have client side sutbs which map to this routines. 00757 * 00758 * Adding a new FNID (This is just what I figured out...so fix it if wrong or incomplete) 00759 * -Decide what range it should be in: 00760 * FNID_WNDPROCSTART to FNID_WNDPROCEND: Server side proc with client 00761 * stub 00762 * FIND_CONTROLSTART to FNID_CONTROLEND: Client side controls with no 00763 * server side proc 00764 * After FNID_CONTROLEND: other, like server side only procs or client 00765 * side only.... 00766 * -Make sure to adjust FNID_*START and FNID_*END appropriately. 00767 * -If the ID is to be associated with a window class, and it is for all 00768 * windows of the class, make sure that the InternalRegisterClassEx call 00769 * receives the id as a parameter. 00770 * -If in FNID_WNDPROCSTART-END range, make the proper STOCID call in InitFunctionTables. 00771 * -Add proper FNID call in InitFunctionTables. 00772 * -If the class has a client side worker function (pcls->lpfnWorker) or you expect 00773 * apps to send messages to it or call its window proc directly, define 00774 * a message table in kernel\server.c and initialize it in InitMessageTables. 00775 * -If there is a client side for this proc, you probably need to add it to 00776 * PFNCLIENT. 00777 * -Add the debug-only text description of this FNID to in gapszFNID in globals.c 00778 * -See if you need to modify aiClassWow in client\client.c 00779 * -Modify the gaFNIDtoICLS table in kernel\ntstubs.c 00780 */ 00781 #define FNID_START 0x0000029A 00782 #define FNID_WNDPROCSTART 0x0000029A 00783 00784 #define FNID_SCROLLBAR 0x0000029A // xxxSBWndProc; 00785 #define FNID_ICONTITLE 0x0000029B // xxxDefWindowProc; 00786 #define FNID_MENU 0x0000029C // xxxMenuWindowProc; 00787 #define FNID_DESKTOP 0x0000029D // xxxDesktopWndProc; 00788 #define FNID_DEFWINDOWPROC 0x0000029E // xxxDefWindowProc; 00789 00790 #define FNID_WNDPROCEND 0x0000029E // see PatchThreadWindows 00791 #define FNID_CONTROLSTART 0x0000029F 00792 00793 #define FNID_BUTTON 0x0000029F // No server side proc 00794 #define FNID_COMBOBOX 0x000002A0 // No server side proc 00795 #define FNID_COMBOLISTBOX 0x000002A1 // No server side proc 00796 #define FNID_DIALOG 0x000002A2 // No server side proc 00797 #define FNID_EDIT 0x000002A3 // No server side proc 00798 #define FNID_LISTBOX 0x000002A4 // No server side proc 00799 #define FNID_MDICLIENT 0x000002A5 // No server side proc 00800 #define FNID_STATIC 0x000002A6 // No server side proc 00801 00802 #define FNID_IME 0x000002A7 // No server side proc 00803 #define FNID_CONTROLEND 0x000002A7 00804 00805 #define FNID_HKINLPCWPEXSTRUCT 0x000002A8 00806 #define FNID_HKINLPCWPRETEXSTRUCT 0x000002A9 00807 #define FNID_DEFFRAMEPROC 0x000002AA // No server side proc 00808 #define FNID_DEFMDICHILDPROC 0x000002AB // No server side proc 00809 #define FNID_MB_DLGPROC 0x000002AC // No server side proc 00810 #define FNID_MDIACTIVATEDLGPROC 0x000002AD // No server side proc 00811 #define FNID_SENDMESSAGE 0x000002AE 00812 00813 #define FNID_SENDMESSAGEFF 0x000002AF 00814 #define FNID_SENDMESSAGEEX 0x000002B0 00815 #define FNID_CALLWINDOWPROC 0x000002B1 00816 #define FNID_SENDMESSAGEBSM 0x000002B2 00817 #define FNID_SWITCH 0x000002B3 // Just used by GetTopMostInserAfter 00818 #define FNID_TOOLTIP 0x000002B4 00819 #define FNID_END 0x000002B4 00820 00821 /* 00822 * The size of the server side function table is defined as a power of two 00823 * so a simple "and" operation can be used to determine if a function index 00824 * is legal or not. Unused entries in the table are fill with a routine that 00825 * catches invalid functions that have indices within range, but are not 00826 * implemented. 00827 */ 00828 00829 #define FNID_ARRAY_SIZE 32 00830 00831 #if (FNID_END - FNID_START + 1) > FNID_ARRAY_SIZE 00832 #error"The size of the function array is greater than the allocated storage" 00833 #endif // (FNID_END - FNID_START + 1) > FNID_ARRAY_SIZE 00834 00835 #define FNID_DDE_BIT 0x00002000 // Used by RegisterClassExWOW 00836 #define FNID_CLEANEDUP_BIT 0x00004000 00837 #define FNID_DELETED_BIT 0x00008000 00838 #define FNID_STATUS_BITS (FNID_CLEANEDUP_BIT | FNID_DELETED_BIT) 00839 00840 #define FNID(s) (gpsi->mpFnidPfn[((DWORD)(s) - FNID_START) & (FNID_ARRAY_SIZE - 1)]) 00841 #define STOCID(s) (gpsi->aStoCidPfn[(DWORD)((s) & ~FNID_STATUS_BITS) - FNID_START]) 00842 #define CBFNID(s) (gpsi->mpFnid_serverCBWndProc[(DWORD)((s) & ~FNID_STATUS_BITS) - FNID_START]) 00843 #define GETFNID(pwnd) ((pwnd)->fnid & ~FNID_STATUS_BITS) 00844 00845 typedef LRESULT (APIENTRY *WNDPROC_PWND)(PWND, UINT, WPARAM, LPARAM); 00846 typedef LRESULT (APIENTRY *WNDPROC_PWNDEX)(PWND, UINT, WPARAM, LPARAM, ULONG_PTR); 00847 typedef BOOL (APIENTRY *WNDENUMPROC_PWND)(PWND, LPARAM); 00848 typedef VOID (APIENTRY *TIMERPROC_PWND)(PWND, UINT, UINT, LPARAM); 00849 00850 /* 00851 * Structure passed by client during process initialization that holds some 00852 * client-side callback addresses. 00853 */ 00854 typedef struct _PFNCLIENT { 00855 PROC pfnScrollBarWndProc; // and must be paired Unicode then ANSI 00856 PROC pfnTitleWndProc; 00857 PROC pfnMenuWndProc; 00858 PROC pfnDesktopWndProc; 00859 PROC pfnDefWindowProc; 00860 00861 // Below not in FNID_WNDPROCSTART FNID_WNDPROCEND range 00862 00863 PROC pfnButtonWndProc; 00864 PROC pfnComboBoxWndProc; 00865 PROC pfnComboListBoxProc; 00866 PROC pfnDialogWndProc; 00867 PROC pfnEditWndProc; 00868 PROC pfnListBoxWndProc; 00869 PROC pfnMDIClientWndProc; 00870 PROC pfnStaticWndProc; 00871 PROC pfnImeWndProc; 00872 00873 // Below not in FNID_CONTROLSTART FNID_CONTROLEND range 00874 00875 PROC pfnHkINLPCWPSTRUCT; // client-side callback for hook thunks 00876 PROC pfnHkINLPCWPRETSTRUCT; // client-side callback for hook thunks 00877 PROC pfnDispatchHook; 00878 PROC pfnDispatchMessage; 00879 PROC pfnMB_DlgProc; 00880 PROC pfnMDIActivateDlgProc; 00881 } PFNCLIENT, *PPFNCLIENT; 00882 00883 typedef struct _PFNCLIENTWORKER { 00884 PROC pfnButtonWndProc; 00885 PROC pfnComboBoxWndProc; 00886 PROC pfnComboListBoxProc; 00887 PROC pfnDialogWndProc; 00888 PROC pfnEditWndProc; 00889 PROC pfnListBoxWndProc; 00890 PROC pfnMDIClientWndProc; 00891 PROC pfnStaticWndProc; 00892 PROC pfnImeWndProc; 00893 } PFNCLIENTWORKER, *PPFNCLIENTWORKER; 00894 00895 #define FNID_TO_CLIENT_PFNA(s) (*(((ULONG_PTR *)&gpsi->apfnClientA) + (s - FNID_START))) 00896 #define FNID_TO_CLIENT_PFNW(s) (*(((ULONG_PTR *)&gpsi->apfnClientW) + (s - FNID_START))) 00897 #define FNID_TO_CLIENT_PFNWORKER(s) (*(((ULONG_PTR *)&gpsi->apfnClientWorker) + (s - FNID_CONTROLSTART))) 00898 00899 /* 00900 * Object types 00901 * 00902 * NOTE: Changing this table means changing hard-coded arrays that depend 00903 * on the index number (in security.c and in debug.c) 00904 */ 00905 #define TYPE_FREE 0 // must be zero! 00906 #define TYPE_WINDOW 1 // in order of use for C code lookups 00907 #define TYPE_MENU 2 00908 #define TYPE_CURSOR 3 00909 #define TYPE_SETWINDOWPOS 4 00910 #define TYPE_HOOK 5 00911 #define TYPE_CLIPDATA 6 // clipboard data 00912 #define TYPE_CALLPROC 7 00913 #define TYPE_ACCELTABLE 8 00914 #define TYPE_DDEACCESS 9 00915 #define TYPE_DDECONV 10 00916 #define TYPE_DDEXACT 11 // DDE transaction tracking info. 00917 #define TYPE_MONITOR 12 00918 #define TYPE_KBDLAYOUT 13 // Keyboard Layout handle (HKL) object. 00919 #define TYPE_KBDFILE 14 // Keyboard Layout file object. 00920 #define TYPE_WINEVENTHOOK 15 // WinEvent hook (EVENTHOOK) 00921 #define TYPE_TIMER 16 00922 #define TYPE_INPUTCONTEXT 17 // Input Context info structure 00923 00924 #define TYPE_CTYPES 18 // Count of TYPEs; Must be LAST + 1 00925 00926 #define TYPE_GENERIC 255 // used for generic handle validation 00927 00928 /* OEM Bitmap Information Structure */ 00929 typedef struct tagOEMBITMAPINFO 00930 { 00931 int x; 00932 int y; 00933 int cx; 00934 int cy; 00935 } OEMBITMAPINFO, *POEMBITMAPINFO; 00936 00937 // For the following OBI_ defines : 00938 // 00939 // a pushed state bitmap should be at +1 from it's normal state bitmap 00940 // an inactive state bitmap should be at +2 from it's normal state bitmap 00941 // A small caption bitmap should be +2 from the normal bitmap 00942 00943 #define DOBI_NORMAL 0 00944 #define DOBI_PUSHED 1 00945 #define DOBI_HOT 2 00946 #define DOBI_INACTIVE 3 00947 00948 #define DOBI_CHECK 1 // checkbox/radio/3state button states 00949 #define DOBI_DOWN 2 00950 #define DOBI_CHECKDOWN 3 00951 00952 #define DOBI_CAPON 0 // caption states 00953 #define DOBI_CAPOFF 1 00954 00955 // shared bitmap mappings 00956 #define DOBI_3STATE 8 // offset from checkbox to 3state 00957 #define DOBI_MBAR OBI_CLOSE_MBAR // offset to menu bar equivalent 00958 00959 #define OBI_CLOSE 0 // caption close button 00960 #define OBI_CLOSE_D 1 00961 #define OBI_CLOSE_H 2 00962 #define OBI_CLOSE_I 3 00963 #define OBI_REDUCE 4 // caption minimize button 00964 #define OBI_REDUCE_D 5 00965 #define OBI_REDUCE_H 6 00966 #define OBI_REDUCE_I 7 00967 #define OBI_RESTORE 8 // caption restore button 00968 #define OBI_RESTORE_D 9 00969 #define OBI_RESTORE_H 10 00970 #define OBI_HELP 11 00971 #define OBI_HELP_D 12 00972 #define OBI_HELP_H 13 00973 #define OBI_ZOOM 14 // caption maximize button 00974 #define OBI_ZOOM_D 15 00975 #define OBI_ZOOM_H 16 00976 #define OBI_ZOOM_I 17 00977 #define OBI_CLOSE_MBAR 18 // menu bar close button 00978 #define OBI_CLOSE_MBAR_D 19 00979 #define OBI_CLOSE_MBAR_H 20 00980 #define OBI_CLOSE_MBAR_I 21 00981 #define OBI_REDUCE_MBAR 22 // menu bar minimize button 00982 #define OBI_REDUCE_MBAR_D 23 00983 #define OBI_REDUCE_MBAR_H 24 00984 #define OBI_REDUCE_MBAR_I 25 00985 #define OBI_RESTORE_MBAR 26 // menu bar restore button 00986 #define OBI_RESTORE_MBAR_D 27 00987 #define OBI_RESTORE_MBAR_H 28 00988 #define OBI_CAPCACHE1 29 // caption icon cache entry #1 00989 #define OBI_CAPCACHE1_I 30 00990 #define OBI_CAPCACHE2 31 // caption icon cache entry #2 00991 #define OBI_CAPCACHE2_I 32 00992 #define OBI_CAPCACHE3 33 // caption icon cache entry #3 00993 #define OBI_CAPCACHE3_I 34 00994 #define OBI_CAPCACHE4 35 // caption icon cache entry #4 00995 #define OBI_CAPCACHE4_I 36 00996 #define OBI_CAPCACHE5 37 // caption icon cache entry #5 00997 #define OBI_CAPCACHE5_I 38 00998 #define OBI_CAPBTNS 39 // caption buttons cache 00999 #define OBI_CAPBTNS_I 40 01000 #define OBI_CLOSE_PAL 41 // small caption close button 01001 #define OBI_CLOSE_PAL_D 42 01002 #define OBI_CLOSE_PAL_H 43 01003 #define OBI_CLOSE_PAL_I 44 01004 #define OBI_NCGRIP 45 // bottom/right size grip 01005 #define OBI_UPARROW 46 // up scroll arrow 01006 #define OBI_UPARROW_D 47 01007 #define OBI_UPARROW_H 48 01008 #define OBI_UPARROW_I 49 01009 #define OBI_DNARROW 50 // down scroll arrow 01010 #define OBI_DNARROW_D 51 01011 #define OBI_DNARROW_H 52 01012 #define OBI_DNARROW_I 53 01013 #define OBI_RGARROW 54 // right scroll arrow 01014 #define OBI_RGARROW_D 55 01015 #define OBI_RGARROW_H 56 01016 #define OBI_RGARROW_I 57 01017 #define OBI_LFARROW 58 // left scroll arrow 01018 #define OBI_LFARROW_D 59 01019 #define OBI_LFARROW_H 60 01020 #define OBI_LFARROW_I 61 01021 #define OBI_MENUARROW 62 // menu hierarchy arrow 01022 #define OBI_MENUCHECK 63 // menu check mark 01023 #define OBI_MENUBULLET 64 // menu bullet mark 01024 #define OBI_MENUARROWUP 65 01025 #define OBI_MENUARROWUP_H 66 01026 #define OBI_MENUARROWUP_I 67 01027 #define OBI_MENUARROWDOWN 68 01028 #define OBI_MENUARROWDOWN_H 69 01029 #define OBI_MENUARROWDOWN_I 70 01030 #define OBI_RADIOMASK 71 // radio button mask 01031 #define OBI_CHECK 72 // check box 01032 #define OBI_CHECK_C 73 01033 #define OBI_CHECK_D 74 01034 #define OBI_CHECK_CD 75 01035 #define OBI_CHECK_CDI 76 01036 #define OBI_RADIO 77 // radio button 01037 #define OBI_RADIO_C 78 01038 #define OBI_RADIO_D 79 01039 #define OBI_RADIO_CD 80 01040 #define OBI_RADIO_CDI 81 01041 #define OBI_3STATE 82 // 3-state button 01042 #define OBI_3STATE_C 83 01043 #define OBI_3STATE_D 84 01044 #define OBI_3STATE_CD 85 01045 #define OBI_3STATE_CDI 86 01046 #define OBI_POPUPFIRST 87 // System popupmenu bitmaps. 01047 #define OBI_CLOSE_POPUP 87 01048 #define OBI_RESTORE_POPUP 88 01049 #define OBI_ZOOM_POPUP 89 01050 #define OBI_REDUCE_POPUP 90 01051 #define OBI_NCGRIP_L 91 01052 #define OBI_MENUARROW_L 92 01053 #define OBI_COUNT 93 // bitmap count 01054 01055 /* 01056 * One global instance of this structure is allocated into memory that is 01057 * mapped into all clients' address space. Client-side functions will 01058 * read this data to avoid calling the server. 01059 */ 01060 01061 #define NCHARS 256 01062 #define NCTRLS 0x20 01063 01064 /* 01065 * PERUSERSERVERINFO flags. 01066 * 01067 * !!!!!! NOTE !!!!!! 01068 * Currently, PUSIFlags is a BYTE. If the new flag that you add exceeds the BYTE 01069 * boundaries, you must make PUSIFlags a WORD or a DWORD. 01070 */ 01071 #define PUSIF_PALETTEDISPLAY 0x01 /* Is the display palettized? */ 01072 #define PUSIF_SNAPTO 0x02 /* Is SnapTo enabled? */ 01073 #define PUSIF_COMBOBOXANIMATION 0x04 /* Must match UPBOOLMask(SPI_GETCOMBOBOXANIMATION) */ 01074 #define PUSIF_LISTBOXSMOOTHSCROLLING 0x08 /* Must match UPBOOLMask(SPI_GETLISTBOXSMOOTHSCROLLING) */ 01075 01076 #define TEST_PUSIF(f) TEST_FLAG(gpsi->PUSIFlags, f) 01077 #define TEST_BOOL_PUSIF(f) TEST_BOOL_FLAG(gpsi->PUSIFlags, f) 01078 #define SET_PUSIF(f) SET_FLAG(gpsi->PUSIFlags, f) 01079 #define CLEAR_PUSIF(f) CLEAR_FLAG(gpsi->PUSIFlags, f) 01080 #define SET_OR_CLEAR_PUSIF(f, fSet) SET_OR_CLEAR_FLAG(gpsi->PUSIFlags, f, fSet) 01081 #define TOGGLE_PUSIF(f) TOGGLE_FLAG(gpsi->PUSIFlags, f) 01082 01083 typedef struct tagPERUSERSERVERINFO { 01084 /* 01085 * All of this information should be mapped to the server, but put in 01086 * the desktop section so it can vary from desktop to desktop. 01087 */ 01088 01089 int aiSysMet[SM_CMETRICS]; 01090 COLORREF argbSystem[COLOR_MAX]; 01091 POINT ptCursor; 01092 DWORD dwLastRITEventTickCount; 01093 int nEvents; 01094 01095 int gclBorder; /* # of logical units in window frame */ 01096 01097 UINT dtScroll; 01098 UINT dtLBSearch; 01099 UINT dtCaretBlink; 01100 UINT ucWheelScrollLines; /* # of lines to scroll when wheel is rolled */ 01101 01102 int wMaxLeftOverlapChars; 01103 int wMaxRightOverlapChars; 01104 01105 /* 01106 * these are here to lose a thunk for GetDialogBaseUnits 01107 */ 01108 int cxSysFontChar; 01109 int cySysFontChar; 01110 int cxMsgFontChar; 01111 int cyMsgFontChar; 01112 TEXTMETRIC tmSysFont; 01113 01114 01115 /* 01116 * values to allow HasCaptionIcon to be in user32 01117 */ 01118 HICON hIconSmWindows; 01119 HICON hIcoWindows; 01120 01121 HFONT hCaptionFont; 01122 HFONT hMsgFont; 01123 01124 01125 DWORD dwKeyCache; 01126 DWORD dwAsyncKeyCache; 01127 01128 /* 01129 * Information about the current state of the display which needs to 01130 * be shared with the client side. The information here corresponds 01131 * to the display in gpDispInfo. Note that much of this information 01132 * is only for the primary monitor. 01133 */ 01134 OEMBITMAPINFO oembmi[OBI_COUNT]; /* OEM bitmap information */ 01135 RECT rcScreen; /* rectangle of the virtual screen */ 01136 WORD BitCount; /* Planes * Depth */ 01137 WORD dmLogPixels; /* logical pixels per inch, both X and Y */ 01138 BYTE Planes; /* Planes */ 01139 BYTE BitsPixel; /* Depth */ 01140 01141 BYTE PUSIFlags; // PUSIF_ flags 01142 } PERUSERSERVERINFO, *PPERUSERSERVERINFO; 01143 01144 #define SRVIF_CHECKED 0x0001 01145 #define SRVIF_WINEVENTHOOKS 0x0002 01146 #define SRVIF_DBCS 0x0004 01147 #define SRVIF_IME 0x0008 01148 #define SRVIF_MIDEAST 0x0010 01149 01150 #define TEST_SRVIF(f) TEST_FLAG(gpsi->wSRVIFlags, f) 01151 #define TEST_BOOL_SRVIF(f) TEST_BOOL_FLAG(gpsi->wSRVIFlags, f) 01152 #define SET_SRVIF(f) SET_FLAG(gpsi->wSRVIFlags, f) 01153 #define CLEAR_SRVIF(f) CLEAR_FLAG(gpsi->wSRVIFlags, f) 01154 #define SET_OR_CLEAR_SRVIF(f, fSet) SET_OR_CLEAR_FLAG(gpsi->wSRVIFlags, f, fSet) 01155 #define TOGGLE_SRVIF(f) TOGGLE_FLAG(gpsi->wSRVIFlags, f) 01156 01157 #define RIPF_PROMPTONERROR 0x0001 01158 #define RIPF_PROMPTONWARNING 0x0002 01159 #define RIPF_PROMPTONVERBOSE 0x0004 01160 #define RIPF_PRINTONERROR 0x0010 01161 #define RIPF_PRINTONWARNING 0x0020 01162 #define RIPF_PRINTONVERBOSE 0x0040 01163 #define RIPF_PRINTFILELINE 0x0100 01164 #define RIPF_HIDEPID 0x0200 01165 01166 #define RIPF_DEFAULT ((WORD)(RIPF_PROMPTONERROR | \ 01167 RIPF_PRINTONERROR | \ 01168 RIPF_PRINTONWARNING)) 01169 01170 #define RIPF_PROMPT_MASK 0x0007 01171 #define RIPF_PROMPT_SHIFT 0x00 01172 #define RIPF_PRINT_MASK 0x0070 01173 #define RIPF_PRINT_SHIFT 0x04 01174 #define RIPF_VALIDUSERFLAGS 0x0377 01175 01176 #define TEST_RIPF(f) TEST_FLAG((gpsi) ? gpsi->wRIPFlags : RIPF_DEFAULT, f) 01177 #define TEST_BOOL_RIPF(f) TEST_BOOL_FLAG((gpsi) ? gpsi->wRIPFlags : RIPF_DEFAULT, f) 01178 #define SET_RIPF(f) do{UserAssert(gpsi); SET_FLAG(gpsi->wRIPFlags, f);}while (FALSE) 01179 #define CLEAR_RIPF(f) do{UserAssert(gpsi); CLEAR_FLAG(gpsi->wRIPFlags, f);}while (FALSE) 01180 #define SET_OR_CLEAR_RIPF(f, fSet) do{UserAssert(gpsi); SET_OR_CLEAR_FLAG(gpsi->wRIPFlags, f, fSet);}while (FALSE) 01181 #define TOGGLE_RIPF(f) do{UserAssert(gpsi); TOGGLE_FLAG(gpsi->wRIPFlags, f);}while (FALSE) 01182 01183 typedef struct tagSERVERINFO { // si 01184 WORD wRIPFlags; // RIPF_ flags 01185 WORD wSRVIFlags; // SRVIF_ flags 01186 WORD wRIPPID; // PID of process to apply RIP flags to (zero means all) 01187 WORD wRIPError; // Error to break on (zero means all errors are treated equal) 01188 01189 DWORD cHandleEntries; // count of handle entries in array 01190 01191 /* 01192 * Array of server-side function pointers. 01193 * Client passes servers function ID so they can be easily validated; 01194 * this array maps function ID into server-side function address. 01195 * The order of these are enforced by the FNID_ constants, and must match 01196 * the client-side mpFnidClientPfn[] order as well. 01197 */ 01198 WNDPROC_PWNDEX mpFnidPfn[FNID_ARRAY_SIZE]; // function mapping table 01199 WNDPROC_PWND aStoCidPfn[(FNID_WNDPROCEND - FNID_START) + 1]; 01200 01201 // mapping of fnid to min bytes need by public windproc user 01202 WORD mpFnid_serverCBWndProc[(FNID_END - FNID_START) + 1]; 01203 01204 /* 01205 * Client side functions pointer structure. 01206 */ 01207 struct _PFNCLIENT apfnClientA; 01208 struct _PFNCLIENT apfnClientW; 01209 struct _PFNCLIENTWORKER apfnClientWorker; 01210 01211 DWORD cbHandleTable; 01212 01213 /* 01214 * Class atoms to allow fast checks on the client. 01215 */ 01216 ATOM atomSysClass[ICLS_MAX]; // Atoms for control classes 01217 01218 DWORD dwDefaultHeapBase; // so WOW can do handle validation 01219 DWORD dwDefaultHeapSize; 01220 01221 UINT uiShellMsg; // message for shell hooks 01222 01223 UINT wMaxBtnSize; /* Size of the longest button string in any MessageBox */ 01224 DWORD mpAllMBbtnStringsToSTR[MAX_MB_STRINGS]; /* MB button String IDs */ 01225 DWORD AllMBbtnStrings[MAX_MB_STRINGS]; /* MB button String buffer offsets*/ 01226 WCHAR szOK[10]; 01227 WCHAR szCANCEL[15]; 01228 WCHAR szYES[10]; 01229 WCHAR szNO[10]; 01230 WCHAR szABORT[15]; 01231 WCHAR szRETRY[15]; 01232 WCHAR szIGNORE[15]; 01233 WCHAR szCLOSE[15]; 01234 WCHAR szHELP[15]; 01235 01236 /* 01237 * values to allow HasCaptionIcon to be in user32 01238 */ 01239 ATOM atomIconSmProp; 01240 ATOM atomIconProp; 01241 01242 ATOM atomContextHelpIdProp; 01243 01244 char acOemToAnsi[NCHARS]; 01245 char acAnsiToOem[NCHARS]; 01246 01247 /* 01248 * Per user settings. We use _HYDRA_'s PERUSERSERVERINO struct 01249 * to avoid defining fields in two places. 01250 */ 01251 PERUSERSERVERINFO; 01252 01253 #if DEBUGTAGS 01254 DWORD adwDBGTAGFlags[DBGTAG_Max + 1]; 01255 #endif // DEBUGTAGS 01256 01257 } SERVERINFO, *PSERVERINFO; 01258 01259 /* 01260 * Quick test for any Window Event Hooks. 01261 */ 01262 #ifdef _USERK_ 01263 #define FWINABLE() gpWinEventHooks 01264 #else 01265 #define FWINABLE() TEST_SRVIF(SRVIF_WINEVENTHOOKS) 01266 #endif 01267 01268 /* MessageBox String pointers from offset in the gpsi struct */ 01269 #define GETGPSIMBPSTR(u) (LPWSTR) ((LPBYTE)gpsi->AllMBbtnStrings + *(gpsi->AllMBbtnStrings+(u))) 01270 01271 typedef struct _WNDMSG { 01272 UINT maxMsgs; 01273 BYTE *abMsgs; 01274 } WNDMSG, *PWNDMSG; 01275 01276 typedef struct tagSHAREDINFO { 01277 struct tagSERVERINFO *psi; 01278 struct _HANDLEENTRY *aheList; // handle table pointer 01279 struct tagDISPLAYINFO *pDispInfo; // global displayinfo 01280 ULONG ulSharedDelta; // delta between client and kernel mapping of ... 01281 // shared memory section. Only valid/used in client. 01282 01283 /* 01284 * This field is used for DLL preloading to allow custom functinality 01285 * for all windows processes. 01286 */ 01287 LPWSTR pszDllList; 01288 01289 WNDMSG awmControl[FNID_END - FNID_START + 1]; 01290 01291 WNDMSG DefWindowMsgs; 01292 WNDMSG DefWindowSpecMsgs; 01293 } SHAREDINFO, *PSHAREDINFO; 01294 01295 typedef struct _USERCONNECT { 01296 IN ULONG ulVersion; 01297 OUT ULONG ulCurrentVersion; 01298 IN DWORD dwDispatchCount; 01299 OUT SHAREDINFO siClient; 01300 } USERCONNECT, *PUSERCONNECT; 01301 01302 #define USER_MAJOR_VERSION 0x0005 01303 #define USER_MINOR_VERSION 0x0000 01304 01305 #define USERCURRENTVERSION MAKELONG(USER_MINOR_VERSION, USER_MAJOR_VERSION) 01306 01307 /* 01308 * Options used for NtUserSetSysColors 01309 */ 01310 #define SSCF_NOTIFY 0x00000001 01311 #define SSCF_FORCESOLIDCOLOR 0x00000002 01312 #define SSCF_SETMAGICCOLORS 0x00000004 01313 01314 /* 01315 * Structure used for GetClipboardData, where we can have 01316 * extra information returned from the kernel. 01317 */ 01318 typedef struct tagGETCLIPBDATA { 01319 01320 UINT uFmtRet; // Identifies returned format. 01321 BOOL fGlobalHandle; // Indicates if handle is global. 01322 union { 01323 HANDLE hLocale; // Locale (text-type formats only). 01324 HANDLE hPalette; // Palette (bitmap-type formats only). 01325 }; 01326 01327 } GETCLIPBDATA, *PGETCLIPBDATA; 01328 01329 /* 01330 * Structure used for SetClipboardData, where we can have 01331 * extra information passed to the kernel. 01332 */ 01333 typedef struct tagSETCLIPBDATA { 01334 01335 BOOL fGlobalHandle; // Indicates if handle is global. 01336 BOOL fIncSerialNumber; // Indicates if we should increment serial# 01337 01338 } SETCLIPBDATA, *PSETCLIPBDATA; 01339 01340 /* 01341 * HM Object definition control flags 01342 */ 01343 #define OCF_THREADOWNED 0x01 01344 #define OCF_PROCESSOWNED 0x02 01345 #define OCF_MARKPROCESS 0x04 01346 #define OCF_USEPOOLQUOTA 0x08 01347 #define OCF_DESKTOPHEAP 0x10 01348 #define OCF_USEPOOLIFNODESKTOP 0x20 01349 #define OCF_SHAREDHEAP 0x40 01350 #if DBG 01351 #define OCF_VARIABLESIZE 0x80 01352 #else 01353 #define OCF_VARIABLESIZE 0 01354 #endif 01355 01356 /* 01357 * From HANDTABL.C 01358 */ 01359 /* 01360 * Static information about each handle type. 01361 */ 01362 typedef void (*FnDestroyUserObject)(void *); 01363 01364 typedef struct tagHANDLETYPEINFO { 01365 #if DBG 01366 LPCSTR szObjectType; 01367 UINT uSize; 01368 #endif 01369 FnDestroyUserObject fnDestroy; 01370 DWORD dwAllocTag; 01371 BYTE bObjectCreateFlags; 01372 } HANDLETYPEINFO, *PHANDLETYPEINFO; 01373 01374 /* 01375 * The following is the header of all objects managed in the handle list. 01376 * (allocated as part of the object for easy access). All object 01377 * headers must start with the members of a HEAD structure. 01378 */ 01379 typedef struct _HEAD { 01380 HANDLE h; 01381 DWORD cLockObj; 01382 } HEAD, *PHEAD; 01383 01384 /* 01385 * sizeof(THROBJHEAD) must be equal to sizeof(PROCOBJHEAD) 01386 * This is to make sure that DESKHEAD fields are always at the same offset. 01387 */ 01388 typedef struct _THROBJHEAD { 01389 HEAD; 01390 PTHREADINFO pti; 01391 } THROBJHEAD, *PTHROBJHEAD; 01392 01393 typedef struct _PROCOBJHEAD { 01394 HEAD; 01395 DWORD hTaskWow; 01396 } PROCOBJHEAD, *PPROCOBJHEAD; 01397 01398 typedef struct _PROCMARKHEAD { 01399 PROCOBJHEAD; 01400 struct tagPROCESSINFO *ppi; 01401 } PROCMARKHEAD, *PPROCMARKHEAD; 01402 01403 typedef struct _DESKHEAD { 01404 PDESKTOP rpdesk; 01405 PBYTE pSelf; 01406 } DESKHEAD, *PDESKHEAD; 01407 01408 /* 01409 * This type is for HM casting only. Use THRDESKHEAD or PROCDESKHEAD instead. 01410 */ 01411 typedef struct _DESKOBJHEAD { 01412 HEAD; 01413 PVOID pOwner; 01414 DESKHEAD; 01415 } DESKOBJHEAD, *PDESKOBJHEAD; 01416 01417 typedef struct _THRDESKHEAD { 01418 THROBJHEAD; 01419 DESKHEAD; 01420 } THRDESKHEAD, *PTHRDESKHEAD; 01421 01422 typedef struct _PROCDESKHEAD { 01423 PROCOBJHEAD; 01424 DESKHEAD; 01425 } PROCDESKHEAD, *PPROCDESKHEAD; 01426 01427 01428 01429 #define HANDLEF_DESTROY 0x01 01430 #define HANDLEF_INDESTROY 0x02 01431 #define HANDLEF_INWAITFORDEATH 0x04 01432 #define HANDLEF_FINALDESTROY 0x08 01433 #define HANDLEF_MARKED_OK 0x10 01434 #define HANDLEF_GRANTED 0x20 01435 #define HANDLEF_VALID 0x3F 01436 01437 /* 01438 * The following is a handle table entry. 01439 * 01440 * Note that by keeping a pointer to the owning entity (process or 01441 * thread), cleanup will touch only those objects that belong to 01442 * the entity being destroyed. This helps keep the working set 01443 * size down. Look at DestroyProcessesObjects() for an example. 01444 */ 01445 typedef struct _HANDLEENTRY { 01446 PHEAD phead; /* pointer to the real object */ 01447 PVOID pOwner; /* pointer to owning entity (pti or ppi) */ 01448 BYTE bType; /* type of object */ 01449 BYTE bFlags; /* flags - like destroy flag */ 01450 WORD wUniq; /* uniqueness count */ 01451 01452 #if DBG 01453 PLR plr; /* lock record pointer */ 01454 #endif // DBG 01455 01456 } HANDLEENTRY, *PHE; 01457 01458 /* 01459 * Change HMINDEXBITS for bits that make up table index in handle 01460 * Change HMUNIQSHIFT for count of bits to shift uniqueness left. 01461 * Change HMUNIQBITS for bits that make up uniqueness. 01462 * 01463 * Currently 64K handles can be created, w/16 bits of uniqueness. 01464 */ 01465 #define HMINDEXBITS 0x0000FFFF // bits where index is stored 01466 #define HMUNIQSHIFT 16 // bits to shift uniqueness 01467 #define HMUNIQBITS 0xFFFF // valid uniqueness bits 01468 01469 #define HMHandleFromIndex(i) ((HANDLE)(i | (gSharedInfo.aheList[i].wUniq << HMUNIQSHIFT))) 01470 #define HMIndexFromHandle(h) (((ULONG_PTR)h) & HMINDEXBITS) 01471 #define _HMPheFromObject(p) (&gSharedInfo.aheList[HMIndexFromHandle((((PHEAD)p)->h))]) 01472 #define _HMObjectFromHandle(h) ((PVOID)(gSharedInfo.aheList[HMIndexFromHandle(h)].phead)) 01473 #define HMUniqFromHandle(h) ((WORD)((((ULONG_PTR)h) >> HMUNIQSHIFT) & HMUNIQBITS)) 01474 #define HMObjectType(p) (HMPheFromObject(p)->bType) 01475 #define HMObjectFlags(p) (gahti[HMObjectType(p)].bObjectCreateFlags) 01476 01477 #define HMIsMarkDestroy(p) (HMPheFromObject(p)->bFlags & HANDLEF_DESTROY) 01478 01479 /* 01480 * Validation, handle mapping, etc. 01481 */ 01482 #define HMRevalidateHandle(h) HMValidateHandleNoSecure(h, TYPE_GENERIC) 01483 01484 #define HMRevalidateHandleNoRip(h) HMValidateHandleNoRip(h, TYPE_GENERIC) 01485 #define RevalidateHmenu(hmenuX) HMValidateHandleNoRip(hmenuX, TYPE_MENU) 01486 01487 #define _PtoHq(p) ((HANDLE)(((PHEAD)p)->h)) 01488 #define _PtoH(p) ((HANDLE)((p) == NULL ? NULL : _PtoHq(p))) 01489 #define _HW(pwnd) ((HWND)_PtoH(pwnd)) 01490 #define _HWq(pwnd) ((HWND)_PtoHq(pwnd)) 01491 01492 #if DBG && defined(_USERK_) 01493 01494 PHE DBGHMPheFromObject (PVOID p); 01495 PVOID DBGHMObjectFromHandle (HANDLE h); 01496 HANDLE DBGPtoH (PVOID p); 01497 HANDLE DBGPtoHq (PVOID p); 01498 HWND DBGHW (PWND pwnd); 01499 HWND DBGHWq (PWND pwnd); 01500 01501 #define HMPheFromObject(p) DBGHMPheFromObject((p)) 01502 #define HMObjectFromHandle(h) DBGHMObjectFromHandle((HANDLE)(h)) 01503 #define PtoH(p) DBGPtoH((PVOID)(p)) 01504 #define PtoHq(p) DBGPtoHq((PVOID)(p)) 01505 #define HW(pwnd) DBGHW((PWND)(pwnd)) 01506 #define HWq(pwnd) DBGHWq((PWND)(pwnd)) 01507 01508 #else 01509 01510 #define HMPheFromObject(p) _HMPheFromObject(p) 01511 #define HMObjectFromHandle(h) _HMObjectFromHandle(h) 01512 #define PtoH(p) _PtoH(p) 01513 #define PtoHq(p) _PtoHq(p) 01514 #define HW(pwnd) _HW(pwnd) 01515 #define HWq(pwnd) _HWq(pwnd) 01516 01517 #endif /* #else #if DBG && defined(_USERK_) */ 01518 01519 /* 01520 * Inline functions / macros to access HM object head fields 01521 */ 01522 #define _GETPTI(p) (((PTHROBJHEAD)p)->pti) 01523 #define _GETPDESK(p) (((PDESKOBJHEAD)p)->rpdesk) 01524 #define _GETPPI(p) (((PPROCMARKHEAD)p)->ppi) 01525 01526 #if DBG && defined(_USERK_) 01527 extern CONST HANDLETYPEINFO gahti[]; 01528 extern SHAREDINFO gSharedInfo; 01529 __inline PTHREADINFO GETPTI (PVOID p) 01530 { 01531 UserAssert(HMObjectFlags(p) & OCF_THREADOWNED); 01532 return _GETPTI(p); 01533 } 01534 __inline PDESKTOP GETPDESK (PVOID p) 01535 { 01536 UserAssert(HMObjectFlags(p) & OCF_DESKTOPHEAP); 01537 return _GETPDESK(p); 01538 } 01539 __inline PPROCESSINFO GETPPI (PVOID p) 01540 { 01541 UserAssert(HMObjectFlags(p) & OCF_MARKPROCESS); 01542 return _GETPPI(p); 01543 } 01544 01545 #else 01546 01547 #define GETPTI(p) _GETPTI(p) 01548 #define GETPDESK(p) _GETPDESK(p) 01549 #define GETPPI(p) _GETPPI(p) 01550 01551 #endif /* #else #if DBG && defined(_USERK_) */ 01552 01553 #define GETPWNDPPI(p) (GETPTI(p)->ppi) 01554 01555 01556 /* 01557 * NOTE!: there is code in exitwin.c that assumes HMIsMarkDestroy is defined as 01558 * (HMPheFromObject(p)->bFlags & HANDLEF_DESTROY) 01559 */ 01560 01561 #define CPD_ANSI_TO_UNICODE 0x0001 /* CPD represents ansi to U transition */ 01562 #define CPD_UNICODE_TO_ANSI 0x0002 01563 #define CPD_TRANSITION_TYPES (CPD_ANSI_TO_UNICODE|CPD_UNICODE_TO_ANSI) 01564 01565 #define CPD_CLASS 0x0010 /* Get CPD for a class */ 01566 #define CPD_WND 0x0020 01567 #define CPD_DIALOG 0x0040 01568 #define CPD_WNDTOCLS 0x0080 01569 01570 #define CPDHANDLE_HI 0xFFFF 01571 #define MAKE_CPDHANDLE(h) (MAKELONG((WORD)(ULONG_PTR)h,CPDHANDLE_HI)) 01572 #define ISCPDTAG(x) (HIWORD((ULONG_PTR)x) == CPDHANDLE_HI) 01573 01574 /* 01575 * Call Proc Handle Info 01576 */ 01577 typedef struct _CALLPROCDATA { 01578 THRDESKHEAD head; 01579 struct _CALLPROCDATA *pcpdNext; 01580 ULONG_PTR pfnClientPrevious; 01581 WORD wType; 01582 } CALLPROCDATA, *PCALLPROCDATA; 01583 01584 /* 01585 * Class styles 01586 */ 01587 #define CFVREDRAW 0x0001 01588 #define CFHREDRAW 0x0002 01589 #define CFKANJIWINDOW 0x0004 01590 #define CFDBLCLKS 0x0008 01591 #define CFSERVERSIDEPROC 0x0010 // documented as reserved in winuser.h 01592 #define CFOWNDC 0x0020 01593 #define CFCLASSDC 0x0040 01594 #define CFPARENTDC 0x0080 01595 #define CFNOKEYCVT 0x0101 01596 #define CFNOCLOSE 0x0102 01597 #define CFLVB 0x0104 01598 #define CFSAVEBITS 0x0108 01599 #define CFOEMCHARS 0x0140 01600 #define CFIME 0x0201 01601 01602 #define CFCACHEDSMICON 0x0304 01603 01604 /* 01605 * Offset from the beginning of the CLS structure to the WNDCLASS section. 01606 */ 01607 #define CFOFFSET (sizeof(CLS) - sizeof(COMMON_WNDCLASS)) 01608 01609 #define TestCF(hwnd, flag) (*((BYTE *)((PWND)(hwnd))->pcls + CFOFFSET + HIBYTE(flag)) & LOBYTE(flag)) 01610 #define SetCF(hwnd, flag) (*((BYTE *)((PWND)(hwnd))->pcls + CFOFFSET + HIBYTE(flag)) |= LOBYTE(flag)) 01611 #define ClrCF(pcls, flag) (*((BYTE *)((PWND)(hwnd))->pcls + CFOFFSET + HIBYTE(flag)) &= ~LOBYTE(flag)) 01612 01613 #define TestCF2(pcls, flag) (*((BYTE *)(pcls) + CFOFFSET + (int)HIBYTE(flag)) & LOBYTE(flag)) 01614 #define SetCF2(pcls, flag) (*((BYTE *)(pcls) + CFOFFSET + (int)HIBYTE(flag)) |= LOBYTE(flag)) 01615 #define ClrCF2(pcls, flag) (*((BYTE *)(pcls) + CFOFFSET + (int)HIBYTE(flag)) &= ~LOBYTE(flag)) 01616 01617 #define PWCFromPCLS(pcls) ((PWC)((PBYTE)(pcls) + sizeof(CLS) + (pcls)->cbclsExtra)) 01618 01619 /* Window class structure */ 01620 typedef struct tagCOMMON_WNDCLASS 01621 { 01622 UINT style; 01623 WNDPROC_PWND lpfnWndProc; // HI BIT on means WOW PROC 01624 int cbclsExtra; 01625 int cbwndExtra; 01626 HANDLE hModule; 01627 struct tagCURSOR *spicn; 01628 struct tagCURSOR *spcur; 01629 HBRUSH hbrBackground; 01630 LPWSTR lpszMenuName; 01631 LPSTR lpszAnsiClassName; 01632 struct tagCURSOR *spicnSm; 01633 } COMMON_WNDCLASS; 01634 /* 01635 * Class Menu names structure. For performance reasons (GetClassInfo) 01636 * we keep two client side copies of wndcls.lpszMenu and another kernel side copy. 01637 * This structure is used to pass menu names info between client and kernel. 01638 */ 01639 typedef struct tagCLSMENUNAME 01640 { 01641 LPSTR pszClientAnsiMenuName; 01642 LPWSTR pwszClientUnicodeMenuName; 01643 PUNICODE_STRING pusMenuName; 01644 } CLSMENUNAME, *PCLSMENUNAME; 01645 01646 /* 01647 * This is the window class structure. All window classes are linked 01648 * together in a master list pointed to by pclsList. 01649 * 01650 * RED ALERT! Do not add any fields after the COMMON_WNDCLASS structure; 01651 * CFOFFSET depends on this. 01652 */ 01653 01654 typedef struct tagCLS { 01655 /* NOTE: The order of the following fields is assumed. */ 01656 struct tagCLS *pclsNext; 01657 ATOM atomClassName; 01658 WORD fnid; // record window proc used by this hwnd 01659 // access through GETFNID 01660 struct tagDESKTOP *rpdeskParent;/* Parent desktop */ 01661 struct tagDCE *pdce; /* PDCE to DC associated with class */ 01662 int cWndReferenceCount; /* The number of windows registered 01663 with this class */ 01664 WORD hTaskWow; 01665 WORD CSF_flags; /* internal class flags */ 01666 LPSTR lpszClientAnsiMenuName; /* string or resource ID */ 01667 LPWSTR lpszClientUnicodeMenuName; /* string or resource ID */ 01668 01669 PCALLPROCDATA spcpdFirst; /* Pointer to first CallProcData element (or 0) */ 01670 struct tagCLS *pclsBase; /* Pointer to base class */ 01671 struct tagCLS *pclsClone; /* Pointer to clone class list */ 01672 01673 COMMON_WNDCLASS; 01674 /* 01675 * WARNING: 01676 * CFOFFSET expects COMMON_WNDCLASS to be last fields in CLS 01677 */ 01678 } CLS, *PCLS, *LPCLS, **PPCLS; 01679 01680 /* 01681 * This class flag is used to distinguish classes that were registered 01682 * by the server (most system classes) from those registered by the client. 01683 * Note -- flags are a WORD in the class structure now. 01684 */ 01685 #define CSF_SERVERSIDEPROC 0x0001 01686 #define CSF_ANSIPROC 0x0002 01687 #define CSF_WOWDEFERDESTROY 0x0004 01688 #define CSF_SYSTEMCLASS 0x0008 01689 #define CSF_WOWCLASS 0x0010 // extra words at end for wow info 01690 #define CSF_WOWEXTRA 0x0020 01691 01692 /* 01693 * SBDATA are the values for one scrollbar 01694 */ 01695 01696 typedef struct tagSBDATA { 01697 int posMin; 01698 int posMax; 01699 int page; 01700 int pos; 01701 } SBDATA, *PSBDATA; 01702 01703 /* 01704 * SBINFO is the set of values that hang off of a window structure, if the 01705 * window has scrollbars. 01706 */ 01707 typedef struct tagSBINFO { 01708 int WSBflags; 01709 SBDATA Horz; 01710 SBDATA Vert; 01711 } SBINFO, *PSBINFO; 01712 01713 /* 01714 * Window Property structure 01715 */ 01716 typedef struct tagPROP { 01717 HANDLE hData; 01718 ATOM atomKey; 01719 WORD fs; 01720 } PROP, *PPROP; 01721 01722 #define PROPF_INTERNAL 0x0001 01723 #define PROPF_STRING 0x0002 01724 #define PROPF_NOPOOL 0x0004 01725 01726 01727 /* 01728 * Window Property List structure 01729 */ 01730 typedef struct tagPROPLIST { 01731 UINT cEntries; 01732 UINT iFirstFree; 01733 PROP aprop[1]; 01734 } PROPLIST, *PPROPLIST; 01735 01736 01737 typedef struct tagWND { // wnd 01738 THRDESKHEAD head; 01739 01740 WW; // WOW-USER common fields. Defined in wowuserp.h 01741 // The presence of "state" at the start of this structure is assumed 01742 // by the STATEOFFSET macro. 01743 01744 struct tagWND *spwndNext; // Handle to the next window 01745 struct tagWND *spwndParent; // Backpointer to the parent window. 01746 struct tagWND *spwndChild; // Handle to child 01747 struct tagWND *spwndOwner; // Popup window owner field 01748 01749 RECT rcWindow; // Window outer rectangle 01750 RECT rcClient; // Client rectangle 01751 01752 WNDPROC_PWND lpfnWndProc; // Can be WOW address or standard address 01753 01754 PCLS pcls; // Pointer to window class 01755 int cbwndExtra; // Extra bytes in window 01756 01757 HRGN hrgnUpdate; // Accumulated paint region 01758 01759 struct tagWND *spwndLastActive; // Last active in owner/ownee list 01760 PPROPLIST ppropList; // Pointer to property list 01761 PSBINFO pSBInfo; // Words used for scrolling 01762 01763 struct tagMENU *spmenuSys; // Handle to system menu 01764 struct tagMENU *spmenu; // Menu handle or ID 01765 LARGE_UNICODE_STRING strName; 01766 01767 ULONG_PTR dwUserData; // Reserved for random application data 01768 HRGN hrgnClip; // Clipping region for this window 01769 01770 HIMC hImc; // Associated input context handle 01771 01772 } WND; 01773 01774 #define NEEDSPAINT(pwnd) (pwnd->hrgnUpdate != NULL || TestWF(pwnd, WFINTERNALPAINT)) 01775 01776 /* 01777 * Combo Box stuff 01778 */ 01779 typedef struct tagCBox { 01780 struct tagWND *spwnd; /* Window for the combo box */ 01781 struct tagWND *spwndParent;/* Parent of the combo box */ 01782 RECT editrc; /* Rectangle for the edit control/static text 01783 area */ 01784 RECT buttonrc; /* Rectangle where the dropdown button is */ 01785 01786 int cxCombo; // Width of sunken area 01787 int cyCombo; // Height of sunken area 01788 int cxDrop; // 0x24 Width of dropdown 01789 int cyDrop; // Height of dropdown or shebang if simple 01790 01791 struct tagWND *spwndEdit; /* Edit control window handle */ 01792 struct tagWND *spwndList; /* List box control window handle */ 01793 01794 UINT CBoxStyle:2; /* Combo box style */ 01795 UINT fFocus:1; /* Combo box has focus? */ 01796 UINT fNoRedraw:1; /* Stop drawing? */ 01797 UINT fMouseDown:1; /* Was the popdown button just clicked and 01798 mouse still down? */ 01799 UINT fButtonPressed:1; /* Is the dropdown button in an inverted state? 01800 */ 01801 UINT fLBoxVisible:1; /* Is list box visible? (dropped down?) */ 01802 UINT OwnerDraw:2; /* Owner draw combo box if nonzero. value 01803 * specifies either fixed or varheight 01804 */ 01805 UINT fKeyboardSelInListBox:1; /* Is the user keyboarding through the 01806 * listbox. So that we don't hide the 01807 * listbox on selchanges caused by the 01808 * user keyboard through it but we do 01809 * hide it if the mouse causes the 01810 * selchange. 01811 */ 01812 UINT fExtendedUI:1; /* Are we doing TandyT's UI changes on this 01813 * combo box? 01814 */ 01815 UINT fCase:2; 01816 01817 UINT f3DCombo:1; // 3D or flat border? 01818 UINT fNoEdit:1; /* True if editing is not allowed in the edit 01819 * window. 01820 */ 01821 #ifdef COLOR_HOTTRACKING 01822 UINT fButtonHotTracked:1; /* Is the dropdown hot-tracked? */ 01823 #endif // COLOR_HOTTRACKING 01824 UINT fRightAlign:1; /* used primarily for MidEast right align */ 01825 UINT fRtoLReading:1; /* used only for MidEast, text rtol reading order */ 01826 HANDLE hFont; /* Font for the combo box */ 01827 LONG styleSave; /* Temp to save the style bits when creating 01828 * window. Needed because we strip off some 01829 * bits and pass them on to the listbox or 01830 * edit box. 01831 */ 01832 } CBOX, *PCBOX; 01833 01834 typedef struct tagCOMBOWND { 01835 WND wnd; 01836 PCBOX pcbox; 01837 } COMBOWND, *PCOMBOWND; 01838 01839 /* 01840 * List Box 01841 */ 01842 typedef struct _SCROLLPOS { 01843 INT cItems; 01844 UINT iPage; 01845 INT iPos; 01846 UINT fMask; 01847 INT iReturn; 01848 } SCROLLPOS, *PSCROLLPOS; 01849 01850 typedef struct tagLBIV { 01851 PWND spwndParent; /* parent window */ 01852 PWND spwnd; /* lbox ctl window */ 01853 INT iTop; /* index of top item displayed */ 01854 INT iSel; /* index of current item selected */ 01855 INT iSelBase; /* base sel for multiple selections */ 01856 INT cItemFullMax; /* cnt of Fully Visible items. Always contains 01857 result of CItemInWindow(plb, FALSE) for fixed 01858 height listboxes. Contains 1 for var height 01859 listboxes. */ 01860 INT cMac; /* cnt of items in listbox */ 01861 INT cMax; /* cnt of total # items allocated for rgpch. 01862 Not all are necessarly in use */ 01863 PBYTE rgpch; /* pointer to array of string offsets */ 01864 LPWSTR hStrings; /* string storage handle */ 01865 INT cchStrings; /* Size in bytes of hStrings */ 01866 INT ichAlloc; /* Pointer to end of hStrings (end of last valid 01867 string) */ 01868 INT cxChar; /* Width of a character */ 01869 INT cyChar; /* height of line */ 01870 INT cxColumn; /* width of a column in multicolumn listboxes */ 01871 INT itemsPerColumn; /* for multicolumn listboxes */ 01872 INT numberOfColumns; /* for multicolumn listboxes */ 01873 POINT ptPrev; /* coord of last tracked mouse pt. used for auto 01874 scrolling the listbox during timer's */ 01875 01876 UINT OwnerDraw:2; /* Owner draw styles. Non-zero if ownerdraw. */ 01877 UINT fRedraw:1; /* if TRUE then do repaints */ 01878 UINT fDeferUpdate:1; /* */ 01879 UINT wMultiple:2; /* SINGLESEL allows a single item to be selected. 01880 * MULTIPLESEL allows simple toggle multi-selection 01881 * EXTENDEDSEL allows extended multi selection; 01882 */ 01883 01884 UINT fSort:1; /* if TRUE the sort list */ 01885 UINT fNotify:1; /* if TRUE then Notify parent */ 01886 UINT fMouseDown:1; /* if TRUE then process mouse moves/mouseup */ 01887 UINT fCaptured:1; // if TRUE then process mouse messages 01888 UINT fCaret:1; /* flashing caret allowed */ 01889 UINT fDoubleClick:1; /* mouse down in double click */ 01890 UINT fCaretOn:1; /* if TRUE then caret is on */ 01891 UINT fAddSelMode:1; /* if TRUE, then it is in ADD selection mode */ 01892 UINT fHasStrings:1; /* True if the listbox has a string associated 01893 * with each item else it has an app suppled LONG 01894 * value and is ownerdraw 01895 */ 01896 UINT fHasData:1; /* if FALSE, then lb doesn't keep any line data 01897 * beyond selection state, but instead calls back 01898 * to the client for each line's definition. 01899 * Forces OwnerDraw==OWNERDRAWFIXED, !fSort, 01900 * and !fHasStrings. 01901 */ 01902 UINT fNewItemState:1; /* select/deselect mode? for multiselection lb 01903 */ 01904 UINT fUseTabStops:1; /* True if the non-ownerdraw listbox should handle 01905 * tabstops 01906 */ 01907 UINT fMultiColumn:1; /* True if this is a multicolumn listbox */ 01908 UINT fNoIntegralHeight:1; /* True if we don't want to size the listbox 01909 * an integral lineheight 01910 */ 01911 UINT fWantKeyboardInput:1; /* True if we should pass on WM_KEY & CHAR 01912 * so that the app can go to special items 01913 * with them. 01914 */ 01915 UINT fDisableNoScroll:1; /* True if the listbox should 01916 * automatically Enable/disable 01917 * it's scroll bars. If false, the scroll 01918 * bars will be hidden/Shown automatically 01919 * if they are present. 01920 */ 01921 UINT fHorzBar:1; // TRUE if WS_HSCROLL specified at create time 01922 01923 UINT fVertBar:1; // TRUE if WS_VSCROLL specified at create time 01924 UINT fFromInsert:1; // TRUE if client drawing should be deferred during delete/insert ops 01925 UINT fNoSel:1; 01926 01927 UINT fHorzInitialized : 1; // Horz scroll cache initialized 01928 UINT fVertInitialized : 1; // Vert scroll cache initialized 01929 01930 UINT fSized : 1; // Listbox was resized. 01931 UINT fIgnoreSizeMsg : 1; // If TRUE, ignore WM_SIZE message 01932 01933 UINT fInitialized : 1; 01934 01935 UINT fRightAlign:1; // used primarily for MidEast right align 01936 UINT fRtoLReading:1; // used only for MidEast, text rtol reading order 01937 UINT fSmoothScroll:1; // allow just one smooth-scroll per scroll cycle 01938 01939 int xRightOrigin; // For horizontal scrolling. The current x origin 01940 01941 INT iLastSelection; /* Used for cancelable selection. Last selection 01942 * in listbox for combo box support 01943 */ 01944 INT iMouseDown; /* For multiselection mouse click & drag extended 01945 * selection. It is the ANCHOR point for range 01946 * selections 01947 */ 01948 INT iLastMouseMove; /* selection of listbox items */ 01949 /* 01950 * IanJa/Win32: Tab positions remain int for 32-bit API ?? 01951 */ 01952 LPINT iTabPixelPositions; /* List of positions for tabs */ 01953 HANDLE hFont; /* User settable font for listboxes */ 01954 int xOrigin; /* For horizontal scrolling. The current x origin */ 01955 int maxWidth; /* Maximum width of listbox in pixels for 01956 horizontal scrolling purposes */ 01957 PCBOX pcbox; /* Combo box pointer */ 01958 HDC hdc; /* hdc currently in use */ 01959 DWORD dwLocaleId; /* Locale used for sorting strings in list box */ 01960 int iTypeSearch; 01961 LPWSTR pszTypeSearch; 01962 SCROLLPOS HPos; 01963 SCROLLPOS VPos; 01964 } LBIV, *PLBIV; 01965 01966 typedef struct tagLBWND { 01967 WND wnd; 01968 PLBIV pLBIV; 01969 } LBWND, *PLBWND; 01970 01971 /* 01972 * kernel side input context structure. 01973 */ 01974 typedef struct tagIMC { /* hImc */ 01975 THRDESKHEAD head; 01976 struct tagIMC *pImcNext; 01977 ULONG_PTR dwClientImcData; // Client side data 01978 HWND hImeWnd; // in use Ime Window 01979 } IMC, *PIMC; 01980 01981 01982 /* 01983 * Hook structure. 01984 */ 01985 #undef HOOKBATCH 01986 typedef struct tagHOOK { /* hk */ 01987 THRDESKHEAD head; 01988 struct tagHOOK *phkNext; 01989 int iHook; // WH_xxx hook type 01990 DWORD offPfn; 01991 UINT flags; // HF_xxx flags 01992 int ihmod; 01993 PTHREADINFO ptiHooked; // Thread hooked. 01994 PDESKTOP rpdesk; // Global hook pdesk. Only used when 01995 // hook is locked and owner is destroyed 01996 #ifdef HOOKBATCH 01997 DWORD cEventMessages; // Number of events in the cache 01998 DWORD iCurrentEvent; // Current cache event 01999 DWORD CacheTimeOut; // Timeout between keys 02000 PEVENTMSG aEventCache; // The array of Events 02001 #endif // HOOKBATCH 02002 } HOOK, *PHOOK; 02003 02004 /* 02005 * Hook defines. 02006 */ 02007 #define HF_GLOBAL 0x0001 02008 #define HF_ANSI 0x0002 02009 #define HF_NEEDHC_SKIP 0x0004 02010 #define HF_HUNG 0x0008 // Hook Proc hung don't call if system 02011 #define HF_HOOKFAULTED 0x0010 // Hook Proc faulted 02012 #define HF_NOPLAYBACKDELAY 0x0020 // Ignore requested delay 02013 #define HF_WX86KNOWNDLL 0x0040 // Hook Module is x86 machine type 02014 #define HF_DESTROYED 0x0080 // Set by FreeHook 02015 #if DBG 02016 #define HF_INCHECKWHF 0x0100 // fsHooks is being updated 02017 #define HF_FREED 0x0200 // Object has been freed. 02018 #define HF_DBGUSED 0x03FF // Update if adding a flag 02019 #endif 02020 02021 /* 02022 * Macro to convert the WH_* index into a bit position for 02023 * the fsHooks fields of SERVERINFO and THREADINFO. 02024 */ 02025 #define WHF_FROM_WH(n) (1 << (n + 1)) 02026 02027 /* 02028 * Flags for IsHooked(). 02029 */ 02030 #define WHF_MSGFILTER WHF_FROM_WH(WH_MSGFILTER) 02031 #define WHF_JOURNALRECORD WHF_FROM_WH(WH_JOURNALRECORD) 02032 #define WHF_JOURNALPLAYBACK WHF_FROM_WH(WH_JOURNALPLAYBACK) 02033 #define WHF_KEYBOARD WHF_FROM_WH(WH_KEYBOARD) 02034 #define WHF_GETMESSAGE WHF_FROM_WH(WH_GETMESSAGE) 02035 #define WHF_CALLWNDPROC WHF_FROM_WH(WH_CALLWNDPROC) 02036 #define WHF_CALLWNDPROCRET WHF_FROM_WH(WH_CALLWNDPROCRET) 02037 #define WHF_CBT WHF_FROM_WH(WH_CBT) 02038 #define WHF_SYSMSGFILTER WHF_FROM_WH(WH_SYSMSGFILTER) 02039 #define WHF_MOUSE WHF_FROM_WH(WH_MOUSE) 02040 #define WHF_HARDWARE WHF_FROM_WH(WH_HARDWARE) 02041 #define WHF_DEBUG WHF_FROM_WH(WH_DEBUG) 02042 #define WHF_SHELL WHF_FROM_WH(WH_SHELL) 02043 #define WHF_FOREGROUNDIDLE WHF_FROM_WH(WH_FOREGROUNDIDLE) 02044 02045 /* 02046 * Windowstation and desktop enum list structure. 02047 */ 02048 typedef struct tagNAMELIST { 02049 DWORD cb; 02050 DWORD cNames; 02051 WCHAR awchNames[1]; 02052 } NAMELIST, *PNAMELIST; 02053 02054 #define MONF_VISIBLE 0x01 // monitor is visible on desktop 02055 #define MONF_PALETTEDISPLAY 0x02 // monitor has palette 02056 02057 #ifndef _USERSRV_ 02058 /* 02059 * Monitor information structure. 02060 * 02061 * This structure defines the attributes of a single monitor 02062 * in a virtual display. 02063 */ 02064 typedef struct tagMONITOR { 02065 HEAD head; // object handle stuff 02066 02067 struct tagMONITOR * pMonitorNext; // next monitor in free or used list 02068 DWORD dwMONFlags; // flags 02069 RECT rcMonitor; // location of monitor in virtual screen coordinates 02070 RECT rcWork; // work area of monitor in virtual screen coordinates 02071 HRGN hrgnMonitor; // monitor region in virtual screen coordinates 02072 short cFullScreen; // number of fullscreen apps on this monitor 02073 short cWndStack; // number of tiled top-level windows 02074 HANDLE hDev; // hdev associated with this monitor 02075 } MONITOR, *PMONITOR; 02076 #endif 02077 02078 /* 02079 * Display Information Structure. 02080 * 02081 * This structure defines the display attributes for the 02082 * desktop. This is usually maintained in the DESKTOP 02083 * structure. The current display in use is pointed to 02084 * by gpDispInfo. 02085 * 02086 * CONSIDER: How many of these fields need to be actually kept 02087 * in a DISPLAYINFO that is not in use, rather than just be put 02088 * in gpsi or a kernel-side global? 02089 */ 02090 #ifndef _USERSRV_ 02091 02092 typedef struct tagDISPLAYINFO { 02093 // device stuff 02094 HANDLE hDev; 02095 PVOID pmdev; 02096 HANDLE hDevInfo; 02097 02098 // useful dcs 02099 HDC hdcScreen; // Device-Context for screen 02100 HDC hdcBits; // Holds system-bitmap resource 02101 02102 // Graystring resources 02103 HDC hdcGray; // GrayString DC. 02104 HBITMAP hbmGray; // GrayString Bitmap Surface. 02105 int cxGray; // width of gray bitmap 02106 int cyGray; // height of gray bitmap 02107 02108 // random stuff 02109 PDCE pdceFirst; // list of dcs 02110 PSPB pspbFirst; // list of spbs 02111 02112 // Monitors on this device 02113 ULONG cMonitors; // number of monitors attached to desktop 02114 PMONITOR pMonitorPrimary; // the primary monitor (display) 02115 PMONITOR pMonitorFirst; // monitor in use list 02116 02117 // device characteristics 02118 RECT rcScreen; // Rectangle of entire desktop surface 02119 HRGN hrgnScreen; // region describing virtual screen 02120 WORD dmLogPixels; // pixels per inch 02121 WORD BitCountMax; // Maximum bitcount across all monitors 02122 02123 BOOL fDesktopIsRect:1; // Is the desktop a simple rectangle? 02124 BOOL fAnyPalette:1; // Are any of the monitors paletized? 02125 02126 // NOTE: if you need more flags, make fDesktopIsRect a flags field instead. 02127 02128 } DISPLAYINFO, *PDISPLAYINFO; 02129 02130 /* 02131 * Multimonitor function in rtl\mmrtl.c 02132 */ 02133 PMONITOR _MonitorFromPoint(POINT pt, DWORD dwFlags); 02134 PMONITOR _MonitorFromRect(LPCRECT lprc, DWORD dwFlags); 02135 PMONITOR _MonitorFromWindow(PWND pwnd, DWORD dwFlags); 02136 #endif 02137 02138 #define HDCBITS() gpDispInfo->hdcBits 02139 02140 #define DTF_NEEDSPALETTECHANGED 0x00000001 02141 #define DTF_NEEDSREDRAW 0x00000002 02142 02143 #define CWINHOOKS (WH_MAX - WH_MIN + 1) 02144 02145 /* 02146 * Desktop Information Structure. 02147 * 02148 * This structure contains information regading the 02149 * desktop. This is viewable from both the client and 02150 * kernel processes. 02151 */ 02152 typedef struct tagDESKTOPINFO { 02153 02154 PVOID pvDesktopBase; // For handle validation 02155 PVOID pvDesktopLimit; // ??? 02156 struct tagWND *spwnd; // Desktop window 02157 DWORD fsHooks; // Deskop global hooks 02158 struct tagHOOK *aphkStart[CWINHOOKS]; // List of hooks 02159 struct tagWND *spwndShell; // Shell window 02160 PPROCESSINFO ppiShellProcess; // Shell Process 02161 struct tagWND *spwndBkGnd; // Shell background window 02162 struct tagWND *spwndTaskman; // Task-Manager window 02163 struct tagWND *spwndProgman; // Program-Manager window 02164 int nShellHookPwnd; // ??? 02165 struct tagWND **papwndShellHook; // ??? 02166 int cntMBox; // ??? 02167 } DESKTOPINFO, *PDESKTOPINFO; 02168 02169 #define CURSOR_ALWAYSDESTROY 0 02170 #define CURSOR_CALLFROMCLIENT 1 02171 #define CURSOR_THREADCLEANUP 2 02172 02173 #define CURSORF_FROMRESOURCE 0x0001 // it was loaded from a resource 02174 #define CURSORF_GLOBAL 0x0002 // it never dies 02175 #define CURSORF_LRSHARED 0x0004 // its cached 02176 #define CURSORF_ACON 0x0008 // its animated 02177 #define CURSORF_WOWCLEANUP 0x0010 // marked for cleanup at wow task exit time 02178 #define CURSORF_ACONFRAME 0x0040 // its a frame of an acon 02179 #define CURSORF_SECRET 0x0080 // created internally - not exposed to apps 02180 #define CURSORF_LINKED 0x0100 // linked into a cache 02181 #define CURSORF_VALID 0x01DF 02182 02183 typedef struct tagCURSORDATA { 02184 DWORD CURSORF_flags; 02185 LPWSTR lpName; 02186 LPWSTR lpModName; 02187 WORD rt; 02188 WORD dummy; 02189 DWORD bpp; // -------------------------------------- 02190 DWORD cx; // SetCursorIconData() hack: 02191 DWORD cy; // This part must 02192 SHORT xHotspot; // match the end of 02193 SHORT yHotspot; // the CURSOR 02194 HBITMAP hbmMask; // structure! 02195 HBITMAP hbmColor; // --------------------------------------- 02196 02197 int cpcur; // --------------------------------------- 02198 int cicur; // This part must 02199 struct tagCURSOR **aspcur; // match the end of 02200 DWORD *aicur; // the ACON 02201 PJIF ajifRate; // Structure! 02202 int iicur; // 02203 DWORD fl; // --------------------------------------- 02204 } CURSORDATA, *PCURSORDATA; 02205 02206 02207 typedef struct tagCURSORFIND { 02208 02209 HCURSOR hcur; 02210 DWORD rt; 02211 DWORD cx; 02212 DWORD cy; 02213 DWORD bpp; 02214 02215 } CURSORFIND, *PCURSORFIND; 02216 02217 #define MSGFLAG_MASK 0xFFFE0000 02218 #define MSGFLAG_WOW_RESERVED 0x00010000 // Used by WOW 02219 #define MSGFLAG_DDE_MID_THUNK 0x80000000 // DDE tracking thunk 02220 #define MSGFLAG_DDE_SPECIAL_SEND 0x40000000 // WOW bad DDE app hack 02221 #define MSGFLAG_SPECIAL_THUNK 0x10000000 // server->client thunk needs special handling 02222 02223 #define WIDTHBYTES(i) \ 02224 ((((i) + 31) & ~31) >> 3) 02225 02226 #define BITMAPWIDTHSIZE(cx, cy, planes, bpp) \ 02227 (WIDTHBYTES((cx * bpp)) * (cy) * (planes)) 02228 02229 /* 02230 * Window Style and State Masks - 02231 * 02232 * High byte of word is byte index from the start of the state field 02233 * in the WND structure, low byte is the mask to use on the byte. 02234 * These masks assume the order of the state and style fields of a 02235 * window instance structure. 02236 * 02237 * This is how the Test/Set/Clr/MaskWF value ranges map to the corresponding 02238 * fields in the window structure. 02239 * 02240 * offset WND field 02241 * 0 - 3 state - private 02242 * 4 - 7 state2 - private 02243 * 8 - B ExStyle - public, exposed in SetWindowLong(GWL_EXSTYLE) 02244 * C - F style - public, exposed in SetWindowLong(GWL_STYLE) 02245 * C-D are reserved for window class designer. 02246 * E-F are reserved for WS_ styles. 02247 * 02248 * NOTE: Be sure to add the flag to the wFlags array in kd\userexts.c!!! 02249 */ 02250 02251 /* 02252 * State flags, from 0x0000 to 0x0780. 02253 */ 02254 02255 /* 02256 * DON'T MOVE ANY ONE OF THE FOLLOWING WFXPRESENT FLAGS, 02257 * BECAUSE WFFRAMEPRESENTMASK DEPENDS ON THEIR VALUES 02258 */ 02259 #define WFMPRESENT 0x0001 02260 #define WFVPRESENT 0x0002 02261 #define WFHPRESENT 0x0004 02262 #define WFCPRESENT 0x0008 02263 #define WFFRAMEPRESENTMASK 0x000F 02264 02265 #define WFSENDSIZEMOVE 0x0010 02266 #define WFMSGBOX 0x0020 // used to maintain count of msg boxes on screen 02267 #define WFFRAMEON 0x0040 02268 #define WFHASSPB 0x0080 02269 #define WFNONCPAINT 0x0101 02270 #define WFSENDERASEBKGND 0x0102 02271 #define WFERASEBKGND 0x0104 02272 #define WFSENDNCPAINT 0x0108 02273 #define WFINTERNALPAINT 0x0110 02274 #define WFUPDATEDIRTY 0x0120 02275 #define WFHIDDENPOPUP 0x0140 02276 #define WFMENUDRAW 0x0180 02277 02278 /* 02279 * NOTE -- WFDIALOGWINDOW is used in WOW. DO NOT CHANGE without 02280 * changing WD_DIALOG_WINDOW in winuser.w 02281 */ 02282 #define WFDIALOGWINDOW 0x0201 02283 02284 #define WFTITLESET 0x0202 02285 #define WFSERVERSIDEPROC 0x0204 02286 #define WFANSIPROC 0x0208 02287 #define WFBEINGACTIVATED 0x0210 // prevent recursion in xxxActivateThis Window 02288 #define WFHASPALETTE 0x0220 02289 #define WFPAINTNOTPROCESSED 0x0240 // WM_PAINT message not processed 02290 #define WFSYNCPAINTPENDING 0x0280 02291 #define WFGOTQUERYSUSPENDMSG 0x0301 02292 #define WFGOTSUSPENDMSG 0x0302 02293 #define WFTOGGLETOPMOST 0x0304 // Toggle the WS_EX_TOPMOST bit ChangeStates 02294 02295 /* 02296 * DON'T MOVE REDRAWIFHUNGFLAGS WITHOUT ADJUSTING WFANYHUNGREDRAW 02297 */ 02298 #define WFREDRAWIFHUNG 0x0308 02299 #define WFREDRAWFRAMEIFHUNG 0x0310 02300 #define WFANYHUNGREDRAW 0x0318 02301 02302 #define WFANSICREATOR 0x0320 02303 #define WFREALLYMAXIMIZABLE 0x0340 // The window fills the work area or monitor when maximized 02304 #define WFDESTROYED 0x0380 02305 #define WFWMPAINTSENT 0x0401 02306 #define WFDONTVALIDATE 0x0402 02307 #define WFSTARTPAINT 0x0404 02308 #define WFOLDUI 0x0408 02309 #define WFCEPRESENT 0x0410 // Client edge present 02310 #define WFBOTTOMMOST 0x0420 // Bottommost window 02311 #define WFFULLSCREEN 0x0440 02312 #define WFINDESTROY 0x0480 02313 02314 /* 02315 * DON'T MOVE ANY ONE OF THE FOLLOWING WFWINXXCOMPAT FLAGS, 02316 * BECAUSE WFWINCOMPATMASK DEPENDS ON THEIR VALUES 02317 */ 02318 #define WFWIN31COMPAT 0x0501 // Win 3.1 compatible window 02319 #define WFWIN40COMPAT 0x0502 // Win 4.0 compatible window 02320 #define WFWIN50COMPAT 0x0504 // Win 5.0 compatibile window 02321 #define WFWINCOMPATMASK 0x0507 // Compatibility flag mask 02322 02323 #define WFMAXFAKEREGIONAL 0x0508 // Window has a fake region for maxing on 1 monitor 02324 02325 // Active Accessibility (Window Event) state 02326 #define WFCLOSEBUTTONDOWN 0x0510 02327 #define WFZOOMBUTTONDOWN 0x0520 02328 #define WFREDUCEBUTTONDOWN 0x0540 02329 #define WFHELPBUTTONDOWN 0x0580 02330 #define WFLINEUPBUTTONDOWN 0x0601 // Line up/left scroll button down 02331 #define WFPAGEUPBUTTONDOWN 0x0602 // Page up/left scroll area down 02332 #define WFPAGEDNBUTTONDOWN 0x0604 // Page down/right scroll area down 02333 #define WFLINEDNBUTTONDOWN 0x0608 // Line down/right scroll area down 02334 #define WFSCROLLBUTTONDOWN 0x0610 // Any scroll button down? 02335 #define WFVERTSCROLLTRACK 0x0620 // Vertical or horizontal scroll track... 02336 02337 #define WFALWAYSSENDNCPAINT 0x0640 // Always send WM_NCPAINT to children 02338 #define WFPIXIEHACK 0x0680 // Send (HRGN)1 to WM_NCPAINT (see PixieHack) 02339 02340 /* 02341 * WFFULLSCREENBASE MUST HAVE LOWORD OF 0. See SetFullScreen macro. 02342 */ 02343 #define WFFULLSCREENBASE 0x0700 // Fullscreen flags take up 0x0701 02344 #define WFFULLSCREENMASK 0x0707 // and 0x0702 and 0x0704 02345 02346 #define WFSPRITE 0x0708 // Sprite window 02347 02348 /* 02349 * Add more state flags here, up to 0x0780. 02350 * Look for empty slots above before adding to the end. 02351 * Be sure to add the flag to the wFlags array in kd\userexts.c 02352 */ 02353 02354 /* 02355 * Window Extended Style, from 0x0800 to 0x0B80. 02356 */ 02357 #define WEFDLGMODALFRAME 0x0801 // WS_EX_DLGMODALFRAME 02358 #define WEFDRAGOBJECT 0x0802 // ??? 02359 #define WEFNOPARENTNOTIFY 0x0804 // WS_EX_NOPARENTNOTIFY 02360 #define WEFTOPMOST 0x0808 // WS_EX_TOPMOST 02361 #define WEFACCEPTFILES 0x0810 // WS_EX_ACCEPTFILES 02362 #define WEFTRANSPARENT 0x0820 // WS_EX_TRANSPARENT 02363 #define WEFMDICHILD 0x0840 // WS_EX_MDICHILD 02364 #define WEFTOOLWINDOW 0x0880 // WS_EX_TOOLWINDOW 02365 #define WEFWINDOWEDGE 0x0901 // WS_EX_WINDOWEDGE 02366 #define WEFCLIENTEDGE 0x0902 // WS_EX_CLIENTEDGE 02367 #define WEFEDGEMASK 0x0903 // WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE 02368 #define WEFCONTEXTHELP 0x0904 // WS_EX_CONTEXTHELP 02369 02370 02371 // intl styles 02372 #define WEFRIGHT 0x0910 // WS_EX_RIGHT 02373 #define WEFRTLREADING 0x0920 // WS_EX_RTLREADING 02374 #define WEFLEFTSCROLL 0x0940 // WS_EX_LEFTSCROLLBAR 02375 02376 02377 #define WEFCONTROLPARENT 0x0A01 // WS_EX_CONTROLPARENT 02378 #define WEFSTATICEDGE 0x0A02 // WS_EX_STATICEDGE 02379 #define WEFAPPWINDOW 0x0A04 // WS_EX_APPWINDOW 02380 #define WEFROUNDFRAME 0x0A08 // ??? NOT USED AND CAN BE REUSED 02381 #define WFNOANIMATE 0x0A10 // ??? 02382 #define WFSMQUERYDRAGICON 0x0A20 // ??? Small icon comes from WM_QUERYDRAGICON 02383 #define WFSHELLHOOKWND 0x0A80 // ??? 02384 02385 #ifdef USE_MIRRORING 02386 #define WEFLAYOUTRTL 0x0B04 // WS_EX_LAYOUTRTL 02387 02388 #define WEFNOINHERITLAYOUT 0x0B01 // WS_EX_NOINHERITLAYOUT 02389 #define WEFLAYOUTVBHRESERVED 0x0B02 // WS_EX_LAYOUTVBHRESERVED 02390 #define WEFLAYOUTBTTRESERVED 0x0B08 // WS_EX_LAYOUTBTTRESERVED 02391 #endif 02392 /* 02393 * Add more Window Extended Style flags here, up to 0x0B80. 02394 * Be sure to add the flag to the wFlags array in kd\userexts.c 02395 */ 02396 02397 /* 02398 * Window styles, from 0x0E00 to 0x0F80. 02399 */ 02400 #define WFMAXBOX 0x0E01 // WS_MAXIMIZEBOX 02401 #define WFTABSTOP 0x0E01 // WS_TABSTOP 02402 #define WFMINBOX 0x0E02 // WS_MAXIMIZEBOX 02403 #define WFGROUP 0x0E02 // WS_GROUP 02404 #define WFSIZEBOX 0x0E04 // WS_THICKFRAME, WS_SIZEBOX 02405 #define WFSYSMENU 0x0E08 // WS_SYSMENU 02406 #define WFHSCROLL 0x0E10 // WS_HSCROLL 02407 #define WFVSCROLL 0x0E20 // WS_VSCROLL 02408 #define WFDLGFRAME 0x0E40 // WS_DLGFRAME 02409 #define WFTOPLEVEL 0x0E40 // ??? 02410 #define WFBORDER 0x0E80 // WS_BORDER 02411 #define WFBORDERMASK 0x0EC0 // WS_BORDER | WS_DLGFRAME 02412 #define WFCAPTION 0x0EC0 // WS_CAPTION 02413 02414 #define WFTILED 0x0F00 // WS_OVERLAPPED, WS_TILED 02415 #define WFMAXIMIZED 0x0F01 // WS_MAXIMIZE 02416 #define WFCLIPCHILDREN 0x0F02 // WS_CLIPCHILDREN 02417 #define WFCLIPSIBLINGS 0x0F04 // WS_CLIPSIBLINGS 02418 #define WFDISABLED 0x0F08 // WS_DISABLED 02419 #define WFVISIBLE 0x0F10 // WS_VISIBLE 02420 #define WFMINIMIZED 0x0F20 // WS_MINIMIZE 02421 #define WFCHILD 0x0F40 // WS_CHILD 02422 #define WFPOPUP 0x0F80 // WS_POPUP 02423 #define WFTYPEMASK 0x0FC0 // WS_CHILD | WS_POPUP 02424 #define WFICONICPOPUP 0x0FC0 // WS_CHILD | WS_POPUP 02425 #define WFICONIC WFMINIMIZED 02426 /* 02427 * No more Window style flags are available, use Extended window styles. 02428 */ 02429 02430 02431 /* 02432 * Window Styles for built-in classes, from 0x0C00 to 0x0D80. 02433 */ 02434 02435 // Buttons 02436 #define BFTYPEMASK 0x0C0F 02437 02438 #define BFRIGHTBUTTON 0x0C20 02439 #define BFICON 0x0C40 02440 #define BFBITMAP 0x0C80 02441 #define BFIMAGEMASK 0x0CC0 02442 02443 #define BFLEFT 0x0D01 02444 #define BFRIGHT 0x0D02 02445 #define BFCENTER 0x0D03 02446 #define BFHORZMASK 0x0D03 02447 #define BFTOP 0x0D04 02448 #define BFBOTTOM 0x0D08 02449 #define BFVCENTER 0x0D0C 02450 #define BFVERTMASK 0x0D0C 02451 #define BFALIGNMASK 0x0D0F 02452 02453 #define BFPUSHLIKE 0x0D10 02454 #define BFMULTILINE 0x0D20 02455 #define BFNOTIFY 0x0D40 02456 #define BFFLAT 0x0D80 02457 02458 // Combos 02459 #define CBFSIMPLE 0x0C01 02460 #define CBFDROPDOWN 0x0C02 02461 #define CBFDROPDOWNLIST 0x0C03 02462 02463 #define CBFEDITABLE 0x0C01 02464 #define CBFDROPPABLE 0x0C02 02465 #define CBFDROPTYPE 0x0C03 02466 02467 #define CBFOWNERDRAWFIXED 0x0C10 02468 #define CBFOWNERDRAWVAR 0x0C20 02469 #define CBFOWNERDRAW 0x0C30 02470 02471 #define CBFAUTOHSCROLL 0x0C40 02472 #define CBFOEMCONVERT 0x0C80 02473 #define CBFSORT 0x0D01 02474 #define CBFHASSTRINGS 0x0D02 02475 #define CBFNOINTEGRALHEIGHT 0x0D04 02476 #define CBFDISABLENOSCROLL 0x0D08 02477 #define CBFBUTTONUPTRACK 0x0D10 02478 02479 #define CBFUPPERCASE 0x0D20 02480 #define CBFLOWERCASE 0x0D40 02481 02482 // Dialogs 02483 #define DFSYSMODAL 0x0C02 02484 #define DF3DLOOK 0x0C04 02485 #define DFNOFAILCREATE 0x0C10 02486 #define DFLOCALEDIT 0x0C20 02487 #define WFNOIDLEMSG 0x0D01 02488 #define DFCONTROL 0x0D04 02489 02490 // Edits 02491 #define EFMULTILINE 0x0C04 02492 #define EFUPPERCASE 0x0C08 02493 #define EFLOWERCASE 0x0C10 02494 #define EFPASSWORD 0x0C20 02495 #define EFAUTOVSCROLL 0x0C40 02496 #define EFAUTOHSCROLL 0x0C80 02497 #define EFNOHIDESEL 0x0D01 02498 #define EFCOMBOBOX 0x0D02 02499 #define EFOEMCONVERT 0x0D04 02500 #define EFREADONLY 0x0D08 02501 #define EFWANTRETURN 0x0D10 02502 #define EFNUMBER 0x0D20 02503 02504 // Scrollbars 02505 #define SBFSIZEBOXTOPLEFT 0x0C02 02506 #define SBFSIZEBOXBOTTOMRIGHT 0x0C04 02507 #define SBFSIZEBOX 0x0C08 02508 #define SBFSIZEGRIP 0x0C10 02509 02510 // Statics 02511 #define SFTYPEMASK 0x0C1F 02512 #define SFNOPREFIX 0x0C80 02513 #define SFNOTIFY 0x0D01 02514 #define SFCENTERIMAGE 0x0D02 02515 #define SFRIGHTJUST 0x0D04 02516 #define SFREALSIZEIMAGE 0x0D08 02517 #define SFSUNKEN 0x0D10 02518 #define SFEDITCONTROL 0x0D20 02519 #define SFELLIPSISMASK 0x0DC0 02520 #define SFWIDELINESPACING 0x0C20 02521 02522 02523 /* 02524 * 02525 */ 02526 #define SYS_ALTERNATE 0x2000 02527 #define SYS_PREVKEYSTATE 0x4000 02528 02529 /*** AWESOME HACK ALERT!!! 02530 * 02531 * The low byte of the WF?PRESENT state flags must NOT be the 02532 * same as the low byte of the WFBORDER and WFCAPTION flags, 02533 * since these are used as paint hint masks. The masks are calculated 02534 * with the MaskWF macro below. 02535 * 02536 * The magnitude of this hack compares favorably with that of the national debt. 02537 * 02538 * STATEOFFSET is the offset into the WND structure of the state field. 02539 * The state field is actually part of the WW structure defined in wowuserp.h 02540 * which is embedded in the WND structure. 02541 */ 02542 #define STATEOFFSET (FIELD_OFFSET(WND, state)) 02543 02544 02545 /* 02546 * Redefine LOBYTE to get rid of compiler warning C4309: 02547 * 'cast' : truncation of constant value 02548 */ 02549 #ifdef LOBYTE 02550 #undef LOBYTE 02551 #endif 02552 02553 #define LOBYTE(w) ((BYTE)((w) & 0x00FF)) 02554 02555 #define TestWF(hwnd, flag) (*(((BYTE *)(hwnd)) + STATEOFFSET + (int)HIBYTE(flag)) & LOBYTE(flag)) 02556 #define SetWF(hwnd, flag) (*(((BYTE *)(hwnd)) + STATEOFFSET + (int)HIBYTE(flag)) |= LOBYTE(flag)) 02557 #define ClrWF(hwnd, flag) (*(((BYTE *)(hwnd)) + STATEOFFSET + (int)HIBYTE(flag)) &= ~LOBYTE(flag)) 02558 #define MaskWF(flag) ((WORD)( (HIBYTE(flag) & 1) ? LOBYTE(flag) << 8 : LOBYTE(flag))) 02559 02560 02561 #define TestwndChild(hwnd) (TestWF(hwnd, WFTYPEMASK) == LOBYTE(WFCHILD)) 02562 #define TestwndIPopup(hwnd) (TestWF(hwnd, WFTYPEMASK) == LOBYTE(WFICONICPOPUP)) 02563 #define TestwndTiled(hwnd) (TestWF(hwnd, WFTYPEMASK) == LOBYTE(WFTILED)) 02564 #define TestwndNIPopup(hwnd) (TestWF(hwnd, WFTYPEMASK) == LOBYTE(WFPOPUP)) 02565 #define TestwndPopup(hwnd) (TestwndNIPopup(hwnd) || TestwndIPopup(hwnd)) 02566 #define TestwndHI(hwnd) (TestwndTiled(hwnd) || TestwndIPopup(hwnd)) 02567 02568 #define GetChildParent(pwnd) (TestwndChild(pwnd) ? pwnd->spwndParent : NULL) 02569 #define GetWindowCreator(pwnd) (TestwndChild(pwnd) ? pwnd->spwndParent : pwnd->spwndOwner) 02570 02571 #define TestwndFrameOn(pwnd) (TestWF(pwnd, WFFRAMEON) && (GETPTI(pwnd)->pq == gpqForeground)) 02572 02573 #define GetFullScreen(pwnd) (TestWF(pwnd, WFFULLSCREENMASK)) 02574 #define SetFullScreen(pwnd, state) (ClrWF(pwnd, WFFULLSCREENMASK), \ 02575 SetWF(pwnd, WFFULLSCREENBASE | (state & WFFULLSCREENMASK))) 02576 02577 //#define FTrueVis(pwnd) (pwnd->fs & WF_TRUEVIS) 02578 #define FTrueVis(pwnd) (_IsWindowVisible(pwnd)) 02579 #define _IsWindowEnabled(pwnd) (TestWF(pwnd, WFDISABLED) == 0) 02580 #define _IsIconic(pwnd) (TestWF(pwnd, WFMINIMIZED) != 0) 02581 #define _IsZoomed(pwnd) (TestWF(pwnd, WFMAXIMIZED) != 0) 02582 02583 WORD VersionFromWindowFlag(PWND pwnd); 02584 02585 #define SV_UNSET 0x0000 02586 #define SV_SET 0x0001 02587 #define SV_CLRFTRUEVIS 0x0002 02588 02589 /* 02590 * System menu IDs 02591 */ 02592 #define ID_SYSMENU 0x10 02593 #define ID_CLOSEMENU 0x20 02594 #define CHILDSYSMENU ID_CLOSEMENU 02595 #define ID_DIALOGSYSMENU 0x30 02596 #define ID_HSCROLLMENU 0x40 02597 #define ID_VSCROLLMENU 0x50 02598 02599 /* 02600 * Menu Item Structure 02601 */ 02602 typedef struct tagITEM { 02603 UINT fType; // Item Type Flags 02604 UINT fState; // Item State Flags 02605 UINT wID; 02606 struct tagMENU *spSubMenu; /* Handle to a popup */ 02607 HANDLE hbmpChecked; /* Bitmap for an on check */ 02608 HANDLE hbmpUnchecked; /* Bitmap for an off check */ 02609 LPWSTR lpstr; //item's text 02610 DWORD cch; /* String: WCHAR count */ 02611 ULONG_PTR dwItemData; 02612 DWORD xItem; 02613 DWORD yItem; 02614 DWORD cxItem; 02615 DWORD cyItem; 02616 DWORD dxTab; 02617 DWORD ulX; /* String: Underline start */ 02618 DWORD ulWidth; /* String: underline width */ 02619 HBITMAP hbmp; // item's bitmap 02620 int cxBmp; // bitmap width 02621 int cyBmp; // bitmap height 02622 } ITEM, *PITEM, *LPITEM; 02623 02624 /* 02625 * Scroll menu arrow flags 02626 */ 02627 #define MSA_OFF 0 02628 #define MSA_ON 1 02629 #define MSA_ATTOP 2 02630 #define MSA_ATBOTTOM 3 02631 02632 /* 02633 * Menu Structure 02634 */ 02635 typedef struct tagMENU { 02636 PROCDESKHEAD head; 02637 DWORD fFlags; /* Menu Flags */ 02638 int iItem; /* Contains the position of the selected 02639 item in the menu. -1 if no selection */ 02640 UINT cAlloced; // Number of items that can fit in rgItems 02641 UINT cItems; /* Number of items in rgItems */ 02642 02643 DWORD cxMenu; 02644 DWORD cyMenu; 02645 DWORD cxTextAlign; /* Text align offset for popups*/ 02646 struct tagWND *spwndNotify; /* The owner hwnd of this menu */ 02647 PITEM rgItems; /* The list of items in this menu */ 02648 DWORD dwContextHelpId;// Context help Id for the whole menu 02649 DWORD cyMax; /* max menu height after which menu scrolls */ 02650 DWORD dwMenuData; /* app-supplied menu data */ 02651 02652 HBRUSH hbrBack; // background brush for menu 02653 int iTop; // Scroll top 02654 int iMaxTop; // Scroll MaxTop 02655 DWORD dwArrowsOn:2; // Scroll flags 02656 } MENU, *PMENU; 02657 02658 02659 /* 02660 * Items used for WinHelp and Context Sensitive help support 02661 */ 02662 02663 #define ID_HELPMENU 4 02664 02665 // WINHELP4 invoked type 02666 enum { 02667 TYPE_NORMAL, 02668 TYPE_POPUP, 02669 TYPE_TCARD 02670 }; 02671 02672 typedef struct tagDLGENUMDATA { 02673 PWND pwndDialog; 02674 PWND pwndControl; 02675 POINT ptCurHelp; 02676 } DLGENUMDATA, *PDLGENUMDATA; 02677 02678 BOOL CALLBACK EnumPwndDlgChildProc(PWND pwnd, LPARAM lParam); 02679 BOOL FIsParentDude(PWND pwnd); 02680 02681 02682 #define MNF_DONTSKIPSEPARATORS 0x0001 02683 02684 /* 02685 * The following masks can be used along with the wDisableFlags field of SB 02686 * to find if the Up/Left or Down/Right arrow or Both are disabled; 02687 * Now it is possible to selectively Enable/Disable just one or both the 02688 * arrows in a scroll bar control; 02689 */ 02690 #define LTUPFLAG 0x0001 // Left/Up arrow disable flag. 02691 #define RTDNFLAG 0x0002 // Right/Down arrow disable flag. 02692 02693 typedef struct tagSBCALC { 02694 SBDATA; /* this must be first -- we cast structure pointers */ 02695 int pxTop; 02696 int pxBottom; 02697 int pxLeft; 02698 int pxRight; 02699 int cpxThumb; 02700 int pxUpArrow; 02701 int pxDownArrow; 02702 int pxStart; /* Initial position of thumb */ 02703 int pxThumbBottom; 02704 int pxThumbTop; 02705 int cpx; 02706 int pxMin; 02707 } SBCALC, *PSBCALC; 02708 02709 typedef struct tagSBTRACK { 02710 DWORD fHitOld : 1; 02711 DWORD fTrackVert : 1; 02712 DWORD fCtlSB : 1; 02713 DWORD fTrackRecalc: 1; 02714 PWND spwndTrack; 02715 PWND spwndSB; 02716 PWND spwndSBNotify; 02717 RECT rcTrack; 02718 VOID (*xxxpfnSB)(PWND, UINT, DWORD, LONG, PSBCALC); 02719 UINT cmdSB; 02720 UINT hTimerSB; 02721 int dpxThumb; /* Offset from mouse point to start of thumb box */ 02722 int pxOld; /* Previous position of thumb */ 02723 int posOld; 02724 int posNew; 02725 int nBar; 02726 PSBCALC pSBCalc; 02727 } SBTRACK, *PSBTRACK; 02728 02729 /* 02730 * How many times a thread can spin through get/peek message without idling 02731 * before the system puts the app in the background. 02732 */ 02733 #define CSPINBACKGROUND 100 02734 02735 #define CCHTITLEMAX 256 02736 02737 #define SW_MDIRESTORE 0xCC /* special xxxMinMaximize() command for MDI */ 02738 02739 /* 02740 * This is used by CreateWindow() - the 16 bit version of CW_USEDEFAULT, 02741 * that we still need to support. 02742 */ 02743 #define CW2_USEDEFAULT 0x8000 02744 #define CW_FLAGS_DIFFHMOD 0x80000000 02745 02746 02747 /* 02748 * Menu commands 02749 */ 02750 //#define MENUBIT (0x8000) 02751 //#define MENUUP (0x8000 | VK_UP) 02752 //#define MENUDOWN (0x8000 | VK_DOWN) 02753 //#define MENULEFT (0x8000 | VK_LEFT) 02754 //#define MENURIGHT (0x8000 | VK_RIGHT) 02755 //#define MENUEXECUTE TEXT('\r') /* Return character */ 02756 #define MENUSYSMENU TEXT(' ') /* Space character */ 02757 #define MENUCHILDSYSMENU TEXT('-') /* Hyphen */ 02758 02759 #define MF_ALLSTATE 0x00FF 02760 #define MF_MAINMENU 0xFFFF 02761 #define MFMWFP_OFFMENU 0 02762 #define MFMWFP_MAINMENU 0x0000FFFF 02763 #define MFMWFP_NOITEM 0xFFFFFFFF 02764 #define MFMWFP_UPARROW 0xFFFFFFFD /* Warning: Also used to define IDSYS_MNUP */ 02765 #define MFMWFP_DOWNARROW 0xFFFFFFFC /* Warning: Also used to define IDSYS_MNDOWN */ 02766 #define MFMWFP_MINVALID 0xFFFFFFFC 02767 #define MFMWFP_ALTMENU 0xFFFFFFFB 02768 #define MFMWFP_FIRSTITEM 0 02769 02770 02771 /* 02772 * NOTE: SMF() can only be used on single bit flags (NOT MRGFDISABLED!). 02773 */ 02774 #define SetMF(pmenu, flag) ((pmenu)->fFlags |= (flag)) 02775 #define ClearMF(pmenu, flag) ((pmenu)->fFlags &= ~(flag)) 02776 #define TestMF(pmenu, flag) ((pmenu)->fFlags & (flag)) 02777 02778 #define SetMFS(pitem, flag) ((pitem)->fState |= (flag)) 02779 #define TestMFS(pitem, flag) ((pitem)->fState & (flag)) 02780 #define ClearMFS(pitem, flag) ((pitem)->fState &= ~(flag)) 02781 02782 #define SetMFT(pitem, flag) ((pitem)->fType |= (flag)) 02783 #define TestMFT(pitem, flag) ((pitem)->fType & (flag)) 02784 #define ClearMFT(pitem, flag) ((pitem)->fType &= ~(flag)) 02785 02786 /* 02787 * Dialog structure (dlg). The window-words for the dialog structure must 02788 * be EXACTLY 30 bytes long! This is because Windows 3.0 exported a constant 02789 * called DLGWINDOWEXTRA that resolved to 30. Although we could redefine this 02790 * for 32-bit windows apps, we cannot redefine it for 16 bit apps (it is 02791 * a difficult problem). So instead we peg the window-words at 30 bytes 02792 * exactly, and allocate storage for the other information. 02793 */ 02794 typedef struct _DLG { 02795 DLGPROC lpfnDlg; 02796 DWORD flags; /* Various useful flags -- see definitions below */ 02797 int cxChar; 02798 int cyChar; 02799 HWND hwndFocusSave; 02800 UINT fEnd : 1; 02801 UINT fDisabled : 1; 02802 int result; /* DialogBox result */ 02803 HANDLE hData; /* Global handle for edit ctl storage. */ 02804 HFONT hUserFont; /* Handle of the font mentioned by the user in template*/ 02805 LPVOID pDlgResize; // Resize C++ object 02806 #ifdef SYSMODALWINDOWS 02807 HWND hwndSysModalSave; /* Previous sysmodal window saved here */ 02808 #endif 02809 } DLG, *PDLG; 02810 02811 typedef struct _DIALOG { 02812 WND wnd; 02813 LRESULT resultWP; /* window proc result -- DWL_MSGRESULT (+0) */ 02814 PDLG pdlg; 02815 LONG_PTR unused; /* DWL_USER (+8) */ 02816 BYTE reserved[DLGWINDOWEXTRA - sizeof(LRESULT) - sizeof(PDLG) - sizeof(LONG_PTR)]; 02817 } DIALOG, *PDIALOG; 02818 02819 #define PDLG(pwnd) (((PDIALOG)pwnd)->pdlg) 02820 02821 /* 02822 * Flags definitions for DLG.flags 02823 */ 02824 #define DLGF_ANSI 0x01 /* lpfnDlg is an ANSI proc */ 02825 02826 #define TIF_INCLEANUP (UINT)0x00000001 02827 #define TIF_16BIT (UINT)0x00000002 02828 #define TIF_SYSTEMTHREAD (UINT)0x00000004 02829 #define TIF_CSRSSTHREAD (UINT)0x00000008 02830 #define TIF_TRACKRECTVISIBLE (UINT)0x00000010 02831 #define TIF_ALLOWFOREGROUNDACTIVATE (UINT)0x00000020 02832 #define TIF_DONTATTACHQUEUE (UINT)0x00000040 02833 #define TIF_DONTJOURNALATTACH (UINT)0x00000080 02834 // 0x00000100 Unused was TIF_SCREENSAVER 02835 #define TIF_INACTIVATEAPPMSG (UINT)0x00000200 02836 #define TIF_SPINNING (UINT)0x00000400 02837 #define TIF_PALETTEAWARE (UINT)0x00000800 02838 #define TIF_SHAREDWOW (UINT)0x00001000 02839 #define TIF_FIRSTIDLE (UINT)0x00002000 02840 #define TIF_WAITFORINPUTIDLE (UINT)0x00004000 02841 #define TIF_MOVESIZETRACKING (UINT)0x00008000 02842 #define TIF_VDMAPP (UINT)0x00010000 02843 #define TIF_DOSEMULATOR (UINT)0x00020000 02844 #define TIF_GLOBALHOOKER (UINT)0x00040000 02845 #define TIF_DELAYEDEVENT (UINT)0x00080000 02846 // 0x00100000 Unused. was TIF_ALLOWSHUTDOWN 02847 // 0x00200000 Unused. was TIF_SHUTDOWNCOMPLETE 02848 #define TIF_IGNOREPLAYBACKDELAY (UINT)0x00400000 02849 #define TIF_ALLOWOTHERACCOUNTHOOK (UINT)0x00800000 02850 #define TIF_GUITHREADINITIALIZED (UINT)0x02000000 02851 #define TIF_DISABLEIME (UINT)0x04000000 02852 #define TIF_INGETTEXTLENGTH (UINT)0x08000000 02853 #define TIF_ANSILENGTH (UINT)0x10000000 02854 02855 #define TIF_DISABLEHOOKS (UINT)0x20000000 02856 02857 #define TIF_RESTRICTED (UINT)0x40000000 02858 02859 /* 02860 * Client Thread Information Structure. 02861 * 02862 * This structure contains information regarding the 02863 * thread. This is viewable from both the client and 02864 * kernel processes. 02865 */ 02866 typedef struct tagCLIENTTHREADINFO { 02867 UINT CTIF_flags; 02868 WORD fsChangeBits; // Bits changes since last compared 02869 WORD fsWakeBits; // Bits currently available 02870 WORD fsWakeBitsJournal; // Bits saved while journalling 02871 WORD fsWakeMask; // Bits looking for when asleep 02872 LONG timeLastRead; // Time of last input read 02873 } CLIENTTHREADINFO, *PCLIENTTHREADINFO; 02874 02875 #define CTIF_SYSQUEUELOCKED (UINT)0x00000001 02876 02877 /* 02878 * First check for a 0, 0 filter which means we want all input. 02879 * If inverted message range, filter is exclusive. 02880 */ 02881 #define CheckMsgFilter(wMsg, wMsgFilterMin, wMsgFilterMax) \ 02882 ( ((wMsgFilterMin) == 0 && (wMsgFilterMax) == 0xFFFFFFFF) \ 02883 || ( ((wMsgFilterMin) > (wMsgFilterMax)) \ 02884 ? (((wMsg) < (wMsgFilterMax)) || ((wMsg) > (wMsgFilterMin))) \ 02885 : (((wMsg) >= (wMsgFilterMin)) && ((wMsg) <= (wMsgFilterMax))))) 02886 02887 UINT CalcWakeMask(UINT wMsgFilterMin, UINT wMsgFilterMax, UINT fsWakeMaskFilter); 02888 02889 /* 02890 * GetInputBits 02891 * This function checks if the specified input (fsWakeMask) has arrived (fsChangeBits) 02892 * or it's available (fsWakeBits) 02893 */ 02894 __inline WORD GetInputBits (PCLIENTTHREADINFO pcti, WORD fsWakeMask, BOOL fAvailable) 02895 { 02896 return (pcti->fsChangeBits | (fAvailable ? pcti->fsWakeBits : 0)) & fsWakeMask; 02897 } 02898 02899 02900 typedef struct tagCARET { 02901 struct tagWND *spwnd; 02902 UINT fVisible : 1; 02903 UINT fOn : 1; 02904 int iHideLevel; 02905 int x; 02906 int y; 02907 int cy; 02908 int cx; 02909 HBITMAP hBitmap; 02910 UINT hTimer; 02911 DWORD tid; 02912 } CARET, *PCARET; 02913 02914 /* 02915 * vkey table counts, macros, etc. input synchonized key state tables have 02916 * 2 bits per vkey: fDown, fToggled. Async key state tables have 3 bits: 02917 * fDown, fToggled, fDownSinceLastRead. 02918 * 02919 * Important! The array gafAsyncKeyState matches the bit positions of the 02920 * afKeyState array in each thread info block. The fDownSinceLastRead bit 02921 * for the async state is stored in a separate bit array, called 02922 * gafAsyncKeyStateRecentDown. 02923 * 02924 * It is important that the bit positions of gafAsyncKeyState and 02925 * pti->afKeyState match because we copy from one to the other to maintain 02926 * key state synchronization between threads. 02927 * 02928 * These macros below MUST be used when setting / querying key state. 02929 */ 02930 #define CVKKEYSTATE 256 02931 #define CBKEYSTATE (CVKKEYSTATE >> 2) 02932 #define CBKEYSTATERECENTDOWN (CVKKEYSTATE >> 3) 02933 02934 #define TestKeyDownBit(pb, vk)\ 02935 (pb[vk >> 2] & (1 << ((vk & 3) << 1))) 02936 #define SetKeyDownBit(pb, vk)\ 02937 (pb[vk >> 2] |= (1 << ((vk & 3) << 1))) 02938 #define ClearKeyDownBit(pb, vk)\ 02939 (pb[vk >> 2] &= ~(1 << ((vk & 3) << 1))) 02940 #define TestKeyToggleBit(pb, vk)\ 02941 (pb[vk >> 2] & (1 << (((vk & 3) << 1) + 1))) 02942 #define SetKeyToggleBit(pb, vk)\ 02943 (pb[vk >> 2] |= (1 << (((vk & 3) << 1) + 1))) 02944 #define ClearKeyToggleBit(pb, vk)\ 02945 (pb[vk >> 2] &= ~(1 << (((vk & 3) << 1) + 1))) 02946 #define ToggleKeyToggleBit(pb, vk)\ 02947 (pb[vk >> 2] ^= (1 << (((vk & 3) << 1) + 1))) 02948 #define TestKeyRecentDownBit(pb, vk)\ 02949 (pb[vk >> 3] & (1 << (vk & 7))) 02950 #define SetKeyRecentDownBit(pb, vk)\ 02951 (pb[vk >> 3] |= (1 << (vk & 7))) 02952 #define ClearKeyRecentDownBit(pb, vk)\ 02953 (pb[vk >> 3] &= ~(1 << (vk & 7))) 02954 02955 #define TestKeyStateDown(pq, vk)\ 02956 TestKeyDownBit(pq->afKeyState, vk) 02957 #define SetKeyStateDown(pq, vk)\ 02958 SetKeyDownBit(pq->afKeyState, vk) 02959 #define ClearKeyStateDown(pq, vk)\ 02960 ClearKeyDownBit(pq->afKeyState, vk) 02961 #define TestKeyStateToggle(pq, vk)\ 02962 TestKeyToggleBit(pq->afKeyState, vk) 02963 #define SetKeyStateToggle(pq, vk)\ 02964 SetKeyToggleBit(pq->afKeyState, vk) 02965 #define ClearKeyStateToggle(pq, vk)\ 02966 ClearKeyToggleBit(pq->afKeyState, vk) 02967 02968 #define TestAsyncKeyStateDown(vk)\ 02969 TestKeyDownBit(gafAsyncKeyState, vk) 02970 #define SetAsyncKeyStateDown(vk)\ 02971 SetKeyDownBit(gafAsyncKeyState, vk) 02972 #define ClearAsyncKeyStateDown(vk)\ 02973 ClearKeyDownBit(gafAsyncKeyState, vk) 02974 #define TestAsyncKeyStateToggle(vk)\ 02975 TestKeyToggleBit(gafAsyncKeyState, vk) 02976 #define SetAsyncKeyStateToggle(vk)\ 02977 SetKeyToggleBit(gafAsyncKeyState, vk) 02978 #define ClearAsyncKeyStateToggle(vk)\ 02979 ClearKeyToggleBit(gafAsyncKeyState, vk) 02980 #define TestAsyncKeyStateRecentDown(vk)\ 02981 TestKeyRecentDownBit(gafAsyncKeyStateRecentDown, vk) 02982 #define SetAsyncKeyStateRecentDown(vk)\ 02983 SetKeyRecentDownBit(gafAsyncKeyStateRecentDown, vk) 02984 #define ClearAsyncKeyStateRecentDown(vk)\ 02985 ClearKeyRecentDownBit(gafAsyncKeyStateRecentDown, vk) 02986 02987 02988 #define XPixFromXDU(x, cxChar) MultDiv(x, cxChar, 4) 02989 #define YPixFromYDU(y, cyChar) MultDiv(y, cyChar, 8) 02990 #define XDUFromXPix(x, cxChar) MultDiv(x, 4, cxChar) 02991 #define YDUFromYPix(y, cyChar) MultDiv(y, 8, cyChar) 02992 02993 02994 /* 02995 * Flags for the Q structure. 02996 */ 02997 #define QF_UPDATEKEYSTATE (UINT)0x00001 02998 02999 #define QF_FMENUSTATUSBREAK (UINT)0x00004 03000 #define QF_FMENUSTATUS (UINT)0x00008 03001 #define QF_FF10STATUS (UINT)0x00010 03002 #define QF_MOUSEMOVED (UINT)0x00020 03003 #define QF_ACTIVATIONCHANGE (UINT)0x00040 // This flag is examined in the 03004 // menu loop code so that we 03005 // exit from menu mode if 03006 // another window was activated 03007 // while we were tracking 03008 // menus. This flag is set 03009 // whenever we activate a new 03010 // window. 03011 03012 #define QF_TABSWITCHING (UINT)0x00080 // This bit is used as a 03013 // safety check when alt- 03014 // tabbing between apps. It 03015 // tells us when to expect 03016 // a tab-switch in dwp.c. 03017 03018 #define QF_KEYSTATERESET (UINT)0x00100 03019 #define QF_INDESTROY (UINT)0x00200 03020 #define QF_LOCKNOREMOVE (UINT)0x00400 03021 #define QF_FOCUSNULLSINCEACTIVE (UINT)0x00800 03022 #define QF_DIALOGACTIVE (UINT)0x04000 03023 #define QF_EVENTDEACTIVATEREMOVED (UINT)0x08000 03024 03025 #ifdef OLDTRACKMOUSEEVENT /* Later5.0 GerardoB: Remove this dead code */ 03026 #define QF_TRACKMOUSELEAVE (UINT)0x20000 03027 #define QF_TRACKMOUSEHOVER (UINT)0x40000 03028 #define QF_TRACKMOUSEFIRING (UINT)0x80000 03029 #endif /* OLDTRACKMOUSEEVENT */ 03030 03031 #define QF_CAPTURELOCKED 0x00100000 03032 #define QF_ACTIVEWNDTRACKING 0x00200000 03033 03034 /* 03035 * Constants for Round Frame balloons 03036 */ 03037 #define RNDFRM_CORNER 10 03038 #define RNDFRM_BORDER 3 03039 03040 /* 03041 * Constants for GetRealClientRect 03042 */ 03043 #define GRC_SCROLLS 0x0001 03044 #define GRC_MINWNDS 0x0002 03045 #define GRC_FULLSCREEN 0x0004 03046 03047 /* 03048 * Scroll bar info structure 03049 */ 03050 typedef struct tagSBWND { 03051 WND wnd; 03052 BOOL fVert; 03053 #ifdef COLOR_HOTTRACKING 03054 int ht; 03055 #endif // COLOR_HOTTRACKING 03056 UINT wDisableFlags; /* Indicates which arrow is disabled; */ 03057 SBCALC SBCalc; 03058 } SBWND, *PSBWND, *LPSBWND; 03059 03060 // 03061 // Special regions 03062 // 03063 #define HRGN_EMPTY ((HRGN)0) 03064 #define HRGN_FULL ((HRGN)1) 03065 #define HRGN_MONITOR ((HRGN)2) 03066 #define HRGN_SPECIAL_LAST HRGN_MONITOR 03067 03068 /* 03069 * SendMsgTimeout client/server transition struct 03070 */ 03071 typedef struct tagSNDMSGTIMEOUT { /* smto */ 03072 UINT fuFlags; // how to send the message, SMTO_BLOCK, SMTO_ABORTIFHUNG 03073 UINT uTimeout; // time-out duration 03074 ULONG_PTR lSMTOReturn; // return value TRUE or FALSE 03075 ULONG_PTR lSMTOResult; // result value for lpdwResult 03076 } SNDMSGTIMEOUT, *PSNDMSGTIMEOUT; 03077 03078 /* 03079 * Button data structures (use to be in usercli.h) 03080 */ 03081 typedef struct tagBUTN { 03082 PWND spwnd; 03083 UINT buttonState; // Leave this a word for compatibility with SetWindowWord( 0L ) 03084 HANDLE hFont; 03085 HANDLE hImage; 03086 } BUTN, *PBUTN; 03087 03088 typedef struct tagBUTNWND { 03089 WND wnd; 03090 PBUTN pbutn; 03091 } BUTNWND, *PBUTNWND; 03092 03093 /* 03094 * IME control data structures 03095 */ 03096 typedef struct tagIMEUI { 03097 PWND spwnd; 03098 HIMC hIMC; 03099 HWND hwndIMC; 03100 HKL hKL; 03101 HWND hwndUI; // To keep handle for UI window. 03102 int nCntInIMEProc; // Non-zero if hwnd has called into ImeWndProc. 03103 BOOL fShowStatus:1; // TRUE if don't want to show IME's window. 03104 BOOL fActivate:1; // TRUE if hwnd has called into ImeWndProc. 03105 BOOL fDestroy:1; // TRUE if hwnd has called into ImeWndProc. 03106 BOOL fDefault:1; // TRUE if this is the default IME. 03107 BOOL fChildThreadDef:1; // TRUE if this is the default IME which 03108 // thread has only child window. 03109 } IMEUI, *PIMEUI; 03110 03111 typedef struct tagIMEWND { 03112 WND wnd; 03113 PIMEUI pimeui; 03114 } IMEWND, *PIMEWND; 03115 03116 /* 03117 * SysErrorBox is a 3.1 API that has no 32-bit equivalent. It's 03118 * implemented for WOW in harderr.c. 03119 */ 03120 #define MAX_SEB_STYLES 9 /* number of SEB_* values */ 03121 03122 #define SEB_OK 1 /* Button with "OK". */ 03123 #define SEB_CANCEL 2 /* Button with "Cancel" */ 03124 #define SEB_YES 3 /* Button with "&Yes" */ 03125 #define SEB_NO 4 /* Button with "&No" */ 03126 #define SEB_RETRY 5 /* Button with "&Retry" */ 03127 #define SEB_ABORT 6 /* Button with "&Abort" */ 03128 #define SEB_IGNORE 7 /* Button with "&Ignore" */ 03129 #define SEB_CLOSE 8 /* Button with "&Close" */ 03130 #define SEB_HELP 9 /* Button with "&Help" */ 03131 03132 #define SEB_DEFBUTTON 0x8000 /* Mask to make this button default */ 03133 03134 typedef struct _MSGBOXDATA { // mbd 03135 MSGBOXPARAMS; // Must be 1st item in structure 03136 PWND pwndOwner; // Converted hwndOwner 03137 WORD wLanguageId; 03138 INT * pidButton; // Array of button IDs 03139 LPWSTR * ppszButtonText; // Array of button text strings 03140 UINT cButtons; // Number of buttons 03141 UINT DefButton; 03142 UINT CancelId; 03143 } MSGBOXDATA, *PMSGBOXDATA, *LPMSGBOXDATA; 03144 03145 LPWSTR MB_GetString(UINT wBtn); 03146 int SoftModalMessageBox(LPMSGBOXDATA lpmb); 03147 03148 DWORD GetContextHelpId(PWND pwnd); 03149 03150 PITEM MNLookUpItem(PMENU pMenu, UINT wCmd, BOOL fByPosition, PMENU *ppMenuItemIsOn); 03151 BOOL _MNCanClose(PWND pwnd); 03152 PMENU GetSysMenuHandle(PWND pwnd); 03153 PWND GetPrevPwnd(PWND pwndList, PWND pwndFind); 03154 BOOL _RegisterServicesProcess(DWORD dwProcessId); 03155 03156 #ifdef _USERK_ 03157 #define RTLMENU PMENU 03158 #define xxxRtlSetMenuInfo xxxSetMenuInfo 03159 #define xxxRtlSetMenuItemInfo(rtlMenu, uId, pmii) \ 03160 xxxSetMenuItemInfo(rtlMenu, uId, FALSE, pmii, NULL) 03161 #else 03162 #define RTLMENU HMENU 03163 #define xxxRtlSetMenuInfo NtUserThunkedMenuInfo 03164 #define xxxRtlSetMenuItemInfo(rtlMenu, uId, pmii) \ 03165 NtUserThunkedMenuItemInfo(rtlMenu, uId, FALSE, FALSE, pmii, NULL) 03166 #endif 03167 RTLMENU xxxLoadSysMenu (UINT uMenuId); 03168 03169 03170 BOOL _FChildVisible(PWND pwnd); 03171 03172 #define CH_PREFIX TEXT('&') 03173 // 03174 // Japan support both Kanji and English mnemonic characters, 03175 // toggled from control panel. Both mnemonics are embedded in menu 03176 // resource templates. The following prefixes guide their parsing. 03177 // 03178 #define CH_ENGLISHPREFIX 0x1E 03179 #define CH_KANJIPREFIX 0x1F 03180 03181 03182 BOOL RtlWCSMessageWParamCharToMB(DWORD msg, WPARAM *pWParam); 03183 BOOL RtlMBMessageWParamCharToWCS(DWORD msg, WPARAM *pWParam); 03184 03185 VOID RtlInitLargeAnsiString(PLARGE_ANSI_STRING plstr, LPCSTR psz, 03186 UINT cchLimit); 03187 VOID RtlInitLargeUnicodeString(PLARGE_UNICODE_STRING plstr, LPCWSTR psz, 03188 UINT cchLimit); 03189 03190 DWORD RtlGetExpWinVer(HANDLE hmod); 03191 03192 /***************************************************************************\ 03193 * 03194 * International multi-keyboard layout/font support 03195 * 03196 \***************************************************************************/ 03197 03198 #define DT_CHARSETDRAW 1 03199 #define DT_CHARSETINIT 2 03200 #define DT_CHARSETDONE 3 03201 #define DT_GETNEXTWORD 4 03202 03203 typedef void (FAR *LPFNTEXTDRAW)(HDC, int, int, LPWSTR, int); 03204 03205 typedef struct { 03206 RECT rcFormat; // Format rectangle. 03207 int cxTabLength; // Tab length in pixels. 03208 int iXSign; 03209 int iYSign; 03210 int cyLineHeight; // Height of a line based on DT_EXTERNALLEADING 03211 int cxMaxWidth; // Width of the format rectangle. 03212 int cxMaxExtent; // Width of the longest line drawn. 03213 int cxRightMargin; // Right margin in pixels (with proper sign) 03214 LPFNTEXTDRAW lpfnTextDraw; // pointer to PSTextOut or PSMTextOut based 03215 // on DT_NOPREFIX flag. 03216 int cxOverhang; // Character overhang. 03217 BOOL bCharsetDll; // redirect to intl DLL, not textout 03218 int iCharset; // ANSI charset value 03219 } DRAWTEXTDATA, *LPDRAWTEXTDATA; 03220 03221 typedef LONG (*FPLPKTABBEDTEXTOUT) 03222 (HDC, int, int, LPCWSTR, int, int, LPINT, int, BOOL, int, int, int); 03223 03224 typedef void (*FPLPKPSMTEXTOUT) 03225 (HDC, int, int, LPWSTR, int); 03226 03227 typedef int (*FPLPKDRAWTEXTEX) 03228 (HDC, int, int, LPCWSTR, int, BOOL, UINT, LPDRAWTEXTDATA, UINT, int); 03229 03230 extern FPLPKTABBEDTEXTOUT fpLpkTabbedTextOut; 03231 extern FPLPKPSMTEXTOUT fpLpkPSMTextOut; 03232 extern FPLPKDRAWTEXTEX fpLpkDrawTextEx; 03233 03234 03235 // The number of characters in the ellipsis string (string defined in rtl\drawtext.c). 03236 #define CCHELLIPSIS 3 03237 03238 int DrawTextExWorker(HDC hdc, LPWSTR lpchText, int cchText, LPRECT lprc, 03239 UINT dwDTformat, LPDRAWTEXTPARAMS lpDTparams, int iCharset); 03240 03241 03242 /***************************************************************************\ 03243 * 03244 * Language pack edit control callouts. 03245 * 03246 * Functions are accessed through the pLpkEditCallout pointer in the ED 03247 * structure. pLpkEditCallout points to a structure containing a pointer 03248 * to each callout routine. These are typedef'd here. 03249 * 03250 * (In Windows95 this was achieved through a single function pointer 03251 * - lpfnCharset - which was written in assembler and called from over 30 03252 * places with different parameters. Since for NT the Lpk is written in C, 03253 * the ED structure now points to a list of function pointers, each properly 03254 * typedef'd, improving performance, enabling typechecking and avoiding 03255 * varargs discrepancies between architectures.) 03256 * 03257 \***************************************************************************/ 03258 03259 typedef struct tagED *PED; 03260 03261 typedef BOOL LpkEditCreate (PED ped, HWND hWnd); 03262 03263 typedef int LpkEditIchToXY (PED ped, HDC hDC, PSTR pText, ICH cch, ICH ichPos); 03264 03265 typedef ICH LpkEditMouseToIch (PED ped, HDC hDC, PSTR pText, ICH cch, INT iX); 03266 03267 typedef ICH LpkEditCchInWidth (PED ped, HDC hdc, PSTR pText, ICH cch, int width); 03268 03269 typedef INT LpkEditGetLineWidth (PED ped, HDC hdc, PSTR pText, ICH cch); 03270 03271 typedef void LpkEditDrawText (PED ped, HDC hdc, PSTR pText, INT cch, INT iMinSel, INT iMaxSel, INT iY); 03272 03273 typedef BOOL LpkEditHScroll (PED ped, HDC hdc, PSTR pText); 03274 03275 typedef ICH LpkEditMoveSelection (PED ped, HDC hdc, PSTR pText, ICH ich, BOOL fLeft); 03276 03277 typedef int LpkEditVerifyText (PED ped, HDC hdc, PSTR pText, ICH ichInsert, PSTR pInsertText, ICH cchInsert); 03278 03279 typedef void LpkEditNextWord (PED ped, HDC hdc, PSTR pText, ICH ichStart, BOOL fLeft, ICH *pichMin, ICH *pichMax); 03280 03281 typedef void LpkEditSetMenu (PED ped, HMENU hMenu); 03282 03283 typedef int LpkEditProcessMenu (PED ped, UINT idMenuItem); 03284 03285 typedef int LpkEditCreateCaret (PED ped, HDC hdc, INT nWidth, INT nHeight, UINT hkl); 03286 03287 03288 typedef struct tagLPKEDITCALLOUT { 03289 LpkEditCreate *EditCreate; 03290 LpkEditIchToXY *EditIchToXY; 03291 LpkEditMouseToIch *EditMouseToIch; 03292 LpkEditCchInWidth *EditCchInWidth; 03293 LpkEditGetLineWidth *EditGetLineWidth; 03294 LpkEditDrawText *EditDrawText; 03295 LpkEditHScroll *EditHScroll; 03296 LpkEditMoveSelection *EditMoveSelection; 03297 LpkEditVerifyText *EditVerifyText; 03298 LpkEditNextWord *EditNextWord; 03299 LpkEditSetMenu *EditSetMenu; 03300 LpkEditProcessMenu *EditProcessMenu; 03301 LpkEditCreateCaret *EditCreateCaret; 03302 } LPKEDITCALLOUT, *PLPKEDITCALLOUT; 03303 03304 extern PLPKEDITCALLOUT fpLpkEditControl; 03305 03306 /***************************************************************************\ 03307 * 03308 * Structure for client-side thread-info. 03309 * dwHookCurrent HIWORD is current hook filter type (eg: WH_GETMESSAGE) 03310 * LOWORD is TRUE if current hook is ANSI, FALSE if Unicode 03311 * 03312 \***************************************************************************/ 03313 03314 03315 /* 03316 * Hook thunks. 03317 */ 03318 LRESULT CALLBACK fnHkINLPRECT(DWORD nCode, 03319 WPARAM wParam, LPRECT lParam, 03320 ULONG_PTR xParam, PROC xpfnProc); 03321 LRESULT CALLBACK fnHkINDWORD(DWORD nCode, 03322 WPARAM wParam, LPARAM lParam, 03323 ULONG_PTR xParam, PROC xpfnProc, LPDWORD lpFlags); 03324 LRESULT CALLBACK fnHkINLPMSG(DWORD nCode, 03325 WPARAM wParam, LPMSG lParam, 03326 ULONG_PTR xParam, PROC xpfnProc, BOOL bAnsi, LPDWORD lpFlags); 03327 LRESULT CALLBACK fnHkOPTINLPEVENTMSG(DWORD nCode, 03328 WPARAM wParam, LPEVENTMSGMSG lParam, 03329 ULONG_PTR xParam, PROC xpfnProc); 03330 LRESULT CALLBACK fnHkINLPDEBUGHOOKSTRUCT(DWORD nCode, 03331 WPARAM wParam, LPDEBUGHOOKINFO lParam, 03332 ULONG_PTR xParam, PROC xpfnProc); 03333 LRESULT CALLBACK fnHkINLPMOUSEHOOKSTRUCTEX(DWORD nCode, 03334 WPARAM wParam, LPMOUSEHOOKSTRUCTEX lParam, 03335 ULONG_PTR xParam, PROC xpfnProc, LPDWORD lpFlags); 03336 LRESULT CALLBACK fnHkINLPKBDLLHOOKSTRUCT(DWORD nCode, 03337 WPARAM wParam, LPKBDLLHOOKSTRUCT lParam, 03338 ULONG_PTR xParam, PROC xpfnProc); 03339 LRESULT CALLBACK fnHkINLPMSLLHOOKSTRUCT(DWORD nCode, 03340 WPARAM wParam, LPMSLLHOOKSTRUCT lParam, 03341 ULONG_PTR xParam, PROC xpfnProc); 03342 LRESULT CALLBACK fnHkINLPCBTACTIVATESTRUCT(DWORD nCode, 03343 WPARAM wParam, LPCBTACTIVATESTRUCT lParam, 03344 ULONG_PTR xParam, PROC xpfnProc); 03345 LRESULT CALLBACK fnHkINLPCBTCSTRUCT(UINT msg, 03346 WPARAM wParam, LPCBT_CREATEWND pcbt, 03347 PROC xpfnProc, BOOL bAnsi); 03348 LRESULT CALLBACK fnHkINLPCBTMDICCSTRUCT(UINT msg, 03349 WPARAM wParam, LPCBT_CREATEWND pcbt, 03350 PROC xpfnProc, BOOL bAnsi); 03351 03352 03353 /***************************************************************************\ 03354 * 03355 * Definitions for client/server-specific data referenced by rtl routines. 03356 * 03357 \***************************************************************************/ 03358 03359 extern HBRUSH ahbrSystem[]; 03360 03361 extern HBRUSH ghbrWhite; 03362 extern HBRUSH ghbrBlack; 03363 extern HBRUSH ghbrGray; 03364 03365 03366 DWORD GetCPD(PVOID pWndOrCls, DWORD options, ULONG_PTR dwData); 03367 03368 BOOL TestWindowProcess(PWND pwnd); 03369 DWORD GetAppCompatFlags(PTHREADINFO pti); 03370 PWND _GetDesktopWindow(VOID); 03371 PWND _GetMessageWindow(VOID); 03372 03373 /***************************************************************************\ 03374 * 03375 * Shared function prototypes 03376 * 03377 \***************************************************************************/ 03378 03379 03380 PVOID FASTCALL HMValidateHandle(HANDLE h, BYTE btype); 03381 PVOID FASTCALL HMValidateHandleNoRip(HANDLE h, BYTE btype); 03382 PVOID FASTCALL HMValidateHandleNoDesktop(HANDLE h, BYTE btype); 03383 PVOID FASTCALL HMValidateSharedHandle(HANDLE h, BYTE bType); 03384 03385 PVOID FASTCALL HMValidateHandleNoSecure(HANDLE h, BYTE bType); 03386 03387 ULONG_PTR MapClientNeuterToClientPfn(PCLS pcls, ULONG_PTR dw, BOOL bAnsi); 03388 ULONG_PTR MapServerToClientPfn(ULONG_PTR dw, BOOL bAnsi); 03389 03390 BOOL IsSysFontAndDefaultMode(HDC hdc); 03391 03392 int GetCharDimensions(HDC hDC, TEXTMETRICW *lpTextMetrics, LPINT lpcy); 03393 03394 int GetWindowBorders(LONG lStyle, DWORD dwExStyle, BOOL fWindow, BOOL fClient); 03395 PWND SizeBoxHwnd(PWND pwnd); 03396 VOID _GetClientRect(PWND pwnd, LPRECT prc); 03397 03398 #ifndef _USERSRV_ 03399 void GetRealClientRect(PWND pwnd, LPRECT prc, UINT uFlags, PMONITOR pMonitor); 03400 #endif 03401 03402 VOID _GetWindowRect(PWND pwnd, LPRECT prc); 03403 PWND _GetLastActivePopup(PWND pwnd); 03404 PWND GetTopLevelTiled(PWND pwnd); 03405 BOOL _IsChild(PWND pwndParent, PWND pwnd); 03406 BOOL _AdjustWindowRectEx(LPRECT lprc, LONG style, BOOL fMenu, DWORD dwExStyle); 03407 BOOL NeedsWindowEdge(DWORD dwStyle, DWORD dwExStyle, BOOL fNewApp); 03408 VOID _ClientToScreen(PWND pwnd, PPOINT ppt); 03409 VOID _ScreenToClient(PWND pwnd, PPOINT ppt); 03410 int _MapWindowPoints(PWND pwndFrom, PWND pwndTo, LPPOINT lppt, DWORD cpt); 03411 BOOL _IsWindowVisible(PWND pwnd); 03412 BOOL _IsDescendant(PWND pwndParent, PWND pwndChild); 03413 BOOL IsVisible(PWND pwnd); 03414 PWND _GetWindow(PWND pwnd, UINT cmd); 03415 PWND _GetParent(PWND pwnd); 03416 int FindNCHit(PWND pwnd, LONG lPt); 03417 SHORT _GetKeyState(int vk); 03418 PHOOK PhkNextValid(PHOOK phk); 03419 03420 #define GRECT_CLIENT 0x0001 03421 #define GRECT_WINDOW 0x0002 03422 #define GRECT_RECTMASK 0x0003 03423 03424 #define GRECT_CLIENTCOORDS 0x0010 03425 #define GRECT_WINDOWCOORDS 0x0020 03426 #define GRECT_PARENTCOORDS 0x0040 03427 #define GRECT_COORDMASK 0x0070 03428 03429 void GetRect(PWND pwnd, LPRECT lprc, UINT uCoords); 03430 03431 PPROP _FindProp(PWND pwnd, PCWSTR pszKey, BOOL fInternal); 03432 HANDLE _GetProp(PWND pwnd, PCWSTR pszKey, BOOL fInternal); 03433 BOOL _HasCaptionIcon(PWND pwnd); 03434 PWND GetTopLevelWindow(PWND pwnd); 03435 03436 BOOL _SBGetParms(PWND pwnd, int code, PSBDATA pw, LPSCROLLINFO lpsi); 03437 BOOL PSMGetTextExtent(HDC hdc, LPCWSTR lpstr, int cch, PSIZE psize); 03438 03439 LONG GetPrefixCount(LPCWSTR lpstr, int cb, LPWSTR lpstrCopy, int cbCopy); 03440 PMENU _GetSubMenu(PMENU pMenu, int nPos); 03441 DWORD _GetMenuDefaultItem(PMENU pMenu, BOOL fByPosition, UINT uFlags); 03442 UINT _GetMenuState(PMENU pMenu, UINT wID, UINT dwFlags); 03443 03444 BOOL APIENTRY CopyInflateRect(LPRECT prcDst, CONST RECT *prcSrc, int cx, int cy); 03445 BOOL APIENTRY CopyOffsetRect(LPRECT prcDst, CONST RECT *prcSrc, int cx, int cy); 03446 03447 DWORD FindCharPosition(LPWSTR lpString, WCHAR ch); 03448 LPWSTR TextAlloc(LPCWSTR lpsz); 03449 UINT TextCopy(PLARGE_UNICODE_STRING pstr, LPWSTR lpstr, UINT size); 03450 DWORD wcsncpycch(LPWSTR pwsDest, LPCWSTR pwszSrc, DWORD cch); 03451 DWORD strncpycch(LPSTR pszDest, LPCSTR pszSrc, DWORD cch); 03452 03453 03454 #define TextPointer(h) ((LPWSTR)h) 03455 03456 BOOL DrawFrame(HDC hdc, LPRECT prect, int clFrame, int cmd); 03457 void DrawPushButton(HDC hdc, LPRECT lprc, UINT state, UINT flags); 03458 BOOL ClientFrame(HDC hDC, CONST RECT *pRect, HBRUSH hBrush, DWORD patOp); 03459 03460 HBITMAP OwnerLoadBitmap( 03461 HANDLE hInstLoad, 03462 LPWSTR lpName, 03463 HANDLE hOwner); 03464 03465 PCURSOR ClassSetSmallIcon( 03466 PCLS pcls, 03467 PCURSOR pcursor, 03468 BOOL fServerCreated); 03469 03470 #define DO_DROPFILE 0x454C4946L 03471 03472 /* 03473 * Structure for DoConnect system call. 03474 */ 03475 typedef struct _DOCONNECTDATA { 03476 BOOL fMouse; 03477 BOOL fINetClient; 03478 BOOL fInitialProgram; 03479 BOOL fHideTitleBar; 03480 HANDLE IcaVideoChannel; 03481 HANDLE IcaBeepChannel; 03482 HANDLE IcaMouseChannel; 03483 HANDLE IcaKeyboardChannel; 03484 HANDLE IcaThinwireChannel; 03485 WCHAR WinStationName[32]; 03486 WCHAR ProtocolName[10]; 03487 WCHAR AudioDriverName[10]; 03488 BOOL fClientDoubleClickSupport; 03489 03490 } DOCONNECTDATA, *PDOCONNECTDATA; 03491 03492 /* 03493 * Structure for DoReconnect system call. 03494 */ 03495 typedef struct _DORECONNECTDATA { 03496 BOOL fMouse; 03497 BOOL fINetClient; 03498 WCHAR WinStationName[32]; 03499 BOOL fClientDoubleClickSupport; 03500 } DORECONNECTDATA, *PDORECONNECTDATA; 03501 03502 /* 03503 * EndTask, ExitWindows, hung app, etc time outs 03504 */ 03505 #define CMSSLEEP 250 03506 #define CMSHUNGAPPTIMEOUT (5 * 1000) 03507 #define CMSHUNGTOKILLCOUNT 4 03508 #define CMSWAITTOKILLTIMEOUT (CMSHUNGTOKILLCOUNT * CMSHUNGAPPTIMEOUT) 03509 #define CMSAPPSTARTINGTIMEOUT (3 * CMSHUNGAPPTIMEOUT) /* Must be less than WAITTOKILL. See CheckAppStarting */ 03510 #define CMS_QANIMATION 165 03511 #define CMS_FLASHWND 500 03512 03513 void KernelBP(void); 03514 03515 /* 03516 * Message table definitions 03517 */ 03518 typedef struct tagMSG_TABLE_ENTRY { 03519 BYTE iFunction:6; 03520 BYTE bThunkMessage:1; 03521 BYTE bSyncOnlyMessage:1; 03522 } MSG_TABLE_ENTRY; 03523 03524 extern CONST MSG_TABLE_ENTRY MessageTable[]; 03525 03526 #define TESTSYNCONLYMESSAGE(msg, wParam) (((msg) < WM_USER) ? \ 03527 ( (MessageTable[msg].bSyncOnlyMessage) || \ 03528 (((msg) == WM_DEVICECHANGE) && ((wParam) & 0x8000))) : \ 03529 0) 03530 03531 03532 /* 03533 * Drag and Drop menus. 03534 * MNDragOver output info 03535 */ 03536 typedef struct tagMNDRAGOVERINFO 03537 { 03538 DWORD dwFlags; 03539 HMENU hmenu; 03540 UINT uItemIndex; 03541 HWND hwndNotify; 03542 } MNDRAGOVERINFO, * PMNDRAGOVERINFO; 03543 03544 #ifdef _USERK_ 03545 typedef struct tagMOUSECURSOR { 03546 BYTE bAccelTableLen; 03547 BYTE bAccelTable[128]; 03548 BYTE bConstantTableLen; 03549 BYTE bConstantTable[128]; 03550 } MOUSECURSOR; 03551 #endif 03552 03553 /* 03554 * Equates for the User interface to CSR server for sound output. 03555 * These equates must be kept in sync with lpszUserSounds in ntuser\server\msgbeep.c. 03556 */ 03557 #define USER_SOUND_DEFAULT 0 // default MB sound 03558 #define USER_SOUND_SYSTEMHAND 1 // MB_ICONHAND shifted 03559 #define USER_SOUND_SYSTEMQUESTION 2 // MB_ICONQUESTION shifted 03560 #define USER_SOUND_SYSTEMEXCLAMATION 3 // MB_ICONEXCLAMATION shifted 03561 #define USER_SOUND_SYSTEMASTERISK 4 // MB_ICONASTERISK shifted 03562 #define USER_SOUND_MENUPOPUP 5 03563 #define USER_SOUND_MENUCOMMAND 6 03564 #define USER_SOUND_OPEN 7 03565 #define USER_SOUND_CLOSE 8 03566 #define USER_SOUND_RESTOREUP 9 03567 #define USER_SOUND_RESTOREDOWN 10 03568 #define USER_SOUND_MINIMIZE 11 03569 #define USER_SOUND_MAXIMIZE 12 03570 #define USER_SOUND_MAX 13 03571 03572 #endif // _USER_

Generated on Sat May 15 19:42:12 2004 for test by doxygen 1.3.7