Optimize IsChild() to use the desktop heap instead of calling win32k

svn path=/trunk/; revision=30519
This commit is contained in:
Thomas Bluemel 2007-11-17 06:50:23 +00:00
parent 1e40d2861b
commit 0a9026f76e

View file

@ -1252,18 +1252,40 @@ BOOL STDCALL
IsChild(HWND hWndParent, IsChild(HWND hWndParent,
HWND hWnd) HWND hWnd)
{ {
if (! IsWindow(hWndParent) || ! IsWindow(hWnd)) PWINDOW WndParent, Wnd;
{ BOOL Ret = FALSE;
return FALSE;
}
do WndParent = ValidateHwnd(hWndParent);
{ if (!WndParent)
hWnd = (HWND)NtUserGetWindowLong(hWnd, GWL_HWNDPARENT, FALSE); return FALSE;
} Wnd = ValidateHwnd(hWnd);
while (hWnd != NULL && hWnd != hWndParent); if (!Wnd)
return FALSE;
return hWnd == hWndParent; _SEH_TRY
{
while (Wnd != NULL)
{
if (Wnd->Parent != NULL)
{
Wnd = DesktopPtrToUser(Wnd->Parent);
if (Wnd == WndParent)
{
Ret = TRUE;
break;
}
}
else
break;
}
}
_SEH_HANDLE
{
/* Do nothing */
}
_SEH_END;
return Ret;
} }