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.
This commit is contained in:
Rob Shearman 2008-01-18 13:23:37 +00:00 committed by Alexandre Julliard
parent 39f672798b
commit 374f6ec616
1 changed files with 3 additions and 3 deletions

View File

@ -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
{