CB_GETTEXT: Use lpBuffer instead of lpText for LB_GETTEXT32, handle 0

byte NULL buffer.
This commit is contained in:
Marcus Meissner 1998-11-22 15:41:00 +00:00 committed by Alexandre Julliard
parent 9dc325629d
commit 21777c59c7
1 changed files with 3 additions and 1 deletions

View File

@ -1001,14 +1001,16 @@ static LRESULT COMBO_GetText( LPHEADCOMBO lphc, UINT32 N, LPSTR lpText)
if( lpBuffer )
{
INT32 n = SendMessage32A( lphc->hWndLBox, LB_GETTEXT32,
(WPARAM32)idx, (LPARAM)lpText );
(WPARAM32)idx, (LPARAM)lpBuffer );
/* truncate if buffer is too short */
if( length >= N )
{
if (N && lpText) {
if( n != LB_ERR ) memcpy( lpText, lpBuffer, (N>n) ? n+1 : N-1 );
lpText[N - 1] = '\0';
}
HeapFree( GetProcessHeap(), 0, lpBuffer );
}
return (LRESULT)n;