[CMAKE] Remove global _CRT_NON_CONFORMING_SWPRINTFS

Instead define it only in 3rd-party code where required.
Most of these will go away with future wine-syncs.
This commit is contained in:
Timo Kreuzer
2026-05-07 06:27:58 +00:00
parent 3b7960e2f8
commit b13e568d99
42 changed files with 53 additions and 8 deletions
-2
View File
@@ -73,8 +73,6 @@ include(sdk/cmake/set_wine_module.cmake)
add_definitions(
-D__REACTOS__
# swprintf without count argument is used in most of the codebase
-D_CRT_NON_CONFORMING_SWPRINTFS
)
# There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime.
@@ -4,6 +4,7 @@ add_definitions(-D_WIN32_WINNT=0x600)
add_executable(reg add.c copy.c delete.c export.c import.c query.c reg.c reg.rc)
set_module_type(reg win32cui UNICODE)
target_compile_definitions(reg PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(reg wine oldnames)
add_importlibs(reg advapi32 advapi32_vista user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET reg DESTINATION reactos/system32 FOR all)
+1
View File
@@ -35,6 +35,7 @@ file(GLOB mstsc_rc_deps res/*.*)
add_rc_deps(rdc.rc ${mstsc_rc_deps})
add_executable(mstsc ${SOURCE} rdc.rc)
set_module_type(mstsc win32gui UNICODE)
target_compile_definitions(mstsc PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
add_importlibs(mstsc user32 gdi32 comctl32 ws2_32 crypt32 secur32 advapi32 shell32 ole32 comdlg32 msvcrt kernel32)
add_pch(mstsc precomp.h SOURCE)
add_cd_file(TARGET mstsc DESTINATION reactos/system32 FOR all)
@@ -1,6 +1,7 @@
add_executable(route route.c route.rc)
set_module_type(route win32cui UNICODE)
target_compile_definitions(route PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(route conutils)
add_importlibs(route ws2_32 iphlpapi advapi32 msvcrt kernel32 ntdll) ## ntdll for RtlIpv*
add_cd_file(TARGET route DESTINATION reactos/system32 FOR all)
+1
View File
@@ -27,6 +27,7 @@ file(GLOB regedit_rc_deps res/*.*)
add_rc_deps(regedit.rc ${regedit_rc_deps})
add_executable(regedit ${SOURCE} regedit.rc)
set_module_type(regedit win32gui UNICODE)
target_compile_definitions(regedit PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(regedit uuid wine)
add_importlibs(regedit user32 gdi32 advapi32 ole32 shell32 comctl32 comdlg32 shlwapi msvcrt kernel32 ntdll)
add_pch(regedit regedit.h SOURCE)
+1
View File
@@ -3,6 +3,7 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/fmifs)
add_executable(chkdsk chkdsk.c chkdsk.rc)
set_module_type(chkdsk win32cui UNICODE)
target_compile_definitions(chkdsk PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(chkdsk conutils)
add_importlibs(chkdsk fmifs msvcrt kernel32)
add_cd_file(TARGET chkdsk DESTINATION reactos/system32 FOR all)
+1
View File
@@ -25,6 +25,7 @@ add_library(dsound MODULE
${CMAKE_CURRENT_BINARY_DIR}/dsound.def)
set_module_type(dsound win32dll)
target_compile_definitions(dsound PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(dsound dxguid uuid)
add_importlibs(dsound winmm ole32 advapi32 setupapi ksuser user32 msvcrt kernel32 ntdll)
add_pch(dsound precomp.h SOURCE)
+1
View File
@@ -16,6 +16,7 @@ add_library(dxdiagn MODULE
${CMAKE_CURRENT_BINARY_DIR}/dxdiagn.def)
set_module_type(dxdiagn win32dll)
target_compile_definitions(dxdiagn PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(dxdiagn strmiids dxguid uuid wine)
add_dependencies(dxdiagn wineheaders)
add_importlibs(dxdiagn d3d9 ddraw version ole32 oleaut32 psapi user32 dsound msvcrt kernel32 ntdll)
+2
View File
@@ -37,6 +37,8 @@ add_library(shellbtrfs MODULE
shellbtrfs.rc
${CMAKE_CURRENT_BINARY_DIR}/shellbtrfs.def)
target_compile_definitions(shellbtrfs PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
file(GLOB shellbtrfs_rc_deps *.ico)
add_rc_deps(shellbtrfs.rc ${shellbtrfs_rc_deps})
+1
View File
@@ -3,6 +3,7 @@ remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
add_definitions(
-D_CRT_NON_CONFORMING_SWPRINTFS
-D_ATL_VER=_ATL_VER_30)
spec2def(atl.dll atl.spec ADD_IMPORTLIB)
+1
View File
@@ -24,6 +24,7 @@ add_library(comdlg32 MODULE
${CMAKE_CURRENT_BINARY_DIR}/comdlg32.def)
set_module_type(comdlg32 win32dll)
target_compile_definitions(comdlg32 PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(comdlg32 uuid wine oldnames)
add_delay_importlibs(comdlg32 ole32)
add_importlibs(comdlg32 shell32 shlwapi comctl32 winspool user32 gdi32 advapi32 msvcrt kernel32 ntdll)
+1
View File
@@ -8,6 +8,7 @@ list(APPEND SOURCE
add_library(credui MODULE ${SOURCE} credui.rc)
set_module_type(credui win32dll)
target_compile_definitions(credui PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(credui wine oldnames)
add_importlibs(credui advapi32 user32 comctl32 msvcrt kernel32 ntdll)
add_cd_file(TARGET credui DESTINATION reactos/system32 FOR all)
+1
View File
@@ -8,6 +8,7 @@ list(APPEND SOURCE
add_library(cryptdlg MODULE ${SOURCE} cryptdlg.rc)
set_module_type(cryptdlg win32dll)
target_compile_definitions(cryptdlg PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(cryptdlg wine)
add_importlibs(cryptdlg advapi32 user32 crypt32 cryptui wintrust msvcrt kernel32 ntdll)
add_cd_file(TARGET cryptdlg DESTINATION reactos/system32 FOR all)
+1
View File
@@ -11,6 +11,7 @@ list(APPEND SOURCE
add_library(cryptui MODULE ${SOURCE} cryptui.rc)
set_module_type(cryptui win32dll)
target_compile_definitions(cryptui PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(cryptui uuid wine oldnames)
add_delay_importlibs(cryptui urlmon wintrust)
add_importlibs(cryptui user32 ole32 crypt32 gdi32 advapi32 comctl32 comdlg32 msvcrt kernel32 ntdll)
+2 -1
View File
@@ -1,6 +1,6 @@
if(NOT CMAKE_CROSSCOMPILING)
add_definitions(-DDBGHELP_STATIC_LIB -DNONAMELESSUNION)
add_definitions(-DDBGHELP_STATIC_LIB -DNONAMELESSUNION -D_CRT_NON_CONFORMING_SWPRINTFS)
include_directories(
${REACTOS_SOURCE_DIR}/tools)
@@ -28,6 +28,7 @@ else()
add_definitions(
-D_WINE
-DHAVE_ALLOCA_H
-D_CRT_NON_CONFORMING_SWPRINTFS
-D_IMAGEHLP_SOURCE_)
include_directories(
+1
View File
@@ -11,6 +11,7 @@ list(APPEND COMMON_SOURCE
${CMAKE_CURRENT_BINARY_DIR}/fusion_stubs.c)
add_library(fusion_common STATIC ${COMMON_SOURCE})
target_compile_definitions(fusion_common PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(fusion_common oldnames)
add_dependencies(fusion_common psdk)
add_pch(fusion_common precomp.h COMMON_SOURCE)
+1
View File
@@ -41,6 +41,7 @@ list(APPEND ieframe_rc_deps
set_source_files_properties(ieframe.rc PROPERTIES OBJECT_DEPENDS "${ieframe_rc_deps}")
add_dependencies(ieframe stdole2)
set_module_type(ieframe win32dll)
target_compile_definitions(ieframe PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(ieframe uuid wine)
add_importlibs(ieframe urlmon shell32 comctl32 shlwapi oleaut32 ole32 user32 gdi32 advapi32 msvcrt kernel32 ntdll)
add_pch(ieframe precomp.h SOURCE)
+1 -1
View File
@@ -1,5 +1,5 @@
add_definitions(-D__ROS_LONG64__)
add_definitions(-D__ROS_LONG64__ -D_CRT_NON_CONFORMING_SWPRINTFS)
spec2def(itss.dll itss.spec)
list(APPEND SOURCE
+2
View File
@@ -54,6 +54,8 @@ add_library(jscript MODULE
rsrc.rc
${CMAKE_CURRENT_BINARY_DIR}/jscript.def)
target_compile_definitions(jscript PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
if(MSVC)
# Disable warning C4146: unary minus operator applied to unsigned type, result still unsigned
# Disable warning C4267: '=': conversion from 'size_t' to 'WCHAR', possible loss of data
+1
View File
@@ -8,6 +8,7 @@ list(APPEND SOURCE
add_library(jsproxy MODULE ${SOURCE} rsrc.rc)
set_module_type(jsproxy win32dll)
target_compile_definitions(jsproxy PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(jsproxy uuid wine)
add_importlibs(jsproxy oleaut32 ole32 ws2_32 msvcrt kernel32 ntdll)
add_cd_file(TARGET jsproxy DESTINATION reactos/system32 FOR all)
+1 -1
View File
@@ -1,6 +1,6 @@
add_definitions(
-DCOM_NO_WINDOWS_H)
-DCOM_NO_WINDOWS_H -D_CRT_NON_CONFORMING_SWPRINTFS)
spec2def(mlang.dll mlang.spec ADD_IMPORTLIB)
+1
View File
@@ -1,5 +1,6 @@
add_definitions(
-D_CRT_NON_CONFORMING_SWPRINTFS
-D_WINE)
spec2def(mpr.dll mpr.spec ADD_IMPORTLIB)
+1
View File
@@ -18,6 +18,7 @@ add_library(msacm32 MODULE
${CMAKE_CURRENT_BINARY_DIR}/msacm32.def)
set_module_type(msacm32 win32dll ENTRYPOINT DllMain 12 UNICODE)
target_compile_definitions(msacm32 PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(msacm32 wine oldnames)
add_importlibs(msacm32 advapi32 user32 winmm msvcrt kernel32 ntdll)
add_pch(msacm32 precomp.h SOURCE)
+1
View File
@@ -1,5 +1,6 @@
add_definitions(
-D_CRT_NON_CONFORMING_SWPRINTFS
-DENTRY_PREFIX=OLEACC_
-DPROXY_DELEGATION
-DWINE_REGISTER_DLL)
+2 -1
View File
@@ -9,7 +9,8 @@ add_definitions(
-DPROXY_DELEGATION
-DWINE_REGISTER_DLL
-DENTRY_PREFIX=OLEAUTPS_
-DPROXY_CLSID=CLSID_PSFactoryBuffer)
-DPROXY_CLSID=CLSID_PSFactoryBuffer
-D_CRT_NON_CONFORMING_SWPRINTFS)
spec2def(oleaut32.dll oleaut32.spec ADD_IMPORTLIB)
add_rpcproxy_files(oleaut32_oaidl.idl oleaut32_ocidl.idl)
+1
View File
@@ -11,6 +11,7 @@ list(APPEND SOURCE
add_library(pdh MODULE ${SOURCE})
set_module_type(pdh win32dll)
target_compile_definitions(pdh PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(pdh wine)
add_importlibs(pdh msvcrt kernel32_vista kernel32 ntdll)
add_cd_file(TARGET pdh DESTINATION reactos/system32 FOR all)
+1
View File
@@ -12,6 +12,7 @@ if(MSVC)
endif()
set_module_type(powrprof win32dll UNICODE)
target_compile_definitions(powrprof PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(powrprof wine)
add_importlibs(powrprof advapi32 user32 comctl32 msvcrt kernel32 ntdll)
add_cd_file(TARGET powrprof DESTINATION reactos/system32 FOR all)
+1
View File
@@ -5,6 +5,7 @@ add_definitions(-D_WIN32_WINNT=0x600)
add_definitions(
-D_RPCRT4_
-DCOM_NO_WINDOWS_H
-D_CRT_NON_CONFORMING_SWPRINTFS
-DMSWMSG)
spec2def(rpcrt4.dll rpcrt4.spec ADD_IMPORTLIB)
+1
View File
@@ -28,6 +28,7 @@ add_library(scrrun MODULE
add_dependencies(scrrun scrrun_idlheader stdole2)
set_module_type(scrrun win32dll)
target_compile_definitions(scrrun PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(scrrun uuid wine oldnames)
add_importlibs(scrrun oleaut32 version advapi32 msvcrt kernel32 ntdll)
add_pch(scrrun precomp.h "${PCH_SKIP_SOURCE}")
+7 -2
View File
@@ -85,7 +85,7 @@ list(APPEND SOURCE
CFolderItems.cpp
CFolderItemVerbs.cpp)
list(APPEND PCH_SKIP_SOURCE
list(APPEND WINE_SOURCE
appbar.c
wine/classes.c
wine/clipboard.c
@@ -98,7 +98,12 @@ list(APPEND PCH_SKIP_SOURCE
wine/shellreg.c
wine/shellstring.c
wine/shlmenu.c
wine/shpolicy.c
wine/shpolicy.c)
set_source_files_properties(${WINE_SOURCE} PROPERTIES COMPILE_DEFINITIONS _CRT_NON_CONFORMING_SWPRINTFS)
list(APPEND PCH_SKIP_SOURCE
${WINE_SOURCE}
vista.c
${CMAKE_CURRENT_BINARY_DIR}/shell32_stubs.c)
+1
View File
@@ -1,5 +1,6 @@
add_definitions(
-D_CRT_NON_CONFORMING_SWPRINTFS
-DENTRY_PREFIX=STI_
-DPROXY_DELEGATION
-DWINE_REGISTER_DLL)
+1
View File
@@ -16,6 +16,7 @@ add_library(sxs MODULE
${CMAKE_CURRENT_BINARY_DIR}/sxs.def)
set_module_type(sxs win32dll)
target_compile_definitions(sxs PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(sxs wine)
add_importlibs(sxs oleaut32 ole32 msvcrt kernel32 ntdll)
add_pch(sxs precomp.h "${PCH_SKIP_SOURCE}")
+1
View File
@@ -14,6 +14,7 @@ add_library(tapi32 MODULE
${CMAKE_CURRENT_BINARY_DIR}/tapi32.def)
set_module_type(tapi32 win32dll)
target_compile_definitions(tapi32 PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(tapi32 wine)
add_importlibs(tapi32 advapi32 msvcrt kernel32 ntdll)
add_pch(tapi32 precomp.h SOURCE)
+1
View File
@@ -4,6 +4,7 @@ add_definitions(
-DENTRY_PREFIX=URLMON_
-DPROXY_DELEGATION
-DWINE_REGISTER_DLL
-D_CRT_NON_CONFORMING_SWPRINTFS
-DPROXY_CLSID_IS={0x79EAC9F1,0xBAF9,0x11CE,{0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B}})
spec2def(urlmon.dll urlmon.spec ADD_IMPORTLIB)
+1
View File
@@ -22,6 +22,7 @@ add_library(usp10 MODULE
${CMAKE_CURRENT_BINARY_DIR}/usp10.def)
set_module_type(usp10 win32dll)
target_compile_definitions(usp10 PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(usp10 wine)
add_importlibs(usp10 advapi32 user32 gdi32 msvcrt kernel32 ntdll)
add_pch(usp10 precomp.h SOURCE)
+1
View File
@@ -34,6 +34,7 @@ add_library(wbemprox MODULE
set_source_files_properties(wbemprox.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/wbemprox.rgs)
set_module_type(wbemprox win32dll)
target_compile_definitions(wbemprox PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(wbemprox uuid wine oldnames)
add_importlibs(wbemprox iphlpapi oleaut32 advapi32 user32 gdi32 version winspool ws2_32 rpcrt4 setupapi msvcrt kernel32 ntdll)
add_dependencies(wbemprox d3d_idl_headers)
+1
View File
@@ -9,6 +9,7 @@ list(APPEND SOURCE
add_library(wmiutils MODULE ${SOURCE} wmiutils.rc)
set_module_type(wmiutils win32dll)
target_compile_definitions(wmiutils PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(wmiutils wine)
add_importlibs(wmiutils oleaut32 msvcrt kernel32 ntdll)
add_cd_file(TARGET wmiutils DESTINATION reactos/system32/wbem FOR all)
+1
View File
@@ -26,6 +26,7 @@ list(APPEND wshom_rc_deps
set_source_files_properties(wshom.rc PROPERTIES OBJECT_DEPENDS "${wshom_rc_deps}")
set_module_type(wshom win32ocx)
target_compile_definitions(wshom PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(wshom uuid wine oldnames)
add_importlibs(wshom oleaut32 ole32 shell32 advapi32 advapi32_vista user32 msvcrt kernel32 ntdll)
add_dependencies(wshom stdole2 wshom_idlheader)
+1
View File
@@ -19,6 +19,7 @@ if(MSVC)
endif()
set_module_type(xmllite win32dll)
target_compile_definitions(xmllite PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
target_link_libraries(xmllite uuid wine oldnames)
add_importlibs(xmllite msvcrt kernel32 ntdll)
add_pch(xmllite precomp.h SOURCE)
+2
View File
@@ -88,6 +88,8 @@ list(APPEND SOURCE
add_library(ext2fs MODULE ${SOURCE} ext2fs.rc)
target_compile_definitions(ext2fs PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# Disable warning C4101: 'i': unreferenced local variable
# Disable warning C4189: 'sbi': local variable is initialized but not referenced
+2
View File
@@ -41,6 +41,8 @@ list(APPEND SOURCE
add_library(udfs MODULE ${SOURCE} udffs.rc)
target_compile_definitions(udfs PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(udfs PRIVATE -Wno-unused-but-set-variable)
endif()
@@ -41,6 +41,7 @@ endif()
add_pch(uniata stdafx.h SOURCE)
set_module_type(uniata kernelmodedriver)
target_compile_definitions(uniata PRIVATE _CRT_NON_CONFORMING_SWPRINTFS)
add_importlibs(uniata scsiport ntoskrnl hal)
add_cd_file(TARGET uniata DESTINATION reactos/system32/drivers NO_CAB FOR all)
# add_registry_inf(uniata_reg.inf)