diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c index ac363c41923..1f36bca5712 100644 --- a/dlls/msvcrt/cpp.c +++ b/dlls/msvcrt/cpp.c @@ -27,12 +27,13 @@ #include "wine/exception.h" #include "wine/debug.h" #include "msvcrt.h" -#include "cppexcept.h" #include "mtdll.h" #include "cxx.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); +CREATE_TYPE_INFO_VTABLE + struct __type_info_node { void *memPtr; @@ -626,27 +627,6 @@ const char * __thiscall type_info_raw_name(type_info * _this) return _this->mangled; } -/* Unexported */ -DEFINE_THISCALL_WRAPPER(type_info_vector_dtor,8) -void * __thiscall 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--) type_info_dtor(_this + i); - operator_delete(ptr); - } - else - { - type_info_dtor(_this); - if (flags & 1) operator_delete(_this); - } - return _this; -} - #if _MSVCR_VER >= 80 typedef exception bad_alloc; @@ -936,8 +916,6 @@ improper_scheduler_detach * __thiscall improper_scheduler_detach_copy_ctor( __ASM_BLOCK_BEGIN(vtables) -__ASM_VTABLE(type_info, - VTABLE_ADD_FUNC(type_info_vector_dtor)); __ASM_VTABLE(exception, VTABLE_ADD_FUNC(exception_vector_dtor) VTABLE_ADD_FUNC(what_exception)); @@ -984,7 +962,6 @@ __ASM_VTABLE(improper_scheduler_detach, __ASM_BLOCK_END -DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" ) #if _MSVCR_VER >= 80 DEFINE_RTTI_DATA0( exception, 0, ".?AVexception@std@@" ) DEFINE_RTTI_DATA0( exception_old, 0, ".?AVexception@@" ) diff --git a/dlls/msvcrt/cxx.h b/dlls/msvcrt/cxx.h index 77778730e25..1a5442725ef 100644 --- a/dlls/msvcrt/cxx.h +++ b/dlls/msvcrt/cxx.h @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/asm.h" +#include "cppexcept.h" #ifdef _WIN64 @@ -279,3 +279,32 @@ extern void *vtbl_wrapper_48; #endif exception* __thiscall exception_ctor(exception*, const char**); + +extern const vtable_ptr type_info_vtable; + +#define CREATE_TYPE_INFO_VTABLE \ +DEFINE_THISCALL_WRAPPER(type_info_vector_dtor,8) \ +void * __thiscall 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--) free(_this->name); \ + free(ptr); \ + } \ + else \ + { \ + free(_this->name); \ + 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(type_info_vector_dtor)); \ +__ASM_BLOCK_END diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c index 78767689c06..9c96217ca95 100644 --- a/dlls/msvcrt/lock.c +++ b/dlls/msvcrt/lock.c @@ -24,7 +24,6 @@ #include "winbase.h" #include "winternl.h" #include "msvcrt.h" -#include "cppexcept.h" #include "mtdll.h" #include "cxx.h" diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c index ef40a3236cd..b8bff6119bf 100644 --- a/dlls/msvcrt/scheduler.c +++ b/dlls/msvcrt/scheduler.c @@ -25,7 +25,6 @@ #include "winternl.h" #include "wine/debug.h" #include "msvcrt.h" -#include "cppexcept.h" #include "cxx.h" #if _MSVCR_VER >= 100 @@ -1097,7 +1096,6 @@ DEFINE_VTBL_WRAPPER(48); #endif -extern const vtable_ptr type_info_vtable; DEFINE_RTTI_DATA0(Context, 0, ".?AVContext@Concurrency@@") DEFINE_RTTI_DATA1(ContextBase, 0, &Context_rtti_base_descriptor, ".?AVContextBase@details@Concurrency@@") DEFINE_RTTI_DATA2(ExternalContextBase, 0, &ContextBase_rtti_base_descriptor,