include: Disallow wcsncpy() in Wine, similarly to strncpy().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-05-04 21:23:01 +02:00
parent 85846bfbf4
commit b35404aa61
4 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include "windef.h"
#include "winbase.h"
#undef strncpy
#undef wcsncpy
extern BOOL sse2_supported DECLSPEC_HIDDEN;

View File

@ -33,6 +33,7 @@
/* make it use a definition from string.h */
#undef strncpy
#undef wcsncpy
#include "winbase.h"
#include "winnls.h"
#include "winuser.h"

View File

@ -241,6 +241,7 @@ int __cdecl wcsncmp( LPCWSTR str1, LPCWSTR str2, size_t n )
/*********************************************************************
* wcsncpy (NTDLL.@)
*/
#undef wcsncpy
LPWSTR __cdecl wcsncpy( LPWSTR s1, LPCWSTR s2, size_t n )
{
WCHAR *ret = s1;

View File

@ -2888,9 +2888,11 @@ static inline LPSTR WINAPI lstrcatA( LPSTR dst, LPCSTR src )
return strcat( dst, src );
}
/* strncpy doesn't do what you think, don't use it */
/* strncpy/wcsncpy don't do what you think, don't use them */
#undef strncpy
#undef wcsncpy
#define strncpy(d,s,n) error do_not_use_strncpy_use_lstrcpynA_or_memcpy_instead
#define wcsncpy(d,s,n) error do_not_use_wcsncpy_use_lstrcpynW_or_memcpy_instead
#endif /* !defined(__WINESRC__) || defined(WINE_NO_INLINE_STRING) */