[ros-diffs] [mjmartin] 47073: [win32k] - Revert the hack done in 47059 to apply a better solution. - co_IntCreateWindowEx: Add the WNDS2_WMCREATEMSGPROCESSED flag to state2 member of WND after sending the WM_CREATE message. - By setting this flag it can be examined elsewhere to determine if the window was created successfully. - co_UserDestroyWindow: Examine above mentioned flag to make sure the windows was created before calling hook procedure to inform of destroying window.
mjmartin at svn.reactos.org
mjmartin at svn.reactos.org
Sat May 1 14:02:24 CEST 2010
Author: mjmartin
Date: Sat May 1 14:02:23 2010
New Revision: 47073
URL: http://svn.reactos.org/svn/reactos?rev=47073&view=rev
Log:
[win32k]
- Revert the hack done in 47059 to apply a better solution.
- co_IntCreateWindowEx: Add the WNDS2_WMCREATEMSGPROCESSED flag to state2 member of WND after sending the WM_CREATE message.
- By setting this flag it can be examined elsewhere to determine if the window was created successfully.
- co_UserDestroyWindow: Examine above mentioned flag to make sure the windows was created before calling hook procedure to inform of destroying window.
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/window.c?rev=47073&r1=47072&r2=47073&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Sat May 1 14:02:23 2010
@@ -2333,6 +2333,11 @@
IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window->Wnd, OBJID_WINDOW, 0);
+ /* By setting the flag below it can be examined to determine if the window
+ was created successfully and a valid pwnd was passed back to caller since
+ from here the function has to succeed. */
+ Window->Wnd->state2 |= WNDS2_WMCREATEMSGPROCESSED;
+
/* Send move and size messages. */
if (!(Window->state & WINDOWOBJECT_NEED_SIZE))
{
@@ -2468,23 +2473,7 @@
CLEANUP:
if (!_ret_ && Window && Window->Wnd && ti)
- {
- ULONG SavedHooks;
- /* HACK: co_UserDestroyWindow will call CBT proc with code HCBT_DESTROYWND.
- Applications can choke on this as a hwnd was never returned from this call */
- /* Save the flags */
- SavedHooks = ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->fsHooks;
-
- /* Temporary remove the flag */
- ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->fsHooks &= ~HOOKID_TO_FLAG(WH_CBT);
-
- /* Destroy the window */
co_UserDestroyWindow(Window);
-
- /* Restore the flag */
- ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->fsHooks = SavedHooks;
- }
-
// UserFreeWindowInfo(ti, Window);
if (Window)
{
@@ -2649,8 +2638,8 @@
return FALSE;
}
- /* Call hooks */
- if (ISITHOOKED(WH_CBT))
+ /* If window was created successfully and it is hooked */
+ if ((Wnd->state2 & WNDS2_WMCREATEMSGPROCESSED) && (ISITHOOKED(WH_CBT)))
{
if (co_HOOK_CallHooks(WH_CBT, HCBT_DESTROYWND, (WPARAM) hWnd, 0)) return FALSE;
}
More information about the Ros-diffs
mailing list