Commit 73045050 authored by Krzysztof Foltman's avatar Krzysztof Foltman Committed by Alexandre Julliard

Fix CB_GETLBTEXT ANSI-Unicode calls when return value is an error

code.
parent 44cbdf21
...@@ -970,7 +970,12 @@ LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ...@@ -970,7 +970,12 @@ LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
break; break;
case CB_GETLBTEXT: case CB_GETLBTEXT:
if ( WINPROC_TestCBForStr( hwnd )) if ( result < 0) /* CB_ERR and CB_ERRSPACE */
{
LPARAM *ptr = (LPARAM *)lParam - 1;
HeapFree( GetProcessHeap(), 0, ptr );
}
else if ( WINPROC_TestCBForStr( hwnd ))
{ {
LPARAM *ptr = (LPARAM *)lParam - 1; LPARAM *ptr = (LPARAM *)lParam - 1;
result = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1, result = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)lParam, -1,
...@@ -1232,7 +1237,12 @@ static LRESULT WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPA ...@@ -1232,7 +1237,12 @@ static LRESULT WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPA
break; break;
case CB_GETLBTEXT: case CB_GETLBTEXT:
if ( WINPROC_TestCBForStr( hwnd )) if ( result < 0) /* CB_ERR and CB_ERRSPACE */
{
LPARAM *ptr = (LPARAM *)lParam - 1;
HeapFree( GetProcessHeap(), 0, ptr );
}
else if ( WINPROC_TestCBForStr( hwnd ))
{ {
LPARAM *ptr = (LPARAM *)lParam - 1; LPARAM *ptr = (LPARAM *)lParam - 1;
result = MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, (LPWSTR)*ptr, 0x7fffffff ) - 1; result = MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, (LPWSTR)*ptr, 0x7fffffff ) - 1;
......
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