[ros-diffs] [weiden] 30519: Optimize IsChild() to use the desktop heap instead of calling win32k
weiden at svn.reactos.org
weiden at svn.reactos.org
Sat Nov 17 07:50:23 CET 2007
Author: weiden
Date: Sat Nov 17 09:50:23 2007
New Revision: 30519
URL: http://svn.reactos.org/svn/reactos?rev=30519&view=rev
Log:
Optimize IsChild() to use the desktop heap instead of calling win32k
Modified:
trunk/reactos/dll/win32/user32/windows/window.c
Modified: trunk/reactos/dll/win32/user32/windows/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/window.c?rev=30519&r1=30518&r2=30519&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/window.c (original)
+++ trunk/reactos/dll/win32/user32/windows/window.c Sat Nov 17 09:50:23 2007
@@ -1252,18 +1252,40 @@
IsChild(HWND hWndParent,
HWND hWnd)
{
- if (! IsWindow(hWndParent) || ! IsWindow(hWnd))
- {
- return FALSE;
- }
-
- do
- {
- hWnd = (HWND)NtUserGetWindowLong(hWnd, GWL_HWNDPARENT, FALSE);
- }
- while (hWnd != NULL && hWnd != hWndParent);
-
- return hWnd == hWndParent;
+ PWINDOW WndParent, Wnd;
+ BOOL Ret = FALSE;
+
+ WndParent = ValidateHwnd(hWndParent);
+ if (!WndParent)
+ return FALSE;
+ Wnd = ValidateHwnd(hWnd);
+ if (!Wnd)
+ return FALSE;
+
+ _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;
}
More information about the Ros-diffs
mailing list