Modified lstrcpynWtoA to put terminating null at end of string, not
end of buffer.
This commit is contained in:
parent
486dee9072
commit
9fcbc54428
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue