Author: fireball Date: Sun Nov 11 20:03:20 2007 New Revision: 30361
URL: http://svn.reactos.org/svn/reactos?rev=30361&view=rev Log: - Update MSVCRT_thread_data - Winesync cpp.c.
Modified: trunk/reactos/lib/sdk/crt/except/cpp.c trunk/reactos/lib/sdk/crt/except/cppexcept.c trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h trunk/reactos/lib/sdk/crt/include/internal/wine/msvcrt.h trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/lib/sdk/crt/except/cpp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/cpp.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/except/cpp.c (original) +++ trunk/reactos/lib/sdk/crt/except/cpp.c Sun Nov 11 20:03:20 2007 @@ -2,7 +2,7 @@ * msvcrt.dll C++ objects * * Copyright 2000 Jon Griffiths - * Copyright 2003 Alexandre Julliard + * Copyright 2003, 2004 Alexandre Julliard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#include "wine/config.h" @@ -41,81 +41,101 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
-/* - * exception object: base for exception, bad_cast, bad_typeid, __non_rtti_object - */ -typedef struct -{ - void* pfn_vector_dtor; - void* pfn_what; -} exception_vtable; - -typedef struct __exception -{ - const exception_vtable *vtable; - char *name; /* Name of this exception, always a new copy for each object */ - int do_free; /* Whether to free 'name' in our dtor */ -} exception; - typedef exception bad_cast; typedef exception bad_typeid; typedef exception __non_rtti_object;
typedef struct _rtti_base_descriptor { - type_info *type_descriptor; + const type_info *type_descriptor; int num_base_classes; + this_ptr_offsets offsets; /* offsets for computing the this pointer */ + unsigned int attributes; +} rtti_base_descriptor; + +typedef struct _rtti_base_array +{ + const rtti_base_descriptor *bases[3]; /* First element is the class itself */ +} rtti_base_array; + +typedef struct _rtti_object_hierarchy +{ + unsigned int signature; + unsigned int attributes; + int array_len; /* Size of the array pointed to by 'base_classes' */ + const rtti_base_array *base_classes; +} rtti_object_hierarchy; + +typedef struct _rtti_object_locator +{ + unsigned int signature; int base_class_offset; unsigned int flags; - int unknown1; - int unknown2; -} rtti_base_descriptor; - -typedef struct _rtti_base_array -{ - const rtti_base_descriptor *bases[3]; /* First element is the class itself */ -} rtti_base_array; - -typedef struct _rtti_object_hierachy -{ - int unknown1; - int unknown2; - int array_len; /* Size of the array pointed to by 'base_classes' */ - const rtti_base_array *base_classes; -} rtti_object_hierachy; - -typedef struct _rtti_object_locator -{ - int unknown1; - int base_class_offset; - unsigned int flags; - type_info *type_descriptor; - const rtti_object_hierachy *type_hierachy; + const type_info *type_descriptor; + const rtti_object_hierarchy *type_hierarchy; } rtti_object_locator;
#ifdef __i386__ /* thiscall functions are i386-specific */
-#define DEFINE_THISCALL_WRAPPER0(func) \ - extern void __thiscall_ ## func(); \ +#define THISCALL(func) __thiscall_ ## func +#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) +#define DEFINE_THISCALL_WRAPPER(func) \ + extern void THISCALL(func)(); \ __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ "popl %eax\n\t" \ "pushl %ecx\n\t" \ "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) "@4" ) -#define DEFINE_THISCALL_WRAPPER1(func) \ - extern void __thiscall_ ## func(); \ - __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) "@8" ) - -const exception_vtable MSVCRT_exception_vtable; -const exception_vtable MSVCRT_bad_typeid_vtable; -const exception_vtable MSVCRT_bad_cast_vtable; -const exception_vtable MSVCRT___non_rtti_object_vtable; -static const exception_vtable MSVCRT_type_info_vtable; + "jmp " __ASM_NAME(#func) ) +#else /* __i386__ */ + +#define THISCALL(func) func +#define THISCALL_NAME(func) __ASM_NAME(#func) +#define DEFINE_THISCALL_WRAPPER(func) /* nothing */ + +#endif /* __i386__ */ + +extern const vtable_ptr MSVCRT_exception_vtable; +extern const vtable_ptr MSVCRT_bad_typeid_vtable; +extern const vtable_ptr MSVCRT_bad_cast_vtable; +extern const vtable_ptr MSVCRT___non_rtti_object_vtable; +extern const vtable_ptr MSVCRT_type_info_vtable; + +/* get the vtable pointer for a C++ object */ +static inline const vtable_ptr *get_vtable( void *obj ) +{ + return *(const vtable_ptr **)obj; +} + +static inline const rtti_object_locator *get_obj_locator( void *cppobj ) +{ + const vtable_ptr *vtable = get_vtable( cppobj ); + return (const rtti_object_locator *)vtable[-1]; +} + +static void dump_obj_locator( const rtti_object_locator *ptr ) +{ + int i; + const rtti_object_hierarchy *h = ptr->type_hierarchy; + + TRACE( "%p: sig=%08x base_offset=%08x flags=%08x type=%p %s hierarchy=%p\n", + ptr, ptr->signature, ptr->base_class_offset, ptr->flags, + ptr->type_descriptor, dbgstr_type_info(ptr->type_descriptor), ptr->type_hierarchy ); + TRACE( " hierarchy: sig=%08x attr=%08x len=%d base classes=%p\n", + h->signature, h->attributes, h->array_len, h->base_classes ); + for (i = 0; i < h->array_len; i++) + { + TRACE( " base class %p: num %d off %d,%d,%d attr %08x type %p %s\n", + h->base_classes->bases[i], + h->base_classes->bases[i]->num_base_classes, + h->base_classes->bases[i]->offsets.this_offset, + h->base_classes->bases[i]->offsets.vbase_descr, + h->base_classes->bases[i]->offsets.vbase_offset, + h->base_classes->bases[i]->attributes, + h->base_classes->bases[i]->type_descriptor, + dbgstr_type_info(h->base_classes->bases[i]->type_descriptor) ); + } +}
/* Internal common ctor for exception */ static void WINAPI EXCEPTION_ctor(exception *_this, const char** name) @@ -125,7 +145,7 @@ { size_t name_len = strlen(*name) + 1; _this->name = MSVCRT_malloc(name_len); - memcpy(_this->name, *name, name_len); + memcpy(_this->name, *name, name_len); _this->do_free = TRUE; } else @@ -138,7 +158,7 @@ /****************************************************************** * ??0exception@@QAE@ABQBD@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_exception_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT_exception_ctor) exception * __stdcall MSVCRT_exception_ctor(exception * _this, const char ** name) { TRACE("(%p,%s)\n", _this, *name); @@ -149,7 +169,7 @@ /****************************************************************** * ??0exception@@QAE@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_exception_copy_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT_exception_copy_ctor) exception * __stdcall MSVCRT_exception_copy_ctor(exception * _this, const exception * rhs) { TRACE("(%p,%p)\n", _this, rhs); @@ -169,7 +189,7 @@ /****************************************************************** * ??0exception@@QAE@XZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_exception_default_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT_exception_default_ctor) exception * __stdcall MSVCRT_exception_default_ctor(exception * _this) { static const char* empty = NULL; @@ -182,7 +202,7 @@ /****************************************************************** * ??1exception@@UAE@XZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_exception_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_exception_dtor) void __stdcall MSVCRT_exception_dtor(exception * _this) { TRACE("(%p)\n", _this); @@ -193,7 +213,7 @@ /****************************************************************** * ??4exception@@QAEAAV0@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_exception_opequals); +DEFINE_THISCALL_WRAPPER(MSVCRT_exception_opequals) exception * __stdcall MSVCRT_exception_opequals(exception * _this, const exception * rhs) { TRACE("(%p %p)\n", _this, rhs); @@ -209,7 +229,7 @@ /****************************************************************** * ??_Eexception@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_exception_vector_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_exception_vector_dtor) void * __stdcall MSVCRT_exception_vector_dtor(exception * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -232,7 +252,7 @@ /****************************************************************** * ??_Gexception@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_exception_scalar_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_exception_scalar_dtor) void * __stdcall MSVCRT_exception_scalar_dtor(exception * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -244,7 +264,7 @@ /****************************************************************** * ?what@exception@@UBEPBDXZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_what_exception); +DEFINE_THISCALL_WRAPPER(MSVCRT_what_exception) const char * __stdcall MSVCRT_what_exception(exception * _this) { TRACE("(%p) returning %s\n", _this, _this->name); @@ -254,7 +274,7 @@ /****************************************************************** * ??0bad_typeid@@QAE@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_typeid_copy_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_typeid_copy_ctor) bad_typeid * __stdcall MSVCRT_bad_typeid_copy_ctor(bad_typeid * _this, const bad_typeid * rhs) { TRACE("(%p %p)\n", _this, rhs); @@ -266,7 +286,7 @@ /****************************************************************** * ??0bad_typeid@@QAE@PBD@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_typeid_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_typeid_ctor) bad_typeid * __stdcall MSVCRT_bad_typeid_ctor(bad_typeid * _this, const char * name) { TRACE("(%p %s)\n", _this, name); @@ -278,7 +298,7 @@ /****************************************************************** * ??1bad_typeid@@UAE@XZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_bad_typeid_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_typeid_dtor) void __stdcall MSVCRT_bad_typeid_dtor(bad_typeid * _this) { TRACE("(%p)\n", _this); @@ -288,7 +308,7 @@ /****************************************************************** * ??4bad_typeid@@QAEAAV0@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_typeid_opequals); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_typeid_opequals) bad_typeid * __stdcall MSVCRT_bad_typeid_opequals(bad_typeid * _this, const bad_typeid * rhs) { TRACE("(%p %p)\n", _this, rhs); @@ -299,7 +319,7 @@ /****************************************************************** * ??_Ebad_typeid@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_typeid_vector_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_typeid_vector_dtor) void * __stdcall MSVCRT_bad_typeid_vector_dtor(bad_typeid * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -322,7 +342,7 @@ /****************************************************************** * ??_Gbad_typeid@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_typeid_scalar_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_typeid_scalar_dtor) void * __stdcall MSVCRT_bad_typeid_scalar_dtor(bad_typeid * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -334,7 +354,7 @@ /****************************************************************** * ??0__non_rtti_object@@QAE@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT___non_rtti_object_copy_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT___non_rtti_object_copy_ctor) __non_rtti_object * __stdcall MSVCRT___non_rtti_object_copy_ctor(__non_rtti_object * _this, const __non_rtti_object * rhs) { @@ -347,7 +367,7 @@ /****************************************************************** * ??0__non_rtti_object@@QAE@PBD@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT___non_rtti_object_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT___non_rtti_object_ctor) __non_rtti_object * __stdcall MSVCRT___non_rtti_object_ctor(__non_rtti_object * _this, const char * name) { @@ -360,7 +380,7 @@ /****************************************************************** * ??1__non_rtti_object@@UAE@XZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT___non_rtti_object_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT___non_rtti_object_dtor) void __stdcall MSVCRT___non_rtti_object_dtor(__non_rtti_object * _this) { TRACE("(%p)\n", _this); @@ -370,7 +390,7 @@ /****************************************************************** * ??4__non_rtti_object@@QAEAAV0@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT___non_rtti_object_opequals); +DEFINE_THISCALL_WRAPPER(MSVCRT___non_rtti_object_opequals) __non_rtti_object * __stdcall MSVCRT___non_rtti_object_opequals(__non_rtti_object * _this, const __non_rtti_object *rhs) { @@ -382,7 +402,7 @@ /****************************************************************** * ??_E__non_rtti_object@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT___non_rtti_object_vector_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT___non_rtti_object_vector_dtor) void * __stdcall MSVCRT___non_rtti_object_vector_dtor(__non_rtti_object * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -405,7 +425,7 @@ /****************************************************************** * ??_G__non_rtti_object@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT___non_rtti_object_scalar_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT___non_rtti_object_scalar_dtor) void * __stdcall MSVCRT___non_rtti_object_scalar_dtor(__non_rtti_object * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -417,7 +437,7 @@ /****************************************************************** * ??0bad_cast@@QAE@ABQBD@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_cast_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_cast_ctor) bad_cast * __stdcall MSVCRT_bad_cast_ctor(bad_cast * _this, const char ** name) { TRACE("(%p %s)\n", _this, *name); @@ -429,7 +449,7 @@ /****************************************************************** * ??0bad_cast@@QAE@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_cast_copy_ctor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_cast_copy_ctor) bad_cast * __stdcall MSVCRT_bad_cast_copy_ctor(bad_cast * _this, const bad_cast * rhs) { TRACE("(%p %p)\n", _this, rhs); @@ -441,7 +461,7 @@ /****************************************************************** * ??1bad_cast@@UAE@XZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_bad_cast_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_cast_dtor) void __stdcall MSVCRT_bad_cast_dtor(bad_cast * _this) { TRACE("(%p)\n", _this); @@ -451,7 +471,7 @@ /****************************************************************** * ??4bad_cast@@QAEAAV0@ABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_cast_opequals); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_cast_opequals) bad_cast * __stdcall MSVCRT_bad_cast_opequals(bad_cast * _this, const bad_cast * rhs) { TRACE("(%p %p)\n", _this, rhs); @@ -462,7 +482,7 @@ /****************************************************************** * ??_Ebad_cast@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_cast_vector_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_cast_vector_dtor) void * __stdcall MSVCRT_bad_cast_vector_dtor(bad_cast * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -485,7 +505,7 @@ /****************************************************************** * ??_Gbad_cast@@UAEPAXI@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_bad_cast_scalar_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_bad_cast_scalar_dtor) void * __stdcall MSVCRT_bad_cast_scalar_dtor(bad_cast * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -497,7 +517,7 @@ /****************************************************************** * ??8type_info@@QBEHABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_type_info_opequals_equals); +DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_opequals_equals) int __stdcall MSVCRT_type_info_opequals_equals(type_info * _this, const type_info * rhs) { int ret = !strcmp(_this->mangled + 1, rhs->mangled + 1); @@ -508,7 +528,7 @@ /****************************************************************** * ??9type_info@@QBEHABV0@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_type_info_opnot_equals); +DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_opnot_equals) int __stdcall MSVCRT_type_info_opnot_equals(type_info * _this, const type_info * rhs) { int ret = !!strcmp(_this->mangled + 1, rhs->mangled + 1); @@ -519,7 +539,7 @@ /****************************************************************** * ?before@type_info@@QBEHABV1@@Z (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_type_info_before); +DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_before) int __stdcall MSVCRT_type_info_before(type_info * _this, const type_info * rhs) { int ret = strcmp(_this->mangled + 1, rhs->mangled + 1) < 0; @@ -530,18 +550,17 @@ /****************************************************************** * ??1type_info@@UAE@XZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_type_info_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_dtor) void __stdcall MSVCRT_type_info_dtor(type_info * _this) { TRACE("(%p)\n", _this); - if (_this->name) - MSVCRT_free(_this->name); + MSVCRT_free(_this->name); }
/****************************************************************** * ?name@type_info@@QBEPBDXZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_type_info_name); +DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_name) const char * __stdcall MSVCRT_type_info_name(type_info * _this) { if (!_this->name) @@ -582,7 +601,7 @@ /****************************************************************** * ?raw_name@type_info@@QBEPBDXZ (MSVCRT.@) */ -DEFINE_THISCALL_WRAPPER0(MSVCRT_type_info_raw_name); +DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_raw_name) const char * __stdcall MSVCRT_type_info_raw_name(type_info * _this) { TRACE("(%p) returning %s\n", _this, _this->mangled); @@ -590,7 +609,7 @@ }
/* Unexported */ -DEFINE_THISCALL_WRAPPER1(MSVCRT_type_info_vector_dtor); +DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_vector_dtor) void * __stdcall MSVCRT_type_info_vector_dtor(type_info * _this, unsigned int flags) { TRACE("(%p %x)\n", _this, flags); @@ -612,41 +631,37 @@
/* vtables */
-const exception_vtable MSVCRT_exception_vtable = -{ - __thiscall_MSVCRT_exception_vector_dtor, - __thiscall_MSVCRT_what_exception -}; - -const exception_vtable MSVCRT_bad_typeid_vtable = -{ - __thiscall_MSVCRT_bad_typeid_vector_dtor, - __thiscall_MSVCRT_what_exception -}; - -const exception_vtable MSVCRT_bad_cast_vtable = -{ - __thiscall_MSVCRT_bad_cast_vector_dtor, - __thiscall_MSVCRT_what_exception -}; - -const exception_vtable MSVCRT___non_rtti_object_vtable = -{ - __thiscall_MSVCRT___non_rtti_object_vector_dtor, - __thiscall_MSVCRT_what_exception -}; - -static const exception_vtable MSVCRT_type_info_vtable = -{ - __thiscall_MSVCRT_type_info_vector_dtor, - NULL -}; +#define __ASM_VTABLE(name,funcs) \ + __asm__(".data\n" \ + "\t.align 4\n" \ + "\t.long " __ASM_NAME(#name "_rtti") "\n" \ + "\t.globl " __ASM_NAME("MSVCRT_" #name "_vtable") "\n" \ + __ASM_NAME("MSVCRT_" #name "_vtable") ":\n" \ + "\t.long " THISCALL_NAME(MSVCRT_ ## name ## _vector_dtor) "\n" \ + funcs "\n\t.text"); + +#define __ASM_EXCEPTION_VTABLE(name) \ + __ASM_VTABLE(name, "\t.long " THISCALL_NAME(MSVCRT_what_exception) ) + +#ifndef __GNUC__ +void __asm_dummy_vtables(void) { +#endif + +__ASM_VTABLE(type_info,"") +__ASM_EXCEPTION_VTABLE(exception) +__ASM_EXCEPTION_VTABLE(bad_typeid) +__ASM_EXCEPTION_VTABLE(bad_cast) +__ASM_EXCEPTION_VTABLE(__non_rtti_object) + +#ifndef __GNUC__ +} +#endif
/* Static RTTI for exported objects */
-static type_info exception_type_info = -{ - (void*)&MSVCRT_type_info_vtable, +static const type_info exception_type_info = +{ + &MSVCRT_type_info_vtable, NULL, ".?AVexception@@" }; @@ -655,9 +670,7 @@ { &exception_type_info, 0, - 0, - 0, - 0, + { 0, -1, 0 }, 0 };
@@ -670,7 +683,7 @@ } };
-static const rtti_object_hierachy exception_type_hierachy = +static const rtti_object_hierarchy exception_type_hierarchy = { 0, 0, @@ -678,29 +691,27 @@ &exception_rtti_base_array };
-static const rtti_object_locator exception_rtti = +const rtti_object_locator exception_rtti = { 0, 0, 0, &exception_type_info, - &exception_type_hierachy + &exception_type_hierarchy };
static const cxx_type_info exception_cxx_type_info = { 0, &exception_type_info, - 0, - -1, - 0, + { 0, -1, 0 }, sizeof(exception), - (cxx_copy_ctor)__thiscall_MSVCRT_exception_copy_ctor -}; - -static type_info bad_typeid_type_info = -{ - (void*)&MSVCRT_type_info_vtable, + (cxx_copy_ctor)THISCALL(MSVCRT_exception_copy_ctor) +}; + +static const type_info bad_typeid_type_info = +{ + &MSVCRT_type_info_vtable, NULL, ".?AVbad_typeid@@" }; @@ -709,9 +720,7 @@ { &bad_typeid_type_info, 1, - 0, - 0xffffffff, - 0, + { 0, -1, 0 }, 0 };
@@ -724,7 +733,7 @@ } };
-static const rtti_object_hierachy bad_typeid_type_hierachy = +static const rtti_object_hierarchy bad_typeid_type_hierarchy = { 0, 0, @@ -732,29 +741,27 @@ &bad_typeid_rtti_base_array };
-static const rtti_object_locator bad_typeid_rtti = +const rtti_object_locator bad_typeid_rtti = { 0, 0, 0, &bad_typeid_type_info, - &bad_typeid_type_hierachy + &bad_typeid_type_hierarchy };
static const cxx_type_info bad_typeid_cxx_type_info = { 0, &bad_typeid_type_info, - 0, - -1, - 0, + { 0, -1, 0 }, sizeof(exception), - (cxx_copy_ctor)__thiscall_MSVCRT_bad_typeid_copy_ctor -}; - -static type_info bad_cast_type_info = -{ - (void*)&MSVCRT_type_info_vtable, + (cxx_copy_ctor)THISCALL(MSVCRT_bad_typeid_copy_ctor) +}; + +static const type_info bad_cast_type_info = +{ + &MSVCRT_type_info_vtable, NULL, ".?AVbad_cast@@" }; @@ -763,9 +770,7 @@ { &bad_cast_type_info, 1, - 0, - 0xffffffff, - 0, + { 0, -1, 0 }, 0 };
@@ -778,7 +783,7 @@ } };
-static const rtti_object_hierachy bad_cast_type_hierachy = +static const rtti_object_hierarchy bad_cast_type_hierarchy = { 0, 0, @@ -786,29 +791,27 @@ &bad_cast_rtti_base_array };
-static const rtti_object_locator bad_cast_rtti = +const rtti_object_locator bad_cast_rtti = { 0, 0, 0, &bad_cast_type_info, - &bad_cast_type_hierachy + &bad_cast_type_hierarchy };
static const cxx_type_info bad_cast_cxx_type_info = { 0, &bad_cast_type_info, - 0, - -1, - 0, + { 0, -1, 0 }, sizeof(exception), - (cxx_copy_ctor)__thiscall_MSVCRT_bad_cast_copy_ctor -}; - -static type_info __non_rtti_object_type_info = -{ - (void*)&MSVCRT_type_info_vtable, + (cxx_copy_ctor)THISCALL(MSVCRT_bad_cast_copy_ctor) +}; + +static const type_info __non_rtti_object_type_info = +{ + &MSVCRT_type_info_vtable, NULL, ".?AV__non_rtti_object@@" }; @@ -817,9 +820,7 @@ { &__non_rtti_object_type_info, 2, - 0, - 0xffffffff, - 0, + { 0, -1, 0 }, 0 };
@@ -832,7 +833,7 @@ } };
-static const rtti_object_hierachy __non_rtti_object_type_hierachy = +static const rtti_object_hierarchy __non_rtti_object_type_hierarchy = { 0, 0, @@ -840,29 +841,27 @@ &__non_rtti_object_rtti_base_array };
-static const rtti_object_locator __non_rtti_object_rtti = +const rtti_object_locator __non_rtti_object_rtti = { 0, 0, 0, &__non_rtti_object_type_info, - &__non_rtti_object_type_hierachy + &__non_rtti_object_type_hierarchy };
static const cxx_type_info __non_rtti_object_cxx_type_info = { 0, &__non_rtti_object_type_info, - 0, - -1, - 0, + { 0, -1, 0 }, sizeof(exception), - (cxx_copy_ctor)__thiscall_MSVCRT___non_rtti_object_copy_ctor -}; - -static type_info type_info_type_info = -{ - (void*)&MSVCRT_type_info_vtable, + (cxx_copy_ctor)THISCALL(MSVCRT___non_rtti_object_copy_ctor) +}; + +static const type_info type_info_type_info = +{ + &MSVCRT_type_info_vtable, NULL, ".?AVtype_info@@" }; @@ -871,9 +870,7 @@ { &type_info_type_info, 0, - 0, - 0xffffffff, - 0, + { 0, -1, 0 }, 0 };
@@ -886,7 +883,7 @@ } };
-static const rtti_object_hierachy type_info_type_hierachy = +static const rtti_object_hierarchy type_info_type_hierarchy = { 0, 0, @@ -894,13 +891,13 @@ &type_info_rtti_base_array };
-static const rtti_object_locator type_info_rtti = +const rtti_object_locator type_info_rtti = { 0, 0, 0, &type_info_type_info, - &type_info_type_hierachy + &type_info_type_hierarchy };
/* @@ -919,7 +916,7 @@ static const cxx_exception_type bad_cast_exception_type = { 0, - (void*)__thiscall_MSVCRT_bad_cast_dtor, + (void*)THISCALL(MSVCRT_bad_cast_dtor), NULL, &bad_cast_type_info_table }; @@ -937,7 +934,7 @@ static const cxx_exception_type bad_typeid_exception_type = { 0, - (void*)__thiscall_MSVCRT_bad_typeid_dtor, + (void*)THISCALL(MSVCRT_bad_typeid_dtor), NULL, &bad_cast_type_info_table }; @@ -945,13 +942,11 @@ static const cxx_exception_type __non_rtti_object_exception_type = { 0, - (void*)__thiscall_MSVCRT___non_rtti_object_dtor, + (void*)THISCALL(MSVCRT___non_rtti_object_dtor), NULL, &bad_typeid_type_info_table };
-#endif /* __i386__ */ -
/****************************************************************** * ?set_terminate@@YAP6AXXZP6AXXZ@Z (MSVCRT.@) @@ -964,7 +959,7 @@ * RETURNS * The previously installed handler function, if any. */ -terminate_function MSVCRT_set_terminate(terminate_function func) +terminate_function CDECL MSVCRT_set_terminate(terminate_function func) { MSVCRT_thread_data *data = msvcrt_get_thread_data(); terminate_function previous = data->terminate_handler; @@ -984,7 +979,7 @@ * RETURNS * The previously installed handler function, if any. */ -unexpected_function MSVCRT_set_unexpected(unexpected_function func) +unexpected_function CDECL MSVCRT_set_unexpected(unexpected_function func) { MSVCRT_thread_data *data = msvcrt_get_thread_data(); unexpected_function previous = data->unexpected_handler; @@ -996,7 +991,7 @@ /****************************************************************** * ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z (MSVCRT.@) */ -_se_translator_function MSVCRT__set_se_translator(_se_translator_function func) +_se_translator_function CDECL MSVCRT__set_se_translator(_se_translator_function func) { MSVCRT_thread_data *data = msvcrt_get_thread_data(); _se_translator_function previous = data->se_translator; @@ -1018,7 +1013,7 @@ * handler installed by calling set_terminate(), or (by default) abort() * is called. */ -void MSVCRT_terminate(void) +void CDECL MSVCRT_terminate(void) { MSVCRT_thread_data *data = msvcrt_get_thread_data(); if (data->terminate_handler) data->terminate_handler(); @@ -1028,59 +1023,13 @@ /****************************************************************** * ?unexpected@@YAXXZ (MSVCRT.@) */ -void MSVCRT_unexpected(void) +void CDECL MSVCRT_unexpected(void) { MSVCRT_thread_data *data = msvcrt_get_thread_data(); if (data->unexpected_handler) data->unexpected_handler(); MSVCRT_terminate(); }
-/* Get type info from an object (internal) */ -static const rtti_object_locator* RTTI_GetObjectLocator(type_info *cppobj) -{ - const rtti_object_locator *obj_locator = NULL; - -#ifdef __i386__ - const exception_vtable* vtable = (const exception_vtable*)cppobj->vtable; - - /* Perhaps this is one of classes we export? */ - if (vtable == &MSVCRT_exception_vtable) - { - TRACE("returning exception_rtti\n"); - return &exception_rtti; - } - else if (vtable == &MSVCRT_bad_typeid_vtable) - { - TRACE("returning bad_typeid_rtti\n"); - return &bad_typeid_rtti; - } - else if (vtable == &MSVCRT_bad_cast_vtable) - { - TRACE("returning bad_cast_rtti\n"); - return &bad_cast_rtti; - } - else if (vtable == &MSVCRT___non_rtti_object_vtable) - { - TRACE("returning __non_rtti_object_rtti\n"); - return &__non_rtti_object_rtti; - } - else if (vtable == &MSVCRT_type_info_vtable) - { - TRACE("returning type_info_rtti\n"); - return &type_info_rtti; - } -#endif - - if (!IsBadReadPtr(cppobj, sizeof(void *)) && - !IsBadReadPtr(cppobj->vtable - 1,sizeof(void *)) && - !IsBadReadPtr((void*)cppobj->vtable[-1], sizeof(rtti_object_locator))) - { - obj_locator = (rtti_object_locator *)cppobj->vtable[-1]; - TRACE("returning type_info from vtable (%p)\n", obj_locator); - } - - return obj_locator; -}
/****************************************************************** * __RTtypeid (MSVCRT.@) @@ -1100,39 +1049,32 @@ * This function is usually called by compiler generated code as a result * of using one of the C++ dynamic cast statements. */ -type_info* MSVCRT___RTtypeid(type_info *cppobj) -{ - const rtti_object_locator *obj_locator = RTTI_GetObjectLocator(cppobj); - -#ifdef __i386__ - if (!obj_locator) - { - static const char* szNullPtr = "Attempted a typeid of NULL pointer!"; - static const char* szBadPtr = "Bad read pointer - no RTTI data!"; - const cxx_exception_type *e_type; - exception e; - - /* Throw a bad_typeid or __non_rtti_object exception */ +const type_info* CDECL MSVCRT___RTtypeid(void *cppobj) +{ + const type_info *ret; + if (!cppobj) { - EXCEPTION_ctor(&e, &szNullPtr); - e.vtable = &MSVCRT_bad_typeid_vtable; - e_type = &bad_typeid_exception_type; - } - else - { - EXCEPTION_ctor(&e, &szBadPtr); - e.vtable = &MSVCRT___non_rtti_object_vtable; - e_type = &__non_rtti_object_exception_type; - } - - _CxxThrowException(&e, e_type); - DebugBreak(); - } - return obj_locator->type_descriptor; -#else - return NULL; -#endif + bad_typeid e; + MSVCRT_bad_typeid_ctor( &e, "Attempted a typeid of NULL pointer!" ); + _CxxThrowException( &e, &bad_typeid_exception_type ); + return NULL; + } + + __TRY + { + const rtti_object_locator *obj_locator = get_obj_locator( cppobj ); + ret = obj_locator->type_descriptor; + } + __EXCEPT_PAGE_FAULT + { + __non_rtti_object e; + MSVCRT___non_rtti_object_ctor( &e, "Bad read pointer - no RTTI data!" ); + _CxxThrowException( &e, &bad_typeid_exception_type ); + return NULL; + } + __ENDTRY + return ret; }
/****************************************************************** @@ -1157,66 +1099,67 @@ * This function is usually called by compiler generated code as a result * of using one of the C++ dynamic cast statements. */ -void* MSVCRT___RTDynamicCast(type_info *cppobj, int unknown, - type_info *src, type_info *dst, - int do_throw) -{ - const rtti_object_locator *obj_locator; - - /* Note: cppobj _isn't_ a type_info, we use that struct for its vtable ptr */ - TRACE("(%p,%d,%p,%p,%d)\n", cppobj, unknown, src, dst, do_throw); - if (!cppobj) - return 0; - obj_locator= RTTI_GetObjectLocator(cppobj); - if (unknown) - FIXME("Unknown parameter is non-zero: please report\n"); - - /* To cast an object at runtime: - * 1.Find out the true type of the object from the typeinfo at vtable[-1] - * 2.Search for the destination type in the class heirachy - * 3.If destination type is found, return base object address + dest offset - * Otherwise, fail the cast - */ - if (obj_locator) - { - int count = 0; - const rtti_object_hierachy *obj_bases = obj_locator->type_hierachy; - const rtti_base_descriptor* const *base_desc = obj_bases->base_classes->bases; - int src_offset = obj_locator->base_class_offset, dst_offset = -1; - - while (count < obj_bases->array_len) - { - const type_info *typ = (*base_desc)->type_descriptor; - - if (!strcmp(typ->mangled, dst->mangled)) - { - dst_offset = (*base_desc)->base_class_offset; - break; - } - base_desc++; - count++; - } - if (dst_offset >= 0) - return (void*)((unsigned long)cppobj - src_offset + dst_offset); - } - -#ifdef __i386__ - /* VC++ sets do_throw to 1 when the result of a dynamic_cast is assigned - * to a reference, since references cannot be NULL. - */ - if (do_throw) - { - static const char* exception_text = "Bad dynamic_cast!"; - exception e; - - /* Throw a bad_cast exception */ - EXCEPTION_ctor(&e, &exception_text); - e.vtable = &MSVCRT_bad_cast_vtable; - _CxxThrowException(&e, &bad_cast_exception_type); - DebugBreak(); - } -#endif - return NULL; +void* CDECL MSVCRT___RTDynamicCast(void *cppobj, int unknown, + type_info *src, type_info *dst, + int do_throw) +{ + void *ret; + + if (!cppobj) return NULL; + + TRACE("obj: %p unknown: %d src: %p %s dst: %p %s do_throw: %d)\n", + cppobj, unknown, src, dbgstr_type_info(src), dst, dbgstr_type_info(dst), do_throw); + + /* To cast an object at runtime: + * 1.Find out the true type of the object from the typeinfo at vtable[-1] + * 2.Search for the destination type in the class hierarchy + * 3.If destination type is found, return base object address + dest offset + * Otherwise, fail the cast + * + * FIXME: the unknown parameter doesn't seem to be used for anything + */ + __TRY + { + int i; + const rtti_object_locator *obj_locator = get_obj_locator( cppobj ); + const rtti_object_hierarchy *obj_bases = obj_locator->type_hierarchy; + const rtti_base_descriptor * const* base_desc = obj_bases->base_classes->bases; + + if (TRACE_ON(msvcrt)) dump_obj_locator(obj_locator); + + ret = NULL; + for (i = 0; i < obj_bases->array_len; i++) + { + const type_info *typ = base_desc[i]->type_descriptor; + + if (!strcmp(typ->mangled, dst->mangled)) + { + /* compute the correct this pointer for that base class */ + void *this_ptr = (char *)cppobj - obj_locator->base_class_offset; + ret = get_this_pointer( &base_desc[i]->offsets, this_ptr ); + break; + } + } + /* VC++ sets do_throw to 1 when the result of a dynamic_cast is assigned + * to a reference, since references cannot be NULL. + */ + if (!ret && do_throw) + { + const char *msg = "Bad dynamic_cast!"; + bad_cast e; + MSVCRT_bad_cast_ctor( &e, &msg ); + _CxxThrowException( &e, &bad_cast_exception_type ); + } + } + __EXCEPT_PAGE_FAULT + { + __non_rtti_object e; + MSVCRT___non_rtti_object_ctor( &e, "Access violation - no RTTI data!" ); + _CxxThrowException( &e, &bad_typeid_exception_type ); + return NULL; + } + __ENDTRY + return ret; }
@@ -1236,15 +1179,24 @@ * This function is usually called by compiler generated code as a result * of using one of the C++ dynamic cast statements. */ -void* MSVCRT___RTCastToVoid(type_info *cppobj) -{ - const rtti_object_locator *obj_locator = RTTI_GetObjectLocator(cppobj); - - /* Note: cppobj _isn't_ a type_info, we use that struct for its vtable ptr */ - TRACE("(%p)\n", cppobj); - - /* Casts to void* simply cast to the base object */ - if (obj_locator) - return (void*)((unsigned long)cppobj - obj_locator->base_class_offset); - return NULL; -} +void* CDECL MSVCRT___RTCastToVoid(void *cppobj) +{ + void *ret; + + if (!cppobj) return NULL; + + __TRY + { + const rtti_object_locator *obj_locator = get_obj_locator( cppobj ); + ret = (char *)cppobj - obj_locator->base_class_offset; + } + __EXCEPT_PAGE_FAULT + { + __non_rtti_object e; + MSVCRT___non_rtti_object_ctor( &e, "Access violation - no RTTI data!" ); + _CxxThrowException( &e, &bad_typeid_exception_type ); + return NULL; + } + __ENDTRY + return ret; +}
Modified: trunk/reactos/lib/sdk/crt/except/cppexcept.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/cppexcep... ============================================================================== --- trunk/reactos/lib/sdk/crt/except/cppexcept.c (original) +++ trunk/reactos/lib/sdk/crt/except/cppexcept.c Sun Nov 11 20:03:20 2007 @@ -78,10 +78,10 @@
static void dump_type( const cxx_type_info *type ) { - DPRINTF( "flags %x type %p", type->flags, type->type_info ); - if (type->type_info) DPRINTF( " (%p %s)", type->type_info->name, type->type_info->mangled ); - DPRINTF( " offset %d vbase %d,%d size %d copy ctor %p\n", type->this_offset, - type->vbase_descr, type->vbase_offset, type->size, type->copy_ctor ); + TRACE( "flags %x type %p %s offsets %d,%d,%d size %d copy ctor %p\n", + type->flags, type->type_info, dbgstr_type_info(type->type_info), + type->offsets.this_offset, type->offsets.vbase_descr, type->offsets.vbase_offset, + type->size, type->copy_ctor ); }
static void dump_exception_type( const cxx_exception_type *type ) @@ -129,25 +129,6 @@ } }
-/* compute the this pointer for a base class of a given type */ -static void *get_this_pointer( const cxx_type_info *type, void *object ) -{ - void *this_ptr; - int *offset_ptr; - - if (!object) return NULL; - this_ptr = (char *)object + type->this_offset; - if (type->vbase_descr >= 0) - { - /* move this ptr to vbase descriptor */ - this_ptr = (char *)this_ptr + type->vbase_descr; - /* and fetch additional offset from vbase descriptor */ - offset_ptr = (int *)(*(char **)this_ptr + type->vbase_offset); - this_ptr = (char *)this_ptr + *offset_ptr; - } - return this_ptr; -} - /* check if the exception type is caught by a given catch block, and return the type that matched */ static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type, catchblock_info *catchblock ) { @@ -185,21 +166,21 @@
if (catchblock->flags & TYPE_FLAG_REFERENCE) { - *dest_ptr = get_this_pointer( type, object ); + *dest_ptr = get_this_pointer( &type->offsets, object ); } else if (type->flags & CLASS_IS_SIMPLE_TYPE) { memmove( dest_ptr, object, type->size ); /* if it is a pointer, adjust it */ - if (type->size == sizeof(void *)) *dest_ptr = get_this_pointer( type, *dest_ptr ); + if (type->size == sizeof(void *)) *dest_ptr = get_this_pointer( &type->offsets, *dest_ptr ); } else /* copy the object */ { if (type->copy_ctor) - call_copy_ctor( type->copy_ctor, dest_ptr, get_this_pointer(type,object), + call_copy_ctor( type->copy_ctor, dest_ptr, get_this_pointer(&type->offsets,object), (type->flags & CLASS_HAS_VIRTUAL_BASE_CLASS) ); else - memmove( dest_ptr, get_this_pointer(type,object), type->size ); + memmove( dest_ptr, get_this_pointer(&type->offsets,object), type->size ); } }
Modified: trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/include/interna... ============================================================================== --- trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h (original) +++ trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h Sun Nov 11 20:03:20 2007 @@ -29,10 +29,18 @@ /* type_info object, see cpp.c for inplementation */ typedef struct __type_info { - vtable_ptr *vtable; - char *name; /* Unmangled name, allocated lazily */ - char mangled[32]; /* Variable length, but we declare it large enough for static RTTI */ + const vtable_ptr *vtable; + char *name; /* Unmangled name, allocated lazily */ + char mangled[32]; /* Variable length, but we declare it large enough for static RTTI */ } type_info; + +/* exception object */ +typedef struct __exception +{ + const vtable_ptr *vtable; + char *name; /* Name of this exception, always a new copy for each object */ + int do_free; /* Whether to free 'name' in our dtor */ +} exception;
/* the exception frame used by CxxFrameHandler */ typedef struct __cxx_exception_frame @@ -84,16 +92,22 @@
typedef void (*cxx_copy_ctor)(void);
+/* offsets for computing the this pointer */ +typedef struct +{ + int this_offset; /* offset of base class this pointer from start of object */ + int vbase_descr; /* offset of virtual base class descriptor */ + int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */ +} this_ptr_offsets; + /* complete information about a C++ type */ typedef struct __cxx_type_info { - UINT flags; /* flags (see CLASS_* flags below) */ - type_info *type_info; /* C++ type info */ - int this_offset; /* offset of base class this pointer from start of object */ - int vbase_descr; /* offset of virtual base class descriptor */ - int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */ - size_t size; /* object size */ - cxx_copy_ctor copy_ctor; /* copy constructor */ + UINT flags; /* flags (see CLASS_* flags below) */ + const type_info *type_info; /* C++ type info */ + this_ptr_offsets offsets; /* offsets for computing the this pointer */ + unsigned int size; /* object size */ + cxx_copy_ctor copy_ctor; /* copy constructor */ } cxx_type_info; #define CLASS_IS_SIMPLE_TYPE 1 #define CLASS_HAS_VIRTUAL_BASE_CLASS 4 @@ -121,4 +135,30 @@
void _CxxThrowException(void*,const cxx_exception_type*);
+static inline const char *dbgstr_type_info( const type_info *info ) +{ + if (!info) return "{}"; + return wine_dbg_sprintf( "{vtable=%p name=%s (%s)}", + info->vtable, info->mangled, info->name ? info->name : "" ); +} + +/* compute the this pointer for a base class of a given type */ +static inline void *get_this_pointer( const this_ptr_offsets *off, void *object ) +{ + void *this_ptr; + int *offset_ptr; + + if (!object) return NULL; + this_ptr = (char *)object + off->this_offset; + if (off->vbase_descr >= 0) + { + /* move this ptr to vbase descriptor */ + this_ptr = (char *)this_ptr + off->vbase_descr; + /* and fetch additional offset from vbase descriptor */ + offset_ptr = (int *)(*(char **)this_ptr + off->vbase_offset); + this_ptr = (char *)this_ptr + *offset_ptr; + } + return this_ptr; +} + #endif /* __MSVCRT_CPPEXCEPT_H */
Modified: trunk/reactos/lib/sdk/crt/include/internal/wine/msvcrt.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/include/interna... ============================================================================== --- trunk/reactos/lib/sdk/crt/include/internal/wine/msvcrt.h (original) +++ trunk/reactos/lib/sdk/crt/include/internal/wine/msvcrt.h Sun Nov 11 20:03:20 2007 @@ -31,19 +31,60 @@ //#include "msvcrt/string.h" #include "eh.h"
+typedef unsigned short MSVCRT_wchar_t; +typedef unsigned short MSVCRT_wint_t; +typedef unsigned short MSVCRT_wctype_t; +typedef unsigned short MSVCRT__ino_t; +typedef unsigned long MSVCRT__fsize_t; +#ifdef _WIN64 +typedef unsigned __int64 MSVCRT_size_t; +typedef __int64 MSVCRT_intptr_t; +typedef unsigned __int64 MSVCRT_uintptr_t; +#else +typedef unsigned int MSVCRT_size_t; +typedef int MSVCRT_intptr_t; +typedef unsigned int MSVCRT_uintptr_t; +#endif +typedef unsigned int MSVCRT__dev_t; +typedef int MSVCRT__off_t; +typedef long MSVCRT_clock_t; +typedef long MSVCRT_time_t; +typedef __int64 MSVCRT___time64_t; +typedef __int64 MSVCRT_fpos_t; + +struct MSVCRT_tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + /* TLS data */ extern DWORD MSVCRT_tls_index;
typedef struct __MSVCRT_thread_data { - int _errno; // ros - unsigned long doserrno; - char *mbstok_next; /* next ptr for mbstok() */ - char *efcvt_buffer; /* buffer for ecvt/fcvt */ - terminate_function terminate_handler; - unexpected_function unexpected_handler; - _se_translator_function se_translator; - EXCEPTION_RECORD *exc_record; + int thread_errno; + unsigned long thread_doserrno; + unsigned int random_seed; /* seed for rand() */ + char *strtok_next; /* next ptr for strtok() */ + unsigned char *mbstok_next; /* next ptr for mbstok() */ + MSVCRT_wchar_t *wcstok_next; /* next ptr for wcstok() */ + char *efcvt_buffer; /* buffer for ecvt/fcvt */ + char *asctime_buffer; /* buffer for asctime */ + MSVCRT_wchar_t *wasctime_buffer; /* buffer for wasctime */ + struct MSVCRT_tm time_buffer; /* buffer for localtime/gmtime */ + char *strerror_buffer; /* buffer for strerror */ + int fpecode; + terminate_function terminate_handler; + unexpected_function unexpected_handler; + _se_translator_function se_translator; + EXCEPTION_RECORD *exc_record; } MSVCRT_thread_data;
extern MSVCRT_thread_data *msvcrt_get_thread_data(void);
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=3... ============================================================================== --- trunk/reactos/media/doc/README.WINE (original) +++ trunk/reactos/media/doc/README.WINE Sun Nov 11 20:03:20 2007 @@ -120,6 +120,7 @@ msvcrt - reactos/dll/win32/msvcrt/wine/*.c # Out of sync reactos/lib/sdk/crt/except # Synced at XXXXXXXX + reactos/lib/sdk/crt/cpp.c # Synced at 20071111 reactos/lib/sdk/crt/wine # Synced at XXXXXXXX
User32 -