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

userk.h

Go to the documentation of this file.
00001 /*++ BUILD Version: 0015 // Increment this if a change has global effects 00002 00003 /****************************** Module Header ******************************\ 00004 * Module Name: userk.h 00005 * 00006 * Copyright (c) 1985 - 1999, Microsoft Corporation 00007 * 00008 * Typedefs, defines, and prototypes that are used exclusively by the User 00009 * kernel-mode code. 00010 * 00011 * History: 00012 * 04-28-91 DarrinM Created from PROTO.H, MACRO.H, and STRTABLE.H 00013 * 01-25-95 JimA Prepped for kernel-mode 00014 \***************************************************************************/ 00015 00016 #ifndef _USERK_ 00017 #define _USERK_ 00018 00019 #ifndef _WINBASE_ 00020 #include "wbasek.h" 00021 #endif // _WINBASE_ 00022 00023 #include "csrmsg.h" 00024 00025 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) 00026 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) 00027 //BlColor flags 00028 #define BC_INVERT 0x00000001 00029 #define BC_NOMIRROR 0x00000002 00030 #ifdef USE_MIRRORING 00031 #define MIRRORED_HDC(hdc) (GreGetLayout(hdc) & LAYOUT_RTL) 00032 #endif 00033 #define HEBREW_UI_LANGID() (gpsi->UILangID == MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT)) 00034 00035 #define OEMRESOURCE 1 00036 00037 #define CCACHEDCAPTIONS 5 00038 00039 #define RIT_PROCESSINPUT 0x01 00040 #define RIT_STOPINPUT 0x02 00041 00042 #include <winnls.h> 00043 #include <wincon.h> 00044 00045 #include <winuser.h> 00046 #include <winuserp.h> 00047 #include <wowuserp.h> 00048 00049 #include <user.h> 00050 00051 PTHREADINFO _ptiCrit(VOID); 00052 PTHREADINFO _ptiCritShared(VOID); 00053 00054 #if DBG 00055 #define PtiCurrent() _ptiCrit() 00056 #define PtiCurrentShared() _ptiCritShared() 00057 #else // DBG 00058 #define PtiCurrent() (gptiCurrent) 00059 #define PtiCurrentShared() ((PTHREADINFO)(W32GetCurrentThread())) 00060 #endif // DBG 00061 00062 typedef struct tagEVENTHOOK *PEVENTHOOK; 00063 typedef struct tagNOTIFY *PNOTIFY; 00064 00065 #if DEBUGTAGS 00066 void CheckPtiSysPeek(int where, PQ pq, ULONG_PTR newIdSysPeek); 00067 void CheckSysLock(int where, PQ pq, PTHREADINFO pti); 00068 #else // DEBUGTAGS 00069 #define CheckPtiSysPeek(where, pq, newIdSysPeek) 00070 #define CheckSysLock(where, pq, pti) 00071 #endif // DEBUGTAGS 00072 00073 /* 00074 * ShutdownProcessRoutine return values 00075 */ 00076 #define SHUTDOWN_KNOWN_PROCESS 1 00077 #define SHUTDOWN_UNKNOWN_PROCESS 2 00078 #define SHUTDOWN_CANCEL 3 00079 00080 /* 00081 * Macros to get address of current thread and process information. 00082 */ 00083 00084 #define PpiCurrent() \ 00085 ((PPROCESSINFO)(W32GetCurrentProcess())) 00086 00087 #define PtiFromThread(Thread) ((PTHREADINFO)((Thread)->Tcb.Win32Thread)) 00088 00089 #define PpiFromProcess(Process) \ 00090 ((PPROCESSINFO)((PW32PROCESS)(Process)->Win32Process)) 00091 00092 #define GetCurrentProcessId() \ 00093 (PsGetCurrentThread()->Cid.UniqueProcess) 00094 00095 #define ISCSRSS() (PsGetCurrentProcess() == gpepCSRSS) 00096 00097 #define CheckForClientDeath() 00098 00099 00100 NTSTATUS OpenEffectiveToken( 00101 PHANDLE phToken); 00102 00103 NTSTATUS GetProcessLuid( 00104 PETHREAD Thread OPTIONAL, 00105 PLUID LuidProcess); 00106 00107 BOOLEAN IsRestricted( 00108 PETHREAD Thread); 00109 00110 NTSTATUS CreateSystemThread( 00111 PKSTART_ROUTINE lpThreadAddress, 00112 PVOID pvContext, 00113 PHANDLE phThread); 00114 00115 NTSTATUS InitSystemThread( 00116 PUNICODE_STRING pstrThreadName); 00117 00118 PKEVENT CreateKernelEvent( 00119 IN EVENT_TYPE Type, 00120 IN BOOLEAN State); 00121 00122 NTSTATUS ProtectHandle( 00123 IN HANDLE Handle, 00124 IN BOOLEAN Protect); 00125 00126 VOID __inline FreeKernelEvent(PVOID* pp) 00127 { 00128 UserFreePool(*pp); 00129 *pp = NULL; 00130 } 00131 00132 /* 00133 * Object types exported from the kernel. 00134 */ 00135 extern POBJECT_TYPE *ExWindowStationObjectType; 00136 extern POBJECT_TYPE *ExDesktopObjectType; 00137 extern POBJECT_TYPE *ExEventObjectType; 00138 00139 /* 00140 * Private probing macros 00141 */ 00142 00143 #if defined(_X86_) 00144 #define DATAALIGN sizeof(BYTE) 00145 #define CHARALIGN sizeof(BYTE) 00146 #else 00147 #define DATAALIGN sizeof(DWORD) 00148 #define CHARALIGN sizeof(WCHAR) 00149 #endif 00150 00151 #define ProbeForReadBuffer(Address, Count, Alignment) { \ 00152 if ((ULONG)(Count) > (ULONG)(MAXULONG / sizeof(*(Address)))) { \ 00153 ExRaiseAccessViolation(); \ 00154 } \ 00155 ProbeForRead(Address, (ULONG)(Count) * sizeof(*(Address)), Alignment); \ 00156 } 00157 00158 #define ProbeForWriteBuffer(Address, Count, Alignment) { \ 00159 if ((ULONG)(Count) > (ULONG)(MAXULONG / sizeof(*(Address)))) { \ 00160 ExRaiseAccessViolation(); \ 00161 } \ 00162 ProbeForWrite(Address, (ULONG)(Count) * sizeof(*(Address)), Alignment); \ 00163 } 00164 00165 #define ProbeAndReadSize(Address) \ 00166 (((Address) >= (SIZE * const)MM_USER_PROBE_ADDRESS) ? \ 00167 (*(volatile SIZE * const)MM_USER_PROBE_ADDRESS) : (*(volatile SIZE *)(Address))) 00168 00169 #define ProbeAndReadBlendfunction(Address) \ 00170 (((Address) >= (BLENDFUNCTION * const)MM_USER_PROBE_ADDRESS) ? \ 00171 (*(volatile BLENDFUNCTION * const)MM_USER_PROBE_ADDRESS) : (*(volatile BLENDFUNCTION *)(Address))) 00172 00173 //++ 00174 // 00175 // BOOLEAN 00176 // ProbeAndReadPoint( 00177 // IN PPOINT Address 00178 // ) 00179 // 00180 //-- 00181 00182 #define ProbePoint(Address) \ 00183 (((Address) >= (POINT * const)MM_USER_PROBE_ADDRESS) ? \ 00184 (*(volatile DWORD * const)MM_USER_PROBE_ADDRESS) : (*(volatile DWORD *)(Address))) 00185 00186 #define ProbeAndReadPoint(Address) \ 00187 (((Address) >= (POINT * const)MM_USER_PROBE_ADDRESS) ? \ 00188 (*(volatile POINT * const)MM_USER_PROBE_ADDRESS) : (*(volatile POINT *)(Address))) 00189 00190 //++ 00191 // 00192 // BOOLEAN 00193 // ProbeAndReadRect( 00194 // IN PRECT Address 00195 // ) 00196 // 00197 //-- 00198 00199 #define ProbeRect(Address) \ 00200 (((Address) >= (RECT * const)MM_USER_PROBE_ADDRESS) ? \ 00201 (*(volatile DWORD * const)MM_USER_PROBE_ADDRESS) : (*(volatile DWORD *)(Address))) 00202 00203 #define ProbeAndReadRect(Address) \ 00204 (((Address) >= (RECT * const)MM_USER_PROBE_ADDRESS) ? \ 00205 (*(volatile RECT * const)MM_USER_PROBE_ADDRESS) : (*(volatile RECT *)(Address))) 00206 00207 //++ 00208 // 00209 // BOOLEAN 00210 // ProbeAndReadMessage( 00211 // IN PMSG Address 00212 // ) 00213 // 00214 //-- 00215 00216 #define ProbeMessage(Address) \ 00217 (((Address) >= (MSG * const)MM_USER_PROBE_ADDRESS) ? \ 00218 (*(volatile DWORD * const)MM_USER_PROBE_ADDRESS) : (*(volatile DWORD *)(Address))) 00219 00220 #define ProbeAndReadMessage(Address) \ 00221 (((Address) >= (MSG * const)MM_USER_PROBE_ADDRESS) ? \ 00222 (*(volatile MSG * const)MM_USER_PROBE_ADDRESS) : (*(volatile MSG *)(Address))) 00223 00224 //++ 00225 // 00226 // BOOLEAN 00227 // ProbeAndReadLargeString( 00228 // IN PLARGE_STRING Address 00229 // ) 00230 // 00231 //-- 00232 00233 #define ProbeAndReadLargeString(Address) \ 00234 (((Address) >= (LARGE_STRING * const)MM_USER_PROBE_ADDRESS) ? \ 00235 (*(volatile LARGE_STRING * const)MM_USER_PROBE_ADDRESS) : (*(volatile LARGE_STRING *)(Address))) 00236 00237 //++ 00238 // 00239 // BOOLEAN 00240 // ProbeAndReadWindowPlacement( 00241 // IN PWINDOWPLACEMENT Address 00242 // ) 00243 // 00244 //-- 00245 00246 #define ProbeAndReadWindowPlacement(Address) \ 00247 (((Address) >= (WINDOWPLACEMENT * const)MM_USER_PROBE_ADDRESS) ? \ 00248 (*(volatile WINDOWPLACEMENT * const)MM_USER_PROBE_ADDRESS) : (*(volatile WINDOWPLACEMENT *)(Address))) 00249 00250 //++ 00251 // 00252 // BOOLEAN 00253 // ProbeAndReadMenuItem( 00254 // IN PMENUITEMINFO Address 00255 // ) 00256 // 00257 //-- 00258 00259 #define ProbeAndReadMenuItem(Address) \ 00260 (((Address) >= (MENUITEMINFO * const)MM_USER_PROBE_ADDRESS) ? \ 00261 (*(volatile MENUITEMINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile MENUITEMINFO *)(Address))) 00262 00263 //++ 00264 // 00265 // BOOLEAN 00266 // ProbeAndReadMenuInfo( 00267 // IN PMENUINFO Address 00268 // ) 00269 // 00270 //-- 00271 00272 #define ProbeAndReadMenuInfo(Address) \ 00273 (((Address) >= (MENUINFO * const)MM_USER_PROBE_ADDRESS) ? \ 00274 (*(volatile MENUINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile MENUINFO *)(Address))) 00275 00276 //++ 00277 // 00278 // BOOLEAN 00279 // ProbeAndReadScrollInfo( 00280 // IN PSCROLLINFO Address 00281 // ) 00282 // 00283 //-- 00284 00285 #define ProbeAndReadScrollInfo(Address) \ 00286 (((Address) >= (SCROLLINFO * const)MM_USER_PROBE_ADDRESS) ? \ 00287 (*(volatile SCROLLINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile SCROLLINFO *)(Address))) 00288 00289 //++ 00290 // 00291 // BOOLEAN 00292 // ProbeAndReadPopupParams( 00293 // IN PTPMPARAMS Address 00294 // ) 00295 // 00296 //-- 00297 00298 #define ProbeAndReadPopupParams(Address) \ 00299 (((Address) >= (TPMPARAMS * const)MM_USER_PROBE_ADDRESS) ? \ 00300 (*(volatile TPMPARAMS * const)MM_USER_PROBE_ADDRESS) : (*(volatile TPMPARAMS *)(Address))) 00301 00302 //++ 00303 // 00304 // BOOLEAN 00305 // ProbeAndReadPaintStruct( 00306 // IN PPAINTSTRUCT Address 00307 // ) 00308 // 00309 //-- 00310 00311 #define ProbeAndReadPaintStruct(Address) \ 00312 (((Address) >= (PAINTSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00313 (*(volatile PAINTSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile PAINTSTRUCT *)(Address))) 00314 00315 //++ 00316 // 00317 // BOOLEAN 00318 // ProbeAndReadCreateStruct( 00319 // IN PCREATESTRUCTW Address 00320 // ) 00321 // 00322 //-- 00323 00324 #define ProbeAndReadCreateStruct(Address) \ 00325 (((Address) >= (CREATESTRUCTW * const)MM_USER_PROBE_ADDRESS) ? \ 00326 (*(volatile CREATESTRUCTW * const)MM_USER_PROBE_ADDRESS) : (*(volatile CREATESTRUCTW *)(Address))) 00327 00328 //++ 00329 // 00330 // BOOLEAN 00331 // ProbeAndReadMDICreateStruct( 00332 // IN PMDICREATESTRUCT Address 00333 // ) 00334 // 00335 //-- 00336 00337 #define ProbeAndReadMDICreateStruct(Address) \ 00338 (((Address) >= (MDICREATESTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00339 (*(volatile MDICREATESTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile MDICREATESTRUCT *)(Address))) 00340 00341 //++ 00342 // 00343 // BOOLEAN 00344 // ProbeAndReadCopyDataStruct( 00345 // IN PCOPYDATASTRUCT Address 00346 // ) 00347 // 00348 //-- 00349 00350 #define ProbeAndReadCopyDataStruct(Address) \ 00351 (((Address) >= (COPYDATASTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00352 (*(volatile COPYDATASTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile COPYDATASTRUCT *)(Address))) 00353 00354 //++ 00355 // 00356 // BOOLEAN 00357 // ProbeAndReadCompareItemStruct( 00358 // IN PCOMPAREITEMSTRUCT Address 00359 // ) 00360 // 00361 //-- 00362 00363 #define ProbeAndReadCompareItemStruct(Address) \ 00364 (((Address) >= (COMPAREITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00365 (*(volatile COMPAREITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile COMPAREITEMSTRUCT *)(Address))) 00366 00367 //++ 00368 // 00369 // BOOLEAN 00370 // ProbeAndReadDeleteItemStruct( 00371 // IN PDELETEITEMSTRUCT Address 00372 // ) 00373 // 00374 //-- 00375 00376 #define ProbeAndReadDeleteItemStruct(Address) \ 00377 (((Address) >= (DELETEITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00378 (*(volatile DELETEITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile DELETEITEMSTRUCT *)(Address))) 00379 00380 //++ 00381 // 00382 // BOOLEAN 00383 // ProbeAndReadHelp( 00384 // IN PHLP Address 00385 // ) 00386 // 00387 //-- 00388 00389 #define ProbeAndReadHelp(Address) \ 00390 (((Address) >= (HLP * const)MM_USER_PROBE_ADDRESS) ? \ 00391 (*(volatile HLP * const)MM_USER_PROBE_ADDRESS) : (*(volatile HLP *)(Address))) 00392 00393 //++ 00394 // 00395 // BOOLEAN 00396 // ProbeAndReadHelpInfo( 00397 // IN PHELPINFO Address 00398 // ) 00399 // 00400 //-- 00401 00402 #define ProbeAndReadHelpInfo(Address) \ 00403 (((Address) >= (HELPINFO * const)MM_USER_PROBE_ADDRESS) ? \ 00404 (*(volatile HELPINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile HELPINFO *)(Address))) 00405 00406 //++ 00407 // 00408 // BOOLEAN 00409 // ProbeAndReadDrawItemStruct( 00410 // IN PDRAWITEMSTRUCT Address 00411 // ) 00412 // 00413 //-- 00414 00415 #define ProbeAndReadDrawItemStruct(Address) \ 00416 (((Address) >= (DRAWITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00417 (*(volatile DRAWITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile DRAWITEMSTRUCT *)(Address))) 00418 00419 //++ 00420 // 00421 // BOOLEAN 00422 // ProbeAndReadHookInfo( 00423 // IN PDEBUGHOOKINFO Address 00424 // ) 00425 // 00426 //-- 00427 00428 #define ProbeAndReadHookInfo(Address) \ 00429 (((Address) >= (DEBUGHOOKINFO * const)MM_USER_PROBE_ADDRESS) ? \ 00430 (*(volatile DEBUGHOOKINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile DEBUGHOOKINFO *)(Address))) 00431 00432 //++ 00433 // 00434 // BOOLEAN 00435 // ProbeAndReadCBTActivateStruct( 00436 // IN PCBTACTIVATESTRUCT Address 00437 // ) 00438 // 00439 //-- 00440 00441 #define ProbeAndReadCBTActivateStruct(Address) \ 00442 (((Address) >= (CBTACTIVATESTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00443 (*(volatile CBTACTIVATESTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile CBTACTIVATESTRUCT *)(Address))) 00444 00445 //++ 00446 // 00447 // BOOLEAN 00448 // ProbeAndReadKbdHook( 00449 // IN PKBDHOOKSTRUCT Address 00450 // ) 00451 // 00452 //-- 00453 00454 #define ProbeAndReadKbdHook(Address) \ 00455 (((Address) >= (KBDLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00456 (*(volatile KBDLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile KBDLLHOOKSTRUCT *)(Address))) 00457 //++ 00458 // 00459 // BOOLEAN 00460 // ProbeAndReadMsllHook( 00461 // IN PMSLLHOOKSTRUCT Address 00462 // ) 00463 // 00464 //-- 00465 00466 #define ProbeAndReadMsllHook(Address) \ 00467 (((Address) >= (MSLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00468 (*(volatile MSLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile MSLLHOOKSTRUCT *)(Address))) 00469 00470 //++ 00471 // 00472 // BOOLEAN 00473 // ProbeAndReadMouseHook( 00474 // IN PMOUSEHOOKSTRUCTEX Address 00475 // ) 00476 // 00477 //-- 00478 00479 #define ProbeAndReadMouseHook(Address) \ 00480 (((Address) >= (MOUSEHOOKSTRUCTEX * const)MM_USER_PROBE_ADDRESS) ? \ 00481 (*(volatile MOUSEHOOKSTRUCTEX * const)MM_USER_PROBE_ADDRESS) : (*(volatile MOUSEHOOKSTRUCTEX *)(Address))) 00482 00483 00484 #ifdef REDIRECTION 00485 00486 //++ 00487 // 00488 // BOOLEAN 00489 // ProbeAndReadHTHook( 00490 // IN PHTHOOKSTRUCT Address 00491 // ) 00492 // 00493 //-- 00494 00495 #define ProbeAndReadHTHook(Address) \ 00496 (((Address) >= (HTHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ 00497 (*(volatile HTHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile HTHOOKSTRUCT *)(Address))) 00498 00499 #endif // REDIRECTION 00500 00501 //++ 00502 // 00503 // BOOLEAN 00504 // ProbeAndReadCBTCreateStruct( 00505 // IN PCBT_CREATEWND Address 00506 // ) 00507 // 00508 //-- 00509 00510 #define ProbeAndReadCBTCreateStruct(Address) \ 00511 (((Address) >= (CBT_CREATEWND * const)MM_USER_PROBE_ADDRESS) ? \ 00512 (*(volatile CBT_CREATEWND * const)MM_USER_PROBE_ADDRESS) : (*(volatile CBT_CREATEWND *)(Address))) 00513 00514 //++ 00515 // 00516 // BOOLEAN 00517 // ProbeAndReadTrackMouseEvent( 00518 // IN LPTRACKMOUSEEVENT Address 00519 // ) 00520 // 00521 //-- 00522 00523 #define ProbeAndReadTrackMouseEvent(Address) \ 00524 (((Address) >= (TRACKMOUSEEVENT * const)MM_USER_PROBE_ADDRESS) ? \ 00525 (*(volatile TRACKMOUSEEVENT * const)MM_USER_PROBE_ADDRESS) : (*(volatile TRACKMOUSEEVENT *)(Address))) 00526 00527 //++ 00528 // 00529 // BOOLEAN 00530 // ProbeAndReadWindowPos( 00531 // IN PWINDOWPOS Address 00532 // ) 00533 // 00534 //-- 00535 00536 #define ProbeAndReadWindowPos(Address) \ 00537 (((Address) >= (WINDOWPOS * const)MM_USER_PROBE_ADDRESS) ? \ 00538 (*(volatile WINDOWPOS * const)MM_USER_PROBE_ADDRESS) : (*(volatile WINDOWPOS *)(Address))) 00539 00540 //++ 00541 // 00542 // BOOLEAN 00543 // ProbeAndReadCursorFind( 00544 // IN PCURSORFIND Address 00545 // ) 00546 // 00547 //-- 00548 00549 #define ProbeAndReadCursorFind(Address) \ 00550 (((Address) >= (CURSORFIND * const)MM_USER_PROBE_ADDRESS) ? \ 00551 (*(volatile CURSORFIND * const)MM_USER_PROBE_ADDRESS) : (*(volatile CURSORFIND *)(Address))) 00552 00553 //++ 00554 // 00555 // BOOLEAN 00556 // ProbeAndReadSetClipBData( 00557 // IN PSETCLIPBDATA Address 00558 // ) 00559 // 00560 //-- 00561 00562 #define ProbeAndReadSetClipBData(Address) \ 00563 (((Address) >= (SETCLIPBDATA * const)MM_USER_PROBE_ADDRESS) ? \ 00564 (*(volatile SETCLIPBDATA * const)MM_USER_PROBE_ADDRESS) : (*(volatile SETCLIPBDATA *)(Address))) 00565 00566 //++ 00567 // 00568 // BOOLEAN 00569 // ProbeAndReadBroadcastSystemMsgParams( 00570 // IN LPBROADCASTSYSTEMMSGPARAMS Address 00571 // ) 00572 // 00573 //-- 00574 00575 #define ProbeAndReadBroadcastSystemMsgParams(Address) \ 00576 (((Address) >= (BROADCASTSYSTEMMSGPARAMS * const)MM_USER_PROBE_ADDRESS) ? \ 00577 (*(volatile BROADCASTSYSTEMMSGPARAMS * const)MM_USER_PROBE_ADDRESS) : (*(volatile BROADCASTSYSTEMMSGPARAMS *)(Address))) 00578 00579 //++ 00580 // 00581 // BOOLEAN 00582 // ProbeAndReadCursorData( 00583 // IN PCURSORDATA Address 00584 // ) 00585 // 00586 //-- 00587 00588 #define ProbeAndReadCursorData(Address) \ 00589 (((Address) >= (CURSORDATA * const)MM_USER_PROBE_ADDRESS) ? \ 00590 (*(volatile CURSORDATA * const)MM_USER_PROBE_ADDRESS) : (*(volatile CURSORDATA *)(Address))) 00591 00592 //++ 00593 // 00594 // BOOLEAN 00595 // ProbeForReadUnicodeStringBuffer( 00596 // IN UNICODE_STRING String 00597 // ) 00598 // 00599 //-- 00600 00601 #if defined(_X86_) 00602 #define ProbeForReadUnicodeStringBuffer(String) \ 00603 if (((ULONG_PTR)((String).Buffer) & (sizeof(BYTE) - 1)) != 0) { \ 00604 ExRaiseDatatypeMisalignment(); \ 00605 } else if ((((ULONG_PTR)((String).Buffer) + ((String).Length) + sizeof(UNICODE_NULL)) < (ULONG_PTR)((String).Buffer)) || \ 00606 (((ULONG_PTR)((String).Buffer) + ((String).Length) + sizeof(UNICODE_NULL)) > (ULONG_PTR)MM_USER_PROBE_ADDRESS)) { \ 00607 ExRaiseAccessViolation(); \ 00608 } else if (((String).Length) > ((String).MaximumLength)) { \ 00609 ExRaiseAccessViolation(); \ 00610 } 00611 #else 00612 #define ProbeForReadUnicodeStringBuffer(String) \ 00613 if (((ULONG_PTR)((String).Buffer) & (sizeof(WCHAR) - 1)) != 0) { \ 00614 ExRaiseDatatypeMisalignment(); \ 00615 } else if ((((ULONG_PTR)((String).Buffer) + ((String).Length) + sizeof(UNICODE_NULL)) < (ULONG_PTR)((String).Buffer)) || \ 00616 (((ULONG_PTR)((String).Buffer) + ((String).Length) + sizeof(UNICODE_NULL)) > (ULONG_PTR)MM_USER_PROBE_ADDRESS)) { \ 00617 ExRaiseAccessViolation(); \ 00618 } else if (((String).Length) > ((String).MaximumLength)) { \ 00619 ExRaiseAccessViolation(); \ 00620 } 00621 #endif 00622 00623 #if defined(_X86_) 00624 #define ProbeForReadUnicodeStringFullBuffer(String) \ 00625 if (((ULONG_PTR)((String).Buffer) & (sizeof(BYTE) - 1)) != 0) { \ 00626 ExRaiseDatatypeMisalignment(); \ 00627 } else if ((((ULONG_PTR)((String).Buffer) + ((String).MaximumLength)) < (ULONG_PTR)((String).Buffer)) || \ 00628 (((ULONG_PTR)((String).Buffer) + ((String).MaximumLength)) > (ULONG_PTR)MM_USER_PROBE_ADDRESS)) { \ 00629 ExRaiseAccessViolation(); \ 00630 } else if (((String).Length) > ((String).MaximumLength)) { \ 00631 ExRaiseAccessViolation(); \ 00632 } 00633 #else 00634 #define ProbeForReadUnicodeStringFullBuffer(String) \ 00635 if (((ULONG_PTR)((String).Buffer) & (sizeof(WCHAR) - 1)) != 0) { \ 00636 ExRaiseDatatypeMisalignment(); \ 00637 } else if ((((ULONG_PTR)((String).Buffer) + ((String).MaximumLength)) < (ULONG_PTR)((String).Buffer)) || \ 00638 (((ULONG_PTR)((String).Buffer) + ((String).MaximumLength)) > (ULONG_PTR)MM_USER_PROBE_ADDRESS)) { \ 00639 ExRaiseAccessViolation(); \ 00640 } else if (((String).Length) > ((String).MaximumLength)) { \ 00641 ExRaiseAccessViolation(); \ 00642 } 00643 #endif 00644 00645 //++ 00646 // 00647 // BOOLEAN 00648 // ProbeForReadUnicodeStringBufferOrId( 00649 // IN UNICODE_STRING String 00650 // ) 00651 // 00652 //-- 00653 00654 #define ProbeForReadUnicodeStringBufferOrId(String) \ 00655 if (IS_PTR((String).Buffer)) { \ 00656 ProbeForReadUnicodeStringBuffer(String); \ 00657 } 00658 00659 //++ 00660 // 00661 // BOOLEAN 00662 // ProbeAndReadCandidateForm( 00663 // IN PCANDIDATEFORM Address 00664 // ) 00665 // 00666 //-- 00667 00668 #define ProbeAndReadCandidateForm(Address) \ 00669 (((Address) >= (CANDIDATEFORM * const)MM_USER_PROBE_ADDRESS) ? \ 00670 (*(volatile CANDIDATEFORM * const)MM_USER_PROBE_ADDRESS) : (*(volatile CANDIDATEFORM *)(Address))) 00671 00672 //++ 00673 // 00674 // BOOLEAN 00675 // ProbeAndReadCompositionForm( 00676 // IN PCANDIDATEFORM Address 00677 // ) 00678 // 00679 //-- 00680 00681 #define ProbeAndReadCompositionForm(Address) \ 00682 (((Address) >= (COMPOSITIONFORM * const)MM_USER_PROBE_ADDRESS) ? \ 00683 (*(volatile COMPOSITIONFORM * const)MM_USER_PROBE_ADDRESS) : (*(volatile COMPOSITIONFORM *)(Address))) 00684 00685 //++ 00686 // 00687 // BOOLEAN 00688 // ProbeAndReadLogFontW( 00689 // IN PLOGFONTA Address 00690 // ) 00691 // 00692 //-- 00693 00694 #define ProbeAndReadLogFontW(Address) \ 00695 (((Address) >= (LOGFONTW * const)MM_USER_PROBE_ADDRESS) ? \ 00696 (*(volatile LOGFONTW * const)MM_USER_PROBE_ADDRESS) : (*(volatile LOGFONTW *)(Address))) 00697 00698 00699 //++ 00700 // 00701 // VOID 00702 // ProbeForWritePoint( 00703 // IN PPOINT Address 00704 // ) 00705 // 00706 //-- 00707 00708 #define ProbeForWritePoint(Address) { \ 00709 if ((Address) >= (POINT * const)MM_USER_PROBE_ADDRESS) { \ 00710 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00711 } \ 00712 \ 00713 *(volatile POINT *)(Address) = *(volatile POINT *)(Address); \ 00714 } 00715 00716 //++ 00717 // 00718 // VOID 00719 // ProbeForWriteRect( 00720 // IN PRECT Address 00721 // ) 00722 // 00723 //-- 00724 00725 #define ProbeForWriteRect(Address) { \ 00726 if ((Address) >= (RECT * const)MM_USER_PROBE_ADDRESS) { \ 00727 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00728 } \ 00729 \ 00730 *(volatile RECT *)(Address) = *(volatile RECT *)(Address); \ 00731 } 00732 00733 //++ 00734 // 00735 // VOID 00736 // ProbeForWriteMessage( 00737 // IN PMSG Address 00738 // ) 00739 // 00740 //-- 00741 00742 #define ProbeForWriteMessage(Address) { \ 00743 if ((Address) >= (MSG * const)MM_USER_PROBE_ADDRESS) { \ 00744 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00745 } \ 00746 \ 00747 *(volatile MSG *)(Address) = *(volatile MSG *)(Address); \ 00748 } 00749 00750 //++ 00751 // 00752 // VOID 00753 // ProbeForWritePaintStruct( 00754 // IN PPAINTSTRUCT Address 00755 // ) 00756 // 00757 //-- 00758 00759 #define ProbeForWritePaintStruct(Address) { \ 00760 if ((Address) >= (PAINTSTRUCT * const)MM_USER_PROBE_ADDRESS) { \ 00761 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00762 } \ 00763 \ 00764 *(volatile PAINTSTRUCT *)(Address) = *(volatile PAINTSTRUCT *)(Address); \ 00765 } 00766 00767 //++ 00768 // 00769 // VOID 00770 // ProbeForWriteDropStruct( 00771 // IN PDROPSTRUCT Address 00772 // ) 00773 // 00774 //-- 00775 00776 #define ProbeForWriteDropStruct(Address) { \ 00777 if ((Address) >= (DROPSTRUCT * const)MM_USER_PROBE_ADDRESS) { \ 00778 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00779 } \ 00780 \ 00781 *(volatile DROPSTRUCT *)(Address) = *(volatile DROPSTRUCT *)(Address); \ 00782 } 00783 00784 //++ 00785 // 00786 // VOID 00787 // ProbeForWriteScrollInfo( 00788 // IN PSCROLLINFO Address 00789 // ) 00790 // 00791 //-- 00792 00793 #define ProbeForWriteScrollInfo(Address) { \ 00794 if ((Address) >= (SCROLLINFO * const)MM_USER_PROBE_ADDRESS) { \ 00795 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00796 } \ 00797 \ 00798 *(volatile SCROLLINFO *)(Address) = *(volatile SCROLLINFO *)(Address); \ 00799 } 00800 00801 //++ 00802 // 00803 // VOID 00804 // ProbeForWriteStyleStruct( 00805 // IN PSTYLESTRUCT Address 00806 // ) 00807 // 00808 //-- 00809 00810 #define ProbeForWriteStyleStruct(Address) { \ 00811 if ((Address) >= (STYLESTRUCT * const)MM_USER_PROBE_ADDRESS) { \ 00812 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00813 } \ 00814 \ 00815 *(volatile STYLESTRUCT *)(Address) = *(volatile STYLESTRUCT *)(Address); \ 00816 } 00817 00818 //++ 00819 // 00820 // VOID 00821 // ProbeForWriteMeasureItemStruct( 00822 // IN PMEASUREITEMSTRUCT Address 00823 // ) 00824 // 00825 //-- 00826 00827 #define ProbeForWriteMeasureItemStruct(Address) { \ 00828 if ((Address) >= (MEASUREITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) { \ 00829 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00830 } \ 00831 \ 00832 *(volatile MEASUREITEMSTRUCT *)(Address) = *(volatile MEASUREITEMSTRUCT *)(Address);\ 00833 } 00834 00835 //++ 00836 // 00837 // VOID 00838 // ProbeForWriteCreateStruct( 00839 // IN PCREATESTRUCTW Address 00840 // ) 00841 // 00842 //-- 00843 00844 #define ProbeForWriteCreateStruct(Address) { \ 00845 if ((Address) >= (CREATESTRUCTW * const)MM_USER_PROBE_ADDRESS) { \ 00846 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00847 } \ 00848 \ 00849 *(volatile CREATESTRUCTW *)(Address) = *(volatile CREATESTRUCTW *)(Address);\ 00850 } 00851 00852 //++ 00853 // 00854 // VOID 00855 // ProbeForWriteEvent( 00856 // IN PEVENTMSGMSG Address 00857 // ) 00858 // 00859 //-- 00860 00861 #define ProbeForWriteEvent(Address) { \ 00862 if ((Address) >= (EVENTMSG * const)MM_USER_PROBE_ADDRESS) { \ 00863 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00864 } \ 00865 \ 00866 *(volatile EVENTMSG *)(Address) = *(volatile EVENTMSG *)(Address); \ 00867 } 00868 00869 //++ 00870 // 00871 // VOID 00872 // ProbeForWriteWindowPlacement( 00873 // IN PWINDOWPLACEMENT Address 00874 // ) 00875 // 00876 //-- 00877 00878 #define ProbeForWriteWindowPlacement(Address) { \ 00879 if ((Address) >= (WINDOWPLACEMENT * const)MM_USER_PROBE_ADDRESS) { \ 00880 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00881 } \ 00882 \ 00883 *(volatile WINDOWPLACEMENT *)(Address) = *(volatile WINDOWPLACEMENT *)(Address);\ 00884 } 00885 00886 //++ 00887 // 00888 // VOID 00889 // ProbeForWriteGetClipData( 00890 // IN PGETCLIPBDATA Address 00891 // ) 00892 // 00893 //-- 00894 00895 #define ProbeForWriteGetClipData(Address) { \ 00896 if ((Address) >= (GETCLIPBDATA * const)MM_USER_PROBE_ADDRESS) { \ 00897 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00898 } \ 00899 \ 00900 *(volatile GETCLIPBDATA *)(Address) = *(volatile GETCLIPBDATA *)(Address);\ 00901 } 00902 00903 //++ 00904 // 00905 // VOID 00906 // ProbeForWriteMDINextMenu( 00907 // IN PMDINEXTMENU Address 00908 // ) 00909 // 00910 //-- 00911 00912 #define ProbeForWriteMDINextMenu(Address) { \ 00913 if ((Address) >= (MDINEXTMENU * const)MM_USER_PROBE_ADDRESS) { \ 00914 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00915 } \ 00916 \ 00917 *(volatile MDINEXTMENU *)(Address) = *(volatile MDINEXTMENU *)(Address); \ 00918 } 00919 00920 //++ 00921 // 00922 // VOID 00923 // ProbeForWritePoint5( 00924 // IN PPOINT5 Address 00925 // ) 00926 // 00927 //-- 00928 00929 #define ProbeForWritePoint5(Address) { \ 00930 if ((Address) >= (POINT5 * const)MM_USER_PROBE_ADDRESS) { \ 00931 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00932 } \ 00933 \ 00934 *(volatile POINT5 *)(Address) = *(volatile POINT5 *)(Address);\ 00935 } 00936 00937 //++ 00938 // 00939 // VOID 00940 // ProbeForWriteNCCalcSize( 00941 // IN PNCCALCSIZE_PARAMS Address 00942 // ) 00943 // 00944 //-- 00945 00946 #define ProbeForWriteNCCalcSize(Address) { \ 00947 if ((Address) >= (NCCALCSIZE_PARAMS * const)MM_USER_PROBE_ADDRESS) { \ 00948 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00949 } \ 00950 \ 00951 *(volatile NCCALCSIZE_PARAMS *)(Address) = *(volatile NCCALCSIZE_PARAMS *)(Address);\ 00952 } 00953 00954 //++ 00955 // 00956 // VOID 00957 // ProbeForWriteWindowPos( 00958 // IN PWINDOWPOS Address 00959 // ) 00960 // 00961 //-- 00962 00963 #define ProbeForWriteWindowPos(Address) { \ 00964 if ((Address) >= (WINDOWPOS * const)MM_USER_PROBE_ADDRESS) { \ 00965 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00966 } \ 00967 \ 00968 *(volatile WINDOWPOS *)(Address) = *(volatile WINDOWPOS *)(Address);\ 00969 } 00970 00971 00972 //++ 00973 // 00974 // VOID 00975 // ProbeForWriteCandidateForm( 00976 // IN PCANDIDATEFORM Address 00977 // ) 00978 // 00979 //-- 00980 00981 #define ProbeForWriteCandidateForm(Address) { \ 00982 if ((Address) >= (CANDIDATEFORM * const)MM_USER_PROBE_ADDRESS) { \ 00983 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 00984 } \ 00985 \ 00986 *(volatile CANDIDATEFORM *)(Address) = *(volatile CANDIDATEFORM *)(Address); \ 00987 } 00988 00989 //++ 00990 // 00991 // VOID 00992 // ProbeForWriteCompositionForm( 00993 // IN PCOMPOSITIONFORM Address 00994 // ) 00995 // 00996 //-- 00997 00998 #define ProbeForWriteCompositionForm(Address) { \ 00999 if ((Address) >= (COMPOSITIONFORM * const)MM_USER_PROBE_ADDRESS) { \ 01000 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 01001 } \ 01002 \ 01003 *(volatile COMPOSITIONFORM *)(Address) = *(volatile COMPOSITIONFORM *)(Address);\ 01004 } 01005 01006 //++ 01007 // 01008 // VOID 01009 // ProbeForWriteLogFontW( 01010 // IN PLOGFONTW Address 01011 // ) 01012 // 01013 //-- 01014 01015 #define ProbeForWriteLogFontW(Address) { \ 01016 if ((Address) >= (LOGFONTW * const)MM_USER_PROBE_ADDRESS) { \ 01017 *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ 01018 } \ 01019 \ 01020 *(volatile LOGFONTW *)(Address) = *(volatile LOGFONTW *)(Address); \ 01021 } 01022 01023 //++ 01024 // 01025 // VOID 01026 // ProbeForWriteReconvertString(IN PRECONVERTSTRING Address) 01027 // 01028 //-- 01029 01030 #define ProbeForWriteReconvertString(Address) { \ 01031 if ((Address) >= (RECONVERTSTRING* const)MM_USER_PROBE_ADDRESS) { \ 01032 *(volatile ULONG* const)MM_USER_PROBE_ADDRESS = 0; \ 01033 } \ 01034 \ 01035 *(volatile RECONVERTSTRING*)(Address) = *(volatile RECONVERTSTRING*)(Address); \ 01036 *((volatile BYTE*)(Address) + (Address)->dwSize) = *((volatile BYTE*)(Address) + (Address)->dwSize); \ 01037 } 01038 01039 #define ProbeForReadReconvertString(pReconv) \ 01040 ProbeForRead((pReconv), (pReconv)->dwSize, 1) 01041 01042 01043 //++ 01044 // 01045 // VOID 01046 // ProbeForWriteImeCharPosition(IN LPPrivateIMECHARPOSITION Address) 01047 // 01048 //-- 01049 01050 #define ProbeForWriteImeCharPosition(Address) { \ 01051 if ((Address) >= (PrivateIMECHARPOSITION* const)MM_USER_PROBE_ADDRESS) { \ 01052 *(volatile ULONG* const)MM_USER_PROBE_ADDRESS = 0; \ 01053 } \ 01054 \ 01055 *(volatile PrivateIMECHARPOSITION*)(Address) = *(volatile PrivateIMECHARPOSITION*)(Address); \ 01056 } 01057 01058 01059 01060 //++ 01061 // 01062 // VOID 01063 // ProbeAndReadMenuGetObjectInfo( 01064 // IN PMENUGETOBJECTINFO Address 01065 // ) 01066 // 01067 //-- 01068 01069 #define ProbeAndReadMenuGetObjectInfo(Address) \ 01070 (((Address) >= (MENUGETOBJECTINFO * const)MM_USER_PROBE_ADDRESS) ? \ 01071 (*(volatile MENUGETOBJECTINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile MENUGETOBJECTINFO *)(Address))) 01072 01073 01074 /* 01075 * This macro makes sure an object is thread locked. DEBUG only. 01076 */ 01077 #if DBG 01078 VOID CheckLock(PVOID pobj); 01079 #else // DBG 01080 #define CheckLock(p) 01081 #endif // DBG 01082 01083 /* 01084 * Debug macros 01085 */ 01086 #if DBG 01087 01088 #define TRACE_INIT(str) { if (TraceInitialization > 0) { KdPrint(str); }} 01089 #define TRACE_SWITCH(str) { if (TraceFullscreenSwitch > 0) { KdPrint(str); }} 01090 01091 extern PCSZ apszSimpleCallNames[]; 01092 01093 #define TRACE(s) TAGMSG2(DBGTAG_StubReturn, "%s, retval = %x", (s), retval) 01094 #define TRACEVOID(s) TAGMSG1(DBGTAG_StubReturn, "%s", (s)) 01095 01096 #define TRACETHUNK(t) \ 01097 TAGMSG3(DBGTAG_StubThunk, \ 01098 "Thunk %s, %s(%s)", \ 01099 (t), \ 01100 (xpfnProc >= FNID_START && xpfnProc <= FNID_END ? \ 01101 gapszFNID[xpfnProc - FNID_START] : "Unknown"), \ 01102 (msg >= WM_USER ? "WM_USER" : gapszMessage[msg])) 01103 01104 #define TRACECALLBACK(s) TAGMSG2(DBGTAG_StubCallback, "%s, retval = %x", (s), retval) 01105 01106 #define TRACECALLBACKMSG(s) \ 01107 TAGMSG4(DBGTAG_StubCallback, \ 01108 "Callback %s, %s(%s), retval = %x", \ 01109 (s), \ 01110 (xpfnProc >= (PROC)FNID_START && xpfnProc <= (PROC)FNID_END ? \ 01111 gapszFNID[(ULONG_PTR)xpfnProc - FNID_START] : "Unknown"), \ 01112 (msg >= WM_USER ? "WM_USER" : gapszMessage[msg]), \ 01113 retval) 01114 #else // DBG 01115 01116 #define TRACE_INIT(str) {} 01117 #define TRACE_SWITCH(str) {} 01118 #define TRACE(s) 01119 #define TRACEVOID(s) 01120 #define TRACETHUNK(t) 01121 #define TRACECALLBACK(t) 01122 #define TRACECALLBACKMSG(t) 01123 01124 #endif // DBG 01125 01126 /* 01127 * Statistics for performance counter 01128 */ 01129 01130 typedef struct tagPERFINFO { 01131 LONG lCount; 01132 LONG lMaxCount; 01133 LONG lTotalCount; 01134 SIZE_T lSize; 01135 } PERFHANDLEINFO, *PPERFHANDLEINFO; 01136 01137 typedef struct _HANDLEPAGE { 01138 ULONG_PTR iheLimit; /* first handle index past the end of the page */ 01139 ULONG_PTR iheFreeEven; /* first even free handle in the page -- window objects */ 01140 ULONG_PTR iheFreeOdd; /* first even odd handle in the page */ 01141 } HANDLEPAGE, *PHANDLEPAGE; 01142 01143 01144 #if DBG 01145 VOID HMCleanUpHandleTable(VOID); 01146 DWORD DbgDumpHandleTable(VOID); 01147 #endif 01148 01149 BOOL HMInitHandleTable(PVOID pBase); 01150 PVOID HMAllocObject(PTHREADINFO pti, PDESKTOP pdesk, BYTE btype, DWORD size); 01151 BOOL HMFreeObject(PVOID pobj); 01152 BOOL HMMarkObjectDestroy(PVOID pobj); 01153 BOOL HMDestroyObject(PVOID pobj); 01154 PVOID FASTCALL HMAssignmentLock(PVOID *ppobj, PVOID pobj); 01155 PVOID FASTCALL HMAssignmentUnlock(PVOID *ppobj); 01156 NTSTATUS HMGetStats(HANDLE hProcess, int iPidType, PVOID pResults, UINT cjResultSize); 01157 HANDLE KernelPtoH(PVOID pObj); 01158 void HMDestroyUnlockedObject(PHE phe); 01159 01160 void HMCleanupGrantedHandle(HANDLE h); 01161 01162 /* 01163 * Validation, handle mapping, etc. 01164 */ 01165 #define RevalidateHwnd(hwnd) HMValidateHandleNoSecure(hwnd, TYPE_WINDOW) 01166 #define RevalidateCatHwnd(hwnd) HMValidateCatHandleNoSecure(hwnd, TYPE_WINDOW) 01167 01168 #define HtoPq(h) ((PVOID)HMObjectFromHandle(h)) 01169 #define HtoPqCat(h) ((PVOID)HMCatObjectFromHandle(h)) 01170 #define HtoP(h) ((PVOID)HMObjectFromHandle(h)) 01171 #define HtoPCat(h) ((PVOID)HMCatObjectFromHandle(h)) 01172 #define PW(hwnd) ((PWND)HtoP(hwnd)) 01173 #define PWCat(hwnd) ((PWND)HtoPCat(hwnd)) 01174 #define TID(pti) HandleToUlong((pti) == NULL ? NULL : (pti)->pEThread->Cid.UniqueThread) 01175 #define TIDq(pti) HandleToUlong((pti)->pEThread->Cid.UniqueThread) 01176 01177 /* 01178 * Assignment lock macro -> used for locking objects embedded in structures 01179 * and globals. Threadlocks used for locking objects across callbacks. 01180 */ 01181 #define Lock(ppobj, pobj) HMAssignmentLock((PVOID *)ppobj, (PVOID)pobj) 01182 #define Unlock(ppobj) HMAssignmentUnlock((PVOID *)ppobj) 01183 01184 PVOID HMUnlockObjectInternal(PVOID pobj); 01185 01186 #define HMUnlockObject(pobj) \ 01187 ( (--((PHEAD)pobj)->cLockObj == 0) ? HMUnlockObjectInternal(pobj) : pobj ) 01188 01189 VOID HMChangeOwnerThread(PVOID pobj, PTHREADINFO pti); 01190 VOID HMChangeOwnerPheProcess(PHE phe, PTHREADINFO pti); 01191 #define HMChangeOwnerProcess(pobj, pti) HMChangeOwnerPheProcess(HMPheFromObject(pobj), pti) 01192 01193 #if DBG 01194 VOID HMLockObject(PVOID pobj); 01195 BOOL HMRelocateLockRecord(PVOID ppobjOld, LONG_PTR cbDelta); 01196 #else // DBG 01197 #define HMLockObject(p) (((PHEAD)p)->cLockObj++) 01198 #endif // DBG 01199 01200 #if DBG 01201 VOID ThreadLock(PVOID pobj, PTL ptl); 01202 #else // DBG 01203 #define ThreadLock(_pobj_, _ptl_) \ 01204 { \ 01205 \ 01206 PTHREADINFO _pti_; \ 01207 PVOID __pobj_ = (_pobj_); \ 01208 \ 01209 _pti_ = PtiCurrent(); \ 01210 (_ptl_)->next = _pti_->ptl; \ 01211 _pti_->ptl = (_ptl_); \ 01212 (_ptl_)->pobj = __pobj_; \ 01213 if (__pobj_ != NULL) { \ 01214 HMLockObject(__pobj_); \ 01215 } \ 01216 } 01217 #endif // DBG 01218 01219 #if DBG 01220 #define ThreadLockAlways(_pobj_, _ptl_) \ 01221 { \ 01222 PVOID __pobj_ = (_pobj_); \ 01223 UserAssert(__pobj_ != NULL); \ 01224 ThreadLock(__pobj_, _ptl_); \ 01225 } 01226 #else // DBG 01227 #define ThreadLockAlways(_pobj_, _ptl_) \ 01228 { \ 01229 \ 01230 PTHREADINFO _pti_; \ 01231 PVOID __pobj_ = (_pobj_); \ 01232 \ 01233 _pti_ = PtiCurrent(); \ 01234 (_ptl_)->next = _pti_->ptl; \ 01235 _pti_->ptl = (_ptl_); \ 01236 (_ptl_)->pobj = __pobj_; \ 01237 HMLockObject(__pobj_); \ 01238 } 01239 #endif // DBG 01240 01241 #if DBG 01242 #define ThreadLockNever(_ptl_) \ 01243 { \ 01244 ThreadLock(NULL, _ptl_); \ 01245 } 01246 #else // DBG 01247 #define ThreadLockNever(_ptl_) \ 01248 { \ 01249 \ 01250 PTHREADINFO _pti_; \ 01251 \ 01252 _pti_ = PtiCurrent(); \ 01253 (_ptl_)->next = _pti_->ptl; \ 01254 _pti_->ptl = (_ptl_); \ 01255 (_ptl_)->pobj = NULL; \ 01256 } 01257 #endif // DBG 01258 01259 #if DBG 01260 #define ThreadLockAlwaysWithPti(_pti_, _pobj_, _ptl_) \ 01261 { \ 01262 PVOID __pobj_ = (_pobj_); \ 01263 UserAssert(_pti_ == PtiCurrentShared()); \ 01264 UserAssert(__pobj_ != NULL); \ 01265 ThreadLock(__pobj_, _ptl_); \ 01266 } 01267 #else // DBG 01268 #define ThreadLockAlwaysWithPti(_pti_, _pobj_, _ptl_) \ 01269 { \ 01270 PVOID __pobj_ = (_pobj_); \ 01271 (_ptl_)->next = _pti_->ptl; \ 01272 _pti_->ptl = (_ptl_); \ 01273 (_ptl_)->pobj = __pobj_; \ 01274 HMLockObject(__pobj_); \ 01275 } 01276 #endif // DBG 01277 01278 #if DBG 01279 #define ThreadLockNeverWithPti(_pti_, _ptl_) \ 01280 { \ 01281 UserAssert(_pti_ == PtiCurrentShared()); \ 01282 ThreadLock(NULL, _ptl_); \ 01283 } 01284 #else // DBG 01285 #define ThreadLockNeverWithPti(_pti_, _ptl_) \ 01286 { \ 01287 (_ptl_)->next = _pti_->ptl; \ 01288 _pti_->ptl = (_ptl_); \ 01289 (_ptl_)->pobj = NULL; \ 01290 } 01291 #endif // DBG 01292 01293 #if DBG 01294 #define ThreadLockWithPti(_pti_, _pobj_, _ptl_) \ 01295 { \ 01296 PVOID __pobj_ = (_pobj_); \ 01297 UserAssert(_pti_ == PtiCurrentShared()); \ 01298 ThreadLock(__pobj_, _ptl_); \ 01299 } 01300 #else // DBG 01301 #define ThreadLockWithPti(_pti_, _pobj_, _ptl_) \ 01302 { \ 01303 PVOID __pobj_ = (_pobj_); \ 01304 (_ptl_)->next = _pti_->ptl; \ 01305 _pti_->ptl = (_ptl_); \ 01306 (_ptl_)->pobj = __pobj_; \ 01307 if (__pobj_ != NULL) { \ 01308 HMLockObject(__pobj_); \ 01309 } \ 01310 } 01311 #endif // DBG 01312 01313 #if DBG 01314 PVOID ThreadLockExchange(PVOID pobj, PTL ptl); 01315 #else // DBG 01316 PVOID __inline ThreadLockExchange(PVOID pobj, PTL ptl) 01317 { 01318 PVOID pobjOld; 01319 01320 pobjOld = ptl->pobj; 01321 ptl->pobj = pobj; 01322 if (pobj) { 01323 HMLockObject(pobj); 01324 } 01325 01326 if (pobjOld) { 01327 pobjOld = HMUnlockObject((PHEAD)pobjOld); 01328 } 01329 01330 return pobjOld; 01331 } 01332 #endif // DBG 01333 01334 #if DBG 01335 #define ThreadLockExchangeAlways(_pobj_, _ptl_) \ 01336 { \ 01337 PVOID __pobj_ = (_pobj_); \ 01338 UserAssert(__pobj_ != NULL); \ 01339 ThreadLockExchange(__pobj_, _ptl_); \ 01340 } 01341 #else // DBG 01342 PVOID __inline ThreadLockExchangeAlways(PVOID pobj, PTL ptl) 01343 { 01344 PVOID pobjOld; 01345 01346 pobjOld = ptl->pobj; 01347 ptl->pobj = pobj; 01348 HMLockObject(pobj); 01349 if (pobjOld) { 01350 pobjOld = HMUnlockObject((PHEAD)pobjOld); 01351 } 01352 01353 return pobjOld; 01354 } 01355 #endif // DBG 01356 01357 #if DBG 01358 PVOID ThreadUnlock1(PTL ptl); 01359 #define ThreadUnlock(ptl) ThreadUnlock1(ptl) 01360 #else // DBG 01361 PVOID ThreadUnlock1(VOID); 01362 #define ThreadUnlock(ptl) ThreadUnlock1() 01363 #endif // DBG 01364 01365 /* 01366 * Define this only if you want to track down lock/unlock mismatches 01367 * for desktop objects 01368 */ 01369 #if DBG 01370 // #define LOGDESKTOPLOCKS 01371 #endif // DBG 01372 01373 #ifdef LOGDESKTOPLOCKS 01374 01375 /* 01376 * this is the structure used by the desktop logging stuff 01377 */ 01378 typedef struct tagLogD { 01379 WORD tag; // tag 01380 WORD type; // lock | unlock 01381 ULONG_PTR extra; // extra information to identify the lock/unlock 01382 PVOID trace[6]; // stack trace 01383 } LogD, *PLogD; 01384 01385 /* 01386 * Tags for LOCK/UNLOCK REFERENCE/DEREFERENCE calls for 01387 * desktop objects 01388 */ 01389 01390 #define LDU_CLS_DESKPARENT1 1 01391 #define LDL_CLS_DESKPARENT1 2 01392 01393 #define LDU_CLS_DESKPARENT2 3 01394 #define LDL_CLS_DESKPARENT2 5 01395 01396 #define LDU_FN_DESTROYCLASS 6 01397 #define LDL_FN_DESTROYCLASS 7 01398 01399 #define LDU_FN_DESTROYMENU 8 01400 #define LDL_FN_DESTROYMENU 9 01401 01402 #define LDU_FN_DESTROYTHREADINFO 10 01403 #define LDL_FN_DESTROYTHREADINFO 11 01404 01405 #define LDU_FN_DESTROYWINDOWSTATION 12 01406 #define LDL_FN_DESTROYWINDOWSTATION 13 01407 01408 #define LDU_DESKDISCONNECT 14 01409 #define LDL_DESKDISCONNECT 15 01410 01411 #define LDU_DESK_DESKNEXT 16 01412 #define LDL_DESK_DESKNEXT1 17 01413 01414 #define LDU_OBJ_DESK 18 01415 #define LDL_OBJ_DESK 19 01416 #define LDL_MOTHERDESK_DESK1 20 01417 01418 #define LDL_PTI_DESK 21 01419 #define LDL_DT_DESK 23 01420 01421 #define LDU_PTI_DESK 24 01422 01423 #define LDU_PPI_DESKSTARTUP1 26 01424 #define LDU_PPI_DESKSTARTUP2 27 01425 #define LDU_PPI_DESKSTARTUP3 28 01426 #define LDL_PPI_DESKSTARTUP1 29 01427 #define LDL_PPI_DESKSTARTUP2 30 01428 01429 #define LDU_DESKLOGON 31 01430 #define LDL_DESKLOGON 32 01431 01432 #define LDUT_FN_FREEWINDOW 33 01433 #define LDLT_FN_FREEWINDOW 34 01434 01435 #define LDUT_FN_DESKTOPTHREAD_DESK 35 01436 #define LDLT_FN_DESKTOPTHREAD_DESK 36 01437 01438 #define LDUT_FN_DESKTOPTHREAD_DESKTEMP 37 01439 #define LDLT_FN_DESKTOPTHREAD_DESKTEMP 38 01440 01441 #define LDUT_FN_SETDESKTOP 39 01442 #define LDLT_FN_SETDESKTOP 40 01443 01444 #define LDUT_FN_NTUSERSWITCHDESKTOP 41 01445 #define LDLT_FN_NTUSERSWITCHDESKTOP 42 01446 01447 #define LDUT_FN_SENDMESSAGEBSM1 43 01448 #define LDUT_FN_SENDMESSAGEBSM2 44 01449 #define LDLT_FN_SENDMESSAGEBSM 45 01450 01451 #define LDUT_FN_SYSTEMBROADCASTMESSAGE 46 01452 #define LDLT_FN_SYSTEMBROADCASTMESSAGE 47 01453 01454 #define LDUT_FN_CTXREDRAWSCREEN 48 01455 #define LDLT_FN_CTXREDRAWSCREEN 49 01456 01457 #define LDUT_FN_CTXDISABLESCREEN 50 01458 #define LDLT_FN_CTXDISABLESCREEN 51 01459 01460 #define LD_DEREF_FN_CREATEDESKTOP1 52 01461 #define LD_DEREF_FN_CREATEDESKTOP2 53 01462 #define LD_DEREF_FN_CREATEDESKTOP3 54 01463 #define LD_REF_FN_CREATEDESKTOP 55 01464 01465 #define LD_DEREF_FN_OPENDESKTOP 56 01466 #define LD_REF_FN_OPENDESKTOP 57 01467 01468 #define LD_DEREF_FN_SETDESKTOP 58 01469 #define LD_REF_FN_SETDESKTOP 59 01470 01471 #define LD_DEREF_FN_GETTHREADDESKTOP 60 01472 #define LD_REF_FN_GETTHREADDESKTOP 61 01473 01474 #define LD_DEREF_FN_CLOSEDESKTOP1 62 01475 #define LD_DEREF_FN_CLOSEDESKTOP2 63 01476 #define LD_REF_FN_CLOSEDESKTOP 64 01477 01478 #define LD_DEREF_FN_RESOLVEDESKTOP 65 01479 #define LD_REF_FN_RESOLVEDESKTOP 66 01480 01481 #define LD_DEREF_VALIDATE_HDESK1 67 01482 #define LD_DEREF_VALIDATE_HDESK2 68 01483 #define LD_DEREF_VALIDATE_HDESK3 69 01484 #define LD_DEREF_VALIDATE_HDESK4 70 01485 #define LDL_VALIDATE_HDESK 71 01486 01487 #define LDUT_FN_CREATETHREADINFO1 72 01488 #define LDUT_FN_CREATETHREADINFO2 73 01489 #define LDLT_FN_CREATETHREADINFO 74 01490 01491 #define LD_DEREF_FN_SETCSRSSTHREADDESKTOP1 75 01492 #define LD_DEREF_FN_SETCSRSSTHREADDESKTOP2 76 01493 #define LD_REF_FN_SETCSRSSTHREADDESKTOP 77 01494 01495 #define LD_DEREF_FN_CONSOLECONTROL1 78 01496 #define LD_REF_FN_CONSOLECONTROL1 79 01497 01498 #define LD_DEREF_FN_CONSOLECONTROL2 80 01499 #define LD_REF_FN_CONSOLECONTROL2 81 01500 01501 #define LD_DEREF_FN_GETUSEROBJECTINFORMATION 82 01502 #define LD_REF_FN_GETUSEROBJECTINFORMATION 83 01503 01504 #define LD_DEREF_FN_SETUSEROBJECTINFORMATION 84 01505 #define LD_REF_FN_SETUSEROBJECTINFORMATION 85 01506 01507 #define LD_DEREF_FN_CREATEWINDOWSTATION 86 01508 #define LD_REF_FN_CREATEWINDOWSTATION 87 01509 01510 #define LDL_TERM_DESKDESTROY1 88 01511 #define LDL_TERM_DESKDESTROY2 89 01512 01513 #define LDL_MOTHERDESK_DESK2 92 01514 01515 #define LDL_WINSTA_DESKLIST2 93 01516 #define LDL_WINSTA_DESKLIST1 94 01517 01518 #define LDL_DESKRITINPUT 95 01519 #define LDU_DESKRITINPUT 96 01520 01521 #define LD_DEREF_FN_2CREATEDESKTOP 97 01522 01523 #define LDL_DESK_DESKNEXT2 98 01524 01525 #define LDL_DESKSHOULDBEFOREGROUND1 99 01526 #define LDL_DESKSHOULDBEFOREGROUND2 100 01527 #define LDL_DESKSHOULDBEFOREGROUND3 101 01528 01529 #define LDL_HOOK_DESK 102 01530 #define LDU_HOOK_DESK 103 01531 01532 #define LDU_DESKSHOULDBEFOREGROUND 105 01533 01534 #define LDU_MOTHERDESK_DESK 106 01535 01536 void LogDesktop(PDESKTOP pdesk, DWORD tag, BOOL bLock, ULONG_PTR extra); 01537 01538 #else 01539 #define LogDesktop(pdesk, tag, bLock, extra) 01540 #endif // LOGDESKTOPLOCKS 01541 01542 /* 01543 * Routines for referencing and assigning kernel objects. 01544 */ 01545 #ifdef LOGDESKTOPLOCKS 01546 VOID LockObjectAssignment(PVOID*, PVOID, DWORD, ULONG_PTR); 01547 VOID UnlockObjectAssignment(PVOID*, DWORD, ULONG_PTR); 01548 #else 01549 VOID LockObjectAssignment(PVOID*, PVOID); 01550 VOID UnlockObjectAssignment(PVOID*); 01551 #endif 01552 01553 VOID UserDereferenceObject(PVOID pobj); 01554 01555 #define ThreadLockObject(pobj, ptl) \ 01556 { \ 01557 UserAssert(!(PpiCurrent()->W32PF_Flags & W32PF_TERMINATED)); \ 01558 UserAssert(pobj == NULL || OBJECT_TO_OBJECT_HEADER(pobj)->PointerCount != 0); \ 01559 PushW32ThreadLock(pobj, ptl, UserDereferenceObject); \ 01560 if (pobj != NULL) { \ 01561 ObReferenceObject(pobj); \ 01562 } \ 01563 } 01564 01565 #define ThreadLockExchangeObject(pobj, ptl) \ 01566 { \ 01567 UserAssert(!(PpiCurrent()->W32PF_Flags & W32PF_TERMINATED)); \ 01568 UserAssert(pobj == NULL || OBJECT_TO_OBJECT_HEADER(pobj)->PointerCount != 0); \ 01569 if (pobj != NULL) { \ 01570 ObReferenceObject(pobj); \ 01571 } \ 01572 ExchangeW32ThreadLock(pobj, ptl); \ 01573 } 01574 01575 #define ThreadUnlockObject(ptl) \ 01576 { \ 01577 PopAndFreeW32ThreadLock(ptl); \ 01578 } \ 01579 01580 #ifdef LOGDESKTOPLOCKS 01581 01582 #define UnlockWinSta(ppwinsta) \ 01583 UnlockObjectAssignment(ppwinsta, 0, 0) 01584 01585 #define LockWinSta(ppwinsta, pwinsta) \ 01586 { \ 01587 if (pwinsta != NULL) \ 01588 { \ 01589 UserAssert(OBJECT_TO_OBJECT_HEADER(pwinsta)->Type == *ExWindowStationObjectType); \ 01590 } \ 01591 LockObjectAssignment(ppwinsta, pwinsta, 0, 0); \ 01592 } 01593 01594 #define LockDesktop(ppdesk, pdesk, tag, extra) \ 01595 { \ 01596 if (pdesk != NULL) \ 01597 { \ 01598 UserAssert(OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType); \ 01599 } \ 01600 LockObjectAssignment(ppdesk, pdesk, tag, extra); \ 01601 } 01602 01603 #define UnlockDesktop(ppdesk, tag, extra) \ 01604 UnlockObjectAssignment(ppdesk, tag, extra) 01605 01606 #define ThreadLockDesktop(pti, pdesk, ptl, tag) \ 01607 { \ 01608 UserAssert(pdesk == NULL || OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType);\ 01609 ThreadLockObject(pdesk, ptl); \ 01610 LogDesktop(pdesk, tag, TRUE, (ULONG_PTR)PtiCurrent()); \ 01611 } 01612 01613 #define ThreadLockExchangeDesktop(pti, pdesk, ptl, tag) \ 01614 { \ 01615 UserAssert(pdesk == NULL || OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType);\ 01616 ThreadLockExchangeObject(pdesk, ptl); \ 01617 LogDesktop(pdesk, tag, TRUE, (ULONG_PTR)PtiCurrent()); \ 01618 } 01619 01620 #define ThreadUnlockDesktop(pti, ptl, tag) \ 01621 { \ 01622 LogDesktop((PDESKTOP)(((PTL)ptl)->pobj), tag, FALSE, (ULONG_PTR)PtiCurrent()); \ 01623 ThreadUnlockObject(ptl); \ 01624 } 01625 01626 #else 01627 01628 #define UnlockWinSta(ppwinsta) \ 01629 UnlockObjectAssignment(ppwinsta) 01630 01631 #define LockWinSta(ppwinsta, pwinsta) \ 01632 { \ 01633 if (pwinsta != NULL) \ 01634 { \ 01635 UserAssert(OBJECT_TO_OBJECT_HEADER(pwinsta)->Type == *ExWindowStationObjectType); \ 01636 } \ 01637 LockObjectAssignment(ppwinsta, pwinsta); \ 01638 } 01639 01640 #define LockDesktop(ppdesk, pdesk, tag, extra) \ 01641 { \ 01642 if (pdesk != NULL) \ 01643 { \ 01644 UserAssert(OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType); \ 01645 } \ 01646 LockObjectAssignment(ppdesk, pdesk); \ 01647 } 01648 01649 #define UnlockDesktop(ppdesk, tag, extra) \ 01650 UnlockObjectAssignment(ppdesk) 01651 01652 #define ThreadLockDesktop(pti, pdesk, ptl, tag) \ 01653 { \ 01654 UserAssert(pdesk == NULL || OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType);\ 01655 ThreadLockObject(pdesk, ptl); \ 01656 } 01657 01658 #define ThreadLockExchangeDesktop(pti, pdesk, ptl, tag) \ 01659 { \ 01660 UserAssert(pdesk == NULL || OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType);\ 01661 ThreadLockExchangeObject(pdesk, ptl); \ 01662 } 01663 01664 #define ThreadUnlockDesktop(pti, ptl, tag) ThreadUnlockObject(ptl) 01665 01666 #endif // LOGDESKTOPLOCKS 01667 01668 #define ThreadLockWinSta(pti, pwinsta, ptl) \ 01669 { \ 01670 UserAssert(pwinsta == NULL || OBJECT_TO_OBJECT_HEADER(pwinsta)->Type == *ExWindowStationObjectType);\ 01671 ThreadLockObject(pwinsta, ptl); \ 01672 } 01673 01674 #define ThreadLockExchangeWinSta(pti, pwinsta, ptl) \ 01675 { \ 01676 UserAssert(pwinsta == NULL || OBJECT_TO_OBJECT_HEADER(pwinsta)->Type == *ExWindowStationObjectType);\ 01677 ThreadLockExchangeObject(pwinsta, ptl); \ 01678 } 01679 01680 #define _ThreadLockPti(pti, pobj, ptl) LockW32Thread((PW32THREAD)pobj, ptl) 01681 #if DBG 01682 #define ThreadLockPti(pti, pobj, ptl) \ 01683 { \ 01684 if ((pobj != NULL) \ 01685 && (pobj->TIF_flags & TIF_INCLEANUP) \ 01686 && (pobj != PtiCurrent())) { \ 01687 RIPMSG1(RIP_ERROR, "ThreadLockPti: dead thread %#p", pobj); \ 01688 } \ 01689 _ThreadLockPti(pti, pobj, ptl); \ 01690 } 01691 #else 01692 #define ThreadLockPti(pti, pobj, ptl) \ 01693 { \ 01694 _ThreadLockPti(pti, pobj, ptl); \ 01695 } 01696 #endif 01697 01698 #define ThreadUnlockWinSta(pti, ptl) ThreadUnlockObject(ptl) 01699 #define ThreadUnlockPti(pti, ptl) UnlockW32Thread(ptl) 01700 01701 /* 01702 * Macros for locking pool allocations 01703 */ 01704 #define ThreadLockPool(_pti_, _ppool_, _ptl_) \ 01705 PushW32ThreadLock(_ppool_, _ptl_, UserFreePool) 01706 01707 #define ThreadUnlockPool(_pti_, _ptl_) \ 01708 PopW32ThreadLock(_ptl_) 01709 01710 #define ThreadUnlockAndFreePool(_pti_, _ptl_) \ 01711 PopAndFreeAlwaysW32ThreadLock(_ptl_) 01712 01713 #define ThreadLockPoolCleanup(_pti_, _ppool_, _ptl_, _pfn_) \ 01714 PushW32ThreadLock(_ppool_, _ptl_, _pfn_) 01715 01716 #define ThreadUnlockPoolCleanup(_pti_, _ptl_) \ 01717 PopW32ThreadLock(_ptl_) 01718 01719 #define ThreadUnlockAndCleanupPool(_pti_, _ptl_) \ 01720 PopAndFreeAlwaysW32ThreadLock(_ptl_) 01721 01722 #define ThreadLockDesktopHandle(_pti, _ptl_, _hdesk_) \ 01723 PushW32ThreadLock(_hdesk_, _ptl_, CloseProtectedHandle) 01724 01725 #define ThreadUnlockDesktopHandle(_ptl_) \ 01726 PopAndFreeAlwaysW32ThreadLock(_ptl_) 01727 01728 void CleanupDecSFWLockCount(PVOID pIgnore); 01729 #define ThreadLockSFWLockCount(_ptl_) \ 01730 { \ 01731 IncSFWLockCount(); \ 01732 /* Pass a fake pObj or the cleanup function won't be called */ \ 01733 PushW32ThreadLock(&guSFWLockCount, _ptl_, CleanupDecSFWLockCount); \ 01734 } 01735 01736 #define ThreadUnlockSFWLockCount(_ptl_) \ 01737 { \ 01738 DecSFWLockCount(); \ 01739 PopW32ThreadLock(_ptl_); \ 01740 } 01741 01742 /* 01743 * special handle that signifies we have a rle bitmap for the wallpaper 01744 */ 01745 #define HBITMAP_RLE ((HBITMAP)0xffffffff) 01746 01747 typedef struct tagWPINFO { 01748 int xsize, ysize; 01749 PBITMAPINFO pbmi; 01750 PBYTE pdata; 01751 PBYTE pbmfh; 01752 } WPINFO; 01753 01754 /* 01755 * Defines used by GetMouseMovePointsEx API 01756 */ 01757 01758 #define MAX_MOUSEPOINTS 64 01759 01760 #define PREVPOINT(i) \ 01761 ((i == 0) ? (MAX_MOUSEPOINTS - 1) : ((i - 1) % MAX_MOUSEPOINTS)) 01762 01763 #define NEXTPOINT(i) \ 01764 ((i + 1) % MAX_MOUSEPOINTS) 01765 01766 #define NEXTPOINTCOUNT(c) \ 01767 { \ 01768 if (c < MAX_MOUSEPOINTS) \ 01769 c++; \ 01770 } 01771 01772 #define SAVEPOINT(xc, yc, resX, resY, t, e) \ 01773 { \ 01774 /* \ 01775 * (xc, yc) is the point and (resX, resY) is the resolution \ 01776 */ \ 01777 gaptMouse[gptInd].x = MAKELONG(LOWORD(xc), LOWORD(resX)); \ 01778 gaptMouse[gptInd].y = MAKELONG(LOWORD(yc), LOWORD(resY)); \ 01779 gaptMouse[gptInd].time = t; \ 01780 gaptMouse[gptInd].dwExtraInfo = e; \ 01781 \ 01782 gptInd = NEXTPOINT(gptInd); \ 01783 } 01784 01785 01786 /* 01787 * Structure used for getting the stack traces for user critical section 01788 */ 01789 01790 #define MAX_STACK_CALLS 8 01791 01792 typedef struct tagCRITSTACK { 01793 struct tagCRITSTACK* pNext; 01794 PETHREAD thread; 01795 int nFrames; 01796 PVOID trace[ MAX_STACK_CALLS ]; 01797 } CRITSTACK, *PCRITSTACK; 01798 01799 01800 /* 01801 * Macros for User Server and Raw Input Thread critical sections. 01802 */ 01803 #if DBG 01804 #define KeUserModeCallback(api, pIn, cb, pOut, pcb) _KeUserModeCallback(api, pIn, cb, pOut, pcb); 01805 #define CheckCritIn() _AssertCritIn() 01806 #define CheckDeviceInfoListCritIn() _AssertDeviceInfoListCritIn() 01807 #define CheckCritInShared() _AssertCritInShared() 01808 #define CheckCritOut() _AssertCritOut() 01809 #define CheckDeviceInfoListCritOut() _AssertDeviceInfoListCritOut() 01810 01811 void BeginAtomicCheck(); 01812 void BeginAtomicDeviceInfoListCheck(); 01813 void EndAtomicCheck(); 01814 void EndAtomicDeviceInfoListCheck(); 01815 #define BEGINATOMICCHECK() BeginAtomicCheck(); \ 01816 { DWORD dwCritSecUseSave = gdwCritSecUseCount; 01817 01818 #define ENDATOMICCHECK() UserAssert(dwCritSecUseSave == gdwCritSecUseCount); \ 01819 } EndAtomicCheck(); 01820 #define BEGINATOMICDEVICEINFOLISTCHECK() \ 01821 BeginAtomicDeviceInfoListCheck(); \ 01822 { DWORD dwDeviceInfoListCritSecUseSave = gdwDeviceInfoListCritSecUseCount; 01823 01824 #define ENDATOMICDEVICEINFOLISTCHECK() \ 01825 UserAssert(dwDeviceInfoListCritSecUseSave == gdwDeviceInfoListCritSecUseCount); \ 01826 } EndAtomicDeviceInfoListCheck(); 01827 01828 // Use this to jump/return out of scope of dwCritSecUseSave (eg: error handling) 01829 #define EXITATOMICCHECK() UserAssert(dwCritSecUseSave == gdwCritSecUseCount); \ 01830 EndAtomicCheck(); 01831 #define ISATOMICCHECK() (gdwInAtomicOperation != 0) 01832 #define ISATOMICDEVICEINFOLISTCHECK() (gdwInAtomicDeviceInfoListOperation != 0) 01833 01834 #else // DBG 01835 #define CheckCritIn() 01836 #define CheckDeviceInfoListCritIn() 01837 #define CheckCritInShared() 01838 #define CheckCritOut() 01839 #define CheckDeviceInfoListCritOut() 01840 #define BEGINATOMICCHECK() 01841 #define BEGINATOMICDEVICEINFOLISTCHECK() 01842 #define BeginAtomicCheck() 01843 #define BeginAtomicDeviceInfoListCheck() 01844 #define ENDATOMICCHECK() 01845 #define ENDATOMICDEVICEINFOLISTCHECK() 01846 #define EndAtomicCheck() 01847 #define EndAtomicDeviceInfoListCheck() 01848 #define EXITATOMICCHECK() 01849 #define ISATOMICCHECK() 01850 #define ISATOMICDEVICEINFOLISTCHECK() 01851 #endif // DBG 01852 01853 01854 #define DIAGNOSE_IO 1 01855 #ifdef DIAGNOSE_IO 01856 ULONG MonotonicTick(); 01857 #define LOGTIME(gt) gt = MonotonicTick(); 01858 #else 01859 #define LOGTIME(gt) 01860 #endif 01861 01862 /* 01863 * #defines used for mouse/keyboard read buffer 01864 */ 01865 #define MAXIMUM_ITEMS_READ 10 01866 #define NELEM_BUTTONQUEUE 16 01867 01868 /* 01869 * Number of times to retry reading a device after a read attempt fails 01870 */ 01871 #define MAXIMUM_READ_RETRIES 5 01872 01873 typedef struct tagGENERIC_DEVICE_INFO { 01874 struct tagDEVICEINFO *pNext; 01875 BYTE type; 01876 BYTE bFlags; 01877 USHORT usActions; 01878 BYTE nRetryRead; 01879 UNICODE_STRING ustrName; 01880 HANDLE handle; 01881 PVOID NotificationEntry; 01882 PKEVENT pkeHidChangeCompleted; // wake RequestDeviceChange() 01883 IO_STATUS_BLOCK iosb; 01884 NTSTATUS ReadStatus; 01885 #ifdef DIAGNOSE_IO 01886 HANDLE OpenerProcess; 01887 NTSTATUS OpenStatus; 01888 NTSTATUS AttrStatus; 01889 ULONG timeStartRead; // tick before ZwReadFile 01890 ULONG timeEndRead; // tick after ZwReadFile 01891 int nReadsOutstanding; // ZwReadFile ++, consume data -- 01892 #endif 01893 } GENERIC_DEVICE_INFO, *PGENERIC_DEVICE_INFO; 01894 01895 // valuse for GENERIC_DEVICE_INFO.type 01896 #define DEVICE_TYPE_MOUSE 0 01897 #define DEVICE_TYPE_KEYBOARD 1 01898 #define DEVICE_TYPE_MAX 1 01899 01900 // values for GENERIC_DEVICE_INFO.usActions and SignalDeviceChange() 01901 #define GDIAF_ARRIVED (USHORT)0x0001 // open & start reading 01902 #define GDIAF_QUERYREMOVE (USHORT)0x0002 // close the device 01903 #define GDIAF_REMOVECANCELLED (USHORT)0x0004 // reopen the device 01904 #define GDIAF_DEPARTED (USHORT)0x0008 // close and free the device 01905 #define GDIAF_IME_STATUS (USHORT)0x0010 // ??? 01906 #define GDIAF_REFRESH_MOUSE (USHORT)0x0020 // ??? 01907 #define GDIAF_FREEME (USHORT)0x0080 // Request to Free the DeviceInfo 01908 #define GDIAF_PNPWAITING (USHORT)0x0100 // a PnP thread is waiting 01909 #define GDIAF_RETRYREAD (USHORT)0x0200 // Retry the read 01910 #define GDIAF_RECONNECT (USHORT)0x0400 // The session reconnected 01911 01912 // values for GENERIC_DEVICE_INFO.bFlags; 01913 #define GDIF_NOTPNP 0x01 // Not a PnP device (eg: PS/2) 01914 #define GDIF_READING 0x02 // Read may be pending (don't free DeviceInfo). 01915 #if DIAGNOSE_IO 01916 #define GDIF_READERMUSTFREE 0x04 // "Free Device" while read pending 01917 #define GDIF_PNPMUSTFREE 0x08 // "Free Device" while PnP notification pending 01918 #endif 01919 #define GDIF_DBGREAD 0x10 // Verbose dbg output about this device 01920 01921 typedef struct tagMOUSE_DEVICE_INFO { // DEVICE_TYPE_MOUSE 01922 MOUSE_ATTRIBUTES Attr; 01923 MOUSE_INPUT_DATA Data[MAXIMUM_ITEMS_READ]; 01924 } MOUSE_DEVICE_INFO, *PMOUSE_DEVICE_INFO; 01925 01926 typedef struct tagKEYBOARD_DEVICE_INFO { // DEVICE_TYPE_KEYBOARD 01927 KEYBOARD_ATTRIBUTES Attr; 01928 KEYBOARD_INPUT_DATA Data[MAXIMUM_ITEMS_READ]; 01929 } KEYBOARD_DEVICE_INFO, *PKEYBOARD_DEVICE_INFO; 01930 01931 typedef struct tagDEVICEINFO { 01932 GENERIC_DEVICE_INFO; 01933 union { 01934 MOUSE_DEVICE_INFO mouse; 01935 KEYBOARD_DEVICE_INFO keyboard; 01936 }; 01937 } DEVICEINFO, *PDEVICEINFO; 01938 01939 typedef struct tagDEVICE_TEMPLATE { 01940 SIZE_T cbDeviceInfo; // bytes to allocate for DEVICEINFO 01941 const GUID *pClassGUID; // GUID of the class 01942 UINT uiRegistrySection; // Parameters for class (HKLM\SYSTEM\CurrentControlSet\Services\*\Parameters) 01943 LPWSTR pwszClassName; // Class name (eg: L"mouclass") 01944 LPWSTR pwszDefDevName; // Default Device Name 01945 LPWSTR pwszLegacyDevName; // Legacy Device Name (eg: "PointerClassLegacy0") 01946 ULONG IOCTL_Attr; // IOCTL_*_QUERY_ATTRIBUTES 01947 UINT offAttr; // offset of *_ATTRIBUTES struct within DEVICEINFO 01948 ULONG cbAttr; // sizeof *_ATTRIBUTES struct 01949 UINT offData; // offset of *_INPUT_DATA buffer within DEVICEINFO 01950 ULONG cbData; // sizeof *_INPUT_DATA buffer 01951 VOID (*DeviceRead)(PDEVICEINFO); // routine to read the device 01952 PKEVENT pkeHidChange; // event to signal changes to this sort of device 01953 } DEVICE_TEMPLATE, *PDEVICE_TEMPLATE; 01954 01955 extern DEVICE_TEMPLATE aDeviceTemplate[]; // in pnp.c 01956 01957 typedef struct tagMOUSEEVENT { 01958 USHORT ButtonFlags; 01959 USHORT ButtonData; 01960 ULONG_PTR ExtraInfo; 01961 POINT ptPointer; 01962 LONG time; 01963 BOOL bInjected; 01964 } MOUSEEVENT, *PMOUSEEVENT; 01965 01966 01967 VOID ProcessKeyboardInput(PDEVICEINFO pDeviceInfo); 01968 VOID ProcessMouseInput(PDEVICEINFO pDeviceInfo); 01969 VOID RequestDeviceChange( 01970 PDEVICEINFO pDeviceInfo, 01971 USHORT usAction, 01972 BOOL fInDeviceInfoListCrit); 01973 01974 VOID RetryReadInput(); 01975 01976 VOID NTAPI InputApc( 01977 IN PVOID ApcContext, 01978 IN PIO_STATUS_BLOCK IoStatusBlock, 01979 IN ULONG Reserved); 01980 01981 ULONG GetDeviceChangeInfo(VOID); 01982 VOID InitializeMediaChange(HANDLE); 01983 01984 /* 01985 * Hard error information 01986 */ 01987 typedef struct tagHARDERRORHANDLER { 01988 PTHREADINFO pti; 01989 PQ pqAttach; 01990 } HARDERRORHANDLER, *PHARDERRORHANDLER; 01991 01992 /* 01993 * Terminal Structure. 01994 * 01995 * This structure is only viewable from the kernel. 01996 */ 01997 01998 #define TEST_GTERMF(f) TEST_FLAG(gdwGTERMFlags, f) 01999 #define TEST_BOOL_GTERMF(f) TEST_BOOL_FLAG(gdwGTERMFlags, f) 02000 #define SET_GTERMF(f) SET_FLAG(gdwGTERMFlags, f) 02001 #define CLEAR_GTERMF(f) CLEAR_FLAG(gdwGTERMFlags, f) 02002 #define SET_OR_CLEAR_GTERMF(f, fSet) SET_OR_CLEAR_FLAG(gdwGTERMFlags, f, fSet) 02003 #define TOGGLE_GTERMF(f) TOGGLE_FLAG(gdwGTERMFlags, f) 02004 02005 #define GTERMF_MOUSE 0x00000001 02006 02007 02008 #define TERMF_INITIALIZED 0x00000001 02009 #define TERMF_NOIO 0x00000002 02010 #define TERMF_STOPINPUT 0x00000004 02011 #define TERMF_DTINITSUCCESS 0x00000008 02012 #define TERMF_DTINITFAILED 0x00000010 02013 #define TERMF_DTDESTROYED 0x00000020 02014 02015 typedef struct tagTERMINAL { 02016 02017 DWORD dwTERMF_Flags; // terminal flags 02018 02019 /* 02020 * System Information 02021 */ 02022 PWND spwndDesktopOwner; // mother desktop 02023 02024 02025 PTHREADINFO ptiDesktop; 02026 PQ pqDesktop; 02027 02028 PKEVENT pEventTermInit; 02029 PKEVENT pEventDestroyDesktop; // Used for destroying desktops 02030 02031 PDESKTOP rpdeskDestroy; // Desktop destroy list. 02032 02033 PKEVENT pEventInputReady; // input ready event. This is created in 02034 // CreateTerminal. RIT and the desktop thread 02035 // will wait for it. It will be set when the 02036 // first desktop in that terminal will be created. 02037 PKEVENT pEventDTExit; 02038 02039 } TERMINAL, *PTERMINAL; 02040 02041 /* 02042 * Pool allocation tags and macros 02043 */ 02044 02045 /* 02046 * Define tags. To add tags, add them to ntuser\kernel\ptag.lst 02047 */ 02048 #define DEFINE_POOLTAG(value, index) value 02049 02050 #define DECLARE_POOLTAG(name, value, index) 02051 02052 #include "ptag.h" 02053 02054 NTSTATUS UserCommitDesktopMemory( 02055 PVOID pBase, 02056 PVOID *ppCommit, 02057 PSIZE_T pCommitSize); 02058 02059 NTSTATUS UserCommitSharedMemory( 02060 PVOID pBase, 02061 PVOID *ppCommit, 02062 PSIZE_T pCommitSize); 02063 02064 PWIN32HEAP UserCreateHeap( 02065 HANDLE hSection, 02066 ULONG ulViewOffset, 02067 PVOID pvBaseAddress, 02068 DWORD dwSize, 02069 PRTL_HEAP_COMMIT_ROUTINE pfnCommit); 02070 02071 #define IsValidTag(p, tag) TRUE 02072 02073 #define RECORD_STACK_TRACE_SIZE 6 02074 02075 /* 02076 * Pool allocation flags 02077 */ 02078 02079 #define POOL_HEAVY_ALLOCS 0x00000001 // use HeavyAllocPool 02080 #define POOL_CAPTURE_STACK 0x00000002 // stack traces are captured 02081 #define POOL_FAIL_ALLOCS 0x00000004 // fail pool allocations 02082 #define POOL_FAIL_BY_INDEX 0x00000008 // fail allocations by index 02083 #define POOL_TAIL_CHECK 0x00000010 // append tail string 02084 #define POOL_KEEP_FREE_RECORD 0x00000020 // keep a list with last x frees 02085 #define POOL_KEEP_FAIL_RECORD 0x00000040 // keep a list with last x failed allocations 02086 #define POOL_BREAK_FOR_LEAKS 0x00000080 // break on pool leaks (remote sessions) 02087 02088 typedef struct tagWin32AllocStats { 02089 SIZE_T dwMaxMem; // max pool memory allocated 02090 SIZE_T dwCrtMem; // current pool memory used 02091 DWORD dwMaxAlloc; // max number of pool allocations made 02092 DWORD dwCrtAlloc; // current pool allocations 02093 02094 PWin32PoolHead pHead; // pointer to the link list with the allocations 02095 02096 } Win32AllocStats, *PWin32AllocStats; 02097 02098 typedef struct tagPOOLRECORD { 02099 PVOID ExtraData; // the tag 02100 SIZE_T size; 02101 PVOID trace[RECORD_STACK_TRACE_SIZE]; 02102 } POOLRECORD, *PPOOLRECORD; 02103 02104 #ifdef POOL_INSTR_API 02105 02106 BOOL _Win32PoolAllocationStats( 02107 LPDWORD parrTags, 02108 SIZE_T tagsCount, 02109 SIZE_T* lpdwMaxMem, 02110 SIZE_T* lpdwCrtMem, 02111 LPDWORD lpdwMaxAlloc, 02112 LPDWORD lpdwCrtAlloc); 02113 02114 #endif // POOL_INSTR_API 02115 02116 #ifdef POOL_INSTR 02117 02118 void CleanupPoolAllocations(void); 02119 void InitPoolLimitations(); 02120 void CleanUpPoolLimitations(); 02121 #else 02122 #define CleanupPoolAllocations() 02123 #define InitPoolLimitations() 02124 #define CleanUpPoolLimitations() 02125 02126 #endif // POOL_INSTR 02127 02128 #ifndef TRACE_MAP_VIEWS 02129 #define InitSectionTrace() 02130 #define CleanUpSections() 02131 #else 02132 VOID InitSectionTrace(VOID); 02133 void CleanUpSections(void); 02134 #endif // TRACE_MAP_VIEWS 02135 02136 extern PWIN32HEAP gpvSharedAlloc; 02137 02138 PVOID __inline 02139 SharedAlloc(ULONG cb) 02140 { 02141 return Win32HeapAlloc(gpvSharedAlloc, cb, 0, 0); 02142 } 02143 02144 BOOL __inline 02145 SharedFree(PVOID pv) 02146 { 02147 return Win32HeapFree(gpvSharedAlloc, pv); 02148 } 02149 02150 NTSTATUS CommitReadOnlyMemory(HANDLE hSection, PSIZE_T pulCommit, 02151 DWORD dwCommitOffset, int* pdCommit); 02152 02153 /* 02154 * Height and Width of the desktop pattern bitmap. 02155 */ 02156 #define CXYDESKPATTERN 8 02157 02158 /* 02159 * LATER: these things are not defined yet 02160 */ 02161 #define CheckHwnd(x) TRUE 02162 #define CheckHwndNull(x) TRUE 02163 02164 /***************************************************************************\ 02165 * Typedefs and Macros 02166 * 02167 * Here are defined all types and macros that are shared across the User's 02168 * server-side code modules. Types and macros that are unique to a single 02169 * module should be defined at the head of that module, not in this file. 02170 * 02171 \***************************************************************************/ 02172 02173 02174 // Window Proc Window Validation macro 02175 02176 #define VALIDATECLASSANDSIZE(pwnd, message, wParam, lParam, inFNID, initmessage) \ 02177 if ((pwnd)->fnid != (inFNID)) { \ 02178 switch ((pwnd)->fnid) { \ 02179 DWORD cb; \ 02180 case 0: \ 02181 \ 02182 if ((cb = pwnd->cbwndExtra + sizeof(WND)) < (DWORD)(CBFNID(inFNID))) { \ 02183 RIPMSG3(RIP_WARNING, \ 02184 "(%#p %lX) needs at least (%ld) window words for this proc", \ 02185 pwnd, cb - sizeof(WND), \ 02186 (DWORD)(CBFNID(inFNID)) - sizeof(WND)); \ 02187 return 0; \ 02188 } \ 02189 /* \ 02190 * If this is not the initialization message, we cannot set the fnid; \ 02191 * otherwise, we'll probably fault working on this pwnd's private \ 02192 * uninitialized data \ 02193 */ \ 02194 if ((message) != (initmessage)) { \ 02195 if (((message) != WM_NCCREATE) && ((message) != WM_NCCALCSIZE) && ((message) != WM_GETMINMAXINFO)) { \ 02196 RIPMSG3(RIP_WARNING, \ 02197 "Default processing message %#lx for pwnd %#p. fnid %#lx not set",\ 02198 (message), (pwnd), (DWORD)(inFNID)); \ 02199 } \ 02200 return xxxDefWindowProc((pwnd), (message), (wParam), (lParam)); \ 02201 } \ 02202 \ 02203 /* \ 02204 * Remember what window class this window belongs to. Can't use \ 02205 * the real class because any app can call CallWindowProc() \ 02206 * directly no matter what the class is! \ 02207 */ \ 02208 (pwnd)->fnid = (WORD)(inFNID); \ 02209 break; \ 02210 \ 02211 default: \ 02212 RIPMSG3(RIP_WARNING, "Window (%#p) not of correct class; fnid = %lX not %lX", \ 02213 (pwnd), (DWORD)((pwnd)->fnid), (DWORD)(inFNID)); \ 02214 \ 02215 /* Fall through */ \ 02216 \ 02217 case (inFNID | FNID_CLEANEDUP_BIT): \ 02218 case (inFNID | FNID_DELETED_BIT): \ 02219 case (inFNID | FNID_STATUS_BITS): \ 02220 return 0; \ 02221 } \ 02222 } 02223 02224 /* 02225 * Handy Region helper macros 02226 */ 02227 #define CopyRgn(hrgnDst, hrgnSrc) \ 02228 GreCombineRgn(hrgnDst, hrgnSrc, NULL, RGN_COPY) 02229 #define IntersectRgn(hrgnResult, hrgnA, hrgnB) \ 02230 GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_AND) 02231 #define SubtractRgn(hrgnResult, hrgnA, hrgnB) \ 02232 GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_DIFF) 02233 #define UnionRgn(hrgnResult, hrgnA, hrgnB) \ 02234 GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_OR) 02235 #define XorRgn(hrgnResult, hrgnA, hrgnB) \ 02236 GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_XOR) 02237 02238 void DeleteMaybeSpecialRgn(HRGN hrgn); 02239 02240 BOOL zzzInvalidateDCCache(PWND pwndInvalid, DWORD flags); 02241 02242 #define IDC_DEFAULT 0x0001 02243 #define IDC_CHILDRENONLY 0x0002 02244 #define IDC_CLIENTONLY 0x0004 02245 #define IDC_MOVEBLT 0x0008 02246 #define IDC_NOMOUSE 0x0010 02247 02248 /* 02249 * RestoreSpb return Flags 02250 */ 02251 02252 #define RSPB_NO_INVALIDATE 0 // nothing invalidated by restore 02253 #define RSPB_INVALIDATE 1 // restore invalidate some area 02254 #define RSPB_INVALIDATE_SSB 2 // restore called SaveScreenBits which invalidated 02255 02256 // Calls Proc directly without doing any messages translation 02257 02258 #define SCMS_FLAGS_ANSI 0x0001 02259 #define SCMS_FLAGS_INONLY 0x0002 // Message should be one way (hooks) 02260 02261 #define CallClientProcA(pwnd, msg, wParam, lParam, xpfn) \ 02262 SfnDWORD(pwnd, msg, wParam, lParam, xpfn, \ 02263 ((PROC)(gpsi->apfnClientW.pfnDispatchMessage)), TRUE, NULL) 02264 #define CallClientProcW(pwnd, msg, wParam, lParam, xpfn) \ 02265 SfnDWORD(pwnd, msg, wParam, lParam, xpfn, \ 02266 ((PROC)(gpsi->apfnClientW.pfnDispatchMessage)), TRUE, NULL) 02267 #define CallClientWorkerProc(pwnd, msg, wParam, lParam, xpfn) \ 02268 SfnDWORD(pwnd, msg, wParam, lParam, 0, xpfn, TRUE, NULL) 02269 #define ScSendMessageSMS(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms) \ 02270 (((msg) & ~MSGFLAG_MASK) >= WM_USER) ? \ 02271 SfnDWORD(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms) : \ 02272 gapfnScSendMessage[MessageTable[msg & 0xffff].iFunction](pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms) 02273 #define ScSendMessage(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags) \ 02274 ScSendMessageSMS(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, NULL) 02275 02276 /* 02277 * Server-side routines for loading cursors/icons/strings/menus from server. 02278 */ 02279 #define SERVERSTRINGMAXSIZE 40 02280 void RtlInitUnicodeStringOrId(PUNICODE_STRING pstrName, LPWSTR lpstrName); 02281 int RtlLoadStringOrError(UINT, LPTSTR, int, WORD); 02282 #define ServerLoadString(hmod, id, p, cch)\ 02283 RtlLoadStringOrError(id, p, cch, 0) 02284 #define ServerLoadStringEx(hmod, id, p, cch, wLang)\ 02285 RtlLoadStringOrError(id, p, cch, wLang) 02286 02287 /* 02288 * Callback routines for loading resources from client. 02289 */ 02290 HANDLE xxxClientLoadImage( 02291 PUNICODE_STRING pstrName, 02292 ATOM atomModName, 02293 WORD wImageType, 02294 int cxSize, 02295 int cySize, 02296 UINT LR_flags, 02297 BOOL fWallpaper); 02298 02299 HANDLE xxxClientCopyImage( 02300 IN HANDLE hImage, 02301 IN UINT uImageType, 02302 IN int cxDesired, 02303 IN int cyDesired, 02304 IN UINT LR_flags); 02305 02306 PMENU xxxClientLoadMenu( 02307 HANDLE hmod, 02308 PUNICODE_STRING pstrName); 02309 02310 int xxxClientAddFontResourceW(PUNICODE_STRING, DWORD, DESIGNVECTOR*); 02311 02312 VOID ClientFontSweep(VOID); 02313 VOID ClientLoadLocalT1Fonts(); 02314 VOID ClientLoadRemoteT1Fonts(); 02315 02316 /* 02317 * Server-side routine for thread initialization. 02318 */ 02319 NTSTATUS InitializeClientPfnArrays( 02320 CONST PFNCLIENT *ppfnClientA, 02321 CONST PFNCLIENT *ppfnClientW, 02322 CONST PFNCLIENTWORKER *ppfnClientWorker, 02323 HANDLE hModUser); 02324 02325 //VOID _SetDebugErrorLevel(DWORD); 02326 VOID _SetRipFlags(DWORD, DWORD); 02327 VOID _SetDbgTag(int, DWORD); 02328 02329 02330 /* 02331 * xxxActivateWindow() commands 02332 */ 02333 #define AW_USE 1 02334 #define AW_TRY 2 02335 #define AW_SKIP 3 02336 #define AW_TRY2 4 02337 #define AW_SKIP2 5 /* used internally in xxxActivateWindow() */ 02338 #define AW_USE2 6 /* nc mouse activation added by craigc */ 02339 02340 /* 02341 * Structure for WM_ACTIVATEAPP EnumWindows() callback. 02342 */ 02343 typedef struct tagAAS { 02344 PTHREADINFO ptiNotify; 02345 DWORD tidActDeact; 02346 UINT fActivating : 1; 02347 UINT fQueueNotify : 1; 02348 } AAS; 02349 02350 /* 02351 * Declaration for EnumWindows() callback function. 02352 */ 02353 BOOL xxxActivateApp(PWND pwnd, AAS *paas); 02354 02355 #define GETDESKINFO(pti) ((pti)->pDeskInfo) 02356 02357 #define SET_TIME_LAST_READ(pti) ((pti)->pcti->timeLastRead = NtGetTickCount()) 02358 #define GET_TIME_LAST_READ(pti) ((pti)->pcti->timeLastRead) 02359 02360 02361 /* 02362 * General purpose helper macros 02363 */ 02364 #define abs(A) (((A) < 0)? -(A) : (A)) 02365 02366 #define N_ELEM(a) (sizeof(a)/sizeof(a[0])) 02367 #define LAST_ELEM(a) ( (a) [ N_ELEM(a) - 1 ] ) 02368 #define PLAST_ELEM(a) (&LAST_ELEM(a)) 02369 02370 02371 /* 02372 * General purpose access check macro 02373 */ 02374 #define RETURN_IF_ACCESS_DENIED(amGranted, amRequested, r) \ 02375 if (!CheckGrantedAccess((amGranted), (amRequested))) return r 02376 02377 /* 02378 * Lock record structure for tracking locks (debug only) 02379 */ 02380 02381 #define LOCKRECORD_STACK 8 02382 #define LOCKRECORD_MARKDESTROY IntToPtr( 0xFFFFFFFF ) 02383 02384 typedef struct _LOCKRECORD { 02385 PLR plrNext; 02386 DWORD cLockObj; 02387 PVOID ppobj; 02388 PVOID trace[LOCKRECORD_STACK]; 02389 } LOCKRECORD; 02390 02391 /* 02392 * We limit recursion until if we have only this much stack left. 02393 * We have to leave room for kernel interupts 02394 */ 02395 #define KERNEL_STACK_MINIMUM_RESERVE (4*1024) 02396 02397 /* 02398 * The following is a LOCK structure. This structure is recorded for 02399 * each threadlock so unlocks can occur at cleanup time. 02400 */ 02401 typedef struct _LOCK { 02402 PTHREADINFO pti; 02403 PVOID pobj; 02404 PTL ptl; 02405 #if DBG 02406 PVOID pfn; // for debugging purposes only 02407 int ilNext; // for debugging purposes only 02408 int iilPrev; // for debugging purposes only 02409 #endif // DBG 02410 } LOCK, *PLOCK; 02411 02412 #define NEEDSSYNCPAINT(pwnd) TestWF(pwnd, WFSENDERASEBKGND | WFSENDNCPAINT) 02413 02414 typedef struct tagCVR // cvr 02415 { 02416 WINDOWPOS pos; // MUST be first field of CVR! 02417 int xClientNew; // New client rectangle 02418 int yClientNew; 02419 int cxClientNew; 02420 int cyClientNew; 02421 RECT rcBlt; 02422 int dxBlt; // Distance blt rectangle is moving 02423 int dyBlt; 02424 UINT fsRE; // RE_ flags: whether hrgnVisOld is empty or not 02425 HRGN hrgnVisOld; // Previous visrgn 02426 PTHREADINFO pti; // The thread this SWP should be processed on 02427 HRGN hrgnClip; // Window clipping region 02428 HRGN hrgnInterMonitor; // multimon support 02429 } CVR, *PCVR; 02430 02431 /* 02432 * CalcValidRects() "Region Empty" flag values 02433 * A set bit indicates the corresponding region is empty. 02434 */ 02435 #define RE_VISNEW 0x0001 // CVR "Region Empty" flag values 02436 #define RE_VISOLD 0x0002 // A set bit indicates the 02437 #define RE_VALID 0x0004 // corresponding region is empty. 02438 #define RE_INVALID 0x0008 02439 #define RE_SPB 0x0010 02440 #define RE_VALIDSUM 0x0020 02441 #define RE_INVALIDSUM 0x0040 02442 02443 typedef struct tagSMWP { // smwp 02444 HEAD head; 02445 UINT bShellNotify:1; // The acvr list contains shell notify flags 02446 UINT bHandle:1; // This is an HM object allocation -- See -BeginDeferWindowPos 02447 /* 02448 * All fields AFTER ccvr are preserved when reusing the global SMWP structure. 02449 */ 02450 int ccvr; // Number of CVRs in the SWMP 02451 int ccvrAlloc; // Number of actual CVRs allocated in the SMWP 02452 PCVR acvr; // Pointer to array of CVR structures 02453 } SMWP, *PSMWP; 02454 02455 void DestroySMWP(PSMWP psmwp); 02456 02457 /* 02458 * Clipboard data object definition 02459 */ 02460 typedef struct tagCLIPDATA { 02461 HEAD head; 02462 DWORD cbData; 02463 BYTE abData[0]; 02464 } CLIPDATA, *PCLIPDATA; 02465 02466 /* 02467 * Private User Startupinfo 02468 */ 02469 typedef struct tagUSERSTARTUPINFO { 02470 DWORD cb; 02471 DWORD dwX; 02472 DWORD dwY; 02473 DWORD dwXSize; 02474 DWORD dwYSize; 02475 DWORD dwFlags; 02476 WORD wShowWindow; 02477 WORD cbReserved2; 02478 } USERSTARTUPINFO, *PUSERSTARTUPINFO; 02479 02480 /* 02481 * TLBLOCK structure for multiple threads locking. 02482 */ 02483 #define THREADS_PER_TLBLOCK 16 02484 02485 typedef struct tagTLBLOCK { 02486 struct tagTLBLOCK *ptlBlockPrev; 02487 struct { 02488 PTHREADINFO pti; 02489 TL tlpti; 02490 DWORD dwFlags; 02491 #if DBG 02492 DWORD dwUnlockedCount; 02493 #endif 02494 } list[THREADS_PER_TLBLOCK]; 02495 } TLBLOCK, *PTLBLOCK; 02496 02497 /* 02498 * Keyboard File object 02499 */ 02500 typedef struct tagKBDFILE { 02501 HEAD head; 02502 struct tagKBDFILE *pkfNext; // next keyboard file 02503 WCHAR awchKF[9]; // Name of Layout eg: L"00000409" 02504 HANDLE hBase; // base address of data 02505 PKBDTABLES pKbdTbl; // pointer to kbd layout data. 02506 ULONG Size; // Size of pKbdTbl 02507 PKBDNLSTABLES pKbdNlsTbl; // pointer to kbd nls layout data. 02508 } KBDFILE, *PKBDFILE; 02509 02510 /* 02511 * Keyboard Layout object 02512 */ 02513 typedef struct tagKL { /* kl */ 02514 HEAD head; 02515 struct tagKL *pklNext; // next in layout cycle 02516 struct tagKL *pklPrev; // prev in layout cycle 02517 DWORD dwKL_Flags; // KL_* flags 02518 HKL hkl; // (Layout ID | Base Language ID) 02519 KBDFILE *spkf; // Keyboard Layout File 02520 DWORD dwFontSigs; // mask of FS_xxx bits - fonts that layout is good for 02521 UINT iBaseCharset;// Charset value (Win95 compat) eg: ANSI_CHARSET 02522 WORD CodePage; // Windows Codepage of kbd layout, eg: 1252, 1250 02523 WCHAR wchDiacritic;// Dead key saved here until next keystroke 02524 PIMEINFOEX piiex; // Extended information for IME based layout 02525 } KL, *PKL; 02526 02527 /* 02528 * Flag values for KL dwFlags 02529 */ 02530 #define KL_UNLOADED 0x20000000 02531 #define KL_RESET 0x40000000 02532 02533 02534 PKL HKLtoPKL(PTHREADINFO pti, HKL hkl); 02535 02536 typedef struct tagKBDLANGTOGGLE 02537 { 02538 BYTE bVkey; 02539 BYTE bScan; 02540 int iBitPosition; 02541 } KBDLANGTOGGLE; 02542 02543 /* 02544 * These constants are derived from combinations of 02545 * iBitPosition (refer to the LangToggle array defined 02546 * in globals.c). 02547 */ 02548 02549 /* 02550 * This bit is used for both control and alt keys 02551 */ 02552 #define KLT_ALT 1 02553 02554 /* 02555 * This bit is used for the left shift key 02556 */ 02557 #define KLT_LEFTSHIFT 2 02558 02559 /* 02560 * This combination denotes ctrl/alt and the left shift key 02561 */ 02562 #define KLT_ALTLEFTSHIFT 3 02563 02564 /* 02565 * This bit is used for the right shift key 02566 */ 02567 #define KLT_RIGHTSHIFT 4 02568 02569 /* 02570 * This combination denotes ctrl/alt and the right shift key 02571 */ 02572 #define KLT_ALTRIGHTSHIFT 5 02573 02574 /* 02575 * This combination denotes ctrl/alt and both the shift keys 02576 */ 02577 #define KLT_ALTBOTHSHIFTS 7 02578 02579 /* 02580 * This value is used to mark invalid toggle key sequence 02581 */ 02582 #define KLT_NONE 8 02583 02584 02585 /* 02586 * Desktop flags 02587 */ 02588 #define DF_DYING 0x80000000 02589 #define DF_DESKWNDDESTROYED 0x40000000 02590 #define DF_DESTROYED 0x20000000 02591 #define DF_HOTTRACKING 0x10000000 02592 #define DF_TOOLTIPSHOWING 0x08000000 02593 #define DF_TOOLTIPACTIVE 0x04000000 02594 #define DF_TOOLTIP (DF_TOOLTIPACTIVE | DF_TOOLTIPSHOWING) 02595 #define DF_TRACKMOUSELEAVE 0x02000000 02596 #define DF_TRACKMOUSEHOVER 0x01000000 02597 #define DF_TRACKMOUSEEVENT (DF_TRACKMOUSELEAVE | DF_TRACKMOUSEHOVER) 02598 #define DF_MOUSEMOVETRK (DF_HOTTRACKING | DF_TOOLTIPACTIVE | DF_TRACKMOUSELEAVE | DF_TRACKMOUSEHOVER) 02599 #define DF_MENUINUSE 0x00800000 02600 #define DF_NEWDISPLAYSETTINGS 0x00400000 02601 #define DF_DESKCREATED 0x00200000 02602 02603 02604 02605 #define CAPTIONTOOLTIPLEN 100 02606 02607 /* 02608 * Used to identify desktops uniquely for GDI 02609 */ 02610 02611 #define GW_DESKTOP_ID 1 02612 02613 // #define DESKTOP_ALLOC_TRACE 02614 #define DESKTOP_ALLOC_TRACE_SIZE 6 02615 02616 #if DBG 02617 typedef struct tagDbgAllocHead { 02618 DWORD mark; 02619 DWORD tag; 02620 PDESKTOP pdesk; 02621 SIZE_T size; // the size of the allocation (doesn't include 02622 // this structure 02623 02624 struct tagDbgAllocHead* pPrev; // pointer to the previous allocation of this tag 02625 struct tagDbgAllocHead* pNext; // pointer to the next allocation of this tag 02626 02627 #ifdef DESKTOP_ALLOC_TRACE 02628 PVOID trace[DESKTOP_ALLOC_TRACE_SIZE]; 02629 #endif // DESKTOP_ALLOC_TRACE 02630 02631 } DbgAllocHead, *PDbgAllocHead; 02632 #endif // DBG 02633 02634 #define DTAG_CLASS 0x0001 02635 #define DTAG_DESKTOPINFO 0x0002 02636 #define DTAG_CLIENTTHREADINFO 0x0003 02637 #define DTAG_TEXT 0x0004 02638 #define DTAG_HANDTABL 0x0005 02639 #define DTAG_SBINFO 0x0006 02640 #define DTAG_MENUITEM 0x0007 02641 #define DTAG_MENUTEXT 0x0008 02642 #define DTAG_IMETEXT 0x0009 02643 #define DTAG_PROPLIST 0x000A 02644 02645 /* 02646 * Desktop Structure. 02647 * 02648 * This structure is only viewable from the kernel. If any desktop 02649 * information is needed in the client, then they should reference off 02650 * the pDeskInfo field (i.e. pti->pDeskInfo). 02651 */ 02652 typedef struct tagDESKTOP { 02653 02654 PDESKTOPINFO pDeskInfo; // Desktop information 02655 PDISPLAYINFO pDispInfo; // 02656 02657 PDESKTOP rpdeskNext; // Next desktop in list 02658 PWINDOWSTATION rpwinstaParent; // Windowstation owner 02659 02660 DWORD dwDTFlags; // Desktop flags 02661 ULONG dwDesktopId; // Needed by GDI to tag display devices 02662 02663 PWND spwndMenu; // 02664 PMENU spmenuSys; // 02665 PMENU spmenuDialogSys; // 02666 PMENU spmenuHScroll; 02667 PMENU spmenuVScroll; 02668 PWND spwndForeground; // 02669 PWND spwndTray; 02670 PWND spwndMessage; 02671 PWND spwndTooltip; 02672 02673 HANDLE hsectionDesktop; // 02674 PWIN32HEAP pheapDesktop; // 02675 DWORD dwConsoleThreadId; // 02676 DWORD dwConsoleIMEThreadId; 02677 CONSOLE_CARET_INFO cciConsole; 02678 LIST_ENTRY PtiList; // 02679 02680 PWND spwndTrack; // xxxTrackMouseMove data 02681 int htEx; 02682 RECT rcMouseHover; 02683 DWORD dwMouseHoverTime; 02684 02685 DWORD dwSessionId; 02686 02687 #ifdef LOGDESKTOPLOCKS 02688 int nLockCount; 02689 int nLogMax; 02690 int nLogCrt; 02691 PLogD pLog; 02692 #endif // LOGDESKTOPLOCKS 02693 02694 } DESKTOP; 02695 02696 typedef struct tagDESKWND { 02697 WND wnd; 02698 DWORD idProcess; 02699 DWORD idThread; 02700 } DESKWND, *PDESKWND; 02701 02702 PVOID DesktopAlloc(PDESKTOP pdesk, UINT uSize,DWORD tag); 02703 02704 #define DesktopAllocAlways(pdesk, uSize, tag) \ 02705 Win32HeapAlloc(pdesk->pheapDesktop, uSize, tag, 0) 02706 02707 #define DesktopFree(pdesk, p) Win32HeapFree(pdesk->pheapDesktop, p) 02708 02709 /* 02710 * Windowstation structure 02711 */ 02712 #define WSF_SWITCHLOCK 0x0001 02713 #define WSF_OPENLOCK 0x0002 02714 #define WSF_NOIO 0x0004 02715 #define WSF_SHUTDOWN 0x0008 02716 #define WSF_DYING 0x0010 02717 02718 #define WSF_REALSHUTDOWN 0x0020 02719 02720 typedef struct tagWINDOWSTATION { 02721 PWINDOWSTATION rpwinstaNext; 02722 PDESKTOP rpdeskList; 02723 02724 PTERMINAL pTerm; 02725 /* 02726 * Pointer to the currently active desktop for the window station. 02727 */ 02728 DWORD dwWSF_Flags; 02729 struct tagKL *spklList; 02730 02731 /* 02732 * Clipboard variables 02733 */ 02734 PTHREADINFO ptiClipLock; 02735 PTHREADINFO ptiDrawingClipboard; 02736 PWND spwndClipOpen; 02737 PWND spwndClipViewer; 02738 PWND spwndClipOwner; 02739 struct tagCLIP *pClipBase; 02740 int cNumClipFormats; 02741 UINT iClipSerialNumber; 02742 UINT iClipSequenceNumber; 02743 UINT fClipboardChanged : 1; 02744 UINT fInDelayedRendering : 1; 02745 02746 /* 02747 * Global Atom table 02748 */ 02749 PVOID pGlobalAtomTable; 02750 02751 LUID luidEndSession; 02752 LUID luidUser; 02753 PSID psidUser; 02754 PQ pqDesktop; 02755 02756 DWORD dwSessionId; 02757 02758 #if DBG 02759 PDESKTOP pdeskCurrent; 02760 #endif // DBG 02761 02762 } WINDOWSTATION; 02763 02764 typedef struct tagCAPTIONCACHE { 02765 PCURSOR spcursor; 02766 POEMBITMAPINFO pOem; 02767 #if DBG 02768 HICON hico; 02769 #endif // DBG 02770 } CAPTIONCACHE; 02771 02772 /* 02773 * Configurable icon and cursor stuff 02774 */ 02775 typedef struct tagSYSCFGICO 02776 { 02777 WORD Id; // configurable id (OIC_ or OCR_ value) 02778 WORD StrId; // String ID for registry key name 02779 PCURSOR spcur; // perminant cursor/icon pointer 02780 } SYSCFGICO; 02781 02782 #define SYSICO(name) (gasysico[OIC_##name##_DEFAULT - OIC_FIRST_DEFAULT].spcur) 02783 #define SYSCUR(name) (gasyscur[OCR_##name##_DEFAULT - OCR_FIRST_DEFAULT].spcur) 02784 02785 02786 /* 02787 * Accelerator Table structure 02788 */ 02789 typedef struct tagACCELTABLE { 02790 PROCOBJHEAD head; 02791 UINT cAccel; 02792 ACCEL accel[1]; 02793 } ACCELTABLE, *LPACCELTABLE; 02794 02795 /* 02796 * Besides the desktop window used by the current thread, we also 02797 * need to get the desktop window of a window and the input desktop 02798 * window. 02799 */ 02800 #define PWNDDESKTOP(p) ((p)->head.rpdesk->pDeskInfo->spwnd) 02801 #define PWNDMESSAGE(p) ((p)->head.rpdesk->spwndMessage) 02802 #define PWNDTOOLTIP(p) ((p)->head.rpdesk->spwndTooltip) 02803 02804 /* 02805 * During window destruction, even a locked window can have a 02806 * NULL parent so use this macro where a NULL parent is a problem. 02807 */ 02808 #define PWNDPARENT(p) (p->spwndParent ? p->spwndParent : PWNDDESKTOP(p)) 02809 02810 #define ISAMENU(pwwnd) \ 02811 (GETFNID(pwnd) == FNID_MENU) 02812 02813 02814 /* NEW MENU STUFF */ 02815 typedef struct tagPOPUPMENU 02816 { 02817 02818 DWORD fIsMenuBar:1; /* This is a hacked struct which refers to the 02819 * menu bar associated with a app. Only true if 02820 * in the root ppopupMenuStruct. 02821 */ 02822 DWORD fHasMenuBar:1; /* This popup is part of a series which has a 02823 * menu bar (either a sys menu or top level menu 02824 * bar) 02825 */ 02826 DWORD fIsSysMenu:1; /* The system menu is here. */ 02827 DWORD fIsTrackPopup:1; /* Is TrackPopup popup menu */ 02828 DWORD fDroppedLeft:1; 02829 DWORD fHierarchyDropped:1;/* If true, a submenu has been dropped off this popup */ 02830 DWORD fRightButton:1; /* Allow right button in menu */ 02831 DWORD fToggle:1; /* If TRUE, button up cancels the popup */ 02832 DWORD fSynchronous:1; /* For synchronous return value of cmd chosen */ 02833 DWORD fFirstClick:1; /* Keep track if this was the first click on the 02834 * top level menu bar item. If the user down/up 02835 * clicks on a top level menu bar item twice, we 02836 * want to cancel menu mode. 02837 */ 02838 DWORD fDropNextPopup:1; /* Should we drop hierarchy of next menu item w/ popup? */ 02839 DWORD fNoNotify:1; /* Don't send WM_ msgs to owner, except WM_COMMAND */ 02840 DWORD fAboutToHide:1; // Same purpose as fHideTimer? 02841 DWORD fShowTimer:1; // TRUE if the IDSYS_MNSHOW timer is set 02842 DWORD fHideTimer:1; // TRUE if the IDSYS_MNHIDE timer is set 02843 02844 DWORD fDestroyed:1; /* Set when the owner menu window has been destroyed 02845 * so the popup can be freed once it's no longer needed 02846 * Also set in root popupmenu when menu mode must end 02847 */ 02848 02849 DWORD fDelayedFree:1; /* Avoid freeing the popup when the owner menu 02850 * window is destroyed. 02851 * If set, it must be a root popupmenu or must 02852 * be linked in ppmDelayedFree 02853 * This is eventually set for all hierarchical popups 02854 */ 02855 02856 DWORD fFlushDelayedFree:1; /* Used in root popupmenus only. 02857 * Set when a hierarchical popup marked as fDelayedFree 02858 * has been destroyed. 02859 */ 02860 02861 02862 DWORD fFreed:1; /* Popup has been freed. Used for debug only */ 02863 02864 DWORD fInCancel:1; /* Popup has been passed to xxxMNCancel */ 02865 02866 DWORD fTrackMouseEvent:1; /* TrackMouseEvent has been called */ 02867 DWORD fSendUninit:1; /* Send WM_UNINITMENUPOPUP */ 02868 DWORD fRtoL:1; /* For going backwards with the keys */ 02869 DWORD fDesktopMenu:1; /* Set if this popup belons to the pdesk->spwndMenu window */ 02870 DWORD iDropDir:5; /* Animation direction */ 02871 02872 02873 PWND spwndNotify; 02874 /* Window who gets the notification messages. If this 02875 * is a window with a menu bar, then this is the same 02876 * as hwndPopupMenu. 02877 */ 02878 PWND spwndPopupMenu; 02879 /* The window associated with this ppopupMenu struct. 02880 * If this is a top level menubar, then hwndPopupMenu 02881 * is the window the menu bar. ie. it isn't really a 02882 * popup menu window. 02883 */ 02884 PWND spwndNextPopup; 02885 /* The next popup in the hierarchy. Null if the last 02886 * in chain 02887 */ 02888 PWND spwndPrevPopup; 02889 /* The previous popup in the hierarchy. NULL if at top 02890 */ 02891 PMENU spmenu;/* The PMENU displayed in this window 02892 */ 02893 PMENU spmenuAlternate; 02894 /* Alternate PMENU. If the system menu is displayed, 02895 * and a menubar menu exists, this will contain the 02896 * menubar menu. If menubar menu is displayed, this 02897 * will contain the system menu. Use only on top level 02898 * ppopupMenu structs so that we can handle windows 02899 * with both a system menu and a menu bar menu. Only 02900 * used in the root ppopupMenuStruct. 02901 */ 02902 02903 PWND spwndActivePopup; /* This is the popup the mouse/"keyboard focus" is on */ 02904 02905 PPOPUPMENU ppopupmenuRoot; 02906 02907 PPOPUPMENU ppmDelayedFree; /* List of hierarchical popups marked 02908 * as fDelayedFree. 02909 */ 02910 02911 UINT posSelectedItem; /* Position of the selected item in this menu 02912 */ 02913 UINT posDropped; 02914 02915 } POPUPMENU; 02916 02917 typedef struct tagMENUWND { 02918 WND wnd; 02919 PPOPUPMENU ppopupmenu; 02920 } MENUWND, *PMENUWND; 02921 02922 /* 02923 * CheckPoint structure 02924 */ 02925 typedef struct tagCHECKPOINT { 02926 RECT rcNormal; 02927 POINT ptMin; 02928 POINT ptMax; 02929 DWORD fDragged:1; 02930 DWORD fWasMaximizedBeforeMinimized:1; 02931 DWORD fWasMinimizedBeforeMaximized:1; 02932 DWORD fMinInitialized:1; 02933 DWORD fMaxInitialized:1; 02934 } CHECKPOINT, *PCHECKPOINT; 02935 02936 02937 #define dpHorzRes HORZRES 02938 #define dpVertRes VERTRES 02939 02940 /* 02941 * If the handle for CF_TEXT/CF_OEMTEXT is a dummy handle then this implies 02942 * that data is available in the other format (as CF_OEMTEXT/CF_TEXT) 02943 */ 02944 #define DUMMY_TEXT_HANDLE 0xFFFF 02945 #define DATA_NOT_BANKED 0xFFFF 02946 02947 typedef struct tagCLIP { 02948 UINT fmt; 02949 HANDLE hData; 02950 BOOL fGlobalHandle; 02951 } CLIP, *PCLIP; 02952 02953 /* 02954 * DDEML instance structure 02955 */ 02956 typedef struct tagSVR_INSTANCE_INFO { 02957 THROBJHEAD head; 02958 struct tagSVR_INSTANCE_INFO *next; 02959 struct tagSVR_INSTANCE_INFO *nextInThisThread; 02960 DWORD afCmd; 02961 PWND spwndEvent; 02962 PVOID pcii; 02963 } SVR_INSTANCE_INFO, *PSVR_INSTANCE_INFO; 02964 02965 typedef struct tagPUBOBJ { 02966 struct tagPUBOBJ *next; 02967 HANDLE hObj; 02968 int count; 02969 // 02970 // BUGBUG, MAKE FIELD USHORT!!! 02971 // 02972 W32PID pid; 02973 } PUBOBJ, *PPUBOBJ; 02974 02975 /* 02976 * Defines for Menu focus 02977 */ 02978 #define FREEHOLD 0 02979 #define MOUSEHOLD -1 /* Mouse button held down and dragging */ 02980 #define KEYBDHOLD 1 02981 02982 /* 02983 * Structure definition for messages as they exist on a Q. Same as MSG 02984 * structure except for the link-pointer and flags at the end. 02985 */ 02986 typedef struct tagQMSG { 02987 PQMSG pqmsgNext; 02988 PQMSG pqmsgPrev; 02989 MSG msg; 02990 LONG_PTR ExtraInfo; 02991 DWORD dwQEvent; 02992 PTHREADINFO pti; 02993 } QMSG; 02994 02995 /* 02996 * dwQEvent values for QMSG structure. 02997 */ 02998 #define QEVENT_SHOWWINDOW 0x0001 02999 #define QEVENT_CANCELMODE 0x0002 03000 #define QEVENT_SETWINDOWPOS 0x0003 03001 #define QEVENT_UPDATEKEYSTATE 0x0004 03002 #define QEVENT_DEACTIVATE 0x0005 03003 #define QEVENT_ACTIVATE 0x0006 03004 #define QEVENT_POSTMESSAGE 0x0007 // Chicago 03005 #define QEVENT_EXECSHELL 0x0008 // Chicago 03006 #define QEVENT_CANCELMENU 0x0009 // Chicago 03007 #define QEVENT_DESTROYWINDOW 0x000A 03008 #define QEVENT_ASYNCSENDMSG 0x000B 03009 #define QEVENT_HUNGTHREAD 0x000C 03010 #define QEVENT_CANCELMOUSEMOVETRK 0x000D 03011 #define QEVENT_NOTIFYWINEVENT 0x000E 03012 #define QEVENT_RITACCESSIBILITY 0x000F 03013 #define QEVENT_RITSOUND 0x0010 03014 // QEvent for WM_APPCOMMAND messages - bug 339877 03015 #define QEVENT_APPCOMMAND 0x0011 03016 03017 #define RITSOUND_UPSIREN 0x0000 03018 #define RITSOUND_DOWNSIREN 0x0001 03019 #define RITSOUND_LOWBEEP 0x0002 03020 #define RITSOUND_HIGHBEEP 0x0003 03021 #define RITSOUND_KEYCLICK 0x0004 03022 #define RITSOUND_DOBEEP 0x0005 03023 03024 /* 03025 * xxxProcessEventMessage flags 03026 */ 03027 #define PEM_ACTIVATE_RESTORE 0x0001 03028 #define PEM_ACTIVATE_NOZORDER 0x0002 03029 03030 typedef struct _MOVESIZEDATA { 03031 PWND spwnd; 03032 RECT rcDrag; 03033 RECT rcDragCursor; 03034 RECT rcParent; 03035 POINT ptMinTrack; 03036 POINT ptMaxTrack; 03037 RECT rcWindow; 03038 int dxMouse; 03039 int dyMouse; 03040 int cmd; 03041 int impx; 03042 int impy; 03043 POINT ptRestore; 03044 UINT fInitSize : 1; // should we initialize cursor pos 03045 UINT fmsKbd : 1; // who knows 03046 UINT fLockWindowUpdate : 1; // whether screen was locked ok 03047 UINT fTrackCancelled : 1; // Set if tracking ended by other thread. 03048 UINT fForeground : 1; // whether the tracking thread is foreground 03049 // and if we should draw the drag-rect 03050 UINT fDragFullWindows : 1; 03051 UINT fOffScreen : 1; 03052 } MOVESIZEDATA, *PMOVESIZEDATA; 03053 03054 /* 03055 * DrawDragRect styles. 03056 */ 03057 #define DDR_START 0 // - start drag. 03058 #define DDR_ENDACCEPT 1 // - end and accept 03059 #define DDR_ENDCANCEL 2 // - end and cancel. 03060 03061 03062 /* 03063 * Pseudo Event stuff. (fManualReset := TRUE, fInitState := FALSE) 03064 */ 03065 03066 DWORD WaitOnPseudoEvent(HANDLE *phE, DWORD dwMilliseconds); 03067 03068 #define PSEUDO_EVENT_ON ((HANDLE)IntToPtr( 0xFFFFFFFF )) 03069 #define PSEUDO_EVENT_OFF ((HANDLE)IntToPtr( 0x00000000 )) 03070 #define INIT_PSEUDO_EVENT(ph) *ph = PSEUDO_EVENT_OFF; 03071 03072 #define SET_PSEUDO_EVENT(phE) \ 03073 CheckCritIn(); \ 03074 if (*(phE) == PSEUDO_EVENT_OFF) *(phE) = PSEUDO_EVENT_ON; \ 03075 else if (*(phE) != PSEUDO_EVENT_ON) { \ 03076 KeSetEvent(*(phE), EVENT_INCREMENT, FALSE); \ 03077 ObDereferenceObject(*(phE)); \ 03078 *(phE) = PSEUDO_EVENT_ON; \ 03079 } 03080 03081 #define RESET_PSEUDO_EVENT(phE) \ 03082 CheckCritIn(); \ 03083 if (*(phE) == PSEUDO_EVENT_ON) *(phE) = PSEUDO_EVENT_OFF; \ 03084 else if (*(phE) != PSEUDO_EVENT_OFF) { \ 03085 KeClearEvent(*(phE)); \ 03086 } 03087 03088 #define CLOSE_PSEUDO_EVENT(phE) \ 03089 CheckCritIn(); \ 03090 if (*(phE) == PSEUDO_EVENT_ON) *(phE) = PSEUDO_EVENT_OFF; \ 03091 else if (*(phE) != PSEUDO_EVENT_OFF) { \ 03092 KeSetEvent(*(phE), EVENT_INCREMENT, FALSE); \ 03093 ObDereferenceObject(*(phE)); \ 03094 *(phE) = PSEUDO_EVENT_OFF; \ 03095 } 03096 03097 typedef struct tagMLIST { 03098 PQMSG pqmsgRead; 03099 PQMSG pqmsgWriteLast; 03100 DWORD cMsgs; 03101 } MLIST, *PMLIST; 03102 03103 /* 03104 * Message Queue structure. 03105 * 03106 * Note, if you need to add a WORD sized value, 03107 * do so after xbtnDblClk. 03108 */ 03109 typedef struct tagQ { 03110 MLIST mlInput; // raw mouse and key message list. 03111 03112 PTHREADINFO ptiSysLock; // Thread currently allowed to process input 03113 ULONG_PTR idSysLock; // Last message removed 03114 ULONG_PTR idSysPeek; // Last message peeked 03115 03116 PTHREADINFO ptiMouse; // Last thread to get mouse msg. 03117 PTHREADINFO ptiKeyboard; 03118 03119 PWND spwndCapture; 03120 PWND spwndFocus; 03121 PWND spwndActive; 03122 PWND spwndActivePrev; 03123 03124 UINT codeCapture; 03125 UINT msgDblClk; 03126 WORD xbtnDblClk; 03127 DWORD timeDblClk; 03128 HWND hwndDblClk; 03129 POINT ptDblClk; 03130 03131 BYTE afKeyRecentDown[CBKEYSTATERECENTDOWN]; 03132 BYTE afKeyState[CBKEYSTATE]; 03133 03134 CARET caret; 03135 03136 PCURSOR spcurCurrent; 03137 int iCursorLevel; 03138 03139 DWORD QF_flags; // QF_ flags go here 03140 03141 USHORT cThreads; // Count of threads using this queue 03142 USHORT cLockCount; // Count of threads that don't want this queue freed 03143 03144 UINT msgJournal; 03145 LONG_PTR ExtraInfo; 03146 } Q; 03147 03148 /* 03149 * Used for zzzAttachThreadInput() 03150 */ 03151 typedef struct tagATTACHINFO { 03152 struct tagATTACHINFO *paiNext; 03153 PTHREADINFO pti1; 03154 PTHREADINFO pti2; 03155 } ATTACHINFO, *PATTACHINFO; 03156 03157 #define POLL_EVENT_CNT 5 03158 03159 #define IEV_IDLE 0 03160 #define IEV_INPUT 1 03161 #define IEV_EXEC 2 03162 #define IEV_TASK 3 03163 #define IEV_WOWEXEC 4 03164 03165 03166 typedef struct tagWOWTHREADINFO { 03167 struct tagWOWTHREADINFO *pwtiNext; 03168 DWORD idTask; // WOW task id 03169 ULONG_PTR idWaitObject; // pseudo handle returned to parent 03170 DWORD idParentProcess; // process that called CreateProcess 03171 PKEVENT pIdleEvent; // event that WaitForInputIdle will wait on 03172 } WOWTHREADINFO, *PWOWTHREADINFO; 03173 03174 /* 03175 * Task Data Block structure. 03176 */ 03177 typedef struct tagTDB { 03178 PTDB ptdbNext; 03179 int nEvents; 03180 int nPriority; 03181 PTHREADINFO pti; 03182 PWOWTHREADINFO pwti; // per thread info for shared Wow 03183 WORD hTaskWow; // Wow cookie to find apps during shutdown 03184 WORD TDB_Flags; // bit 0 means setup app 03185 } TDB; 03186 03187 #define TDBF_SETUP 1 03188 03189 03190 /* 03191 * Hack message for shell to tell them a setup app is exiting. 03192 * This message is defined in \nt\private\shell\inc, but I really 03193 * don't want to introduce that dependency in the build. DavidDS 03194 * has put a check in that file to make sure that the value does not 03195 * change and refers to this usage. FritzS 03196 */ 03197 #define DTM_SETUPAPPRAN (WM_USER+90) 03198 03199 /* 03200 * Menu animation GDI objects. 03201 */ 03202 typedef struct tagMENUANIDC 03203 { 03204 HDC hdcAni; // Scratch dc for animation 03205 } MENUANIDC; 03206 03207 /* 03208 * Menu Control Structure 03209 */ 03210 typedef struct tagMENUSTATE { 03211 PPOPUPMENU pGlobalPopupMenu; 03212 DWORD fMenuStarted : 1; 03213 DWORD fIsSysMenu : 1; 03214 DWORD fInsideMenuLoop : 1; 03215 DWORD fButtonDown:1; 03216 DWORD fInEndMenu:1; 03217 DWORD fUnderline:1; /* Shorcut key underlines are shown */ 03218 DWORD fButtonAlwaysDown:1; /* The mouse has always been down since the menu started */ 03219 DWORD fDragging:1; /* Dragging (in DoDragDrop) or about to */ 03220 DWORD fModelessMenu:1; /* No modal loop */ 03221 DWORD fInCallHandleMenuMessages:1;/* processing a msg from CallHandleMM */ 03222 DWORD fDragAndDrop:1; /* This menu can do drag and drop */ 03223 DWORD fAutoDismiss:1; /* This menu goes away on its own if mouse is off for certain time */ 03224 DWORD fAboutToAutoDismiss:1; /* Autodismiss will take place when timer goes off */ 03225 DWORD fIgnoreButtonUp:1; /* Eat next button up, i.e, cancel dragging */ 03226 DWORD fMouseOffMenu:1; /* Mouse is off the menu - modeless menus only */ 03227 DWORD fInDoDragDrop:1; /* in a WM_MENUDODRAGDROP callback */ 03228 DWORD fActiveNoForeground:1; /* A menu window is active but we're not in the foreground */ 03229 DWORD fNotifyByPos:1; /* Use WM_MENUCOMMAND */ 03230 DWORD fSetCapture:1; /* True if the menu mode set capture */ 03231 DWORD iAniDropDir:5; /* direction of animation */ 03232 03233 POINT ptMouseLast; 03234 int mnFocus; 03235 int cmdLast; 03236 PTHREADINFO ptiMenuStateOwner; 03237 03238 DWORD dwLockCount; 03239 03240 struct tagMENUSTATE *pmnsPrev; /* Previous menustate for nested/context menus */ 03241 03242 POINT ptButtonDown; /* Mouse down position (begin drag position) */ 03243 ULONG_PTR uButtonDownHitArea; /* Return from xxxMNFindWindowFromPoint on button down */ 03244 UINT uButtonDownIndex; /* Index of the item being dragged */ 03245 03246 int vkButtonDown; /* Mouse button being dragged */ 03247 03248 ULONG_PTR uDraggingHitArea; /* Last hit area while InDoDragDrop */ 03249 UINT uDraggingIndex; /* Last index */ 03250 UINT uDraggingFlags; /* Gap flags */ 03251 03252 HDC hdcWndAni; // window DC while animating 03253 DWORD dwAniStartTime; // starting time of animation 03254 int ixAni; // current x-step in animation 03255 int iyAni; // current y-step in animation 03256 int cxAni; // total x in animation 03257 int cyAni; // total y in animation 03258 HBITMAP hbmAni; // Scratch bmp for animation. 03259 03260 /* 03261 * Important: The following structure must be the last 03262 * thing in tagMENUSTATE. MNAllocMenuState doesn't NULL out 03263 * this structure 03264 */ 03265 MENUANIDC; 03266 03267 } MENUSTATE, *PMENUSTATE; 03268 03269 typedef struct tagLASTINPUT { /* linp */ 03270 DWORD timeLastInputMessage; 03271 DWORD dwFlags; 03272 PTHREADINFO ptiLastWoken; /* Last thread woken by key or click */ 03273 /* It can be NULL */ 03274 POINT ptLastClick; /* point of the last mouse click */ 03275 } LASTINPUT, PLASTINPUT; 03276 03277 #define LINP_KEYBOARD 0x00000001 03278 #define LINP_SCREENSAVER 0x00000002 03279 #define LINP_LOWPOWER 0x00000004 03280 #define LINP_POWEROFF 0x00000008 03281 #define LINP_POWERTIMEOUTS (LINP_LOWPOWER | LINP_POWEROFF) 03282 #define LINP_INPUTTIMEOUTS (LINP_SCREENSAVER | LINP_LOWPOWER | LINP_POWEROFF) 03283 03284 /* 03285 * Menu data to be passed to xxxRealDrawMenuItem from xxxDrawState 03286 */ 03287 typedef struct { 03288 PMENU pMenu; 03289 PITEM pItem; 03290 } GRAYMENU; 03291 typedef GRAYMENU *PGRAYMENU; 03292 03293 03294 #define IS_THREAD_RESTRICTED(pti, r) \ 03295 ((pti->TIF_flags & TIF_RESTRICTED) ? \ 03296 (pti->ppi->pW32Job->restrictions & (r)) : \ 03297 FALSE) 03298 03299 #define IS_CURRENT_THREAD_RESTRICTED(r) \ 03300 ((PtiCurrent()->TIF_flags & TIF_RESTRICTED) ? \ 03301 (PtiCurrent()->ppi->pW32Job->restrictions & (r)) : \ 03302 FALSE) 03303 03304 /* 03305 * These types are needed before they are fully defined. 03306 */ 03307 typedef struct tagSMS * KPTR_MODIFIER PSMS; 03308 03309 /* 03310 * Make sure this structure matches up with W32THREAD, since they're 03311 * really the same thing. 03312 */ 03313 03314 /* 03315 * NOTE -- this structure has been sorted (roughly) in order of use 03316 * of the fields. The x86 code set allows cheaper access to fields 03317 * that are in the first 0x80 bytes of a structure. Please attempt 03318 * to ensure that frequently-used fields are below this boundary. 03319 * FritzS 03320 */ 03321 03322 typedef struct tagTHREADINFO { 03323 W32THREAD; 03324 03325 //***************************************** begin: USER specific fields 03326 03327 PTL ptl; // Listhead for thread lock list 03328 03329 PPROCESSINFO ppi; // process info struct for this thread 03330 03331 PQ pq; // keyboard and mouse input queue 03332 03333 PKL spklActive; // active keyboard layout for this thread 03334 03335 PCLIENTTHREADINFO pcti; // Info that must be visible from client 03336 03337 PDESKTOP rpdesk; 03338 PDESKTOPINFO pDeskInfo; // Desktop info visible to client 03339 PCLIENTINFO pClientInfo; // Client info stored in TEB 03340 03341 DWORD TIF_flags; // TIF_ flags go here. 03342 03343 PUNICODE_STRING pstrAppName; // Application module name. 03344 03345 PSMS psmsSent; // Most recent SMS this thread has sent 03346 PSMS psmsCurrent; // Received SMS this thread is currently processing 03347 PSMS psmsReceiveList; // SMSs to be processed 03348 03349 LONG timeLast; // Time, position, and ID of last message 03350 ULONG_PTR idLast; 03351 03352 int cQuit; 03353 int exitCode; 03354 03355 HDESK hdesk; // Desktop handle 03356 int cPaintsReady; 03357 UINT cTimersReady; 03358 03359 PMENUSTATE pMenuState; 03360 03361 union { 03362 PTDB ptdb; // Win16Task Schedule data for WOW thread 03363 PWINDOWSTATION pwinsta; // Window station for SYSTEM thread 03364 }; 03365 03366 PSVR_INSTANCE_INFO psiiList; // thread DDEML instance list 03367 DWORD dwExpWinVer; 03368 DWORD dwCompatFlags; // The Win 3.1 Compat flags 03369 DWORD dwCompatFlags2; // new DWORD to extend compat flags for NT5+ features 03370 03371 PQ pqAttach; // calculation variabled used in 03372 // zzzAttachThreadInput() 03373 03374 PTHREADINFO ptiSibling; // pointer to sibling thread info 03375 03376 PMOVESIZEDATA pmsd; 03377 03378 DWORD fsHooks; // WHF_ Flags for which hooks are installed 03379 PHOOK sphkCurrent; // Hook this thread is currently processing 03380 03381 PSBTRACK pSBTrack; 03382 03383 HANDLE hEventQueueClient; 03384 PKEVENT pEventQueueServer; 03385 LIST_ENTRY PtiLink; // Link to other threads on desktop 03386 int iCursorLevel; // keep track of each thread's level 03387 POINT ptLast; 03388 03389 PWND spwndDefaultIme; // Default IME Window for this thread 03390 PIMC spDefaultImc; // Default input context for this thread 03391 HKL hklPrev; // Previous active keyboard layout 03392 int cEnterCount; 03393 MLIST mlPost; // posted message list. 03394 USHORT fsChangeBitsRemoved;// Bits removed during PeekMessage 03395 WCHAR wchInjected; // character from last VK_PACKET 03396 DWORD fsReserveKeys; // Keys that must be sent to the active 03397 // active console window. 03398 PKEVENT *apEvent; // Wait array for xxxPollAndWaitForSingleObject 03399 ACCESS_MASK amdesk; // Granted desktop access 03400 UINT cWindows; // Number of windows owned by this thread 03401 UINT cVisWindows; // Number of visible windows on this thread 03402 03403 PHOOK aphkStart[CWINHOOKS]; // Hooks registered for this thread 03404 CLIENTTHREADINFO cti; // Use this when no desktop is available 03405 } THREADINFO; 03406 03407 #define PWNDTOPSBTRACK(pwnd) (((GETPTI(pwnd)->pSBTrack))) 03408 03409 /* 03410 * The number of library module handles we can store in the dependency 03411 * tables. If this exceeds 32, the load mask implementation must be 03412 * changed. 03413 */ 03414 #define CLIBS 32 03415 03416 /* 03417 * Process Info structure. 03418 */ 03419 typedef struct tagWOWPROCESSINFO { 03420 struct tagWOWPROCESSINFO *pwpiNext; // List of WOW ppi's, gppiFirstWow is head 03421 PTHREADINFO ptiScheduled; // current thread in nonpreemptive scheduler 03422 DWORD nTaskLock; // nonpreemptive scheduler task lock count 03423 PTDB ptdbHead; // list of this process's WOW tasks 03424 PVOID lpfnWowExitTask; // func addr for wow exittask callback 03425 PKEVENT pEventWowExec; // WowExec Virt HWint scheduler event 03426 HANDLE hEventWowExecClient; // client handle value for wowexec 03427 DWORD nSendLock; // Send Scheduler inter process Send count 03428 DWORD nRecvLock; // Send Scheduler inter process Receive count 03429 PTHREADINFO CSOwningThread; // Pseudo Wow CritSect ClientThreadId 03430 LONG CSLockCount; // Pseudo Wow CritSect LockCount 03431 }WOWPROCESSINFO, *PWOWPROCESSINFO; 03432 03433 typedef struct tagDESKTOPVIEW { 03434 struct tagDESKTOPVIEW *pdvNext; 03435 PDESKTOP pdesk; 03436 ULONG_PTR ulClientDelta; 03437 } DESKTOPVIEW, *PDESKTOPVIEW; 03438 03439 03440 /* 03441 * number of DWORDs in ppi->pgh 03442 */ 03443 #define GH_SIZE 8 03444 03445 /* 03446 * the delta allocation for ppiTable array in W32JOB structure. 03447 */ 03448 #define JP_DELTA 4 03449 03450 /* 03451 * W32JOB structure 03452 */ 03453 typedef struct tagW32JOB { 03454 struct tagW32JOB* pNext; // next W32JOB structure 03455 PEJOB Job; // pointer to the EJOB structure 03456 PVOID pAtomTable; // the atom table for the job object 03457 DWORD restrictions; // UI restrictions 03458 UINT uProcessCount; // number of processes in ppiTable 03459 UINT uMaxProcesses; // how much room is in ppiTable 03460 PPROCESSINFO* ppiTable; // the array of processes contained in the job 03461 UINT ughCrt; // crt number of handles in pgh 03462 UINT ughMax; // number of handles pgh can store 03463 PULONG_PTR pgh; // the granted handles table 03464 } W32JOB, *PW32JOB; 03465 03466 03467 /* 03468 * Make sure this structure matches up with W32PROCESS, since they're 03469 * really the same thing. 03470 */ 03471 03472 /* 03473 * NOTE -- this structure has been sorted (roughly) in order of use 03474 * of the fields. The x86 code set allows cheaper access to fields 03475 * that are in the first 0x80 bytes of a structure. Please attempt 03476 * to ensure that frequently-used fields are below this boundary. 03477 * FritzS 03478 */ 03479 03480 03481 typedef struct tagPROCESSINFO { 03482 W32PROCESS; 03483 //***************************************** begin: USER specific fields 03484 PTHREADINFO ptiList; // threads in this process 03485 PTHREADINFO ptiMainThread; // pti of "main thread" 03486 PDESKTOP rpdeskStartup; // initial desktop 03487 PCLS pclsPrivateList; // this processes' private classes 03488 PCLS pclsPublicList; // this processes' public classes 03489 PWOWPROCESSINFO pwpi; // Wow PerProcess Info 03490 03491 PPROCESSINFO ppiNext; // next ppi structure in start list 03492 PPROCESSINFO ppiNextRunning; 03493 int cThreads; // count of threads using this process info 03494 HDESK hdeskStartup; // initial desktop handle 03495 UINT cSysExpunge; // sys expunge counter 03496 DWORD dwhmodLibLoadedMask; // bits describing loaded hook dlls 03497 HANDLE ahmodLibLoaded[CLIBS]; // process unique hmod array for hook dlls 03498 struct tagWINDOWSTATION *rpwinsta; // process windowstation 03499 HWINSTA hwinsta; // windowstation handle 03500 ACCESS_MASK amwinsta; // windowstation accesses 03501 03502 DWORD dwHotkey; // hot key from progman 03503 HMONITOR hMonitor; // monitor handle from CreateProcess 03504 PDESKTOPVIEW pdvList; // list of desktop views 03505 UINT iClipSerialNumber; // clipboard serial number 03506 RTL_BITMAP bmHandleFlags; // per handle flags 03507 PCURSOR pCursorCache; // process cursor/icon cache 03508 PVOID pClientBase; // LEAVE THIS FOR HYDRA; offset to the shared section 03509 DWORD dwLpkEntryPoints; // user mode language pack installed 03510 03511 PW32JOB pW32Job; // pointer to the W32JOB structure 03512 03513 DWORD dwImeCompatFlags; // per-process Ime Compatibility flags 03514 LUID luidSession; // logon session id 03515 USERSTARTUPINFO usi; // process startup info 03516 03517 #ifdef VALIDATEHANDLEQUOTA 03518 LONG lHandles; 03519 #endif 03520 03521 #ifdef USE_MIRRORING 03522 DWORD dwLayout; // the default Window orientation for this process 03523 #endif 03524 03525 } PROCESSINFO; 03526 03527 /* 03528 * Bit definitions for dwLpkEntryPoints in the processinfo structure. 03529 * These are passed from the client side when an lpk is registered. 03530 * The kernel determines when to perform callbacks based on which 03531 * entry points an lpk supports. 03532 */ 03533 #define LPK_TABBEDTEXTOUT 0x01 03534 #define LPK_PSMTEXTOUT 0x02 03535 #define LPK_DRAWTEXTEX 0x04 03536 #define LPK_EDITCONTROL 0x08 03537 #define LPK_INSTALLED 0x0f 03538 03539 #define CALL_LPK(ptiCurrent) ((PpiCurrent()->dwLpkEntryPoints & LPK_INSTALLED) && \ 03540 !((ptiCurrent)->TIF_flags & (TIF_INCLEANUP | TIF_SYSTEMTHREAD))) 03541 03542 /* 03543 * This is used to send cool switch windows information 03544 * to the lpk 03545 */ 03546 typedef struct _LPKDRAWSWITCHWND { 03547 RECT rcRect; 03548 LARGE_UNICODE_STRING strName; 03549 } LPKDRAWSWITCHWND; 03550 03551 /* 03552 * DC cache entry structure (DCE) 03553 * 03554 * This structure identifies an entry in the DCE cache. It is 03555 * usually initialized at GetDCEx() and cleanded during RelaseCacheDC 03556 * calls. 03557 * 03558 * Field 03559 * ----- 03560 * 03561 * pdceNext - Pointer to the next DCE entry. 03562 * 03563 * 03564 * hdc - GDI DC handle for the dce entry. This will have 03565 * the necessary clipping regions selected into it. 03566 * 03567 * pwndOrg - Identifies the window in the GetDCEx() call which owns 03568 * the DCE Entry. 03569 * 03570 * pwndClip - Identifies the window by which the DC is clipped to. 03571 * This is usually done for PARENTDC windows. 03572 * 03573 * hrgnClip - This region is set if the caller to GetDCEx() passes a 03574 * clipping region in which to intersect with the visrgn. 03575 * This is used when we need to recalc the visrgn for the 03576 * DCE entry. This will be freed at ReleaseCacheDC() 03577 * time if the flag doesn't have DCX_NODELETERGN set. 03578 * 03579 * hrgnClipPublic - This is a copy of the (hrgnClip) passed in above. We 03580 * make a copy and set it as PUBLIC ownership so that 03581 * we can use it in computations during the UserSetDCVisRgn 03582 * call. This is necessary for Full-Hung-Draw where we 03583 * are drawing from a different process then the one 03584 * who created the (hrgnClip). This is always deleted 03585 * in the ReleaseCacheDC() call. 03586 * 03587 * hrgnSavedVis - This is a copy of the saved visrgn for the DCE entry. 03588 * 03589 * flags - DCX_ flags. 03590 * 03591 * ptiOwner - Thread owner of the DCE entry. 03592 * 03593 */ 03594 typedef struct tagDCE { 03595 PDCE pdceNext; 03596 HDC hdc; 03597 PWND pwndOrg; 03598 PWND pwndClip; 03599 HRGN hrgnClip; 03600 HRGN hrgnClipPublic; 03601 HRGN hrgnSavedVis; 03602 DWORD DCX_flags; 03603 PTHREADINFO ptiOwner; 03604 PMONITOR pMonitor; 03605 } DCE; 03606 03607 #define DCE_SIZE_CACHEINIT 5 // Initial number of DCEs in the cache. 03608 #define DCE_SIZE_CACHETHRESHOLD 32 // Number of dce's as a threshold. 03609 03610 #define DCE_RELEASED 0 // ReleaseDC released 03611 #define DCE_FREED 1 // ReleaseDC freed 03612 #define DCE_NORELEASE 2 // ReleaseDC in-use. 03613 03614 /* 03615 * CalcVisRgn DC type bits 03616 */ 03617 #define DCUNUSED 0x00 /* Unused cache entry */ 03618 #define DCC 0x01 /* Client area */ 03619 #define DCW 0x02 /* Window area */ 03620 #define DCSAVEDVISRGN 0x04 03621 #define DCCLIPRGN 0x08 03622 #define DCNOCHILDCLIP 0x10 /* Nochildern clip */ 03623 #define DCSAVEVIS 0x20 /* Save visrgn before calculating */ 03624 #define DCCACHE 0x40 03625 03626 /* 03627 * Window List Structure 03628 */ 03629 typedef struct tagBWL { 03630 struct tagBWL *pbwlNext; 03631 HWND *phwndNext; 03632 HWND *phwndMax; 03633 PTHREADINFO ptiOwner; 03634 HWND rghwnd[1]; 03635 } BWL, *PBWL; 03636 03637 /* 03638 * Numbers of HWND slots to to start with and to increase by. 03639 */ 03640 #define BWL_CHWNDINIT 32 /* initial # slots pre-allocated */ 03641 #define BWL_CHWNDMORE 8 /* # slots to obtain when required */ 03642 03643 #define BWL_ENUMCHILDREN 1 03644 #define BWL_ENUMLIST 2 03645 #define BWL_ENUMOWNERLIST 4 03646 03647 #define BWL_ENUMIMELAST 0x08 03648 #define BWL_REMOVEIMECHILD 0x10 03649 03650 /* 03651 * Saved Popup Bits structure 03652 */ 03653 typedef struct tagSPB { 03654 struct tagSPB *pspbNext; 03655 PWND spwnd; 03656 HBITMAP hbm; 03657 RECT rc; 03658 HRGN hrgn; 03659 DWORD flags; 03660 ULONG_PTR ulSaveId; 03661 } SPB; 03662 03663 #define SPB_SAVESCREENBITS 0x0001 // GreSaveScreenBits() was called 03664 #define SPB_LOCKUPDATE 0x0002 // LockWindowUpdate() SPB 03665 #define SPB_DRAWBUFFER 0x0004 // BeginDrawBuffer() SPB 03666 03667 #define AnySpbs() (gpDispInfo->pspbFirst != NULL) // TRUE if there are any SPBs 03668 03669 /* 03670 * Macro to check if the journal playback hook is installed. 03671 */ 03672 #define FJOURNALRECORD() (GETDESKINFO(PtiCurrent())->aphkStart[WH_JOURNALRECORD + 1] != NULL) 03673 #define FJOURNALPLAYBACK() (GETDESKINFO(PtiCurrent())->aphkStart[WH_JOURNALPLAYBACK + 1] != NULL) 03674 03675 #define TESTHMODLOADED(pti, x) ((pti)->ppi->dwhmodLibLoadedMask & (1 << (x))) 03676 #define SETHMODLOADED(pti, x, hmod) ((pti)->ppi->ahmodLibLoaded[x] = hmod, \ 03677 (pti)->ppi->dwhmodLibLoadedMask |= (1 << (x))) 03678 #define CLEARHMODLOADED(pti, x) ((pti)->ppi->ahmodLibLoaded[x] = NULL, \ 03679 (pti)->ppi->dwhmodLibLoadedMask &= ~(1 << (x))) 03680 #define PFNHOOK(phk) (phk->ihmod == -1 ? (PROC)phk->offPfn : \ 03681 (PROC)(((ULONG_PTR)(PtiCurrent()->ppi->ahmodLibLoaded[phk->ihmod])) + \ 03682 ((ULONG_PTR)(phk->offPfn)))) 03683 03684 /* 03685 * Extended structures for message thunking. 03686 */ 03687 typedef struct _CREATESTRUCTEX { 03688 CREATESTRUCT cs; 03689 LARGE_STRING strName; 03690 LARGE_STRING strClass; 03691 } CREATESTRUCTEX, *PCREATESTRUCTEX; 03692 03693 typedef struct _MDICREATESTRUCTEX { 03694 MDICREATESTRUCT mdics; 03695 LARGE_STRING strTitle; 03696 LARGE_STRING strClass; 03697 } MDICREATESTRUCTEX, *PMDICREATESTRUCTEX; 03698 03699 typedef struct _CWPSTRUCTEX { 03700 struct tagCWPSTRUCT; 03701 PSMS psmsSender; 03702 } CWPSTRUCTEX, *PCWPSTRUCTEX; 03703 03704 typedef struct _CWPRETSTRUCTEX { 03705 LRESULT lResult; 03706 struct tagCWPSTRUCT; 03707 PSMS psmsSender; 03708 } CWPRETSTRUCTEX, *PCWPRETSTRUCTEX; 03709 03710 /* 03711 * SendMessage structure and defines. 03712 */ 03713 typedef struct tagSMS { /* sms */ 03714 PSMS psmsNext; // link in global psmsList 03715 #if DBG 03716 PSMS psmsSendList; // head of queue's SendMessage chain 03717 PSMS psmsSendNext; // link in queue's SendMessage chain 03718 #endif // DBG 03719 PSMS psmsReceiveNext; // link in queue's ReceiveList 03720 DWORD tSent; // time message was sent 03721 PTHREADINFO ptiSender; // sending thread 03722 PTHREADINFO ptiReceiver; // receiving thread 03723 03724 SENDASYNCPROC lpResultCallBack; // function to receive the SendMessageCallback return value 03725 ULONG_PTR dwData; // value to be passed back to the lpResultCallBack function 03726 PTHREADINFO ptiCallBackSender; // sending thread 03727 03728 LRESULT lRet; // message return value 03729 UINT flags; // SMF_ flags 03730 WPARAM wParam; // message fields... 03731 LPARAM lParam; 03732 UINT message; 03733 PWND spwnd; 03734 PVOID pvCapture; // captured argument data 03735 } SMS; 03736 03737 #define SMF_REPLY 0x0001 // message has been replied to 03738 #define SMF_RECEIVERDIED 0x0002 // receiver has died 03739 #define SMF_SENDERDIED 0x0004 // sender has died 03740 #define SMF_RECEIVERFREE 0x0008 // receiver should free sms when done 03741 #define SMF_RECEIVEDMESSAGE 0x0010 // sms has been received 03742 #define SMF_CB_REQUEST 0x0100 // SendMessageCallback requested 03743 #define SMF_CB_REPLY 0x0200 // SendMessageCallback reply 03744 #define SMF_CB_CLIENT 0x0400 // Client process request 03745 #define SMF_CB_SERVER 0x0800 // Server process request 03746 #define SMF_WOWRECEIVE 0x1000 // wow sched has incr recv count 03747 #define SMF_WOWSEND 0x2000 // wow sched has incr send count 03748 #define SMF_RECEIVERBUSY 0x4000 // reciver is processing this msg 03749 03750 /* 03751 * InterSendMsgEx parameter used for SendMessageCallback and TimeOut 03752 */ 03753 typedef struct tagINTERSENDMSGEX { /* ism */ 03754 UINT fuCall; // callback or timeout call 03755 03756 SENDASYNCPROC lpResultCallBack; // function to receive the send message value 03757 ULONG_PTR dwData; // Value to be passed back to the SendResult call back function 03758 LRESULT lRet; // return value from the send message 03759 03760 UINT fuSend; // how to send the message, SMTO_BLOCK, SMTO_ABORTIFHUNG 03761 UINT uTimeout; // time-out duration 03762 PULONG_PTR lpdwResult; // the return value for a syncornis call 03763 } INTRSENDMSGEX, *PINTRSENDMSGEX; 03764 03765 #define ISM_CALLBACK 0x0001 // callback function request 03766 #define ISM_TIMEOUT 0x0002 // timeout function request 03767 #define ISM_REQUEST 0x0010 // callback function request message 03768 #define ISM_REPLY 0x0020 // callback function reply message 03769 #define ISM_CB_CLIENT 0x0100 // client process callback function 03770 03771 /* 03772 * Event structure to handle broadcasts of notification messages. 03773 */ 03774 typedef struct tagASYNCSENDMSG { 03775 WPARAM wParam; 03776 LPARAM lParam; 03777 UINT message; 03778 HWND hwnd; 03779 } ASYNCSENDMSG, *PASYNCSENDMSG; 03780 03781 /* 03782 * HkCallHook() structure 03783 */ 03784 #define IsHooked(pti, fsHook) \ 03785 ((fsHook & (pti->fsHooks | pti->pDeskInfo->fsHooks)) != 0) 03786 03787 #define IsGlobalHooked(pti, fsHook) \ 03788 ((fsHook & pti->pDeskInfo->fsHooks) != 0) 03789 03790 typedef struct tagHOOKMSGSTRUCT { /* hch */ 03791 PHOOK phk; 03792 int nCode; 03793 LPARAM lParam; 03794 } HOOKMSGSTRUCT, *PHOOKMSGSTRUCT; 03795 03796 /* 03797 * BroadcastMessage() commands. 03798 */ 03799 #define BMSG_SENDMSG 0x0000 03800 #define BMSG_SENDNOTIFYMSG 0x0001 03801 #define BMSG_POSTMSG 0x0002 03802 #define BMSG_SENDMSGCALLBACK 0x0003 03803 #define BMSG_SENDMSGTIMEOUT 0x0004 03804 #define BMSG_SENDNOTIFYMSGPROCESS 0x0005 03805 03806 /* 03807 * xxxBroadcastMessage parameter used for SendMessageCallback and TimeOut 03808 */ 03809 typedef union tagBROADCASTMSG { /* bcm */ 03810 struct { // for callback broadcast 03811 SENDASYNCPROC lpResultCallBack; // function to receive the send message value 03812 ULONG_PTR dwData; // Value to be passed back to the SendResult call back function 03813 BOOL bClientRequest; // if a cliet or server callback request 03814 } cb; 03815 struct { // for timeout broadcast 03816 UINT fuFlags; // timeout type flags 03817 UINT uTimeout; // timeout length 03818 PULONG_PTR lpdwResult; // where to put the return value 03819 } to; 03820 } BROADCASTMSG, *PBROADCASTMSG; 03821 03822 /* 03823 * Internal hotkey structures and defines. 03824 */ 03825 typedef struct tagHOTKEY { 03826 PTHREADINFO pti; 03827 PWND spwnd; 03828 WORD fsModifiers; // MOD_SHIFT, MOD_ALT, MOD_CONTROL, MOD_WIN 03829 WORD wFlags; // MOD_SAS 03830 UINT vk; 03831 int id; 03832 struct tagHOTKEY *phkNext; 03833 } HOTKEY, *PHOTKEY; 03834 03835 #define PWND_INPUTOWNER (PWND)1 // Means send WM_HOTKEY to input owner. 03836 #define PWND_FOCUS (PWND)NULL // Means send WM_HOTKEY to queue's pwndFocus. 03837 #define PWND_ERROR (PWND)0x10 // Means HWND validation returned an error 03838 #define PWND_TOP (PWND)0 03839 #define PWND_BOTTOM (PWND)1 03840 #define PWND_GROUPTOTOP ((PWND)-1) 03841 #define PWND_TOPMOST ((PWND)-1) 03842 #define PWND_NOTOPMOST ((PWND)-2) 03843 #define PWND_BROADCAST ((PWND)-1) 03844 03845 #define IDHOT_DEBUG (-5) 03846 #define IDHOT_DEBUGSERVER (-6) 03847 #define IDHOT_WINDOWS (-7) 03848 03849 /* 03850 * xPos, yPos for WM_CONTEXTMENU from keyboard 03851 */ 03852 #define KEYBOARD_MENU ((LPARAM)-1) // Keyboard generated menu 03853 03854 /* 03855 * Capture codes 03856 */ 03857 #define NO_CAP_CLIENT 0 /* no capture; in client area */ 03858 #define NO_CAP_SYS 1 /* no capture; in sys area */ 03859 #define CLIENT_CAPTURE 2 /* client-relative capture */ 03860 #define WINDOW_CAPTURE 3 /* window-relative capture */ 03861 #define SCREEN_CAPTURE 4 /* screen-relative capture */ 03862 #define FULLSCREEN_CAPTURE 5 /* capture entire machine */ 03863 #define CLIENT_CAPTURE_INTERNAL 6 /* client-relative capture (Win 3.1 style; won't release) */ 03864 03865 #define CH_HELPPREFIX 0x08 03866 03867 #ifdef KANJI 03868 #define CH_KANJI1 0x1D 03869 #define CH_KANJI2 0x1E 03870 #define CH_KANJI3 0x1F 03871 #endif // KANJI 03872 03873 #define xxxRedrawScreen() \ 03874 xxxInternalInvalidate(PtiCurrent()->rpdesk->pDeskInfo->spwnd, \ 03875 HRGN_FULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN) 03876 03877 /* 03878 * Preallocated buffer for use during SetWindowPos to prevent memory 03879 * allocation failures. 03880 */ 03881 #define CCVR_WORKSPACE 4 03882 03883 /* 03884 * DrawIconCallBack data, global only for state data in tmswitch.c 03885 */ 03886 typedef struct tagDRAWICONCB { /* dicb */ 03887 PWND pwndTop; // Window being drawn 03888 UINT cx; // x offset for icon 03889 UINT cy; // y offset for icon 03890 } DRAWICONCB, *PDRAWICONCB; 03891 03892 /* 03893 * The following defines the components of nKeyboardSpeed 03894 */ 03895 #define KSPEED_MASK 0x001F // Defines the key repeat speed. 03896 #define KDELAY_MASK 0x0060 // Defines the keyboard delay. 03897 #define KDELAY_SHIFT 5 03898 03899 /* 03900 * Property list checkpoint int 03901 */ 03902 #define PROP_CHECKPOINT MAKEINTATOM(atomCheckpointProp) 03903 #define PROP_DDETRACK MAKEINTATOM(atomDDETrack) 03904 #define PROP_QOS MAKEINTATOM(atomQOS) 03905 #define PROP_DDEIMP MAKEINTATOM(atomDDEImp) 03906 #define PROP_WNDOBJ MAKEINTATOM(atomWndObj) 03907 #define PROP_IMELEVEL MAKEINTATOM(atomImeLevel) 03908 #define PROP_LAYER MAKEINTATOM(atomLayer) 03909 03910 #define WinFlags ((WORD)(&__WinFlags)) 03911 03912 /* 03913 * ntinput.c 03914 */ 03915 VOID xxxInternalKeyEventDirect( 03916 BYTE bVk, 03917 WORD wScan, 03918 DWORD dwFlags, 03919 DWORD dwTime, 03920 ULONG_PTR dwExtraInfo); 03921 03922 UINT xxxSendInput( 03923 UINT nInputs, 03924 LPINPUT pInputs); 03925 03926 BOOL _BlockInput( 03927 BOOL fBlockIt); 03928 03929 int _GetMouseMovePointsEx( 03930 CONST MOUSEMOVEPOINT* ppt, 03931 MOUSEMOVEPOINT* pptBuf, 03932 UINT nPoints, 03933 DWORD resolution); 03934 03935 03936 VOID xxxProcessKeyEvent( 03937 PKE pke, 03938 ULONG_PTR ExtraInformation, 03939 BOOL bInjected); 03940 03941 VOID xxxButtonEvent( 03942 DWORD ButtonNumber, 03943 POINT ptPointer, 03944 BOOL fBreak, 03945 DWORD time, 03946 ULONG_PTR ExtraInfo, 03947 BOOL bInjected, 03948 BOOL fDblClk); 03949 03950 VOID xxxMoveEvent( 03951 LONG dx, 03952 LONG dy, 03953 DWORD dwFlags, 03954 ULONG_PTR dwExtraInfo, 03955 DWORD time, 03956 BOOL bInjected 03957 ); 03958 03959 PDEVICEINFO StartDeviceRead(PDEVICEINFO pDeviceInfo); 03960 03961 NTSTATUS DeviceNotify( 03962 IN PPLUGPLAY_NOTIFY_HDR pNotification, 03963 IN PDEVICEINFO pDeviceInfo); 03964 03965 #define MOUSE_SENSITIVITY_MIN 1 03966 #define MOUSE_SENSITIVITY_DEFAULT 10 03967 #define MOUSE_SENSITIVITY_MAX 20 03968 LONG CalculateMouseSensitivity(LONG lSens); 03969 03970 PDEVICEINFO FreeDeviceInfo(PDEVICEINFO pMouseInfo); 03971 03972 VOID QueueMouseEvent( 03973 USHORT ButtonFlags, 03974 USHORT ButtonData, 03975 ULONG_PTR ExtraInfo, 03976 POINT ptMouse, 03977 LONG time, 03978 BOOL bInjected, 03979 BOOL bWakeRIT 03980 ); 03981 03982 typedef struct { 03983 DWORD dwVersion; 03984 DWORD dwFlags; 03985 DWORD dwMapCount; 03986 DWORD dwMap[0]; 03987 } SCANCODEMAP, *PSCANCODEMAP; 03988 03989 03990 #ifndef SCANCODE_NUMPAD_PLUS 03991 #define SCANCODE_NUMPAD_PLUS (0x4e) 03992 #endif 03993 #ifndef SCANCODE_NUMPAD_DOT 03994 #define SCANCODE_NUMPAD_DOT (0x53) 03995 #endif 03996 03997 /* 03998 * Flag (LowLevel and HighLevel) for 03999 * hex Alt+Numpad mode. 04000 * If you need to add a new flag for gfInNumpadHexInput, 04001 * note the variable is BYTE. 04002 */ 04003 #define NUMPAD_HEXMODE_LL (1) 04004 #define NUMPAD_HEXMODE_HL (2) 04005 04006 #define MODIFIER_FOR_ALT_NUMPAD(wModBit) \ 04007 (((wModBits) == KBDALT) || ((wModBits) == (KBDALT | KBDSHIFT)) || \ 04008 ((wModBits) == (KBDKANA | KBDALT)) || ((wModBits) == (KBDKANA | KBDALT | KBDSHIFT))) 04009 04010 04011 BOOL UnqueueMouseEvent(PMOUSEEVENT pme); 04012 04013 BYTE VKFromVSC(PKE pke, BYTE bPrefix, LPBYTE afKeyState); 04014 BOOL KEOEMProcs(PKE pke); 04015 BOOL xxxKELocaleProcs(PKE pke); 04016 BOOL xxxKENLSProcs(PKE pke, ULONG_PTR dwExtraInformation); 04017 04018 VOID xxxKeyEvent(USHORT usVk, WORD wScanCode, DWORD time, ULONG_PTR ExtraInfo, BOOL bInjected); 04019 04020 typedef BITMAPINFOHEADER *PBMPHEADER, *LPBMPHEADER; 04021 04022 /* 04023 * Defines for WinOldAppHackoMatic flags which win386 oldapp can send to us. 04024 * These are kept in user's global variable winOldAppHackoMaticFlags 04025 */ 04026 #define WOAHACK_CHECKALTKEYSTATE 1 04027 #define WOAHACK_IGNOREALTKEYDOWN 2 04028 04029 void xxxSimpleDoSyncPaint(PWND pwnd); 04030 VOID xxxDoSyncPaint(PWND pwnd, DWORD flags); 04031 void xxxInternalDoSyncPaint(PWND pwnd, DWORD flags); 04032 04033 /* 04034 * NOTE: the first 4 values must be as defined for backward compatibility 04035 * reasons. They are sent as parameters to the WM_SYNCPAINT message. 04036 * They used to be hard-coded constants. 04037 * 04038 * Only ENUMCLIPPEDCHILDREN, ALLCHILDREN, and NOCHECKPARENTS are passed on 04039 * during recursion. The other bits reflect the current window only. 04040 */ 04041 #define DSP_ERASE 0x0001 // Send WM_ERASEBKGND 04042 #define DSP_FRAME 0x0002 // Send WM_NCPAINT 04043 #define DSP_ENUMCLIPPEDCHILDREN 0x0004 // Enum children if WS_CLIPCHILDREN 04044 #define DSP_WM_SYNCPAINT 0x0008 // Called from WM_SYNCPAINT handler 04045 #define DSP_NOCHECKPARENTS 0x0010 // Don't check parents for update region 04046 #define DSP_ALLCHILDREN 0x0020 // Enumerate all children. 04047 04048 BOOL xxxDrawAnimatedRects( 04049 PWND pwndClip, 04050 int idAnimation, 04051 LPRECT lprcStart, 04052 LPRECT lprcEnd); 04053 04054 typedef struct tagTIMER { // tmr 04055 HEAD head; 04056 struct tagTIMER *ptmrNext; 04057 struct tagTIMER *ptmrPrev; 04058 PTHREADINFO pti; 04059 struct tagWND * spwnd; 04060 UINT_PTR nID; 04061 INT cmsCountdown; 04062 INT cmsRate; 04063 UINT flags; 04064 TIMERPROC_PWND pfn; 04065 PTHREADINFO ptiOptCreator; // used for journal playback 04066 // will be NULL if timer was created by non-GUI thread 04067 } TIMER, *PTIMER; 04068 04069 UINT_PTR InternalSetTimer(PWND pwnd, UINT_PTR nIDEvent, UINT dwElapse, 04070 TIMERPROC_PWND pTimerFunc, UINT flags); 04071 04072 VOID FreeTimer(PTIMER ptmr); 04073 04074 /* 04075 * Call FindTimer() with fKill == TRUE and TMRF_RIT. This will basically 04076 * delete the timer. 04077 */ 04078 #define KILLRITTIMER(pwnd, nID) FindTimer(pwnd, nID, TMRF_RIT, TRUE) 04079 04080 /* 04081 * Raster Ops 04082 */ 04083 #define DPO 0x00FA0089 /* destination, pattern, or */ 04084 04085 /* 04086 * Message thunks. 04087 */ 04088 typedef LRESULT (APIENTRY *SFNSCSENDMESSAGE)(PWND, UINT, WPARAM, LPARAM, 04089 ULONG_PTR, PROC, DWORD, PSMS); 04090 04091 #define SMESSAGEPROTO(func) \ 04092 LRESULT CALLBACK Sfn ## func( \ 04093 PWND pwnd, UINT msg, WPARAM wParam, LPARAM lParam, \ 04094 ULONG_PTR xParam, PROC xpfnWndProc, DWORD dwSCMSFlags, PSMS psms) 04095 04096 SMESSAGEPROTO(SENTDDEMSG); 04097 SMESSAGEPROTO(DDEINIT); 04098 SMESSAGEPROTO(DWORD); 04099 SMESSAGEPROTO(INWPARAMCHAR); 04100 SMESSAGEPROTO(INWPARAMDBCSCHAR); 04101 04102 SMESSAGEPROTO(GETTEXTLENGTHS); 04103 04104 SMESSAGEPROTO(GETDBCSTEXTLENGTHS); 04105 SMESSAGEPROTO(INLPCREATESTRUCT); 04106 SMESSAGEPROTO(INLPDROPSTRUCT); 04107 SMESSAGEPROTO(INOUTLPPOINT5); 04108 SMESSAGEPROTO(INOUTLPSCROLLINFO); 04109 SMESSAGEPROTO(INOUTLPRECT); 04110 SMESSAGEPROTO(INOUTNCCALCSIZE); 04111 SMESSAGEPROTO(OUTLPRECT); 04112 SMESSAGEPROTO(INLPMDICREATESTRUCT); 04113 SMESSAGEPROTO(INLPCOMPAREITEMSTRUCT); 04114 SMESSAGEPROTO(INLPDELETEITEMSTRUCT); 04115 SMESSAGEPROTO(INLPHLPSTRUCT); 04116 SMESSAGEPROTO(INLPHELPINFOSTRUCT); // WINHELP4 04117 SMESSAGEPROTO(INLPDRAWITEMSTRUCT); 04118 SMESSAGEPROTO(INOUTLPMEASUREITEMSTRUCT); 04119 SMESSAGEPROTO(INSTRING); 04120 SMESSAGEPROTO(INPOSTEDSTRING); 04121 SMESSAGEPROTO(INSTRINGNULL); 04122 SMESSAGEPROTO(OUTSTRING); 04123 SMESSAGEPROTO(INCNTOUTSTRING); 04124 SMESSAGEPROTO(POUTLPINT); 04125 SMESSAGEPROTO(POPTINLPUINT); 04126 SMESSAGEPROTO(INOUTLPWINDOWPOS); 04127 SMESSAGEPROTO(INLPWINDOWPOS); 04128 SMESSAGEPROTO(INLBOXSTRING); 04129 SMESSAGEPROTO(OUTLBOXSTRING); 04130 SMESSAGEPROTO(INCBOXSTRING); 04131 SMESSAGEPROTO(OUTCBOXSTRING); 04132 SMESSAGEPROTO(INCNTOUTSTRINGNULL); 04133 SMESSAGEPROTO(INOUTDRAG); 04134 SMESSAGEPROTO(FULLSCREEN); 04135 SMESSAGEPROTO(INPAINTCLIPBRD); 04136 SMESSAGEPROTO(INSIZECLIPBRD); 04137 SMESSAGEPROTO(OUTDWORDDWORD); 04138 SMESSAGEPROTO(OUTDWORDINDWORD); 04139 SMESSAGEPROTO(OPTOUTLPDWORDOPTOUTLPDWORD); 04140 SMESSAGEPROTO(DWORDOPTINLPMSG); 04141 SMESSAGEPROTO(COPYGLOBALDATA); 04142 SMESSAGEPROTO(COPYDATA); 04143 SMESSAGEPROTO(INDESTROYCLIPBRD); 04144 SMESSAGEPROTO(INOUTNEXTMENU); 04145 SMESSAGEPROTO(INOUTSTYLECHANGE); 04146 SMESSAGEPROTO(IMAGEIN); 04147 SMESSAGEPROTO(IMAGEOUT); 04148 SMESSAGEPROTO(INDEVICECHANGE); 04149 SMESSAGEPROTO(INOUTMENUGETOBJECT); 04150 SMESSAGEPROTO(POWERBROADCAST); 04151 SMESSAGEPROTO(LOGONNOTIFY); 04152 SMESSAGEPROTO(IMECONTROL); 04153 SMESSAGEPROTO(IMEREQUEST); 04154 SMESSAGEPROTO(INLPKDRAWSWITCHWND); 04155 04156 /***************************************************************************\ 04157 * Function Prototypes 04158 * 04159 * NOTE: Only prototypes for GLOBAL (across module) functions should be put 04160 * here. Prototypes for functions that are global to a single module should 04161 * be put at the head of that module. 04162 * 04163 * LATER: There's still lots of bogus trash in here to be cleaned out. 04164 * 04165 \***************************************************************************/ 04166 04167 /* 04168 * Random prototypes. 04169 */ 04170 DWORD _GetWindowContextHelpId( 04171 PWND pwnd); 04172 04173 BOOL _SetWindowContextHelpId( 04174 PWND pwnd, 04175 DWORD dwContextId); 04176 04177 void xxxSendHelpMessage( 04178 PWND pwnd, 04179 int iType, 04180 int iCtrlId, 04181 HANDLE hItemHandle, 04182 DWORD dwContextId); 04183 04184 HPALETTE _SelectPalette( 04185 HDC hdc, 04186 HPALETTE hpalette, 04187 BOOL fForceBackground); 04188 04189 int xxxRealizePalette( 04190 HDC hdc); 04191 04192 VOID xxxFlushPalette( 04193 PWND pwnd); 04194 04195 VOID xxxBroadcastPaletteChanged( 04196 PWND pwnd, 04197 BOOL fForceDesktop); 04198 04199 PCURSOR SearchIconCache( 04200 PCURSOR pCursorCache, 04201 ATOM atomModName, 04202 PUNICODE_STRING pstrResName, 04203 PCURSOR pCursorSrc, 04204 PCURSORFIND pcfSearch); 04205 04206 VOID ZombieCursor(PCURSOR pcur); 04207 04208 BOOL IsSmallerThanScreen(PWND pwnd); 04209 04210 BOOL zzzSetSystemCursor( 04211 PCURSOR pcur, 04212 DWORD id); 04213 04214 BOOL zzzSetSystemImage( 04215 PCURSOR pcur, 04216 PCURSOR pcurOld); 04217 04218 BOOL _InternalGetIconInfo( 04219 IN PCURSOR pcur, 04220 OUT PICONINFO piconinfo, 04221 OUT OPTIONAL PUNICODE_STRING pstrModName, 04222 OUT OPTIONAL PUNICODE_STRING pstrResName, 04223 OUT OPTIONAL LPDWORD pbpp, 04224 IN BOOL fInternalCursor); 04225 04226 VOID LinkCursor( 04227 PCURSOR pcur); 04228 04229 BOOL _SetCursorIconData( 04230 PCURSOR pcur, 04231 PUNICODE_STRING pstrModName, 04232 PUNICODE_STRING pstrResName, 04233 PCURSORDATA pData, 04234 DWORD cbData); 04235 04236 PCURSOR _GetCursorFrameInfo( 04237 PCURSOR pcur, 04238 int iFrame, 04239 PJIF pjifRate, 04240 LPINT pccur); 04241 04242 BOOL zzzSetSystemCursor( 04243 PCURSOR pcur, 04244 DWORD id); 04245 04246 PCURSOR _FindExistingCursorIcon( 04247 ATOM atomModName, 04248 PUNICODE_STRING pstrResName, 04249 PCURSOR pcurSrc, 04250 PCURSORFIND pcfSearch); 04251 04252 HCURSOR _CreateEmptyCursorObject( 04253 BOOL fPublic); 04254 04255 BOOL _GetUserObjectInformation(HANDLE h, 04256 int nIndex, PVOID pvInfo, DWORD nLength, LPDWORD lpnLengthNeeded); 04257 BOOL _SetUserObjectInformation(HANDLE h, 04258 int nIndex, PVOID pvInfo, DWORD nLength); 04259 DWORD xxxWaitForInputIdle(ULONG_PTR idProcess, DWORD dwMilliseconds, 04260 BOOL fSharedWow); 04261 VOID StartScreenSaver(BOOL bOnlyIfSecure); 04262 UINT InternalMapVirtualKeyEx(UINT wCode, UINT wType, PKBDTABLES pKbdTbl); 04263 SHORT InternalVkKeyScanEx(WCHAR cChar, PKBDTABLES pKbdTbl); 04264 04265 04266 04267 PWND ParentNeedsPaint(PWND pwnd); 04268 VOID SetHungFlag(PWND pwnd, WORD wFlag); 04269 VOID ClearHungFlag(PWND pwnd, WORD wFlag); 04270 04271 BOOL _DdeSetQualityOfService(PWND pwndClient, 04272 CONST PSECURITY_QUALITY_OF_SERVICE pqosNew, 04273 PSECURITY_QUALITY_OF_SERVICE pqosOld); 04274 BOOL _DdeGetQualityOfService(PWND pwndClient, 04275 PWND pwndServer, PSECURITY_QUALITY_OF_SERVICE pqos); 04276 04277 BOOL QueryTrackMouseEvent(LPTRACKMOUSEEVENT lpTME); 04278 void CancelMouseHover(PQ pq); 04279 void ResetMouseTracking(PQ pq, PWND pwnd); 04280 04281 void _SetIMEShowStatus(BOOL fShow); 04282 BOOL _GetIMEShowStatus(VOID); 04283 04284 /* 04285 * Prototypes for internal version of APIs. 04286 */ 04287 PWND _FindWindowEx(PWND pwndParent, PWND pwndChild, 04288 LPCWSTR pszClass, LPCWSTR pszName, DWORD dwType); 04289 UINT APIENTRY GreSetTextAlign(HDC, UINT); 04290 UINT APIENTRY GreGetTextAlign(HDC); 04291 04292 /* 04293 * Prototypes for validation, RIP, error handling, etc functions. 04294 */ 04295 PWND FASTCALL ValidateHwnd(HWND hwnd); 04296 04297 NTSTATUS ValidateHwinsta(HWINSTA, KPROCESSOR_MODE, ACCESS_MASK, PWINDOWSTATION*); 04298 NTSTATUS ValidateHdesk(HDESK, KPROCESSOR_MODE, ACCESS_MASK, PDESKTOP*); 04299 04300 PMENU ValidateHmenu(HMENU hmenu); 04301 PMONITOR ValidateHmonitor(HMONITOR hmonitor); 04302 HRGN UserValidateCopyRgn(HRGN); 04303 04304 BOOL ValidateHandleSecure(HANDLE h); 04305 04306 NTSTATUS UserJobCallout(PKWIN32_JOBCALLOUT_PARAMETERS Parm); 04307 04308 BOOL RemoveProcessFromJob(PPROCESSINFO ppi); 04309 04310 04311 BOOL xxxActivateDebugger(UINT fsModifiers); 04312 04313 void ClientDied(void); 04314 04315 VOID SendMsgCleanup(PTHREADINFO ptiCurrent); 04316 VOID ReceiverDied(PSMS psms, PSMS *ppsmsUnlink); 04317 LRESULT xxxInterSendMsgEx(PWND, UINT, WPARAM, LPARAM, PTHREADINFO, PTHREADINFO, PINTRSENDMSGEX ); 04318 VOID ClearSendMessages(PWND pwnd); 04319 PPCLS GetClassPtr(ATOM atom, PPROCESSINFO ppi, HANDLE hModule); 04320 BOOL ReferenceClass(PCLS pcls, PWND pwnd); 04321 VOID DereferenceClass(PWND pwnd); 04322 ULONG_PTR MapClientToServerPfn(ULONG_PTR dw); 04323 04324 04325 VOID xxxReceiveMessage(PTHREADINFO); 04326 #define xxxReceiveMessages(pti) \ 04327 while ((pti)->pcti->fsWakeBits & QS_SENDMESSAGE) { xxxReceiveMessage((pti)); } 04328 04329 PBWL BuildHwndList(PWND pwnd, UINT flags, PTHREADINFO ptiOwner); 04330 VOID FreeHwndList(PBWL pbwl); 04331 04332 #define MINMAX_KEEPHIDDEN 0x1 04333 #define MINMAX_ANIMATE 0x10000 04334 04335 PWND xxxMinMaximize(PWND pwnd, UINT cmd, DWORD dwFlags); 04336 void xxxMinimizeHungWindow(PWND pwnd); 04337 VOID xxxInitSendValidateMinMaxInfo(PWND pwnd, LPMINMAXINFO lpmmi); 04338 HRGN CreateEmptyRgn(void); 04339 HRGN CreateEmptyRgnPublic(void); 04340 HRGN SetOrCreateRectRgnIndirectPublic(HRGN * phrgn, LPCRECT lprc); 04341 BOOL SetEmptyRgn(HRGN hrgn); 04342 BOOL SetRectRgnIndirect(HRGN hrgn, LPCRECT lprc); 04343 NTSTATUS xxxRegisterForDeviceClassNotifications(); 04344 BOOL xxxInitInput(PTERMINAL); 04345 VOID InitMice(); 04346 void UpdateMouseInfo(void); 04347 BOOL OpenMouse(PDEVICEINFO pMouseInfo); 04348 void ProcessDeviceChanges(DWORD DeviceType); 04349 PDEVICEINFO CreateDeviceInfo(DWORD DeviceType, PUNICODE_STRING SymbolicLinkName, BYTE bFlags); 04350 void InitKeyboard(void); 04351 UINT xxxHardErrorControl(DWORD, HANDLE, PDESKRESTOREDATA); 04352 04353 VOID SetKeyboardRate(UINT nKeySpeed); 04354 VOID RecolorDeskPattern(); 04355 BOOL xxxInitWindowStation(PWINDOWSTATION); 04356 VOID zzzInternalSetCursorPos(int x, int y); 04357 VOID UpdateKeyLights(BOOL bInjected); 04358 VOID SetDebugHotKeys(); 04359 VOID BoundCursor(LPPOINT lppt); 04360 04361 void DestroyKF(PKBDFILE pkf); 04362 VOID DestroyKL(PKL pkl); 04363 BOOL xxxSetDeskPattern(PUNICODE_STRING pProfileUserName,LPWSTR lpPat, BOOL fCreation); 04364 BOOL xxxSetDeskWallpaper(PUNICODE_STRING pProfileUserName,LPWSTR lpszFile); 04365 HPALETTE CreateDIBPalette(LPBITMAPINFOHEADER pbmih, UINT colors); 04366 BOOL CalcVisRgn(HRGN* hrgn, PWND pwndOrg, PWND pwndClip, DWORD flags); 04367 04368 NTSTATUS xxxCreateThreadInfo(PETHREAD, BOOL); 04369 04370 BOOL DestroyProcessInfo(PW32PROCESS); 04371 04372 #if DBG 04373 PWCHAR GetDesktopName(PDESKTOP pdesk); 04374 #endif // DBG 04375 04376 VOID xxxDesktopThread(PTERMINAL pTerm); 04377 04378 VOID ForceEmptyClipboard(PWINDOWSTATION); 04379 04380 NTSTATUS zzzInitTask(UINT dwExpWinVer, DWORD dwAppCompatFlags, 04381 PUNICODE_STRING pstrModName, PUNICODE_STRING pstrBaseFileName, 04382 DWORD hTaskWow, DWORD dwHotkey, DWORD idTask, 04383 DWORD dwX, DWORD dwY, DWORD dwXSize, DWORD dwYSize); 04384 VOID DestroyTask(PPROCESSINFO ppi, PTHREADINFO ptiToRemove); 04385 void PostInputMessage(PQ pq, PWND pwnd, UINT message, WPARAM wParam, 04386 LPARAM lParam, DWORD time, ULONG_PTR dwExtraInfo); 04387 PWND PwndForegroundCapture(VOID); 04388 BOOL xxxSleepThread(UINT fsWakeMask, DWORD Timeout, BOOL fForegroundIdle); 04389 VOID SetWakeBit(PTHREADINFO pti, UINT wWakeBit); 04390 VOID WakeSomeone(PQ pq, UINT message, PQMSG pqmsg); 04391 VOID ClearWakeBit(PTHREADINFO pti, UINT wWakeBit, BOOL fSysCheck); 04392 NTSTATUS xxxInitProcessInfo(PW32PROCESS); 04393 04394 PTHREADINFO PtiFromThreadId(DWORD idThread); 04395 BOOL zzzAttachThreadInput(PTHREADINFO ptiAttach, PTHREADINFO ptiAttachTo, BOOL fAttach); 04396 BOOL zzzReattachThreads(BOOL fJournalAttach); 04397 PQ AllocQueue(PTHREADINFO, PQ); 04398 VOID FreeQueue(PQ pq); 04399 04400 04401 VOID FreeCachedQueues(VOID); 04402 VOID CleanupGDI(VOID); 04403 VOID CleanupResources(VOID); 04404 04405 void zzzDestroyQueue(PQ pq, PTHREADINFO pti); 04406 PQMSG AllocQEntry(PMLIST pml); 04407 __inline void FreeQEntry(PQMSG pqmsg) 04408 { 04409 extern PPAGED_LOOKASIDE_LIST QEntryLookaside; 04410 ExFreeToPagedLookasideList(QEntryLookaside, pqmsg); 04411 } 04412 04413 void DelQEntry(PMLIST pml, PQMSG pqmsg); 04414 void zzzAttachToQueue(PTHREADINFO pti, PQ pqAttach, PQ pqJournal, 04415 BOOL fJoiningForeground); 04416 VOID xxxProcessEventMessage(PTHREADINFO ptiCurrent, PQMSG pqmsg); 04417 VOID xxxProcessSetWindowPosEvent(PSMWP psmwpT); 04418 VOID xxxProcessAsyncSendMessage(PASYNCSENDMSG pmsg); 04419 BOOL PostEventMessage(PTHREADINFO pti, PQ pq, DWORD dwQEvent, PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam); 04420 04421 BOOL DoPaint(PWND pwndFilter, LPMSG lpMsg); 04422 BOOL DoTimer(PWND pwndFilter); 04423 BOOL CheckPwndFilter(PWND pwnd, PWND pwndFilter); 04424 04425 #define WHT_IGNOREDISABLED 0x00000001 04426 04427 #ifdef REDIRECTION 04428 04429 #define WHT_FAKESPEEDHITTEST 0x00000002 04430 04431 BOOL xxxGetCursorPos(LPPOINT lpPt); 04432 PWND xxxCallSpeedHitTestHook(POINT* ppt); 04433 VOID PushMouseMove(PQ pq, POINT pt); 04434 VOID PopMouseMove(PQ pq, POINT* ppt); 04435 04436 #endif // REDIRECTION 04437 04438 HWND xxxWindowHitTest(PWND pwnd, POINT pt, int *pipos, DWORD dwHitTestFlags); 04439 HWND xxxWindowHitTest2(PWND pwnd, POINT pt, int *pipos, DWORD dwHitTestFlags); 04440 04441 PWND SpeedHitTest(PWND pwndParent, POINT pt); 04442 VOID xxxDeactivate(PTHREADINFO pti, DWORD tidSetForeground); 04443 04444 #define SFW_STARTUP 0x0001 04445 #define SFW_SWITCH 0x0002 04446 #define SFW_NOZORDER 0x0004 04447 #define SFW_SETFOCUS 0x0008 04448 #define SFW_ACTIVATERESTORE 0x0010 04449 04450 BOOL xxxSetForegroundWindow2(PWND pwnd, PTHREADINFO ptiCurrent, DWORD fFlags); 04451 VOID SetForegroundThread(PTHREADINFO pti); 04452 VOID xxxSendFocusMessages(PTHREADINFO pti, PWND pwndReceive); 04453 04454 #define ATW_MOUSE 0x0001 04455 #define ATW_SETFOCUS 0x0002 04456 #define ATW_ASYNC 0x0004 04457 #define ATW_NOZORDER 0x0008 04458 04459 BOOL FBadWindow(PWND pwnd); 04460 BOOL xxxActivateThisWindow(PWND pwnd, DWORD tidLoseForeground, DWORD fFlags); 04461 BOOL xxxActivateWindow(PWND pwnd, UINT cmd); 04462 04463 #define NTW_PREVIOUS 1 04464 #define NTW_IGNORETOOLWINDOW 2 04465 PWND NextTopWindow(PTHREADINFO pti, PWND pwnd, PWND pwndSkip, DWORD flags); 04466 04467 int xxxMouseActivate(PTHREADINFO pti, PWND pwnd, UINT message, WPARAM wParam, LPPOINT lppt, int ht); 04468 int UT_GetParentDCClipBox(PWND pwnd, HDC hdc, LPRECT lprc); 04469 VOID UpdateAsyncKeyState(PQ pq, UINT wVK, BOOL fBreak); 04470 void PostUpdateKeyStateEvent(PQ pq); 04471 void ProcessUpdateKeyStateEvent(PQ pq, CONST PBYTE pbKeyState, CONST PBYTE pbRecentDown); 04472 04473 BOOL InternalSetProp(PWND pwnd, LPWSTR pszKey, HANDLE hData, DWORD dwFlags); 04474 HANDLE InternalRemoveProp(PWND pwnd, LPWSTR pszKey, BOOL fInternal); 04475 VOID DeleteProperties(PWND pwnd); 04476 CHECKPOINT *CkptRestore(PWND pwnd, LPCRECT lprcWindow); 04477 UINT_PTR _SetTimer(PWND pwnd, UINT_PTR nIDEvent, UINT dwElapse, TIMERPROC_PWND pTimerFunc); 04478 BOOL KillTimer2(PWND pwnd, UINT_PTR nIDEvent, BOOL fSystemTimer); 04479 VOID DestroyThreadsTimers(PTHREADINFO pti); 04480 VOID DecTimerCount(PTHREADINFO pti); 04481 VOID zzzInternalShowCaret(); 04482 VOID zzzInternalHideCaret(); 04483 VOID zzzInternalDestroyCaret(); 04484 VOID ChangeAcquireResourceType(VOID); 04485 VOID EnterCrit(VOID); 04486 VOID EnterSharedCrit(VOID); 04487 VOID LeaveCrit(VOID); 04488 VOID _AssertCritIn(VOID); 04489 VOID _AssertDeviceInfoListCritIn(VOID); 04490 VOID _AssertCritInShared(VOID); 04491 VOID _AssertCritOut(VOID); 04492 VOID _AssertDeviceInfoListCritOut(VOID); 04493 NTSTATUS _KeUserModeCallback (IN ULONG ApiNumber, IN PVOID InputBuffer, 04494 IN ULONG InputLength, OUT PVOID *OutputBuffer, OUT PULONG OutputLength); 04495 04496 #define UnlockProcess ObDereferenceObject 04497 #define UnlockThread ObDereferenceObject 04498 04499 extern ULONG gSessionId; 04500 04501 #if DBG 04502 #define ValidateProcessSessionId(pEProcess) \ 04503 UserAssert((pEProcess)->SessionId == gSessionId) 04504 04505 #define ValidateThreadSessionId(pEThread) \ 04506 UserAssert((pEThread)->ThreadsProcess->SessionId == gSessionId) 04507 #else 04508 #define ValidateProcessSessionId(pEProcess) 04509 #define ValidateThreadSessionId(pEThread) 04510 #endif 04511 04512 04513 NTSTATUS __inline LockProcessByClientId(HANDLE dwProcessId, PEPROCESS* ppEProcess) 04514 { 04515 NTSTATUS Status; 04516 04517 CheckCritOut(); 04518 04519 Status = PsLookupProcessByProcessId(dwProcessId, ppEProcess); 04520 04521 if (NT_SUCCESS(Status) && (*ppEProcess)->SessionId != gSessionId) { 04522 UnlockProcess(*ppEProcess); 04523 return STATUS_UNSUCCESSFUL; 04524 } 04525 return Status; 04526 } 04527 04528 NTSTATUS __inline LockThreadByClientId(HANDLE dwThreadId, PETHREAD* ppEThread) 04529 { 04530 NTSTATUS Status; 04531 04532 Status = PsLookupThreadByThreadId(dwThreadId, ppEThread); 04533 04534 if (NT_SUCCESS(Status) && (*ppEThread)->ThreadsProcess->SessionId != gSessionId) { 04535 UnlockThread(*ppEThread); 04536 return STATUS_UNSUCCESSFUL; 04537 } 04538 return Status; 04539 } 04540 04541 BOOL IsSAS(BYTE vk, UINT* pfsModifiers); 04542 BOOL xxxDoHotKeyStuff(UINT vk, BOOL fBreak, DWORD fsReserveKeys); 04543 PHOTKEY IsHotKey(UINT fsModifiers, UINT vk); 04544 /* 04545 * Server.c 04546 */ 04547 BOOL InitCreateUserCrit(VOID); 04548 PMDEV InitVideo( 04549 BOOL bReenumerationNeeded); 04550 04551 /* 04552 * DRVSUP.C 04553 */ 04554 BOOL InitUserScreen(); 04555 04556 VOID InitLoadResources(); 04557 04558 typedef struct tagDISPLAYRESOURCE { 04559 WORD cyThunb; 04560 WORD cxThumb; 04561 WORD xCompressIcon; 04562 WORD yCompressIcon; 04563 WORD xCompressCursor; 04564 WORD yCompressCursor; 04565 WORD yKanji; 04566 WORD cxBorder; 04567 WORD cyBorder; 04568 } DISPLAYRESOURCE, *PDISPLAYRESOURCE; 04569 04570 04571 04572 VOID xxxUserResetDisplayDevice(); 04573 04574 /* 04575 * Object management and security 04576 */ 04577 #define DEFAULT_WINSTA L"\\Windows\\WindowStations\\WinSta0" 04578 04579 #define POBJECT_NAME(pobj) (OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(pobj)) ? \ 04580 &(OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(pobj))->Name) : NULL) 04581 04582 PSECURITY_DESCRIPTOR CreateSecurityDescriptor(PACCESS_ALLOWED_ACE paceList, 04583 DWORD cbAce, BOOLEAN fDaclDefaulted); 04584 PACCESS_ALLOWED_ACE AllocAce(PACCESS_ALLOWED_ACE pace, BYTE bType, 04585 BYTE bFlags, ACCESS_MASK am, PSID psid, LPDWORD lpdwLength); 04586 BOOL CheckGrantedAccess(ACCESS_MASK, ACCESS_MASK); 04587 BOOL AccessCheckObject(PVOID, ACCESS_MASK, KPROCESSOR_MODE, CONST GENERIC_MAPPING *); 04588 BOOL InitSecurity(VOID); 04589 BOOL IsPrivileged(PPRIVILEGE_SET ppSet); 04590 BOOL CheckWinstaWriteAttributesAccess(void); 04591 04592 NTSTATUS xxxUserDuplicateObject(HANDLE SourceProcessHandle, HANDLE SourceHandle, 04593 HANDLE TargetProcessHandle, PHANDLE TargetHandle, ACCESS_MASK DesiredAccess, 04594 ULONG HandleAttributes, ULONG Options); 04595 HWINSTA xxxConnectService(PUNICODE_STRING, HDESK *); 04596 NTSTATUS TestForInteractiveUser(PLUID pluidCaller); 04597 NTSTATUS _UserTestForWinStaAccess( PUNICODE_STRING pstrWinSta, BOOL fInherit); 04598 HDESK xxxResolveDesktop(HANDLE hProcess, PUNICODE_STRING pstrDesktop, 04599 HWINSTA *phwinsta, BOOL fInherit, BOOL* pbShutDown); 04600 04601 /* NEW CODE */ 04602 NTSTATUS xxxResolveDesktopForWOW ( 04603 IN OUT PUNICODE_STRING pstrDesktop); 04604 04605 WORD xxxClientWOWGetProcModule(WNDPROC_PWND pfn); 04606 04607 PVOID _MapDesktopObject(HANDLE h); 04608 PDESKTOPVIEW GetDesktopView(PPROCESSINFO ppi, PDESKTOP pdesk); 04609 VOID TerminateConsole(PDESKTOP); 04610 04611 04612 /* 04613 * Object manager callouts for windowstations 04614 */ 04615 VOID DestroyWindowStation( 04616 IN PEPROCESS Process OPTIONAL, 04617 IN PVOID Object, 04618 IN ACCESS_MASK GrantedAccess, 04619 IN ULONG ProcessHandleCount, 04620 IN ULONG SystemHandleCount); 04621 04622 VOID FreeWindowStation( 04623 IN PWINDOWSTATION WindowStation); 04624 04625 NTSTATUS ParseWindowStation( 04626 IN PVOID ParseObject, 04627 IN PVOID ObjectType, 04628 IN OUT PACCESS_STATE AccessState, 04629 IN KPROCESSOR_MODE AccessMode, 04630 IN ULONG Attributes, 04631 IN OUT PUNICODE_STRING CompleteName, 04632 IN OUT PUNICODE_STRING RemainingName, 04633 IN OUT PVOID Context OPTIONAL, 04634 IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL, 04635 OUT PVOID *Object); 04636 04637 BOOLEAN OkayToCloseWindowStation( 04638 IN PEPROCESS Process OPTIONAL, 04639 IN PVOID Object, 04640 IN HANDLE Handle 04641 ); 04642 04643 /* 04644 * Object manager callouts for desktops 04645 */ 04646 VOID MapDesktop( 04647 IN OB_OPEN_REASON OpenReason, 04648 IN PEPROCESS Process OPTIONAL, 04649 IN PVOID Object, 04650 IN ACCESS_MASK GrantedAccess, 04651 IN ULONG HandleCount); 04652 04653 VOID UnmapDesktop( 04654 IN PEPROCESS Process OPTIONAL, 04655 IN PVOID Object, 04656 IN ACCESS_MASK GrantedAccess, 04657 IN ULONG ProcessHandleCount, 04658 IN ULONG SystemHandleCount); 04659 04660 VOID FreeDesktop( 04661 IN PVOID Desktop); 04662 04663 NTSTATUS ParseDesktop( 04664 IN PVOID ParseObject, 04665 IN PVOID ObjectType, 04666 IN OUT PACCESS_STATE AccessState, 04667 IN KPROCESSOR_MODE AccessMode, 04668 IN ULONG Attributes, 04669 IN OUT PUNICODE_STRING CompleteName, 04670 IN OUT PUNICODE_STRING RemainingName, 04671 IN OUT PVOID Context OPTIONAL, 04672 IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL, 04673 OUT PVOID *Object); 04674 04675 BOOLEAN OkayToCloseDesktop( 04676 IN PEPROCESS Process OPTIONAL, 04677 IN PVOID Object, 04678 IN HANDLE Handle 04679 ); 04680 04681 /* 04682 * Routines pilfered from kernel32 04683 */ 04684 VOID UserSleep(DWORD dwMilliseconds); 04685 BOOL UserBeep(DWORD dwFreq, DWORD dwDuration); 04686 NTSTATUS UserRtlCreateAtomTable(ULONG NumberOfBuckets); 04687 ATOM UserAddAtom(LPCWSTR lpAtom, BOOL bPin); 04688 ATOM UserFindAtom(LPCWSTR lpAtom); 04689 ATOM UserDeleteAtom(ATOM atom); 04690 UINT UserGetAtomName(ATOM atom, LPWSTR lpch, int cchMax); 04691 04692 #define FindClassAtom(lpszClassName) \ 04693 (IS_PTR(lpszClassName) ? UserFindAtom(lpszClassName) : PTR_TO_ID(lpszClassName)) 04694 04695 /* 04696 * Keyboard Layouts 04697 */ 04698 VOID ChangeForegroundKeyboardTable(PKL pklOld, PKL pklNew); 04699 HKL xxxLoadKeyboardLayoutEx(PWINDOWSTATION, HANDLE, HKL, UINT, LPCWSTR, UINT, UINT); 04700 HKL xxxActivateKeyboardLayout(PWINDOWSTATION pwinsta, HKL hkl, UINT Flags, PWND pwnd); 04701 HKL xxxInternalActivateKeyboardLayout(PKL pkl, UINT Flags, PWND pwnd); 04702 BOOL GetKbdLangSwitch(PUNICODE_STRING pProfileUserName); 04703 04704 BOOL xxxUnloadKeyboardLayout(PWINDOWSTATION, HKL); 04705 VOID RemoveKeyboardLayoutFile(PKBDFILE pkf); 04706 HKL _GetKeyboardLayout(DWORD idThread); 04707 UINT _GetKeyboardLayoutList(PWINDOWSTATION pwinsta, UINT nItems, HKL *lpBuff); 04708 VOID xxxFreeKeyboardLayouts(PWINDOWSTATION, BOOL bUnlock); 04709 04710 DWORD xxxDragObject(PWND pwndParent, PWND xhwndFrom, UINT wFmt, 04711 ULONG_PTR dwData, PCURSOR xpcur); 04712 BOOL xxxDragDetect(PWND pwnd, POINT pt); 04713 BOOL xxxIsDragging(PWND pwnd, POINT ptScreen, UINT uMsg); 04714 04715 HKL GetActiveHKL(); 04716 04717 #define DMI_INVERT 0x00000001 04718 #define DMI_GRAYED 0x00000002 04719 04720 void xxxDrawMenuItem(HDC hdc, PMENU pMenu, PITEM pItem, DWORD dwFlags); 04721 04722 BOOL xxxRealDrawMenuItem(HDC hdc, PGRAYMENU lpGray, int cx, int cy); 04723 04724 void xxxDrawMenuBarUnderlines(PWND pwnd, BOOL fShow); 04725 04726 /* 04727 * Menu macros 04728 */ 04729 __inline BOOL IsRootPopupMenu(PPOPUPMENU ppopupmenu) 04730 { 04731 return (ppopupmenu == ppopupmenu->ppopupmenuRoot); 04732 } 04733 __inline BOOL ExitMenuLoop (PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu) 04734 { 04735 return (!pMenuState->fInsideMenuLoop || ppopupmenu->fDestroyed); 04736 } 04737 __inline PMENUSTATE GetpMenuState (PWND pwnd) 04738 { 04739 return (GETPTI(pwnd)->pMenuState); 04740 } 04741 __inline PPOPUPMENU GetpGlobalPopupMenu (PWND pwnd) 04742 { 04743 return (GetpMenuState(pwnd) ? GetpMenuState(pwnd)->pGlobalPopupMenu : NULL); 04744 } 04745 __inline BOOL IsInsideMenuLoop(PTHREADINFO pti) 04746 { 04747 return ((pti->pMenuState != NULL) && pti->pMenuState->fInsideMenuLoop); 04748 } 04749 __inline BOOL IsMenuStarted(PTHREADINFO pti) 04750 { 04751 return ((pti->pMenuState != NULL) && pti->pMenuState->fMenuStarted); 04752 } 04753 __inline PITEM MNGetToppItem(PMENU pMenu) 04754 { 04755 return pMenu->rgItems + pMenu->iTop; 04756 } 04757 __inline BOOL MNIsItemSelected(PPOPUPMENU ppopupmenu) 04758 { 04759 return ((int)ppopupmenu->posSelectedItem >= 0); 04760 } 04761 __inline PITEM MNGetSelectedpitem(PPOPUPMENU ppopupmenu) 04762 { 04763 return ppopupmenu->spmenu->rgItems + ppopupmenu->posSelectedItem; 04764 } 04765 __inline BOOL MNIsScrollArrowSelected(PPOPUPMENU ppopupmenu) 04766 { 04767 return ((ppopupmenu->posSelectedItem == MFMWFP_UPARROW) 04768 || (ppopupmenu->posSelectedItem == MFMWFP_DOWNARROW)); 04769 } 04770 __inline BOOL IsModelessMenuNotificationWindow (PWND pwnd) 04771 { 04772 PMENUSTATE pMenuState; 04773 return (((pMenuState = GetpMenuState(pwnd)) != NULL) 04774 && pMenuState->fModelessMenu 04775 && (pMenuState->pGlobalPopupMenu->spwndNotify == pwnd)); 04776 } 04777 __inline BOOL IsRecursedMenuState(PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu) 04778 { 04779 return (pMenuState->pGlobalPopupMenu != ppopupmenu->ppopupmenuRoot); 04780 } 04781 04782 __inline BOOL IsMDIItem (PITEM pitem) 04783 { 04784 return (TestMFS(pitem, MFS_CACHEDBMP) 04785 && (pitem->hbmp != NULL) 04786 && (pitem->hbmp <= HBMMENU_MBARLAST)); 04787 } 04788 04789 04790 #define MNXBORDER (SYSMET(CXBORDER) + SYSMET(CXEDGE)) 04791 #define MNYBORDER (SYSMET(CYBORDER) + SYSMET(CYEDGE)) 04792 #define MNXSPACE (SYSMET(CXEDGE)) 04793 #define MNLEFTMARGIN (SYSMET(CXEDGE)) 04794 04795 /* 04796 * xxxMNUpdateShownMenu flags 04797 */ 04798 #define MNUS_DEFAULT 0x00000001 04799 #define MNUS_DELETE 0x00000002 04800 #define MNUS_DRAWFRAME 0x00000004 04801 04802 /* This tells xxxMNItemSize that the bitamp size is not avilable */ 04803 #define MNIS_MEASUREBMP -1 04804 04805 04806 /* 04807 * MN_SIZEWINDOW wParam flag. xxxMNUpdateShownMenu sends this 04808 * message, so keep MNSW_ and MNUS_ in sync. 04809 */ 04810 #define MNSW_RETURNSIZE 0 04811 #define MNSW_SIZE MNUS_DEFAULT 04812 #define MNSW_DRAWFRAME MNUS_DRAWFRAME 04813 04814 /* 04815 * Animation flags (pMenuState->iAniDropDir) 04816 */ 04817 #define PAS_RIGHT (TPM_HORPOSANIMATION >> TPM_FIRSTANIBITPOS) 04818 #define PAS_LEFT (TPM_HORNEGANIMATION >> TPM_FIRSTANIBITPOS) 04819 #define PAS_DOWN (TPM_VERPOSANIMATION >> TPM_FIRSTANIBITPOS) 04820 #define PAS_UP (TPM_VERNEGANIMATION >> TPM_FIRSTANIBITPOS) 04821 #define PAS_OUT 0x10 04822 #define PAS_HORZ (PAS_LEFT | PAS_RIGHT) 04823 #define PAS_VERT (PAS_UP | PAS_DOWN) 04824 04825 #if (PAS_HORZ + PAS_VERT >= PAS_OUT) 04826 #error PAS_ & TPM_*ANIMATION conflict. 04827 #endif 04828 04829 #define CXMENU3DEDGE 1 04830 #define CYMENU3DEDGE 1 04831 04832 /* 04833 * Scrollbar initialization types 04834 */ 04835 #define SCROLL_NORMAL 0 04836 #define SCROLL_DIRECT 1 04837 #define SCROLL_MENU 2 04838 04839 /* 04840 * movesize.c 04841 */ 04842 void xxxDrawDragRect(PMOVESIZEDATA pmsd, LPRECT lprc, UINT flags); 04843 void GetMonitorMaxArea(PWND pwnd, PMONITOR pMonitor, LPRECT * pprc); 04844 04845 /* 04846 * focusact.c 04847 */ 04848 VOID SetForegroundPriorityProcess(PPROCESSINFO ppi, PTHREADINFO pti, BOOL fSetForegound); 04849 VOID SetForegroundPriority(PTHREADINFO pti, BOOL fSetForeground); 04850 void xxxUpdateTray(PWND pwnd); 04851 04852 04853 // 04854 // mnchange.c 04855 // 04856 void xxxMNUpdateShownMenu(PPOPUPMENU ppopup, PITEM pItem, UINT uFlags); 04857 04858 // 04859 // mnkey.c 04860 // 04861 UINT xxxMNFindChar(PMENU pMenu, UINT ch, INT idxC, INT *lpr); 04862 UINT MNFindItemInColumn(PMENU pMenu, UINT idxB, int dir, BOOL fRoot); 04863 04864 // 04865 // mndraw.c 04866 // 04867 void MNAnimate(PMENUSTATE pMenuState, BOOL fIterate); 04868 void MNDrawFullNC(PWND pwnd, HDC hdcIn, PPOPUPMENU ppopup); 04869 void MNDrawArrow(HDC hdcIn, PPOPUPMENU ppopup, UINT uArrow); 04870 void MNEraseBackground (HDC hdc, PMENU pmenu, int x, int y, int cx, int cy); 04871 04872 // 04873 // mnstate.c 04874 // 04875 PMENUSTATE xxxMNAllocMenuState(PTHREADINFO ptiCurrent, PTHREADINFO ptiNotify, PPOPUPMENU ppopupmenuRoot); 04876 void xxxMNEndMenuState(BOOL fFreePopup); 04877 BOOL MNEndMenuStateNotify (PMENUSTATE pMenuState); 04878 void MNFlushDestroyedPopups (PPOPUPMENU ppopupmenu, BOOL fUnlock); 04879 BOOL MNSetupAnimationDC (PMENUSTATE pMenuState); 04880 BOOL MNCreateAnimationBitmap(PMENUSTATE pMenuState, UINT cx, UINT cy); 04881 void MNDestroyAnimationBitmap(PMENUSTATE pMenuState); 04882 PMENUSTATE xxxMNStartMenuState(PWND pwnd, DWORD cmd, LPARAM lParam); 04883 __inline void LockMenuState (PMENUSTATE pMenuState) 04884 { 04885 (pMenuState->dwLockCount)++; 04886 } 04887 BOOL xxxUnlockMenuState (PMENUSTATE pMenuState); 04888 04889 // 04890 // menu.c 04891 // 04892 #if DBG 04893 void Validateppopupmenu (PPOPUPMENU ppopupmenu); 04894 #else // DBG 04895 #define Validateppopupmenu(ppopupmenu) 04896 #endif // DBG 04897 04898 #if DBG 04899 #define MNGetpItemIndex DBGMNGetpItemIndex 04900 UINT DBGMNGetpItemIndex(PMENU pmenu, PITEM pitem); 04901 #else // DBG 04902 #define MNGetpItemIndex _MNGetpItemIndex 04903 #endif // DBG 04904 __inline UINT _MNGetpItemIndex(PMENU pmenu, PITEM pitem) 04905 {return (UINT)(((ULONG_PTR)pitem - (ULONG_PTR)pmenu->rgItems) / sizeof(ITEM));} 04906 04907 void xxxMNDismiss (PMENUSTATE pMenuState); 04908 PITEM MNGetpItem(PPOPUPMENU ppopup, UINT uIndex); 04909 void xxxMNSetCapture (PPOPUPMENU ppopup); 04910 void xxxMNReleaseCapture (void); 04911 void MNCheckButtonDownState (PMENUSTATE pMenuState); 04912 PWND GetMenuStateWindow (PMENUSTATE pMenuState); 04913 PVOID LockPopupMenu(PPOPUPMENU ppopup, PMENU * pspmenu, PMENU pmenu); 04914 PVOID UnlockPopupMenu(PPOPUPMENU ppopup, PMENU * pspmenu); 04915 PVOID LockWndMenu(PWND pwnd, PMENU * pspmenu, PMENU pmenu); 04916 PVOID UnlockWndMenu(PWND pwnd, PMENU * pspmenu); 04917 UINT MNSetTimerToCloseHierarchy(PPOPUPMENU ppopup); 04918 BOOL xxxMNSetTop(PPOPUPMENU ppopup, int iNewTop); 04919 LRESULT xxxMenuWindowProc(PWND, UINT, WPARAM, LPARAM); 04920 VOID xxxMNButtonUp(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT posItemHit, LPARAM lParam); 04921 VOID xxxMNButtonDown(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT posItemHit, BOOL fClick); 04922 PITEM xxxMNSelectItem(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT itemPos); 04923 BOOL xxxMNSwitchToAlternateMenu(PPOPUPMENU ppopupMenu); 04924 void xxxMNCancel(PMENUSTATE pMenuState, UINT uMsg, UINT cmd, LPARAM lParam); 04925 VOID xxxMNKeyDown(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT key); 04926 BOOL xxxMNDoubleClick(PMENUSTATE pMenuState, PPOPUPMENU ppopup, int idxItem); 04927 VOID xxxMNCloseHierarchy(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState); 04928 PWND xxxMNOpenHierarchy(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState); 04929 void LockMFMWFPWindow (PULONG_PTR puHitArea, ULONG_PTR uNewHitArea); 04930 void UnlockMFMWFPWindow (PULONG_PTR puHitArea); 04931 BOOL IsMFMWFPWindow (ULONG_PTR uHitArea); 04932 LONG_PTR xxxMNFindWindowFromPoint(PPOPUPMENU ppopupMenu, PUINT pIndex, POINTS screenPt); 04933 VOID xxxMNMouseMove(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, POINTS screenPt); 04934 int xxxMNCompute(PMENU pMenu, PWND pwndNotify, DWORD yMenuTop, 04935 DWORD xMenuLeft,DWORD cxMax, LPDWORD lpdwHeight); 04936 VOID xxxMNRecomputeBarIfNeeded(PWND pwndNotify, PMENU pMenu); 04937 VOID xxxMenuDraw(HDC hdc, PMENU pMenu); 04938 UINT MNFindNextValidItem(PMENU pMenu, int i, int dir, UINT flags); 04939 VOID MNFreeItem(PMENU pMenu, PITEM pItem, BOOL fFreeItemPopup); 04940 BOOL xxxMNStartMenu(PPOPUPMENU ppopupMenu, int mn); 04941 VOID MNPositionSysMenu(PWND pwnd, PMENU pSysMenu); 04942 04943 PITEM xxxMNInvertItem(PPOPUPMENU ppopupmenu, PMENU pMenu,int itemNumber,PWND pwndNotify, BOOL fOn); 04944 04945 VOID xxxSendMenuSelect(PWND pwndNotify, PWND pwndMenu, PMENU pMenu, int idx); 04946 #define SMS_NOMENU (PMENU)(-1) 04947 04948 04949 BOOL xxxSetSystemMenu(PWND pwnd, PMENU pMenu); 04950 BOOL xxxSetDialogSystemMenu(PWND pwnd); 04951 04952 VOID xxxMNChar(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT character); 04953 PPOPUPMENU MNAllocPopup(BOOL fForceAlloc); 04954 VOID MNFreePopup(PPOPUPMENU ppopupmenu); 04955 04956 /* 04957 * Menu entry points used by the rest of USER 04958 */ 04959 VOID xxxMNKeyFilter(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT ch); 04960 int xxxMenuBarCompute(PMENU pMenu, PWND pwndNotify, DWORD yMenuTop, 04961 DWORD xMenuLeft, int cxMax); 04962 VOID xxxEndMenu(PMENUSTATE pMenuState); 04963 BOOL xxxCallHandleMenuMessages(PMENUSTATE pMenuState, PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam); 04964 BOOL xxxHandleMenuMessages(LPMSG lpmsg, PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu); 04965 void xxxEndMenuLoop (PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu); 04966 int xxxMNLoop(PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, LPARAM lParam, BOOL fDblClk); 04967 VOID xxxSetSysMenu(PWND pwnd); 04968 PMENU xxxGetSysMenuHandle(PWND pwnd); 04969 PMENU xxxGetSysMenu(PWND pwnd, BOOL fSubMenu); 04970 PMENU MakeMenuRtoL(PMENU pMenu, BOOL bRtoL); 04971 HDC CreateCompatiblePublicDC(HDC hdc, HBITMAP *pbmDCGray); 04972 void xxxPSMTextOut(HDC hdc, int xLeft, int yTop, LPWSTR lpsz, int cch, DWORD dwFlags); 04973 BOOL xxxPSMGetTextExtent(HDC hdc, LPWSTR lpstr, int cch, PSIZE psize); 04974 04975 /* 04976 * LPK callbacks 04977 */ 04978 void xxxClientPSMTextOut(HDC hdc, int xLeft, int yTop, PUNICODE_STRING lpsz, int cch, DWORD dwFlags); 04979 int xxxClientLpkDrawTextEx(HDC hdc, int xLeft, int yTop, LPCWSTR lpsz, int nCount, 04980 BOOL fDraw, UINT wFormat, LPDRAWTEXTDATA lpDrawInfo, UINT bAction, int iCharSet); 04981 BOOL xxxClientExtTextOutW(HDC hdc, int x, int y, int flOpts, RECT *prcl, 04982 LPCWSTR pwsz, UINT cwc, INT *pdx); 04983 BOOL xxxClientGetTextExtentPointW(HDC hdc, LPCWSTR lpstr, int cch, PSIZE psize); 04984 04985 /* 04986 * Menu Drag and Drop 04987 */ 04988 NTSTATUS xxxClientRegisterDragDrop (HWND hwnd); 04989 NTSTATUS xxxClientRevokeDragDrop (HWND hwnd); 04990 NTSTATUS xxxClientLoadOLE(VOID); 04991 void xxxMNSetGapState (ULONG_PTR uHitArea, UINT uIndex, UINT uFlags, BOOL fSet); 04992 BOOL xxxMNDragOver(POINT * ppt, PMNDRAGOVERINFO pmndoi); 04993 BOOL xxxMNDragLeave(VOID); 04994 void xxxMNUpdateDraggingInfo (PMENUSTATE pMenuState, ULONG_PTR uHitArea, UINT uIndex); 04995 04996 /* 04997 * Scroll bar entry points 04998 */ 04999 VOID xxxSBTrackInit(PWND pwnd, LPARAM lParam, int curArea, UINT uType); 05000 VOID SBCtlSetup(PSBWND psbwnd); 05001 void CalcSBStuff(PWND pwnd, PSBCALC pSBCalc, BOOL fVert); 05002 void CalcSBStuff2(PSBCALC pSBCalc, LPRECT lprc, CONST PSBDATA pw, BOOL fVert); 05003 BOOL xxxEnableScrollBar(PWND pwnd, UINT wSBflags, UINT wArrows); 05004 void DrawSize(PWND pwnd, HDC hdc, int cxFrame, int cyFrame); 05005 int xxxScrollWindowEx(PWND pwnd, int dx, int dy, LPRECT prcScroll, 05006 LPRECT prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, DWORD flags); 05007 void xxxDoScrollMenu(PWND pwndNotify, PWND pwndSB, BOOL fVert, LPARAM lParam); 05008 05009 /* 05010 * ICONS.C 05011 */ 05012 BOOL xxxInternalEnumWindow(PWND pwndNext, WNDENUMPROC_PWND lpfn, LPARAM lParam, UINT fEnumChildren); 05013 VOID ISV_InitMinMaxInfo(PWND pwnd, PPOINT aptMinMaxWnd); 05014 VOID ISV_ValidateMinMaxInfo(PWND pwnd, PPOINT aptMinMaxWnd); 05015 /* 05016 * GETSET.C 05017 */ 05018 WORD _SetWindowWord(PWND pwnd, int index, WORD value); 05019 DWORD xxxSetWindowLong(PWND pwnd, int index, DWORD value, BOOL bAnsi); 05020 ULONG_PTR xxxSetWindowData(PWND pwnd, int index, ULONG_PTR dwData, BOOL bAnsi); 05021 LONG xxxSetWindowStyle(PWND pwnd, int gwl, DWORD styleNew); 05022 BOOL FCallerOk(PWND pwnd); 05023 05024 int IntersectVisRect(HDC, int, int, int, int); // Imported from GDI 05025 PCURSOR xxxGetWindowSmIcon(PWND pwnd, BOOL fDontSendMsg); 05026 VOID xxxDrawCaptionBar(PWND pwnd, HDC hdc, UINT fFlags); 05027 VOID xxxDrawScrollBar(PWND pwnd, HDC hdc, BOOL fVert); 05028 VOID xxxTrackBox(PWND, UINT, WPARAM, LPARAM, PSBCALC); 05029 VOID xxxTrackThumb(PWND, UINT, WPARAM, LPARAM, PSBCALC); 05030 VOID xxxEndScroll(PWND pwnd, BOOL fCancel); 05031 VOID xxxDrawWindowFrame(PWND pwnd, HDC hdc, 05032 BOOL fHungRedraw, BOOL fActive); 05033 BOOL xxxInternalPaintDesktop(PWND pwnd, HDC hdc, BOOL fPaint); 05034 VOID xxxSysCommand(PWND pwnd, DWORD cmd, LPARAM lParam); 05035 VOID xxxHandleNCMouseGuys(PWND pwnd, UINT message, int htArea, LPARAM lParam); 05036 void xxxCreateClassSmIcon(PCLS pcls); 05037 HICON xxxCreateWindowSmIcon(PWND pwnd, HICON hIconBig, BOOL fCopyFromRes); 05038 BOOL DestroyWindowSmIcon(PWND pwnd); 05039 BOOL DestroyClassSmIcon(PCLS pcls); 05040 UINT DWP_GetHotKey(PWND); 05041 UINT DWP_SetHotKey(PWND, DWORD); 05042 PWND HotKeyToWindow(DWORD); 05043 05044 VOID xxxDWP_DoNCActivate(PWND pwnd, DWORD dwFlags, HRGN hrgnClip); 05045 #define NCA_ACTIVE 0x00000001 05046 #define NCA_FORCEFRAMEOFF 0x00000002 05047 05048 VOID xxxDWP_ProcessVirtKey(UINT key); 05049 BOOL xxxDWP_EraseBkgnd(PWND pwnd, UINT msg, HDC hdc); 05050 VOID SetTiledRect(PWND pwnd, LPRECT lprc, PMONITOR pMonitor); 05051 VOID LinkWindow(PWND pwnd, PWND pwndInsert, PWND pwndParent); 05052 VOID UnlinkWindow(PWND pwndUnlink, PWND pwndParent); 05053 VOID xxxDW_DestroyOwnedWindows(PWND pwndParent); 05054 VOID xxxDW_SendDestroyMessages(PWND pwnd); 05055 VOID xxxFreeWindow(PWND pwnd, PTL ptlpwndFree); 05056 VOID xxxFW_DestroyAllChildren(PWND pwnd); 05057 05058 PHOTKEY FindHotKey(PTHREADINFO pti, PWND pwnd, int id, UINT fsModifiers, UINT vk, 05059 BOOL fUnregister, PBOOL pfKeysExist); 05060 05061 NTSTATUS _BuildNameList( 05062 PWINDOWSTATION pwinsta, 05063 PNAMELIST pNameList, 05064 UINT cbNameList, 05065 PUINT pcbNeeded); 05066 05067 VOID xxxHelpLoop(PWND pwnd); 05068 05069 NTSTATUS _BuildPropList(PWND pwnd, PROPSET aPropSet[], UINT cPropMax, PUINT pcPropReturned); 05070 BOOL xxxSendEraseBkgnd(PWND pwnd, HDC hdcBeginPaint, HRGN hrgnUpdate); 05071 LONG xxxSetScrollBar(PWND pwnd, int code, LPSCROLLINFO lpsi, BOOL fRedraw); 05072 VOID IncPaintCount(PWND pwnd); 05073 VOID DecPaintCount(PWND pwnd); 05074 PPROP CreateProp(PWND pwnd); 05075 05076 /* 05077 * METRICS.C 05078 */ 05079 VOID xxxRecreateSmallIcons(PWND pwnd); 05080 05081 VOID TransferWakeBit(PTHREADINFO pti, UINT message); 05082 BOOL SysHasKanji(VOID); 05083 LONG xxxBroadcastMessage(PWND, UINT, WPARAM, LPARAM, UINT, PBROADCASTMSG ); 05084 05085 VOID zzzSetFMouseMoved(); 05086 05087 VOID TimersProc(VOID); 05088 05089 VOID PostMove(PQ pq); 05090 VOID DestroyWindowsTimers(PWND pwnd); 05091 05092 UINT_PTR StartTimers(VOID); 05093 05094 /*==========================================================================*/ 05095 /* */ 05096 /* Internal Function Declarations */ 05097 /* */ 05098 /*==========================================================================*/ 05099 05100 LRESULT xxxTooltipWndProc(PWND, UINT, WPARAM, LPARAM); 05101 LRESULT xxxSwitchWndProc(PWND, UINT, WPARAM, LPARAM); 05102 LRESULT xxxDesktopWndProc(PWND, UINT, WPARAM, LPARAM); 05103 05104 LRESULT xxxSBWndProc(PSBWND, UINT, WPARAM, LPARAM); 05105 05106 VOID DrawThumb2(PWND, PSBCALC, HDC, HBRUSH, BOOL, UINT); 05107 UINT GetWndSBDisableFlags(PWND, BOOL); 05108 05109 HANDLE _ConvertMemHandle(LPBYTE lpData, int cbData); 05110 05111 VOID zzzRegisterSystemThread (DWORD flags, DWORD reserved); 05112 05113 VOID zzzUpdateCursorImage(); 05114 void zzzCalcStartCursorHide(PW32PROCESS Process, DWORD timeAdd); 05115 BOOL FinalUserInit(); 05116 BOOL LW_RegisterWindows(BOOL fSystem); 05117 05118 BOOL xxxSystemParametersInfo(UINT wFlag, DWORD wParam, LPVOID lParam, UINT flags); 05119 05120 PWINDOWSTATION CheckClipboardAccess(void); 05121 PCLIP FindClipFormat(PWINDOWSTATION pwinsta, UINT format); 05122 BOOL InternalSetClipboardData(PWINDOWSTATION pwinsta, UINT format, 05123 HANDLE hData, BOOL fGlobalHandle, BOOL fIncSerialNumber); 05124 VOID DisownClipboard(PWND pwndClipOwner); 05125 05126 VOID CaretBlinkProc(PWND pwnd, UINT message, UINT_PTR id, LPARAM lParam); 05127 VOID xxxRedrawFrame(PWND pwnd); 05128 VOID xxxRedrawFrameAndHook(PWND pwnd); 05129 VOID BltColor(HDC, HBRUSH, HDC, int, int, int, int, int, int, UINT); 05130 VOID StoreMessage(LPMSG pmsg, PWND pwnd, UINT message, WPARAM wParam, 05131 LPARAM lParam, DWORD time); 05132 VOID StoreQMessage(PQMSG pqmsg, PWND pwnd, UINT message, WPARAM wParam, 05133 LPARAM lParam, DWORD time, DWORD dwQEvent, ULONG_PTR dwExtraInfo); 05134 05135 #ifdef REDIRECTION 05136 void __inline StoreQMessagePti(PQMSG pqmsg, PTHREADINFO pti) 05137 { 05138 if (pqmsg->msg.message >= WM_MOUSEFIRST && pqmsg->msg.message <= WM_MOUSELAST) { 05139 pqmsg->msg.pt.x = LOWORD(pqmsg->msg.lParam); 05140 pqmsg->msg.pt.y = HIWORD(pqmsg->msg.lParam); 05141 } else { 05142 if (pti != NULL) 05143 pqmsg->msg.pt = pti->ptLast; 05144 } 05145 pqmsg->pti = pti; 05146 } 05147 #else 05148 void __inline StoreQMessagePti(PQMSG pqmsg, PTHREADINFO pti) 05149 { 05150 pqmsg->pti = pti; 05151 } 05152 #endif // REDIRECTION 05153 05154 VOID xxxSendSizeMessage(PWND pwnd, UINT cmdSize); 05155 05156 VOID xxxCheckFocus(PWND pwnd); 05157 VOID OffsetChildren(PWND pwnd, int dx, int dy, LPRECT prcHitTest); 05158 05159 VOID xxxMoveSize(PWND pwnd, UINT cmdMove, DWORD wptStart); 05160 VOID xxxShowOwnedWindows(PWND pwndOwner, UINT cmdShow, HRGN hrgnHung); 05161 VOID xxxAdjustSize(PWND pwnd, LPINT lpcx, LPINT lpcy); 05162 05163 VOID xxxNextWindow(PQ pq, DWORD wParam); 05164 VOID xxxOldNextWindow(UINT flags); 05165 VOID xxxCancelCoolSwitch(void); 05166 05167 VOID xxxCancelTracking(VOID); 05168 VOID xxxCancelTrackingForThread(PTHREADINFO ptiCancel); 05169 VOID xxxCapture(PTHREADINFO pti, PWND pwnd, UINT code); 05170 UINT SystoChar(UINT message, LPARAM lParam); 05171 05172 PHOOK PhkFirstValid(PTHREADINFO pti, int nFilterType); 05173 PHOOK PhkFirstGlobalValid(PTHREADINFO pti, int nFilterType); 05174 VOID FreeHook(PHOOK phk); 05175 int xxxCallHook(int, WPARAM, LPARAM, int); 05176 LRESULT xxxCallHook2(PHOOK, int, WPARAM, LPARAM, LPBOOL); 05177 BOOL xxxCallMouseHook(UINT message, PMOUSEHOOKSTRUCTEX pmhs, BOOL fRemove); 05178 VOID xxxCallJournalRecordHook(PQMSG pqmsg); 05179 DWORD xxxCallJournalPlaybackHook(PQMSG pqmsg); 05180 VOID SetJournalTimer(DWORD dt, UINT msgJournal); 05181 VOID FreeThreadsWindowHooks(VOID); 05182 05183 BOOL xxxSnapWindow(PWND pwnd); 05184 05185 BOOL DefSetText(PWND pwnd, PLARGE_STRING pstrText); 05186 PWND DSW_GetTopLevelCreatorWindow(PWND pwnd); 05187 VOID xxxCalcClientRect(PWND pwnd, LPRECT lprc, BOOL fHungRedraw); 05188 VOID xxxUpdateClientRect(PWND pwnd); 05189 05190 BOOL AllocateUnicodeString(PUNICODE_STRING pstrDst, PUNICODE_STRING pstrSrc); 05191 05192 HANDLE CreateDesktopHeap(PWIN32HEAP* ppheapRet, ULONG ulHeapSize); 05193 05194 BOOL xxxSetInternalWindowPos(PWND pwnd, UINT cmdShow, LPRECT lprcWin, 05195 LPPOINT lpptMin); 05196 VOID xxxMetricsRecalc(UINT wFlags, int dx, int dy, int dyCaption, int dyMenu); 05197 05198 VOID xxxBroadcastDisplaySettingsChange(PDESKTOP, BOOL); 05199 05200 05201 /* 05202 * This is for SPI_GET/SETUSERPREFERENCE. 05203 * Currently it's for DWORD values only. A type field will be added 05204 * so all new settings will be mostly handled through common SystemParametersInfo 05205 * code. 05206 */ 05207 typedef struct tagPROFILEVALUEINFO { 05208 DWORD dwValue; 05209 UINT uSection; 05210 LPCWSTR pwszKeyName; 05211 } PROFILEVALUEINFO, *PPROFILEVALUEINFO; 05212 05213 /* 05214 * SystemParametersInfo UserPreferences manipulation macros. 05215 * SPI_ values in the BOOL or DWORD ranges (see winuser.w) are stored in 05216 * gpdwCPUserPreferencesMask (BOOL) and gpviCPUserPreferences (DOWRD) (see kernel\globals.c). 05217 * The following macros use the actual SPI_ value to determine the 05218 * location of a given bit (BOOL mask) or DWORD in those globals. 05219 * 05220 * Macros to access DWORDs stored in gpviCPUserPreferences. 05221 * 05222 */ 05223 #define UPIsDWORDRange(uSetting) \ 05224 ((uSetting) >= SPI_STARTDWORDRANGE && (uSetting) < SPI_MAXDWORDRANGE) 05225 05226 /* 05227 * The first entry in gpviCPUserPreferences is reserved for the bitmask, so add 1. 05228 * Each setting has SPI_GET and SPI_SET, so divide by 2 to get the index 05229 */ 05230 #define UPDWORDIndex(uSetting) \ 05231 (1 + (((uSetting) - SPI_STARTDWORDRANGE) / 2)) 05232 05233 /* 05234 * Macros to access BOOLs stored in gpdwCPUserPreferencesMask. 05235 */ 05236 #define UPIsBOOLRange(uSetting) \ 05237 ((uSetting) >= SPI_STARTBOOLRANGE && (uSetting) < SPI_MAXBOOLRANGE) 05238 05239 /* 05240 * Each setting has SPI_GET and SPI_SET, so divide by 2 to get the index 05241 */ 05242 #define UPBOOLIndex(uSetting) \ 05243 (((uSetting) - SPI_STARTBOOLRANGE) / 2) 05244 05245 /* 05246 * Returns a pointer to the DWORD that contains the bit corresponding to uSetting 05247 */ 05248 #define UPBOOLPointer(pdw, uSetting) \ 05249 (pdw + (UPBOOLIndex(uSetting) / 32)) 05250 05251 /* 05252 * Returns the DWORD mask needed to test/set/clear the bit corresponding to uSetting 05253 */ 05254 #define UPBOOLMask(uSetting) \ 05255 (1 << (UPBOOLIndex(uSetting) - ((UPBOOLIndex(uSetting) / 32) * 32))) 05256 05257 #define TestUPBOOL(pdw, uSetting) \ 05258 (*UPBOOLPointer(pdw, uSetting) & UPBOOLMask(uSetting)) 05259 05260 #define SetUPBOOL(pdw, uSetting) \ 05261 (*UPBOOLPointer(pdw, uSetting) |= UPBOOLMask(uSetting)) 05262 05263 #define ClearUPBOOL(pdw, uSetting) \ 05264 { \ 05265 UserAssert(UPIsBOOLRange(uSetting)); \ 05266 *UPBOOLPointer(pdw, uSetting) &= ~UPBOOLMask(uSetting); \ 05267 } 05268 05269 /* 05270 * Use these macros ONLY if UPIsBOOLRange(SPI_GET ## uSetting) is TRUE 05271 */ 05272 #define TestUP(uSetting) TestUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting) 05273 #define SetUP(uSetting) SetUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting) 05274 #define ClearUP(uSetting) ClearUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting) 05275 05276 #define IndexUP(uSetting) \ 05277 (1 << (((uSetting) - SPI_STARTBOOLRANGE) / 2)) 05278 05279 /* 05280 * Some settings (ie, UI Effects) are disabled when TestUP(UISETTINGS) is FALSE. 05281 */ 05282 #define TestEffectUP(uSetting) \ 05283 ((*gpdwCPUserPreferencesMask & \ 05284 (IndexUP(SPI_GET ## uSetting) | IndexUP(SPI_GETUIEFFECTS))) == \ 05285 (IndexUP(SPI_GET ## uSetting) | IndexUP(SPI_GETUIEFFECTS))) 05286 05287 /* 05288 * Some UI effects have an "inverted" disabled value (ie, disabled is TRUE) 05289 */ 05290 #define TestEffectInvertUP(uSetting) (TestUP(uSetting) || !TestUP(UIEFFECTS)) 05291 05292 /* 05293 * Some of these BOOL values are needed in the client side. This macro propagates them to gpsi->PUSIFlags 05294 * Note that the SI_ value must match the UPBOOLMask value for this to work fine. 05295 */ 05296 #define PropagetUPBOOLTogpsi(uSetting) \ 05297 UserAssert((DWORD)(PUSIF_ ## uSetting) == (DWORD)UPBOOLMask(SPI_GET ## uSetting)); \ 05298 COPY_FLAG(gpsi->PUSIFlags, TestUP(## uSetting), PUSIF_ ## uSetting) 05299 05300 BOOL xxxUpdatePerUserSystemParameters(HANDLE hToken, BOOL bUserLoggedOn); 05301 VOID SaveVolatileUserSettings(VOID); 05302 05303 void MenuRecalc(void); 05304 05305 #define UNDERLINE_RECALC 0x7FFFFFFF // MAXINT; tells us to recalc underline position 05306 05307 05308 /* 05309 * Library management routines. 05310 */ 05311 int GetHmodTableIndex(PUNICODE_STRING pstrName); 05312 VOID AddHmodDependency(int iatom); 05313 VOID RemoveHmodDependency(int iatom); 05314 HANDLE xxxLoadHmodIndex(int iatom, BOOL bWx86KnownDll); 05315 VOID xxxDoSysExpunge(PTHREADINFO pti); 05316 05317 05318 #define UnrealizeObject(hbr) /* NOP for NT */ 05319 05320 05321 VOID DestroyThreadsObjects(VOID); 05322 VOID MarkThreadsObjects(PTHREADINFO pti); 05323 05324 VOID FreeMessageList(PMLIST pml); 05325 VOID DestroyThreadsHotKeys(VOID); 05326 VOID DestroyWindowsHotKeys(PWND pwnd); 05327 05328 VOID DestroyClass(PPCLS ppcls); 05329 VOID PatchThreadWindows(PTHREADINFO); 05330 VOID DestroyCacheDCEntries(PTHREADINFO); 05331 05332 VOID DestroyProcessesClasses(PPROCESSINFO); 05333 05334 /* 05335 * Win16 Task Apis Taskman.c 05336 */ 05337 05338 VOID InsertTask(PPROCESSINFO ppi, PTDB ptdbNew); 05339 05340 BOOL xxxSleepTask(BOOL fInputIdle, HANDLE); 05341 05342 BOOL xxxUserYield(PTHREADINFO pti); 05343 VOID xxxDirectedYield(DWORD dwThreadId); 05344 VOID DirectedScheduleTask(PTHREADINFO ptiOld, PTHREADINFO ptiNew, BOOL bSendMsg, PSMS psms); 05345 VOID WakeWowTask(PTHREADINFO Pti); 05346 05347 /* 05348 * WowScheduler assertion for multiple wow tasks running simultaneously 05349 */ 05350 05351 _inline 05352 VOID 05353 EnterWowCritSect( 05354 PTHREADINFO pti, 05355 PWOWPROCESSINFO pwpi 05356 ) 05357 { 05358 if (!++pwpi->CSLockCount) { 05359 pwpi->CSOwningThread = pti; 05360 return; 05361 } 05362 05363 RIPMSG2(RIP_ERROR, 05364 "MultipleWowTasks running simultaneously %x %x\n", 05365 pwpi->CSOwningThread, 05366 pwpi->CSLockCount 05367 ); 05368 05369 return; 05370 } 05371 05372 _inline 05373 VOID 05374 ExitWowCritSect( 05375 PTHREADINFO pti, 05376 PWOWPROCESSINFO pwpi 05377 ) 05378 { 05379 if (pti == pwpi->CSOwningThread) { 05380 pwpi->CSOwningThread = NULL; 05381 pwpi->CSLockCount--; 05382 } 05383 05384 return; 05385 } 05386 05387 05389 // 05390 // These are internal USER functions called from inside and outside the 05391 // critical section (from server & client side). They are a private 'API'. 05392 // 05393 // The prototypes appear in pairs: 05394 // as called from outside the critsect (from client-side) 05395 // as called from inside the critsect (from server-side) 05396 // there must be layer code for the 1st function of each pair which validates 05397 // handles, enters the critsect, calls the 2nd of the pair of functions, and 05398 // leaves the critsect again. 05399 // 05400 // Things may have to change when we go client server: InitPwSB() mustn't 05401 // return a pointer to global (server) data! etc. 05402 // 05404 05405 BOOL xxxFillWindow(PWND pwndBrush, PWND pwndPaint, HDC hdc, HBRUSH hbr); 05406 HBRUSH xxxGetControlBrush(PWND pwnd, HDC hdc, UINT msg); 05407 HBRUSH xxxGetControlColor(PWND pwndParent, PWND pwndCtl, HDC hdc, UINT message); 05408 PSBINFO _InitPwSB(PWND); 05409 BOOL _KillSystemTimer(PWND pwnd, UINT_PTR nIDEvent); 05410 BOOL xxxPaintRect(PWND, PWND, HDC, HBRUSH, LPRECT); 05411 05413 // 05414 // these are called from stubs.c in the client so will probably go away 05415 // 05417 05418 05419 /* 05420 * From CLASS.C 05421 */ 05422 PCLS InternalRegisterClassEx( 05423 LPWNDCLASSEX lpwndcls, 05424 WORD fnid, 05425 DWORD flags 05426 ); 05427 05428 PCURSOR GetClassIcoCur(PWND pwnd, int index); 05429 PCURSOR xxxSetClassIcon(PWND pwnd, PCLS pcls, PCURSOR pCursor, int gcw); 05430 ULONG_PTR xxxSetClassData(PWND pwnd, int index, ULONG_PTR dwData, BOOL bAnsi); 05431 ULONG_PTR SetClassCursor(PWND pwnd, PCLS pcls, DWORD index, ULONG_PTR dwData); 05432 05433 /* 05434 * CREATEW.C 05435 * LATER IanJa: LPSTR -> LPCREATESTRUCT pCreateParams 05436 */ 05437 05438 PWND xxxCreateWindowEx(DWORD dwStyle, PLARGE_STRING pstrClass, 05439 PLARGE_STRING pstrName, DWORD style, int x, int y, int cx, 05440 int cy, PWND pwndParent, PMENU pmenu, HANDLE hModule, 05441 LPVOID pCreateParams, DWORD dwExpWinVerAndFlags); 05442 BOOL xxxDestroyWindow(PWND pwnd); 05443 05444 /* 05445 * SENDMSG.C 05446 */ 05447 LRESULT xxxSendMessageFF(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam); 05448 LONG xxxSendMessageBSM(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, 05449 LPBROADCASTSYSTEMMSGPARAMS pbsmParams); 05450 LRESULT xxxSendMessageEx(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam); 05451 LRESULT xxxSendMessage(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam); 05452 LRESULT xxxSendMessageTimeout(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, 05453 UINT fuFlags, UINT uTimeout, PLONG_PTR lpdwResult); 05454 BOOL xxxSendNotifyMessage(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam); 05455 void QueueNotifyMessage(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam); 05456 BOOL xxxSendMessageCallback(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, 05457 SENDASYNCPROC lpResultCallBack, ULONG_PTR dwData, BOOL bClientReqest ); 05458 BOOL _ReplyMessage(LRESULT lRet); 05459 05460 /* 05461 * MN*.C 05462 */ 05463 int xxxTranslateAccelerator(PWND pwnd, LPACCELTABLE pat, LPMSG lpMsg); 05464 BOOL xxxSetMenu(PWND pwnd, PMENU pmenu, BOOL fRedraw); 05465 VOID ChangeMenuOwner(PMENU pMenu, PPROCESSINFO ppi); 05466 int xxxMenuBarDraw(PWND pwnd, HDC hdc, int cxFrame, int cyFrame); 05467 BOOL xxxDrawMenuBar(PWND pwnd); 05468 05469 BOOL xxxSetMenuItemInfo(PMENU pMenu, UINT nPos, BOOL fByPosition, 05470 LPMENUITEMINFOW lpmii, PUNICODE_STRING pstrItem); 05471 BOOL _SetMenuContextHelpId(PMENU pMenu, DWORD dwContextHelpId); 05472 BOOL _SetMenuFlagRtoL(PMENU pMenu); 05473 BOOL xxxInsertMenuItem(PMENU pMenu, UINT wIndex, BOOL fByPosition, 05474 LPMENUITEMINFOW lpmii, PUNICODE_STRING pstrItem); 05475 BOOL xxxRemoveMenu(PMENU pMenu, UINT nPos, UINT dwFlags); 05476 BOOL xxxDeleteMenu(PMENU pMenu, UINT nPos, UINT dwFlags); 05477 BOOL xxxSetMenuInfo(PMENU pMenu, LPCMENUINFO lpmi); 05478 BOOL xxxTrackPopupMenuEx(PMENU pmenu, UINT dwFlags, int x, int y, 05479 PWND pwnd, CONST TPMPARAMS *pparams); 05480 LONG FindBestPos(int x, int y, int cx, int cy, LPRECT prcExclude, 05481 UINT wFlags, PPOPUPMENU ppopupmenu, PMONITOR pMonitor); 05482 BOOL _SetMenuDefaultItem(PMENU pMenu, UINT wId, BOOL fByPosition); 05483 int xxxMenuItemFromPoint(PWND pwnd, PMENU pMenu, POINT ptScreen); 05484 BOOL xxxGetMenuItemRect(PWND pwnd, PMENU pMenu, UINT uIndex, LPRECT lprcScreen); 05485 PPOPUPMENU MNGetPopupFromMenu(PMENU pMenu, PMENUSTATE *ppMenuState); 05486 PVOID LockDesktopMenu(PMENU * ppmenu, PMENU pmenu); 05487 PVOID UnlockDesktopMenu(PMENU * ppmenu); 05488 PMENU xxxLoadSysDesktopMenu (PMENU * ppmenu, UINT uMenuId); 05489 __inline PVOID UnlockDesktopSysMenu(PMENU * ppmenu) 05490 { 05491 ClearMF(*ppmenu, MFSYSMENU); 05492 return UnlockDesktopMenu(ppmenu); 05493 } 05494 05495 /* 05496 * SHOWWIN.C 05497 */ 05498 BOOL xxxShowWindow(PWND pwnd, DWORD cmdShowAnimate); 05499 BOOL _ShowWindowAsync(PWND pwnd, int cmdShow, UINT uWPFlags); 05500 BOOL xxxShowOwnedPopups(PWND pwndOwner, BOOL fShow); 05501 05502 #define RDW_HASWINDOWRGN 0x8000 05503 BOOL xxxSetWindowRgn(PWND pwnd, HRGN hrgn, BOOL fRedraw); 05504 05505 /* 05506 * SWP.C 05507 */ 05508 void SelectWindowRgn(PWND pwnd, HRGN hrgnClip); 05509 PWND GetTopMostInsertAfter (PWND pwnd); 05510 05511 #define GETTOPMOSTINSERTAFTER(pwnd) \ 05512 (gHardErrorHandler.pti == NULL ? NULL : GetTopMostInsertAfter(pwnd)) 05513 05514 __inline BOOL FSwpTopmost(PWND pwnd) 05515 { 05516 return (!!TestWF(pwnd, WEFTOPMOST) ^ !!TestWF(pwnd, WFTOGGLETOPMOST)); 05517 } 05518 05519 05520 PWND CalcForegroundInsertAfter(PWND pwnd); 05521 BOOL xxxSetWindowPos(PWND pwnd, PWND pwndInsertAfter, int x, int y, 05522 int cx, int cy, UINT flags); 05523 PSMWP InternalBeginDeferWindowPos(int cwndGuess); 05524 BOOL AllocateCvr (PSMWP psmwp, int cwndHint); 05525 PSMWP _BeginDeferWindowPos(int cwndGuess); 05526 PSMWP _DeferWindowPos(PSMWP psmwp, PWND pwnd, PWND pwndInsertAfter, 05527 int x, int y, int cx, int cy, UINT rgf); 05528 BOOL xxxEndDeferWindowPosEx(PSMWP psmwp, BOOL fAsync); 05529 BOOL xxxMoveWindow(PWND pwnd, int x, int y, int cx, int cy, BOOL fRedraw); 05530 PWND GetLastTopMostWindow(VOID); 05531 VOID xxxHandleWindowPosChanged(PWND pwnd, PWINDOWPOS ppos); 05532 VOID IncVisWindows(PWND pwnd); 05533 VOID DecVisWindows(PWND pwnd); 05534 BOOL FVisCountable(PWND pwnd); 05535 VOID SetVisible(PWND pwnd, UINT flags); 05536 VOID ClrFTrueVis(PWND pwnd); 05537 05538 VOID SetWindowState(PWND pwnd, DWORD flags); 05539 VOID ClearWindowState(PWND pwnd, DWORD flags); 05540 05541 BOOL xxxUpdateWindows(PWND pwnd, HRGN hrgn); 05542 05543 VOID SetMinimize(PWND pwnd, UINT uFlags); 05544 #define SMIN_CLEAR 0 05545 #define SMIN_SET 1 05546 05547 /* 05548 * DWP.C 05549 */ 05550 LRESULT xxxDefWindowProc(PWND, UINT, WPARAM, LPARAM); 05551 PWND DWP_GetEnabledPopup(PWND pwndStart); 05552 05553 05554 /* 05555 * INPUT.C 05556 */ 05557 BOOL xxxWaitMessage(VOID); 05558 VOID IdleTimerProc(VOID); 05559 VOID zzzWakeInputIdle(PTHREADINFO pti); 05560 VOID SleepInputIdle(PTHREADINFO pti); 05561 BOOL xxxInternalGetMessage(LPMSG lpmsg, HWND hwnd, UINT wMsgFilterMin, 05562 UINT wMsgFilterMax, UINT wRemoveMsg, BOOL fGetMessage); 05563 #define xxxPeekMessage(lpmsg, hwnd, wMsgMin, wMsgMax, wRemoveMsg) \ 05564 xxxInternalGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax, wRemoveMsg, FALSE) 05565 #define xxxGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax) \ 05566 xxxInternalGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax, PM_REMOVE, TRUE) 05567 DWORD _GetMessagePos(VOID); 05568 LRESULT xxxDispatchMessage(LPMSG lpmsg); 05569 UINT GetMouseKeyFlags(PQ pq); 05570 /* 05571 * OLE private message signature. From rpc\runtime\mtrt\wmsgpack.hxx 05572 */ 05573 #define WMSG_MAGIC_VALUE 0xBABE 05574 BOOL _PostMessage(PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam); 05575 BOOL IPostQuitMessage(PTHREADINFO pti, int nExitCode); 05576 BOOL _PostQuitMessage(int nExitCode); 05577 BOOL _PostThreadMessage(PTHREADINFO pti, UINT message, WPARAM wParam, LPARAM lParam); 05578 BOOL xxxTranslateMessage(LPMSG pmsg, UINT flags); 05579 BOOL _GetInputState(VOID); 05580 DWORD _GetQueueStatus(UINT); 05581 typedef VOID (CALLBACK* MSGWAITCALLBACK)(DWORD DeviceType); 05582 DWORD xxxMsgWaitForMultipleObjects(DWORD nCount, PVOID *apObjects, MSGWAITCALLBACK pfnNonMsg, PKWAIT_BLOCK WaitBlockArray); 05583 05584 BOOL FHungApp(PTHREADINFO pti, DWORD dwTimeFromLastRead); 05585 VOID xxxRedrawHungWindow(PWND pwnd, HRGN hrgnFullDrag); 05586 VOID xxxRedrawHungWindowFrame(PWND pwnd, BOOL fActive); 05587 void zzzActiveCursorTracking (PWND pwnd); 05588 PWND GetActiveTrackPwnd(PWND pwnd, Q **ppq); 05589 int xxxActiveWindowTracking(PWND pwnd, UINT uMsg, int iHitTest); 05590 VOID xxxHungAppDemon(PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam); 05591 05592 #ifdef HUNGAPP_GHOSTING 05593 05594 /* 05595 * GHOST.C 05596 */ 05597 LRESULT xxxGhostWndProc(PWND, UINT, WPARAM, LPARAM); 05598 VOID SignalGhost(PWND pwnd); 05599 BOOL xxxCreateGhost(PWND pwnd); 05600 VOID RemoveGhost(PWND pwnd); 05601 PWND FindGhost(PWND pwnd); 05602 05603 #define WM_HUNGTHREAD (WM_USER + 0) 05604 05605 __inline VOID SignalGhost(PWND pwnd) 05606 { 05607 _PostMessage(PWNDDESKTOP(pwnd), WM_HUNGTHREAD, 0, (LPARAM)HWq(pwnd)); 05608 } 05609 05610 #endif // HUNGAPP_GHOSTING 05611 05612 /* 05613 * TMSWITCH.C 05614 */ 05615 VOID xxxSwitchToThisWindow(PWND pwnd, BOOL fAltTab); 05616 05617 /* 05618 * TOUNICOD.C 05619 */ 05620 int xxxToUnicodeEx(UINT wVirtKey, UINT wScanCode, CONST BYTE *lpKeyState, 05621 LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL hkl); 05622 int xxxInternalToUnicode(UINT wVirtKey, UINT wScanCode, CONST IN PBYTE pfvk, 05623 OUT PWCHAR awchChars, INT cChar, UINT uiTMFlags, OUT PDWORD pdwFlags, HKL hkl); 05624 05625 /* 05626 * HOTKEYS.C 05627 */ 05628 BOOL _RegisterHotKey(PWND pwnd, int id, UINT fsModifiers, UINT vk); 05629 BOOL _UnregisterHotKey(PWND pwnd, int id); 05630 05631 /* 05632 * FOCUSACT.C 05633 */ 05634 PWND xxxSetFocus(PWND pwnd); 05635 BOOL CanForceForeground(PPROCESSINFO ppi); 05636 BOOL xxxStubSetForegroundWindow(PWND pwnd); 05637 BOOL xxxSetForegroundWindow(PWND pwnd, BOOL fFlash); 05638 PWND xxxSetActiveWindow(PWND pwnd); 05639 PWND _GetActiveWindow(VOID); 05640 BOOL xxxAllowSetForegroundWindow(DWORD dwProcessId); 05641 BOOL _LockSetForegroundWindow(UINT uLockCode); 05642 05643 /* 05644 * UPDATE.C 05645 */ 05646 BOOL xxxInvalidateRect(PWND pwnd, LPRECT lprc, BOOL fErase); 05647 BOOL xxxValidateRect(PWND pwnd, LPRECT lprc); 05648 BOOL xxxInvalidateRgn(PWND pwnd, HRGN hrgn, BOOL fErase); 05649 BOOL xxxValidateRgn(PWND pwnd, HRGN hrgn); 05650 BOOL xxxUpdateWindow(PWND pwnd); 05651 BOOL xxxGetUpdateRect(PWND pwnd, LPRECT lprc, BOOL fErase); 05652 int xxxGetUpdateRgn(PWND pwnd, HRGN hrgn, BOOL fErase); 05653 int _ExcludeUpdateRgn(HDC hdc, PWND pwnd); 05654 int CalcWindowRgn(PWND pwnd, HRGN hrgn, BOOL fClient); 05655 VOID DeleteUpdateRgn(PWND pwnd); 05656 BOOL xxxRedrawWindow(PWND pwnd, LPRECT lprcUpdate, HRGN hrgnUpdate, DWORD flags); 05657 BOOL IntersectWithParents(PWND pwnd, LPRECT lprc); 05658 VOID xxxInternalInvalidate(PWND pwnd, HRGN hrgnUpdate, DWORD flags); 05659 05660 /* 05661 * WINMGR.C 05662 */ 05663 BOOL xxxEnableWindow(PWND pwnd, BOOL fEnable); 05664 int xxxGetWindowText(PWND pwnd, LPWSTR psz, int cchMax); 05665 PWND xxxSetParent(PWND pwnd, PWND pwndNewParent); 05666 BOOL xxxFlashWindow(PWND pwnd, DWORD dwFlags, DWORD dwTimeout); 05667 extern ATOM gaFlashWState; 05668 __inline DWORD GetFlashWindowState(PWND pwnd) 05669 { 05670 return (DWORD)(ULONG_PTR)_GetProp(pwnd, MAKEINTATOM(gaFlashWState), PROPF_INTERNAL); 05671 } 05672 __inline void SetFlashWindowState(PWND pwnd, DWORD dwState) 05673 { 05674 InternalSetProp(pwnd, MAKEINTATOM(gaFlashWState), 05675 (HANDLE)ULongToPtr(dwState), PROPF_INTERNAL | PROPF_NOPOOL); 05676 } 05677 __inline void RemoveFlashWindowState(PWND pwnd) 05678 { 05679 InternalRemoveProp(pwnd, MAKEINTATOM(gaFlashWState), PROPF_INTERNAL); 05680 } 05681 BOOL _GetWindowPlacement(PWND pwnd, PWINDOWPLACEMENT pwp); 05682 BOOL xxxSetWindowPlacement(PWND pwnd, PWINDOWPLACEMENT pwp); 05683 BOOL ValidateParentDepth(PWND pwnd, PWND pwndParent); 05684 BOOL ValidateOwnerDepth(PWND pwnd, PWND pwndOwner); 05685 void WPUpdateCheckPointSettings (PWND pwnd, UINT uWPFlags); 05686 05687 /* 05688 * DC.C 05689 */ 05690 HDC _GetDC(PWND pwnd); 05691 HDC _GetDCEx(PWND pwnd, HRGN hrgnClip, DWORD flags); 05692 HDC _GetWindowDC(PWND pwnd); 05693 BOOL _ReleaseDC(HDC hdc); 05694 UINT ReleaseCacheDC(HDC hdc, BOOL fEndPaint); 05695 HDC CreateCacheDC(PWND, DWORD, PMONITOR); 05696 BOOL DestroyCacheDC(PDCE *, HDC); 05697 VOID InvalidateDce(PDCE pdce); 05698 void DeleteHrgnClip(PDCE pdce); 05699 PWND WindowFromCacheDC(HDC hdc); 05700 PWND FastWindowFromDC(HDC hdc); 05701 VOID DelayedDestroyCacheDC(VOID); 05702 PDCE LookupDC(HDC hdc); 05703 HDC GetMonitorDC(PDCE pdceOrig, PMONITOR pMonitor); 05704 BOOL GetDCOrgOnScreen(HDC hdc, LPPOINT ppt); 05705 __inline VOID MarkDCEInvalid(PDCE pdce) 05706 { 05707 /* 05708 * Clear all bits, but these. 05709 */ 05710 pdce->DCX_flags &= (DCX_CACHE | DCX_LAYERED); 05711 05712 /* 05713 * Mark this cache entry as invalid 05714 */ 05715 pdce->DCX_flags |= DCX_INVALID; 05716 } 05717 05718 #ifdef USE_MIRRORING 05719 void MirrorRect(PWND pwnd, LPRECT lprc); 05720 BOOL MirrorRegion(PWND pwnd, HRGN hrgn, BOOL bUseClient); 05721 #endif 05722 05723 /* 05724 * PAINT.C 05725 */ 05726 HDC xxxBeginPaint(PWND pwnd, PAINTSTRUCT *lpps); 05727 BOOL xxxEndPaint(PWND pwnd, PAINTSTRUCT *lpps); 05728 05729 /* 05730 * CAPTURE.C 05731 */ 05732 PWND xxxSetCapture(PWND pwnd); 05733 BOOL xxxReleaseCapture(VOID); 05734 05735 /* 05736 * KEYBOARD.C 05737 */ 05738 SHORT _GetAsyncKeyState(int vk); 05739 BOOL _SetKeyboardState(CONST BYTE *pKeyboard); 05740 int _GetKeyboardType(int nTypeFlag); 05741 VOID RegisterPerUserKeyboardIndicators(PUNICODE_STRING pProfileUserName); 05742 VOID UpdatePerUserKeyboardIndicators(PUNICODE_STRING pProfileUserName); 05743 05744 #define TestRawKeyDown(vk) TestKeyDownBit(gafRawKeyState, vk) 05745 #define SetRawKeyDown(vk) SetKeyDownBit(gafRawKeyState, vk) 05746 #define ClearRawKeyDown(vk) ClearKeyDownBit(gafRawKeyState, vk) 05747 #define TestRawKeyToggle(vk) TestKeyToggleBit(gafRawKeyState, vk) 05748 #define SetRawKeyToggle(vk) SetKeyToggleBit(gafRawKeyState, vk) 05749 #define ClearRawKeyToggle(vk) ClearKeyToggleBit(gafRawKeyState, vk) 05750 #define ToggleRawKeyToggle(vk) ToggleKeyToggleBit(gafRawKeyState, vk) 05751 05752 /* 05753 * XLATE.C 05754 */ 05755 int _GetKeyNameText(LONG lParam, LPWSTR lpString, int nSize); 05756 05757 /* 05758 * TIMERS.C 05759 */ 05760 BOOL _KillTimer(PWND pwnd, UINT_PTR nIDEvent); 05761 PTIMER FindTimer(PWND pwnd, UINT_PTR nID, UINT flags, BOOL fKill); 05762 VOID xxxSystemTimerProc(PWND pwnd, UINT msg, UINT_PTR id, LPARAM lParam); 05763 05764 05765 /* 05766 * CARET.C 05767 */ 05768 BOOL zzzDestroyCaret(VOID); 05769 BOOL xxxCreateCaret(PWND, HBITMAP, int, int); 05770 BOOL zzzShowCaret(PWND); 05771 BOOL zzzHideCaret(PWND); 05772 BOOL _SetCaretBlinkTime(UINT); 05773 BOOL zzzSetCaretPos(int, int); 05774 05775 /* 05776 * MSGBEEP.C 05777 */ 05778 BOOL xxxOldMessageBeep(VOID); 05779 BOOL xxxMessageBeep(UINT wType); 05780 VOID PlayEventSound(UINT idSound); 05781 05782 /* 05783 * WINWHERE.C 05784 */ 05785 PWND _ChildWindowFromPointEx(PWND pwndParent, POINT pt, UINT i); 05786 PWND xxxWindowFromPoint(POINT pt); 05787 PWND FAR SizeBoxHwnd(PWND pwnd); 05788 05789 /* 05790 * GETSET.C 05791 */ 05792 WORD _SetWindowWord(PWND pwnd, int index, WORD value); 05793 DWORD xxxSetWindowLong(PWND pwnd, int index, DWORD value, BOOL bAnsi); 05794 #ifdef _WIN64 05795 ULONG_PTR xxxSetWindowLongPtr(PWND pwnd, int index, ULONG_PTR value, BOOL bAnsi); 05796 #else 05797 #define xxxSetWindowLongPtr xxxSetWindowLong 05798 #endif 05799 #define __GetWindowLong(pwnd, index) ((LONG)(*(DWORD UNALIGNED *)((BYTE *)((pwnd) + 1) + (index)))) 05800 #define __GetWindowLongPtr(pwnd, index) ((LONG_PTR)(*(ULONG_PTR UNALIGNED *)((BYTE *)((pwnd) + 1) + (index)))) 05801 #if DBG 05802 ULONG DBGGetWindowLong(PWND pwnd, int index); 05803 #define _GetWindowLong DBGGetWindowLong 05804 ULONG_PTR DBGGetWindowLongPtr(PWND pwnd, int index); 05805 #define _GetWindowLongPtr DBGGetWindowLongPtr 05806 #else 05807 #define _GetWindowLong __GetWindowLong 05808 #define _GetWindowLongPtr __GetWindowLongPtr 05809 #endif 05810 05811 /* 05812 * CLIPBRD.C 05813 */ 05814 BOOL xxxOpenClipboard(PWND pwnd, LPBOOL lpfEmptyClient); 05815 BOOL xxxCloseClipboard(PWINDOWSTATION pwinsta); 05816 UINT _EnumClipboardFormats(UINT fmt); 05817 BOOL xxxEmptyClipboard(PWINDOWSTATION pwinsta); 05818 HANDLE xxxGetClipboardData(PWINDOWSTATION pwinsta, UINT fmt, PGETCLIPBDATA gcd); 05819 BOOL _IsClipboardFormatAvailable(UINT fmt); 05820 int _GetPriorityClipboardFormat(UINT *lpPriorityList, int cfmts); 05821 PWND xxxSetClipboardViewer(PWND pwndClipViewerNew); 05822 BOOL xxxChangeClipboardChain(PWND pwndRemove, PWND pwndNewNext); 05823 05824 /* 05825 * miscutil.c 05826 */ 05827 VOID SetDialogPointer(PWND pwnd, LONG_PTR lPtr); 05828 VOID ZapActiveAndFocus(VOID); 05829 BOOL xxxSetShellWindow(PWND pwnd, PWND pwndBkGnd); 05830 BOOL _SetProgmanWindow(PWND pwnd); 05831 BOOL _SetTaskmanWindow(PWND pwnd); 05832 05833 #define STW_SAME ((PWND) 1) 05834 void xxxSetTrayWindow(PDESKTOP pdesk, PWND pwnd, PMONITOR pMonitor); 05835 BOOL xxxAddFullScreen(PWND pwnd, PMONITOR pMonitor); 05836 BOOL xxxRemoveFullScreen(PWND pwnd, PMONITOR pMonitor); 05837 BOOL xxxCheckFullScreen(PWND pwnd, PSIZERECT psrc); 05838 BOOL IsTrayWindow(PWND); 05839 05840 #define FDoTray() (SYSMET(ARRANGE) & ARW_HIDE) 05841 #define FCallHookTray() (IsHooked(PtiCurrent(), WHF_SHELL)) 05842 #define FPostTray(p) (p->pDeskInfo->spwndTaskman) 05843 #define FCallTray(p) (FDoTray() && ( FCallHookTray()|| FPostTray(p) )) 05844 05845 // ---------------------------------------------------------------------------- 05846 // 05847 // FTopLevel() - TRUE if window is a top level window 05848 // 05849 // FHas31TrayStyles() - TRUE if window is either full screen or has 05850 // both a system menu and a caption 05851 // (NOTE: minimized windows always have captions) 05852 // 05853 // ---------------------------------------------------------------------------- 05854 #define FTopLevel(pwnd) (pwnd->spwndParent == PWNDDESKTOP(pwnd)) 05855 #define FHas31TrayStyles(pwnd) (TestWF(pwnd, WFFULLSCREEN) || \ 05856 (TestWF(pwnd, WFSYSMENU | WFMINBOX) && \ 05857 (TestWF(pwnd, WFCAPTION) || TestWF(pwnd, WFMINIMIZED)))) 05858 BOOL IsVSlick(PWND pwnd); 05859 BOOL Is31TrayWindow(PWND pwnd); 05860 05861 /* 05862 * fullscr.c 05863 */ 05864 05865 #if DBG 05866 #define VerifyVisibleMonitorCount() \ 05867 { \ 05868 PMONITOR pMonitor = gpDispInfo->pMonitorFirst; \ 05869 ULONG cVisMon = 0; \ 05870 while (pMonitor) { \ 05871 if (pMonitor->dwMONFlags & MONF_VISIBLE) { \ 05872 cVisMon++; \ 05873 } \ 05874 pMonitor = pMonitor->pMonitorNext; \ 05875 } \ 05876 UserAssert(cVisMon == gpDispInfo->cMonitors); \ 05877 } 05878 #endif 05879 05880 BOOL xxxMakeWindowForegroundWithState(PWND, BYTE); 05881 void FullScreenCleanup(); 05882 LONG xxxUserChangeDisplaySettings(PUNICODE_STRING pstrDeviceName, LPDEVMODEW pDevMode, 05883 HWND hwnd, PDESKTOP pdesk, DWORD dwFlags, PVOID lParam, MODE PreviousMode); 05884 BOOL xxxbFullscreenSwitch(BOOL bFullscreenSwitch, HWND hwnd); 05885 05886 05887 /* 05888 * SBAPI.C 05889 */ 05890 BOOL xxxShowScrollBar(PWND, UINT, BOOL); 05891 #define xxxSetScrollInfo(a,b,c,d) xxxSetScrollBar((a),(b),(c),(d)) 05892 05893 /* 05894 * mngray.c 05895 */ 05896 BOOL xxxDrawState(HDC hdcDraw, HBRUSH hbrFore, 05897 LPARAM lData, int x, int y, int cx, int cy, UINT uFlags); 05898 05899 /* 05900 * SCROLLW.C 05901 */ 05902 BOOL _ScrollDC(HDC, int, int, LPRECT, LPRECT, HRGN, LPRECT); 05903 05904 /* 05905 * SPB.C 05906 */ 05907 VOID SpbCheckRect(PWND pwnd, LPRECT lprc, DWORD flags); 05908 VOID SpbCheck(VOID); 05909 PSPB FindSpb(PWND pwnd); 05910 VOID FreeSpb(PSPB pspb); 05911 VOID FreeAllSpbs(void); 05912 VOID CreateSpb(PWND pwnd, UINT flags, HDC hdcScreen); 05913 UINT RestoreSpb(PWND pwnd, HRGN hrgnUncovered, HDC *phdcScreen); 05914 VOID SpbCheckPwnd(PWND pwnd); 05915 VOID SpbCheckDce(PDCE pdce); 05916 BOOL LockWindowUpdate2(PWND pwndLock, BOOL fThreadOverride); 05917 05918 /* 05919 * DRAWFRM.C 05920 */ 05921 BOOL FAR BitBltSysBmp(HDC hdc, int x, int y, UINT i); 05922 05923 /* 05924 * SYSMET.c 05925 */ 05926 BOOL APIENTRY xxxSetSysColors(PUNICODE_STRING pProfileUserName,int count, PUINT pIndex, LPDWORD pClrVal, UINT uOptions); 05927 VOID SetSysColor(UINT icol, DWORD rgb, UINT uOptions); 05928 05929 /* 05930 * ICONS.C 05931 */ 05932 UINT xxxArrangeIconicWindows(PWND pwnd); 05933 BOOL _SetSystemMenu(PWND pwnd, PMENU pMenu); 05934 05935 /* 05936 * RMCREATE.C 05937 */ 05938 PICON _CreateIconIndirect(PICONINFO piconinfo); 05939 PCURSOR _CreateCursor(HANDLE hModule, int iXhotspot, int iYhotspot, 05940 int iWidth, int iHeight, LPBYTE lpANDplane, LPBYTE lpXORplane); 05941 PICON _CreateIcon(HANDLE hModule, int iWidth, int iHeight, 05942 BYTE bPlanes, BYTE bBitsPixel, LPBYTE lpANDplane, LPBYTE lpXORplane); 05943 void DestroyUnlockedCursor(void *); 05944 BOOL _DestroyCursor(PCURSOR, DWORD); 05945 HANDLE _CreateAcceleratorTable(LPACCEL, int); 05946 05947 /* 05948 * CURSOR.C 05949 */ 05950 #if DBG 05951 PCURSOR DbgLockQCursor(PQ pq, PCURSOR pcur); 05952 #define LockQCursor(pq, pcur) DbgLockQCursor(pq, pcur) 05953 #else 05954 #define LockQCursor(pq, pcur) Lock(&pq->spcurCurrent, pcur) 05955 #endif // DBG 05956 05957 BOOL _GetCursorPos(LPPOINT); 05958 PCURSOR zzzSetCursor(PCURSOR pcur); 05959 BOOL zzzSetCursorPos(int x, int y); 05960 int zzzShowCursor(BOOL fShow); 05961 BOOL zzzClipCursor(LPCRECT prcClip); 05962 PCURSOR _GetCursor(VOID); 05963 BOOL _SetCursorContents(PCURSOR pcur, PCURSOR pcurNew); 05964 void SetPointer(BOOL fSet); 05965 void zzzHideCursorNoCapture(void); 05966 #define GETPCI(pcur) ((PCURSINFO)&(pcur->CI_FIRST)) 05967 05968 /* 05969 * WMICON.C 05970 */ 05971 BOOL _DrawIconEx(HDC hdc, int x, int y, PCURSOR pcur, int cx, int cy, 05972 UINT istepIfAniCur, HBRUSH hbrush, UINT diFlags) ; 05973 BOOL BltIcon(HDC hdc, int x, int y, int cx, int cy, 05974 HDC hdcSrc, PCURSOR pcursor, BOOL fMask, LONG rop); 05975 05976 void DBGValidateQueueStates(PDESKTOP pdesk); 05977 /* 05978 * DESKTOP.C 05979 */ 05980 05981 HDESK xxxCreateDesktop( 05982 POBJECT_ATTRIBUTES, 05983 KPROCESSOR_MODE, 05984 PUNICODE_STRING, 05985 LPDEVMODEW, 05986 DWORD, 05987 DWORD); 05988 05989 HDESK xxxOpenDesktop(POBJECT_ATTRIBUTES, KPROCESSOR_MODE, DWORD, DWORD, BOOL*); 05990 BOOL OpenDesktopCompletion(PDESKTOP pdesk, HDESK hdesk, DWORD dwFlags, BOOL*); 05991 BOOL xxxSwitchDesktop(PWINDOWSTATION, PDESKTOP, BOOL); 05992 VOID zzzSetDesktop(PTHREADINFO pti, PDESKTOP pdesk, HDESK hdesk); 05993 HDESK xxxGetInputDesktop(VOID); 05994 BOOL xxxSetThreadDesktop(HDESK, PDESKTOP); 05995 HDESK xxxGetThreadDesktop(DWORD, HDESK, KPROCESSOR_MODE); 05996 BOOL xxxCloseDesktop(HDESK, KPROCESSOR_MODE); 05997 BOOL xxxEnumDesktops(FARPROC, LONG, BOOL); 05998 DWORD _SetDesktopConsoleThread(PDESKTOP pdesk, DWORD dwThreadId); 05999 VOID xxxRealizeDesktop(PWND pwnd); 06000 06001 /* 06002 * WINSTA.C 06003 */ 06004 NTSTATUS CreateGlobalAtomTable(PVOID* ppAtomTable); 06005 HWINSTA xxxCreateWindowStation(POBJECT_ATTRIBUTES ObjA, 06006 KPROCESSOR_MODE OwnershipMode, 06007 DWORD amRequest, 06008 HANDLE hKbdLayoutFile, 06009 DWORD offTable, 06010 PCWSTR pwszKLID, 06011 UINT uKbdInputLocale); 06012 HWINSTA _OpenWindowStation(POBJECT_ATTRIBUTES, DWORD, KPROCESSOR_MODE); 06013 BOOL _CloseWindowStation(HWINSTA hwinsta); 06014 BOOL xxxSetProcessWindowStation(HWINSTA, KPROCESSOR_MODE); 06015 06016 PWINDOWSTATION _GetProcessWindowStation(HWINSTA *); 06017 BOOL _LockWorkStation(VOID); 06018 06019 NTSTATUS ReferenceWindowStation(PETHREAD Thread, HWINSTA hwinsta, 06020 ACCESS_MASK amDesiredAccess, PWINDOWSTATION *ppwinsta, BOOL fUseDesktop); 06021 06022 /* 06023 * HOOKS.C 06024 */ 06025 PROC zzzSetWindowsHookAW(int nFilterType, PROC pfnFilterProc, DWORD dwFlags); 06026 BOOL zzzUnhookWindowsHookEx(PHOOK phk); 06027 BOOL zzzUnhookWindowsHook(int nFilterType, PROC pfnFilterProc); 06028 LRESULT xxxCallNextHookEx(int nCode, WPARAM wParam, LPARAM lParam); 06029 BOOL _CallMsgFilter(LPMSG lpMsg, int nCode); 06030 void zzzCancelJournalling(void); 06031 #if DBG 06032 void DbgValidateHooks(PHOOK phk, int iType); 06033 #else 06034 #define DbgValidateHooks(phk, iType) 06035 #endif 06036 06037 06038 /* 06039 * SRVHOOK.C 06040 */ 06041 LRESULT fnHkINLPCWPEXSTRUCT(PWND pwnd, UINT message, WPARAM wParam, 06042 LPARAM lParam, ULONG_PTR xParam); 06043 LRESULT fnHkINLPCWPRETEXSTRUCT(PWND pwnd, UINT message, WPARAM wParam, 06044 LPARAM lParam, ULONG_PTR xParam); 06045 06046 /* 06047 * QUEUE.C 06048 */ 06049 __inline BOOL IsShellProcess (PPROCESSINFO ppi) 06050 { 06051 return ((ppi->rpdeskStartup != NULL) 06052 && (ppi->rpdeskStartup->pDeskInfo->ppiShellProcess == ppi)); 06053 } 06054 __inline DWORD GetAppCompatFlags2ForPti(PTHREADINFO pti, WORD wVer) 06055 { 06056 if (wVer < pti->dwExpWinVer) { 06057 return 0; 06058 } 06059 return pti->dwCompatFlags2; 06060 } 06061 06062 VOID ClearWakeMask(VOID); 06063 ULONG GetTaskName(PTHREADINFO pti, PWSTR Buffer, ULONG BufferLength); 06064 PQMSG FindQMsg(PTHREADINFO, PMLIST, PWND, UINT, UINT, BOOL); 06065 void zzzShowStartGlass(DWORD dwTimeout); 06066 DWORD _GetChangeBits(VOID); 06067 NTSTATUS xxxSetCsrssThreadDesktop(PDESKTOP pdesk, PDESKRESTOREDATA pdrdRestore); 06068 NTSTATUS xxxRestoreCsrssThreadDesktop(PDESKRESTOREDATA pdrdRestore); 06069 06070 PQ GetJournallingQueue(PTHREADINFO pti); 06071 void ClearAppStarting (PPROCESSINFO ppi); 06072 #ifdef USE_MIRRORING 06073 BOOL _GetProcessDefaultLayout(DWORD *pdwDefaultLayout); 06074 BOOL _SetProcessDefaultLayout(DWORD dwDefaultLayout); 06075 #endif 06076 06077 /* 06078 * EXITWIN.C 06079 */ 06080 LONG xxxClientShutdown(PWND pwnd, WPARAM wParam); 06081 BOOL xxxRegisterUserHungAppHandlers( PFNW32ET pfnW32EndTask, HANDLE hEventWowExec); 06082 06083 /* 06084 * INIT.C 06085 */ 06086 BOOL CreateTerminalInput(PTERMINAL); 06087 06088 VOID LW_LoadSomeStrings(VOID); 06089 VOID LW_LoadProfileInitData(); 06090 VOID xxxODI_ColorInit(PUNICODE_STRING pProfileUserName); 06091 HRGN InitCreateRgn(VOID); 06092 VOID xxxUpdateSystemCursorsFromRegistry(PUNICODE_STRING pProfileUserName); 06093 VOID xxxUpdateSystemIconsFromRegistry(PUNICODE_STRING pProfileUserName); 06094 void RegisterLPK(DWORD); 06095 HBITMAP CreateCaptionStrip(); 06096 06097 BOOL LW_BrushInit(VOID); 06098 VOID xxxLW_LoadFonts(BOOL bRemote); 06099 06100 VOID _LoadCursorsAndIcons(VOID); 06101 06102 void UnloadCursorsAndIcons(VOID); 06103 06104 void IncrMBox(void); 06105 void DecrMBox(void); 06106 void InitAnsiOem(PCHAR pOemToAnsi, PCHAR pAnsiToOem); 06107 int xxxAddFontResourceW(LPWSTR lpFile, FLONG flags, DESIGNVECTOR *pdv); 06108 void EnforceColorDependentSettings(void); 06109 06110 06111 /* 06112 * ACCESS.C 06113 */ 06114 VOID xxxUpdatePerUserAccessPackSettings(PUNICODE_STRING pProfileUserName); 06115 06116 /* 06117 * inctlpan.c 06118 */ 06119 VOID GetWindowNCMetrics(LPNONCLIENTMETRICS lpnc); 06120 06121 HFONT FAR PASCAL CreateFontFromWinIni(PUNICODE_STRING pProfileUserName,LPLOGFONT lplf, UINT idFont); 06122 VOID SetMinMetrics(PUNICODE_STRING pProfileUserName,LPMINIMIZEDMETRICS lpmin); 06123 BOOL xxxSetWindowNCMetrics(PUNICODE_STRING pProfileUserName,LPNONCLIENTMETRICS lpnc, BOOL fSizeChange, int clNewBorder); 06124 BOOL SetIconMetrics(PUNICODE_STRING pProfileUserName,LPICONMETRICS lpicon); 06125 BOOL xxxSetNCFonts(PUNICODE_STRING pProfileUserName, LPNONCLIENTMETRICS lpnc); 06126 BOOL CreateBitmapStrip(VOID); 06127 BOOL UpdateWinIniInt(PUNICODE_STRING pProfileUserName, UINT idSection, UINT wKeyNameId, int value); 06128 06129 /* 06130 * rare.c 06131 */ 06132 void FAR SetDesktopMetrics(); 06133 06134 void SetMsgBox(PWND pwnd); 06135 06136 BOOL _RegisterShellHookWindow(PWND pwnd); 06137 BOOL _DeregisterShellHookWindow(PWND pwnd); 06138 BOOL xxxSendMinRectMessages(PWND pwnd, RECT *lpRect); 06139 void PostShellHookMessages(UINT message, LPARAM lParam); 06140 VOID _ResetDblClk(VOID); 06141 VOID xxxSimulateShiftF10(VOID); 06142 BOOL VWPLAdd(PVWPL *ppvwpl, PWND pwnd, DWORD dwThreshold); 06143 BOOL VWPLRemove(PVWPL *ppvwpl, PWND pwnd); 06144 PWND VWPLNext(PVWPL pvwpl, PWND pwndPrev, DWORD *pnPrev); 06145 06146 /* 06147 * DDETRACK STUFF 06148 */ 06149 06150 typedef struct tagFREELIST { 06151 struct tagFREELIST *next; 06152 HANDLE h; // CSR client side GMEM_DDESHARE handle 06153 DWORD flags; // XS_ flags describing data 06154 } FREELIST, *PFREELIST; 06155 06156 typedef struct tagDDEIMP { 06157 SECURITY_QUALITY_OF_SERVICE qos; 06158 SECURITY_CLIENT_CONTEXT ClientContext; 06159 short cRefInit; 06160 short cRefConv; 06161 } DDEIMP, *PDDEIMP; 06162 06163 typedef struct tagDDECONV { 06164 THROBJHEAD head; // HM header 06165 struct tagDDECONV *snext; 06166 struct tagDDECONV *spartnerConv; // siamese twin 06167 PWND spwnd; // associated pwnd 06168 PWND spwndPartner; // associated partner pwnd 06169 struct tagXSTATE *spxsOut; // transaction info queue - out point 06170 struct tagXSTATE *spxsIn; // transaction info queue - in point 06171 struct tagFREELIST *pfl; // free list 06172 DWORD flags; // CXF_ flags 06173 struct tagDDEIMP *pddei; // impersonation information 06174 } DDECONV, *PDDECONV; 06175 06176 typedef DWORD (FNDDERESPONSE)(PDWORD pmsg, LPARAM *plParam, PDDECONV pDdeConv); 06177 typedef FNDDERESPONSE *PFNDDERESPONSE; 06178 06179 typedef struct tagXSTATE { 06180 THROBJHEAD head; // HM header 06181 struct tagXSTATE *snext; 06182 PFNDDERESPONSE fnResponse; // proc to handle next msg. 06183 HANDLE hClient; // GMEM_DDESAHRE handle on client side 06184 HANDLE hServer; // GMEM_DDESHARE handle on server side 06185 PINTDDEINFO pIntDdeInfo; // DDE data being transfered 06186 DWORD flags; // XS_ flags describing transaction/data 06187 } XSTATE, *PXSTATE; 06188 06189 // values for flags field 06190 06191 #define CXF_IS_SERVER 0x0001 06192 #define CXF_TERMINATE_POSTED 0x0002 06193 #define CXF_PARTNER_WINDOW_DIED 0x0004 06194 #define CXF_INTRA_PROCESS 0x8000 06195 06196 BOOL xxxDDETrackSendHook(PWND pwndTo, DWORD message, WPARAM wParam, LPARAM lParam); 06197 DWORD xxxDDETrackPostHook(PUINT pmessage, PWND pwndTo, WPARAM wParam, LPARAM *plParam, BOOL fSent); 06198 VOID FreeDdeXact(PXSTATE pxs); 06199 06200 VOID xxxDDETrackGetMessageHook(PMSG pmsg); 06201 VOID xxxDDETrackWindowDying(PWND pwnd, PDDECONV pDdeConv); 06202 VOID FreeDdeConv(PDDECONV pDdeConv); 06203 BOOL _ImpersonateDdeClientWindow(PWND pwndClient, PWND pwndServer); 06204 06205 HBITMAP _ConvertBitmap(HBITMAP hBitmap); 06206 06207 typedef struct tagMONITORPOS 06208 { 06209 RECT rcMonitor; /* where the monitor rect was */ 06210 RECT rcWork; /* where the work rect was */ 06211 PMONITOR pMonitor; /* what new monitor gets its windows */ 06212 } MONITORPOS, *PMONITORPOS; 06213 06214 typedef struct tagMONITORRECTS 06215 { 06216 int cMonitor; /* number of monitors */ 06217 MONITORPOS amp[1]; /* the monitor positions */ 06218 } MONITORRECTS, *PMONITORRECTS; 06219 06220 06221 PMONITORRECTS SnapshotMonitorRects(void); 06222 void xxxDesktopRecalc(PMONITORRECTS pmrOld); 06223 06224 BOOL _SetDoubleClickTime(UINT); 06225 BOOL APIENTRY _SwapMouseButton(BOOL fSwapButtons); 06226 VOID xxxDestroyThreadInfo(VOID); 06227 06228 BOOL _GetWindowPlacement(PWND pwnd, PWINDOWPLACEMENT pwp); 06229 06230 PMENU xxxGetSystemMenu(PWND pWnd, BOOL bRevert); 06231 PMENU _CreateMenu(VOID); 06232 PMENU _CreatePopupMenu(VOID); 06233 BOOL _DestroyMenu(PMENU pMenu); 06234 DWORD _CheckMenuItem(PMENU pMenu, UINT wIDCheckItem, UINT wCheck); 06235 DWORD xxxEnableMenuItem(PMENU pMenu, UINT wIDEnableItem, UINT wEnable); 06236 WINUSERAPI UINT _GetMenuItemID(PMENU pMenu, int nPos); 06237 WINUSERAPI UINT _GetMenuItemCount(PMENU pMenu); 06238 06239 PMENU _GetMenu(PWND pWnd); 06240 BOOL _SetMenuContextHelpId(PMENU pMenu, DWORD dwContextHelpId); 06241 06242 PWND _GetNextQueueWindow(PWND pwnd, BOOL fDir, BOOL fAltEsc); 06243 06244 UINT_PTR _SetSystemTimer(PWND pwnd, UINT_PTR nIDEvent, DWORD dwElapse, 06245 TIMERPROC_PWND pTimerFunc); 06246 BOOL _SetClipboardData(UINT fmt, HANDLE hData, BOOL fGlobalHandle, BOOL fIncSerialNumber); 06247 WORD _SetClassWord(PWND pwnd, int index, WORD value); 06248 DWORD xxxSetClassLong(PWND pwnd, int index, DWORD value, BOOL bAnsi); 06249 #ifdef _WIN64 06250 ULONG_PTR xxxSetClassLongPtr(PWND pwnd, int index, ULONG_PTR value, BOOL bAnsi); 06251 #else 06252 #define xxxSetClassLongPtr xxxSetClassLong 06253 #endif 06254 ATOM xxxRegisterClassEx(LPWNDCLASSEX pwc, PCLSMENUNAME pcmn, 06255 WORD fnid, DWORD dwFlags, LPDWORD pdwWOW); 06256 BOOL xxxHiliteMenuItem(PWND pwnd, PMENU pmenu, UINT cmd, UINT flags); 06257 HANDLE _CreateAcceleratorTable(LPACCEL paccel, int cbAccel); 06258 HANDLE xxxGetInputEvent(DWORD dwWakeMask); 06259 BOOL _UnregisterClass(LPCWSTR lpszClassName, HANDLE hModule, PCLSMENUNAME pcmn); 06260 ATOM _GetClassInfoEx(HANDLE hModule, LPCWSTR lpszClassName, LPWNDCLASSEX pwc, LPWSTR *ppszMenuName, BOOL bAnsi); 06261 PWND _WindowFromDC(HDC hdc); 06262 PCLS _GetWOWClass(HANDLE hModule, LPCWSTR lpszClassName); 06263 LRESULT xxxHkCallHook(PHOOK phk, int nCode, WPARAM wParam, LPARAM lParam); 06264 PHOOK zzzSetWindowsHookEx(HANDLE hmod, PUNICODE_STRING pstrLib, 06265 PTHREADINFO ptiThread, int nFilterType, PROC pfnFilterProc, DWORD dwFlags); 06266 DWORD GetDebugHookLParamSize(WPARAM wParam, PDEBUGHOOKINFO pdebughookstruct); 06267 BOOL _RegisterLogonProcess(DWORD dwProcessId, BOOL fSecure); 06268 UINT _LockWindowStation(PWINDOWSTATION pwinsta); 06269 BOOL _UnlockWindowStation(PWINDOWSTATION pwinsta); 06270 UINT _SetWindowStationUser(PWINDOWSTATION pwinsta, PLUID pluidUser, 06271 PSID psidUser, DWORD cbsidUser); 06272 BOOL _SetDesktopBitmap(PDESKTOP pdesk, HBITMAP hbitmap, DWORD dwStyle); 06273 06274 BOOL _SetLogonNotifyWindow(PWND pwnd); 06275 06276 06277 BOOL _RegisterTasklist(PWND pwndTasklist); 06278 LONG_PTR _SetMessageExtraInfo(LONG_PTR); 06279 VOID xxxRemoveEvents(PQ pq, int nQueue, DWORD flags); 06280 06281 PPCLS _InnerGetClassPtr(ATOM atom, PPCLS ppclsList, HANDLE hModule); 06282 06283 /* 06284 * ntcb.h funtions. 06285 */ 06286 DWORD ClientGetListboxString(PWND hwnd, UINT msg, 06287 WPARAM wParam, PVOID lParam, 06288 ULONG_PTR xParam, PROC xpfn, DWORD dwSCMSFlags, BOOL bNotString, PSMS psms); 06289 HANDLE ClientLoadLibrary(PUNICODE_STRING pstrLib, BOOL bWx86KnownDll); 06290 BOOL ClientFreeLibrary(HANDLE hmod); 06291 BOOL xxxClientGetCharsetInfo(LCID lcid, PCHARSETINFO pcs); 06292 BOOL ClientExitProcess(PFNW32ET pfn, DWORD dwExitCode); 06293 BOOL ClientGrayString(GRAYSTRINGPROC pfnOutProc, HDC hdc, 06294 DWORD lpData, int nCount); 06295 BOOL CopyFromClient(LPBYTE lpByte, LPBYTE lpByteClient, DWORD cch, 06296 BOOL fString, BOOL fAnsi); 06297 BOOL CopyToClient(LPBYTE lpByte, LPBYTE lpByteClient, 06298 DWORD cchMax, BOOL fAnsi); 06299 VOID ClientNoMemoryPopup(VOID); 06300 NTSTATUS ClientThreadSetup(VOID); 06301 06302 VOID ClientDeliverUserApc(VOID); 06303 06304 BOOL ClientImmLoadLayout(HKL, PIMEINFOEX); 06305 DWORD ClientImmProcessKey(HWND, HKL, UINT, LPARAM, DWORD); 06306 06307 NTSTATUS xxxUserModeCallback (ULONG uApi, PVOID pIn, ULONG cbIn, PVOID pOut, ULONG cbOut); 06308 06309 06310 PCURSOR ClassSetSmallIcon( 06311 PCLS pcls, 06312 PCURSOR pcursor, 06313 BOOL fServerCreated); 06314 06315 BOOL _GetTextMetricsW( 06316 HDC hdc, 06317 LPTEXTMETRICW ptm); 06318 06319 int xxxDrawMenuBarTemp( 06320 PWND pwnd, 06321 HDC hdc, 06322 LPRECT lprc, 06323 PMENU pMenu, 06324 HFONT hFont); 06325 06326 BOOL xxxDrawCaptionTemp( 06327 PWND pwnd, 06328 HDC hdc, 06329 LPRECT lprc, 06330 HFONT hFont, 06331 PCURSOR pcursor, 06332 PUNICODE_STRING pstrText OPTIONAL, 06333 UINT flags); 06334 06335 WORD xxxTrackCaptionButton( 06336 PWND pwnd, 06337 UINT hit); 06338 06339 void GiveForegroundActivateRight(HANDLE hPid); 06340 BOOL HasForegroundActivateRight(HANDLE hPid); 06341 BOOL FRemoveForegroundActivate(PTHREADINFO pti); 06342 void RestoreForegroundActivate(); 06343 void CancelForegroundActivate(); 06344 06345 #define ACTIVATE_ARRAY_SIZE 5 06346 extern HANDLE ghCanActivateForegroundPIDs[ACTIVATE_ARRAY_SIZE]; 06347 06348 __inline void GiveForegroundActivateRight(HANDLE hPid) 06349 { 06350 static int index = 0; 06351 06352 TAGMSG1(DBGTAG_FOREGROUND, "Giving %x foreground activate right", hPid); 06353 ghCanActivateForegroundPIDs[index++] = hPid; 06354 if(index == ACTIVATE_ARRAY_SIZE) { 06355 index = 0; 06356 } 06357 } 06358 06359 __inline BOOL HasForegroundActivateRight(HANDLE hPid) 06360 { 06361 int i = 0; 06362 06363 for(; i < ACTIVATE_ARRAY_SIZE; ++i) { 06364 if(ghCanActivateForegroundPIDs[i] == hPid) { 06365 TAGMSG1(DBGTAG_FOREGROUND, "HasForegroundActivateRight: Found %x", hPid); 06366 return TRUE; 06367 } 06368 } 06369 06370 TAGMSG1(DBGTAG_FOREGROUND, "HasForegroundActivateRight: Did NOT find %x", hPid); 06371 return FALSE; 06372 } 06373 06374 06375 #define WHERE_NOONE_CAN_SEE_ME ((int) -32000) 06376 BOOL MinToTray(PWND pwnd); 06377 06378 void xxxUpdateThreadsWindows( 06379 PTHREADINFO pti, 06380 PWND pwnd, 06381 HRGN hrgnFullDrag); 06382 06383 NTSTATUS xxxQueryInformationThread( 06384 IN HANDLE hThread, 06385 IN USERTHREADINFOCLASS ThreadInfoClass, 06386 OUT PVOID ThreadInformation, 06387 IN ULONG ThreadInformationLength, 06388 OUT PULONG ReturnLength OPTIONAL); 06389 06390 NTSTATUS xxxSetInformationThread( 06391 IN HANDLE hThread, 06392 IN USERTHREADINFOCLASS ThreadInfoClass, 06393 IN PVOID ThreadInformation, 06394 IN ULONG ThreadInformationLength); 06395 06396 #ifdef USE_MIRRORING 06397 NTSTATUS GetProcessDefaultWindowOrientation( 06398 IN HANDLE hProcess, 06399 OUT DWORD *pdwDefaultOrientation); 06400 06401 NTSTATUS SetProcessDefaultWindowOrientation( 06402 IN HANDLE hProcess, 06403 IN DWORD dwDefaultOrientation); 06404 #endif 06405 06406 NTSTATUS SetInformationProcess( 06407 IN HANDLE hProcess, 06408 IN USERPROCESSINFOCLASS ProcessInfoClass, 06409 IN PVOID ProcessInformation, 06410 IN ULONG ProcessInformationLength); 06411 06412 06413 NTSTATUS xxxConsoleControl( 06414 IN CONSOLECONTROL ConsoleControl, 06415 IN PVOID ConsoleInformation, 06416 IN ULONG ConsoleInformationLength); 06417 06418 06419 /***************************************************************************\ 06420 * String Table Defines 06421 * 06422 * KERNEL\STRID.MC has a nice big table of strings that are meant to be 06423 * localized. Before use, the strings are pulled from the resource table 06424 * with LoadString, passing it one of the following string ids. 06425 * 06426 * NOTE: Only strings that need to be localized should be added to the 06427 * string table. Class name strings, etc are NOT localized. 06428 * 06429 * LATER: All string table entries should be reexamined to be sure they 06430 * conform to the note above. 06431 * 06432 \***************************************************************************/ 06433 06434 #define OCR_APPSTARTING 32650 06435 06436 /* 06437 * Win Event Hook struct 06438 */ 06439 typedef struct tagEVENTHOOK { 06440 THROBJHEAD head; // 06441 struct tagEVENTHOOK *pehNext; // 0x14 Next event hook 06442 UINT eventMin; // 0x18 Min event (>=) to hook 06443 UINT eventMax; // 0x1C Max event (<=) to hook 06444 UINT fDestroyed:1; // 0x20 If orphaned while in use 06445 // IanJa - we don't need this bit 0x24 06446 // UINT f32Bit:1; // 0x28 If 32-bit client 06447 UINT fIgnoreOwnThread:1; // 0x2C Ignore events for installer thread 06448 UINT fIgnoreOwnProcess:1; // Ignore events for installer process 06449 UINT fSync:1; // Sync event (inject DLL into each process) 06450 UINT fWx86KnownDll:1; // x86 emulation? (IanJa - provide support) 06451 HANDLE hEventProcess; // 0x30 Process being hooked 06452 DWORD idEventThread; // 0x34 Thread being hooked 06453 // (IanJa - have head.pti: don't need ppiInstaller, can use GETPTI(peh)->ppi) 06454 // DWORD idInstallerProcess; // 0x38 ID of process that installed hook 06455 ULONG_PTR offPfn; // 0x3C offset event proc 06456 int ihmod; // 0x40 index of module containing event proc 06457 LPWSTR pwszModulePath; // 0x44 Path of module library for global sync. 06458 } EVENTHOOK, *PEVENTHOOK; // 0x48 (size) 06459 06460 typedef struct tagNOTIFY { 06461 struct tagNOTIFY *pNotifyNext; // 0x00 Next notification 06462 PEVENTHOOK spEventHook; // 0x04 Event this refers to 06463 DWORD event; // 0x08 Event 06464 HWND hwnd; // 0x0C hwnd to ask about it 06465 LONG idObject; // 0x10 object ID 06466 LONG idChild; // 0x14 child id 06467 DWORD idSenderThread; // 0x18 Thread generating event 06468 DWORD dwEventTime; // 0x1C Event time 06469 DWORD dwWEFlags; // 0x20 WEF_DEFERNOTIFY etc. 06470 PTHREADINFO ptiReceiver; // 0x24 Thread receiving event 06471 } NOTIFY, *PNOTIFY; // 0x28 06472 06473 VOID xxxWindowEvent(DWORD event, PWND pwnd, LONG idObject, LONG idChild, DWORD dwFlags); 06474 #define WEF_USEPWNDTHREAD 0x0001 06475 #define WEF_DEFERNOTIFY 0x0002 06476 #define WEF_ASYNC 0x0004 06477 #define WEF_POSTED 0x0008 06478 06479 #define DeferWinEventNotify() CheckCritIn(); \ 06480 gdwDeferWinEvent++ 06481 #define IsWinEventNotifyDeferred() (gdwDeferWinEvent > 0) 06482 #define IsWinEventNotifyDeferredOK() (!IsWinEventNotifyDeferred() || ISATOMICCHECK()) 06483 #define zzzEndDeferWinEventNotify() \ 06484 UserAssert(IsWinEventNotifyDeferred()); \ 06485 UserAssert(FWINABLE() || gnDeferredWinEvents == 0); \ 06486 CheckCritIn(); \ 06487 if (--gdwDeferWinEvent == 0) { \ 06488 if (FWINABLE() && (gpPendingNotifies != NULL)) { \ 06489 xxxFlushDeferredWindowEvents(); \ 06490 } \ 06491 } \ 06492 UserAssert(FWINABLE() || gnDeferredWinEvents == 0) 06493 06494 /* 06495 * Only use this one for bookkeeping gdwDeferWinEvent, 06496 * which may be required without leaving the critical section. 06497 */ 06498 #define EndDeferWinEventNotifyWithoutProcessing() \ 06499 UserAssert(IsWinEventNotifyDeferred()); \ 06500 UserAssert(FWINABLE() || gnDeferredWinEvents == 0); \ 06501 CheckCritIn(); \ 06502 --gdwDeferWinEvent 06503 06504 #define zzzWindowEvent(event, pwnd, idObject, idChild, dwFlags) \ 06505 xxxWindowEvent(event, pwnd, idObject, idChild, \ 06506 IsWinEventNotifyDeferred() ? (dwFlags) | WEF_DEFERNOTIFY : (dwFlags)) 06507 06508 VOID xxxFlushDeferredWindowEvents(); 06509 06510 BOOL xxxClientCallWinEventProc(WINEVENTPROC pfn, PEVENTHOOK pEventHook, PNOTIFY pNotify); 06511 void DestroyEventHook(PEVENTHOOK); 06512 VOID FreeThreadsWinEvents(PTHREADINFO pti); 06513 06514 BOOL _UnhookWinEvent(PEVENTHOOK peh); 06515 VOID DestroyNotify(PNOTIFY pNotify); 06516 PEVENTHOOK xxxProcessNotifyWinEvent(PNOTIFY pNotify); 06517 PEVENTHOOK _SetWinEventHook(DWORD eventMin, DWORD eventMax, 06518 HMODULE hmodWinEventProc, PUNICODE_STRING pstrLib, 06519 WINEVENTPROC pfnWinEventProc, HANDLE hEventProcess, 06520 DWORD idEventThread, DWORD dwFlags); 06521 BOOL _GetGUIThreadInfo(PTHREADINFO pti, PGUITHREADINFO pgui); 06522 BOOL xxxGetTitleBarInfo(PWND pwnd, PTITLEBARINFO ptbi); 06523 BOOL _GetComboBoxInfo(PWND pwnd, PCOMBOBOXINFO ptbi); 06524 DWORD _GetListBoxInfo(PWND pwnd); 06525 BOOL _GetScrollBarInfo(PWND pwnd, LONG idObject, PSCROLLBARINFO ptbi); 06526 PWND _GetAncestor(PWND pwnd, UINT gaFlags); 06527 PWND _RealChildWindowFromPoint(PWND pwndParent, POINT pt); 06528 BOOL _GetAltTabInfo(int iItem, PALTTABINFO pati, 06529 LPWSTR lpszItemText, UINT cchItemText, BOOL bAnsi); 06530 BOOL xxxGetMenuBarInfo(PWND pwnd, long idObject, long idItem, PMENUBARINFO pmbi); 06531 06532 typedef HWND *PHWND; 06533 06534 typedef struct tagSwitchWndInfo { 06535 06536 PBWL pbwl; // Pointer to the window list built. 06537 PHWND phwndLast; // Pointer to the last window in the list. 06538 PHWND phwndCurrent; // pointer to the current window. 06539 06540 INT iTotalTasks; // Total number of tasks. 06541 INT iTasksShown; // Total tasks shown. 06542 BOOL fScroll; // Is there a need to scroll? 06543 06544 INT iFirstTaskIndex; // Index to the first task shown. 06545 06546 INT iNoOfColumns; // Max Number of tasks per row. 06547 INT iNoOfRows; // Max Number of rows of icons in the switch window. 06548 INT iIconsInLastRow; // Icons in last row. 06549 INT iCurCol; // Current column where hilite lies. 06550 INT iCurRow; // Current row where hilite lies. 06551 INT cxSwitch; // Switch Window dimensions. 06552 INT cySwitch; 06553 POINT ptFirstRowStart; // Top left corner of the first Icon Slot. 06554 RECT rcTaskName; // Rect where Task name is displayed. 06555 BOOL fJournaling; // Determins how we check the keyboard state 06556 } SWITCHWNDINFO, *PSWINFO; 06557 06558 typedef struct tagSWITCHWND { 06559 WND; 06560 PSWINFO pswi; 06561 } SWITCHWND, *PSWITCHWND; 06562 06563 typedef struct tagHOTKEYSTRUCT { 06564 PWND spwnd; 06565 DWORD key; 06566 } HOTKEYSTRUCT, *PHOTKEYSTRUCT; 06567 06568 #define LANGTOGGLEKEYS_SIZE 3 06569 06570 /* 06571 * ACCF_ and PUDF_ flags share the same field. ACCF fields 06572 * are so named because they may later move to a differnt 06573 * struct. 06574 */ 06575 #define ACCF_DEFAULTFILTERKEYSON 0x00000001 06576 #define ACCF_DEFAULTSTICKYKEYSON 0x00000002 06577 #define ACCF_DEFAULTMOUSEKEYSON 0x00000004 06578 #define ACCF_DEFAULTTOGGLEKEYSON 0x00000008 06579 #define ACCF_DEFAULTTIMEOUTON 0x00000010 06580 #define ACCF_DEFAULTKEYBOARDPREF 0x00000020 06581 #define ACCF_DEFAULTSCREENREADER 0x00000040 06582 #define ACCF_DEFAULTHIGHCONTRASTON 0x00000080 06583 #define ACCF_ACCESSENABLED 0x00000100 06584 #define ACCF_IGNOREBREAKCODE 0x00000400 06585 #define ACCF_FKMAKECODEPROCESSED 0x00000800 06586 #define ACCF_MKVIRTUALMOUSE 0x00001000 06587 #define ACCF_MKREPEATVK 0x00002000 06588 #define ACCF_FIRSTTICK 0x00004000 06589 #define ACCF_SHOWSOUNDSON 0x00008000 06590 06591 /* 06592 * NOTE: PUDF_ANIMATE must have the same value as MINMAX_ANIMATE. 06593 */ 06594 #define PUDF_ANIMATE 0x00010000 06595 06596 #define ACCF_KEYBOARDPREF 0x00020000 06597 #define ACCF_SCREENREADER 0x00040000 06598 #define PUDF_BEEP 0x00080000 /* Warning beeps allowed? */ 06599 #define PUDF_EXTENDEDSOUNDS 0x00100000 /* Extended sounds enabling */ 06600 #define PUDF_DRAGFULLWINDOWS 0x00200000 /* Drag xor rect or full windows */ 06601 #define PUDF_ICONTITLEWRAP 0x00400000 /* Wrap icon titles or just use single line */ 06602 #define PUDF_FONTSARELOADED 0x00800000 06603 #define PUDF_POPUPINUSE 0x01000000 06604 #define PUDF_MENUSTATEINUSE 0x02000000 06605 #define PUDF_VDMBOUNDSACTIVE 0x04000000 06606 #define PUDF_ALLOWFOREGROUNDACTIVATE 0x08000000 06607 #define PUDF_DRAGGINGFULLWINDOW 0x10000000 06608 #define PUDF_LOCKFULLSCREEN 0x20000000 06609 #define PUDF_GSMWPINUSE 0x40000000 06610 06611 #define TEST_ACCF(f) TEST_FLAG(gdwPUDFlags, f) 06612 #define TEST_BOOL_ACCF(f) TEST_BOOL_FLAG(gdwPUDFlags, f) 06613 #define SET_ACCF(f) SET_FLAG(gdwPUDFlags, f) 06614 #define CLEAR_ACCF(f) CLEAR_FLAG(gdwPUDFlags, f) 06615 #define SET_OR_CLEAR_ACCF(f, fSet) SET_OR_CLEAR_FLAG(gdwPUDFlags, f, fSet) 06616 #define TOGGLE_ACCF(f) TOGGLE_FLAG(gdwPUDFlags, f) 06617 06618 #define TEST_PUDF(f) TEST_FLAG(gdwPUDFlags, f) 06619 #define TEST_BOOL_PUDF(f) TEST_BOOL_FLAG(gdwPUDFlags, f) 06620 #define SET_PUDF(f) SET_FLAG(gdwPUDFlags, f) 06621 #define CLEAR_PUDF(f) CLEAR_FLAG(gdwPUDFlags, f) 06622 #define SET_OR_CLEAR_PUDF(f, fSet) SET_OR_CLEAR_FLAG(gdwPUDFlags, f, fSet) 06623 #define TOGGLE_PUDF(f) TOGGLE_FLAG(gdwPUDFlags, f) 06624 06625 /* 06626 * Power state stuff 06627 */ 06628 typedef struct tagPOWERSTATE { 06629 volatile ULONG fInProgress:1; 06630 volatile ULONG fCritical:1; 06631 volatile ULONG fOverrideApps:1; 06632 volatile ULONG fQueryAllowed:1; 06633 volatile ULONG fUIAllowed:1; 06634 PKEVENT pEvent; 06635 BROADCASTSYSTEMMSGPARAMS bsmParams; 06636 POWERSTATEPARAMS psParams; 06637 } POWERSTATE, *PPOWERSTATE; 06638 06639 #define POWERON_PHASE -1 06640 #define LOWPOWER_PHASE 1 06641 #define POWEROFF_PHASE 2 06642 06643 NTSTATUS InitializePowerRequestList(HANDLE hPowerRequestEvent); 06644 VOID CleanupPowerRequestList(VOID); 06645 VOID DeletePowerRequestList(VOID); 06646 VOID xxxUserPowerCalloutWorker(VOID); 06647 06648 /* 06649 * Fade-in / fade-out globals. 06650 */ 06651 06652 typedef struct tagFADE { 06653 HANDLE hsprite; 06654 HDC hdc; 06655 HBITMAP hbm; 06656 POINT ptDst; 06657 SIZE size; 06658 DWORD dwTime; 06659 DWORD dwStart; 06660 DWORD dwFlags; 06661 } FADE, *PFADE; 06662 06663 /* 06664 * Globals are included last because they may require some of the types 06665 * being defined above. 06666 */ 06667 #include "globals.h" 06668 #include "ddemlsvr.h" 06669 /* 06670 * If you make a change that requires including strid.h when building 06671 * ntuser\rtl, then you need to change the sources/makefil* files so this 06672 * file will be built in ntuser\inc; make sure that the output of 06673 * mc.exe still goes to the kernel directory; this is because there are 06674 * other places (like ntuser\server) where we use the same file name. 06675 */ 06676 #ifndef _USERRTL_ 06677 #include "strid.h" 06678 #endif 06679 06680 #include "ntuser.h" 06681 06682 #define TestALPHA(uSetting) (!gbDisableAlpha && TestEffectUP(uSetting)) 06683 06684 /* 06685 * tooltips/tracking prototypes from tooltips.c 06686 */ 06687 06688 typedef struct tagTOOLTIP { 06689 DWORD dwFlags; 06690 UINT uTID; 06691 DWORD dwAnimStart; 06692 int iyAnim; 06693 LPWSTR pstr; 06694 } TOOLTIP; 06695 06696 typedef struct tagTOOLTIPWND { 06697 WND; 06698 06699 DWORD dwShowDelay; 06700 DWORD dwHideDelay; 06701 HDC hdcMem; 06702 HBITMAP hbmMem; 06703 06704 TOOLTIP; // this field must be last! 06705 } TOOLTIPWND, *PTOOLTIPWND; 06706 06707 #define HTEXSCROLLFIRST 60 06708 #define HTSCROLLUP 60 06709 #define HTSCROLLDOWN 61 06710 #define HTSCROLLUPPAGE 62 06711 #define HTSCROLLDOWNPAGE 63 06712 #define HTSCROLLTHUMB 64 06713 #define HTEXSCROLLLAST 64 06714 #define HTEXMENUFIRST 65 06715 #define HTMDISYSMENU 65 06716 #define HTMDIMAXBUTTON 66 06717 #define HTMDIMINBUTTON 67 06718 #define HTMDICLOSE 68 06719 #define HTMENUITEM 69 06720 #define HTEXMENULAST 69 06721 06722 int FindNCHitEx(PWND pwnd, int ht, POINT pt); 06723 void xxxTrackMouseMove(PWND pwnd, int htEx, UINT message); 06724 BOOL xxxHotTrack(PWND pwnd, int htEx, BOOL fDraw); 06725 void xxxResetTooltip(PTOOLTIPWND pttwnd); 06726 void xxxCancelMouseMoveTracking (DWORD dwDTFlags, PWND pwndTrack, int htEx, DWORD dwDTCancel); 06727 06728 __inline PVOID DesktopRebaseToClient(PTHREADINFO pti, PVOID p) 06729 { 06730 UserAssert(pti->pClientInfo->ulClientDelta != 0); 06731 return (p) ? (PVOID)((PBYTE)p - pti->pClientInfo->ulClientDelta) : NULL; 06732 } 06733 __inline PVOID SharedRebaseToClient(PPROCESSINFO ppi, PVOID p) 06734 { 06735 UserAssert(ppi->pClientBase != 0); 06736 return (p) ? (PVOID)((PBYTE)ppi->pClientBase + ((PBYTE)p - 06737 (PBYTE)gpvSharedBase)) : NULL; 06738 } 06739 #define SHRSTR(ppi, s) SharedRebaseToClient(ppi, gpsi->s) 06740 06741 /* 06742 * String range IDs. 06743 * 06744 * These are defined here to avoid duplicate entries in strid.mc 06745 */ 06746 #define STR_COLORSTART STR_SCROLLBAR 06747 #define STR_COLOREND STR_GRADIENTINACTIVECAPTION 06748 06749 /* 06750 * Sprite and Fade related functions and defines. 06751 */ 06752 #define FADE_SHOW 0x00000001 06753 #define FADE_COMPLETED 0x00000002 06754 #define FADE_SHOWN 0x00000004 06755 #define FADE_WINDOW 0x00000008 06756 #define FADE_MENU 0x00000010 06757 #define FADE_TOOLTIP 0x00000020 06758 06759 HDC CreateFade(PWND pwnd, RECT *prc, DWORD dwTime, DWORD dwFlags); 06760 void StartFade(void); 06761 void StopFade(void); 06762 void ShowFade(void); 06763 void AnimateFade(void); 06764 __inline DWORD TestFadeFlags(DWORD dwFlags) 06765 { 06766 return (gfade.dwFlags & dwFlags); 06767 } 06768 HANDLE xxxSetLayeredWindow(PWND pwnd, BOOL fRepaintBehind); 06769 BOOL UnsetLayeredWindow(PWND pwnd); 06770 void TrackLayeredZorder(PWND pwnd); 06771 VOID UpdateLayeredSprite(PDCE pdce); 06772 BOOL _UpdateLayeredWindow(PWND pwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, 06773 POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags); 06774 BOOL _SetLayeredWindowAttributes(PWND pwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); 06775 BOOL RecreateRedirectionBitmap(PWND pwnd); 06776 PWND GetLayeredWindow(PWND pwnd); 06777 06778 #ifdef REDIRECTION 06779 BOOL SetRedirectedWindow(PWND pwnd); 06780 BOOL UnsetRedirectedWindow(PWND pwnd); 06781 __inline BOOL FLayeredOrRedirected(PWND pwnd) 06782 { 06783 return (TestWF(pwnd, WEFLAYERED) || TestWF(pwnd, WEFREDIRECTED)); 06784 } 06785 #else 06786 __inline BOOL FLayeredOrRedirected(PWND pwnd) 06787 { 06788 return TestWF(pwnd, WEFLAYERED); 06789 } 06790 #endif // REDIRECTION 06791 06792 void InternalInvalidate3( 06793 PWND pwnd, 06794 HRGN hrgn, 06795 DWORD flags); 06796 06797 BOOL UserSetFont(PUNICODE_STRING pProfileUserName, 06798 LPLOGFONTW lplf, 06799 UINT idFont, 06800 HFONT* phfont 06801 ); 06802 06803 HICON DWP_GetIcon( 06804 PWND pwnd, 06805 UINT uType); 06806 06807 BOOL xxxRedrawTitle( 06808 PWND pwnd, UINT wFlags); 06809 06810 DWORD GetContextHelpId( 06811 PWND pwnd); 06812 06813 BOOL BltIcon( 06814 HDC hdc, int x, int y, int cx, int cy, 06815 HDC hdcSrc, PCURSOR pcursor, BOOL fMask, LONG rop); 06816 06817 HANDLE xxxClientCopyImage( 06818 HANDLE hImage, 06819 UINT type, 06820 int cxNew, 06821 int cyNew, 06822 UINT flags); 06823 06824 VOID _WOWCleanup( 06825 HANDLE hInstance, 06826 DWORD hTaskWow); 06827 06828 VOID _WOWModuleUnload(HANDLE hModule); 06829 06830 /* 06831 * FastProfile APIs 06832 */ 06833 typedef struct tagPROFINTINFO { 06834 UINT idSection; 06835 LPWSTR lpKeyName; 06836 DWORD nDefault; 06837 PUINT puResult; 06838 } PROFINTINFO, *PPROFINTINFO; 06839 06840 #define INITIAL_USER_HANDLE_QUOTA 10000 06841 #define MINIMUM_USER_HANDLE_QUOTA 200 06842 06843 #define INITIAL_POSTMESSAGE_LIMIT 10000 06844 #define MINIMUM_POSTMESSAGE_LIMIT 4000 06845 06846 /* 06847 * See aFastRegMap[] in ntuser\kernel\profile.c 06848 */ 06849 #define PMAP_COLORS 0 06850 #define PMAP_CURSORS 1 06851 #define PMAP_WINDOWSM 2 06852 #define PMAP_WINDOWSU 3 06853 #define PMAP_DESKTOP 4 06854 #define PMAP_ICONS 5 06855 #define PMAP_FONTS 6 06856 #define PMAP_TRUETYPE 7 06857 #define PMAP_KBDLAYOUT 8 06858 #define PMAP_INPUT 9 06859 #define PMAP_COMPAT 10 06860 #define PMAP_SUBSYSTEMS 11 06861 #define PMAP_BEEP 12 06862 #define PMAP_MOUSE 13 06863 #define PMAP_KEYBOARD 14 06864 #define PMAP_STICKYKEYS 15 06865 #define PMAP_KEYBOARDRESPONSE 16 06866 #define PMAP_MOUSEKEYS 17 06867 #define PMAP_TOGGLEKEYS 18 06868 #define PMAP_TIMEOUT 19 06869 #define PMAP_SOUNDSENTRY 20 06870 #define PMAP_SHOWSOUNDS 21 06871 #define PMAP_AEDEBUG 22 06872 #define PMAP_NETWORK 23 06873 #define PMAP_METRICS 24 06874 #define PMAP_UKBDLAYOUT 25 06875 #define PMAP_UKBDLAYOUTTOGGLE 26 06876 #define PMAP_WINLOGON 27 06877 #define PMAP_KEYBOARDPREF 28 06878 #define PMAP_SCREENREADER 29 06879 #define PMAP_HIGHCONTRAST 30 06880 #define PMAP_IMECOMPAT 31 06881 #define PMAP_IMM 32 06882 #define PMAP_POOLLIMITS 33 06883 #define PMAP_COMPAT32 34 06884 #define PMAP_SETUPPROGRAMNAMES 35 06885 #define PMAP_INPUTMETHOD 36 06886 #define PMAP_COMPAT2 37 06887 #define PMAP_MOUCLASS_PARAMS 38 06888 #define PMAP_KBDCLASS_PARAMS 39 06889 #define PMAP_LAST 39 06890 06891 #define MAXPROFILEBUF 256 06892 06893 #define POLICY_NONE 0x0001 06894 #define POLICY_USER 0x0002 06895 #define POLICY_MACHINE 0x0004 06896 #define POLICY_ALL (POLICY_NONE | POLICY_USER | POLICY_MACHINE) 06897 06898 PUNICODE_STRING CreateProfileUserName(TL *ptl); 06899 void FreeProfileUserName(PUNICODE_STRING pProfileUserName,TL *ptl); 06900 HANDLE OpenCacheKeyEx(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, ACCESS_MASK amRequest, PDWORD pdwPolicyFlags); 06901 BOOL CheckDesktopPolicy(PUNICODE_STRING pProfileUserName OPTIONAL, PCWSTR lpKeyName); 06902 BOOL CheckDesktopPolicyChange(PUNICODE_STRING pProfileUserName OPTIONAL); 06903 DWORD FastGetProfileKeysW(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR pszDefault, LPWSTR *ppszKeys); 06904 DWORD FastGetProfileDwordW(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, DWORD dwDefault); 06905 DWORD FastGetProfileStringW(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize); 06906 UINT FastGetProfileIntW(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, UINT nDefault); 06907 BOOL FastWriteProfileStringW(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPCWSTR lpString); 06908 int FastGetProfileIntFromID(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT idKey, int def); 06909 DWORD FastGetProfileStringFromIDW(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT idKey, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD cch); 06910 BOOL FastWriteProfileValue(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, UINT uType, LPBYTE lpStruct, UINT cbSizeStruct); 06911 DWORD FastGetProfileValue(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName,LPBYTE lpDefault, LPBYTE lpReturn, UINT cbSizeReturn); 06912 BOOL FastGetProfileIntsW(PUNICODE_STRING pProfileUserName OPTIONAL, PPROFINTINFO ppii); 06913 BOOL FastUpdateWinIni(PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT wKeyNameId, LPWSTR lpszValue); 06914 06915 VOID RecreateSmallIcons(PWND pwnd); 06916 06917 /* 06918 * # of pels added to border width. When a user requests a border width of 1 06919 * that user actualy gets a border width of BORDER_EXTRA + 1if the window 06920 * has a sizing border. 06921 */ 06922 06923 #define BORDER_EXTRA 3 06924 06925 /* 06926 * tmswitch.c stuff 06927 */ 06928 06929 __inline int GetCaptionHeight(PWND pwnd) 06930 { 06931 int height; 06932 06933 06934 if (!TestWF(pwnd, WFCPRESENT)) 06935 return 0; 06936 06937 height = TestWF(pwnd, WEFTOOLWINDOW) ? SYSMET(CYSMCAPTION) : SYSMET(CYCAPTION); 06938 06939 return height; 06940 } 06941 06942 __inline void InitTooltipDelay(PTOOLTIPWND pttwnd) 06943 { 06944 if (pttwnd != NULL) { 06945 pttwnd->dwShowDelay = gdtDblClk * 3; 06946 pttwnd->dwHideDelay = gdtDblClk * 8; 06947 } 06948 } 06949 06950 __inline PPROFILEVALUEINFO UPDWORDPointer (UINT uSetting) 06951 { 06952 UserAssert(UPIsDWORDRange(uSetting)); 06953 return gpviCPUserPreferences + UPDWORDIndex(uSetting); 06954 } 06955 06956 06957 /* 06958 * ComputeTickDelta 06959 * 06960 * ComputeTickDelta computes a time delta between two times. The 06961 * delta is defined as a 31-bit, signed value. It is best to think of time as 06962 * a clock that wraps around. The delta is the minimum distance on this circle 06963 * between two different places on the circle. If the delta goes 06964 * counter-clockwise, it is looking at a time in the PAST and is POSITIVE. If 06965 * the delta goes clockwise, it is looking at a time in the FUTURE and is 06966 * negative. 06967 * 06968 * It is IMPORTANT to realize that the (dwCurTime >= dwLastTime) comparison does 06969 * not determine the delta's sign, but only determines the operation to compute 06970 * the delta without an overflow occuring. 06971 */ 06972 __inline 06973 int ComputeTickDelta( 06974 IN DWORD dwCurTick, 06975 IN DWORD dwLastTick) 06976 { 06977 return (int) dwCurTick - dwLastTick; 06978 } 06979 06980 06981 __inline 06982 int ComputePastTickDelta( 06983 IN DWORD dwCurTick, 06984 IN DWORD dwLastTick) 06985 { 06986 int nDelta = ComputeTickDelta(dwCurTick, dwLastTick); 06987 UserAssertMsg0(nDelta >= 0, "Ensure delta occurs in the past"); 06988 return nDelta; 06989 } 06990 06991 06992 /* 06993 * SubtractTick() subtracts a delta from a given time and returns another time. 06994 * This is different than using ComputeTimeDelta() to compare two 06995 * times and get a delta because of the way wrap around works. 06996 */ 06997 __inline 06998 DWORD SubtractTick( 06999 IN DWORD dwTime, 07000 IN int nDelta) 07001 { 07002 UserAssertMsg0(nDelta >= 0, "Delta must be postive"); 07003 return dwTime - (DWORD) nDelta; 07004 } 07005 07006 __inline BOOL IsTimeFromLastInput (DWORD dwTimeout) 07007 { 07008 return ((NtGetTickCount() - glinp.timeLastInputMessage) > dwTimeout); 07009 } 07010 07011 __inline BOOL IsTimeFromLastRITEvent (DWORD dwTimeout) 07012 { 07013 return ((NtGetTickCount() - gpsi->dwLastRITEventTickCount) > dwTimeout); 07014 } 07015 07016 #if DBG 07017 __inline void DBGIncModalMenuCount() 07018 { 07019 guModalMenuStateCount++; 07020 } 07021 07022 __inline void DBGDecModalMenuCount() 07023 { 07024 UserAssert(guModalMenuStateCount != 0); 07025 guModalMenuStateCount--; 07026 } 07027 #else 07028 #define DBGIncModalMenuCount() 07029 #define DBGDecModalMenuCount() 07030 #endif 07031 07032 __inline BOOL IsForegroundLocked() 07033 { 07034 return ((guSFWLockCount != 0) || (gppiLockSFW != NULL)); 07035 } 07036 07037 07038 /* Bug 247768 - joejo 07039 * Add compatibility hack for foreground activation problems. 07040 * 07041 */ 07042 __inline 07043 BOOL GiveUpForeground() 07044 { 07045 07046 if (gptiForeground == NULL) { 07047 return FALSE; 07048 } 07049 07050 if (GetAppCompatFlags2ForPti(gptiForeground , VER40) & GACF2_GIVEUPFOREGROUND){ 07051 TAGMSG0(DBGTAG_FOREGROUND, "GiveUpForeground Hack Succeeded!"); 07052 return TRUE; 07053 } 07054 07055 return FALSE; 07056 } 07057 07058 __inline void IncSFWLockCount() 07059 { 07060 guSFWLockCount++; 07061 } 07062 07063 __inline void DecSFWLockCount() 07064 { 07065 UserAssert(guSFWLockCount != 0); 07066 guSFWLockCount--; 07067 } 07068 07069 __inline DWORD UPDWORDValue (UINT uSetting) 07070 { 07071 return UPDWORDPointer(uSetting)->dwValue; 07072 } 07073 /* 07074 * Use this macro ONLY if UPIsDWORDRange(SPI_GET ## uSetting) is TRUE. 07075 */ 07076 #define UP(uSetting) UPDWORDValue(SPI_GET ## uSetting) 07077 07078 /* 07079 * NTIMM.C 07080 */ 07081 07082 #define IMESHOWSTATUS_NOTINITIALIZED ((BOOL)0xffff) 07083 07084 PIMC CreateInputContext( 07085 IN ULONG_PTR dwClientImcData); 07086 07087 BOOL DestroyInputContext( 07088 IN PIMC pImc); 07089 07090 VOID FreeInputContext( 07091 IN PIMC pImc); 07092 07093 HIMC AssociateInputContext( 07094 IN PWND pWnd, 07095 IN PIMC pImc); 07096 07097 AIC_STATUS AssociateInputContextEx( 07098 IN PWND pWnd, 07099 IN PIMC pImc, 07100 IN DWORD dwFlag); 07101 07102 BOOL UpdateInputContext( 07103 IN PIMC pImc, 07104 IN UPDATEINPUTCONTEXTCLASS UpdateType, 07105 IN ULONG_PTR UpdateValue); 07106 07107 VOID xxxFocusSetInputContext( 07108 IN PWND pwnd, 07109 IN BOOL fActivate, 07110 IN BOOL fQueueMsg); 07111 07112 UINT BuildHimcList( 07113 PTHREADINFO pti, 07114 UINT cHimcMax, 07115 HIMC *phimcFirst); 07116 07117 PWND xxxCreateDefaultImeWindow( 07118 IN PWND pwnd, 07119 IN ATOM atomT, 07120 IN HANDLE hInst); 07121 07122 BOOL xxxImmActivateThreadsLayout( 07123 PTHREADINFO pti, 07124 PTLBLOCK ptlBlockPrev, 07125 PKL pkl); 07126 07127 VOID xxxImmActivateAndUnloadThreadsLayout( 07128 IN PTHREADINFO *ptiList, 07129 IN UINT nEntries, 07130 IN PTLBLOCK ptlBlockPrev, 07131 PKL pklCurrent, 07132 DWORD dwHklReplace); 07133 07134 VOID xxxImmActivateLayout( 07135 IN PTHREADINFO pti, 07136 IN PKL pkl); 07137 07138 VOID xxxImmUnloadThreadsLayout( 07139 IN PTHREADINFO *ptiList, 07140 IN UINT nEntry, 07141 IN PTLBLOCK ptlBlockPrev, 07142 IN DWORD dwFlag); 07143 07144 VOID xxxImmUnloadLayout( 07145 IN PTHREADINFO pti, 07146 IN DWORD dwFlag); 07147 07148 PIMEINFOEX xxxImmLoadLayout( 07149 IN HKL hKL); 07150 07151 VOID xxxImmActivateLayout( 07152 IN PTHREADINFO pti, 07153 IN PKL pkl); 07154 07155 BOOL GetImeInfoEx( 07156 IN PWINDOWSTATION pwinsta, 07157 IN PIMEINFOEX piiex, 07158 IN IMEINFOEXCLASS SearchType); 07159 07160 BOOL SetImeInfoEx( 07161 IN PWINDOWSTATION pwinsta, 07162 IN PIMEINFOEX piiex); 07163 07164 DWORD xxxImmProcessKey( 07165 IN PQ pq, 07166 IN PWND pwnd, 07167 IN UINT message, 07168 IN WPARAM wParam, 07169 IN LPARAM lParam); 07170 07171 BOOL GetImeHotKey( 07172 DWORD dwHotKeyID, 07173 PUINT puModifiers, 07174 PUINT puVKey, 07175 HKL *phKL ); 07176 07177 BOOL SetImeHotKey( 07178 DWORD dwHotKeyID, 07179 UINT uModifiers, 07180 UINT uVKey, 07181 HKL hKL, 07182 DWORD dwAction ); 07183 07184 PIMEHOTKEYOBJ CheckImeHotKey( 07185 PQ pq, 07186 UINT uVKey, 07187 LPARAM lParam); 07188 07189 BOOL ImeCanDestroyDefIME( 07190 IN PWND pwndDefaultIme, 07191 IN PWND pwndDestroy); 07192 07193 BOOL IsChildSameThread( 07194 IN PWND pwndParent, 07195 IN PWND pwndChild); 07196 07197 BOOL ImeCanDestroyDefIMEforChild( 07198 IN PWND pwndDefaultIme, 07199 IN PWND pwndDestroy); 07200 07201 VOID ImeCheckTopmost( 07202 IN PWND pwnd); 07203 07204 VOID ImeSetFutureOwner( 07205 IN PWND pwndDefaultIme, 07206 IN PWND pwndOrgOwner); 07207 07208 VOID ImeSetTopmostChild( 07209 IN PWND pwndRoot, 07210 IN BOOL fFlag); 07211 07212 VOID ImeSetTopmost( 07213 IN PWND pwndRoot, 07214 IN BOOL fFlag, 07215 IN PWND pwndInsertBefore); 07216 07217 PSOFTKBDDATA ProbeAndCaptureSoftKbdData( 07218 PSOFTKBDDATA Source); 07219 07220 VOID xxxNotifyIMEStatus( 07221 IN PWND pwnd, 07222 IN DWORD dwOpen, 07223 IN DWORD dwConversion ); 07224 07225 BOOL xxxSetIMEShowStatus( 07226 IN BOOL fShow); 07227 07228 VOID xxxBroadcastImeShowStatusChange( 07229 IN PWND pwndDefIme, 07230 IN BOOL fShow); 07231 07232 VOID xxxCheckImeShowStatusInThread( 07233 IN PWND pwndDefIme); 07234 07235 07236 #define IsWndImeRelated(pwnd) \ 07237 (pwnd->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME] || \ 07238 TestCF(pwnd, CFIME)) 07239 07240 /* 07241 * Critical section routines for processing mouse input 07242 */ 07243 __inline VOID EnterMouseCrit() { 07244 07245 KeEnterCriticalRegion(); 07246 ExAcquireResourceExclusiveLite(gpresMouseEventQueue, TRUE); 07247 } 07248 07249 __inline VOID LeaveMouseCrit() { 07250 07251 ExReleaseResource(gpresMouseEventQueue); 07252 KeLeaveCriticalRegion(); 07253 } 07254 07255 #if DBG 07256 #define EnterDeviceInfoListCrit _EnterDeviceInfoListCrit 07257 #define LeaveDeviceInfoListCrit _LeaveDeviceInfoListCrit 07258 VOID _EnterDeviceInfoListCrit(); 07259 VOID _LeaveDeviceInfoListCrit(); 07260 #else 07261 /* 07262 * Critical section routines for accessing the Device List (gpDeviceInfoList) 07263 */ 07264 __inline VOID EnterDeviceInfoListCrit() { 07265 KeEnterCriticalRegion(); 07266 ExAcquireResourceExclusiveLite(gpresDeviceInfoList, TRUE); 07267 } 07268 __inline VOID LeaveDeviceInfoListCrit() { 07269 ExReleaseResource(gpresDeviceInfoList); 07270 KeLeaveCriticalRegion(); 07271 } 07272 #endif 07273 07274 /* 07275 * Keep some capture state visible from user-mode for performance. 07276 */ 07277 __inline VOID LockCaptureWindow(PQ pq, PWND pwnd) { 07278 if (pq->spwndCapture) { 07279 UserAssert(gpsi->cCaptures > 0); 07280 gpsi->cCaptures--; 07281 } 07282 if (pwnd) { 07283 gpsi->cCaptures++; 07284 } 07285 Lock(&pq->spwndCapture, pwnd); 07286 } 07287 07288 __inline VOID UnlockCaptureWindow(PQ pq) { 07289 if (pq->spwndCapture) { 07290 UserAssert(gpsi->cCaptures > 0); 07291 gpsi->cCaptures--; 07292 Unlock(&pq->spwndCapture); 07293 } 07294 } 07295 07296 /* 07297 * Some routines for manipulating desktop and windowstation handles. 07298 */ 07299 #define HF_DESKTOPHOOK 0 // offset to desktop hook flag 07300 #define HF_PROTECTED 1 // offset to protected flag 07301 #define HF_LIMIT 2 // number of flags per handle 07302 07303 BOOL SetHandleFlag(HANDLE, DWORD, BOOL); 07304 BOOL CheckHandleFlag(HANDLE, DWORD); 07305 VOID SetHandleInUse(HANDLE); 07306 BOOL CheckHandleInUse(HANDLE); 07307 07308 __inline NTSTATUS CloseProtectedHandle(HANDLE handle) 07309 { 07310 if (handle != NULL) { 07311 SetHandleFlag(handle, HF_PROTECTED, FALSE); 07312 return ZwClose(handle); 07313 } 07314 return STATUS_SUCCESS; 07315 } 07316 07317 __inline VOID EnterHandleFlagsCrit() { 07318 KeEnterCriticalRegion(); 07319 ExAcquireFastMutexUnsafe(gpHandleFlagsMutex); 07320 } 07321 07322 __inline VOID LeaveHandleFlagsCrit() { 07323 ExReleaseFastMutexUnsafe(gpHandleFlagsMutex); 07324 KeLeaveCriticalRegion(); 07325 } 07326 07327 // multimon apis 07328 07329 #define HMONITOR_PRIMARY ((HMONITOR)0x00010000) 07330 07331 BOOL xxxEnumDisplayMonitors( 07332 HDC hdc, 07333 LPRECT lprcClip, 07334 MONITORENUMPROC lpfnEnum, 07335 LPARAM dwData, 07336 BOOL fInternal); 07337 07338 BOOL xxxClientMonitorEnumProc( 07339 HMONITOR hMonitor, 07340 HDC hdcMonitor, 07341 LPRECT lprc, 07342 LPARAM dwData, 07343 MONITORENUMPROC xpfnProc); 07344 07345 void ClipPointToDesktop(LPPOINT lppt); 07346 void DestroyMonitor(PMONITOR pMonitor); 07347 BOOL GetHDevName(HMONITOR hMon, PWCHAR pName); 07348 ULONG HdevFromMonitor(PMONITOR pMonitor); 07349 07350 /* 07351 * Rebasing functions for shared memory. 07352 */ 07353 #define REBASESHAREDPTR(p) (p) 07354 #define REBASESHAREDPTRALWAYS(p) (p) 07355 07356 /* 07357 * Multimonitor macros used in RTL. There are similar definitions 07358 * in client\userdll.h 07359 */ 07360 __inline PDISPLAYINFO 07361 GetDispInfo(void) 07362 { 07363 07364 return gpDispInfo; 07365 } 07366 07367 __inline PMONITOR 07368 GetPrimaryMonitor(void) 07369 { 07370 return REBASESHAREDPTRALWAYS(GetDispInfo()->pMonitorPrimary); 07371 } 07372 07373 VOID _QueryUserHandles( 07374 IN LPDWORD lpIn, 07375 IN DWORD dwInLength, 07376 OUT DWORD pdwResult[][TYPE_CTYPES]); 07377 07378 07379 07380 #define REMOVE_FROM_LIST(type, pstart, pitem, next) \ 07381 { \ 07382 type** pp; \ 07383 \ 07384 for (pp = &pstart; *pp != NULL; pp = &(*pp)->next) { \ 07385 if (*pp == pitem) { \ 07386 *pp = pitem->next; \ 07387 break; \ 07388 } \ 07389 } \ 07390 } \ 07391 07392 07393 #define HH_DRIVERENTRY 0x00000001 07394 #define HH_USERINITIALIZE 0x00000002 07395 #define HH_INITVIDEO 0x00000004 07396 #define HH_REMOTECONNECT 0x00000008 07397 #define HH_REMOTEDISCONNECT 0x00000010 07398 #define HH_REMOTERECONNECT 0x00000020 07399 #define HH_REMOTELOGOFF 0x00000040 07400 #define HH_DRIVERUNLOAD 0x00000080 07401 #define HH_GRECLEANUP 0x00000100 07402 #define HH_USERKCLEANUP 0x00000200 07403 #define HH_INITIATEWIN32KCLEANUP 0x00000400 07404 #define HH_ALLDTGONE 0x00000800 07405 #define HH_RITGONE 0x00001000 07406 #define HH_RITCREATED 0x00002000 07407 #define HH_LOADCURSORS 0x00004000 07408 #define HH_KBDLYOUTGLOBALCLEANUP 0x00008000 07409 #define HH_KBDLYOUTFREEWINSTA 0x00010000 07410 #define HH_CLEANUPRESOURCES 0x00020000 07411 #define HH_DISCONNECTDESKTOP 0x00040000 07412 #define HH_DTQUITPOSTED 0x00080000 07413 07414 #define HYDRA_HINT(ev) (gdwHydraHint |= ev) 07415 07416 #if DBG 07417 VOID TrackAddDesktop(PVOID pDesktop); 07418 VOID TrackRemoveDesktop(PVOID pDesktop); 07419 VOID DumpTrackedDesktops(BOOL bBreak); 07420 07421 #define DbgTrackAddDesktop(pdesk) TrackAddDesktop(pdesk) 07422 #define DbgTrackRemoveDesktop(pdesk) TrackRemoveDesktop(pdesk) 07423 #define DbgDumpTrackedDesktops(b) DumpTrackedDesktops(b) 07424 #else 07425 #define DbgTrackAddDesktop(pdesk) 07426 #define DbgTrackRemoveDesktop(pdesk) 07427 #define DbgDumpTrackedDesktops(b) 07428 #endif 07429 07430 #if DBG 07431 #define TRACE_HYDAPI(m) \ 07432 if (gbTraceHydraApi) { \ 07433 KdPrint(("HYD-%d API: ", gSessionId)); \ 07434 KdPrint(m); \ 07435 } 07436 #else 07437 #define TRACE_HYDAPI(m) 07438 #endif 07439 07440 #if DBG 07441 #define TRACE_DESKTOP(m) \ 07442 if (gbTraceDesktop) { \ 07443 KdPrint(("HYD-%d DT ", gSessionId)); \ 07444 KdPrint(m); \ 07445 } 07446 07447 #define TRACE_RIT(m) \ 07448 if (gbTraceRIT) { \ 07449 KdPrint(("HYD-%d RIT ", gSessionId)); \ 07450 KdPrint(m); \ 07451 } 07452 #else 07453 #define TRACE_DESKTOP(m) 07454 #define TRACE_RIT(m) 07455 #endif 07456 07457 NTSTATUS 07458 RemoteConnect( 07459 IN PDOCONNECTDATA pDoConnectData, 07460 IN ULONG DisplayDriverNameLength, 07461 IN PWCHAR DisplayDriverName); 07462 07463 NTSTATUS 07464 xxxRemoteDisconnect( 07465 VOID); 07466 07467 NTSTATUS 07468 xxxRemoteReconnect( 07469 IN PDORECONNECTDATA pDoReconnectData); 07470 07471 NTSTATUS 07472 RemoteLogoff( 07473 VOID); 07474 07475 BOOL 07476 PrepareForLogoff( 07477 UINT uFlags); 07478 07479 NTSTATUS 07480 xxxRemoteStopScreenUpdates( 07481 BOOL fDisableGraphics); 07482 07483 VOID xxxPushKeyEvent( 07484 BYTE bVk, 07485 BYTE bScan, 07486 DWORD dwFlags, 07487 DWORD dwExtraInfo); 07488 07489 NTSTATUS 07490 RemoteThinwireStats( 07491 OUT PVOID Stats); 07492 07493 NTSTATUS 07494 RemoteNtSecurity( 07495 VOID); 07496 07497 NTSTATUS 07498 xxxRemoteShadowSetup( 07499 VOID); 07500 07501 NTSTATUS 07502 RemoteShadowStart( 07503 IN PVOID pThinwireData, 07504 ULONG ThinwireDataLength); 07505 07506 NTSTATUS 07507 xxxRemoteShadowStop( 07508 VOID); 07509 07510 NTSTATUS 07511 RemoteShadowCleanup( 07512 IN PVOID pThinwireData, 07513 ULONG ThinwireDataLength); 07514 07515 NTSTATUS 07516 xxxRemotePassthruEnable( 07517 VOID); 07518 07519 NTSTATUS 07520 RemotePassthruDisable( 07521 VOID); 07522 07523 NTSTATUS 07524 CtxDisplayIOCtl( 07525 ULONG DisplayIOCtlFlags, 07526 PUCHAR pDisplayIOCtlData, 07527 ULONG cbDisplayIOCtlData); 07528 07529 DWORD 07530 RemoteConnectState( 07531 VOID); 07532 07533 BOOL 07534 _GetWinStationInfo( 07535 WSINFO* pWsInfo); 07536 07537 // from fullscr.c 07538 07539 NTSTATUS 07540 RemoteRedrawRectangle( 07541 WORD Left, 07542 WORD Top, 07543 WORD Right, 07544 WORD Bottom); 07545 07546 NTSTATUS 07547 RemoteRedrawScreen( 07548 VOID); 07549 07550 NTSTATUS 07551 RemoteDisableScreen( 07552 VOID); 07553 07554 // from muclean.c 07555 07556 // from fekbd.c 07557 VOID 07558 NlsKbdSendIMEProc( 07559 DWORD dwImeOpen, 07560 DWORD dwImeConversion); 07561 07562 #endif // !_USERK_

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