Module: wine Branch: master Commit: 374f6ec616567772d87c13f066cd06f03bf893bb URL: http://source.winehq.org/git/wine.git/?a=commit;h=374f6ec616567772d87c13f066...
Author: Rob Shearman rob@codeweavers.com Date: Fri Jan 18 13:23:37 2008 +0000
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.
---
dlls/riched20/editor.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 4e7c820..a954500 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -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 {