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

win32u: Use user message packing for EM_GETLINE.

parent 1e409563
......@@ -874,16 +874,8 @@ BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam,
case CB_GETDROPPEDCONTROLRECT:
case EM_SETRECT:
case EM_SETRECTNP:
break;
case EM_GETLINE:
{
WORD len;
if (size < sizeof(WORD)) return FALSE;
len = *(WORD *)*buffer;
if (!get_buffer_space( buffer, (len + 1) * sizeof(WCHAR), size )) return FALSE;
*lparam = (LPARAM)*buffer + sizeof(WORD); /* don't erase WORD at start of buffer */
return TRUE;
}
break;
case EM_SETTABSTOPS:
case LB_SETTABSTOPS:
if (!*wparam) return TRUE;
......@@ -1090,6 +1082,7 @@ BOOL WINAPI User32CallWindowProc( struct win_proc_params *params, ULONG size )
case CB_GETDROPPEDCONTROLRECT:
case EM_SETRECT:
case EM_SETRECTNP:
case EM_GETLINE:
{
LRESULT *result_ptr = (LRESULT *)buffer - 1;
*result_ptr = result;
......
......@@ -583,6 +583,17 @@ static BOOL unpack_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lpa
case EM_SETRECTNP:
minsize = sizeof(RECT);
break;
case EM_GETLINE:
{
WORD *len_ptr, len;
if (size < sizeof(WORD)) return FALSE;
len = *(WORD *)*buffer;
if (!get_buffer_space( buffer, (len + 1) * sizeof(WCHAR), size )) return FALSE;
len_ptr = *buffer;
len_ptr[0] = len_ptr[1] = len;
*lparam = (LPARAM)(len_ptr + 1);
return TRUE;
}
case WM_WINE_SETWINDOWPOS:
{
WINDOWPOS wp;
......@@ -1396,6 +1407,9 @@ size_t user_message_size( UINT message, WPARAM wparam, LPARAM lparam, BOOL other
case EM_SETRECTNP:
size = sizeof(RECT);
break;
case EM_GETLINE:
size = max( *(WORD *)lparam * char_size( ansi ), sizeof(WORD) );
break;
}
return size;
......@@ -1461,6 +1475,9 @@ void pack_user_message( void *buffer, size_t size, UINT message,
case EM_GETRECT:
case CB_GETDROPPEDCONTROLRECT:
return;
case EM_GETLINE:
size = sizeof(WORD);
break;
}
if (size) memcpy( buffer, lparam_ptr, size );
......@@ -1556,6 +1573,9 @@ static void copy_user_result( void *buffer, size_t size, LRESULT result, UINT me
case CB_GETDROPPEDCONTROLRECT:
copy_size = sizeof(RECT);
break;
case EM_GETLINE:
copy_size = string_size( buffer, ansi );
break;
default:
return;
}
......@@ -1587,12 +1607,6 @@ static void copy_reply( LRESULT result, HWND hwnd, UINT message, WPARAM wparam,
case WM_MOVING:
copy_size = sizeof(RECT);
break;
case EM_GETLINE:
{
WORD *ptr = (WORD *)lparam;
copy_size = ptr[-1] * sizeof(WCHAR);
break;
}
case LB_GETSELITEMS:
copy_size = wparam * sizeof(UINT);
break;
......
......@@ -1413,6 +1413,14 @@ static void check_params( const struct lparam_hook_test *test, UINT message,
ok( wparam, "wparam = 0\n" );
break;
case EM_GETLINE:
if (!is_ret)
{
WCHAR *buf = (WCHAR *)lparam;
ok(buf[0] == 8, "buf[0] = %x\n", buf[0]);
}
break;
default:
if (test->check_size) {
const void *expected = is_ret && test->change_lparam ? test->change_lparam : test->lparam;
......@@ -1867,6 +1875,16 @@ static void test_wndproc_hook(void)
.lparam_size = sizeof(DWORD), .lparam = &dw_in, .change_lparam = &dw_out,
.check_size = sizeof(DWORD),
},
{
"EM_GETLINE", EM_GETLINE, .msg_result = 5,
.lparam = L"\x8""2345678", .lparam_size = sizeof(strbufW), .change_lparam = L"abc\0defg",
.check_size = sizeof(WCHAR), .check_lparam = L"abc\0""5678",
},
{
"EM_GETLINE-2", EM_GETLINE, .msg_result = 1,
.lparam = L"\x8""2345678", .lparam_size = sizeof(strbufW), .change_lparam = L"abc\0defg",
.check_size = sizeof(WCHAR), .check_lparam = L"abc\0""5678",
},
/* messages that don't change lparam */
{ "WM_USER", WM_USER },
{ "WM_NOTIFY", WM_NOTIFY },
......
......@@ -843,6 +843,7 @@ static size_t packed_result_32to64( UINT message, WPARAM wparam, const void *par
case EM_SETRECTNP:
case LB_GETITEMRECT:
case CB_GETDROPPEDCONTROLRECT:
case EM_GETLINE:
break;
default:
......
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