Commit 85e351ab authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Return result through NtCallbackReturn for the DDE message callback.

parent 386e9fef
......@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "user_private.h"
#include "controls.h"
#include "imm.h"
......@@ -179,18 +181,17 @@ static BOOL WINAPI User32LoadDriver( const WCHAR *path, ULONG size )
return LoadLibraryW( path ) != NULL;
}
static NTSTATUS WINAPI User32UnpackDDEMessage( const struct unpack_dde_message_params *params, ULONG size )
static NTSTATUS WINAPI User32UnpackDDEMessage( void *args, ULONG size )
{
const struct unpack_dde_message_params *params = args;
struct unpack_dde_message_result result = { .wparam = params->wparam, .lparam = params->lparam };
size -= FIELD_OFFSET( struct unpack_dde_message_params, data );
if (!unpack_dde_message( params->hwnd, params->message, &result.wparam, &result.lparam,
params->data, size ))
return FALSE;
return STATUS_NO_MEMORY;
if (params->result) *params->result = result;
else NtCallbackReturn( &result, sizeof(result), TRUE );
return TRUE;
return NtCallbackReturn( &result, sizeof(result), STATUS_SUCCESS );
}
static const void *kernel_callback_table[NtUserCallCount] =
......
......@@ -2894,27 +2894,27 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags,
}
if (info.msg.message >= WM_DDE_FIRST && info.msg.message <= WM_DDE_LAST)
{
struct unpack_dde_message_result result;
struct unpack_dde_message_result *result;
struct unpack_dde_message_params *params;
void *ret_ptr;
NTSTATUS status;
ULONG len;
BOOL ret;
len = FIELD_OFFSET( struct unpack_dde_message_params, data[size] );
if (!(params = malloc( len )))
continue;
params->result = &result;
params->hwnd = info.msg.hwnd;
params->message = info.msg.message;
params->wparam = info.msg.wParam;
params->lparam = info.msg.lParam;
if (size) memcpy( params->data, buffer, size );
ret = KeUserModeCallback( NtUserUnpackDDEMessage, params, len, &ret_ptr, &len );
if (len == sizeof(result)) result = *(struct unpack_dde_message_result *)ret_ptr;
status = KeUserModeCallback( NtUserUnpackDDEMessage, params, len, (void **)&result, &len );
free( params );
if (!ret) continue; /* ignore it */
info.msg.wParam = result.wparam;
info.msg.lParam = result.lparam;
if (status) continue; /* ignore it */
if (len == sizeof(*result))
{
info.msg.wParam = result->wparam;
info.msg.lParam = result->lparam;
}
}
*msg = info.msg;
msg->pt = point_phys_to_win_dpi( info.msg.hwnd, info.msg.pt );
......
......@@ -399,7 +399,6 @@ struct draw_text_params32
struct unpack_dde_message_params32
{
ULONG result;
ULONG hwnd;
UINT message;
LONG wparam;
......@@ -1395,14 +1394,13 @@ static NTSTATUS WINAPI wow64_NtUserUnpackDDEMessage( void *arg, ULONG size )
LONG wparam;
LONG lparam;
} *result32;
void *ret_ptr;
ULONG ret_len;
NTSTATUS status;
size -= FIELD_OFFSET( struct unpack_dde_message_params, data );
if (!(params32 = Wow64AllocateTemp( FIELD_OFFSET( struct unpack_dde_message_params32, data[size] ))))
return 0;
return STATUS_NO_MEMORY;
params32->result = 0;
params32->hwnd = HandleToUlong( params->hwnd );
params32->message = params->message;
params32->wparam = params->wparam;
......@@ -1410,18 +1408,14 @@ static NTSTATUS WINAPI wow64_NtUserUnpackDDEMessage( void *arg, ULONG size )
if (size) memcpy( params32->data, params->data, size );
size = FIELD_OFFSET( struct unpack_dde_message_params32, data[size] );
if (!Wow64KiUserCallbackDispatcher( NtUserUnpackDDEMessage, params32, size, &ret_ptr, &ret_len ))
return FALSE;
if (ret_len == sizeof(*result32))
status = Wow64KiUserCallbackDispatcher( NtUserUnpackDDEMessage, params32, size, (void **)&result32, &ret_len );
if (!status && ret_len == sizeof(*result32))
{
result32 = ret_ptr;
result.wparam = result32->wparam;
result.lparam = result32->lparam;
return NtCallbackReturn( &result, sizeof(result), status );
}
if (!params->result) NtCallbackReturn( &result, sizeof(result), TRUE );
*params->result = result;
return TRUE;
return status;
}
static NTSTATUS WINAPI wow64_NtUserCallFreeIcon( void *arg, ULONG size )
......
......@@ -262,21 +262,19 @@ struct render_synthesized_format_params
};
/* NtUserUnpackDDEMessage params */
struct unpack_dde_message_result
{
WPARAM wparam;
LPARAM lparam;
};
struct unpack_dde_message_params
{
struct unpack_dde_message_result *result; /* FIXME: Use NtCallbackReturn instead */
HWND hwnd;
UINT message;
WPARAM wparam;
LPARAM lparam;
char data[1];
};
struct unpack_dde_message_result
{
WPARAM wparam;
LPARAM lparam;
};
/* process DPI awareness contexts */
#define NTUSER_DPI_UNAWARE 0x00006010
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment