Commit 3ea70fa1 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcrt: Use exception base to create copy constructor pointer.

The exception base (exc_base) from the ExceptionRecord is used in find_caught_type to find the type info for the exception. All related type information is relative to this base, including the offset for the copy constructor. Signed-off-by: 's avatarDaniel Lehman <dlehman@esri.com> Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 78ab8aa4
...@@ -248,7 +248,7 @@ static const cxx_type_info *find_caught_type(cxx_exception_type *exc_type, ULONG ...@@ -248,7 +248,7 @@ static const cxx_type_info *find_caught_type(cxx_exception_type *exc_type, ULONG
static inline void copy_exception(void *object, ULONG64 frame, static inline void copy_exception(void *object, ULONG64 frame,
DISPATCHER_CONTEXT *dispatch, DISPATCHER_CONTEXT *dispatch,
const catchblock_info *catchblock, const catchblock_info *catchblock,
const cxx_type_info *type) const cxx_type_info *type, ULONG64 exc_base)
{ {
const type_info *catch_ti = rva_to_ptr(catchblock->type_info, dispatch->ImageBase); const type_info *catch_ti = rva_to_ptr(catchblock->type_info, dispatch->ImageBase);
void **dest = rva_to_ptr(catchblock->offset, frame); void **dest = rva_to_ptr(catchblock->offset, frame);
...@@ -273,13 +273,13 @@ static inline void copy_exception(void *object, ULONG64 frame, ...@@ -273,13 +273,13 @@ static inline void copy_exception(void *object, ULONG64 frame,
if (type->flags & CLASS_HAS_VIRTUAL_BASE_CLASS) if (type->flags & CLASS_HAS_VIRTUAL_BASE_CLASS)
{ {
void (__cdecl *copy_ctor)(void*, void*, int) = void (__cdecl *copy_ctor)(void*, void*, int) =
rva_to_ptr(type->copy_ctor, dispatch->ImageBase); rva_to_ptr(type->copy_ctor, exc_base);
copy_ctor(dest, get_this_pointer(&type->offsets, object), 1); copy_ctor(dest, get_this_pointer(&type->offsets, object), 1);
} }
else else
{ {
void (__cdecl *copy_ctor)(void*, void*) = void (__cdecl *copy_ctor)(void*, void*) =
rva_to_ptr(type->copy_ctor, dispatch->ImageBase); rva_to_ptr(type->copy_ctor, exc_base);
copy_ctor(dest, get_this_pointer(&type->offsets, object)); copy_ctor(dest, get_this_pointer(&type->offsets, object));
} }
} }
...@@ -462,7 +462,7 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, EXCEPTION_RECORD *unt ...@@ -462,7 +462,7 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, EXCEPTION_RECORD *unt
/* copy the exception to its destination on the stack */ /* copy the exception to its destination on the stack */
copy_exception((void*)rec->ExceptionInformation[1], copy_exception((void*)rec->ExceptionInformation[1],
orig_frame, dispatch, catchblock, type); orig_frame, dispatch, catchblock, type, exc_base);
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment