* Introduce support for for MSVC native run-time checks. Set RUNTIME_CHECKS to TRUE to enable it.
* Dedicated to Christoph von Wittich and all ReactOS devs that use MSVC builds ;)
CORE-8626
svn path=/trunk/; revision=64704
if("${LIB}" MATCHES "msvcrt")
add_target_compile_definitions(${_module} _DLL __USE_CRTIMP)
target_link_libraries(${_module} msvcrtex)
+ if(MSVC)
+ if(RUNTIME_CHECKS)
+ if(NOT ${_module} STREQUAL "kernel32")
+ add_target_compile_flags(${_module} "/RTC1")
+ target_link_libraries(${_module} RunTmChk.lib)
+ endif()
+ endif()
+ endif()
endif()
target_link_libraries(${_module} lib${LIB})
add_dependencies(${_module} lib${LIB})
endif()
endif()
+if(NOT DEFINED RUNTIME_CHECKS)
+ set(RUNTIME_CHECKS FALSE)
+endif()
+
+if(RUNTIME_CHECKS)
+ add_definitions(-D__RUNTIME_CHECKS__)
+endif()
+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE")
target_link_libraries(kernel32 wine chkstk ${PSEH_LIB})
+if(RUNTIME_CHECKS)
+ target_link_libraries(kernel32 RunTmChk.lib)
+endif()
+
add_importlibs(kernel32 ntdll)
add_pch(kernel32 k32.h SOURCE)
add_dependencies(kernel32 psdk errcodes asm)
/* GLOBALS *******************************************************************/
+#ifndef __RUNTIME_CHECKS__
PUBLIC __global_unwind2
PUBLIC __local_unwind2
PUBLIC __abnormal_termination
+#endif
+
PUBLIC __except_handler2
PUBLIC __except_handler3
PUBLIC __global_unwind2
PUBLIC __local_unwind2
PUBLIC __abnormal_termination
+
+#if !defined(__RUNTIME_CHECKS__) || (defined(__RUNTIME_CHECKS__) && !defined(_LIBCNT_))
PUBLIC __except_handler2
PUBLIC __except_handler3
+#endif
/* FUNCTIONS *****************************************************************/
__declspec(noreturn) void __cdecl __report_gsfailure (ULONG_PTR);
+#ifndef _MSC_VER
__declspec(noreturn) void __cdecl
__report_gsfailure (ULONG_PTR StackCookie)
{
TerminateProcess (GetCurrentProcess (), STATUS_STACK_BUFFER_OVERRUN);
abort();
}
-
+#endif /* !_MSC_VER */
return TRUE;
}
+void Catch_RTC_Failure(int errType, const wchar_t *file, int line,
+ const wchar_t *module, const wchar_t *format, ...)
+{
+ /* FIXME: better failure routine */
+ __debugbreak();
+}
+
+void* __cdecl _CRT_RTC_INITW(void *res0, void **res1, int res2, int res3, int res4)
+{
+ return &Catch_RTC_Failure;
+}
+
static int initialized = 0;
void