[UCRTSUPPORT] Add wine c++ exception code

This commit is contained in:
Timo Kreuzer 2024-11-16 15:08:06 +02:00
parent e2d69ad98c
commit ae0fa8ba49
5 changed files with 103 additions and 45 deletions

View file

@ -41,8 +41,10 @@ thread_data_t *msvcrt_get_thread_data(void)
ptr->tid = GetCurrentThreadId();
ptr->handle = INVALID_HANDLE_VALUE;
ptr->random_seed = 1;
#ifndef __UCRTSUPPORT__
ptr->locinfo = MSVCRT_locale->locinfo;
ptr->mbcinfo = MSVCRT_locale->mbcinfo;
#endif /* !__UCRTSUPPORT__ */
}
SetLastError( err );
return ptr;

View file

@ -2,21 +2,67 @@
list(APPEND UCRTSUPP_SOURCE
${CRT_FLOAT_SOURCE}
${CRT_MATH_SOURCE}
misc/amsg.c
misc/purecall.c
misc/tls.c
wine/cpp.c
wine/except.c
wine/undname.c
)
list(APPEND UCRTSUPP_ASM_SOURCE
${CRT_EXCEPT_ASM_SOURCE}
${CRT_FLOAT_ASM_SOURCE}
${CRT_MATH_ASM_SOURCE}
${CRT_SETJMP_ASM_SOURCE}
${CRT_WINE_ASM_SOURCE}
)
if(ARCH STREQUAL "i386")
list(APPEND UCRTSUPP_SOURCE
except/i386/CxxHandleV8Frame.c
wine/except_i386.c
)
list(APPEND UCRTSUPP_ASM_SOURCE
except/i386/__CxxFrameHandler3.s
except/i386/chkesp.s
wine/rosglue_i386.s
)
if(MSVC)
list(APPEND UCRTSUPP_ASM_SOURCE
except/i386/cpp.s
except/i386/prolog.s
)
endif()
elseif(ARCH STREQUAL "amd64")
list(APPEND UCRTSUPP_SOURCE
wine/except_x86_64.c
)
if(MSVC)
list(APPEND UCRTSUPP_ASM_SOURCE
except/amd64/cpp.s
)
endif()
elseif(ARCH STREQUAL "arm")
list(APPEND UCRTSUPP_SOURCE
wine/except_arm.c
)
if(MSVC)
list(APPEND UCRTSUPP_ASM_SOURCE
except/arm/cpp.s
)
endif()
elseif(ARCH STREQUAL "arm64")
list(APPEND UCRTSUPP_SOURCE
wine/except_arm64.c
)
endif()
add_asm_files(ucrtsupp_asm ${UCRTSUPP_ASM_SOURCE})
add_library(ucrtsupport ${UCRTSUPP_SOURCE} ${ucrtsupp_asm})
target_link_libraries(ucrtsupport chkstk ${PSEH_LIB})
target_compile_definitions(ucrtsupport PRIVATE
__UCRTSUPPORT__
CRTDLL
_MSVCRT_LIB_
_MSVCRT_
@ -24,6 +70,11 @@ target_compile_definitions(ucrtsupport PRIVATE
USE_MSVCRT_PREFIX
__MINGW_IMPORT=extern
__fma3_lib_init=__acrt_initialize_fma3
set_terminate=_wine_set_terminate
terminate=_wine_terminate
_get_terminate=_wine_get_terminate
unexpected=_wine_unexpected
__pxcptinfoptrs=_wine__pxcptinfoptrs
)
#add_pch(crt precomp.h)
add_dependencies(ucrtsupport psdk asm)

View file

@ -1025,7 +1025,7 @@ void WINAPI _CxxThrowException( void *object, const cxx_exception_type *type )
}
#endif
#if _MSVCR_VER >= 80
#if _MSVCR_VER >= 80 || defined(__UCRTSUPPORT__)
/*********************************************************************
* ?_is_exception_typeof@@YAHABVtype_info@@PAU_EXCEPTION_POINTERS@@@Z
@ -1063,6 +1063,8 @@ int __cdecl _is_exception_typeof(const type_info *ti, EXCEPTION_POINTERS *ep)
}
}
__EXCEPT_PAGE_FAULT
{
}
__ENDTRY
if(ret == -1)
@ -1104,6 +1106,8 @@ int __cdecl _is_exception_typeof(const type_info *ti, EXCEPTION_POINTERS *ep)
}
}
__EXCEPT_PAGE_FAULT
{
}
__ENDTRY
if(ret == -1)
@ -1123,6 +1127,7 @@ void CDECL __clean_type_info_names_internal(void *p)
/*********************************************************************
* ?_name_internal_method@type_info@@QBEPBDPAU__type_info_node@@@Z (MSVCR100.@)
*/
const char * __thiscall type_info_name_internal_method(type_info * _this, struct __type_info_node *node);
DEFINE_THISCALL_WRAPPER(type_info_name_internal_method,8)
const char * __thiscall type_info_name_internal_method(type_info * _this, struct __type_info_node *node)
{
@ -1472,14 +1477,14 @@ bool __cdecl __ExceptionPtrCompare(const exception_ptr *ep1, const exception_ptr
#endif /* _MSVCR_VER >= 100 */
#if _MSVCR_VER >= 80
#if _MSVCR_VER >= 80 || defined(__UCRTSUPPORT__)
void* __cdecl __AdjustPointer(void *obj, const this_ptr_offsets *off)
{
return get_this_pointer(off, obj);
}
#endif
#if _MSVCR_VER >= 140
#if _MSVCR_VER >= 140 || defined(__UCRTSUPPORT__)
typedef struct
{

View file

@ -487,7 +487,7 @@ struct __std_exception_data {
char dofree;
};
#if _MSVCR_VER>=140
#if _MSVCR_VER>=140 || defined(__UCRTSUPPORT__)
/*********************************************************************
* __std_exception_copy (UCRTBASE.@)