Module: wine Branch: master Commit: 621bcd0db27372166c1ac5f7887b04e2f8b31ada URL: https://gitlab.winehq.org/wine/wine/-/commit/621bcd0db27372166c1ac5f7887b04e...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jan 19 14:28:26 2024 +0100
user32: Return a proper NTSTATUS in the post DDE message callback.
---
dlls/user32/message.c | 21 ++++++--------------- dlls/user32/user_private.h | 4 ++-- dlls/win32u/message.c | 16 +++++++--------- 3 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 07dfbdb0f85..51e908d4dcd 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -333,7 +333,7 @@ static HGLOBAL dde_get_pair(HGLOBAL shm) * * Post a DDE message */ -BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, DWORD type ) +NTSTATUS post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, DWORD type ) { void* ptr = NULL; int size = 0; @@ -344,7 +344,7 @@ BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD ULONGLONG hpack;
if (!UnpackDDElParam( msg, lparam, &uiLo, &uiHi )) - return FALSE; + return STATUS_INVALID_PARAMETER;
lp = lparam; switch (msg) @@ -386,9 +386,9 @@ BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD if ((msg == WM_DDE_ADVISE && size < sizeof(DDEADVISE)) || (msg == WM_DDE_DATA && size < FIELD_OFFSET(DDEDATA, Value)) || (msg == WM_DDE_POKE && size < FIELD_OFFSET(DDEPOKE, Value))) - return FALSE; + return STATUS_INVALID_PARAMETER; } - else if (msg != WM_DDE_DATA) return FALSE; + else if (msg != WM_DDE_DATA) return STATUS_INVALID_PARAMETER;
lp = uiHi; if (uiLo) @@ -428,21 +428,12 @@ BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD req->lparam = lp; req->timeout = TIMEOUT_INFINITE; if (size) wine_server_add_data( req, ptr, size ); - if ((res = wine_server_call( req ))) - { - if (res == STATUS_INVALID_PARAMETER) - /* FIXME: find a STATUS_ value for this one */ - SetLastError( ERROR_INVALID_THREAD_ID ); - else - SetLastError( RtlNtStatusToDosError(res) ); - } - else - FreeDDElParam( msg, lparam ); + if (!(res = wine_server_call( req ))) FreeDDElParam( msg, lparam ); } SERVER_END_REQ; if (hunlock) GlobalUnlock(hunlock);
- return !res; + return res; }
/*********************************************************************** diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 40d67ac468d..102fee69af2 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -45,8 +45,8 @@ struct wm_char_mapping_data
extern HMODULE user32_module;
-extern BOOL post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, - DWORD type ); +extern NTSTATUS post_dde_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, + DWORD type ); extern BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, const void *buffer, size_t size ); extern void free_cached_data( UINT format, HANDLE handle ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 2b6df6cc72c..21d3af8c5fc 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3299,7 +3299,8 @@ static BOOL put_message_in_queue( const struct send_message_info *info, size_t * params.lparam = info->lparam; params.dest_tid = info->dest_tid; params.type = info->type; - return KeUserModeCallback( NtUserPostDDEMessage, ¶ms, sizeof(params), &ret_ptr, &ret_len ); + res = KeUserModeCallback( NtUserPostDDEMessage, ¶ms, sizeof(params), &ret_ptr, &ret_len ); + goto done; }
SERVER_START_REQ( send_message ) @@ -3315,16 +3316,13 @@ static BOOL put_message_in_queue( const struct send_message_info *info, size_t *
if (info->flags & SMTO_ABORTIFHUNG) req->flags |= SEND_MSG_ABORT_IF_HUNG; for (i = 0; i < data.count; i++) wine_server_add_data( req, data.data[i], data.size[i] ); - if ((res = wine_server_call( req ))) - { - if (res == STATUS_INVALID_PARAMETER) - /* FIXME: find a STATUS_ value for this one */ - RtlSetLastWin32Error( ERROR_INVALID_THREAD_ID ); - else - RtlSetLastWin32Error( RtlNtStatusToDosError(res) ); - } + res = wine_server_call( req ); } SERVER_END_REQ; + +done: + if (res == STATUS_INVALID_PARAMETER) res = STATUS_NO_LDT; + if (res) RtlSetLastWin32Error( RtlNtStatusToDosError(res) ); return !res; }