From 300e1d525dbba65ab05e8a0b895baa007202c9fe Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Sun, 14 Jun 2026 00:10:15 +0900 Subject: [PATCH] [MSVCRT][CRT][UCRT] Disable intrinsic string functions on MSVC (#9157) VS2022 version 17.2 and later (`_MSC_VER >= 1932`) added new intrinsic functions (`strncmp`, `strncpy`, `wcsncmp`, and `wcsncpy`). As we implement these ourselves, we have to avoid compiler error C2169. This problem surfaced with a recent GitHub Actions update: https://github.com/actions/runner-images/issues/14017 Use `#pragma function(...)` to disable new intrinsic functions. --- dll/win32/msvcrt/string.c | 5 +++++ dll/win32/msvcrt/wcs.c | 5 +++++ sdk/lib/crt/string/tcsncmp.h | 2 +- sdk/lib/crt/string/tcsncpy.h | 2 +- sdk/lib/ucrt/string/strncmp.c | 2 +- sdk/lib/ucrt/string/strncpy.c | 2 +- sdk/lib/ucrt/string/wcsncmp.cpp | 2 +- sdk/lib/ucrt/string/wcsncpy.cpp | 2 +- 8 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dll/win32/msvcrt/string.c b/dll/win32/msvcrt/string.c index 0c2242995a1..5eca436fb8b 100644 --- a/dll/win32/msvcrt/string.c +++ b/dll/win32/msvcrt/string.c @@ -38,6 +38,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); #ifdef _MSC_VER #pragma function(_strset,memchr,memcmp,memcpy,memset,strcat,strcmp,strcpy,strlen) +#ifdef __REACTOS__ +#if defined(_M_ARM) || _MSC_VER >= 1932 // VS2022 version 17.2 and later +#pragma function(strncmp,strncpy) +#endif +#endif #endif /********************************************************************* diff --git a/dll/win32/msvcrt/wcs.c b/dll/win32/msvcrt/wcs.c index a7dbb59d11c..d42c5d43ab6 100644 --- a/dll/win32/msvcrt/wcs.c +++ b/dll/win32/msvcrt/wcs.c @@ -35,6 +35,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); #ifdef _MSC_VER #pragma function(_wcsset,wcscat,wcscmp,wcscpy,wcslen) +#ifdef __REACTOS__ +#if defined(_M_ARM) || _MSC_VER >= 1932 // VS2022 version 17.2 and later +#pragma function(wcsncmp,wcsncpy) +#endif +#endif #endif typedef struct diff --git a/sdk/lib/crt/string/tcsncmp.h b/sdk/lib/crt/string/tcsncmp.h index 68c7f6355aa..fbf0e2ae356 100644 --- a/sdk/lib/crt/string/tcsncmp.h +++ b/sdk/lib/crt/string/tcsncmp.h @@ -2,7 +2,7 @@ #include #include -#if defined(_MSC_VER) && defined(_M_ARM) +#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later #pragma function(_tcsncmp) #endif /* _MSC_VER */ diff --git a/sdk/lib/crt/string/tcsncpy.h b/sdk/lib/crt/string/tcsncpy.h index ea4caf68dbd..e70a7497fff 100644 --- a/sdk/lib/crt/string/tcsncpy.h +++ b/sdk/lib/crt/string/tcsncpy.h @@ -2,7 +2,7 @@ #include #include -#if defined(_MSC_VER) && defined(_M_ARM) +#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later #pragma function(_tcsncpy) #endif /* _MSC_VER */ diff --git a/sdk/lib/ucrt/string/strncmp.c b/sdk/lib/ucrt/string/strncmp.c index 63ca5859441..85bc18c851a 100644 --- a/sdk/lib/ucrt/string/strncmp.c +++ b/sdk/lib/ucrt/string/strncmp.c @@ -11,7 +11,7 @@ #include -#ifdef _M_ARM +#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later #pragma function(strncmp) #endif diff --git a/sdk/lib/ucrt/string/strncpy.c b/sdk/lib/ucrt/string/strncpy.c index 4871246c427..7aa0344b310 100644 --- a/sdk/lib/ucrt/string/strncpy.c +++ b/sdk/lib/ucrt/string/strncpy.c @@ -10,7 +10,7 @@ #include -#if defined _M_ARM +#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later #pragma function(strncpy) #endif diff --git a/sdk/lib/ucrt/string/wcsncmp.cpp b/sdk/lib/ucrt/string/wcsncmp.cpp index 29a788bca96..3e464c6b12c 100644 --- a/sdk/lib/ucrt/string/wcsncmp.cpp +++ b/sdk/lib/ucrt/string/wcsncmp.cpp @@ -19,7 +19,7 @@ -#ifdef _M_ARM +#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later #pragma function(wcsncmp) #endif diff --git a/sdk/lib/ucrt/string/wcsncpy.cpp b/sdk/lib/ucrt/string/wcsncpy.cpp index 8f9779c242d..cdbb8abd1dd 100644 --- a/sdk/lib/ucrt/string/wcsncpy.cpp +++ b/sdk/lib/ucrt/string/wcsncpy.cpp @@ -12,7 +12,7 @@ #pragma warning(disable:__WARNING_POSTCONDITION_NULLTERMINATION_VIOLATION) // 26036 -#ifdef _M_ARM +#if defined(_MSC_VER) && (defined(_M_ARM) || _MSC_VER >= 1932) // VS2022 version 17.2 and later #pragma function(wcsncpy) #endif