user32: WM_GETTEXT message converters have to 0-terminate output buffer if there is enough space even if there is no text to convert.
This commit is contained in:
parent
928d28f688
commit
b9eb76dea0
|
@ -856,8 +856,10 @@ LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg,
|
||||||
|
|
||||||
if (!(ptr = get_buffer( buffer, sizeof(buffer), len ))) break;
|
if (!(ptr = get_buffer( buffer, sizeof(buffer), len ))) break;
|
||||||
ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
|
ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
|
||||||
if (*result && wParam)
|
if (wParam)
|
||||||
{
|
{
|
||||||
|
len = 0;
|
||||||
|
if (*result)
|
||||||
RtlUnicodeToMultiByteN( str, wParam - 1, &len, ptr, strlenW(ptr) * sizeof(WCHAR) );
|
RtlUnicodeToMultiByteN( str, wParam - 1, &len, ptr, strlenW(ptr) * sizeof(WCHAR) );
|
||||||
str[len] = 0;
|
str[len] = 0;
|
||||||
*result = len;
|
*result = len;
|
||||||
|
@ -1091,10 +1093,13 @@ static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UIN
|
||||||
|
|
||||||
if (!(ptr = get_buffer( buffer, sizeof(buffer), len ))) break;
|
if (!(ptr = get_buffer( buffer, sizeof(buffer), len ))) break;
|
||||||
ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
|
ret = callback( hwnd, msg, wParam, (LPARAM)ptr, result, arg );
|
||||||
if (*result && len)
|
if (len)
|
||||||
|
{
|
||||||
|
if (*result)
|
||||||
{
|
{
|
||||||
RtlMultiByteToUnicodeN( (LPWSTR)lParam, wParam*sizeof(WCHAR), &len, ptr, strlen(ptr)+1 );
|
RtlMultiByteToUnicodeN( (LPWSTR)lParam, wParam*sizeof(WCHAR), &len, ptr, strlen(ptr)+1 );
|
||||||
*result = len/sizeof(WCHAR) - 1; /* do not count terminating null */
|
*result = len/sizeof(WCHAR) - 1; /* do not count terminating null */
|
||||||
|
}
|
||||||
((LPWSTR)lParam)[*result] = 0;
|
((LPWSTR)lParam)[*result] = 0;
|
||||||
}
|
}
|
||||||
free_buffer( buffer, ptr );
|
free_buffer( buffer, ptr );
|
||||||
|
|
Loading…
Reference in New Issue