Fixed return value of GetTextFaceA.

This commit is contained in:
Alexandre Julliard 2003-05-19 23:24:30 +00:00
parent f39f591877
commit 33c2ad5712
1 changed files with 5 additions and 2 deletions

View File

@ -860,8 +860,11 @@ INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name )
GetTextFaceW( hdc, res, nameW );
if (name)
res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count,
NULL, NULL);
{
if (count && !WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count, NULL, NULL))
name[count-1] = 0;
res = strlen(name);
}
else
res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL);
HeapFree( GetProcessHeap(), 0, nameW );