1 /*
2  * PROJECT:         ReactOS C++ runtime library
3  * LICENSE:         GPLv2+ - See COPYING in the top level directory
4  * PURPOSE:         __CxxFrameHandler3 to __CxxFrameHandler wrapper
5  * PROGRAMMER:      Thomas Faber (thomas.faber@reactos.org)
6  */
7 
8 #define WIN32_NO_STATUS
9 #include <windef.h>
10 #include <winbase.h>
11 #include <ndk/rtltypes.h>
12 
13 #define WINE_NO_TRACE_MSGS
14 #include <wine/debug.h>
15 #include <wine/exception.h>
16 #include <internal/wine/msvcrt.h>
17 #include <internal/wine/cppexcept.h>
18 
19 extern DWORD CDECL CallCxxFrameHandler(PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD *frame,
20                                        PCONTEXT context, EXCEPTION_REGISTRATION_RECORD **dispatch,
21                                        const cxx_function_descr *descr);
22 
23 DWORD
24 __stdcall
25 CxxHandleV8Frame(
26     _In_ PEXCEPTION_RECORD rec,
27     _In_ EXCEPTION_REGISTRATION_RECORD *frame,
28     _In_ PCONTEXT context,
29     _In_ EXCEPTION_REGISTRATION_RECORD **dispatch,
30     _In_ const cxx_function_descr *descr)
31 {
32     cxx_function_descr stub_descr;
33 
34     if (descr->magic != CXX_FRAME_MAGIC_VC8)
35         return CallCxxFrameHandler(rec, frame, context, dispatch, descr);
36 
37     if ((descr->flags & FUNC_DESCR_SYNCHRONOUS) &&
38         (rec->ExceptionCode != CXX_EXCEPTION))
39     {
40         return ExceptionContinueSearch;  /* handle only c++ exceptions */
41     }
42 
43     stub_descr = *descr;
44     stub_descr.magic = CXX_FRAME_MAGIC_VC7;
45     return CallCxxFrameHandler(rec, frame, context, dispatch, &stub_descr);
46 }
47