Commit 374f6ec6 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

riched20: The wParam parameter to WM_GETTEXT contains the number of characters,…

riched20: The wParam parameter to WM_GETTEXT contains the number of characters, not the number of bytes. Fix up some places in the WM_GETTEXT handler where it was assumed that it was a byte count.
parent 39f67279
......@@ -2077,7 +2077,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
else
bufferA = heap_alloc(wParam + 2);
ex.cb = wParam + (unicode ? 2*sizeof(WCHAR) : 2);
ex.cb = (wParam + 2) * (unicode ? sizeof(WCHAR) : sizeof(CHAR));
ex.flags = GT_USECRLF;
ex.codepage = unicode ? 1200 : CP_ACP;
ex.lpDefaultChar = NULL;
......@@ -2086,8 +2086,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
if (unicode)
{
memcpy((LPWSTR)lParam, bufferW, wParam);
if (lstrlenW(bufferW) >= wParam / sizeof(WCHAR)) rc = 0;
memcpy((LPWSTR)lParam, bufferW, wParam * sizeof(WCHAR));
if (lstrlenW(bufferW) >= wParam) rc = 0;
}
else
{
......
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