知道了这个函数可能将来不在支持,或者有不安全的成分。
搜了网上,都说是屏蔽掉这个警告。
但是这是掩耳盗铃啊,既然不推荐使用,都没有给出一个替换的函数。
你看看有没有slstrcpyW?,
这个警告是,使用lstrcpyW时错误的拷贝可能产生内存越界, 这个其实不用理会。
https://www.globalyzer.com/gzserver/help/reference/localeSensitiveMethods/winstrsafe.html
Recommended Replacements
Microsoft's strsafe calls and the calls that they replace are listed below. These tables were copied directly from the MSDN site.
strsafe.h character count functions
The following functions use a character count rather than a byte count.
strsafe.h function | Replaces |
StringCchCat, StringCchCatEx |
strcat, wcscat, lstrcat, strcat, StrCatBuff, _tcscat, _ftcscat |
StringCchCatN, StringCchCatNEx |
strncat, StrNCat |
StringCchCopy, StringCchCopyEx |
strcpy, wcscpy, lstrcpy, strcpy, _tcscpy, _ftcscpy |
StringCchCopyN, StringCchCopyNEx |
strncpy |
StringCchGets, StringCchGetsEx |
gets, _getws, _getts |
StringCchPrintf, StringCchPrintfEx |
sprintf, swprintf, wsprintf, wnsprintf, _stprintf, _snprintf, _snwprintf, _sntprintf |
StringCchVPrintf, StringCchVPrintfEx |
vsprintf, vswprintf, wvsprintf, wvnsprintf, _vstprintf, _vsnprintf, _vsnwprintf, _vsntprintf |
StringCchLength |
strlen, lstrlen |
strsafe.h byte count functions
The following functions use a byte count rather than a character count.
strsafe.h function | Replaces |
StringCbCat, StringCbCatEx |
strcat, wcscat, lstrcat, strcat, StrCatBuff, _tcscat, _ftcscat |
StringCbCatN, StringCbCatNEx |
strncat, StrNCat |
StringCbCopy, StringCbCopyEx |
strcpy, wcscpy, lstrcpy, strcpy, _tcscpy, _ftcscpy |
StringCbCopyN, StringCbCopyNEx |
strncpy |
StringCbGets, StringCbGetsEx |
gets, _getws, _getts |
StringCbPrintf, StringCbPrintfEx |
sprintf, swprintf, wsprintf, wnsprintf, _stprintf, _snprintf, _snwprintf, _sntprintf |
StringCbVPrintf, StringCbVPrintfEx |
vsprintf, vswprintf, wvsprintf, wvnsprintf, _vstprintf, _vsnprintf, _vsnwprintf, _vsntprintf |
StringCbLength |
strlen, lstrlen |