This fixes LLVM ASAN an the ASAN then works as expected with Wine. Would something like this be acceptable for upstream?
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50993 Signed-off-by: Roman Pišl rpisl@seznam.cz --- dlls/ntdll/string.c | 98 ++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 49 deletions(-)
diff --git a/dlls/ntdll/string.c b/dlls/ntdll/string.c index 0fa83821d21..7370bf3631b 100644 --- a/dlls/ntdll/string.c +++ b/dlls/ntdll/string.c @@ -69,7 +69,7 @@ static const unsigned short ctypes[257] = /********************************************************************* * memchr (NTDLL.@) */ -void * __cdecl memchr( const void *ptr, int c, size_t n ) +void * __cdecl DECLSPEC_HOTPATCH memchr( const void *ptr, int c, size_t n ) { const unsigned char *p = ptr;
@@ -81,7 +81,7 @@ void * __cdecl memchr( const void *ptr, int c, size_t n ) /********************************************************************* * memcmp (NTDLL.@) */ -int __cdecl memcmp( const void *ptr1, const void *ptr2, size_t n ) +int __cdecl DECLSPEC_HOTPATCH memcmp( const void *ptr1, const void *ptr2, size_t n ) { const unsigned char *p1, *p2;
@@ -100,7 +100,7 @@ int __cdecl memcmp( const void *ptr1, const void *ptr2, size_t n ) * NOTES * Behaves like memmove. */ -void * __cdecl memcpy( void *dst, const void *src, size_t n ) +void * __cdecl DECLSPEC_HOTPATCH memcpy( void *dst, const void *src, size_t n ) { volatile unsigned char *d = dst; /* avoid gcc optimizations */ const unsigned char *s = src; @@ -122,7 +122,7 @@ void * __cdecl memcpy( void *dst, const void *src, size_t n ) /********************************************************************* * memmove (NTDLL.@) */ -void * __cdecl memmove( void *dst, const void *src, size_t n ) +void * __cdecl DECLSPEC_HOTPATCH memmove( void *dst, const void *src, size_t n ) { volatile unsigned char *d = dst; /* avoid gcc optimizations */ const unsigned char *s = src; @@ -157,7 +157,7 @@ static inline void memset_aligned_32( unsigned char *d, uint64_t v, size_t n ) /********************************************************************* * memset (NTDLL.@) */ -void *__cdecl memset( void *dst, int c, size_t n ) +void *__cdecl DECLSPEC_HOTPATCH memset( void *dst, int c, size_t n ) { typedef uint64_t DECLSPEC_ALIGN(1) unaligned_ui64; typedef uint32_t DECLSPEC_ALIGN(1) unaligned_ui32; @@ -214,7 +214,7 @@ void *__cdecl memset( void *dst, int c, size_t n ) /********************************************************************* * strcat (NTDLL.@) */ -char * __cdecl strcat( char *dst, const char *src ) +char * __cdecl DECLSPEC_HOTPATCH strcat( char *dst, const char *src ) { char *d = dst; while (*d) d++; @@ -226,7 +226,7 @@ char * __cdecl strcat( char *dst, const char *src ) /********************************************************************* * strchr (NTDLL.@) */ -char * __cdecl strchr( const char *str, int c ) +char * __cdecl DECLSPEC_HOTPATCH strchr( const char *str, int c ) { do { if (*str == (char)c) return (char *)(ULONG_PTR)str; } while (*str++); return NULL; @@ -236,7 +236,7 @@ char * __cdecl strchr( const char *str, int c ) /********************************************************************* * strcmp (NTDLL.@) */ -int __cdecl strcmp( const char *str1, const char *str2 ) +int __cdecl DECLSPEC_HOTPATCH strcmp( const char *str1, const char *str2 ) { while (*str1 && *str1 == *str2) { str1++; str2++; } if ((unsigned char)*str1 > (unsigned char)*str2) return 1; @@ -248,7 +248,7 @@ int __cdecl strcmp( const char *str1, const char *str2 ) /********************************************************************* * strcpy (NTDLL.@) */ -char * __cdecl strcpy( char *dst, const char *src ) +char * __cdecl DECLSPEC_HOTPATCH strcpy( char *dst, const char *src ) { char *d = dst; while ((*d++ = *src++)); @@ -259,7 +259,7 @@ char * __cdecl strcpy( char *dst, const char *src ) /********************************************************************* * strcspn (NTDLL.@) */ -size_t __cdecl strcspn( const char *str, const char *reject ) +size_t __cdecl DECLSPEC_HOTPATCH strcspn( const char *str, const char *reject ) { const char *ptr; for (ptr = str; *ptr; ptr++) if (strchr( reject, *ptr )) break; @@ -270,7 +270,7 @@ size_t __cdecl strcspn( const char *str, const char *reject ) /********************************************************************* * strlen (NTDLL.@) */ -size_t __cdecl strlen( const char *str ) +size_t __cdecl DECLSPEC_HOTPATCH strlen( const char *str ) { const char *s = str; while (*s) s++; @@ -281,7 +281,7 @@ size_t __cdecl strlen( const char *str ) /********************************************************************* * strncat (NTDLL.@) */ -char * __cdecl strncat( char *dst, const char *src, size_t len ) +char * __cdecl DECLSPEC_HOTPATCH strncat( char *dst, const char *src, size_t len ) { char *d = dst; while (*d) d++; @@ -294,7 +294,7 @@ char * __cdecl strncat( char *dst, const char *src, size_t len ) /********************************************************************* * strncmp (NTDLL.@) */ -int __cdecl strncmp( const char *str1, const char *str2, size_t len ) +int __cdecl DECLSPEC_HOTPATCH strncmp( const char *str1, const char *str2, size_t len ) { if (!len) return 0; while (--len && *str1 && *str1 == *str2) { str1++; str2++; } @@ -306,7 +306,7 @@ int __cdecl strncmp( const char *str1, const char *str2, size_t len ) * strncpy (NTDLL.@) */ #undef strncpy -char * __cdecl strncpy( char *dst, const char *src, size_t len ) +char * __cdecl DECLSPEC_HOTPATCH strncpy( char *dst, const char *src, size_t len ) { char *d; for (d = dst; len && *src; d++, src++, len--) *d = *src; @@ -318,7 +318,7 @@ char * __cdecl strncpy( char *dst, const char *src, size_t len ) /********************************************************************* * strnlen (NTDLL.@) */ -size_t __cdecl strnlen( const char *str, size_t len ) +size_t __cdecl DECLSPEC_HOTPATCH strnlen( const char *str, size_t len ) { const char *s = str; for (s = str; len && *s; s++, len--) ; @@ -329,7 +329,7 @@ size_t __cdecl strnlen( const char *str, size_t len ) /********************************************************************* * strpbrk (NTDLL.@) */ -char * __cdecl strpbrk( const char *str, const char *accept ) +char * __cdecl DECLSPEC_HOTPATCH strpbrk( const char *str, const char *accept ) { for ( ; *str; str++) if (strchr( accept, *str )) return (char *)(ULONG_PTR)str; return NULL; @@ -339,7 +339,7 @@ char * __cdecl strpbrk( const char *str, const char *accept ) /********************************************************************* * strrchr (NTDLL.@) */ -char * __cdecl strrchr( const char *str, int c ) +char * __cdecl DECLSPEC_HOTPATCH strrchr( const char *str, int c ) { char *ret = NULL; do { if (*str == (char)c) ret = (char *)(ULONG_PTR)str; } while (*str++); @@ -350,7 +350,7 @@ char * __cdecl strrchr( const char *str, int c ) /********************************************************************* * strspn (NTDLL.@) */ -size_t __cdecl strspn( const char *str, const char *accept ) +size_t __cdecl DECLSPEC_HOTPATCH strspn( const char *str, const char *accept ) { const char *ptr; for (ptr = str; *ptr; ptr++) if (!strchr( accept, *ptr )) break; @@ -361,7 +361,7 @@ size_t __cdecl strspn( const char *str, const char *accept ) /********************************************************************* * strstr (NTDLL.@) */ -char * __cdecl strstr( const char *str, const char *sub ) +char * __cdecl DECLSPEC_HOTPATCH strstr( const char *str, const char *sub ) { while (*str) { @@ -377,7 +377,7 @@ char * __cdecl strstr( const char *str, const char *sub ) /********************************************************************* * _memccpy (NTDLL.@) */ -void * __cdecl _memccpy( void *dst, const void *src, int c, size_t n ) +void * __cdecl DECLSPEC_HOTPATCH _memccpy( void *dst, const void *src, int c, size_t n ) { unsigned char *d = dst; const unsigned char *s = src; @@ -389,7 +389,7 @@ void * __cdecl _memccpy( void *dst, const void *src, int c, size_t n ) /********************************************************************* * tolower (NTDLL.@) */ -int __cdecl tolower( int c ) +int __cdecl DECLSPEC_HOTPATCH tolower( int c ) { return (char)c >= 'A' && (char)c <= 'Z' ? c - 'A' + 'a' : c; } @@ -413,7 +413,7 @@ int __cdecl tolower( int c ) * Any Nul characters in s1 or s2 are ignored. This function always * compares up to len bytes or the first place where s1 and s2 differ. */ -int __cdecl _memicmp( const void *str1, const void *str2, size_t len ) +int __cdecl DECLSPEC_HOTPATCH _memicmp( const void *str1, const void *str2, size_t len ) { const unsigned char *s1 = str1, *s2 = str2; int ret = 0; @@ -430,7 +430,7 @@ int __cdecl _memicmp( const void *str1, const void *str2, size_t len ) /********************************************************************* * _strnicmp (NTDLL.@) */ -int __cdecl _strnicmp( LPCSTR str1, LPCSTR str2, size_t n ) +int __cdecl DECLSPEC_HOTPATCH _strnicmp( LPCSTR str1, LPCSTR str2, size_t n ) { int l1, l2;
@@ -455,7 +455,7 @@ int __cdecl _strnicmp( LPCSTR str1, LPCSTR str2, size_t n ) * _stricmp (NTDLL.@) * _strcmpi (NTDLL.@) */ -int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 ) +int __cdecl DECLSPEC_HOTPATCH _stricmp( LPCSTR str1, LPCSTR str2 ) { return _strnicmp( str1, str2, -1 ); } @@ -473,7 +473,7 @@ int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 ) * str. There is no error return, if str is NULL or invalid, this * function will crash. */ -LPSTR __cdecl _strupr( LPSTR str ) +LPSTR __cdecl DECLSPEC_HOTPATCH _strupr( LPSTR str ) { LPSTR ret = str; for ( ; *str; str++) *str = RtlUpperChar(*str); @@ -493,7 +493,7 @@ LPSTR __cdecl _strupr( LPSTR str ) * str. There is no error return, if str is NULL or invalid, this * function will crash. */ -LPSTR __cdecl _strlwr( LPSTR str ) +LPSTR __cdecl DECLSPEC_HOTPATCH _strlwr( LPSTR str ) { LPSTR ret = str; for ( ; *str; str++) *str = tolower(*str); @@ -504,7 +504,7 @@ LPSTR __cdecl _strlwr( LPSTR str ) /********************************************************************* * toupper (NTDLL.@) */ -int __cdecl toupper( int c ) +int __cdecl DECLSPEC_HOTPATCH toupper( int c ) { char str[2], *p = str; WCHAR wc; @@ -523,7 +523,7 @@ int __cdecl toupper( int c ) /********************************************************************* * isalnum (NTDLL.@) */ -int __cdecl isalnum( int c ) +int __cdecl DECLSPEC_HOTPATCH isalnum( int c ) { return ctypes[c + 1] & (C1_LOWER | C1_UPPER | C1_DIGIT); } @@ -532,7 +532,7 @@ int __cdecl isalnum( int c ) /********************************************************************* * isalpha (NTDLL.@) */ -int __cdecl isalpha( int c ) +int __cdecl DECLSPEC_HOTPATCH isalpha( int c ) { return ctypes[c + 1] & (C1_LOWER | C1_UPPER); } @@ -541,7 +541,7 @@ int __cdecl isalpha( int c ) /********************************************************************* * iscntrl (NTDLL.@) */ -int __cdecl iscntrl( int c ) +int __cdecl DECLSPEC_HOTPATCH iscntrl( int c ) { return ctypes[c + 1] & C1_CNTRL; } @@ -550,7 +550,7 @@ int __cdecl iscntrl( int c ) /********************************************************************* * isdigit (NTDLL.@) */ -int __cdecl isdigit( int c ) +int __cdecl DECLSPEC_HOTPATCH isdigit( int c ) { return ctypes[c + 1] & C1_DIGIT; } @@ -559,7 +559,7 @@ int __cdecl isdigit( int c ) /********************************************************************* * isgraph (NTDLL.@) */ -int __cdecl isgraph( int c ) +int __cdecl DECLSPEC_HOTPATCH isgraph( int c ) { return ctypes[c + 1] & (C1_LOWER | C1_UPPER | C1_DIGIT | C1_PUNCT); } @@ -568,7 +568,7 @@ int __cdecl isgraph( int c ) /********************************************************************* * islower (NTDLL.@) */ -int __cdecl islower( int c ) +int __cdecl DECLSPEC_HOTPATCH islower( int c ) { return ctypes[c + 1] & C1_LOWER; } @@ -577,7 +577,7 @@ int __cdecl islower( int c ) /********************************************************************* * isprint (NTDLL.@) */ -int __cdecl isprint( int c ) +int __cdecl DECLSPEC_HOTPATCH isprint( int c ) { return ctypes[c + 1] & (C1_LOWER | C1_UPPER | C1_DIGIT | C1_PUNCT | C1_BLANK); } @@ -586,7 +586,7 @@ int __cdecl isprint( int c ) /********************************************************************* * ispunct (NTDLL.@) */ -int __cdecl ispunct( int c ) +int __cdecl DECLSPEC_HOTPATCH ispunct( int c ) { return ctypes[c + 1] & C1_PUNCT; } @@ -595,7 +595,7 @@ int __cdecl ispunct( int c ) /********************************************************************* * isspace (NTDLL.@) */ -int __cdecl isspace( int c ) +int __cdecl DECLSPEC_HOTPATCH isspace( int c ) { return ctypes[c + 1] & C1_SPACE; } @@ -604,7 +604,7 @@ int __cdecl isspace( int c ) /********************************************************************* * isupper (NTDLL.@) */ -int __cdecl isupper( int c ) +int __cdecl DECLSPEC_HOTPATCH isupper( int c ) { return ctypes[c + 1] & C1_UPPER; } @@ -613,7 +613,7 @@ int __cdecl isupper( int c ) /********************************************************************* * isxdigit (NTDLL.@) */ -int __cdecl isxdigit( int c ) +int __cdecl DECLSPEC_HOTPATCH isxdigit( int c ) { return ctypes[c + 1] & C1_XDIGIT; } @@ -684,7 +684,7 @@ static int char_to_int( char c ) /********************************************************************* * strtol (NTDLL.@) */ -__msvcrt_long __cdecl strtol( const char *s, char **end, int base ) +__msvcrt_long __cdecl DECLSPEC_HOTPATCH strtol( const char *s, char **end, int base ) { BOOL negative = FALSE, empty = TRUE; LONG ret = 0; @@ -731,7 +731,7 @@ __msvcrt_long __cdecl strtol( const char *s, char **end, int base ) /********************************************************************* * strtoul (NTDLL.@) */ -__msvcrt_ulong __cdecl strtoul( const char *s, char **end, int base ) +__msvcrt_ulong __cdecl DECLSPEC_HOTPATCH strtoul( const char *s, char **end, int base ) { BOOL negative = FALSE, empty = TRUE; ULONG ret = 0; @@ -786,7 +786,7 @@ __msvcrt_ulong __cdecl strtoul( const char *s, char **end, int base ) * - Does not check if radix is in the range of 2 to 36. * - If str is NULL it crashes, as the native function does. */ -char * __cdecl _ultoa( __msvcrt_ulong value, char *str, int radix ) +char * __cdecl DECLSPEC_HOTPATCH _ultoa( __msvcrt_ulong value, char *str, int radix ) { char buffer[33]; char *pos; @@ -825,7 +825,7 @@ char * __cdecl _ultoa( __msvcrt_ulong value, char *str, int radix ) * - Does not check if radix is in the range of 2 to 36. * - If str is NULL it crashes, as the native function does. */ -char * __cdecl _ltoa( __msvcrt_long value, char *str, int radix ) +char * __cdecl DECLSPEC_HOTPATCH _ltoa( __msvcrt_long value, char *str, int radix ) { ULONG val; int negative; @@ -878,7 +878,7 @@ char * __cdecl _ltoa( __msvcrt_long value, char *str, int radix ) * - Does not check if radix is in the range of 2 to 36. * - If str is NULL it crashes, as the native function does. */ -char * __cdecl _itoa( +char * __cdecl DECLSPEC_HOTPATCH _itoa( int value, /* [I] Value to be converted */ char *str, /* [O] Destination for the converted value */ int radix) /* [I] Number base for conversion */ @@ -901,7 +901,7 @@ char * __cdecl _itoa( * - Does not check if radix is in the range of 2 to 36. * - If str is NULL it crashes, as the native function does. */ -char * __cdecl _ui64toa( +char * __cdecl DECLSPEC_HOTPATCH _ui64toa( ULONGLONG value, /* [I] Value to be converted */ char *str, /* [O] Destination for the converted value */ int radix) /* [I] Number base for conversion */ @@ -952,7 +952,7 @@ char * __cdecl _ui64toa( * The native msvcrt _i64toa function and our ntdll _i64toa function * do not have this bug. */ -char * __cdecl _i64toa( +char * __cdecl DECLSPEC_HOTPATCH _i64toa( LONGLONG value, /* [I] Value to be converted */ char *str, /* [O] Destination for the converted value */ int radix) /* [I] Number base for conversion */ @@ -1011,7 +1011,7 @@ char * __cdecl _i64toa( * - No check is made for value overflow, only the lower 64 bits are assigned. * - If str is NULL it crashes, as the native function does. */ -LONGLONG __cdecl _atoi64( const char *str ) +LONGLONG __cdecl DECLSPEC_HOTPATCH _atoi64( const char *str ) { ULONGLONG RunningTotal = 0; BOOL bMinus = FALSE; @@ -1039,7 +1039,7 @@ LONGLONG __cdecl _atoi64( const char *str ) /********************************************************************* * atoi (NTDLL.@) */ -int __cdecl atoi( const char *nptr ) +int __cdecl DECLSPEC_HOTPATCH atoi( const char *nptr ) { return _atoi64( nptr ); } @@ -1048,7 +1048,7 @@ int __cdecl atoi( const char *nptr ) /********************************************************************* * atol (NTDLL.@) */ -__msvcrt_long __cdecl atol( const char *nptr ) +__msvcrt_long __cdecl DECLSPEC_HOTPATCH atol( const char *nptr ) { return _atoi64( nptr ); } @@ -1528,7 +1528,7 @@ int WINAPIV sscanf( const char *str, const char *format, ... ) * RETURNS * Nothing. */ -void __cdecl _splitpath(const char* inpath, char * drv, char * dir, +void __cdecl DECLSPEC_HOTPATCH _splitpath(const char* inpath, char * drv, char * dir, char* fname, char * ext ) { const char *p, *end;
This fixes LLVM ASAN an the ASAN then works as expected with Wine. Would something like this be acceptable for upstream?
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50993 Signed-off-by: Roman Pišl rpisl@seznam.cz --- dlls/msvcrt/string.c | 206 +++++++++++++++++++++---------------------- 1 file changed, 103 insertions(+), 103 deletions(-)
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index d92b7a38d12..c5a8f834705 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -40,7 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); * _mbsdup (MSVCRT.@) * _strdup (MSVCRT.@) */ -char* CDECL _strdup(const char* str) +char* CDECL DECLSPEC_HOTPATCH _strdup(const char* str) { if(str) { @@ -54,7 +54,7 @@ char* CDECL _strdup(const char* str) /********************************************************************* * _strlwr_s_l (MSVCRT.@) */ -int CDECL _strlwr_s_l(char *str, size_t len, _locale_t locale) +int CDECL DECLSPEC_HOTPATCH _strlwr_s_l(char *str, size_t len, _locale_t locale) { pthreadlocinfo locinfo; char *ptr = str; @@ -107,7 +107,7 @@ int CDECL _strlwr_s_l(char *str, size_t len, _locale_t locale) /********************************************************************* * _strlwr_s (MSVCRT.@) */ -int CDECL _strlwr_s(char *str, size_t len) +int CDECL DECLSPEC_HOTPATCH _strlwr_s(char *str, size_t len) { return _strlwr_s_l(str, len, NULL); } @@ -115,7 +115,7 @@ int CDECL _strlwr_s(char *str, size_t len) /********************************************************************* * _strlwr_l (MSVCRT.@) */ -char* CDECL _strlwr_l(char *str, _locale_t locale) +char* CDECL DECLSPEC_HOTPATCH _strlwr_l(char *str, _locale_t locale) { _strlwr_s_l(str, -1, locale); return str; @@ -124,7 +124,7 @@ char* CDECL _strlwr_l(char *str, _locale_t locale) /********************************************************************* * _strlwr (MSVCRT.@) */ -char* CDECL _strlwr(char *str) +char* CDECL DECLSPEC_HOTPATCH _strlwr(char *str) { _strlwr_s_l(str, -1, NULL); return str; @@ -133,7 +133,7 @@ char* CDECL _strlwr(char *str) /********************************************************************* * _strupr_s_l (MSVCRT.@) */ -int CDECL _strupr_s_l(char *str, size_t len, _locale_t locale) +int CDECL DECLSPEC_HOTPATCH _strupr_s_l(char *str, size_t len, _locale_t locale) { pthreadlocinfo locinfo; char *ptr = str; @@ -186,7 +186,7 @@ int CDECL _strupr_s_l(char *str, size_t len, _locale_t locale) /********************************************************************* * _strupr_s (MSVCRT.@) */ -int CDECL _strupr_s(char *str, size_t len) +int CDECL DECLSPEC_HOTPATCH _strupr_s(char *str, size_t len) { return _strupr_s_l(str, len, NULL); } @@ -194,7 +194,7 @@ int CDECL _strupr_s(char *str, size_t len) /********************************************************************* * _strupr_l (MSVCRT.@) */ -char* CDECL _strupr_l(char *str, _locale_t locale) +char* CDECL DECLSPEC_HOTPATCH _strupr_l(char *str, _locale_t locale) { _strupr_s_l(str, -1, locale); return str; @@ -203,7 +203,7 @@ char* CDECL _strupr_l(char *str, _locale_t locale) /********************************************************************* * _strupr (MSVCRT.@) */ -char* CDECL _strupr(char *str) +char* CDECL DECLSPEC_HOTPATCH _strupr(char *str) { _strupr_s_l(str, -1, NULL); return str; @@ -212,7 +212,7 @@ char* CDECL _strupr(char *str) /********************************************************************* * _strnset_s (MSVCRT.@) */ -int CDECL _strnset_s(char *str, size_t size, int c, size_t count) +int CDECL DECLSPEC_HOTPATCH _strnset_s(char *str, size_t size, int c, size_t count) { size_t i;
@@ -236,7 +236,7 @@ int CDECL _strnset_s(char *str, size_t size, int c, size_t count) /********************************************************************* * _strnset (MSVCRT.@) */ -char* CDECL _strnset(char* str, int value, size_t len) +char* CDECL DECLSPEC_HOTPATCH _strnset(char* str, int value, size_t len) { if (len > 0 && str) while (*str && len--) @@ -247,7 +247,7 @@ char* CDECL _strnset(char* str, int value, size_t len) /********************************************************************* * _strrev (MSVCRT.@) */ -char* CDECL _strrev(char* str) +char* CDECL DECLSPEC_HOTPATCH _strrev(char* str) { char * p1; char * p2; @@ -266,7 +266,7 @@ char* CDECL _strrev(char* str) /********************************************************************* * _strset (MSVCRT.@) */ -char* CDECL _strset(char* str, int value) +char* CDECL DECLSPEC_HOTPATCH _strset(char* str, int value) { char *ptr = str; while (*ptr) @@ -278,7 +278,7 @@ char* CDECL _strset(char* str, int value) /********************************************************************* * strtok (MSVCRT.@) */ -char * CDECL strtok( char *str, const char *delim ) +char * CDECL DECLSPEC_HOTPATCH strtok( char *str, const char *delim ) { thread_data_t *data = msvcrt_get_thread_data(); char *ret; @@ -302,7 +302,7 @@ char * CDECL strtok( char *str, const char *delim ) /********************************************************************* * strtok_s (MSVCRT.@) */ -char * CDECL strtok_s(char *str, const char *delim, char **ctx) +char * CDECL DECLSPEC_HOTPATCH strtok_s(char *str, const char *delim, char **ctx) { if (!MSVCRT_CHECK_PMT(delim != NULL)) return NULL; if (!MSVCRT_CHECK_PMT(ctx != NULL)) return NULL; @@ -331,7 +331,7 @@ char * CDECL strtok_s(char *str, const char *delim, char **ctx) /********************************************************************* * _swab (MSVCRT.@) */ -void CDECL _swab(char* src, char* dst, int len) +void CDECL DECLSPEC_HOTPATCH _swab(char* src, char* dst, int len) { if (len > 1) { @@ -1045,7 +1045,7 @@ static inline double strtod_helper(const char *str, char **end, _locale_t locale /********************************************************************* * _strtod_l (MSVCRT.@) */ -double CDECL _strtod_l(const char *str, char **end, _locale_t locale) +double CDECL DECLSPEC_HOTPATCH _strtod_l(const char *str, char **end, _locale_t locale) { return strtod_helper(str, end, locale, NULL); } @@ -1053,7 +1053,7 @@ double CDECL _strtod_l(const char *str, char **end, _locale_t locale) /********************************************************************* * strtod (MSVCRT.@) */ -double CDECL strtod( const char *str, char **end ) +double CDECL DECLSPEC_HOTPATCH strtod( const char *str, char **end ) { return _strtod_l( str, end, NULL ); } @@ -1063,7 +1063,7 @@ double CDECL strtod( const char *str, char **end ) /********************************************************************* * strtof_l (MSVCR120.@) */ -float CDECL _strtof_l( const char *str, char **end, _locale_t locale ) +float CDECL DECLSPEC_HOTPATCH _strtof_l( const char *str, char **end, _locale_t locale ) { double ret = _strtod_l(str, end, locale); if (ret && isfinite(ret)) { @@ -1077,7 +1077,7 @@ float CDECL _strtof_l( const char *str, char **end, _locale_t locale ) /********************************************************************* * strtof (MSVCR120.@) */ -float CDECL strtof( const char *str, char **end ) +float CDECL DECLSPEC_HOTPATCH strtof( const char *str, char **end ) { return _strtof_l(str, end, NULL); } @@ -1087,7 +1087,7 @@ float CDECL strtof( const char *str, char **end ) /********************************************************************* * atof (MSVCRT.@) */ -double CDECL atof( const char *str ) +double CDECL DECLSPEC_HOTPATCH atof( const char *str ) { return _strtod_l(str, NULL, NULL); } @@ -1095,7 +1095,7 @@ double CDECL atof( const char *str ) /********************************************************************* * _atof_l (MSVCRT.@) */ -double CDECL _atof_l( const char *str, _locale_t locale) +double CDECL DECLSPEC_HOTPATCH _atof_l( const char *str, _locale_t locale) { return _strtod_l(str, NULL, locale); } @@ -1103,7 +1103,7 @@ double CDECL _atof_l( const char *str, _locale_t locale) /********************************************************************* * _atoflt_l (MSVCRT.@) */ -int CDECL _atoflt_l(_CRT_FLOAT *value, char *str, _locale_t locale) +int CDECL DECLSPEC_HOTPATCH _atoflt_l(_CRT_FLOAT *value, char *str, _locale_t locale) { double d; int err; @@ -1120,7 +1120,7 @@ int CDECL _atoflt_l(_CRT_FLOAT *value, char *str, _locale_t locale) /********************************************************************* * _atoflt (MSVCR100.@) */ -int CDECL _atoflt(_CRT_FLOAT *value, char *str) +int CDECL DECLSPEC_HOTPATCH _atoflt(_CRT_FLOAT *value, char *str) { return _atoflt_l(value, str, NULL); } @@ -1128,7 +1128,7 @@ int CDECL _atoflt(_CRT_FLOAT *value, char *str) /********************************************************************* * _atodbl_l (MSVCRT.@) */ -int CDECL _atodbl_l(_CRT_DOUBLE *value, char *str, _locale_t locale) +int CDECL DECLSPEC_HOTPATCH _atodbl_l(_CRT_DOUBLE *value, char *str, _locale_t locale) { int err;
@@ -1143,7 +1143,7 @@ int CDECL _atodbl_l(_CRT_DOUBLE *value, char *str, _locale_t locale) /********************************************************************* * _atodbl (MSVCRT.@) */ -int CDECL _atodbl(_CRT_DOUBLE *value, char *str) +int CDECL DECLSPEC_HOTPATCH _atodbl(_CRT_DOUBLE *value, char *str) { return _atodbl_l(value, str, NULL); } @@ -1151,7 +1151,7 @@ int CDECL _atodbl(_CRT_DOUBLE *value, char *str) /********************************************************************* * _strcoll_l (MSVCRT.@) */ -int CDECL _strcoll_l( const char* str1, const char* str2, _locale_t locale ) +int CDECL DECLSPEC_HOTPATCH _strcoll_l( const char* str1, const char* str2, _locale_t locale ) { pthreadlocinfo locinfo;
@@ -1168,7 +1168,7 @@ int CDECL _strcoll_l( const char* str1, const char* str2, _locale_t locale ) /********************************************************************* * strcoll (MSVCRT.@) */ -int CDECL strcoll( const char* str1, const char* str2 ) +int CDECL DECLSPEC_HOTPATCH strcoll( const char* str1, const char* str2 ) { return _strcoll_l(str1, str2, NULL); } @@ -1176,7 +1176,7 @@ int CDECL strcoll( const char* str1, const char* str2 ) /********************************************************************* * _stricoll_l (MSVCRT.@) */ -int CDECL _stricoll_l( const char* str1, const char* str2, _locale_t locale ) +int CDECL DECLSPEC_HOTPATCH _stricoll_l( const char* str1, const char* str2, _locale_t locale ) { pthreadlocinfo locinfo;
@@ -1194,7 +1194,7 @@ int CDECL _stricoll_l( const char* str1, const char* str2, _locale_t locale ) /********************************************************************* * _stricoll (MSVCRT.@) */ -int CDECL _stricoll( const char* str1, const char* str2 ) +int CDECL DECLSPEC_HOTPATCH _stricoll( const char* str1, const char* str2 ) { return _stricoll_l(str1, str2, NULL); } @@ -1202,7 +1202,7 @@ int CDECL _stricoll( const char* str1, const char* str2 ) /********************************************************************* * _strncoll_l (MSVCRT.@) */ -int CDECL _strncoll_l( const char* str1, const char* str2, size_t count, _locale_t locale ) +int CDECL DECLSPEC_HOTPATCH _strncoll_l( const char* str1, const char* str2, size_t count, _locale_t locale ) { pthreadlocinfo locinfo;
@@ -1221,7 +1221,7 @@ int CDECL _strncoll_l( const char* str1, const char* str2, size_t count, _locale /********************************************************************* * _strncoll (MSVCRT.@) */ -int CDECL _strncoll( const char* str1, const char* str2, size_t count ) +int CDECL DECLSPEC_HOTPATCH _strncoll( const char* str1, const char* str2, size_t count ) { return _strncoll_l(str1, str2, count, NULL); } @@ -1229,7 +1229,7 @@ int CDECL _strncoll( const char* str1, const char* str2, size_t count ) /********************************************************************* * _strnicoll_l (MSVCRT.@) */ -int CDECL _strnicoll_l( const char* str1, const char* str2, size_t count, _locale_t locale ) +int CDECL DECLSPEC_HOTPATCH _strnicoll_l( const char* str1, const char* str2, size_t count, _locale_t locale ) { pthreadlocinfo locinfo;
@@ -1248,7 +1248,7 @@ int CDECL _strnicoll_l( const char* str1, const char* str2, size_t count, _local /********************************************************************* * _strnicoll (MSVCRT.@) */ -int CDECL _strnicoll( const char* str1, const char* str2, size_t count ) +int CDECL DECLSPEC_HOTPATCH _strnicoll( const char* str1, const char* str2, size_t count ) { return _strnicoll_l(str1, str2, count, NULL); } @@ -1256,7 +1256,7 @@ int CDECL _strnicoll( const char* str1, const char* str2, size_t count ) /********************************************************************* * strncpy (MSVCRT.@) */ -char* __cdecl strncpy(char *dst, const char *src, size_t len) +char* __cdecl DECLSPEC_HOTPATCH strncpy(char *dst, const char *src, size_t len) { size_t i;
@@ -1271,7 +1271,7 @@ char* __cdecl strncpy(char *dst, const char *src, size_t len) /********************************************************************* * strcpy (MSVCRT.@) */ -char* CDECL strcpy(char *dst, const char *src) +char* CDECL DECLSPEC_HOTPATCH strcpy(char *dst, const char *src) { char *ret = dst; while ((*dst++ = *src++)); @@ -1281,7 +1281,7 @@ char* CDECL strcpy(char *dst, const char *src) /********************************************************************* * strcpy_s (MSVCRT.@) */ -int CDECL strcpy_s( char* dst, size_t elem, const char* src ) +int CDECL DECLSPEC_HOTPATCH strcpy_s( char* dst, size_t elem, const char* src ) { size_t i; if(!elem) return EINVAL; @@ -1303,7 +1303,7 @@ int CDECL strcpy_s( char* dst, size_t elem, const char* src ) /********************************************************************* * strcat_s (MSVCRT.@) */ -int CDECL strcat_s( char* dst, size_t elem, const char* src ) +int CDECL DECLSPEC_HOTPATCH strcat_s( char* dst, size_t elem, const char* src ) { size_t i, j; if(!dst) return EINVAL; @@ -1332,7 +1332,7 @@ int CDECL strcat_s( char* dst, size_t elem, const char* src ) /********************************************************************* * strcat (MSVCRT.@) */ -char* __cdecl strcat( char *dst, const char *src ) +char* __cdecl DECLSPEC_HOTPATCH strcat( char *dst, const char *src ) { char *d = dst; while (*d) d++; @@ -1343,7 +1343,7 @@ char* __cdecl strcat( char *dst, const char *src ) /********************************************************************* * strncat_s (MSVCRT.@) */ -int CDECL strncat_s( char* dst, size_t elem, const char* src, size_t count ) +int CDECL DECLSPEC_HOTPATCH strncat_s( char* dst, size_t elem, const char* src, size_t count ) { size_t i, j;
@@ -1382,7 +1382,7 @@ int CDECL strncat_s( char* dst, size_t elem, const char* src, size_t count ) /********************************************************************* * strncat (MSVCRT.@) */ -char* __cdecl strncat(char *dst, const char *src, size_t len) +char* __cdecl DECLSPEC_HOTPATCH strncat(char *dst, const char *src, size_t len) { char *d = dst; while (*d) d++; @@ -1394,7 +1394,7 @@ char* __cdecl strncat(char *dst, const char *src, size_t len) /********************************************************************* * _strxfrm_l (MSVCRT.@) */ -size_t CDECL _strxfrm_l( char *dest, const char *src, +size_t CDECL DECLSPEC_HOTPATCH _strxfrm_l( char *dest, const char *src, size_t len, _locale_t locale ) { pthreadlocinfo locinfo; @@ -1440,7 +1440,7 @@ size_t CDECL _strxfrm_l( char *dest, const char *src, /********************************************************************* * strxfrm (MSVCRT.@) */ -size_t CDECL strxfrm( char *dest, const char *src, size_t len ) +size_t CDECL DECLSPEC_HOTPATCH strxfrm( char *dest, const char *src, size_t len ) { return _strxfrm_l(dest, src, len, NULL); } @@ -1448,7 +1448,7 @@ size_t CDECL strxfrm( char *dest, const char *src, size_t len ) /******************************************************************** * __STRINGTOLD_L (MSVCR80.@) */ -int CDECL __STRINGTOLD_L( MSVCRT__LDOUBLE *value, char **endptr, +int CDECL DECLSPEC_HOTPATCH __STRINGTOLD_L( MSVCRT__LDOUBLE *value, char **endptr, const char *str, int flags, _locale_t locale ) { pthreadlocinfo locinfo; @@ -1480,7 +1480,7 @@ int CDECL __STRINGTOLD_L( MSVCRT__LDOUBLE *value, char **endptr, /******************************************************************** * __STRINGTOLD (MSVCRT.@) */ -int CDECL __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str, int flags ) +int CDECL DECLSPEC_HOTPATCH __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str, int flags ) { return __STRINGTOLD_L( value, endptr, str, flags, NULL ); } @@ -1488,7 +1488,7 @@ int CDECL __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str, /******************************************************************** * _atoldbl_l (MSVCRT.@) */ -int CDECL _atoldbl_l( MSVCRT__LDOUBLE *value, char *str, _locale_t locale ) +int CDECL DECLSPEC_HOTPATCH _atoldbl_l( MSVCRT__LDOUBLE *value, char *str, _locale_t locale ) { char *endptr; switch(__STRINGTOLD_L( value, &endptr, str, 0, locale )) @@ -1502,7 +1502,7 @@ int CDECL _atoldbl_l( MSVCRT__LDOUBLE *value, char *str, _locale_t locale ) /******************************************************************** * _atoldbl (MSVCRT.@) */ -int CDECL _atoldbl(_LDOUBLE *value, char *str) +int CDECL DECLSPEC_HOTPATCH _atoldbl(_LDOUBLE *value, char *str) { return _atoldbl_l( (MSVCRT__LDOUBLE*)value, str, NULL ); } @@ -1510,7 +1510,7 @@ int CDECL _atoldbl(_LDOUBLE *value, char *str) /********************************************************************* * strlen (MSVCRT.@) */ -size_t __cdecl strlen(const char *str) +size_t __cdecl DECLSPEC_HOTPATCH strlen(const char *str) { const char *s = str; while (*s) s++; @@ -1520,7 +1520,7 @@ size_t __cdecl strlen(const char *str) /****************************************************************** * strnlen (MSVCRT.@) */ -size_t CDECL strnlen(const char *s, size_t maxlen) +size_t CDECL DECLSPEC_HOTPATCH strnlen(const char *s, size_t maxlen) { size_t i;
@@ -1535,7 +1535,7 @@ size_t CDECL strnlen(const char *s, size_t maxlen) * * FIXME: locale parameter is ignored */ -__int64 CDECL _strtoi64_l(const char *nptr, char **endptr, int base, _locale_t locale) +__int64 CDECL DECLSPEC_HOTPATCH _strtoi64_l(const char *nptr, char **endptr, int base, _locale_t locale) { const char *p = nptr; BOOL negative = FALSE; @@ -1607,7 +1607,7 @@ __int64 CDECL _strtoi64_l(const char *nptr, char **endptr, int base, _locale_t l /********************************************************************* * _strtoi64 (MSVCRT.@) */ -__int64 CDECL _strtoi64(const char *nptr, char **endptr, int base) +__int64 CDECL DECLSPEC_HOTPATCH _strtoi64(const char *nptr, char **endptr, int base) { return _strtoi64_l(nptr, endptr, base, NULL); } @@ -1615,7 +1615,7 @@ __int64 CDECL _strtoi64(const char *nptr, char **endptr, int base) /********************************************************************* * _atoi_l (MSVCRT.@) */ -int __cdecl _atoi_l(const char *str, _locale_t locale) +int __cdecl DECLSPEC_HOTPATCH _atoi_l(const char *str, _locale_t locale) { __int64 ret = _strtoi64_l(str, NULL, 10, locale);
@@ -1633,7 +1633,7 @@ int __cdecl _atoi_l(const char *str, _locale_t locale) * atoi (MSVCRT.@) */ #if _MSVCR_VER == 0 -int __cdecl atoi(const char *str) +int __cdecl DECLSPEC_HOTPATCH atoi(const char *str) { BOOL minus = FALSE; int ret = 0; @@ -1658,7 +1658,7 @@ int __cdecl atoi(const char *str) return minus ? -ret : ret; } #else -int CDECL atoi(const char *str) +int CDECL DECLSPEC_HOTPATCH atoi(const char *str) { return _atoi_l(str, NULL); } @@ -1667,7 +1667,7 @@ int CDECL atoi(const char *str) /****************************************************************** * _atoi64_l (MSVCRT.@) */ -__int64 CDECL _atoi64_l(const char *str, _locale_t locale) +__int64 CDECL DECLSPEC_HOTPATCH _atoi64_l(const char *str, _locale_t locale) { return _strtoi64_l(str, NULL, 10, locale); } @@ -1675,7 +1675,7 @@ __int64 CDECL _atoi64_l(const char *str, _locale_t locale) /****************************************************************** * _atoi64 (MSVCRT.@) */ -__int64 CDECL _atoi64(const char *str) +__int64 CDECL DECLSPEC_HOTPATCH _atoi64(const char *str) { return _strtoi64_l(str, NULL, 10, NULL); } @@ -1683,7 +1683,7 @@ __int64 CDECL _atoi64(const char *str) /****************************************************************** * _atol_l (MSVCRT.@) */ -__msvcrt_long CDECL _atol_l(const char *str, _locale_t locale) +__msvcrt_long CDECL DECLSPEC_HOTPATCH _atol_l(const char *str, _locale_t locale) { __int64 ret = _strtoi64_l(str, NULL, 10, locale);
@@ -1700,7 +1700,7 @@ __msvcrt_long CDECL _atol_l(const char *str, _locale_t locale) /****************************************************************** * atol (MSVCRT.@) */ -__msvcrt_long CDECL atol(const char *str) +__msvcrt_long CDECL DECLSPEC_HOTPATCH atol(const char *str) { #if _MSVCR_VER == 0 return atoi(str); @@ -1714,7 +1714,7 @@ __msvcrt_long CDECL atol(const char *str) /****************************************************************** * _atoll_l (MSVCR120.@) */ -__int64 CDECL _atoll_l(const char* str, _locale_t locale) +__int64 CDECL DECLSPEC_HOTPATCH _atoll_l(const char* str, _locale_t locale) { return _strtoi64_l(str, NULL, 10, locale); } @@ -1722,7 +1722,7 @@ __int64 CDECL _atoll_l(const char* str, _locale_t locale) /****************************************************************** * atoll (MSVCR120.@) */ -__int64 CDECL atoll(const char* str) +__int64 CDECL DECLSPEC_HOTPATCH atoll(const char* str) { return _atoll_l(str, NULL); } @@ -1732,7 +1732,7 @@ __int64 CDECL atoll(const char* str) /****************************************************************** * _strtol_l (MSVCRT.@) */ -__msvcrt_long CDECL _strtol_l(const char* nptr, +__msvcrt_long CDECL DECLSPEC_HOTPATCH _strtol_l(const char* nptr, char** end, int base, _locale_t locale) { __int64 ret = _strtoi64_l(nptr, end, base, locale); @@ -1751,7 +1751,7 @@ __msvcrt_long CDECL _strtol_l(const char* nptr, /****************************************************************** * strtol (MSVCRT.@) */ -__msvcrt_long CDECL strtol(const char* nptr, char** end, int base) +__msvcrt_long CDECL DECLSPEC_HOTPATCH strtol(const char* nptr, char** end, int base) { return _strtol_l(nptr, end, base, NULL); } @@ -1759,7 +1759,7 @@ __msvcrt_long CDECL strtol(const char* nptr, char** end, int base) /****************************************************************** * _strtoul_l (MSVCRT.@) */ -__msvcrt_ulong CDECL _strtoul_l(const char* nptr, char** end, int base, _locale_t locale) +__msvcrt_ulong CDECL DECLSPEC_HOTPATCH _strtoul_l(const char* nptr, char** end, int base, _locale_t locale) { __int64 ret = _strtoi64_l(nptr, end, base, locale);
@@ -1777,7 +1777,7 @@ __msvcrt_ulong CDECL _strtoul_l(const char* nptr, char** end, int base, _locale_ /****************************************************************** * strtoul (MSVCRT.@) */ -__msvcrt_ulong CDECL strtoul(const char* nptr, char** end, int base) +__msvcrt_ulong CDECL DECLSPEC_HOTPATCH strtoul(const char* nptr, char** end, int base) { return _strtoul_l(nptr, end, base, NULL); } @@ -1787,7 +1787,7 @@ __msvcrt_ulong CDECL strtoul(const char* nptr, char** end, int base) * * FIXME: locale parameter is ignored */ -unsigned __int64 CDECL _strtoui64_l(const char *nptr, char **endptr, int base, _locale_t locale) +unsigned __int64 CDECL DECLSPEC_HOTPATCH _strtoui64_l(const char *nptr, char **endptr, int base, _locale_t locale) { const char *p = nptr; BOOL negative = FALSE; @@ -1853,7 +1853,7 @@ unsigned __int64 CDECL _strtoui64_l(const char *nptr, char **endptr, int base, _ /********************************************************************* * _strtoui64 (MSVCRT.@) */ -unsigned __int64 CDECL _strtoui64(const char *nptr, char **endptr, int base) +unsigned __int64 CDECL DECLSPEC_HOTPATCH _strtoui64(const char *nptr, char **endptr, int base) { return _strtoui64_l(nptr, endptr, base, NULL); } @@ -1989,7 +1989,7 @@ static int ltow_helper(__msvcrt_long value, wchar_t *str, size_t size, int radix /********************************************************************* * _ltoa_s (MSVCRT.@) */ -int CDECL _ltoa_s(__msvcrt_long value, char *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _ltoa_s(__msvcrt_long value, char *str, size_t size, int radix) { if (!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL; if (!MSVCRT_CHECK_PMT(size > 0)) return EINVAL; @@ -2005,7 +2005,7 @@ int CDECL _ltoa_s(__msvcrt_long value, char *str, size_t size, int radix) /********************************************************************* * _ltow_s (MSVCRT.@) */ -int CDECL _ltow_s(__msvcrt_long value, wchar_t *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _ltow_s(__msvcrt_long value, wchar_t *str, size_t size, int radix) { if (!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL; if (!MSVCRT_CHECK_PMT(size > 0)) return EINVAL; @@ -2021,7 +2021,7 @@ int CDECL _ltow_s(__msvcrt_long value, wchar_t *str, size_t size, int radix) /********************************************************************* * _itoa_s (MSVCRT.@) */ -int CDECL _itoa_s(int value, char *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _itoa_s(int value, char *str, size_t size, int radix) { return _ltoa_s(value, str, size, radix); } @@ -2029,7 +2029,7 @@ int CDECL _itoa_s(int value, char *str, size_t size, int radix) /********************************************************************* * _itoa (MSVCRT.@) */ -char* CDECL _itoa(int value, char *str, int radix) +char* CDECL DECLSPEC_HOTPATCH _itoa(int value, char *str, int radix) { return ltoa_helper(value, str, SIZE_MAX, radix) ? NULL : str; } @@ -2045,7 +2045,7 @@ char* CDECL _ltoa(__msvcrt_long value, char *str, int radix) /********************************************************************* * _itow_s (MSVCRT.@) */ -int CDECL _itow_s(int value, wchar_t *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _itow_s(int value, wchar_t *str, size_t size, int radix) { return _ltow_s(value, str, size, radix); } @@ -2249,7 +2249,7 @@ wchar_t* CDECL _i64tow(__int64 value, wchar_t *str, int radix) /********************************************************************* * _ui64toa_s (MSVCRT.@) */ -int CDECL _ui64toa_s(unsigned __int64 value, char *str, +int CDECL DECLSPEC_HOTPATCH _ui64toa_s(unsigned __int64 value, char *str, size_t size, int radix) { char buffer[65], *pos; @@ -2288,7 +2288,7 @@ int CDECL _ui64toa_s(unsigned __int64 value, char *str, /********************************************************************* * _ui64tow_s (MSVCRT.@) */ -int CDECL _ui64tow_s( unsigned __int64 value, wchar_t *str, +int CDECL DECLSPEC_HOTPATCH _ui64tow_s( unsigned __int64 value, wchar_t *str, size_t size, int radix ) { wchar_t buffer[65], *pos; @@ -2326,7 +2326,7 @@ int CDECL _ui64tow_s( unsigned __int64 value, wchar_t *str, /********************************************************************* * _ultoa_s (MSVCRT.@) */ -int CDECL _ultoa_s(__msvcrt_ulong value, char *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _ultoa_s(__msvcrt_ulong value, char *str, size_t size, int radix) { __msvcrt_ulong digit; char buffer[33], *pos; @@ -2380,7 +2380,7 @@ int CDECL _ultoa_s(__msvcrt_ulong value, char *str, size_t size, int radix) /********************************************************************* * _ultow_s (MSVCRT.@) */ -int CDECL _ultow_s(__msvcrt_ulong value, wchar_t *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _ultow_s(__msvcrt_ulong value, wchar_t *str, size_t size, int radix) { __msvcrt_ulong digit; WCHAR buffer[33], *pos; @@ -2434,7 +2434,7 @@ int CDECL _ultow_s(__msvcrt_ulong value, wchar_t *str, size_t size, int radix) /********************************************************************* * _i64toa_s (MSVCRT.@) */ -int CDECL _i64toa_s(__int64 value, char *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _i64toa_s(__int64 value, char *str, size_t size, int radix) { unsigned __int64 val; unsigned int digit; @@ -2509,7 +2509,7 @@ int CDECL _i64toa_s(__int64 value, char *str, size_t size, int radix) /********************************************************************* * _i64tow_s (MSVCRT.@) */ -int CDECL _i64tow_s(__int64 value, wchar_t *str, size_t size, int radix) +int CDECL DECLSPEC_HOTPATCH _i64tow_s(__int64 value, wchar_t *str, size_t size, int radix) { unsigned __int64 val; unsigned int digit; @@ -2605,7 +2605,7 @@ struct _I10_OUTPUT_DATA { * Native sets last byte of data->str to '0' or '9', I don't know what * it means. Current implementation sets it always to '0'. */ -int CDECL I10_OUTPUT(MSVCRT__LDOUBLE ld80, int prec, int flag, struct _I10_OUTPUT_DATA *data) +int CDECL DECLSPEC_HOTPATCH I10_OUTPUT(MSVCRT__LDOUBLE ld80, int prec, int flag, struct _I10_OUTPUT_DATA *data) { struct fpnum num; double d; @@ -2678,7 +2678,7 @@ int CDECL I10_OUTPUT(MSVCRT__LDOUBLE ld80, int prec, int flag, struct _I10_OUTPU /********************************************************************* * memcmp (MSVCRT.@) */ -int __cdecl memcmp(const void *ptr1, const void *ptr2, size_t n) +int __cdecl DECLSPEC_HOTPATCH memcmp(const void *ptr1, const void *ptr2, size_t n) { const unsigned char *p1, *p2;
@@ -2738,7 +2738,7 @@ int __cdecl memcmp(const void *ptr1, const void *ptr2, size_t n) __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t") #endif
-void * __cdecl sse2_memmove(void *dst, const void *src, size_t n); +void * __cdecl DECLSPEC_HOTPATCH sse2_memmove(void *dst, const void *src, size_t n); __ASM_GLOBAL_FUNC( sse2_memmove, MEMMOVE_INIT "mov " DEST_REG ", " TMP_REG "\n\t" /* check copying direction */ @@ -2951,7 +2951,7 @@ __ASM_GLOBAL_FUNC( sse2_memmove, #else # define MERGE(w1, sh1, w2, sh2) ((w1 >> sh1) | (w2 << sh2)) #endif -void * __cdecl memmove(void *dst, const void *src, size_t n) +void * __cdecl DECLSPEC_HOTPATCH memmove(void *dst, const void *src, size_t n) { #ifdef __x86_64__ return sse2_memmove(dst, src, n); @@ -3059,7 +3059,7 @@ void * __cdecl memmove(void *dst, const void *src, size_t n) /********************************************************************* * memcpy (MSVCRT.@) */ -void * __cdecl memcpy(void *dst, const void *src, size_t n) +void * __cdecl DECLSPEC_HOTPATCH memcpy(void *dst, const void *src, size_t n) { return memmove(dst, src, n); } @@ -3092,7 +3092,7 @@ static inline void memset_aligned_32(unsigned char *d, uint64_t v, size_t n) /********************************************************************* * memset (MSVCRT.@) */ -void *__cdecl memset(void *dst, int c, size_t n) +void* __cdecl DECLSPEC_HOTPATCH memset(void *dst, int c, size_t n) { typedef uint64_t DECLSPEC_ALIGN(1) unaligned_ui64; typedef uint32_t DECLSPEC_ALIGN(1) unaligned_ui32; @@ -3148,7 +3148,7 @@ void *__cdecl memset(void *dst, int c, size_t n) /********************************************************************* * strchr (MSVCRT.@) */ -char* __cdecl strchr(const char *str, int c) +char* __cdecl DECLSPEC_HOTPATCH strchr(const char *str, int c) { do { @@ -3160,7 +3160,7 @@ char* __cdecl strchr(const char *str, int c) /********************************************************************* * strrchr (MSVCRT.@) */ -char* __cdecl strrchr(const char *str, int c) +char* __cdecl DECLSPEC_HOTPATCH strrchr(const char *str, int c) { char *ret = NULL; do { if (*str == (char)c) ret = (char*)str; } while (*str++); @@ -3170,7 +3170,7 @@ char* __cdecl strrchr(const char *str, int c) /********************************************************************* * memchr (MSVCRT.@) */ -void* __cdecl memchr(const void *ptr, int c, size_t n) +void* __cdecl DECLSPEC_HOTPATCH memchr(const void *ptr, int c, size_t n) { const unsigned char *p = ptr;
@@ -3181,7 +3181,7 @@ void* __cdecl memchr(const void *ptr, int c, size_t n) /********************************************************************* * strcmp (MSVCRT.@) */ -int __cdecl strcmp(const char *str1, const char *str2) +int __cdecl DECLSPEC_HOTPATCH strcmp(const char *str1, const char *str2) { while (*str1 && *str1 == *str2) { str1++; str2++; } if ((unsigned char)*str1 > (unsigned char)*str2) return 1; @@ -3192,7 +3192,7 @@ int __cdecl strcmp(const char *str1, const char *str2) /********************************************************************* * strncmp (MSVCRT.@) */ -int __cdecl strncmp(const char *str1, const char *str2, size_t len) +int __cdecl DECLSPEC_HOTPATCH strncmp(const char *str1, const char *str2, size_t len) { if (!len) return 0; while (--len && *str1 && *str1 == *str2) { str1++; str2++; } @@ -3202,7 +3202,7 @@ int __cdecl strncmp(const char *str1, const char *str2, size_t len) /********************************************************************* * _strnicmp_l (MSVCRT.@) */ -int __cdecl _strnicmp_l(const char *s1, const char *s2, +int __cdecl DECLSPEC_HOTPATCH _strnicmp_l(const char *s1, const char *s2, size_t count, _locale_t locale) { pthreadlocinfo locinfo; @@ -3242,7 +3242,7 @@ int __cdecl _strnicmp_l(const char *s1, const char *s2, /********************************************************************* * _stricmp_l (MSVCRT.@) */ -int __cdecl _stricmp_l(const char *s1, const char *s2, _locale_t locale) +int __cdecl DECLSPEC_HOTPATCH _stricmp_l(const char *s1, const char *s2, _locale_t locale) { return _strnicmp_l(s1, s2, -1, locale); } @@ -3250,7 +3250,7 @@ int __cdecl _stricmp_l(const char *s1, const char *s2, _locale_t locale) /********************************************************************* * _strnicmp (MSVCRT.@) */ -int __cdecl _strnicmp(const char *s1, const char *s2, size_t count) +int __cdecl DECLSPEC_HOTPATCH _strnicmp(const char *s1, const char *s2, size_t count) { return _strnicmp_l(s1, s2, count, NULL); } @@ -3258,7 +3258,7 @@ int __cdecl _strnicmp(const char *s1, const char *s2, size_t count) /********************************************************************* * _stricmp (MSVCRT.@) */ -int __cdecl _stricmp(const char *s1, const char *s2) +int __cdecl DECLSPEC_HOTPATCH _stricmp(const char *s1, const char *s2) { return _strnicmp_l(s1, s2, -1, NULL); } @@ -3266,7 +3266,7 @@ int __cdecl _stricmp(const char *s1, const char *s2) /********************************************************************* * strstr (MSVCRT.@) */ -char* __cdecl strstr(const char *haystack, const char *needle) +char* __cdecl DECLSPEC_HOTPATCH strstr(const char *haystack, const char *needle) { size_t i, j, len, needle_len, lps_len; BYTE lps[256]; @@ -3309,7 +3309,7 @@ char* __cdecl strstr(const char *haystack, const char *needle) /********************************************************************* * _memicmp_l (MSVCRT.@) */ -int __cdecl _memicmp_l(const void *v1, const void *v2, size_t len, _locale_t locale) +int __cdecl DECLSPEC_HOTPATCH _memicmp_l(const void *v1, const void *v2, size_t len, _locale_t locale) { const char *s1 = v1, *s2 = v2; int ret = 0; @@ -3336,7 +3336,7 @@ int __cdecl _memicmp_l(const void *v1, const void *v2, size_t len, _locale_t loc /********************************************************************* * _memicmp (MSVCRT.@) */ -int __cdecl _memicmp(const void *s1, const void *s2, size_t len) +int __cdecl DECLSPEC_HOTPATCH _memicmp(const void *s1, const void *s2, size_t len) { return _memicmp_l(s1, s2, len, NULL); } @@ -3344,7 +3344,7 @@ int __cdecl _memicmp(const void *s1, const void *s2, size_t len) /********************************************************************* * strcspn (MSVCRT.@) */ -size_t __cdecl strcspn(const char *str, const char *reject) +size_t __cdecl DECLSPEC_HOTPATCH strcspn(const char *str, const char *reject) { BOOL rejects[256]; const char *p; @@ -3376,7 +3376,7 @@ size_t __cdecl strspn(const char *str, const char *accept) /********************************************************************* * strpbrk (MSVCRT.@) */ -char* __cdecl strpbrk(const char *str, const char *accept) +char* __cdecl DECLSPEC_HOTPATCH strpbrk(const char *str, const char *accept) { for (; *str; str++) if (strchr( accept, *str )) return (char*)str; return NULL; @@ -3385,7 +3385,7 @@ char* __cdecl strpbrk(const char *str, const char *accept) /********************************************************************* * __strncnt (MSVCRT.@) */ -size_t __cdecl __strncnt(const char *str, size_t size) +size_t __cdecl DECLSPEC_HOTPATCH __strncnt(const char *str, size_t size) { size_t ret = 0;
@@ -3406,7 +3406,7 @@ size_t __cdecl __strncnt(const char *str, size_t size) /********************************************************************* * _strdec (CRTDLL.@) */ -char * CDECL _strdec(const char *str1, const char *str2) +char * CDECL DECLSPEC_HOTPATCH _strdec(const char *str1, const char *str2) { return (char *)(str2 - 1); } @@ -3414,7 +3414,7 @@ char * CDECL _strdec(const char *str1, const char *str2) /********************************************************************* * _strinc (CRTDLL.@) */ -char * CDECL _strinc(const char *str) +char * CDECL DECLSPEC_HOTPATCH _strinc(const char *str) { return (char *)(str + 1); } @@ -3422,7 +3422,7 @@ char * CDECL _strinc(const char *str) /********************************************************************* * _strnextc (CRTDLL.@) */ -unsigned int CDECL _strnextc(const char *str) +unsigned int CDECL DECLSPEC_HOTPATCH _strnextc(const char *str) { return (unsigned char)str[0]; } @@ -3430,7 +3430,7 @@ unsigned int CDECL _strnextc(const char *str) /********************************************************************* * _strninc (CRTDLL.@) */ -char * CDECL _strninc(const char *str, size_t len) +char * CDECL DECLSPEC_HOTPATCH _strninc(const char *str, size_t len) { return (char *)(str + len); } @@ -3438,7 +3438,7 @@ char * CDECL _strninc(const char *str, size_t len) /********************************************************************* * _strspnp (CRTDLL.@) */ -char * CDECL _strspnp( const char *str1, const char *str2) +char * CDECL DECLSPEC_HOTPATCH _strspnp( const char *str1, const char *str2) { str1 += strspn( str1, str2 ); return *str1 ? (char*)str1 : NULL;
On 12/8/21 14:55, Roman Pišl wrote:
This fixes LLVM ASAN an the ASAN then works as expected with Wine. Would something like this be acceptable for upstream?
Adding DECLSPEC_HOTPATCH to so many short and frequently called functions looks rather unfortunate, it prevents some optimizations. Is it maybe possible to check with LLVM ASAN code what does it really want from these functions, does it expect exactly ms hook prologue or maybe (probably?) not necessarily but something else around the function start breaks it?