I spent a week debugging an application only to find out that SendMessageTimeout timed out. These two patches should make it easier to catch such cases in the future.
From: Stefan Dösinger stefan@codeweavers.com
I spent a week debugging an application only to find out that SendMessageTimeout timed out. I think this situation warrants a WARN rather than a TRACE. --- dlls/win32u/message.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 2a824dbdab3..9567e5b125a 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3585,12 +3585,20 @@ static LRESULT retrieve_reply( const struct send_message_info *info,
free( reply_data );
- TRACE( "hwnd %p msg %x (%s) wp %lx lp %lx got reply %lx (err=%d)\n", - info->hwnd, info->msg, debugstr_msg_name(info->msg, info->hwnd), (long)info->wparam, - info->lparam, *result, status ); - /* MSDN states that last error is 0 on timeout, but at least NT4 returns ERROR_TIMEOUT */ - if (status) RtlSetLastWin32Error( RtlNtStatusToDosError(status) ); + if (status) + { + WARN( "hwnd %p msg %x (%s) wp %lx lp %lx got reply %lx (err=%d)\n", + info->hwnd, info->msg, debugstr_msg_name(info->msg, info->hwnd), (long)info->wparam, + info->lparam, *result, status ); + RtlSetLastWin32Error( RtlNtStatusToDosError(status) ); + } + else + { + TRACE( "hwnd %p msg %x (%s) wp %lx lp %lx got reply %lx (err=%d)\n", + info->hwnd, info->msg, debugstr_msg_name(info->msg, info->hwnd), (long)info->wparam, + info->lparam, *result, status ); + } return !status; }
From: Stefan Dösinger stefan@codeweavers.com
Alternatively we could write a FIXME (once or always) if the flag is passed to SMTO, but this feels unnecessary in cases where message replies come on time. --- dlls/win32u/message.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 9567e5b125a..a996227016e 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -4532,6 +4532,10 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa DWORD_PTR res = 0; params->result = send_client_message( hwnd, msg, wparam, lparam, params->flags, params->timeout, &res, ansi ); + if (!params->result && (params->flags & SMTO_NOTIMEOUTIFNOTHUNG)) + { + FIXME( "Timeout and SMTO_NOTIMEOUTIFNOTHUNG is not implemented\n" ); + } return res; }