msvcp90: Add macro that define type_info vtable.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 6568a8cb62)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Piotr Caban 2021-04-06 17:05:09 +03:00 committed by Michael Stefaniuc
parent cfec1ccd0d
commit 1a38fd0a54
2 changed files with 34 additions and 30 deletions

View File

@ -449,3 +449,35 @@ typedef struct
} cxx_exception_type;
#endif
#define CREATE_TYPE_INFO_VTABLE\
static void MSVCP_type_info_dtor(type_info * _this) \
{ \
free(_this->name); \
} \
\
DEFINE_THISCALL_WRAPPER(MSVCP_type_info_vector_dtor,8) \
void * __thiscall MSVCP_type_info_vector_dtor(type_info * _this, unsigned int flags) \
{ \
if (flags & 2) \
{ \
/* we have an array, with the number of elements stored before the first object */ \
INT_PTR i, *ptr = (INT_PTR *)_this - 1; \
\
for (i = *ptr - 1; i >= 0; i--) MSVCP_type_info_dtor(_this + i); \
free(ptr); \
} \
else \
{ \
MSVCP_type_info_dtor(_this); \
if (flags & 1) free(_this); \
} \
return _this; \
} \
\
DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" ) \
\
__ASM_BLOCK_BEGIN(type_info_vtables) \
__ASM_VTABLE(type_info, \
VTABLE_ADD_FUNC(MSVCP_type_info_vector_dtor)); \
__ASM_BLOCK_END

View File

@ -26,6 +26,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
CREATE_TYPE_INFO_VTABLE
#define CLASS_IS_SIMPLE_TYPE 1
#define CLASS_HAS_VIRTUAL_BASE_CLASS 4
@ -65,34 +67,6 @@ extern const vtable_ptr MSVCP_bad_cast_vtable;
/* ??_7range_error@std@@6B@ */
extern const vtable_ptr MSVCP_range_error_vtable;
static void MSVCP_type_info_dtor(type_info * _this)
{
free(_this->name);
}
/* Unexported */
DEFINE_THISCALL_WRAPPER(MSVCP_type_info_vector_dtor,8)
void * __thiscall MSVCP_type_info_vector_dtor(type_info * _this, unsigned int flags)
{
TRACE("(%p %x)\n", _this, flags);
if (flags & 2)
{
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)_this - 1;
for (i = *ptr - 1; i >= 0; i--) MSVCP_type_info_dtor(_this + i);
MSVCRT_operator_delete(ptr);
}
else
{
MSVCP_type_info_dtor(_this);
if (flags & 1) MSVCRT_operator_delete(_this);
}
return _this;
}
DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" )
/* ??0exception@@QAE@ABQBD@Z */
/* ??0exception@@QEAA@AEBQEBD@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_exception_ctor,8)
@ -1022,8 +996,6 @@ void __cdecl __ExceptionPtrDestroy(exception_ptr *ep)
#endif
__ASM_BLOCK_BEGIN(exception_vtables)
__ASM_VTABLE(type_info,
VTABLE_ADD_FUNC(MSVCP_type_info_vector_dtor));
EXCEPTION_VTABLE(exception,
VTABLE_ADD_FUNC(MSVCP_exception_vector_dtor)
VTABLE_ADD_FUNC(MSVCP_exception_what));