* Do not reference current thread before sending message to it. It was causing thread to be a ghost if ExitThread was called in WndProc.
* Hold only UserRefObjectCo reference on windows when sending messages to them.

svn path=/trunk/; revision=51527
This commit is contained in:
Rafal Harabien 2011-05-01 13:15:30 +00:00
parent 606747e15c
commit 3fe6ca77a5
2 changed files with 5 additions and 5 deletions

View file

@ -1218,7 +1218,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
RETURN( FALSE); RETURN( FALSE);
} }
ObReferenceObject(Win32Thread->pEThread); //ObReferenceObject(Win32Thread->pEThread);
Result = (ULONG_PTR)co_IntCallWindowProc( Window->lpfnWndProc, Result = (ULONG_PTR)co_IntCallWindowProc( Window->lpfnWndProc,
!Window->Unicode, !Window->Unicode,
hWnd, hWnd,
@ -1231,7 +1231,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
*uResult = Result; *uResult = Result;
} }
ObDereferenceObject(Win32Thread->pEThread); //ObDereferenceObject(Win32Thread->pEThread);
IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
@ -1438,7 +1438,7 @@ co_IntSendMessageWithCallBack( HWND hWnd,
IntCallWndProc( Window, hWnd, Msg, wParam, lParam); IntCallWndProc( Window, hWnd, Msg, wParam, lParam);
ObReferenceObject(Win32Thread->pEThread); //ObReferenceObject(Win32Thread->pEThread);
Result = (ULONG_PTR)co_IntCallWindowProc( Window->lpfnWndProc, Result = (ULONG_PTR)co_IntCallWindowProc( Window->lpfnWndProc,
!Window->Unicode, !Window->Unicode,
hWnd, hWnd,
@ -1450,7 +1450,7 @@ co_IntSendMessageWithCallBack( HWND hWnd,
{ {
*uResult = Result; *uResult = Result;
} }
ObDereferenceObject(Win32Thread->pEThread); //ObDereferenceObject(Win32Thread->pEThread);
IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);

View file

@ -1995,6 +1995,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
hwndInsertAfter = HWND_TOP; hwndInsertAfter = HWND_TOP;
UserRefObjectCo(Window, &Ref); UserRefObjectCo(Window, &Ref);
UserDereferenceObject(Window);
ObDereferenceObject(WinSta); ObDereferenceObject(WinSta);
//// Check for a hook to eliminate overhead. //// //// Check for a hook to eliminate overhead. ////
@ -2260,7 +2261,6 @@ cleanup:
if (Window) if (Window)
{ {
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
UserDereferenceObject(Window);
} }
if (ParentWindow) UserDerefObjectCo(ParentWindow); if (ParentWindow) UserDerefObjectCo(ParentWindow);