mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:05:49 +00:00
Optimize GetWindow() for the case GW_OWNER to read from the desktop heap
svn path=/trunk/; revision=30521
This commit is contained in:
parent
53b892f4d2
commit
80036846f5
1 changed files with 36 additions and 1 deletions
|
@ -992,7 +992,42 @@ HWND STDCALL
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue