Commit e0d62e85 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Always use NtCallbackReturn in User32DrawText.

parent 0aa36a83
...@@ -121,19 +121,13 @@ static NTSTATUS WINAPI User32DrawScrollBar( const struct draw_scroll_bar_params ...@@ -121,19 +121,13 @@ static NTSTATUS WINAPI User32DrawScrollBar( const struct draw_scroll_bar_params
return 0; return 0;
} }
static NTSTATUS WINAPI User32DrawText( const struct draw_text_params *params, ULONG size ) static NTSTATUS WINAPI User32DrawText( struct draw_text_params *params, ULONG size )
{ {
RECT rect = params->rect;
int ret; int ret;
size -= FIELD_OFFSET( struct draw_text_params, str ); size -= FIELD_OFFSET( struct draw_text_params, str );
ret = DrawTextW( params->hdc, params->str, size / sizeof(WCHAR), &rect, params->flags ); ret = DrawTextW( params->hdc, params->str, size / sizeof(WCHAR), &params->rect, params->flags );
if (params->ret_rect) return NtCallbackReturn( &params->rect, sizeof(params->rect), ret );
{
*params->ret_rect = rect;
return ret;
}
return NtCallbackReturn( &rect, sizeof(rect), ret );
} }
static NTSTATUS WINAPI User32ImmProcessKey( const struct imm_process_key_params *params, ULONG size ) static NTSTATUS WINAPI User32ImmProcessKey( const struct imm_process_key_params *params, ULONG size )
......
...@@ -7097,7 +7097,6 @@ INT WINAPI DECLSPEC_HIDDEN DrawTextW( HDC hdc, const WCHAR *str, INT count, RECT ...@@ -7097,7 +7097,6 @@ INT WINAPI DECLSPEC_HIDDEN DrawTextW( HDC hdc, const WCHAR *str, INT count, RECT
if (!(params = malloc( size ))) return 0; if (!(params = malloc( size ))) return 0;
params->hdc = hdc; params->hdc = hdc;
params->rect = *rect; params->rect = *rect;
params->ret_rect = rect;
params->flags = flags; params->flags = flags;
if (count) memcpy( params->str, str, count * sizeof(WCHAR) ); if (count) memcpy( params->str, str, count * sizeof(WCHAR) );
ret = KeUserModeCallback( NtUserDrawText, params, size, &ret_ptr, &ret_len ); ret = KeUserModeCallback( NtUserDrawText, params, size, &ret_ptr, &ret_len );
......
...@@ -312,7 +312,6 @@ struct draw_text_params32 ...@@ -312,7 +312,6 @@ struct draw_text_params32
ULONG hdc; ULONG hdc;
int count; int count;
RECT rect; RECT rect;
ULONG ret_rect;
UINT flags; UINT flags;
WCHAR str[1]; WCHAR str[1];
}; };
...@@ -832,25 +831,18 @@ static NTSTATUS WINAPI wow64_NtUserDrawText( void *arg, ULONG size ) ...@@ -832,25 +831,18 @@ static NTSTATUS WINAPI wow64_NtUserDrawText( void *arg, ULONG size )
{ {
struct draw_text_params *params = arg; struct draw_text_params *params = arg;
struct draw_text_params32 *params32; struct draw_text_params32 *params32;
RECT *rect_ptr = params->ret_rect; ULONG offset = offsetof( struct draw_text_params, str ) - offsetof( struct draw_text_params32, str );
ULONG ret_len; ULONG ret_len;
void *ret_ptr; void *ret_ptr;
NTSTATUS ret; NTSTATUS ret;
params32 = (struct draw_text_params32 *)(params + 1) - 1; params32 = (struct draw_text_params32 *)((char *)params + offset);
params32->flags = params->flags; params32->flags = params->flags;
params32->ret_rect = 0;
params32->rect = params->rect; params32->rect = params->rect;
params32->count = params->count; params32->count = params->count;
params32->hdc = HandleToUlong( params->hdc ); params32->hdc = HandleToUlong( params->hdc );
ret = Wow64KiUserCallbackDispatcher( NtUserDrawText, params32, ret = Wow64KiUserCallbackDispatcher( NtUserDrawText, params32, size - offset, &ret_ptr, &ret_len );
size - sizeof(*params) + sizeof(*params32), &ret_ptr, &ret_len );
if (ret_len == sizeof(RECT) && rect_ptr)
{
*rect_ptr = *(const RECT *)ret_ptr;
return ret;
}
return NtCallbackReturn( ret_ptr, ret_len, ret ); return NtCallbackReturn( ret_ptr, ret_len, ret );
} }
......
...@@ -188,7 +188,6 @@ struct draw_text_params ...@@ -188,7 +188,6 @@ struct draw_text_params
HDC hdc; HDC hdc;
int count; int count;
RECT rect; RECT rect;
RECT *ret_rect; /* FIXME: Use NtCallbackReturn instead */
UINT flags; UINT flags;
WCHAR str[1]; WCHAR str[1];
}; };
......
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