Author: mjmartin Date: Thu Apr 29 15:41:32 2010 New Revision: 47059
URL: http://svn.reactos.org/svn/reactos?rev=47059&view=rev Log: [win32k] - Fix a problem where application that used WH_CBT hook procedures were receiving destroy window notification on windows that were never created. The window was never created because the application had returned a non zero value when it was notified of window creation, which effectively destroys the window and returns failure for window creation. See CBTProc Function on MSDN. Fixes bug #4461.
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/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Apr 29 15:41:32 2010 @@ -2468,7 +2468,23 @@
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) {