mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:45:50 +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
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
/* dialog resources appear to pass this in 16 bits, handle them properly */
|
/* dialog resources appear to pass this in 16 bits, handle them properly */
|
||||||
#define CW_USEDEFAULT16 (0x8000)
|
#define CW_USEDEFAULT16 (0x8000)
|
||||||
|
|
||||||
|
@ -402,6 +401,9 @@ static LRESULT co_UserFreeWindow(PWND Window,
|
||||||
|
|
||||||
DestroyTimersForWindow(ThreadData, Window);
|
DestroyTimersForWindow(ThreadData, Window);
|
||||||
|
|
||||||
|
/* Unregister hot keys */
|
||||||
|
UnregisterWindowHotKeys (Window);
|
||||||
|
|
||||||
/* flush the message queue */
|
/* flush the message queue */
|
||||||
MsqRemoveWindowMessagesFromQueue(Window);
|
MsqRemoveWindowMessagesFromQueue(Window);
|
||||||
|
|
||||||
|
@ -421,9 +423,6 @@ static LRESULT co_UserFreeWindow(PWND Window,
|
||||||
ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
|
ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unregister hot keys */
|
|
||||||
UnregisterWindowHotKeys (Window);
|
|
||||||
|
|
||||||
/* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
|
/* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
|
||||||
|
|
||||||
#if 0 /* FIXME */
|
#if 0 /* FIXME */
|
||||||
|
@ -1909,7 +1908,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
USER_REFERENCE_ENTRY ParentRef, Ref;
|
USER_REFERENCE_ENTRY ParentRef, Ref;
|
||||||
PTHREADINFO pti;
|
PTHREADINFO pti;
|
||||||
DWORD dwShowMode = SW_SHOW;
|
DWORD dwShowMode = SW_SHOW;
|
||||||
CREATESTRUCTW *pCsw;
|
CREATESTRUCTW *pCsw = NULL;
|
||||||
PVOID pszClass = NULL, pszName = NULL;
|
PVOID pszClass = NULL, pszName = NULL;
|
||||||
DECLARE_RETURN(PWND);
|
DECLARE_RETURN(PWND);
|
||||||
|
|
||||||
|
@ -1983,30 +1982,23 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
}
|
}
|
||||||
|
|
||||||
hWnd = UserHMGetHandle(Window);
|
hWnd = UserHMGetHandle(Window);
|
||||||
|
hwndInsertAfter = HWND_TOP;
|
||||||
|
|
||||||
UserRefObjectCo(Window, &Ref);
|
UserRefObjectCo(Window, &Ref);
|
||||||
ObDereferenceObject(WinSta);
|
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.
|
// Allocate the calling structures Justin Case this goes Global.
|
||||||
pCsw = ExAllocatePoolWithTag(NonPagedPool, sizeof(CREATESTRUCTW), TAG_HOOK);
|
pCsw = ExAllocatePoolWithTag(NonPagedPool, sizeof(CREATESTRUCTW), TAG_HOOK);
|
||||||
pCbtCreate = ExAllocatePoolWithTag(NonPagedPool, sizeof(CBT_CREATEWNDW), TAG_HOOK);
|
pCbtCreate = ExAllocatePoolWithTag(NonPagedPool, sizeof(CBT_CREATEWNDW), TAG_HOOK);
|
||||||
|
|
||||||
/* Fill the new CREATESTRUCTW */
|
/* Fill the new CREATESTRUCTW */
|
||||||
pCsw->lpCreateParams = Cs->lpCreateParams;
|
RtlCopyMemory(pCsw, Cs, sizeof(CREATESTRUCTW));
|
||||||
pCsw->hInstance = Cs->hInstance;
|
pCsw->style = dwStyle; /* HCBT_CREATEWND needs the real window style */
|
||||||
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;
|
|
||||||
|
|
||||||
// Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes.
|
// Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes.
|
||||||
if (!IS_ATOM(ClassName->Buffer))
|
if (!IS_ATOM(ClassName->Buffer))
|
||||||
|
@ -2060,8 +2052,9 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
}
|
}
|
||||||
|
|
||||||
pCbtCreate->lpcs = pCsw;
|
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);
|
Result = co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) pCbtCreate);
|
||||||
if (Result != 0)
|
if (Result != 0)
|
||||||
{
|
{
|
||||||
|
@ -2074,9 +2067,9 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
Cs->x = pCsw->x;
|
Cs->x = pCsw->x;
|
||||||
Cs->y = pCsw->y;
|
Cs->y = pCsw->y;
|
||||||
hwndInsertAfter = pCbtCreate->hwndInsertAfter;
|
hwndInsertAfter = pCbtCreate->hwndInsertAfter;
|
||||||
|
}
|
||||||
|
|
||||||
/* NCCREATE and WM_NCCALCSIZE need the original values */
|
/* NCCREATE and WM_NCCALCSIZE need the original values */
|
||||||
Cs->style = dwStyle;
|
|
||||||
Cs->lpszName = (LPCWSTR) WindowName;
|
Cs->lpszName = (LPCWSTR) WindowName;
|
||||||
Cs->lpszClass = (LPCWSTR) ClassName;
|
Cs->lpszClass = (LPCWSTR) ClassName;
|
||||||
|
|
||||||
|
@ -2115,7 +2108,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
|
if ((dwStyle & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
|
||||||
IntLinkHwnd(Window, HWND_BOTTOM);
|
IntLinkHwnd(Window, HWND_BOTTOM);
|
||||||
else
|
else
|
||||||
IntLinkHwnd(Window, HWND_TOP);
|
IntLinkHwnd(Window, hwndInsertAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the NCCREATE message */
|
/* Send the NCCREATE message */
|
||||||
|
@ -2219,6 +2212,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
|
||||||
CLEANUP:
|
CLEANUP:
|
||||||
if (!_ret_)
|
if (!_ret_)
|
||||||
{
|
{
|
||||||
|
DPRINT("co_UserCreateWindowEx(): Error Created window!\n");
|
||||||
/* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
|
/* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
|
||||||
if (Window)
|
if (Window)
|
||||||
co_UserDestroyWindow(Window);
|
co_UserDestroyWindow(Window);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue