mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
[CPPRT]
- Implement __CxxFrameHandler3 as a wrapper around __CxxFrameHandler that translates VC8-style function exception descriptions to VC7-style. This is necessary to make C++ exceptions work on Windows Server 2003, because msvcrt!__CxxFrameHandler does not support VC8 descriptors there. CORE-9290 #resolve svn path=/trunk/; revision=66503
This commit is contained in:
parent
38ecef1f2b
commit
5dfd2fc11e
3 changed files with 66 additions and 3 deletions
|
@ -1,12 +1,15 @@
|
||||||
|
|
||||||
set_cpp(WITH_EXCEPTIONS)
|
set_cpp(WITH_EXCEPTIONS)
|
||||||
|
|
||||||
|
include_directories(${REACTOS_SOURCE_DIR}/lib/sdk/crt/include)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
ehvec.cpp
|
ehvec.cpp
|
||||||
typeinfo.cpp)
|
typeinfo.cpp)
|
||||||
|
|
||||||
if(ARCH STREQUAL "i386")
|
if(ARCH STREQUAL "i386")
|
||||||
add_asm_files(cpprt_asm i386/cpprt.s)
|
add_asm_files(cpprt_asm i386/cpprt.s)
|
||||||
|
list(APPEND SOURCE i386/framehandler.c)
|
||||||
elseif(ARCH STREQUAL "amd64")
|
elseif(ARCH STREQUAL "amd64")
|
||||||
add_asm_files(cpprt_asm amd64/cpprt.s)
|
add_asm_files(cpprt_asm amd64/cpprt.s)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -7,13 +7,27 @@ EXTERN &orig:&type
|
||||||
ALIAS <&alias> = <&orig>
|
ALIAS <&alias> = <&orig>
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
EXTERN _CxxHandleV8Frame@20 : PROC
|
||||||
|
PUBLIC ___CxxFrameHandler3
|
||||||
|
___CxxFrameHandler3:
|
||||||
|
push eax
|
||||||
|
push dword ptr [esp + 20]
|
||||||
|
push dword ptr [esp + 20]
|
||||||
|
push dword ptr [esp + 20]
|
||||||
|
push dword ptr [esp + 20]
|
||||||
|
call _CxxHandleV8Frame@20
|
||||||
|
ret
|
||||||
|
|
||||||
|
EXTERN ___CxxFrameHandler : PROC
|
||||||
|
PUBLIC _CallCxxFrameHandler
|
||||||
|
_CallCxxFrameHandler:
|
||||||
|
mov eax, dword ptr [esp + 20]
|
||||||
|
jmp ___CxxFrameHandler
|
||||||
|
|
||||||
; void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *),void (__thiscall*)(void *))
|
; void __stdcall `eh vector constructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *),void (__thiscall*)(void *))
|
||||||
DEFINE_ALIAS ??_L@YGXPAXIHP6EX0@Z1@Z, ?MSVCRTEX_eh_vector_constructor_iterator@@YGXPAXIHP6EX0@Z1@Z
|
DEFINE_ALIAS ??_L@YGXPAXIHP6EX0@Z1@Z, ?MSVCRTEX_eh_vector_constructor_iterator@@YGXPAXIHP6EX0@Z1@Z
|
||||||
|
|
||||||
; void __stdcall `eh vector destructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *))
|
; void __stdcall `eh vector destructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *))
|
||||||
DEFINE_ALIAS ??_M@YGXPAXIHP6EX0@Z@Z, ?MSVCRTEX_eh_vector_destructor_iterator@@YGXPAXIHP6EX0@Z@Z
|
DEFINE_ALIAS ??_M@YGXPAXIHP6EX0@Z@Z, ?MSVCRTEX_eh_vector_destructor_iterator@@YGXPAXIHP6EX0@Z@Z
|
||||||
|
|
||||||
; These are the same
|
|
||||||
DEFINE_ALIAS ___CxxFrameHandler3, ___CxxFrameHandler
|
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
46
reactos/lib/sdk/cpprt/i386/framehandler.c
Normal file
46
reactos/lib/sdk/cpprt/i386/framehandler.c
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS C++ runtime library
|
||||||
|
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||||
|
* PURPOSE: __CxxFrameHandler3 to __CxxFrameHandler wrapper
|
||||||
|
* PROGRAMMER: Thomas Faber (thomas.faber@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#include <windef.h>
|
||||||
|
#include <winbase.h>
|
||||||
|
#include <ndk/rtltypes.h>
|
||||||
|
|
||||||
|
#define WINE_NO_TRACE_MSGS
|
||||||
|
#include <wine/debug.h>
|
||||||
|
#include <wine/exception.h>
|
||||||
|
#include <internal/wine/msvcrt.h>
|
||||||
|
#include <internal/wine/cppexcept.h>
|
||||||
|
|
||||||
|
extern DWORD CDECL CallCxxFrameHandler(PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD *frame,
|
||||||
|
PCONTEXT context, EXCEPTION_REGISTRATION_RECORD **dispatch,
|
||||||
|
const cxx_function_descr *descr);
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
__stdcall
|
||||||
|
CxxHandleV8Frame(
|
||||||
|
_In_ PEXCEPTION_RECORD rec,
|
||||||
|
_In_ EXCEPTION_REGISTRATION_RECORD *frame,
|
||||||
|
_In_ PCONTEXT context,
|
||||||
|
_In_ EXCEPTION_REGISTRATION_RECORD **dispatch,
|
||||||
|
_In_ const cxx_function_descr *descr)
|
||||||
|
{
|
||||||
|
cxx_function_descr stub_descr;
|
||||||
|
|
||||||
|
if (descr->magic != CXX_FRAME_MAGIC_VC8)
|
||||||
|
return CallCxxFrameHandler(rec, frame, context, dispatch, descr);
|
||||||
|
|
||||||
|
if ((descr->flags & FUNC_DESCR_SYNCHRONOUS) &&
|
||||||
|
(rec->ExceptionCode != CXX_EXCEPTION))
|
||||||
|
{
|
||||||
|
return ExceptionContinueSearch; /* handle only c++ exceptions */
|
||||||
|
}
|
||||||
|
|
||||||
|
stub_descr = *descr;
|
||||||
|
stub_descr.magic = CXX_FRAME_MAGIC_VC7;
|
||||||
|
return CallCxxFrameHandler(rec, frame, context, dispatch, &stub_descr);
|
||||||
|
}
|
Loading…
Reference in a new issue