Extracted secure api from tchar.h to sec_api/tchar_s.h



git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@148 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-headers/include/sec_api/tchar_s.h b/mingw-w64-headers/include/sec_api/tchar_s.h
new file mode 100755
index 0000000..343d348
--- /dev/null
+++ b/mingw-w64-headers/include/sec_api/tchar_s.h
@@ -0,0 +1,266 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+#ifndef _INC_TCHAR_S
+#define _INC_TCHAR_S
+
+#include <tchar.h>
+
+#if defined(MINGW_HAS_SECURE_API)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _UNICODE
+
+#define _tprintf_s wprintf_s
+#define _tprintf_s_l _wprintf_s_l
+#define _tcprintf_s _cwprintf_s
+#define _tcprintf_s_l _cwprintf_s_l
+#define _vtcprintf_s _vcwprintf_s
+#define _vtcprintf_s_l _vcwprintf_s_l
+#define _ftprintf_s fwprintf_s
+#define _ftprintf_s_l _fwprintf_s_l
+#define _stprintf_s swprintf_s
+#define _stprintf_s_l _swprintf_s_l
+#define _sntprintf_s _snwprintf_s
+#define _sntprintf_s_l _snwprintf_s_l
+#define _vtprintf_s vwprintf_s
+#define _vtprintf_s_l _vwprintf_s_l
+#define _vftprintf_s vfwprintf_s
+#define _vftprintf_s_l _vfwprintf_s_l
+#define _vstprintf_s vswprintf_s
+#define _vstprintf_s_l _vswprintf_s_l
+#define _vsntprintf_s _vsnwprintf_s
+#define _vsntprintf_s_l _vsnwprintf_s_l
+
+#define _tscanf_s wscanf_s
+#define _tscanf_s_l _wscanf_s_l
+#define _tcscanf_s _cwscanf_s
+#define _tcscanf_s_l _cwscanf_s_l
+#define _ftscanf_s fwscanf_s
+#define _ftscanf_s_l _fwscanf_s_l
+#define _stscanf_s swscanf_s
+#define _stscanf_s_l _swscanf_s_l
+#define _sntscanf_s _snwscanf_s
+#define _sntscanf_s_l _snwscanf_s_l
+
+#define _cgetts_s _cgetws_s
+#define _getts_s _getws_s
+
+#define _itot_s _itow_s
+#define _ltot_s _ltow_s
+#define _ultot_s _ultow_s
+#define _i64tot_s _i64tow_s
+#define _ui64tot_s _ui64tow_s
+
+#define _tcscat_s wcscat_s
+#define _tcscpy_s wcscpy_s
+#define _tcsncat_s wcsncat_s
+#define _tcsncat_s_l _wcsncat_s_l
+#define _tcsncpy_s wcsncpy_s
+#define _tcsncpy_s_l _wcsncpy_s_l
+#define _tcstok_s wcstok_s
+#define _tcstok_s_l _wcstok_s_l
+#define _tcserror_s _wcserror_s
+#define __tcserror_s __wcserror_s
+
+#define _tcsnset_s _wcsnset_s
+#define _tcsnset_s_l _wcsnset_s_l
+#define _tcsset_s _wcsset_s
+#define _tcsset_s_l _wcsset_s_l
+
+#define _tasctime_s _wasctime_s
+#define _tctime_s _wctime_s
+#define _tctime32_s _wctime32_s
+#define _tctime64_s _wctime64_s
+#define _tstrdate_s _wstrdate_s
+#define _tstrtime_s _wstrtime_s
+
+#define _tgetenv_s _wgetenv_s
+#define _tdupenv_s _wdupenv_s
+#define _tmakepath_s _wmakepath_s
+#define _tputenv_s _wputenv_s
+#define _tsearchenv_s _wsearchenv_s
+#define _tsplitpath_s _wsplitpath_s
+
+#define _tfopen_s _wfopen_s
+#define _tfreopen_s _wfreopen_s
+#define _ttmpnam_s _wtmpnam_s
+#define _taccess_s _waccess_s
+#define _tmktemp_s _wmktemp_s
+
+#define _tcsnccat_s wcsncat_s
+#define _tcsnccat_s_l _wcsncat_s_l
+#define _tcsnccpy_s wcsncpy_s
+#define _tcsnccpy_s_l _wcsncpy_s_l
+
+#define _tcslwr_s _wcslwr_s
+#define _tcslwr_s_l _wcslwr_s_l
+#define _tcsupr_s _wcsupr_s
+#define _tcsupr_s_l _wcsupr_s_l
+
+#define _wcstok_s_l(_String,_Delimiters,_Current_position,_Locale) (wcstok_s(_String,_Delimiters,_Current_position))
+#define _wcsnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_wcsnset_s(_Destination,_Destination_size_chars,_Value,_Count))
+#define _wcsset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_wcsset_s(_Destination,_Destination_size_chars,_Value))
+
+#else
+
+#define _tprintf_s printf_s
+#define _tprintf_s_l _printf_s_l
+#define _tcprintf_s _cprintf_s
+#define _tcprintf_s_l _cprintf_s_l
+#define _vtcprintf_s _vcprintf_s
+#define _vtcprintf_s_l _vcprintf_s_l
+#define _ftprintf_s fprintf_s
+#define _ftprintf_s_l _fprintf_s_l
+#define _stprintf_s sprintf_s
+#define _stprintf_s_l _sprintf_s_l
+#define _sntprintf_s _snprintf_s
+#define _sntprintf_s_l _snprintf_s_l
+#define _vtprintf_s vprintf_s
+#define _vtprintf_s_l _vprintf_s_l
+#define _vftprintf_s vfprintf_s
+#define _vftprintf_s_l _vfprintf_s_l
+#define _vstprintf_s vsprintf_s
+#define _vstprintf_s_l _vsprintf_s_l
+#define _vsntprintf_s _vsnprintf_s
+#define _vsntprintf_s_l _vsnprintf_s_l
+#define _tscanf_s scanf_s
+#define _tscanf_s_l _scanf_s_l
+#define _tcscanf_s _cscanf_s
+#define _tcscanf_s_l _cscanf_s_l
+#define _ftscanf_s fscanf_s
+#define _ftscanf_s_l _fscanf_s_l
+#define _stscanf_s sscanf_s
+#define _stscanf_s_l _sscanf_s_l
+#define _sntscanf_s _snscanf_s
+#define _sntscanf_s_l _snscanf_s_l
+
+#define _getts_s gets_s
+#define _cgetts_s _cgets_s
+#define _itot_s _itoa_s
+#define _ltot_s _ltoa_s
+#define _ultot_s _ultoa_s
+#define _i64tot_s _i64toa_s
+#define _ui64tot_s _ui64toa_s
+
+#define _tcscat_s strcat_s
+#define _tcscpy_s strcpy_s
+#define _tcserror_s strerror_s
+#define __tcserror_s _strerror_s
+
+#define _tasctime_s asctime_s
+#define _tctime_s ctime_s
+#define _tctime32_s _ctime32_s
+#define _tctime64_s _ctime64_s
+#define _tstrdate_s _strdate_s
+#define _tstrtime_s _strtime_s
+
+#define _tgetenv_s getenv_s
+#define _tdupenv_s _dupenv_s
+#define _tmakepath_s _makepath_s
+#define _tputenv_s _putenv_s
+#define _tsearchenv_s _searchenv_s
+#define _tsplitpath_s _splitpath_s
+
+#define _tfopen_s fopen_s
+#define _tfreopen_s freopen_s
+#define _ttmpnam_s tmpnam_s
+#define _tmktemp_s _mktemp_s
+
+#ifndef _POSIX_
+#define _taccess_s _access_s
+#endif
+
+#define _tsopen_s _sopen_s
+
+#ifdef _MBCS
+
+#ifdef _MB_MAP_DIRECT
+
+#define _tcsncat_s _mbsnbcat_s
+#define _tcsncat_s_l _mbsnbcat_s_l
+#define _tcsncpy_s _mbsnbcpy_s
+#define _tcsncpy_s_l _mbsnbcpy_s_l
+#define _tcstok_s _mbstok_s
+#define _tcstok_s_l _mbstok_s_l
+
+#define _tcsnset_s _mbsnbset_s
+#define _tcsnset_s_l _mbsnbset_s_l
+#define _tcsset_s _mbsset_s
+#define _tcsset_s_l _mbsset_s_l
+
+#define _tcsnccat_s _mbsncat_s
+#define _tcsnccat_s_l _mbsncat_s_l
+#define _tcsnccpy_s _mbsncpy_s
+#define _tcsnccpy_s_l _mbsncpy_s_l
+#define _tcsncset_s _mbsnset_s
+#define _tcsncset_s_l _mbsnset_s_l
+
+#define _tcslwr_s _mbslwr_s
+#define _tcslwr_s_l _mbslwr_s_l
+#define _tcsupr_s _mbsupr_s
+#define _tcsupr_s_l _mbsupr_s_l
+
+#define _tccpy_s _mbccpy_s
+#define _tccpy_s_l _mbccpy_s_l
+#else
+
+  _CRTIMP char *__cdecl _tcsncat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
+  _CRTIMP char *__cdecl _tcsncat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
+  _CRTIMP char *__cdecl _tcsncpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
+  _CRTIMP char *__cdecl _tcsncpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
+  _CRTIMP char *__cdecl _tcstok_s(char *_Str,const char *_Delim,char **_Context);
+  _CRTIMP char *__cdecl _tcstok_s_l(char *_Str,const char *_Delim,char **_Context,_locale_t _Locale);
+  _CRTIMP errno_t __cdecl _tcsset_s(char *_Str,size_t _SizeInChars,unsigned int _Val);
+  _CRTIMP errno_t __cdecl _tcsset_s_l(char *_Str,size_t _SizeInChars,unsigned int,_locale_t _Locale);
+  _CRTIMP char *__cdecl _tcsnccat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
+  _CRTIMP char *__cdecl _tcsnccat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
+  _CRTIMP char *__cdecl _tcsnccpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
+  _CRTIMP char *__cdecl _tcsnccpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
+  _CRTIMP char *__cdecl _tcslwr_s(char *_Str,size_t _SizeInChars);
+  _CRTIMP char *__cdecl _tcslwr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale);
+  _CRTIMP char *__cdecl _tcsupr_s(char *_Str,size_t _SizeInChars);
+  _CRTIMP char *__cdecl _tcsupr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale);
+
+#endif
+
+#else
+
+#define _tcsncat_s strncat_s
+#define _tcsncat_s_l _strncat_s_l
+#define _tcsncpy_s strncpy_s
+#define _tcsncpy_s_l _strncpy_s_l
+#define _tcstok_s strtok_s
+#define _tcstok_s_l _strtok_s_l
+
+#define _tcsnset_s _strnset_s
+#define _tcsnset_s_l _strnset_s_l
+#define _tcsset_s _strset_s
+#define _tcsset_s _strset_s
+#define _tcsset_s_l _strset_s_l
+
+#define _tcsnccat_s strncat_s
+#define _tcsnccat_s_l _strncat_s_l
+#define _tcsnccpy_s strncpy_s
+#define _tcsnccpy_s_l _strncpy_s_l
+
+#define _tcslwr_s _strlwr_s
+#define _tcslwr_s_l _strlwr_s_l
+#define _tcsupr_s _strupr_s
+#define _tcsupr_s_l _strupr_s_l
+
+#define _strnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_strnset_s(_Destination,_Destination_size_chars,_Value,_Count))
+#define _strset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_strset_s(_Destination,_Destination_size_chars,_Value))
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+#endif
diff --git a/mingw-w64-headers/include/tchar.h b/mingw-w64-headers/include/tchar.h
index 05df34d..8f542ba 100755
--- a/mingw-w64-headers/include/tchar.h
+++ b/mingw-w64-headers/include/tchar.h
@@ -124,32 +124,22 @@
 
 #define _tprintf wprintf
 #define _tprintf_l _wprintf_l
-#define _tprintf_s wprintf_s
-#define _tprintf_s_l _wprintf_s_l
 #define _tprintf_p _wprintf_p
 #define _tprintf_p_l _wprintf_p_l
 #define _tcprintf _cwprintf
 #define _tcprintf_l _cwprintf_l
-#define _tcprintf_s _cwprintf_s
-#define _tcprintf_s_l _cwprintf_s_l
 #define _tcprintf_p _cwprintf_p
 #define _tcprintf_p_l _cwprintf_p_l
 #define _vtcprintf _vcwprintf
 #define _vtcprintf_l _vcwprintf_l
-#define _vtcprintf_s _vcwprintf_s
-#define _vtcprintf_s_l _vcwprintf_s_l
 #define _vtcprintf_p _vcwprintf_p
 #define _vtcprintf_p_l _vcwprintf_p_l
 #define _ftprintf fwprintf
 #define _ftprintf_l _fwprintf_l
-#define _ftprintf_s fwprintf_s
-#define _ftprintf_s_l _fwprintf_s_l
 #define _ftprintf_p _fwprintf_p
 #define _ftprintf_p_l _fwprintf_p_l
 #define _stprintf _swprintf
 #define _stprintf_l __swprintf_l
-#define _stprintf_s swprintf_s
-#define _stprintf_s_l _swprintf_s_l
 #define _stprintf_p _swprintf_p
 #define _stprintf_p_l _swprintf_p_l
 #define _sctprintf _scwprintf
@@ -158,24 +148,16 @@
 #define _sctprintf_p_l _scwprintf_p_l
 #define _sntprintf _snwprintf
 #define _sntprintf_l _snwprintf_l
-#define _sntprintf_s _snwprintf_s
-#define _sntprintf_s_l _snwprintf_s_l
 #define _vtprintf vwprintf
 #define _vtprintf_l _vwprintf_l
-#define _vtprintf_s vwprintf_s
-#define _vtprintf_s_l _vwprintf_s_l
 #define _vtprintf_p _vwprintf_p
 #define _vtprintf_p_l _vwprintf_p_l
 #define _vftprintf vfwprintf
 #define _vftprintf_l _vfwprintf_l
-#define _vftprintf_s vfwprintf_s
-#define _vftprintf_s_l _vfwprintf_s_l
 #define _vftprintf_p _vfwprintf_p
 #define _vftprintf_p_l _vfwprintf_p_l
 #define _vstprintf _vswprintf
 #define _vstprintf_l _vswprintf_l
-#define _vstprintf_s vswprintf_s
-#define _vstprintf_s_l _vswprintf_s_l
 #define _vstprintf_p _vswprintf_p
 #define _vstprintf_p_l _vswprintf_p_l
 #define _vsctprintf _vscwprintf
@@ -184,29 +166,17 @@
 #define _vsctprintf_p_l _vscwprintf_p_l
 #define _vsntprintf _vsnwprintf
 #define _vsntprintf_l _vsnwprintf_l
-#define _vsntprintf_s _vsnwprintf_s
-#define _vsntprintf_s_l _vsnwprintf_s_l
 
 #define _tscanf wscanf
 #define _tscanf_l _wscanf_l
-#define _tscanf_s wscanf_s
-#define _tscanf_s_l _wscanf_s_l
 #define _tcscanf _cwscanf
 #define _tcscanf_l _cwscanf_l
-#define _tcscanf_s _cwscanf_s
-#define _tcscanf_s_l _cwscanf_s_l
 #define _ftscanf fwscanf
 #define _ftscanf_l _fwscanf_l
-#define _ftscanf_s fwscanf_s
-#define _ftscanf_s_l _fwscanf_s_l
 #define _stscanf swscanf
 #define _stscanf_l _swscanf_l
-#define _stscanf_s swscanf_s
-#define _stscanf_s_l _swscanf_s_l
 #define _sntscanf _snwscanf
 #define _sntscanf_l _snwscanf_l
-#define _sntscanf_s _snwscanf_s
-#define _sntscanf_s_l _snwscanf_s_l
 
 #define _fgettc fgetwc
 #define _fgettc_nolock _fgetwc_nolock
@@ -218,7 +188,6 @@
 #define _fputts fputws
 #define _cputts _cputws
 #define _cgetts _cgetws
-#define _cgetts_s _cgetws_s
 #define _gettc getwc
 #define _gettc_nolock _getwc_nolock
 #define _gettch _getwch
@@ -228,7 +197,6 @@
 #define _gettchar getwchar
 #define _gettchar_nolock _getwchar_nolock
 #define _getts _getws
-#define _getts_s _getws_s
 #define _puttc putwc
 #define _puttc_nolock _putwc_nolock
 #define _puttchar putwchar
@@ -260,9 +228,6 @@
 #define _tstoi_l _wtoi_l
 #define _tstoi64_l _wtoi64_l
 
-#define _itot_s _itow_s
-#define _ltot_s _ltow_s
-#define _ultot_s _ultow_s
 #define _itot _itow
 #define _ltot _ltow
 #define _ultot _ultow
@@ -270,50 +235,34 @@
 #define _ttol _wtol
 
 #define _ttoi64 _wtoi64
-#define _i64tot_s _i64tow_s
-#define _ui64tot_s _ui64tow_s
 #define _i64tot _i64tow
 #define _ui64tot _ui64tow
 
 #define _tcscat wcscat
-#define _tcscat_s wcscat_s
 #define _tcschr wcschr
 #define _tcscpy wcscpy
-#define _tcscpy_s wcscpy_s
 #define _tcscspn wcscspn
 #define _tcslen wcslen
 #define _tcsnlen wcsnlen
 #define _tcsncat wcsncat
-#define _tcsncat_s wcsncat_s
 #define _tcsncat_l _wcsncat_l
-#define _tcsncat_s_l _wcsncat_s_l
 #define _tcsncpy wcsncpy
-#define _tcsncpy_s wcsncpy_s
 #define _tcsncpy_l _wcsncpy_l
-#define _tcsncpy_s_l _wcsncpy_s_l
 #define _tcspbrk wcspbrk
 #define _tcsrchr wcsrchr
 #define _tcsspn wcsspn
 #define _tcsstr wcsstr
 #define _tcstok wcstok
-#define _tcstok_s wcstok_s
 #define _tcstok_l _wcstok_l
-#define _tcstok_s_l _wcstok_s_l
 #define _tcserror _wcserror
-#define _tcserror_s _wcserror_s
 #define __tcserror __wcserror
-#define __tcserror_s __wcserror_s
 
 #define _tcsdup _wcsdup
 #define _tcsnset _wcsnset
-#define _tcsnset_s _wcsnset_s
 #define _tcsnset_l _wcsnset_l
-#define _tcsnset_s_l _wcsnset_s_l
 #define _tcsrev _wcsrev
 #define _tcsset _wcsset
-#define _tcsset_s _wcsset_s
 #define _tcsset_l _wcsset_l
-#define _tcsset_s_l _wcsset_s_l
 
 #define _tcscmp wcscmp
 #define _tcsicmp _wcsicmp
@@ -371,13 +320,6 @@
 #define _tcsftime wcsftime
 #define _tcsftime_l _wcsftime_l
 
-#define _tasctime_s _wasctime_s
-#define _tctime_s _wctime_s
-#define _tctime32_s _wctime32_s
-#define _tctime64_s _wctime64_s
-#define _tstrdate_s _wstrdate_s
-#define _tstrtime_s _wstrtime_s
-
 #define _tchdir _wchdir
 #define _tgetcwd _wgetcwd
 #define _tgetdcwd _wgetdcwd
@@ -387,33 +329,23 @@
 
 #define _tfullpath _wfullpath
 #define _tgetenv _wgetenv
-#define _tgetenv_s _wgetenv_s
-#define _tdupenv_s _wdupenv_s
 #define _tmakepath _wmakepath
-#define _tmakepath_s _wmakepath_s
 #define _tpgmptr _wpgmptr
 #define _get_tpgmptr _get_wpgmptr
 #define _tputenv _wputenv
-#define _tputenv_s _wputenv_s
 #define _tsearchenv _wsearchenv
-#define _tsearchenv_s _wsearchenv_s
 #define _tsplitpath _wsplitpath
-#define _tsplitpath_s _wsplitpath_s
 
 #define _tfdopen _wfdopen
 #define _tfsopen _wfsopen
 #define _tfopen _wfopen
-#define _tfopen_s _wfopen_s
 #define _tfreopen _wfreopen
-#define _tfreopen_s _wfreopen_s
 #define _tperror _wperror
 #define _tpopen _wpopen
 #define _ttempnam _wtempnam
 #define _ttmpnam _wtmpnam
-#define _ttmpnam_s _wtmpnam_s
 
 #define _taccess _waccess
-#define _taccess_s _waccess_s
 #define _tchmod _wchmod
 #define _tcreat _wcreat
 #define _tfindfirst _wfindfirst
@@ -429,12 +361,10 @@
 #define _tfindnext32i64 _wfindnext32i64
 #define _tfindnext64i32 _wfindnext64i32
 #define _tmktemp _wmktemp
-#define _tmktemp_s _wmktemp_s
 #define _topen _wopen
 #define _tremove _wremove
 #define _trename _wrename
 #define _tsopen _wsopen
-#define _tsopen_s _wsopen_s
 #define _tunlink _wunlink
 
 #define _tfinddata_t _wfinddata_t
@@ -458,13 +388,9 @@
 #define _tcsclen_l(_String,_Locale) wcslen(_String)
 #define _tcscnlen_l(_String,_Max_count,_Locale) wcsnlen_l((_String),(_Max_count))
 #define _tcsnccat wcsncat
-#define _tcsnccat_s wcsncat_s
 #define _tcsnccat_l _wcsncat_l
-#define _tcsnccat_s_l _wcsncat_s_l
 #define _tcsnccpy wcsncpy
-#define _tcsnccpy_s wcsncpy_s
 #define _tcsnccpy_l _wcsncpy_l
-#define _tcsnccpy_s_l _wcsncpy_s_l
 #define _tcsncset _wcsnset
 
 #define _tcsdec _wcsdec
@@ -477,12 +403,8 @@
 
 #define _tcslwr _wcslwr
 #define _tcslwr_l _wcslwr_l
-#define _tcslwr_s _wcslwr_s
-#define _tcslwr_s_l _wcslwr_s_l
 #define _tcsupr _wcsupr
 #define _tcsupr_l _wcsupr_l
-#define _tcsupr_s _wcsupr_s
-#define _tcsupr_s_l _wcsupr_s_l
 #define _tcsxfrm wcsxfrm
 #define _tcsxfrm_l _wcsxfrm_l
 
@@ -534,11 +456,8 @@
 #define _wcsncpy_l(_Destination,_Source,_Count,_Locale) (wcsncpy(_Destination,_Source,_Count))
 #define _wcsncat_l(_Destination,_Source,_Count,_Locale) (wcsncat(_Destination,_Source,_Count))
 #define _wcstok_l(_String,_Delimiters,_Locale) (wcstok(_String,_Delimiters))
-#define _wcstok_s_l(_String,_Delimiters,_Current_position,_Locale) (wcstok_s(_String,_Delimiters,_Current_position))
 #define _wcsnset_l(_Destination,_Value,_Count,_Locale) (_wcsnset(_Destination,_Value,_Count))
-#define _wcsnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_wcsnset_s(_Destination,_Destination_size_chars,_Value,_Count))
 #define _wcsset_l(_Destination,_Value,_Locale) (_wcsset(_Destination,_Value))
-#define _wcsset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_wcsset_s(_Destination,_Destination_size_chars,_Value))
 
   /* dirent structures and functions */
 #define _tdirent	_wdirent
@@ -577,32 +496,22 @@
 
 #define _tprintf printf
 #define _tprintf_l _printf_l
-#define _tprintf_s printf_s
-#define _tprintf_s_l _printf_s_l
 #define _tprintf_p _printf_p
 #define _tprintf_p_l _printf_p_l
 #define _tcprintf _cprintf
 #define _tcprintf_l _cprintf_l
-#define _tcprintf_s _cprintf_s
-#define _tcprintf_s_l _cprintf_s_l
 #define _tcprintf_p _cprintf_p
 #define _tcprintf_p_l _cprintf_p_l
 #define _vtcprintf _vcprintf
 #define _vtcprintf_l _vcprintf_l
-#define _vtcprintf_s _vcprintf_s
-#define _vtcprintf_s_l _vcprintf_s_l
 #define _vtcprintf_p _vcprintf_p
 #define _vtcprintf_p_l _vcprintf_p_l
 #define _ftprintf fprintf
 #define _ftprintf_l _fprintf_l
-#define _ftprintf_s fprintf_s
-#define _ftprintf_s_l _fprintf_s_l
 #define _ftprintf_p _fprintf_p
 #define _ftprintf_p_l _fprintf_p_l
 #define _stprintf sprintf
 #define _stprintf_l _sprintf_l
-#define _stprintf_s sprintf_s
-#define _stprintf_s_l _sprintf_s_l
 #define _stprintf_p _sprintf_p
 #define _stprintf_p_l _sprintf_p_l
 #define _sctprintf _scprintf
@@ -611,24 +520,16 @@
 #define _sctprintf_p_l _scprintf_p_l
 #define _sntprintf _snprintf
 #define _sntprintf_l _snprintf_l
-#define _sntprintf_s _snprintf_s
-#define _sntprintf_s_l _snprintf_s_l
 #define _vtprintf vprintf
 #define _vtprintf_l _vprintf_l
-#define _vtprintf_s vprintf_s
-#define _vtprintf_s_l _vprintf_s_l
 #define _vtprintf_p _vprintf_p
 #define _vtprintf_p_l _vprintf_p_l
 #define _vftprintf vfprintf
 #define _vftprintf_l _vfprintf_l
-#define _vftprintf_s vfprintf_s
-#define _vftprintf_s_l _vfprintf_s_l
 #define _vftprintf_p _vfprintf_p
 #define _vftprintf_p_l _vfprintf_p_l
 #define _vstprintf vsprintf
 #define _vstprintf_l _vsprintf_l
-#define _vstprintf_s vsprintf_s
-#define _vstprintf_s_l _vsprintf_s_l
 #define _vstprintf_p _vsprintf_p
 #define _vstprintf_p_l _vsprintf_p_l
 #define _vsctprintf _vscprintf
@@ -637,29 +538,17 @@
 #define _vsctprintf_p_l _vscprintf_p_l
 #define _vsntprintf _vsnprintf
 #define _vsntprintf_l _vsnprintf_l
-#define _vsntprintf_s _vsnprintf_s
-#define _vsntprintf_s_l _vsnprintf_s_l
 
 #define _tscanf scanf
 #define _tscanf_l _scanf_l
-#define _tscanf_s scanf_s
-#define _tscanf_s_l _scanf_s_l
 #define _tcscanf _cscanf
 #define _tcscanf_l _cscanf_l
-#define _tcscanf_s _cscanf_s
-#define _tcscanf_s_l _cscanf_s_l
 #define _ftscanf fscanf
 #define _ftscanf_l _fscanf_l
-#define _ftscanf_s fscanf_s
-#define _ftscanf_s_l _fscanf_s_l
 #define _stscanf sscanf
 #define _stscanf_l _sscanf_l
-#define _stscanf_s sscanf_s
-#define _stscanf_s_l _sscanf_s_l
 #define _sntscanf _snscanf
 #define _sntscanf_l _snscanf_l
-#define _sntscanf_s _snscanf_s
-#define _sntscanf_s_l _snscanf_s_l
 
 #define _fgettc fgetc
 #define _fgettc_nolock _fgetc_nolock
@@ -679,9 +568,7 @@
 #define _gettchar getchar
 #define _gettchar_nolock _getchar_nolock
 #define _getts gets
-#define _getts_s gets_s
 #define _cgetts _cgets
-#define _cgetts_s _cgets_s
 #define _puttc putc
 #define _puttc_nolock _putc_nolock
 #define _puttchar putchar
@@ -709,9 +596,6 @@
 #define _tstoi_l _atoi_l
 #define _tstoi64_l _atoi64_l
 
-#define _itot_s _itoa_s
-#define _ltot_s _ltoa_s
-#define _ultot_s _ultoa_s
 #define _itot _itoa
 #define _ltot _ltoa
 #define _ultot _ultoa
@@ -723,24 +607,18 @@
 #define _tcstoi64_l _strtoi64_l
 #define _tcstoui64 _strtoui64
 #define _tcstoui64_l _strtoui64_l
-#define _i64tot_s _i64toa_s
-#define _ui64tot_s _ui64toa_s
 #define _i64tot _i64toa
 #define _ui64tot _ui64toa
 
 #define _tcscat strcat
-#define _tcscat_s strcat_s
 #define _tcscpy strcpy
-#define _tcscpy_s strcpy_s
 #define _tcsdup _strdup
 #define _tcslen strlen
 #define _tcsnlen strnlen
 #define _tcsxfrm strxfrm
 #define _tcsxfrm_l _strxfrm_l
 #define _tcserror strerror
-#define _tcserror_s strerror_s
 #define __tcserror _strerror
-#define __tcserror_s _strerror_s
 
 #define _texecl _execl
 #define _texecle _execle
@@ -774,13 +652,6 @@
 #define _tcsftime strftime
 #define _tcsftime_l _strftime_l
 
-#define _tasctime_s asctime_s
-#define _tctime_s ctime_s
-#define _tctime32_s _ctime32_s
-#define _tctime64_s _ctime64_s
-#define _tstrdate_s _strdate_s
-#define _tstrtime_s _strtime_s
-
 #define _tchdir _chdir
 #define _tgetcwd _getcwd
 #define _tgetdcwd _getdcwd
@@ -790,18 +661,12 @@
 
 #define _tfullpath _fullpath
 #define _tgetenv getenv
-#define _tgetenv_s getenv_s
-#define _tdupenv_s _dupenv_s
 #define _tmakepath _makepath
-#define _tmakepath_s _makepath_s
 #define _tpgmptr _pgmptr
 #define _get_tpgmptr _get_pgmptr
 #define _tputenv _putenv
-#define _tputenv_s _putenv_s
 #define _tsearchenv _searchenv
-#define _tsearchenv_s _searchenv_s
 #define _tsplitpath _splitpath
-#define _tsplitpath_s _splitpath_s
 
 #ifdef _POSIX_
 #define _tfdopen fdopen
@@ -810,14 +675,11 @@
 #endif
 #define _tfsopen _fsopen
 #define _tfopen fopen
-#define _tfopen_s fopen_s
 #define _tfreopen freopen
-#define _tfreopen_s freopen_s
 #define _tperror perror
 #define _tpopen _popen
 #define _ttempnam _tempnam
 #define _ttmpnam tmpnam
-#define _ttmpnam_s tmpnam_s
 
 #define _tchmod _chmod
 #define _tcreat _creat
@@ -834,7 +696,6 @@
 #define _tfindnext32i64 _findnext32i64
 #define _tfindnext64i32 _findnext64i32
 #define _tmktemp _mktemp
-#define _tmktemp_s _mktemp_s
 
 #ifdef _POSIX_
 #define _topen open
@@ -842,13 +703,11 @@
 #else
 #define _topen _open
 #define _taccess _access
-#define _taccess_s _access_s
 #endif
 
 #define _tremove remove
 #define _trename rename
 #define _tsopen _sopen
-#define _tsopen_s _sopen_s
 #define _tunlink _unlink
 
 #define _tfinddata_t _finddata_t
@@ -906,31 +765,21 @@
 #define _tcschr _mbschr
 #define _tcscspn _mbscspn
 #define _tcsncat _mbsnbcat
-#define _tcsncat_s _mbsnbcat_s
 #define _tcsncat_l _mbsnbcat_l
-#define _tcsncat_s_l _mbsnbcat_s_l
 #define _tcsncpy _mbsnbcpy
-#define _tcsncpy_s _mbsnbcpy_s
 #define _tcsncpy_l _mbsnbcpy_l
-#define _tcsncpy_s_l _mbsnbcpy_s_l
 #define _tcspbrk _mbspbrk
 #define _tcsrchr _mbsrchr
 #define _tcsspn _mbsspn
 #define _tcsstr _mbsstr
 #define _tcstok _mbstok
-#define _tcstok_s _mbstok_s
 #define _tcstok_l _mbstok_l
-#define _tcstok_s_l _mbstok_s_l
 
 #define _tcsnset _mbsnbset
 #define _tcsnset_l _mbsnbset_l
-#define _tcsnset_s _mbsnbset_s
-#define _tcsnset_s_l _mbsnbset_s_l
 #define _tcsrev _mbsrev
 #define _tcsset _mbsset
-#define _tcsset_s _mbsset_s
 #define _tcsset_l _mbsset_l
-#define _tcsset_s_l _mbsset_s_l
 
 #define _tcscmp _mbscmp
 #define _tcsicmp _mbsicmp
@@ -960,17 +809,11 @@
 #define _tcsclen_l _mbslen_l
 #define _tcscnlen_l _mbsnlen_l
 #define _tcsnccat _mbsncat
-#define _tcsnccat_s _mbsncat_s
 #define _tcsnccat_l _mbsncat_l
-#define _tcsnccat_s_l _mbsncat_s_l
 #define _tcsnccpy _mbsncpy
-#define _tcsnccpy_s _mbsncpy_s
 #define _tcsnccpy_l _mbsncpy_l
-#define _tcsnccpy_s_l _mbsncpy_s_l
 #define _tcsncset _mbsnset
-#define _tcsncset_s _mbsnset_s
 #define _tcsncset_l _mbsnset_l
-#define _tcsncset_s_l _mbsnset_s_l
 
 #define _tcsdec _mbsdec
 #define _tcsinc _mbsinc
@@ -982,44 +825,30 @@
 
 #define _tcslwr _mbslwr
 #define _tcslwr_l _mbslwr_l
-#define _tcslwr_s _mbslwr_s
-#define _tcslwr_s_l _mbslwr_s_l
 #define _tcsupr _mbsupr
 #define _tcsupr_l _mbsupr_l
-#define _tcsupr_s _mbsupr_s
-#define _tcsupr_s_l _mbsupr_s_l
 
 #define _tclen _mbclen
 #define _tccpy _mbccpy
 #define _tccpy_l _mbccpy_l
-#define _tccpy_s _mbccpy_s
-#define _tccpy_s_l _mbccpy_s_l
 #else
 
   _CRTIMP _CONST_RETURN char *__cdecl _tcschr(const char *_Str,unsigned int _Val);
   _CRTIMP size_t __cdecl _tcscspn(const char *_Str,const char *_Control);
   _CRTIMP char *__cdecl _tcsncat(char *_Dst,const char *_Src,size_t _MaxCount);
-  _CRTIMP char *__cdecl _tcsncat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
   _CRTIMP char *__cdecl _tcsncat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale);
-  _CRTIMP char *__cdecl _tcsncat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsncpy(char *_Dst,const char *_Src,size_t _MaxCount);
-  _CRTIMP char *__cdecl _tcsncpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
   _CRTIMP char *__cdecl _tcsncpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale);
-  _CRTIMP char *__cdecl _tcsncpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
   _CRTIMP _CONST_RETURN char *__cdecl _tcspbrk(const char *_Str,const char *_Control);
   _CRTIMP _CONST_RETURN char *__cdecl _tcsrchr(const char *_Str,unsigned int _Ch);
   _CRTIMP size_t __cdecl _tcsspn(const char *_Str,const char *_Control);
   _CRTIMP _CONST_RETURN char *__cdecl _tcsstr(const char *_Str,const char *_Substr);
   _CRTIMP char *__cdecl _tcstok(char *_Str,const char *_Delim);
-  _CRTIMP char *__cdecl _tcstok_s(char *_Str,const char *_Delim,char **_Context);
   _CRTIMP char *__cdecl _tcstok_l(char *_Str,const char *_Delim,_locale_t _Locale);
-  _CRTIMP char *__cdecl _tcstok_s_l(char *_Str,const char *_Delim,char **_Context,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsnset(char *_Str,unsigned int _Val,size_t _MaxCount);
   _CRTIMP char *__cdecl _tcsrev(char *_Str);
   _CRTIMP char *__cdecl _tcsset(char *_Str,unsigned int _Val);
   _CRTIMP char *__cdecl _tcsset_l(char *_Str,unsigned int _Val,_locale_t _Locale);
-  _CRTIMP errno_t __cdecl _tcsset_s(char *_Str,size_t _SizeInChars,unsigned int _Val);
-  _CRTIMP errno_t __cdecl _tcsset_s_l(char *_Str,size_t _SizeInChars,unsigned int,_locale_t _Locale);
   _CRTIMP int __cdecl _tcscmp(const char *_Str1,const char *_Str);
   _CRTIMP int __cdecl _tcsicmp(const char *_Str1,const char *_Str2);
   _CRTIMP int __cdecl _tcsicmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale);
@@ -1046,13 +875,9 @@
   _CRTIMP size_t __cdecl _tcsclen_l(const char *_Str,_locale_t _Locale);
   _CRTIMP size_t __cdecl _tcscnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsnccat(char *_Dst,const char *_Src,size_t _MaxCount);
-  _CRTIMP char *__cdecl _tcsnccat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
   _CRTIMP char *__cdecl _tcsnccat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale);
-  _CRTIMP char *__cdecl _tcsnccat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsnccpy(char *_Dst,const char *_Src,size_t _MaxCount);
-  _CRTIMP char *__cdecl _tcsnccpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount);
   _CRTIMP char *__cdecl _tcsnccpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale);
-  _CRTIMP char *__cdecl _tcsnccpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsncset(char *_Str,unsigned int _Val,size_t _MaxCount);
   _CRTIMP char *__cdecl _tcsdec(const char *_Start,const char *_Pos);
   _CRTIMP char *__cdecl _tcsinc(const char *_Ptr);
@@ -1063,12 +888,8 @@
   _CRTIMP char *__cdecl _tcsspnp(const char *_Str1,const char *_Str2);
   _CRTIMP char *__cdecl _tcslwr(char *_Str);
   _CRTIMP char *__cdecl _tcslwr_l(char *_Str,_locale_t _Locale);
-  _CRTIMP char *__cdecl _tcslwr_s(char *_Str,size_t _SizeInChars);
-  _CRTIMP char *__cdecl _tcslwr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale);
   _CRTIMP char *__cdecl _tcsupr(char *_Str);
   _CRTIMP char *__cdecl _tcsupr_l(char *_Str,_locale_t _Locale);
-  _CRTIMP char *__cdecl _tcsupr_s(char *_Str,size_t _SizeInChars);
-  _CRTIMP char *__cdecl _tcsupr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale);
   _CRTIMP size_t __cdecl _tclen(const char *_Str);
   _CRTIMP void __cdecl _tccpy(char *_DstCh,const char *_SrcCh);
 
@@ -1137,31 +958,20 @@
 #define _tcschr strchr
 #define _tcscspn strcspn
 #define _tcsncat strncat
-#define _tcsncat_s strncat_s
 #define _tcsncat_l _strncat_l
-#define _tcsncat_s_l _strncat_s_l
 #define _tcsncpy strncpy
-#define _tcsncpy_s strncpy_s
 #define _tcsncpy_l _strncpy_l
-#define _tcsncpy_s_l _strncpy_s_l
 #define _tcspbrk strpbrk
 #define _tcsrchr strrchr
 #define _tcsspn strspn
 #define _tcsstr strstr
 #define _tcstok strtok
-#define _tcstok_s strtok_s
 #define _tcstok_l _strtok_l
-#define _tcstok_s_l _strtok_s_l
 
 #define _tcsnset _strnset
-#define _tcsnset_s _strnset_s
 #define _tcsnset_l _strnset_l
-#define _tcsnset_s_l _strnset_s_l
 #define _tcsrev _strrev
 #define _tcsset _strset
-#define _tcsset_s _strset_s
-#define _tcsset_s _strset_s
-#define _tcsset_s_l _strset_s_l
 
 #define _tcscmp strcmp
 #define _tcsicmp _stricmp
@@ -1191,13 +1001,9 @@
 #define _tcsclen_l(_String,_Locale) strlen(_String)
 #define _tcscnlen_l(_String,_Max_count,_Locale) strnlen_l((_String),(_Max_count))
 #define _tcsnccat strncat
-#define _tcsnccat_s strncat_s
 #define _tcsnccat_l _strncat_l
-#define _tcsnccat_s_l _strncat_s_l
 #define _tcsnccpy strncpy
-#define _tcsnccpy_s strncpy_s
 #define _tcsnccpy_l _strncpy_l
-#define _tcsnccpy_s_l _strncpy_s_l
 #define _tcsncset _strnset
 
 #define _tcsdec _strdec
@@ -1210,12 +1016,8 @@
 
 #define _tcslwr _strlwr
 #define _tcslwr_l _strlwr_l
-#define _tcslwr_s _strlwr_s
-#define _tcslwr_s_l _strlwr_s_l
 #define _tcsupr _strupr
 #define _tcsupr_l _strupr_l
-#define _tcsupr_s _strupr_s
-#define _tcsupr_s_l _strupr_s_l
 #define _tcsxfrm strxfrm
 #define _tcsxfrm_l _strxfrm_l
 
@@ -1283,9 +1085,7 @@
 #define _strncat_l(_Destination,_Source,_Count,_Locale) (strncat(_Destination,_Source,_Count))
 #define _strtok_l(_String,_Delimiters,_Locale) (strtok(_String,_Delimiters))
 #define _strnset_l(_Destination,_Value,_Count,_Locale) (_strnset(_Destination,_Value,_Count))
-#define _strnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_strnset_s(_Destination,_Destination_size_chars,_Value,_Count))
 #define _strset_l(_Destination,_Value,_Locale) (_strset(_Destination,_Value))
-#define _strset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_strset_s(_Destination,_Destination_size_chars,_Value))
 #endif
 #endif
 
@@ -1295,4 +1095,6 @@
 #ifdef __cplusplus
 }
 #endif
+
+#include <sec_api/tchar_s.h>
 #endif