From: Vibhav Pant vibhavp@gmail.com
--- dlls/msvcrt/cpp.c | 10 ++++++++++ dlls/msvcrt/cppexcept.h | 13 +++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c index c30fd4994a6..c8537bda8f4 100644 --- a/dlls/msvcrt/cpp.c +++ b/dlls/msvcrt/cpp.c @@ -903,6 +903,16 @@ void WINAPI _CxxThrowException( void *object, const cxx_exception_type *type ) { ULONG_PTR args[CXX_EXCEPTION_PARAMS];
+ if (type && type->flags & TYPE_FLAG_WINRT) + { + /* This is a WinRT exception, which contains a pointer to winrt_exception_info just before the object. + * We use the exception_type field inside that struct as the actual value for exception type. */ + winrt_exception_info **info = *(winrt_exception_info ***)object - 1; + + type = (*info)->exception_type; + (*info)->set_exception_info( info ); + } + args[0] = CXX_FRAME_MAGIC_VC6; args[1] = (ULONG_PTR)object; args[2] = (ULONG_PTR)type; diff --git a/dlls/msvcrt/cppexcept.h b/dlls/msvcrt/cppexcept.h index 61267add740..0f64f97dd20 100644 --- a/dlls/msvcrt/cppexcept.h +++ b/dlls/msvcrt/cppexcept.h @@ -142,6 +142,19 @@ typedef struct #define TYPE_FLAG_REFERENCE 8 #define TYPE_FLAG_WINRT 16
+typedef struct winrt_exception_info +{ + BSTR description; + BSTR restricted_desc; + void *unknown1; + void *unknown2; + HRESULT hr; + void *error_info; /* IRestrictedErrorInfo */ + const cxx_exception_type *exception_type; + UINT32 unknown3; + void (*WINAPI set_exception_info)(struct winrt_exception_info **); +} winrt_exception_info; + void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*);
static inline BOOL is_cxx_exception( EXCEPTION_RECORD *rec )