Prevent DispatchMessage from dispatching a message to a different

thread (reported by Dmitry Timoshkov).
This commit is contained in:
Alexandre Julliard 2004-10-05 22:33:22 +00:00
parent 2f4b33c904
commit 8e68b54787

View file

@ -777,9 +777,14 @@ LONG WINAPI DispatchMessageA( const MSG* msg )
}
if (wndPtr == WND_OTHER_PROCESS)
{
if (IsWindow( msg->hwnd ))
ERR( "cannot dispatch msg to other process window %p\n", msg->hwnd );
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
if (IsWindow( msg->hwnd )) SetLastError( ERROR_MESSAGE_SYNC_ONLY );
else SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0;
}
if (wndPtr->tid != GetCurrentThreadId())
{
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
WIN_ReleasePtr( wndPtr );
return 0;
}
if (!(winproc = wndPtr->winproc))
@ -869,9 +874,14 @@ LONG WINAPI DispatchMessageW( const MSG* msg )
}
if (wndPtr == WND_OTHER_PROCESS)
{
if (IsWindow( msg->hwnd ))
ERR( "cannot dispatch msg to other process window %p\n", msg->hwnd );
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
if (IsWindow( msg->hwnd )) SetLastError( ERROR_MESSAGE_SYNC_ONLY );
else SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return 0;
}
if (wndPtr->tid != GetCurrentThreadId())
{
SetLastError( ERROR_MESSAGE_SYNC_ONLY );
WIN_ReleasePtr( wndPtr );
return 0;
}
if (!(winproc = wndPtr->winproc))