diff --git a/reactos/lib/sdk/crt/except/cpp.c b/reactos/lib/sdk/crt/except/cpp.c index 521791626ce..24b5c3d6c63 100644 --- a/reactos/lib/sdk/crt/except/cpp.c +++ b/reactos/lib/sdk/crt/except/cpp.c @@ -19,28 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/config.h" -#include "wine/port.h" - -#include - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" -#include "wine/exception.h" -#include "winnt.h" -#include "excpt.h" -#include "wine/debug.h" -#include -#include -#include +#include #include #include -#include - -WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); typedef exception bad_cast; typedef exception bad_typeid; @@ -76,7 +58,6 @@ typedef struct _rtti_object_locator const rtti_object_hierarchy *type_hierarchy; } rtti_object_locator; - #ifdef __i386__ /* thiscall functions are i386-specific */ #define THISCALL(func) __thiscall_ ## func diff --git a/reactos/lib/sdk/crt/except/cppexcept.c b/reactos/lib/sdk/crt/except/cppexcept.c index ae6d9c3b553..5e301dae8b5 100644 --- a/reactos/lib/sdk/crt/except/cppexcept.c +++ b/reactos/lib/sdk/crt/except/cppexcept.c @@ -23,20 +23,11 @@ * www.thecodeproject.com. */ -#include "wine/config.h" -#include "wine/port.h" - +#define __WINE_DEBUG_CHANNEL__ +#include #include -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" #include -#include "wine/exception.h" -#include "excpt.h" -#include "wine/debug.h" - #include #ifdef __i386__ /* CxxFrameHandler is not supported on non-i386 */ @@ -328,7 +319,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame /* setup an exception block for nested exceptions */ - nested_frame.frame.Handler = (PEXCEPTION_HANDLER)catch_function_nested_handler; + nested_frame.frame.Handler = (PEXCEPTION_ROUTINE)catch_function_nested_handler; nested_frame.prev_rec = thread_data->exc_record; nested_frame.cxx_frame = frame; nested_frame.descr = descr; diff --git a/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h b/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h index 2b34f55ce25..2cead03a04d 100644 --- a/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h +++ b/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h @@ -21,6 +21,57 @@ #ifndef __MSVCRT_CPPEXCEPT_H #define __MSVCRT_CPPEXCEPT_H +#include + +/* Macros to define assembler functions somewhat portably */ + +#define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef" +#define __ASM_NAME(name) "_" name + +#ifdef __GNUC__ +# define __ASM_GLOBAL_FUNC(name,code) \ + __asm__( ".align 4\n\t" \ + ".globl " __ASM_NAME(#name) "\n\t" \ + __ASM_FUNC(#name) "\n" \ + __ASM_NAME(#name) ":\n\t" \ + code ); +#else /* __GNUC__ */ +# define __ASM_GLOBAL_FUNC(name,code) \ + void __asm_dummy_##name(void) { \ + asm( ".align 4\n\t" \ + ".globl " __ASM_NAME(#name) "\n\t" \ + __ASM_FUNC(#name) "\n" \ + __ASM_NAME(#name) ":\n\t" \ + code ); \ + } +#endif /* __GNUC__ */ + +#define EH_NONCONTINUABLE 0x01 +#define EH_UNWINDING 0x02 +#define EH_EXIT_UNWIND 0x04 +#define EH_STACK_INVALID 0x08 +#define EH_NESTED_CALL 0x10 + +static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame ) +{ + frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0); + __writefsdword(0, (unsigned long)frame); + return frame->Next; +} + +static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame ) +{ + __writefsdword(0, (unsigned long)frame->Next); + return frame->Next; +} + +#define __TRY _SEH2_TRY +#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation())) +#define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) +#define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER) +#define __ENDTRY _SEH2_END +#define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); } + #define CXX_FRAME_MAGIC 0x19930520 #define CXX_EXCEPTION 0xe06d7363 diff --git a/reactos/lib/sdk/crt/precomp.h b/reactos/lib/sdk/crt/precomp.h index d4979dd7a0f..0d8afa002cf 100644 --- a/reactos/lib/sdk/crt/precomp.h +++ b/reactos/lib/sdk/crt/precomp.h @@ -39,7 +39,9 @@ /* kernelmode libcnt should not include Wine-debugging crap */ #ifndef _LIBCNT_ #include "wine/debug.h" +#ifndef __WINE_DEBUG_CHANNEL__ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); +#endif #else #include #define TRACE DPRINT diff --git a/reactos/lib/sdk/crt/wine/undname.c b/reactos/lib/sdk/crt/wine/undname.c index 07e6a062232..178ff88bab9 100755 --- a/reactos/lib/sdk/crt/wine/undname.c +++ b/reactos/lib/sdk/crt/wine/undname.c @@ -19,27 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "wine/config.h" -#include "wine/port.h" - +#define __WINE_DEBUG_CHANNEL__ +#include #include -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" -#include "wine/exception.h" -#include "winnt.h" -#include "excpt.h" -#include "wine/debug.h" -#include -#include #include #include -#include WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);