From b367a6e6283724bf1f5ff296d2c1c2246a9991ee Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 19 May 2003 23:15:21 +0000 Subject: [PATCH] We can't use RtlCreateUnicodeStringFromAsciiz for WM_SETTEXT as the resulting unicode string may be greater than 0xffff bytes. --- windows/winproc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/windows/winproc.c b/windows/winproc.c index d07720614bb..1bb9bb99962 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -594,13 +594,13 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara case LB_DIR: case LB_ADDFILE: case EM_REPLACESEL: - { - UNICODE_STRING usBuffer; - if(!*plparam) return 0; - RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam); - *plparam = (LPARAM)usBuffer.Buffer; - return (*plparam ? 1 : -1); - } + { + DWORD len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*plparam, -1, NULL, 0); + WCHAR *buf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*plparam, -1, buf, len); + *plparam = (LPARAM)buf; + return (*plparam ? 1 : -1); + } case WM_GETTEXTLENGTH: case CB_GETLBTEXTLEN: case LB_GETTEXTLEN: