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

wow.c File Reference

#include "wow.h"

Go to the source code of this file.

Defines

#define CHECK_RESTRICTED()
#define GET_CURRENT_CLIENTINFO()   pci = GetClientInfo();
#define DESKTOPVALIDATE(pci, pobj)
#define SHAREDVALIDATE(pobj)   pobj = REBASESHAREDPTRALWAYS(pobj);
#define ValidateHandleMacro(pci, pobj, h, bType)
#define ValidateSharedHandleMacro(pobj, h, bType)

Functions

PVOID FASTCALL HMValidateHandle (HANDLE h, BYTE bType)
PVOID FASTCALL HMValidateHandleNoSecure (HANDLE h, BYTE bType)
PVOID FASTCALL HMValidateHandleNoRip (HANDLE h, BYTE bType)
PVOID FASTCALL HMValidateSharedHandle (HANDLE h, BYTE bType)
PITEM MNLookUpItem (PMENU pMenu, UINT wCmd, BOOL fByPosition, PMENU *ppMenuItemIsOn)
UINT _GetMenuState (PMENU pMenu, UINT wId, UINT dwFlags)
PWND GetPrevPwnd (PWND pwndList, PWND pwndFind)
PWND _GetWindow (PWND pwnd, UINT cmd)
PWND _GetParent (PWND pwnd)
PMENU _GetSubMenu (PMENU pMenu, int nPos)
BOOL _IsChild (PWND pwndParent, PWND pwnd)
BOOL _IsWindowVisible (PWND pwnd)
VOID _ClientToScreen (PWND pwnd, PPOINT ppt)
VOID _GetClientRect (PWND pwnd, LPRECT prc)
VOID _GetWindowRect (PWND pwnd, LPRECT prc)
VOID _ScreenToClient (PWND pwnd, PPOINT ppt)
PHOOK PhkNextValid (PHOOK phk)


Define Documentation

 
#define CHECK_RESTRICTED  ) 
 

Value:

if (pci && (pci->dwTIFlags & TIF_RESTRICTED) && pobj) { \ if (!NtUserValidateHandleSecure(h)) \ pobj = NULL; \ } \

Definition at line 25 of file rtl/wow.c.

Referenced by HMValidateHandle(), and HMValidateHandleNoRip().

#define DESKTOPVALIDATE pci,
pobj   ) 
 

Value:

if ( pci->pDeskInfo && \ pobj >= pci->pDeskInfo->pvDesktopBase && \ pobj < pci->pDeskInfo->pvDesktopLimit) { \ pobj = (KERNEL_PVOID)((KERNEL_ULONG_PTR)pobj - pci->ulClientDelta); \ } else { \ pobj = (KERNEL_PVOID)NtUserCallOneParam((ULONG_PTR)h, \ SFI__MAPDESKTOPOBJECT); \ } \

Definition at line 76 of file rtl/wow.c.

 
#define GET_CURRENT_CLIENTINFO  )     pci = GetClientInfo();
 

Definition at line 50 of file rtl/wow.c.

Referenced by HMValidateHandle(), HMValidateHandleNoRip(), and HMValidateHandleNoSecure().

#define SHAREDVALIDATE pobj   )     pobj = REBASESHAREDPTRALWAYS(pobj);
 

Definition at line 86 of file rtl/wow.c.

#define ValidateHandleMacro pci,
pobj,
h,
bType   ) 
 

Value:

Definition at line 102 of file rtl/wow.c.

Referenced by HMValidateHandle(), HMValidateHandleNoRip(), and HMValidateHandleNoSecure().

#define ValidateSharedHandleMacro pobj,
h,
bType   ) 
 

Value:

Definition at line 126 of file rtl/wow.c.

Referenced by HMValidateSharedHandle().


Function Documentation

VOID _ClientToScreen PWND  pwnd,
PPOINT  ppt
 

Definition at line 893 of file rtl/wow.c.

References FNID_DESKTOP, GETFNID, tagWND::rcClient, TestWF, and VOID().

Referenced by ClientToScreen(), ComboBoxWndProcWorker(), ReaderMouseMove(), xxxQueryDropObject(), xxxSBWndProc(), xxxTrackInitSize(), and xxxTrackMouse().

00896 { 00897 /* 00898 * Client and screen coordinates are the same for the 00899 * desktop window. 00900 */ 00901 if (GETFNID(pwnd) != FNID_DESKTOP) { 00902 #ifdef USE_MIRRORING 00903 if (TestWF(pwnd, WEFLAYOUTRTL)) { 00904 ppt->x = pwnd->rcClient.right - ppt->x; 00905 } else 00906 #endif 00907 { 00908 ppt->x += pwnd->rcClient.left; 00909 } 00910 ppt->y += pwnd->rcClient.top; 00911 } 00912 }

VOID _GetClientRect PWND  pwnd,
LPRECT  prc
 

Definition at line 924 of file rtl/wow.c.

References FNID_DESKTOP, GETFNID, OffsetRect(), tagWND::rcClient, SYSMETRTL, TestWF, VOID(), WFMINIMIZED, and WFWIN40COMPAT.

Referenced by BNCalcRect(), ButtonWndProcWorker(), ChopText(), CItemInWindow(), CItemInWindowVarOwnerDraw(), DefWindowProcWorker(), ECInvalidateClient(), ECSetEditClip(), ECSize(), EditWndProc(), GetClientRect(), ISelFromPt(), LBCalcItemRowsAndColumns(), LBCalcVarITopScrollAmt(), LBGetItemRect(), LBInitDC(), LBPage(), LBSetCItemFullMax(), ListBoxWndProcWorker(), MLPaint(), MLScroll(), SLPaint(), StaticWndProcWorker(), xxxBNDrawText(), xxxBNOwnerDraw(), xxxBNPaint(), xxxDrawButton(), xxxInitSendValidateMinMaxInfo(), xxxLBoxCtlHScroll(), xxxLBPaint(), xxxLBSize(), xxxMNUpdateShownMenu(), xxxNewITopEx(), xxxPaintSwitchWindow(), xxxStaticPaint(), and xxxTrackMouse().

00927 { 00928 /* 00929 * If this is a 3.1 app, and it's minimized, then we need to return 00930 * a rectangle other than the real-client-rect. This is necessary since 00931 * there is no client-rect-size in Win4.0. Apps such as PackRat 1.0 00932 * will GPF if returned a empty-rect. 00933 */ 00934 if (TestWF(pwnd, WFMINIMIZED) && !TestWF(pwnd, WFWIN40COMPAT)) { 00935 prc->left = 0; 00936 prc->top = 0; 00937 prc->right = SYSMETRTL(CXMINIMIZED); 00938 prc->bottom = SYSMETRTL(CYMINIMIZED); 00939 00940 } else { 00941 00942 if (GETFNID(pwnd) != FNID_DESKTOP) { 00943 *prc = pwnd->rcClient; 00944 OffsetRect(prc, -pwnd->rcClient.left, -pwnd->rcClient.top); 00945 } else { 00946 /* 00947 * For compatibility, return the rect of the primary 00948 * monitor for the desktop window. 00949 */ 00950 prc->left = prc->top = 0; 00951 prc->right = SYSMETRTL(CXSCREEN); 00952 prc->bottom = SYSMETRTL(CYSCREEN); 00953 } 00954 } 00955 }

UINT _GetMenuState PMENU  pMenu,
UINT  wId,
UINT  dwFlags
 

Definition at line 583 of file rtl/wow.c.

References BOOL, dwFlags, DWORD, tagITEM::fState, tagITEM::fType, tagITEM::hbmp, tagITEM::lpstr, MNLookUpItem(), NULL, REBASEPTR, tagITEM::spSubMenu, and UINT.

Referenced by GetMenuState(), xxxDWP_NCMouse(), xxxDWP_SetCursor(), xxxHandleNCMouseGuys(), and xxxMNLoop().

00587 { 00588 PITEM pItem; 00589 DWORD fFlags; 00590 00591 /* 00592 * If the item does not exist, leave 00593 */ 00594 if ((pItem = MNLookUpItem(pMenu, wId, (BOOL) (dwFlags & MF_BYPOSITION), NULL)) == NULL) 00595 return (UINT)-1; 00596 00597 fFlags = pItem->fState | pItem->fType; 00598 00599 #ifndef _USERK_ 00600 /* 00601 * Add old MFT_BITMAP flag to keep old apps happy 00602 */ 00603 if ((pItem->hbmp != NULL) && (pItem->lpstr == NULL)) { 00604 fFlags |= MFT_BITMAP; 00605 } 00606 #endif 00607 00608 if (pItem->spSubMenu != NULL) { 00609 /* 00610 * If the item is a popup, return item count in high byte and 00611 * popup flags in low byte 00612 */ 00613 00614 fFlags = ((fFlags | MF_POPUP) & 0x00FF) + 00615 (((PMENU)REBASEPTR(pMenu, pItem->spSubMenu))->cItems << 8); 00616 } 00617 00618 return fFlags; 00619 }

PWND _GetParent PWND  pwnd  ) 
 

Definition at line 762 of file rtl/wow.c.

References NULL, REBASEPWND, TestwndChild, and TestwndTiled.

Referenced by _GetAncestor(), GetParent(), and xxxHelpLoop().

00764 { 00765 /* 00766 * For 1.03 compatibility reasons, we should return NULL 00767 * for top level "tiled" windows and owner for other popups. 00768 * pwndOwner is set to NULL in xxxCreateWindow for top level 00769 * "tiled" windows. 00770 */ 00771 if (!(TestwndTiled(pwnd))) { 00772 if (TestwndChild(pwnd)) 00773 pwnd = REBASEPWND(pwnd, spwndParent); 00774 else 00775 pwnd = REBASEPWND(pwnd, spwndOwner); 00776 return pwnd; 00777 } 00778 00779 /* 00780 * The window was not a child window; they may have been just testing 00781 * if it was 00782 */ 00783 return NULL; 00784 }

PMENU _GetSubMenu PMENU  pMenu,
int  nPos
 

Definition at line 796 of file rtl/wow.c.

References NULL, REBASEALWAYS, REBASEPTR, tagITEM::spSubMenu, and UINT.

Referenced by GetSubMenu(), MDIAddSysMenu(), xxxGetScrollMenu(), xxxGetSysMenu(), xxxGetSystemMenu(), xxxMNKeyDown(), and xxxSetSysMenu().

00799 { 00800 PITEM pItem; 00801 PMENU pPopup = NULL; 00802 00803 /* 00804 * Make sure nPos refers to a valid popup 00805 */ 00806 if ((UINT)nPos < (UINT)((PMENU)pMenu)->cItems) { 00807 pItem = &((PITEM)REBASEALWAYS(pMenu, rgItems))[nPos]; 00808 if (pItem->spSubMenu != NULL) 00809 pPopup = (PMENU)REBASEPTR(pMenu, pItem->spSubMenu); 00810 00811 } 00812 00813 return (PVOID)pPopup; 00814 }

PWND _GetWindow PWND  pwnd,
UINT  cmd
 

Definition at line 668 of file rtl/wow.c.

References BOOL, FALSE, FNID_DESKTOP, GetAppCompatFlags(), GETFNID, GetPrevPwnd(), NtUserCallHwnd(), NULL, PtoHq, REBASEPTR, REBASEPWND, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndOwner, tagWND::spwndParent, TestWF, TRUE, and WEFTOPMOST.

Referenced by _GetNextQueueWindow(), CheckOnTop(), CheckTopmost(), GetWindow(), xxxCalcValidRects(), and xxxMDINext().

00671 { 00672 PWND pwndT; 00673 BOOL fRebase = FALSE; 00674 00675 /* 00676 * If this is a desktop window, return NULL for sibling or 00677 * parent information. 00678 */ 00679 if (GETFNID(pwnd) == FNID_DESKTOP) { 00680 switch (cmd) { 00681 case GW_CHILD: 00682 break; 00683 00684 default: 00685 return NULL; 00686 break; 00687 } 00688 } 00689 00690 /* 00691 * Rebase the returned window at the end of the routine 00692 * to avoid multiple test for pwndT == NULL. 00693 */ 00694 pwndT = NULL; 00695 switch (cmd) { 00696 case GW_HWNDNEXT: 00697 pwndT = pwnd->spwndNext; 00698 fRebase = TRUE; 00699 break; 00700 00701 case GW_HWNDFIRST: 00702 if (pwnd->spwndParent) { 00703 pwndT = REBASEPWND(pwnd, spwndParent); 00704 pwndT = REBASEPWND(pwndT, spwndChild); 00705 if (GetAppCompatFlags(NULL) & GACF_IGNORETOPMOST) { 00706 while (pwndT != NULL) { 00707 if (!TestWF(pwndT, WEFTOPMOST)) 00708 break; 00709 pwndT = REBASEPWND(pwndT, spwndNext); 00710 } 00711 } 00712 } 00713 break; 00714 00715 case GW_HWNDLAST: 00716 pwndT = GetPrevPwnd(pwnd, NULL); 00717 break; 00718 00719 case GW_HWNDPREV: 00720 pwndT = GetPrevPwnd(pwnd, pwnd); 00721 break; 00722 00723 case GW_OWNER: 00724 pwndT = pwnd->spwndOwner; 00725 fRebase = TRUE; 00726 break; 00727 00728 case GW_CHILD: 00729 pwndT = pwnd->spwndChild; 00730 fRebase = TRUE; 00731 break; 00732 00733 #if !defined(_USERK_) 00734 case GW_ENABLEDPOPUP: 00735 pwndT = (PWND)NtUserCallHwnd(PtoHq(pwnd), SFI_DWP_GETENABLEDPOPUP); 00736 fRebase = TRUE; 00737 break; 00738 #endif 00739 00740 default: 00741 RIPERR0(ERROR_INVALID_GW_COMMAND, RIP_VERBOSE, ""); 00742 return NULL; 00743 } 00744 00745 if (pwndT != NULL && fRebase) 00746 pwndT = REBASEPTR(pwnd, pwndT); 00747 00748 return pwndT; 00749 }

VOID _GetWindowRect PWND  pwnd,
LPRECT  prc
 

Definition at line 967 of file rtl/wow.c.

References FNID_DESKTOP, GETFNID, tagWND::rcWindow, SYSMETRTL, and VOID().

Referenced by _UserSoundSentryWorker(), and GetWindowRect().

00970 { 00971 00972 if (GETFNID(pwnd) != FNID_DESKTOP) { 00973 *prc = pwnd->rcWindow; 00974 } else { 00975 /* 00976 * For compatibility, return the rect of the primary 00977 * monitor for the desktop window. 00978 */ 00979 prc->left = 0; 00980 prc->top = 0; 00981 prc->right = SYSMETRTL(CXSCREEN); 00982 prc->bottom = SYSMETRTL(CYSCREEN); 00983 } 00984 }

BOOL _IsChild PWND  pwndParent,
PWND  pwnd
 

Definition at line 826 of file rtl/wow.c.

References BOOL, FALSE, NULL, REBASEPWND, TestwndChild, and TRUE.

Referenced by _SelectPalette(), CheckPwndFilter(), ComboBoxWndProcWorker(), DefDlgProcWorker(), IsChild(), IsDialogMessageA(), IsDialogMessageW(), and xxxMNLoop().

00829 { 00830 /* 00831 * Don't need a test to get out of the loop because the 00832 * desktop is not a child. 00833 */ 00834 while (pwnd != NULL) { 00835 if (!TestwndChild(pwnd)) 00836 return FALSE; 00837 00838 pwnd = REBASEPWND(pwnd, spwndParent); 00839 if (pwndParent == pwnd) 00840 return TRUE; 00841 } 00842 return FALSE; 00843 }

BOOL _IsWindowVisible PWND  pwnd  ) 
 

Definition at line 860 of file rtl/wow.c.

References BOOL, FALSE, FNID_DESKTOP, GETFNID, NULL, REBASEPWND, TestWF, TRUE, and WFVISIBLE.

Referenced by ECResetTextInfo(), IsWindowVisible(), ListBoxWndProcWorker(), MLChangeSelection(), MLDeleteText(), MLEditWndProc(), MLEnsureCaretVisible(), MLInsertText(), MLKillFocus(), MLScroll(), MLSetCaretPosition(), MLSetFocus(), SLChangeSelection(), SLDrawLine(), SLDrawText(), SLEditWndProc(), SLPaint(), SLReplaceSel(), xxxDWPPrint(), xxxLBSetCurSel(), xxxLBSetSel(), and xxxSetISelBase().

00862 { 00863 /* 00864 * Check if this is the iconic window being moved around with a mouse 00865 * If so, return a TRUE, though, strictly speaking, it is hidden. 00866 * This helps the Tracer guys from going crazy! 00867 * Fix for Bug #57 -- SANKAR -- 08-08-89 -- 00868 */ 00869 if (pwnd == NULL) 00870 return TRUE; 00871 00872 for (;;) { 00873 if (!TestWF(pwnd, WFVISIBLE)) 00874 return FALSE; 00875 if (GETFNID(pwnd) == FNID_DESKTOP) 00876 break; 00877 pwnd = REBASEPWND(pwnd, spwndParent); 00878 } 00879 00880 return TRUE; 00881 }

VOID _ScreenToClient PWND  pwnd,
PPOINT  ppt
 

Definition at line 995 of file rtl/wow.c.

References FNID_DESKTOP, GETFNID, tagWND::rcClient, TestWF, and VOID().

Referenced by ChildMinMaxInfo(), ComboBoxWndProcWorker(), ListBoxWndProcWorker(), ScreenToClient(), xxxArrangeIconicWindows(), xxxDrawDragRect(), xxxQueryDropObject(), and xxxSetParent().

00998 { 00999 /* 01000 * Client and screen coordinates are the same for the 01001 * desktop window. 01002 */ 01003 if (GETFNID(pwnd) != FNID_DESKTOP) { 01004 #ifdef USE_MIRRORING 01005 if (TestWF(pwnd, WEFLAYOUTRTL)) { 01006 ppt->x = pwnd->rcClient.right - ppt->x; 01007 } else 01008 #endif 01009 { 01010 ppt->x -= pwnd->rcClient.left; 01011 } 01012 ppt->y -= pwnd->rcClient.top; 01013 } 01014 }

PWND GetPrevPwnd PWND  pwndList,
PWND  pwndFind
 

Definition at line 631 of file rtl/wow.c.

References NULL, REBASEPWND, and tagWND::spwndParent.

Referenced by _GetWindow().

00634 { 00635 PWND pwndFound, pwndNext; 00636 00637 if (pwndList == NULL) 00638 return NULL; 00639 00640 if (pwndList->spwndParent == NULL) 00641 return NULL; 00642 00643 pwndNext = REBASEPWND(pwndList, spwndParent); 00644 pwndNext = REBASEPWND(pwndNext, spwndChild); 00645 pwndFound = NULL; 00646 00647 while (pwndNext != NULL) { 00648 if (pwndNext == pwndFind) 00649 break; 00650 pwndFound = pwndNext; 00651 pwndNext = REBASEPWND(pwndNext, spwndNext); 00652 } 00653 00654 return (pwndNext == pwndFind) ? pwndFound : NULL; 00655 }

PVOID FASTCALL HMValidateHandle HANDLE  h,
BYTE  bType
 

Definition at line 150 of file rtl/wow.c.

References CHECK_RESTRICTED, DWORD, _CLIENTINFO::dwTIFlags, FASTCALL, GET_CURRENT_CLIENTINFO, HMUniqFromHandle, NULL, TIF_16BIT, TYPE_ACCELTABLE, TYPE_CURSOR, TYPE_HOOK, TYPE_MENU, TYPE_MONITOR, TYPE_SETWINDOWPOS, TYPE_WINDOW, and ValidateHandleMacro.

Referenced by _MapDesktopObject(), _SetCursorIconData(), DestroyInputContext(), ImeIsUsableContext(), ImeMarkUsedContext(), ImmCallImeConsoleIME(), ImmLockClientImc(), IsMenu(), NtUserCreateLocalMemHandle(), NtUserUserHandleGrantAccess(), SetClassCursor(), ValidateHmenu(), ValidateHwnd(), xxxGetDummyPalette(), and xxxQueryDropObject().

00153 { 00154 DWORD dwError; 00155 KERNEL_PVOID pobj = NULL; 00156 PCLIENTINFO pci; 00157 00158 GET_CURRENT_CLIENTINFO(); 00159 00160 #if DBG != 0 && !defined(_USERK_) 00161 /* 00162 * We don't want 32 bit apps passing 16 bit handles 00163 * we should consider failing this before we get 00164 * stuck supporting it (Some VB apps do this). 00165 */ 00166 if (pci && (h != NULL) 00167 && (HMUniqFromHandle(h) == 0) 00168 && !(pci->dwTIFlags & TIF_16BIT)) { 00169 RIPMSG3(RIP_WARNING, "HMValidateHandle: 32bit process [%d] using 16 bit handle [%#p] bType:%#lx", 00170 HandleToUlong(NtCurrentTeb()->ClientId.UniqueProcess), h, (DWORD)bType); 00171 } 00172 #endif 00173 00174 /* 00175 * Object can't be located in shared memory. 00176 */ 00177 UserAssert(bType != TYPE_MONITOR); 00178 00179 /* 00180 * Validation macro. Falls through if the handle is invalid. 00181 */ 00182 ValidateHandleMacro(pci, pobj, h, bType); 00183 00184 /* 00185 * check for secure process 00186 */ 00187 CHECK_RESTRICTED(); 00188 00189 if (pobj != NULL) { 00190 return pobj; 00191 } 00192 00193 switch (bType) { 00194 00195 case TYPE_WINDOW: 00196 dwError = ERROR_INVALID_WINDOW_HANDLE; 00197 break; 00198 00199 case TYPE_MENU: 00200 dwError = ERROR_INVALID_MENU_HANDLE; 00201 break; 00202 00203 case TYPE_CURSOR: 00204 dwError = ERROR_INVALID_CURSOR_HANDLE; 00205 break; 00206 00207 case TYPE_ACCELTABLE: 00208 dwError = ERROR_INVALID_ACCEL_HANDLE; 00209 break; 00210 00211 case TYPE_HOOK: 00212 dwError = ERROR_INVALID_HOOK_HANDLE; 00213 break; 00214 00215 case TYPE_SETWINDOWPOS: 00216 dwError = ERROR_INVALID_DWP_HANDLE; 00217 break; 00218 00219 default: 00220 dwError = ERROR_INVALID_HANDLE; 00221 break; 00222 } 00223 00224 RIPERR2(dwError, 00225 RIP_WARNING, 00226 "HMValidateHandle: Invalid:%#p Type:%#lx", 00227 h, (DWORD)bType); 00228 00229 /* 00230 * If we get here, it's an error. 00231 */ 00232 return NULL; 00233 }

PVOID FASTCALL HMValidateHandleNoRip HANDLE  h,
BYTE  bType
 

Definition at line 353 of file rtl/wow.c.

References CHECK_RESTRICTED, FASTCALL, GET_CURRENT_CLIENTINFO, NULL, TYPE_MONITOR, and ValidateHandleMacro.

Referenced by _CsDdeUninitialize(), _CsUpdateInstance(), _SetWindowLongPtr(), CallWindowProcAorW(), DestroyWindowSmIcon(), DrawIconCallBack(), DWP_GetIcon(), FindQMsg(), MungeClipData(), ProcessRegistrationMessage(), UT_FreeCBFormat(), ValidateHwndNoRip(), xxxCreateWindowSmIcon(), xxxDDETrackGetMessageHook(), xxxDWP_SetIcon(), xxxEventWndProc(), xxxGetDummyBitmap(), xxxGetDummyDib(), xxxGetDummyDibV5(), xxxPaintIconsInSwitchWindow(), xxxRealDrawMenuItem(), xxxRegisterClassEx(), xxxSetClassData(), xxxSetWindowData(), and xxxWrapCallWindowProc().

00356 { 00357 KERNEL_PVOID pobj = NULL; 00358 PCLIENTINFO pci; 00359 00360 /* 00361 * This is the fastest way way to do validation, because 00362 * unlike HMValidateHandle, this function doesn't set the 00363 * last error. 00364 * 00365 * Validation macro. Falls through if the handle is invalid. 00366 */ 00367 00368 GET_CURRENT_CLIENTINFO(); 00369 00370 /* 00371 * Object can't be located in shared memory. 00372 */ 00373 UserAssert(bType != TYPE_MONITOR); 00374 00375 ValidateHandleMacro(pci, pobj, h, bType); 00376 00377 /* 00378 * check for secure process 00379 */ 00380 CHECK_RESTRICTED(); 00381 00382 return pobj; 00383 }

PVOID FASTCALL HMValidateHandleNoSecure HANDLE  h,
BYTE  bType
 

Definition at line 242 of file rtl/wow.c.

References DWORD, _CLIENTINFO::dwTIFlags, FASTCALL, GET_CURRENT_CLIENTINFO, HMUniqFromHandle, NULL, TIF_16BIT, TYPE_MONITOR, and ValidateHandleMacro.

Referenced by ValidateAndLockCursor(), and xxxGetWindowSmIcon().

00245 { 00246 KERNEL_PVOID pobj = NULL; 00247 PCLIENTINFO pci; 00248 00249 GET_CURRENT_CLIENTINFO(); 00250 00251 #if !defined(_USERK_) 00252 /* 00253 * We don't want 32 bit apps passing 16 bit handles 00254 * we should consider failing this before we get 00255 * stuck supporting it (Some VB apps do this). 00256 */ 00257 if (pci && (h != NULL) 00258 && (HMUniqFromHandle(h) == 0) 00259 && !(pci->dwTIFlags & TIF_16BIT)) { 00260 RIPMSG3(RIP_WARNING, "HMValidateHandle: 32bit process [%d] using 16 bit handle [%#p] bType:%#lx", 00261 HandleToUlong(NtCurrentTeb()->ClientId.UniqueProcess), h, (DWORD)bType); 00262 } 00263 #endif 00264 00265 /* 00266 * Object can't be located in shared memory. 00267 */ 00268 UserAssert(bType != TYPE_MONITOR); 00269 00270 /* 00271 * Validation macro. 00272 */ 00273 ValidateHandleMacro(pci, pobj, h, bType); 00274 00275 return pobj; 00276 }

PVOID FASTCALL HMValidateSharedHandle HANDLE  h,
BYTE  bType
 

Definition at line 419 of file rtl/wow.c.

References DWORD, GetClientInfo, HMUniqFromHandle, NULL, TIF_16BIT, TYPE_MONITOR, and ValidateSharedHandleMacro.

Referenced by ValidateHmonitor().

00422 { 00423 DWORD dwError; 00424 KERNEL_PVOID pobj = NULL; 00425 00426 #if DBG != 0 && !defined(_USERK_) 00427 00428 /* 00429 * We don't want 32 bit apps passing 16 bit handles 00430 * we should consider failing this before we get 00431 * stuck supporting it (Some VB apps do this). 00432 */ 00433 if ((h != NULL) 00434 && (HMUniqFromHandle(h) == 0) 00435 && !(GetClientInfo()->dwTIFlags & TIF_16BIT)) { 00436 RIPMSG3(RIP_WARNING, "HMValidateHandle: 32bit process [%d] using 16 bit handle [%#p] bType:%#lx", 00437 HandleToUlong(NtCurrentTeb()->ClientId.UniqueProcess), h, (DWORD)bType); 00438 } 00439 #endif 00440 00441 /* 00442 * Validation macro. Falls through if the handle is invalid. 00443 */ 00444 ValidateSharedHandleMacro(pobj, h, bType); 00445 00446 if (pobj != NULL) 00447 return pobj; 00448 00449 switch (bType) { 00450 case TYPE_MONITOR: 00451 dwError = ERROR_INVALID_MONITOR_HANDLE; 00452 break; 00453 00454 default: 00455 UserAssertMsg0(0, "Logic error in HMValidateSharedHandle"); 00456 break; 00457 } 00458 00459 RIPERR2(dwError, 00460 RIP_WARNING, 00461 "HMValidateSharedHandle: Invalid:%#p Type:%#lx", 00462 h, (DWORD)bType); 00463 00464 /* 00465 * If we get here, it's an error. 00466 */ 00467 return NULL; 00468 }

PITEM MNLookUpItem PMENU  pMenu,
UINT  wCmd,
BOOL  fByPosition,
PMENU ppMenuItemIsOn
 

Definition at line 486 of file rtl/wow.c.

References tagMENU::cItems, FALSE, MFMWFP_NOITEM, NULL, REBASEALWAYS, REBASEPTR, and UINT.

Referenced by _GetMenuState(), _SetMenuDefaultItem(), CheckMenuItem(), CheckMenuRadioItem(), EnableMenuItem(), MenuItemState(), UT_FindTopLevelMenuIndex(), xxxInsertMenuItem(), xxxMNCanClose(), xxxRemoveDeleteMenuHelper(), xxxSetMenuItemInfo(), xxxSetSysMenu(), and xxxTA_AccelerateMenu().

00491 { 00492 PITEM pItem; 00493 PITEM pItemRet = NULL; 00494 PITEM pItemMaybe; 00495 PMENU pMenuMaybe = NULL; 00496 int i; 00497 00498 if (ppMenuItemIsOn != NULL) 00499 *ppMenuItemIsOn = NULL; 00500 00501 if (pMenu == NULL || !pMenu->cItems || wCmd == MFMWFP_NOITEM) { 00502 // RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "MNLookUpItem: invalid item"); 00503 return NULL; 00504 } 00505 00506 /* 00507 * dwFlags determines how we do the search 00508 */ 00509 if (fByPosition) { 00510 if (wCmd < (UINT)pMenu->cItems) { 00511 pItemRet = &((PITEM)REBASEALWAYS(pMenu, rgItems))[wCmd]; 00512 if (ppMenuItemIsOn != NULL) 00513 *ppMenuItemIsOn = pMenu; 00514 return (pItemRet); 00515 } else 00516 return NULL; 00517 } 00518 /* 00519 * Walk down the menu and try to find an item with an ID of wCmd. 00520 * The search procedes from the end of the menu (as was done in 00521 * assembler). 00522 */ 00523 00524 /* this is the Chicago code, which walks from the front of the menu -- Fritz */ 00525 00526 00527 // for (pItem = &pMenu->rgItems[i - 1]; pItemRet == NULL && i--; --pItem) { 00528 for (i = 0, pItem = REBASEALWAYS(pMenu, rgItems); i < (int)pMenu->cItems; 00529 i++, pItem++) { 00530 00531 /* 00532 * If the item is a popup, recurse down the tree 00533 */ 00534 if (pItem->spSubMenu != NULL) { 00535 // 00536 // COMPAT: 00537 // Allow apps to pass in menu handle as ID in menu APIs. We 00538 // remember that this popup had a menu handle with the same ID 00539 // value. This is a 2nd choice though. We still want to see 00540 // if there's some actual command that has this ID value first. 00541 // 00542 if (pItem->wID == wCmd) { 00543 pMenuMaybe = pMenu; 00544 pItemMaybe = pItem; 00545 } 00546 00547 pItemRet = MNLookUpItem((PMENU)REBASEPTR(pMenu, pItem->spSubMenu), 00548 wCmd, FALSE, ppMenuItemIsOn); 00549 if (pItemRet != NULL) 00550 return pItemRet; 00551 } else if (pItem->wID == wCmd) { 00552 00553 /* 00554 * Found the item, now save things for later 00555 */ 00556 if (ppMenuItemIsOn != NULL) 00557 *ppMenuItemIsOn = pMenu; 00558 return pItem; 00559 } 00560 } 00561 00562 if (pMenuMaybe) { 00563 // no non popup menu match found -- use the 2nd choice popup menu 00564 // match 00565 if (ppMenuItemIsOn != NULL) 00566 *ppMenuItemIsOn = pMenuMaybe; 00567 return(pItemMaybe); 00568 } 00569 00570 return(NULL); 00571 }

PHOOK PhkNextValid PHOOK  phk  ) 
 

Definition at line 1031 of file rtl/wow.c.

References tagDESKTOPINFO::aphkStart, CheckCritInShared, DbgValidateHooks, tagHOOK::flags, GetClientInfo, HF_DESTROYED, HF_GLOBAL, tagHOOK::iHook, NULL, _CLIENTINFO::pDeskInfo, PtiCurrent, REBASEALWAYS, and _CLIENTINFO::ulClientDelta.

Referenced by CallNextHookEx(), PhkFirstGlobalValid(), PhkFirstValid(), xxxCallHook2(), xxxCallNextHookEx(), zzzCancelJournalling(), zzzUnhookWindowsHook(), and zzzUnhookWindowsHookEx().

01032 { 01033 01034 #if DBG 01035 int iHook = phk->iHook; 01036 #ifdef _USERK_ 01037 CheckCritInShared(); 01038 #endif 01039 #endif 01040 01041 do { 01042 /* 01043 * If this hook is marked as destroyed, it must be either 01044 * locked or we should be in the process of destroying it 01045 */ 01046 UserAssert(!(phk->flags & HF_DESTROYED) 01047 || (((PHEAD)phk)->cLockObj != 0) 01048 || (phk->flags & HF_INCHECKWHF)); 01049 /* 01050 * Get the next hook 01051 */ 01052 if (phk->phkNext != NULL) { 01053 phk = REBASEALWAYS(phk, phkNext); 01054 } else if (!(phk->flags & HF_GLOBAL)) { 01055 #ifdef _USERK_ 01056 phk = PtiCurrent()->pDeskInfo->aphkStart[phk->iHook + 1]; 01057 #else 01058 PCLIENTINFO pci = GetClientInfo(); 01059 phk = pci->pDeskInfo->aphkStart[phk->iHook + 1]; 01060 /* 01061 * If it found a pointer, rebase it. 01062 */ 01063 if (phk != NULL) { 01064 (KPBYTE)phk -= pci->ulClientDelta; 01065 } 01066 #endif 01067 UserAssert((phk == NULL) || (phk->flags & HF_GLOBAL)); 01068 } else { 01069 return NULL; 01070 } 01071 /* 01072 * If destroyed, keep looking. 01073 */ 01074 } while ((phk != NULL) && (phk->flags & HF_DESTROYED)); 01075 01076 #ifdef _USERK_ 01077 DbgValidateHooks(phk, iHook); 01078 #endif 01079 01080 return phk; 01081 }


Generated on Sat May 15 19:46:09 2004 for test by doxygen 1.3.7