mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[Win32k]
- Test for hooks before setting up for a hook call. This eliminates overhead. svn path=/trunk/; revision=49612
This commit is contained in:
parent
2b843622b4
commit
7b2f0a799a
1 changed files with 82 additions and 88 deletions
|
@ -15,7 +15,6 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* dialog resources appear to pass this in 16 bits, handle them properly */
|
||||
#define CW_USEDEFAULT16 (0x8000)
|
||||
|
||||
|
@ -402,6 +401,9 @@ static LRESULT co_UserFreeWindow(PWND Window,
|
|||
|
||||
DestroyTimersForWindow(ThreadData, Window);
|
||||
|
||||
/* Unregister hot keys */
|
||||
UnregisterWindowHotKeys (Window);
|
||||
|
||||
/* flush the message queue */
|
||||
MsqRemoveWindowMessagesFromQueue(Window);
|
||||
|
||||
|
@ -421,9 +423,6 @@ static LRESULT co_UserFreeWindow(PWND Window,
|
|||
ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
|
||||
}
|
||||
|
||||
/* Unregister hot keys */
|
||||
UnregisterWindowHotKeys (Window);
|
||||
|
||||
/* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
|
||||
|
||||
#if 0 /* FIXME */
|
||||
|
@ -1909,7 +1908,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
USER_REFERENCE_ENTRY ParentRef, Ref;
|
||||
PTHREADINFO pti;
|
||||
DWORD dwShowMode = SW_SHOW;
|
||||
CREATESTRUCTW *pCsw;
|
||||
CREATESTRUCTW *pCsw = NULL;
|
||||
PVOID pszClass = NULL, pszName = NULL;
|
||||
DECLARE_RETURN(PWND);
|
||||
|
||||
|
@ -1983,30 +1982,23 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
}
|
||||
|
||||
hWnd = UserHMGetHandle(Window);
|
||||
hwndInsertAfter = HWND_TOP;
|
||||
|
||||
UserRefObjectCo(Window, &Ref);
|
||||
ObDereferenceObject(WinSta);
|
||||
|
||||
//// Call the WH_CBT hook ////
|
||||
dwStyle = Window->style;
|
||||
|
||||
//// Check for a hook to eliminate overhead. ////
|
||||
if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) )
|
||||
{
|
||||
// Allocate the calling structures Justin Case this goes Global.
|
||||
pCsw = ExAllocatePoolWithTag(NonPagedPool, sizeof(CREATESTRUCTW), TAG_HOOK);
|
||||
pCbtCreate = ExAllocatePoolWithTag(NonPagedPool, sizeof(CBT_CREATEWNDW), TAG_HOOK);
|
||||
|
||||
/* Fill the new CREATESTRUCTW */
|
||||
pCsw->lpCreateParams = Cs->lpCreateParams;
|
||||
pCsw->hInstance = Cs->hInstance;
|
||||
pCsw->hMenu = Cs->hMenu;
|
||||
pCsw->hwndParent = Cs->hwndParent;
|
||||
pCsw->cx = Cs->cx;
|
||||
pCsw->cy = Cs->cy;
|
||||
pCsw->x = Cs->x;
|
||||
pCsw->y = Cs->y;
|
||||
pCsw->dwExStyle = Cs->dwExStyle;
|
||||
dwStyle = Cs->style; // Save it anyway.
|
||||
pCsw->style = Window->style; /* HCBT_CREATEWND needs the real window style */
|
||||
pCsw->lpszName = Cs->lpszName;
|
||||
pCsw->lpszClass = Cs->lpszClass;
|
||||
RtlCopyMemory(pCsw, Cs, sizeof(CREATESTRUCTW));
|
||||
pCsw->style = dwStyle; /* HCBT_CREATEWND needs the real window style */
|
||||
|
||||
// Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes.
|
||||
if (!IS_ATOM(ClassName->Buffer))
|
||||
|
@ -2060,8 +2052,9 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
}
|
||||
|
||||
pCbtCreate->lpcs = pCsw;
|
||||
pCbtCreate->hwndInsertAfter = HWND_TOP;
|
||||
pCbtCreate->hwndInsertAfter = hwndInsertAfter;
|
||||
|
||||
//// Call the WH_CBT hook ////
|
||||
Result = co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) pCbtCreate);
|
||||
if (Result != 0)
|
||||
{
|
||||
|
@ -2074,9 +2067,9 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
Cs->x = pCsw->x;
|
||||
Cs->y = pCsw->y;
|
||||
hwndInsertAfter = pCbtCreate->hwndInsertAfter;
|
||||
}
|
||||
|
||||
/* NCCREATE and WM_NCCALCSIZE need the original values */
|
||||
Cs->style = dwStyle;
|
||||
Cs->lpszName = (LPCWSTR) WindowName;
|
||||
Cs->lpszClass = (LPCWSTR) ClassName;
|
||||
|
||||
|
@ -2115,7 +2108,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
|
||||
IntLinkHwnd(Window, HWND_BOTTOM);
|
||||
else
|
||||
IntLinkHwnd(Window, HWND_TOP);
|
||||
IntLinkHwnd(Window, hwndInsertAfter);
|
||||
}
|
||||
|
||||
/* Send the NCCREATE message */
|
||||
|
@ -2219,6 +2212,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
|||
CLEANUP:
|
||||
if (!_ret_)
|
||||
{
|
||||
DPRINT("co_UserCreateWindowEx(): Error Created window!\n");
|
||||
/* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
|
||||
if (Window)
|
||||
co_UserDestroyWindow(Window);
|
||||
|
|
Loading…
Reference in a new issue