msvcrt: Add __ExceptionPtrCopyException implementation.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-02-23 13:24:47 +01:00 committed by Alexandre Julliard
parent 6caecb6e58
commit 15b144b35d
6 changed files with 91 additions and 10 deletions

View File

@ -1695,8 +1695,8 @@
@ stub -arch=win64 ?__ExceptionPtrCompare@@YA_NPEBX0@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopy@@YAXPAXPBX@Z(ptr ptr) msvcr120.?__ExceptionPtrCopy@@YAXPAXPBX@Z
@ cdecl -arch=win64 ?__ExceptionPtrCopy@@YAXPEAXPEBX@Z(ptr ptr) msvcr120.?__ExceptionPtrCopy@@YAXPEAXPEBX@Z
@ stub -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
@ stub -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z(ptr ptr ptr) msvcr120.?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
@ cdecl -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z(ptr ptr ptr) msvcr120.?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
@ cdecl -arch=win32 ?__ExceptionPtrCreate@@YAXPAX@Z(ptr) msvcr120.?__ExceptionPtrCreate@@YAXPAX@Z
@ cdecl -arch=win64 ?__ExceptionPtrCreate@@YAXPEAX@Z(ptr) msvcr120.?__ExceptionPtrCreate@@YAXPEAX@Z
@ cdecl -arch=win32 ?__ExceptionPtrCurrentException@@YAXPAX@Z(ptr) msvcr120.?__ExceptionPtrCurrentException@@YAXPAX@Z

View File

@ -414,8 +414,8 @@
@ stub -arch=win64 ?__ExceptionPtrCompare@@YA_NPEBX0@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopy@@YAXPAXPBX@Z(ptr ptr) __ExceptionPtrCopy
@ cdecl -arch=win64 ?__ExceptionPtrCopy@@YAXPEAXPEBX@Z(ptr ptr) __ExceptionPtrCopy
@ stub -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
@ stub -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z(ptr ptr ptr) __ExceptionPtrCopyException
@ cdecl -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z(ptr ptr ptr) __ExceptionPtrCopyException
@ cdecl -arch=win32 ?__ExceptionPtrCreate@@YAXPAX@Z(ptr) __ExceptionPtrCreate
@ cdecl -arch=win64 ?__ExceptionPtrCreate@@YAXPEAX@Z(ptr) __ExceptionPtrCreate
@ cdecl -arch=win32 ?__ExceptionPtrCurrentException@@YAXPAX@Z(ptr) __ExceptionPtrCurrentException

View File

@ -692,8 +692,8 @@
@ stub -arch=win64 ?__ExceptionPtrCompare@@YA_NPEBX0@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopy@@YAXPAXPBX@Z(ptr ptr) __ExceptionPtrCopy
@ cdecl -arch=win64 ?__ExceptionPtrCopy@@YAXPEAXPEBX@Z(ptr ptr) __ExceptionPtrCopy
@ stub -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
@ stub -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z(ptr ptr ptr) __ExceptionPtrCopyException
@ cdecl -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z(ptr ptr ptr) __ExceptionPtrCopyException
@ cdecl -arch=win32 ?__ExceptionPtrCreate@@YAXPAX@Z(ptr) __ExceptionPtrCreate
@ cdecl -arch=win64 ?__ExceptionPtrCreate@@YAXPEAX@Z(ptr) __ExceptionPtrCreate
@ cdecl -arch=win32 ?__ExceptionPtrCurrentException@@YAXPAX@Z(ptr) __ExceptionPtrCurrentException

View File

@ -674,8 +674,8 @@
@ stub -arch=win64 ?__ExceptionPtrCompare@@YA_NPEBX0@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopy@@YAXPAXPBX@Z(ptr ptr) __ExceptionPtrCopy
@ cdecl -arch=win64 ?__ExceptionPtrCopy@@YAXPEAXPEBX@Z(ptr ptr) __ExceptionPtrCopy
@ stub -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
@ stub -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z(ptr ptr ptr) __ExceptionPtrCopyException
@ cdecl -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z(ptr ptr ptr) __ExceptionPtrCopyException
@ cdecl -arch=win32 ?__ExceptionPtrCreate@@YAXPAX@Z(ptr) __ExceptionPtrCreate
@ cdecl -arch=win64 ?__ExceptionPtrCreate@@YAXPEAX@Z(ptr) __ExceptionPtrCreate
@ cdecl -arch=win32 ?__ExceptionPtrCurrentException@@YAXPAX@Z(ptr) __ExceptionPtrCurrentException

View File

@ -670,8 +670,8 @@
@ stub -arch=win64 ?__ExceptionPtrCompare@@YA_NPEBX0@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopy@@YAXPAXPBX@Z(ptr ptr) msvcr120.?__ExceptionPtrCopy@@YAXPAXPBX@Z
@ cdecl -arch=win64 ?__ExceptionPtrCopy@@YAXPEAXPEBX@Z(ptr ptr) msvcr120.?__ExceptionPtrCopy@@YAXPEAXPEBX@Z
@ stub -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
@ stub -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
@ cdecl -arch=win32 ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z(ptr ptr ptr) msvcr120.?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
@ cdecl -arch=win64 ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z(ptr ptr ptr) msvcr120.?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
@ cdecl -arch=win32 ?__ExceptionPtrCreate@@YAXPAX@Z(ptr) msvcr120.?__ExceptionPtrCreate@@YAXPAX@Z
@ cdecl -arch=win64 ?__ExceptionPtrCreate@@YAXPEAX@Z(ptr) msvcr120.?__ExceptionPtrCreate@@YAXPEAX@Z
@ cdecl -arch=win32 ?__ExceptionPtrCurrentException@@YAXPAX@Z(ptr) msvcr120.?__ExceptionPtrCurrentException@@YAXPAX@Z

View File

@ -1499,6 +1499,87 @@ MSVCRT_bool __cdecl __ExceptionPtrToBool(exception_ptr *ep)
return !!ep->rec;
}
/*********************************************************************
* ?__ExceptionPtrCopyException@@YAXPAXPBX1@Z
* ?__ExceptionPtrCopyException@@YAXPEAXPEBX1@Z
*/
#ifndef __x86_64__
void __cdecl __ExceptionPtrCopyException(exception_ptr *ep,
exception *object, const cxx_exception_type *type)
{
const cxx_type_info *ti;
void **data;
__ExceptionPtrDestroy(ep);
ep->rec = HeapAlloc(GetProcessHeap(), 0, sizeof(EXCEPTION_RECORD));
ep->ref = HeapAlloc(GetProcessHeap(), 0, sizeof(int));
*ep->ref = 1;
memset(ep->rec, 0, sizeof(EXCEPTION_RECORD));
ep->rec->ExceptionCode = CXX_EXCEPTION;
ep->rec->ExceptionFlags = EH_NONCONTINUABLE;
ep->rec->NumberParameters = 3;
ep->rec->ExceptionInformation[0] = CXX_FRAME_MAGIC_VC6;
ep->rec->ExceptionInformation[2] = (ULONG_PTR)type;
ti = type->type_info_table->info[0];
data = HeapAlloc(GetProcessHeap(), 0, ti->size);
if (ti->flags & CLASS_IS_SIMPLE_TYPE)
{
memcpy(data, object, ti->size);
if (ti->size == sizeof(void *)) *data = get_this_pointer(&ti->offsets, *data);
}
else if (ti->copy_ctor)
{
call_copy_ctor(ti->copy_ctor, data, get_this_pointer(&ti->offsets, object),
ti->flags & CLASS_HAS_VIRTUAL_BASE_CLASS);
}
else
memcpy(data, get_this_pointer(&ti->offsets, object), ti->size);
ep->rec->ExceptionInformation[1] = (ULONG_PTR)data;
}
#else
void __cdecl __ExceptionPtrCopyException(exception_ptr *ep,
exception *object, const cxx_exception_type *type)
{
const cxx_type_info *ti;
void **data;
char *base;
RtlPcToFileHeader((void*)type, (void**)&base);
__ExceptionPtrDestroy(ep);
ep->rec = HeapAlloc(GetProcessHeap(), 0, sizeof(EXCEPTION_RECORD));
ep->ref = HeapAlloc(GetProcessHeap(), 0, sizeof(int));
*ep->ref = 1;
memset(ep->rec, 0, sizeof(EXCEPTION_RECORD));
ep->rec->ExceptionCode = CXX_EXCEPTION;
ep->rec->ExceptionFlags = EH_NONCONTINUABLE;
ep->rec->NumberParameters = 4;
ep->rec->ExceptionInformation[0] = CXX_FRAME_MAGIC_VC6;
ep->rec->ExceptionInformation[2] = (ULONG_PTR)type;
ep->rec->ExceptionInformation[3] = (ULONG_PTR)base;
ti = (const cxx_type_info*)(base + ((const cxx_type_info_table*)(base + type->type_info_table))->info[0]);
data = HeapAlloc(GetProcessHeap(), 0, ti->size);
if (ti->flags & CLASS_IS_SIMPLE_TYPE)
{
memcpy(data, object, ti->size);
if (ti->size == sizeof(void *)) *data = get_this_pointer(&ti->offsets, *data);
}
else if (ti->copy_ctor)
{
call_copy_ctor(base + ti->copy_ctor, data, get_this_pointer(&ti->offsets, object),
ti->flags & CLASS_HAS_VIRTUAL_BASE_CLASS);
}
else
memcpy(data, get_this_pointer(&ti->offsets, object), ti->size);
ep->rec->ExceptionInformation[1] = (ULONG_PTR)data;
}
#endif
void* __cdecl __AdjustPointer(void *obj, const this_ptr_offsets *off)
{
return get_this_pointer(off, obj);