ReactOS 0.4.16-dev-455-g37b0646
cpp.c File Reference
#include <stdarg.h>
#include <stdbool.h>
#include "windef.h"
#include "winternl.h"
#include "wine/exception.h"
#include "wine/debug.h"
#include "msvcrt.h"
#include "mtdll.h"
#include "cxx.h"
Include dependency graph for cpp.c:

Go to the source code of this file.

Classes

struct  __type_info_node
 
struct  exception_ptr
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msvcrt)
 
static const vtable_ptrget_vtable (void *obj)
 
static const rtti_object_locatorget_obj_locator (void *cppobj)
 
static void dump_obj_locator (const rtti_object_locator *ptr)
 
exception __thiscall exception_ctor (exception *_this, const char **name)
 
exception __thiscall exception_ctor_noalloc (exception *_this, char **name, int noalloc)
 
exception __thiscall exception_default_ctor (exception *_this)
 
exception __thiscall exception_opequals (exception *_this, const exception *rhs)
 
void *__thiscall exception_scalar_dtor (exception *_this, unsigned int flags)
 
bad_typeid *__thiscall bad_typeid_copy_ctor (bad_typeid *_this, const bad_typeid *rhs)
 
bad_typeid *__thiscall bad_typeid_ctor (bad_typeid *_this, const char *name)
 
bad_typeid *__thiscall bad_typeid_default_ctor (bad_typeid *_this)
 
void __thiscall bad_typeid_dtor (bad_typeid *_this)
 
bad_typeid *__thiscall bad_typeid_opequals (bad_typeid *_this, const bad_typeid *rhs)
 
void *__thiscall bad_typeid_vector_dtor (bad_typeid *_this, unsigned int flags)
 
void *__thiscall bad_typeid_scalar_dtor (bad_typeid *_this, unsigned int flags)
 
__non_rtti_object *__thiscall __non_rtti_object_copy_ctor (__non_rtti_object *_this, const __non_rtti_object *rhs)
 
__non_rtti_object *__thiscall __non_rtti_object_ctor (__non_rtti_object *_this, const char *name)
 
void __thiscall __non_rtti_object_dtor (__non_rtti_object *_this)
 
__non_rtti_object *__thiscall __non_rtti_object_opequals (__non_rtti_object *_this, const __non_rtti_object *rhs)
 
void *__thiscall __non_rtti_object_vector_dtor (__non_rtti_object *_this, unsigned int flags)
 
void *__thiscall __non_rtti_object_scalar_dtor (__non_rtti_object *_this, unsigned int flags)
 
bad_cast *__thiscall bad_cast_ctor (bad_cast *_this, const char **name)
 
bad_cast *__thiscall bad_cast_copy_ctor (bad_cast *_this, const bad_cast *rhs)
 
bad_cast *__thiscall bad_cast_ctor_charptr (bad_cast *_this, const char *name)
 
bad_cast *__thiscall bad_cast_default_ctor (bad_cast *_this)
 
void __thiscall bad_cast_dtor (bad_cast *_this)
 
bad_cast *__thiscall bad_cast_opequals (bad_cast *_this, const bad_cast *rhs)
 
void *__thiscall bad_cast_vector_dtor (bad_cast *_this, unsigned int flags)
 
void *__thiscall bad_cast_scalar_dtor (bad_cast *_this, unsigned int flags)
 
int __thiscall type_info_opequals_equals (type_info *_this, const type_info *rhs)
 
int __thiscall type_info_opnot_equals (type_info *_this, const type_info *rhs)
 
int __thiscall type_info_before (type_info *_this, const type_info *rhs)
 
void __thiscall type_info_dtor (type_info *_this)
 
const char *__thiscall type_info_name (type_info *_this)
 
const char *__thiscall type_info_raw_name (type_info *_this)
 
 __ASM_VTABLE (bad_typeid, VTABLE_ADD_FUNC(exception_what))
 
 __ASM_VTABLE (bad_cast, VTABLE_ADD_FUNC(exception_what))
 
 __ASM_VTABLE (__non_rtti_object, VTABLE_ADD_FUNC(exception_what))
 
__ASM_BLOCK_END DEFINE_CXX_DATA2 (__non_rtti_object, &bad_typeid_cxx_type_info, &exception_cxx_type_info, __non_rtti_object_dtor) void msvcrt_init_exception(void *base)
 
terminate_function CDECL set_terminate (terminate_function func)
 
terminate_function CDECL _get_terminate (void)
 
unexpected_function CDECL set_unexpected (unexpected_function func)
 
unexpected_function CDECL _get_unexpected (void)
 
_se_translator_function CDECL _set_se_translator (_se_translator_function func)
 
void CDECL terminate (void)
 
void CDECL unexpected (void)
 
const type_info *CDECL __RTtypeid (void *cppobj)
 
void *CDECL __RTDynamicCast (void *cppobj, int unknown, type_info *src, type_info *dst, int do_throw)
 
void *CDECL __RTCastToVoid (void *cppobj)
 
void WINAPI _CxxThrowException (void *object, const cxx_exception_type *type)
 
void __cdecl __ExceptionPtrRethrow (const exception_ptr *ep)
 

Variables

const vtable_ptr bad_typeid_vtable
 
const vtable_ptr bad_cast_vtable
 
const vtable_ptr __non_rtti_object_vtable
 
const vtable_ptr type_info_vtable
 

Function Documentation

◆ __ASM_VTABLE() [1/3]

__ASM_VTABLE ( __non_rtti_object  ,
VTABLE_ADD_FUNC(exception_what  
)

◆ __ASM_VTABLE() [2/3]

__ASM_VTABLE ( bad_cast  ,
VTABLE_ADD_FUNC(exception_what  
)

◆ __ASM_VTABLE() [3/3]

__ASM_VTABLE ( bad_typeid  ,
VTABLE_ADD_FUNC(exception_what  
)

◆ __ExceptionPtrRethrow()

void __cdecl __ExceptionPtrRethrow ( const exception_ptr ep)

Definition at line 1240 of file cpp.c.

1241{
1242 TRACE("(%p)\n", ep);
1243
1244 if (!ep->rec)
1245 {
1246 static const char *exception_msg = "bad exception";
1247 exception e;
1248
1249 exception_ctor(&e, &exception_msg);
1250 _CxxThrowException(&e, &exception_exception_type);
1251 return;
1252 }
1253
1256}
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
#define e
Definition: ke_i.h:82
#define EH_UNWINDING
Definition: exception.h:17
void WINAPI _CxxThrowException(void *object, const cxx_exception_type *type)
Definition: cpp.c:1006
exception __thiscall exception_ctor(exception *_this, const char **name)
Definition: cpp.c:130
#define TRACE(s)
Definition: solgame.cpp:4
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
DWORD ExceptionFlags
Definition: compat.h:209
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213
EXCEPTION_RECORD * rec
Definition: cpp.c:1140

◆ __non_rtti_object_copy_ctor()

__non_rtti_object *__thiscall __non_rtti_object_copy_ctor ( __non_rtti_object *  _this,
const __non_rtti_object *  rhs 
)

Definition at line 276 of file cpp.c.

278{
279 TRACE("(%p %p)\n", _this, rhs);
280 return __exception_copy_ctor(_this, rhs, &__non_rtti_object_vtable);
281}
const vtable_ptr __non_rtti_object_vtable

◆ __non_rtti_object_ctor()

__non_rtti_object *__thiscall __non_rtti_object_ctor ( __non_rtti_object *  _this,
const char name 
)

Definition at line 287 of file cpp.c.

289{
290 TRACE("(%p %s)\n", _this, name);
291 return __exception_ctor(_this, name, &__non_rtti_object_vtable);
292}
Definition: name.c:39

Referenced by __RTCastToVoid(), __RTDynamicCast(), and __RTtypeid().

◆ __non_rtti_object_dtor()

void __thiscall __non_rtti_object_dtor ( __non_rtti_object *  _this)

Definition at line 298 of file cpp.c.

299{
300 TRACE("(%p)\n", _this);
301 bad_typeid_dtor(_this);
302}
void __thiscall bad_typeid_dtor(bad_typeid *_this)
Definition: cpp.c:220

Referenced by __non_rtti_object_scalar_dtor(), and __non_rtti_object_vector_dtor().

◆ __non_rtti_object_opequals()

__non_rtti_object *__thiscall __non_rtti_object_opequals ( __non_rtti_object *  _this,
const __non_rtti_object *  rhs 
)

Definition at line 308 of file cpp.c.

310{
311 TRACE("(%p %p)\n", _this, rhs);
312 bad_typeid_opequals(_this, rhs);
313 return _this;
314}
bad_typeid *__thiscall bad_typeid_opequals(bad_typeid *_this, const bad_typeid *rhs)
Definition: cpp.c:230

◆ __non_rtti_object_scalar_dtor()

void *__thiscall __non_rtti_object_scalar_dtor ( __non_rtti_object *  _this,
unsigned int  flags 
)

Definition at line 343 of file cpp.c.

344{
345 TRACE("(%p %x)\n", _this, flags);
347 if (flags & 1) operator_delete(_this);
348 return _this;
349}
GLbitfield flags
Definition: glext.h:7161
void __thiscall __non_rtti_object_dtor(__non_rtti_object *_this)
Definition: cpp.c:298
void CDECL DECLSPEC_HOTPATCH operator_delete(void *mem)
Definition: heap.c:198

◆ __non_rtti_object_vector_dtor()

void *__thiscall __non_rtti_object_vector_dtor ( __non_rtti_object *  _this,
unsigned int  flags 
)

Definition at line 320 of file cpp.c.

321{
322 TRACE("(%p %x)\n", _this, flags);
323 if (flags & 2)
324 {
325 /* we have an array, with the number of elements stored before the first object */
326 INT_PTR i, *ptr = (INT_PTR *)_this - 1;
327
328 for (i = *ptr - 1; i >= 0; i--) __non_rtti_object_dtor(_this + i);
330 }
331 else
332 {
334 if (flags & 1) operator_delete(_this);
335 }
336 return _this;
337}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
int32_t INT_PTR
Definition: typedefs.h:64

◆ __RTCastToVoid()

void *CDECL __RTCastToVoid ( void cppobj)

Definition at line 980 of file cpp.c.

981{
982 void *ret;
983
984 if (!cppobj) return NULL;
985
986 __TRY
987 {
988 const rtti_object_locator *obj_locator = get_obj_locator( cppobj );
989 ret = (char *)cppobj - obj_locator->base_class_offset;
990 }
992 {
993 __non_rtti_object e;
994 __non_rtti_object_ctor( &e, "Access violation - no RTTI data!" );
995 _CxxThrowException( &e, &__non_rtti_object_exception_type );
996 }
998 return ret;
999}
#define NULL
Definition: types.h:112
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
static void * get_obj_locator(void *cppobj)
Definition: cpp.c:885
__non_rtti_object *__thiscall __non_rtti_object_ctor(__non_rtti_object *_this, const char *name)
Definition: cpp.c:287
int base_class_offset
Definition: cxx.h:220
int ret

◆ __RTDynamicCast()

void *CDECL __RTDynamicCast ( void cppobj,
int  unknown,
type_info src,
type_info dst,
int  do_throw 
)

Definition at line 838 of file cpp.c.

841{
842 void *ret;
843
844 if (!cppobj) return NULL;
845
846 TRACE("obj: %p unknown: %d src: %p %s dst: %p %s do_throw: %d)\n",
847 cppobj, unknown, src, dbgstr_type_info(src), dst, dbgstr_type_info(dst), do_throw);
848
849 /* To cast an object at runtime:
850 * 1.Find out the true type of the object from the typeinfo at vtable[-1]
851 * 2.Search for the destination type in the class hierarchy
852 * 3.If destination type is found, return base object address + dest offset
853 * Otherwise, fail the cast
854 *
855 * FIXME: the unknown parameter doesn't seem to be used for anything
856 */
857 __TRY
858 {
859 int i;
860 const rtti_object_locator *obj_locator = get_obj_locator( cppobj );
861 const rtti_object_hierarchy *obj_bases = obj_locator->type_hierarchy;
862 const rtti_base_descriptor * const* base_desc = obj_bases->base_classes->bases;
863
864 if (TRACE_ON(msvcrt)) dump_obj_locator(obj_locator);
865
866 ret = NULL;
867 for (i = 0; i < obj_bases->array_len; i++)
868 {
869 const type_info *typ = base_desc[i]->type_descriptor;
870
871 if (!strcmp(typ->mangled, dst->mangled))
872 {
873 /* compute the correct this pointer for that base class */
874 void *this_ptr = (char *)cppobj - obj_locator->base_class_offset;
875 ret = get_this_pointer( &base_desc[i]->offsets, this_ptr );
876 break;
877 }
878 }
879 /* VC++ sets do_throw to 1 when the result of a dynamic_cast is assigned
880 * to a reference, since references cannot be NULL.
881 */
882 if (!ret && do_throw)
883 {
884 const char *msg = "Bad dynamic_cast!";
885 bad_cast e;
886 bad_cast_ctor( &e, &msg );
887 _CxxThrowException( &e, &bad_cast_exception_type );
888 }
889 }
891 {
892 __non_rtti_object e;
893 __non_rtti_object_ctor( &e, "Access violation - no RTTI data!" );
894 _CxxThrowException( &e, &__non_rtti_object_exception_type );
895 }
897 return ret;
898}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define msg(x)
Definition: auth_time.c:54
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define TRACE_ON(x)
Definition: compat.h:75
static const FxOffsetAndName offsets[]
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
static const char * dbgstr_type_info(const type_info *info)
Definition: cppexcept.h:155
static void * get_this_pointer(const this_ptr_offsets *off, void *object)
Definition: cppexcept.h:163
bad_cast *__thiscall bad_cast_ctor(bad_cast *_this, const char **name)
Definition: cpp.c:356
static void dump_obj_locator(const rtti_object_locator *ptr)
Definition: cpp.c:66
char mangled[16]
Definition: cpp.c:36
const rtti_base_descriptor * bases[10]
Definition: cxx.h:206
const type_info * type_descriptor
Definition: cxx.h:198
const rtti_base_array * base_classes
Definition: cxx.h:214
const rtti_object_hierarchy * type_hierarchy
Definition: cxx.h:223

◆ __RTtypeid()

const type_info *CDECL __RTtypeid ( void cppobj)

Definition at line 753 of file cpp.c.

754{
755 const type_info *ret;
756
757 if (!cppobj)
758 {
759 bad_typeid e;
760 bad_typeid_ctor( &e, "Attempted a typeid of NULL pointer!" );
761 _CxxThrowException( &e, &bad_typeid_exception_type );
762 }
763
764 __TRY
765 {
766 const rtti_object_locator *obj_locator = get_obj_locator( cppobj );
767 ret = obj_locator->type_descriptor;
768 }
770 {
771 __non_rtti_object e;
772 __non_rtti_object_ctor( &e, "Bad read pointer - no RTTI data!" );
773 _CxxThrowException( &e, &__non_rtti_object_exception_type );
774 }
776 return ret;
777}
bad_typeid *__thiscall bad_typeid_ctor(bad_typeid *_this, const char *name)
Definition: cpp.c:201
const type_info * type_descriptor
Definition: cxx.h:222

◆ _CxxThrowException()

void WINAPI _CxxThrowException ( void object,
const cxx_exception_type type 
)

Definition at line 1006 of file cpp.c.

1007{
1008 ULONG_PTR args[3];
1009
1011 args[1] = (ULONG_PTR)object;
1012 args[2] = (ULONG_PTR)type;
1014}
#define ULONG_PTR
Definition: config.h:101
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CXX_EXCEPTION
Definition: cppexcept.h:27
#define CXX_FRAME_MAGIC_VC6
Definition: cppexcept.h:24
Definition: match.c:390
#define EH_NONCONTINUABLE
Definition: stubs.h:32
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by __ExceptionPtrRethrow(), __RTCastToVoid(), __RTDynamicCast(), and __RTtypeid().

◆ _get_terminate()

terminate_function CDECL _get_terminate ( void  )

Definition at line 654 of file cpp.c.

655{
657 TRACE("returning %p\n", data->terminate_handler);
658 return data->terminate_handler;
659}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
thread_data_t * msvcrt_get_thread_data(void)
Definition: tls.c:31

◆ _get_unexpected()

unexpected_function CDECL _get_unexpected ( void  )

Definition at line 684 of file cpp.c.

685{
687 TRACE("returning %p\n", data->unexpected_handler);
688 return data->unexpected_handler;
689}

◆ _set_se_translator()

Definition at line 694 of file cpp.c.

695{
697 _se_translator_function previous = data->se_translator;
698 TRACE("(%p) returning %p\n",func,previous);
699 data->se_translator = func;
700 return previous;
701}
GLenum func
Definition: glext.h:6028
void(__cdecl * _se_translator_function)(unsigned int, struct _EXCEPTION_POINTERS *)
Definition: eh.h:29

◆ bad_cast_copy_ctor()

bad_cast *__thiscall bad_cast_copy_ctor ( bad_cast *  _this,
const bad_cast *  rhs 
)

Definition at line 366 of file cpp.c.

367{
368 TRACE("(%p %p)\n", _this, rhs);
369 return __exception_copy_ctor(_this, rhs, &bad_cast_vtable);
370}
const vtable_ptr bad_cast_vtable

◆ bad_cast_ctor()

bad_cast *__thiscall bad_cast_ctor ( bad_cast *  _this,
const char **  name 
)

Definition at line 356 of file cpp.c.

357{
358 TRACE("(%p %s)\n", _this, *name);
359 return __exception_ctor(_this, *name, &bad_cast_vtable);
360}

Referenced by __RTDynamicCast().

◆ bad_cast_ctor_charptr()

bad_cast *__thiscall bad_cast_ctor_charptr ( bad_cast *  _this,
const char name 
)

Definition at line 376 of file cpp.c.

377{
378 TRACE("(%p %s)\n", _this, name);
379 return __exception_ctor(_this, name, &bad_cast_vtable);
380}

Referenced by bad_cast_default_ctor().

◆ bad_cast_default_ctor()

bad_cast *__thiscall bad_cast_default_ctor ( bad_cast *  _this)

Definition at line 386 of file cpp.c.

387{
388 return bad_cast_ctor_charptr( _this, "bad cast" );
389}
bad_cast *__thiscall bad_cast_ctor_charptr(bad_cast *_this, const char *name)
Definition: cpp.c:376

◆ bad_cast_dtor()

void __thiscall bad_cast_dtor ( bad_cast *  _this)

Definition at line 395 of file cpp.c.

396{
397 TRACE("(%p)\n", _this);
398 exception_dtor(_this);
399}
void __thiscall exception_dtor(exception *_this)

Referenced by bad_cast_scalar_dtor(), and bad_cast_vector_dtor().

◆ bad_cast_opequals()

bad_cast *__thiscall bad_cast_opequals ( bad_cast *  _this,
const bad_cast *  rhs 
)

Definition at line 405 of file cpp.c.

406{
407 TRACE("(%p %p)\n", _this, rhs);
408 exception_opequals(_this, rhs);
409 return _this;
410}
exception __thiscall exception_opequals(exception *_this, const exception *rhs)
Definition: cpp.c:163

◆ bad_cast_scalar_dtor()

void *__thiscall bad_cast_scalar_dtor ( bad_cast *  _this,
unsigned int  flags 
)

Definition at line 439 of file cpp.c.

440{
441 TRACE("(%p %x)\n", _this, flags);
442 bad_cast_dtor(_this);
443 if (flags & 1) operator_delete(_this);
444 return _this;
445}
void __thiscall bad_cast_dtor(bad_cast *_this)
Definition: cpp.c:395

◆ bad_cast_vector_dtor()

void *__thiscall bad_cast_vector_dtor ( bad_cast *  _this,
unsigned int  flags 
)

Definition at line 416 of file cpp.c.

417{
418 TRACE("(%p %x)\n", _this, flags);
419 if (flags & 2)
420 {
421 /* we have an array, with the number of elements stored before the first object */
422 INT_PTR i, *ptr = (INT_PTR *)_this - 1;
423
424 for (i = *ptr - 1; i >= 0; i--) bad_cast_dtor(_this + i);
426 }
427 else
428 {
429 bad_cast_dtor(_this);
430 if (flags & 1) operator_delete(_this);
431 }
432 return _this;
433}

◆ bad_typeid_copy_ctor()

bad_typeid *__thiscall bad_typeid_copy_ctor ( bad_typeid *  _this,
const bad_typeid *  rhs 
)

Definition at line 191 of file cpp.c.

192{
193 TRACE("(%p %p)\n", _this, rhs);
194 return __exception_copy_ctor(_this, rhs, &bad_typeid_vtable);
195}
const vtable_ptr bad_typeid_vtable

◆ bad_typeid_ctor()

bad_typeid *__thiscall bad_typeid_ctor ( bad_typeid *  _this,
const char name 
)

Definition at line 201 of file cpp.c.

202{
203 TRACE("(%p %s)\n", _this, name);
204 return __exception_ctor(_this, name, &bad_typeid_vtable);
205}

Referenced by __RTtypeid(), and bad_typeid_default_ctor().

◆ bad_typeid_default_ctor()

bad_typeid *__thiscall bad_typeid_default_ctor ( bad_typeid *  _this)

Definition at line 211 of file cpp.c.

212{
213 return bad_typeid_ctor( _this, "bad typeid" );
214}

◆ bad_typeid_dtor()

void __thiscall bad_typeid_dtor ( bad_typeid *  _this)

Definition at line 220 of file cpp.c.

221{
222 TRACE("(%p)\n", _this);
223 exception_dtor(_this);
224}

Referenced by __non_rtti_object_dtor(), bad_typeid_scalar_dtor(), and bad_typeid_vector_dtor().

◆ bad_typeid_opequals()

bad_typeid *__thiscall bad_typeid_opequals ( bad_typeid *  _this,
const bad_typeid *  rhs 
)

Definition at line 230 of file cpp.c.

231{
232 TRACE("(%p %p)\n", _this, rhs);
233 exception_opequals(_this, rhs);
234 return _this;
235}

Referenced by __non_rtti_object_opequals().

◆ bad_typeid_scalar_dtor()

void *__thiscall bad_typeid_scalar_dtor ( bad_typeid *  _this,
unsigned int  flags 
)

Definition at line 264 of file cpp.c.

265{
266 TRACE("(%p %x)\n", _this, flags);
267 bad_typeid_dtor(_this);
268 if (flags & 1) operator_delete(_this);
269 return _this;
270}

◆ bad_typeid_vector_dtor()

void *__thiscall bad_typeid_vector_dtor ( bad_typeid *  _this,
unsigned int  flags 
)

Definition at line 241 of file cpp.c.

242{
243 TRACE("(%p %x)\n", _this, flags);
244 if (flags & 2)
245 {
246 /* we have an array, with the number of elements stored before the first object */
247 INT_PTR i, *ptr = (INT_PTR *)_this - 1;
248
249 for (i = *ptr - 1; i >= 0; i--) bad_typeid_dtor(_this + i);
251 }
252 else
253 {
254 bad_typeid_dtor(_this);
255 if (flags & 1) operator_delete(_this);
256 }
257 return _this;
258}

◆ DEFINE_CXX_DATA2()

__ASM_BLOCK_END DEFINE_CXX_DATA2 ( __non_rtti_object  ,
bad_typeid_cxx_type_info,
exception_cxx_type_info,
__non_rtti_object_dtor   
)

Definition at line 593 of file cpp.c.

600{
601#ifdef __x86_64__
602 init_type_info_rtti(base);
603 init_exception_rtti(base);
604#if _MSVCR_VER >= 80
605 init_exception_old_rtti(base);
606 init_bad_alloc_rtti(base);
607#endif
608 init_bad_typeid_rtti(base);
609 init_bad_cast_rtti(base);
610 init___non_rtti_object_rtti(base);
611
612 init_exception_cxx(base);
613 init_bad_typeid_cxx(base);
614 init_bad_cast_cxx(base);
615 init___non_rtti_object_cxx(base);
616#if _MSVCR_VER >= 80
617 init_bad_alloc_cxx(base);
618#endif
619#endif
620}

◆ dump_obj_locator()

static void dump_obj_locator ( const rtti_object_locator ptr)
static

Definition at line 66 of file cpp.c.

67{
68 int i;
69 const rtti_object_hierarchy *h = ptr->type_hierarchy;
70
71 TRACE( "%p: sig=%08x base_offset=%08x flags=%08x type=%p %s hierarchy=%p\n",
72 ptr, ptr->signature, ptr->base_class_offset, ptr->flags,
73 ptr->type_descriptor, dbgstr_type_info(ptr->type_descriptor), ptr->type_hierarchy );
74 TRACE( " hierarchy: sig=%08x attr=%08x len=%d base classes=%p\n",
75 h->signature, h->attributes, h->array_len, h->base_classes );
76 for (i = 0; i < h->array_len; i++)
77 {
78 TRACE( " base class %p: num %d off %d,%d,%d attr %08x type %p %s\n",
79 h->base_classes->bases[i],
80 h->base_classes->bases[i]->num_base_classes,
81 h->base_classes->bases[i]->offsets.this_offset,
82 h->base_classes->bases[i]->offsets.vbase_descr,
83 h->base_classes->bases[i]->offsets.vbase_offset,
84 h->base_classes->bases[i]->attributes,
85 h->base_classes->bases[i]->type_descriptor,
86 dbgstr_type_info(h->base_classes->bases[i]->type_descriptor) );
87 }
88}
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723

Referenced by __RTDynamicCast().

◆ exception_ctor()

exception __thiscall exception_ctor ( exception _this,
const char **  name 
)

Definition at line 130 of file cpp.c.

131{
132 TRACE("(%p,%s)\n", _this, *name);
133 return __exception_ctor(_this, *name, &exception_vtable);
134}

Referenced by __ExceptionPtrRethrow().

◆ exception_ctor_noalloc()

exception __thiscall exception_ctor_noalloc ( exception _this,
char **  name,
int  noalloc 
)

Definition at line 140 of file cpp.c.

141{
142 TRACE("(%p,%s)\n", _this, *name);
143 _this->vtable = &exception_vtable;
144 _this->name = *name;
145 _this->do_free = FALSE;
146 return _this;
147}
#define FALSE
Definition: types.h:117
char * name
Definition: cpp.c:28
vtable_ptr * vtable
Definition: cpp.c:27
int do_free
Definition: cpp.c:29

◆ exception_default_ctor()

exception __thiscall exception_default_ctor ( exception _this)

Definition at line 153 of file cpp.c.

154{
155 TRACE("(%p)\n", _this);
156 return __exception_ctor(_this, NULL, &exception_vtable);
157}

◆ exception_opequals()

exception __thiscall exception_opequals ( exception _this,
const exception rhs 
)

Definition at line 163 of file cpp.c.

164{
165 TRACE("(%p %p)\n", _this, rhs);
166 if (_this != rhs)
167 {
168 exception_dtor(_this);
169 exception_copy_ctor(_this, rhs);
170 }
171 TRACE("name = %s\n", _this->name);
172 return _this;
173}
exception __thiscall exception_copy_ctor(exception *_this, const exception *rhs)

Referenced by bad_cast_opequals(), and bad_typeid_opequals().

◆ exception_scalar_dtor()

void *__thiscall exception_scalar_dtor ( exception _this,
unsigned int  flags 
)

Definition at line 179 of file cpp.c.

180{
181 TRACE("(%p %x)\n", _this, flags);
182 exception_dtor(_this);
183 if (flags & 1) operator_delete(_this);
184 return _this;
185}

◆ get_obj_locator()

static const rtti_object_locator * get_obj_locator ( void cppobj)
inlinestatic

Definition at line 59 of file cpp.c.

60{
61 const vtable_ptr *vtable = get_vtable( cppobj );
62 return (const rtti_object_locator *)vtable[-1];
63}
void(* vtable_ptr)(void)
Definition: cpp.c:23
static vtable_ptr * get_vtable(void *obj)
Definition: cpp.c:880
static void * vtable[]
Definition: typelib.c:1231

◆ get_vtable()

static const vtable_ptr * get_vtable ( void obj)
inlinestatic

Definition at line 54 of file cpp.c.

55{
56 return *(const vtable_ptr **)obj;
57}

◆ set_terminate()

terminate_function CDECL set_terminate ( terminate_function  func)

Definition at line 642 of file cpp.c.

643{
645 terminate_function previous = data->terminate_handler;
646 TRACE("(%p) returning %p\n",func,previous);
647 data->terminate_handler = func;
648 return previous;
649}
void(__cdecl * terminate_function)(void)
Definition: eh.h:23

Referenced by main(), and Terminate1().

◆ set_unexpected()

unexpected_function CDECL set_unexpected ( unexpected_function  func)

Definition at line 672 of file cpp.c.

673{
675 unexpected_function previous = data->unexpected_handler;
676 TRACE("(%p) returning %p\n",func,previous);
677 data->unexpected_handler = func;
678 return previous;
679}
void(__cdecl * unexpected_function)(void)
Definition: eh.h:25

◆ terminate()

void CDECL terminate ( void  )

◆ type_info_before()

int __thiscall type_info_before ( type_info _this,
const type_info rhs 
)

Definition at line 473 of file cpp.c.

474{
475 int ret = strcmp(_this->mangled + 1, rhs->mangled + 1) < 0;
476 TRACE("(%p %p) returning %d\n", _this, rhs, ret);
477 return ret;
478}

◆ type_info_dtor()

void __thiscall type_info_dtor ( type_info _this)

Definition at line 484 of file cpp.c.

485{
486 TRACE("(%p)\n", _this);
487 free(_this->name);
488}
#define free
Definition: debug_ros.c:5
char * name
Definition: cpp.c:35

◆ type_info_name()

const char *__thiscall type_info_name ( type_info _this)

Definition at line 494 of file cpp.c.

495{
496 if (!_this->name)
497 {
498 /* Create and set the demangled name */
499 /* Note: mangled name in type_info struct always starts with a '.', while
500 * it isn't valid for mangled name.
501 * Is this '.' really part of the mangled name, or has it some other meaning ?
502 */
503 char* name = __unDName(0, _this->mangled + 1, 0,
505 if (name)
506 {
507 unsigned int len = strlen(name);
508
509 /* It seems _unDName may leave blanks at the end of the demangled name */
510 while (len && name[--len] == ' ')
511 name[len] = '\0';
512
513 if (InterlockedCompareExchangePointer((void**)&_this->name, name, NULL))
514 {
515 /* Another thread set this member since we checked above - use it */
516 free(name);
517 }
518 }
519 }
520 TRACE("(%p) returning %s\n", _this, _this->name);
521 return _this->name;
522}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define UNDNAME_32_BIT_DECODE
Definition: dbghelp.h:1264
#define UNDNAME_NO_ARGUMENTS
Definition: dbghelp.h:1266
#define malloc
Definition: debug_ros.c:4
GLenum GLsizei len
Definition: glext.h:6722
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
char *__cdecl __unDName(char *, const char *, int, malloc_func_t, free_func_t, unsigned short int)
Definition: undname.c:1650

◆ type_info_opequals_equals()

int __thiscall type_info_opequals_equals ( type_info _this,
const type_info rhs 
)

Definition at line 451 of file cpp.c.

452{
453 int ret = !strcmp(_this->mangled + 1, rhs->mangled + 1);
454 TRACE("(%p %p) returning %d\n", _this, rhs, ret);
455 return ret;
456}

◆ type_info_opnot_equals()

int __thiscall type_info_opnot_equals ( type_info _this,
const type_info rhs 
)

Definition at line 462 of file cpp.c.

463{
464 int ret = !!strcmp(_this->mangled + 1, rhs->mangled + 1);
465 TRACE("(%p %p) returning %d\n", _this, rhs, ret);
466 return ret;
467}

◆ type_info_raw_name()

const char *__thiscall type_info_raw_name ( type_info _this)

Definition at line 528 of file cpp.c.

529{
530 TRACE("(%p) returning %s\n", _this, _this->mangled);
531 return _this->mangled;
532}

◆ unexpected()

void CDECL unexpected ( void  )

Definition at line 726 of file cpp.c.

727{
729 if (data->unexpected_handler) data->unexpected_handler();
730 terminate();
731}
void CDECL terminate(void)
Definition: cpp.c:716

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msvcrt  )

Variable Documentation

◆ __non_rtti_object_vtable

const vtable_ptr __non_rtti_object_vtable
extern

◆ bad_cast_vtable

const vtable_ptr bad_cast_vtable
extern

◆ bad_typeid_vtable

const vtable_ptr bad_typeid_vtable
extern

◆ type_info_vtable

const vtable_ptr type_info_vtable
extern