diff --git a/include/msvcrt/crtdefs.h b/include/msvcrt/crtdefs.h index 61116e99665..1f51937ca90 100644 --- a/include/msvcrt/crtdefs.h +++ b/include/msvcrt/crtdefs.h @@ -172,3 +172,8 @@ typedef unsigned short wint_t; typedef unsigned short wctype_t; #define _WCTYPE_T_DEFINED #endif + +#ifndef _ERRNO_T_DEFINED +typedef int errno_t; +#define _ERRNO_T_DEFINED +#endif diff --git a/include/msvcrt/memory.h b/include/msvcrt/memory.h index 769fcfc88d6..ecf13aa5dca 100644 --- a/include/msvcrt/memory.h +++ b/include/msvcrt/memory.h @@ -17,12 +17,13 @@ extern "C" { #ifndef _CRT_MEMORY_DEFINED #define _CRT_MEMORY_DEFINED -void* __cdecl memchr(const void*,int,size_t); -int __cdecl memcmp(const void*,const void*,size_t); -void* __cdecl memcpy(void*,const void*,size_t); -void* __cdecl memset(void*,int,size_t); -void* __cdecl _memccpy(void*,const void*,int,unsigned int); -int __cdecl _memicmp(const void*,const void*,unsigned int); +void* __cdecl memchr(const void*,int,size_t); +int __cdecl memcmp(const void*,const void*,size_t); +void* __cdecl memcpy(void*,const void*,size_t); +errno_t __cdecl memcpy_s(void*,size_t,const void*,size_t); +void* __cdecl memset(void*,int,size_t); +void* __cdecl _memccpy(void*,const void*,int,unsigned int); +int __cdecl _memicmp(const void*,const void*,unsigned int); static inline int memicmp(const void* s1, const void* s2, size_t len) { return _memicmp(s1, s2, len); } static inline void* memccpy(void *s1, const void *s2, int c, size_t n) { return _memccpy(s1, s2, c, n); } diff --git a/include/msvcrt/stddef.h b/include/msvcrt/stddef.h index 4f353517f9d..0ceb65d91cd 100644 --- a/include/msvcrt/stddef.h +++ b/include/msvcrt/stddef.h @@ -1,6 +1,4 @@ /* - * Time definitions - * * Copyright 2000 Francois Gouget. * * This library is free software; you can redistribute it and/or diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index b309ebbd463..dd4b26c6b50 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -113,10 +113,12 @@ int __cdecl _putw(int,FILE*); int __cdecl _rmtmp(void); int __cdecl _setmaxstdio(int); int __cdecl _snprintf(char*,size_t,const char*,...); +int __cdecl _snprintf_s(char*,size_t,size_t,const char*,...); char* __cdecl _tempnam(const char*,const char*); int __cdecl _unlink(const char*); int __cdecl _vscprintf(const char*,__ms_va_list); int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list); +int __cdecl _vsnprintf_s(char*,size_t,size_t,const char*,__ms_va_list); void __cdecl clearerr(FILE*); int __cdecl fclose(FILE*); @@ -127,12 +129,14 @@ int __cdecl fgetc(FILE*); int __cdecl fgetpos(FILE*,fpos_t*); char* __cdecl fgets(char*,int,FILE*); FILE* __cdecl fopen(const char*,const char*); +errno_t __cdecl fopen_s(FILE**,const char*,const char*); int __cdecl fprintf(FILE*,const char*,...); int __cdecl fputc(int,FILE*); int __cdecl fputs(const char*,FILE*); size_t __cdecl fread(void*,size_t,size_t,FILE*); FILE* __cdecl freopen(const char*,const char*,FILE*); int __cdecl fscanf(FILE*,const char*,...); +int __cdecl fscanf_s(FILE*,const char*,...); int __cdecl fseek(FILE*,__msvcrt_long,int); int __cdecl fsetpos(FILE*,fpos_t*); __msvcrt_long __cdecl ftell(FILE*); @@ -149,16 +153,20 @@ int __cdecl remove(const char*); int __cdecl rename(const char*,const char*); void __cdecl rewind(FILE*); int __cdecl scanf(const char*,...); +int __cdecl scanf_s(const char*,...); void __cdecl setbuf(FILE*,char*); int __cdecl setvbuf(FILE*,char*,int,size_t); int __cdecl sprintf(char*,const char*,...); +int __cdecl sprintf_s(char*,size_t,const char*,...); int __cdecl sscanf(const char*,const char*,...); +int __cdecl sscanf_s(const char*,const char*,...); FILE* __cdecl tmpfile(void); char* __cdecl tmpnam(char*); int __cdecl ungetc(int,FILE*); int __cdecl vfprintf(FILE*,const char*,__ms_va_list); int __cdecl vprintf(const char*,__ms_va_list); int __cdecl vsprintf(char*,const char*,__ms_va_list); +int __cdecl vsprintf_s(char*,size_t,const char*,__ms_va_list); #ifndef _WSTDIO_DEFINED #define _WSTDIO_DEFINED @@ -167,10 +175,13 @@ wint_t __cdecl _fputwchar(wint_t); wchar_t* __cdecl _getws(wchar_t*); int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); +int __cdecl _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...); int __cdecl _vscwprintf(const wchar_t*,__ms_va_list); int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list); +int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list); FILE* __cdecl _wfdopen(int,const wchar_t*); FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*); +errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*); FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*); FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int); void __cdecl _wperror(const wchar_t*); @@ -186,6 +197,7 @@ int __cdecl fputws(const wchar_t*,FILE*); int __cdecl fwprintf(FILE*,const wchar_t*,...); int __cdecl fputws(const wchar_t*,FILE*); int __cdecl fwscanf(FILE*,const wchar_t*,...); +int __cdecl fwscanf_s(FILE*,const wchar_t*,...); wint_t __cdecl getwc(FILE*); wint_t __cdecl getwchar(void); wchar_t* __cdecl getws(wchar_t*); @@ -193,13 +205,17 @@ wint_t __cdecl putwc(wint_t,FILE*); wint_t __cdecl putwchar(wint_t); int __cdecl putws(const wchar_t*); int __cdecl swprintf(wchar_t*,const wchar_t*,...); +int __cdecl swprintf_s(wchar_t*,size_t,const wchar_t*,...); int __cdecl swscanf(const wchar_t*,const wchar_t*,...); +int __cdecl swscanf_s(const wchar_t*,const wchar_t*,...); wint_t __cdecl ungetwc(wint_t,FILE*); int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list); int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list); +int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list); int __cdecl vwprintf(const wchar_t*,__ms_va_list); int __cdecl wprintf(const wchar_t*,...); int __cdecl wscanf(const wchar_t*,...); +int __cdecl wscanf_s(const wchar_t*,...); #endif /* _WSTDIO_DEFINED */ #endif /* _STDIO_DEFINED */ diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index 35a97820200..c6a3e0000e1 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -161,6 +161,7 @@ void __cdecl _splitpath(const char*,char*,char*,char*,char*); long double __cdecl _strtold(const char*,char**); void __cdecl _swab(char*,char*,int); char* __cdecl _ui64toa(unsigned __int64,char*,int); +errno_t __cdecl _ui64toa_s(unsigned __int64,char*,size_t,int); char* __cdecl _ultoa(__msvcrt_ulong,char*,int); void __cdecl _exit(int); @@ -183,6 +184,7 @@ void* __cdecl malloc(size_t); int __cdecl mblen(const char*,size_t); void __cdecl perror(const char*); int __cdecl rand(void); +errno_t __cdecl rand_s(unsigned int*); void* __cdecl realloc(void*,size_t); void __cdecl srand(unsigned int); double __cdecl strtod(const char*,char**); @@ -206,16 +208,21 @@ void __cdecl _wperror(const wchar_t*); int __cdecl _wputenv(const wchar_t*); void __cdecl _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*); void __cdecl _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*); +errno_t __cdecl _wsplitpath_s(const wchar_t*,wchar_t*,size_t,wchar_t*,size_t, + wchar_t*,size_t,wchar_t*,size_t); int __cdecl _wsystem(const wchar_t*); +double __cdecl _wtof(const wchar_t*); int __cdecl _wtoi(const wchar_t*); __int64 __cdecl _wtoi64(const wchar_t*); __msvcrt_long __cdecl _wtol(const wchar_t*); size_t __cdecl mbstowcs(wchar_t*,const char*,size_t); +errno_t __cdecl mbstowcs_s(size_t*,wchar_t*,size_t,const char*,size_t); int __cdecl mbtowc(wchar_t*,const char*,size_t); double __cdecl wcstod(const wchar_t*,wchar_t**); __msvcrt_long __cdecl wcstol(const wchar_t*,wchar_t**,int); size_t __cdecl wcstombs(char*,const wchar_t*,size_t); +errno_t __cdecl wcstombs_s(size_t*,char*,size_t,const wchar_t*,size_t); __msvcrt_ulong __cdecl wcstoul(const wchar_t*,wchar_t**,int); int __cdecl wctomb(char*,wchar_t); #endif /* _WSTDLIB_DEFINED */ diff --git a/include/msvcrt/string.h b/include/msvcrt/string.h index 03bf4f8fb04..3e60a4d44e8 100644 --- a/include/msvcrt/string.h +++ b/include/msvcrt/string.h @@ -29,12 +29,13 @@ extern "C" { #ifndef _CRT_MEMORY_DEFINED #define _CRT_MEMORY_DEFINED -void* __cdecl memchr(const void*,int,size_t); -int __cdecl memcmp(const void*,const void*,size_t); -void* __cdecl memcpy(void*,const void*,size_t); -void* __cdecl memset(void*,int,size_t); -void* __cdecl _memccpy(void*,const void*,int,unsigned int); -int __cdecl _memicmp(const void*,const void*,unsigned int); +void* __cdecl memchr(const void*,int,size_t); +int __cdecl memcmp(const void*,const void*,size_t); +void* __cdecl memcpy(void*,const void*,size_t); +errno_t __cdecl memcpy_s(void*,size_t,const void*,size_t); +void* __cdecl memset(void*,int,size_t); +void* __cdecl _memccpy(void*,const void*,int,unsigned int); +int __cdecl _memicmp(const void*,const void*,unsigned int); static inline int memicmp(const void* s1, const void* s2, size_t len) { return _memicmp(s1, s2, len); } static inline void* memccpy(void *s1, const void *s2, int c, size_t n) { return _memccpy(s1, s2, c, n); } @@ -52,24 +53,30 @@ char* __cdecl _strrev(char*); char* __cdecl _strset(char*,int); char* __cdecl _strupr(char*); -void* __cdecl memmove(void*,const void*,size_t); -char* __cdecl strcat(char*,const char*); -char* __cdecl strchr(const char*,int); -int __cdecl strcmp(const char*,const char*); -int __cdecl strcoll(const char*,const char*); -char* __cdecl strcpy(char*,const char*); -size_t __cdecl strcspn(const char*,const char*); -char* __cdecl strerror(int); -size_t __cdecl strlen(const char*); -char* __cdecl strncat(char*,const char*,size_t); -int __cdecl strncmp(const char*,const char*,size_t); -char* __cdecl strncpy(char*,const char*,size_t); -char* __cdecl strpbrk(const char*,const char*); -char* __cdecl strrchr(const char*,int); -size_t __cdecl strspn(const char*,const char*); -char* __cdecl strstr(const char*,const char*); -char* __cdecl strtok(char*,const char*); -size_t __cdecl strxfrm(char*,const char*,size_t); +void* __cdecl memmove(void*,const void*,size_t); +errno_t __cdecl memmove_s(void*,size_t,const void*,size_t); +char* __cdecl strcat(char*,const char*); +errno_t __cdecl strcat_s(char*,size_t,const char*); +char* __cdecl strchr(const char*,int); +int __cdecl strcmp(const char*,const char*); +int __cdecl strcoll(const char*,const char*); +char* __cdecl strcpy(char*,const char*); +errno_t __cdecl strcpy_s(char*,size_t,const char*); +size_t __cdecl strcspn(const char*,const char*); +char* __cdecl strerror(int); +size_t __cdecl strlen(const char*); +char* __cdecl strncat(char*,const char*,size_t); +int __cdecl strncmp(const char*,const char*,size_t); +char* __cdecl strncpy(char*,const char*,size_t); +errno_t __cdecl strncpy_s(char*,size_t,const char*,size_t); +size_t __cdecl strnlen(const char*,size_t); +char* __cdecl strpbrk(const char*,const char*); +char* __cdecl strrchr(const char*,int); +size_t __cdecl strspn(const char*,const char*); +char* __cdecl strstr(const char*,const char*); +char* __cdecl strtok(char*,const char*); +char* __cdecl strtok_s(char*,const char*,char**); +size_t __cdecl strxfrm(char*,const char*,size_t); #ifndef _WSTRING_DEFINED #define _WSTRING_DEFINED @@ -84,15 +91,18 @@ wchar_t* __cdecl _wcsset(wchar_t*,wchar_t); wchar_t* __cdecl _wcsupr(wchar_t*); wchar_t* __cdecl wcscat(wchar_t*,const wchar_t*); +errno_t __cdecl wcscat_s(wchar_t*,size_t,const wchar_t*); wchar_t* __cdecl wcschr(const wchar_t*,wchar_t); int __cdecl wcscmp(const wchar_t*,const wchar_t*); int __cdecl wcscoll(const wchar_t*,const wchar_t*); wchar_t* __cdecl wcscpy(wchar_t*,const wchar_t*); +errno_t __cdecl wcscpy_s(wchar_t*,size_t,const wchar_t*); size_t __cdecl wcscspn(const wchar_t*,const wchar_t*); size_t __cdecl wcslen(const wchar_t*); wchar_t* __cdecl wcsncat(wchar_t*,const wchar_t*,size_t); int __cdecl wcsncmp(const wchar_t*,const wchar_t*,size_t); wchar_t* __cdecl wcsncpy(wchar_t*,const wchar_t*,size_t); +errno_t __cdecl wcsncpy_s(wchar_t*,size_t,const wchar_t*,size_t); wchar_t* __cdecl wcspbrk(const wchar_t*,const wchar_t*); wchar_t* __cdecl wcsrchr(const wchar_t*,wchar_t wcFor); size_t __cdecl wcsspn(const wchar_t*,const wchar_t*); diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h index 66d3a8103ed..41ff3ff5a6c 100644 --- a/include/msvcrt/wchar.h +++ b/include/msvcrt/wchar.h @@ -275,10 +275,13 @@ wint_t __cdecl _fputwchar(wint_t); wchar_t* __cdecl _getws(wchar_t*); int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); +int __cdecl _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...); int __cdecl _vscwprintf(const wchar_t*,__ms_va_list); int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list); +int __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list); FILE* __cdecl _wfdopen(int,const wchar_t*); FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*); +errno_t __cdecl _wfopen_s(FILE**,const wchar_t*,const wchar_t*); FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*); FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int); void __cdecl _wperror(const wchar_t*); @@ -294,6 +297,7 @@ int __cdecl fputws(const wchar_t*,FILE*); int __cdecl fwprintf(FILE*,const wchar_t*,...); int __cdecl fputws(const wchar_t*,FILE*); int __cdecl fwscanf(FILE*,const wchar_t*,...); +int __cdecl fwscanf_s(FILE*,const wchar_t*,...); wint_t __cdecl getwc(FILE*); wint_t __cdecl getwchar(void); wchar_t* __cdecl getws(wchar_t*); @@ -301,13 +305,17 @@ wint_t __cdecl putwc(wint_t,FILE*); wint_t __cdecl putwchar(wint_t); int __cdecl putws(const wchar_t*); int __cdecl swprintf(wchar_t*,const wchar_t*,...); +int __cdecl swprintf_s(wchar_t*,size_t,const wchar_t*,...); int __cdecl swscanf(const wchar_t*,const wchar_t*,...); +int __cdecl swscanf_s(const wchar_t*,const wchar_t*,...); wint_t __cdecl ungetwc(wint_t,FILE*); int __cdecl vfwprintf(FILE*,const wchar_t*,__ms_va_list); int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list); +int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list); int __cdecl vwprintf(const wchar_t*,__ms_va_list); int __cdecl wprintf(const wchar_t*,...); int __cdecl wscanf(const wchar_t*,...); +int __cdecl wscanf_s(const wchar_t*,...); #endif /* _WSTDIO_DEFINED */ #ifndef _WSTDLIB_DEFINED @@ -324,16 +332,21 @@ void __cdecl _wperror(const wchar_t*); int __cdecl _wputenv(const wchar_t*); void __cdecl _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*); void __cdecl _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*); +errno_t __cdecl _wsplitpath_s(const wchar_t*,wchar_t*,size_t,wchar_t*,size_t, + wchar_t*,size_t,wchar_t*,size_t); int __cdecl _wsystem(const wchar_t*); +double __cdecl _wtof(const wchar_t*); int __cdecl _wtoi(const wchar_t*); __int64 __cdecl _wtoi64(const wchar_t*); __msvcrt_long __cdecl _wtol(const wchar_t*); size_t __cdecl mbstowcs(wchar_t*,const char*,size_t); +errno_t __cdecl mbstowcs_s(size_t*,wchar_t*,size_t,const char*,size_t); int __cdecl mbtowc(wchar_t*,const char*,size_t); double __cdecl wcstod(const wchar_t*,wchar_t**); __msvcrt_long __cdecl wcstol(const wchar_t*,wchar_t**,int); size_t __cdecl wcstombs(char*,const wchar_t*,size_t); +errno_t __cdecl wcstombs_s(size_t*,char*,size_t,const wchar_t*,size_t); __msvcrt_ulong __cdecl wcstoul(const wchar_t*,wchar_t**,int); int __cdecl wctomb(char*,wchar_t); #endif /* _WSTDLIB_DEFINED */ @@ -351,15 +364,18 @@ wchar_t* __cdecl _wcsset(wchar_t*,wchar_t); wchar_t* __cdecl _wcsupr(wchar_t*); wchar_t* __cdecl wcscat(wchar_t*,const wchar_t*); +errno_t __cdecl wcscat_s(wchar_t*,size_t,const wchar_t*); wchar_t* __cdecl wcschr(const wchar_t*,wchar_t); int __cdecl wcscmp(const wchar_t*,const wchar_t*); int __cdecl wcscoll(const wchar_t*,const wchar_t*); wchar_t* __cdecl wcscpy(wchar_t*,const wchar_t*); +errno_t __cdecl wcscpy_s(wchar_t*,size_t,const wchar_t*); size_t __cdecl wcscspn(const wchar_t*,const wchar_t*); size_t __cdecl wcslen(const wchar_t*); wchar_t* __cdecl wcsncat(wchar_t*,const wchar_t*,size_t); int __cdecl wcsncmp(const wchar_t*,const wchar_t*,size_t); wchar_t* __cdecl wcsncpy(wchar_t*,const wchar_t*,size_t); +errno_t __cdecl wcsncpy_s(wchar_t*,size_t,const wchar_t*,size_t); wchar_t* __cdecl wcspbrk(const wchar_t*,const wchar_t*); wchar_t* __cdecl wcsrchr(const wchar_t*,wchar_t wcFor); size_t __cdecl wcsspn(const wchar_t*,const wchar_t*);