Modified lstrcpynWtoA to put terminating null at end of string, not

end of buffer.
This commit is contained in:
Michael McCormack 1999-11-04 01:54:26 +00:00 committed by Alexandre Julliard
parent 486dee9072
commit 9fcbc54428
1 changed files with 7 additions and 1 deletions

View File

@ -437,12 +437,18 @@ LPWSTR WINAPI lstrcpynAtoW( LPWSTR dst, LPCSTR src, INT n )
* lstrcpynWtoA (Not a Windows API)
* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0
*
* The terminating zero should be written at the end of the string, not
* the end of the buffer, as some programs specify the wrong size for
* the buffer (eg. winnt's sol.exe)
*/
LPSTR WINAPI lstrcpynWtoA( LPSTR dst, LPCWSTR src, INT n )
{
if (--n >= 0)
{
CRTDLL_wcstombs( dst, src, n );
n = CRTDLL_wcstombs( dst, src, n );
if(n<0)
n=0;
dst[n] = 0;
}
return dst;