Author: weiden
Date: Sat Nov 17 10:19:47 2007
New Revision: 30521
URL:
http://svn.reactos.org/svn/reactos?rev=30521&view=rev
Log:
Optimize GetWindow() for the case GW_OWNER to read from the desktop heap
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/w…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/window.c (original)
+++ trunk/reactos/dll/win32/user32/windows/window.c Sat Nov 17 10:19:47 2007
@@ -992,7 +992,42 @@
GetWindow(HWND hWnd,
UINT uCmd)
{
- return NtUserGetWindow(hWnd, uCmd);
+ PWINDOW Wnd, FoundWnd;
+ HWND Ret = NULL;
+
+ Wnd = ValidateHwnd(hWnd);
+ if (!Wnd)
+ return NULL;
+
+ _SEH_TRY
+ {
+ FoundWnd = NULL;
+ switch (uCmd)
+ {
+ case GW_OWNER:
+ if (Wnd->Owner != NULL)
+ FoundWnd = DesktopPtrToUser(Wnd->Owner);
+ break;
+
+ default:
+ /* FIXME: Optimize! Fall back to NtUserGetWindow for now... */
+ Wnd = NULL;
+ break;
+ }
+
+ if (FoundWnd != NULL)
+ Ret = UserHMGetHandle(FoundWnd);
+ }
+ _SEH_HANDLE
+ {
+ /* Do nothing */
+ }
+ _SEH_END;
+
+ if (!Wnd) /* Fall back to win32k... */
+ Ret = NtUserGetWindow(hWnd, uCmd);
+
+ return Ret;
}