2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
30 /* dlls/msvcrt/cppexcept.h */
31 typedef void (*cxx_copy_ctor)(void);
33 /* complete information about a C++ type */
34 typedef struct __cxx_type_info
36 UINT flags; /* flags (see CLASS_* flags below) */
37 const type_info *type_info; /* C++ type info */
38 this_ptr_offsets offsets; /* offsets for computing the this pointer */
39 unsigned int size; /* object size */
40 cxx_copy_ctor copy_ctor; /* copy constructor */
42 #define CLASS_IS_SIMPLE_TYPE 1
43 #define CLASS_HAS_VIRTUAL_BASE_CLASS 4
45 /* table of C++ types that apply for a given object */
46 typedef struct __cxx_type_info_table
48 UINT count; /* number of types */
49 const cxx_type_info *info[3]; /* variable length, we declare it large enough for static RTTI */
50 } cxx_type_info_table;
52 /* type information for an exception object */
53 typedef struct __cxx_exception_type
55 UINT flags; /* TYPE_FLAG flags */
56 void (*destructor)(void);/* exception object destructor */
57 void* /*cxx_exc_custom_handler*/ custom_handler; /* custom handler for this exception */
58 const cxx_type_info_table *type_info_table; /* list of types for this exception object */
61 void WINAPI _CxxThrowException(exception*,const cxx_exception_type*);
64 /* ??_7bad_alloc@std@@6B@ */
65 extern const vtable_ptr MSVCP_bad_alloc_vtable;
66 /* ??_7logic_error@std@@6B@ */
67 extern const vtable_ptr MSVCP_logic_error_vtable;
68 /* ??_7length_error@std@@6B@ */
69 extern const vtable_ptr MSVCP_length_error_vtable;
70 /* ??_7out_of_range@std@@6B@ */
71 extern const vtable_ptr MSVCP_out_of_range_vtable;
72 extern const vtable_ptr MSVCP_invalid_argument_vtable;
73 /* ??_7runtime_error@std@@6B@ */
74 extern const vtable_ptr MSVCP_runtime_error_vtable;
76 /* exception class data */
77 static type_info exception_type_info = {
78 NULL, /* set by set_exception_vtable */
83 DEFINE_THISCALL_WRAPPER(MSVCP_exception_ctor, 8)
84 exception* __thiscall MSVCP_exception_ctor(exception *this, const char *name)
86 TRACE("(%p %s)\n", this, name);
88 this->vtable = exception_type_info.vtable;
90 unsigned int name_len = strlen(name) + 1;
91 this->name = malloc(name_len);
92 memcpy(this->name, name, name_len);
96 this->do_free = FALSE;
101 DEFINE_THISCALL_WRAPPER(MSVCP_exception_copy_ctor,8)
102 exception* __thiscall MSVCP_exception_copy_ctor(exception *this, const exception *rhs)
104 TRACE("(%p,%p)\n", this, rhs);
107 this->vtable = exception_type_info.vtable;
108 this->name = rhs->name;
109 this->do_free = FALSE;
111 MSVCP_exception_ctor(this, rhs->name);
112 TRACE("name = %s\n", this->name);
116 DEFINE_THISCALL_WRAPPER(MSVCP_exception_dtor,4)
117 void __thiscall MSVCP_exception_dtor(exception *this)
119 TRACE("(%p)\n", this);
120 this->vtable = exception_type_info.vtable;
125 /* ?_Doraise@bad_alloc@std@@MBEXXZ */
126 /* ?_Doraise@bad_alloc@std@@MEBAXXZ */
127 /* ?_Doraise@logic_error@std@@MBEXXZ */
128 /* ?_Doraise@logic_error@std@@MEBAXXZ */
129 /* ?_Doraise@length_error@std@@MBEXXZ */
130 /* ?_Doraise@length_error@std@@MEBAXXZ */
131 /* ?_Doraise@out_of_range@std@@MBEXXZ */
132 /* ?_Doraise@out_of_range@std@@MEBAXXZ */
133 /* ?_Doraise@runtime_error@std@@MBEXXZ */
134 /* ?_Doraise@runtime_error@std@@MEBAXXZ */
135 DEFINE_THISCALL_WRAPPER(MSVCP_exception__Doraise, 4)
136 void __thiscall MSVCP_exception__Doraise(exception *this)
138 FIXME("(%p) stub\n", this);
141 DEFINE_THISCALL_WRAPPER(MSVCP_exception_what,4)
142 const char* __thiscall MSVCP_exception_what(exception * this)
144 TRACE("(%p) returning %s\n", this, this->name);
145 return this->name ? this->name : "Unknown exception";
148 static const rtti_base_descriptor exception_rtti_base_descriptor = {
149 &exception_type_info,
155 static const cxx_type_info exception_cxx_type_info = {
157 &exception_type_info,
160 (cxx_copy_ctor)THISCALL(MSVCP_exception_dtor)
163 static const cxx_type_info_table exception_cxx_type_table = {
166 &exception_cxx_type_info,
172 static const cxx_exception_type exception_cxx_type = {
174 (cxx_copy_ctor)THISCALL(MSVCP_exception_copy_ctor),
176 &exception_cxx_type_table
179 void set_exception_vtable(void)
181 HMODULE hmod = GetModuleHandleA("msvcrt.dll");
182 exception_type_info.vtable = (void*)GetProcAddress(hmod, "??_7exception@@6B@");
185 /* bad_alloc class data */
186 typedef exception bad_alloc;
188 /* ??0bad_alloc@std@@QAE@PBD@Z */
189 /* ??0bad_alloc@std@@QEAA@PEBD@Z */
190 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_ctor, 8)
191 bad_alloc* __thiscall MSVCP_bad_alloc_ctor(bad_alloc *this, const char *name)
193 TRACE("%p %s\n", this, name);
194 MSVCP_exception_ctor(this, name);
195 this->vtable = &MSVCP_bad_alloc_vtable;
199 /* ??0bad_alloc@std@@QAE@XZ */
200 /* ??0bad_alloc@std@@QEAA@XZ */
201 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_default_ctor, 4)
202 bad_alloc* __thiscall MSVCP_bad_alloc_default_ctor(bad_alloc *this)
204 return MSVCP_bad_alloc_ctor(this, "bad allocation");
207 /* ??0bad_alloc@std@@QAE@ABV01@@Z */
208 /* ??0bad_alloc@std@@QEAA@AEBV01@@Z */
209 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_copy_ctor, 8)
210 bad_alloc* __thiscall MSVCP_bad_alloc_copy_ctor(bad_alloc *this, const bad_alloc *rhs)
212 TRACE("%p %p\n", this, rhs);
213 MSVCP_exception_copy_ctor(this, rhs);
214 this->vtable = &MSVCP_bad_alloc_vtable;
218 /* ??1bad_alloc@std@@UAE@XZ */
219 /* ??1bad_alloc@std@@UEAA@XZ */
220 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_dtor, 4)
221 void __thiscall MSVCP_bad_alloc_dtor(bad_alloc *this)
224 MSVCP_exception_dtor(this);
227 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_vector_dtor, 8)
228 void * __thiscall MSVCP_bad_alloc_vector_dtor(bad_alloc *this, unsigned int flags)
230 TRACE("%p %x\n", this, flags);
232 /* we have an array, with the number of elements stored before the first object */
233 int i, *ptr = (int *)this-1;
235 for(i=*ptr-1; i>=0; i--)
236 MSVCP_bad_alloc_dtor(this+i);
237 MSVCRT_operator_delete(ptr);
239 MSVCP_bad_alloc_dtor(this);
241 MSVCRT_operator_delete(this);
247 /* ??4bad_alloc@std@@QAEAAV01@ABV01@@Z */
248 /* ??4bad_alloc@std@@QEAAAEAV01@AEBV01@@Z */
249 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_assign, 8)
250 bad_alloc* __thiscall MSVCP_bad_alloc_assign(bad_alloc *this, const bad_alloc *assign)
252 MSVCP_bad_alloc_dtor(this);
253 return MSVCP_bad_alloc_copy_ctor(this, assign);
256 DEFINE_RTTI_DATA(bad_alloc, 0, 1, &exception_rtti_base_descriptor, NULL, NULL, ".?AVbad_alloc@std@@");
258 static const cxx_type_info bad_alloc_cxx_type_info = {
260 &bad_alloc_type_info,
263 (cxx_copy_ctor)THISCALL(MSVCP_bad_alloc_copy_ctor)
266 static const cxx_type_info_table bad_alloc_cxx_type_table = {
269 &bad_alloc_cxx_type_info,
270 &exception_cxx_type_info,
275 static const cxx_exception_type bad_alloc_cxx_type = {
277 (cxx_copy_ctor)THISCALL(MSVCP_bad_alloc_dtor),
279 &bad_alloc_cxx_type_table
282 /* logic_error class data */
285 basic_string_char str;
288 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_ctor, 8)
289 logic_error* __thiscall MSVCP_logic_error_ctor(
290 logic_error *this, const char *name)
292 TRACE("%p %s\n", this, name);
293 this->e.vtable = &MSVCP_logic_error_vtable;
295 this->e.do_free = FALSE;
296 MSVCP_basic_string_char_ctor_cstr(&this->str, name);
300 /* ??0logic_error@std@@QAE@ABV01@@Z */
301 /* ??0logic_error@std@@QEAA@AEBV01@@Z */
302 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_copy_ctor, 8)
303 logic_error* __thiscall MSVCP_logic_error_copy_ctor(
304 logic_error *this, const logic_error *rhs)
306 TRACE("%p %p\n", this, rhs);
307 MSVCP_exception_copy_ctor(&this->e, &rhs->e);
308 MSVCP_basic_string_char_copy_ctor(&this->str, &rhs->str);
309 this->e.vtable = &MSVCP_logic_error_vtable;
313 /* ??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
314 /* ??0logic_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
315 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_ctor_bstr, 8)
316 logic_error* __thiscall MSVCP_logic_error_ctor_bstr(logic_error *this, const basic_string_char *str)
318 TRACE("(%p %p)\n", this, str);
319 return MSVCP_logic_error_ctor(this, MSVCP_basic_string_char_c_str(str));
322 /* ??1logic_error@std@@UAE@XZ */
323 /* ??1logic_error@std@@UEAA@XZ */
324 /* ??1length_error@std@@UAE@XZ */
325 /* ??1length_error@std@@UEAA@XZ */
326 /* ??1out_of_range@std@@UAE@XZ */
327 /* ??1out_of_range@std@@UEAA@XZ */
328 /* ??1runtime_error@std@@UAE@XZ */
329 /* ??1runtime_error@std@@UEAA@XZ */
330 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_dtor, 4)
331 void __thiscall MSVCP_logic_error_dtor(logic_error *this)
334 MSVCP_exception_dtor(&this->e);
335 MSVCP_basic_string_char_dtor(&this->str);
338 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_vector_dtor, 8)
339 void* __thiscall MSVCP_logic_error_vector_dtor(
340 logic_error *this, unsigned int flags)
342 TRACE("%p %x\n", this, flags);
344 /* we have an array, with the number of elements stored before the first object */
345 int i, *ptr = (int *)this-1;
347 for(i=*ptr-1; i>=0; i--)
348 MSVCP_logic_error_dtor(this+i);
349 MSVCRT_operator_delete(ptr);
351 MSVCP_logic_error_dtor(this);
353 MSVCRT_operator_delete(this);
359 /* ??4logic_error@std@@QAEAAV01@ABV01@@Z */
360 /* ??4logic_error@std@@QEAAAEAV01@AEBV01@@Z */
361 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_assign, 8)
362 logic_error* __thiscall MSVCP_logic_error_assign(logic_error *this, const logic_error *assign)
364 MSVCP_logic_error_dtor(this);
365 return MSVCP_logic_error_copy_ctor(this, assign);
368 /* ?what@logic_error@std@@UBEPBDXZ */
369 /* ?what@logic_error@std@@UEBAPEBDXZ */
370 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_what, 4)
371 const char* __thiscall MSVCP_logic_error_what(logic_error *this)
374 return MSVCP_basic_string_char_c_str(&this->str);
377 DEFINE_RTTI_DATA(logic_error, 0, 1, &exception_rtti_base_descriptor, NULL, NULL, ".?AVlogic_error@std@@");
379 static const cxx_type_info logic_error_cxx_type_info = {
381 &logic_error_type_info,
384 (cxx_copy_ctor)THISCALL(MSVCP_logic_error_copy_ctor)
387 static const cxx_type_info_table logic_error_cxx_type_table = {
390 &logic_error_cxx_type_info,
391 &exception_cxx_type_info,
396 static const cxx_exception_type logic_error_cxx_type = {
398 (cxx_copy_ctor)THISCALL(MSVCP_logic_error_dtor),
400 &logic_error_cxx_type_table
403 /* length_error class data */
404 typedef logic_error length_error;
406 DEFINE_THISCALL_WRAPPER(MSVCP_length_error_ctor, 8)
407 length_error* __thiscall MSVCP_length_error_ctor(
408 length_error *this, const char *name)
410 TRACE("%p %s\n", this, name);
411 MSVCP_logic_error_ctor(this, name);
412 this->e.vtable = &MSVCP_length_error_vtable;
416 /* ??0length_error@std@@QAE@ABV01@@Z */
417 /* ??0length_error@std@@QEAA@AEBV01@@Z */
418 DEFINE_THISCALL_WRAPPER(MSVCP_length_error_copy_ctor, 8)
419 length_error* __thiscall MSVCP_length_error_copy_ctor(
420 length_error *this, const length_error *rhs)
422 TRACE("%p %p\n", this, rhs);
423 MSVCP_logic_error_copy_ctor(this, rhs);
424 this->e.vtable = &MSVCP_length_error_vtable;
428 /* ??0length_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
429 /* ??0length_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
430 DEFINE_THISCALL_WRAPPER(MSVCP_length_error_ctor_bstr, 8)
431 length_error* __thiscall MSVCP_length_error_ctor_bstr(length_error *this, const basic_string_char *str)
433 TRACE("(%p %p)\n", this, str);
434 return MSVCP_length_error_ctor(this, MSVCP_basic_string_char_c_str(str));
437 DEFINE_THISCALL_WRAPPER(MSVCP_length_error_vector_dtor, 8)
438 void* __thiscall MSVCP_length_error_vector_dtor(
439 length_error *this, unsigned int flags)
441 TRACE("%p %x\n", this, flags);
442 return MSVCP_logic_error_vector_dtor(this, flags);
445 /* ??4length_error@std@@QAEAAV01@ABV01@@Z */
446 /* ??4length_error@std@@QEAAAEAV01@AEBV01@@Z */
447 DEFINE_THISCALL_WRAPPER(MSVCP_length_error_assign, 8)
448 length_error* __thiscall MSVCP_length_error_assign(length_error *this, const length_error *assign)
450 MSVCP_logic_error_dtor(this);
451 return MSVCP_length_error_copy_ctor(this, assign);
454 DEFINE_RTTI_DATA(length_error, 0, 2, &logic_error_rtti_base_descriptor, &exception_rtti_base_descriptor, NULL, ".?AVlength_error@std@@");
456 static const cxx_type_info length_error_cxx_type_info = {
458 &length_error_type_info,
460 sizeof(length_error),
461 (cxx_copy_ctor)THISCALL(MSVCP_length_error_copy_ctor)
464 static const cxx_type_info_table length_error_cxx_type_table = {
467 &length_error_cxx_type_info,
468 &logic_error_cxx_type_info,
469 &exception_cxx_type_info
473 static const cxx_exception_type length_error_cxx_type = {
475 (cxx_copy_ctor)THISCALL(MSVCP_logic_error_dtor),
477 &length_error_cxx_type_table
480 /* out_of_range class data */
481 typedef logic_error out_of_range;
483 DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_ctor, 8)
484 out_of_range* __thiscall MSVCP_out_of_range_ctor(
485 out_of_range *this, const char *name)
487 TRACE("%p %s\n", this, name);
488 MSVCP_logic_error_ctor(this, name);
489 this->e.vtable = &MSVCP_out_of_range_vtable;
493 /* ??0out_of_range@std@@QAE@ABV01@@Z */
494 /* ??0out_of_range@std@@QEAA@AEBV01@@Z */
495 DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_copy_ctor, 8)
496 out_of_range* __thiscall MSVCP_out_of_range_copy_ctor(
497 out_of_range *this, const out_of_range *rhs)
499 TRACE("%p %p\n", this, rhs);
500 MSVCP_logic_error_copy_ctor(this, rhs);
501 this->e.vtable = &MSVCP_out_of_range_vtable;
505 /* ??0out_of_range@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
506 /* ??0out_of_range@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
507 DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_ctor_bstr, 8)
508 out_of_range* __thiscall MSVCP_out_of_range_ctor_bstr(out_of_range *this, const basic_string_char *str)
510 TRACE("(%p %p)\n", this, str);
511 return MSVCP_out_of_range_ctor(this, MSVCP_basic_string_char_c_str(str));
514 DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_vector_dtor, 8)
515 void* __thiscall MSVCP_out_of_range_vector_dtor(
516 out_of_range *this, unsigned int flags)
518 TRACE("%p %x\n", this, flags);
519 return MSVCP_logic_error_vector_dtor(this, flags);
522 /* ??4out_of_range@std@@QAEAAV01@ABV01@@Z */
523 /* ??4out_of_range@std@@QEAAAEAV01@AEBV01@@Z */
524 DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_assign, 8)
525 out_of_range* __thiscall MSVCP_out_of_range_assign(out_of_range *this, const out_of_range *assign)
527 MSVCP_logic_error_dtor(this);
528 return MSVCP_out_of_range_copy_ctor(this, assign);
531 DEFINE_RTTI_DATA(out_of_range, 0, 2, &logic_error_rtti_base_descriptor, &exception_rtti_base_descriptor, NULL, ".?AVout_of_range@std@@");
533 static const cxx_type_info out_of_range_cxx_type_info = {
535 &out_of_range_type_info,
537 sizeof(out_of_range),
538 (cxx_copy_ctor)THISCALL(MSVCP_out_of_range_copy_ctor)
541 static const cxx_type_info_table out_of_range_cxx_type_table = {
544 &out_of_range_cxx_type_info,
545 &logic_error_cxx_type_info,
546 &exception_cxx_type_info
550 static const cxx_exception_type out_of_range_cxx_type = {
552 (cxx_copy_ctor)THISCALL(MSVCP_logic_error_dtor),
554 &out_of_range_cxx_type_table
557 /* invalid_argument class data */
558 typedef logic_error invalid_argument;
560 DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_ctor, 8)
561 invalid_argument* __thiscall MSVCP_invalid_argument_ctor(
562 invalid_argument *this, const char *name)
564 TRACE("%p %s\n", this, name);
565 MSVCP_logic_error_ctor(this, name);
566 this->e.vtable = &MSVCP_invalid_argument_vtable;
570 DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_copy_ctor, 8)
571 invalid_argument* __thiscall MSVCP_invalid_argument_copy_ctor(
572 invalid_argument *this, invalid_argument *rhs)
574 TRACE("%p %p\n", this, rhs);
575 MSVCP_logic_error_copy_ctor(this, rhs);
576 this->e.vtable = &MSVCP_invalid_argument_vtable;
580 DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_vector_dtor, 8)
581 void* __thiscall MSVCP_invalid_argument_vector_dtor(
582 invalid_argument *this, unsigned int flags)
584 TRACE("%p %x\n", this, flags);
585 return MSVCP_logic_error_vector_dtor(this, flags);
588 DEFINE_RTTI_DATA(invalid_argument, 0, 2, &logic_error_rtti_base_descriptor, &exception_rtti_base_descriptor, NULL, ".?AVinvalid_argument@std@@");
590 static const cxx_type_info invalid_argument_cxx_type_info = {
592 &invalid_argument_type_info,
594 sizeof(invalid_argument),
595 (cxx_copy_ctor)THISCALL(MSVCP_invalid_argument_copy_ctor)
598 static const cxx_type_info_table invalid_argument_cxx_type_table = {
601 &invalid_argument_cxx_type_info,
602 &logic_error_cxx_type_info,
603 &exception_cxx_type_info
607 static const cxx_exception_type invalid_argument_cxx_type = {
609 (cxx_copy_ctor)THISCALL(MSVCP_logic_error_dtor),
611 &invalid_argument_cxx_type_table
614 /* runtime_error class data */
615 typedef logic_error runtime_error;
617 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_ctor, 8)
618 runtime_error* __thiscall MSVCP_runtime_error_ctor(
619 runtime_error *this, const char *name)
621 TRACE("%p %s\n", this, name);
622 MSVCP_logic_error_ctor(this, name);
623 this->e.vtable = &MSVCP_runtime_error_vtable;
627 /* ??0runtime_error@std@@QAE@ABV01@@Z */
628 /* ??0runtime_error@std@@QEAA@AEBV01@@Z */
629 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_copy_ctor, 8)
630 runtime_error* __thiscall MSVCP_runtime_error_copy_ctor(
631 runtime_error *this, const runtime_error *rhs)
633 TRACE("%p %p\n", this, rhs);
634 MSVCP_logic_error_copy_ctor(this, rhs);
635 this->e.vtable = &MSVCP_runtime_error_vtable;
639 /* ??0runtime_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
640 /* ??0runtime_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
641 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_ctor_bstr, 8)
642 runtime_error* __thiscall MSVCP_runtime_error_ctor_bstr(runtime_error *this, const basic_string_char *str)
644 TRACE("(%p %p)\n", this, str);
645 return MSVCP_runtime_error_ctor(this, MSVCP_basic_string_char_c_str(str));
648 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_vector_dtor, 8)
649 void* __thiscall MSVCP_runtime_error_vector_dtor(
650 runtime_error *this, unsigned int flags)
652 TRACE("%p %x\n", this, flags);
653 return MSVCP_logic_error_vector_dtor(this, flags);
656 /* ??4runtime_error@std@@QAEAAV01@ABV01@@Z */
657 /* ??4runtime_error@std@@QEAAAEAV01@AEBV01@@Z */
658 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_assign, 8)
659 runtime_error* __thiscall MSVCP_runtime_error_assign(runtime_error *this, const runtime_error *assign)
661 MSVCP_logic_error_dtor(this);
662 return MSVCP_runtime_error_copy_ctor(this, assign);
665 DEFINE_RTTI_DATA(runtime_error, 0, 1, &exception_rtti_base_descriptor, NULL, NULL, ".?AVruntime_error@std@@");
667 static const cxx_type_info runtime_error_cxx_type_info = {
669 &runtime_error_type_info,
671 sizeof(runtime_error),
672 (cxx_copy_ctor)THISCALL(MSVCP_runtime_error_copy_ctor)
675 static const cxx_type_info_table runtime_error_cxx_type_table = {
678 &runtime_error_cxx_type_info,
679 &exception_cxx_type_info,
684 static const cxx_exception_type runtime_error_cxx_type = {
686 (cxx_copy_ctor)THISCALL(MSVCP_logic_error_dtor),
688 &runtime_error_cxx_type_table
691 /* ?what@runtime_error@std@@UBEPBDXZ */
692 /* ?what@runtime_error@std@@UEBAPEBDXZ */
693 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_what, 4)
694 const char* __thiscall MSVCP_runtime_error_what(runtime_error *this)
697 return MSVCP_basic_string_char_c_str(&this->str);
701 void __asm_dummy_vtables(void) {
703 __ASM_VTABLE(bad_alloc,
704 VTABLE_ADD_FUNC(MSVCP_exception_what)
705 VTABLE_ADD_FUNC(MSVCP_exception__Doraise));
706 __ASM_VTABLE(logic_error,
707 VTABLE_ADD_FUNC(MSVCP_logic_error_what)
708 VTABLE_ADD_FUNC(MSVCP_exception__Doraise));
709 __ASM_VTABLE(length_error,
710 VTABLE_ADD_FUNC(MSVCP_logic_error_what)
711 VTABLE_ADD_FUNC(MSVCP_exception__Doraise));
712 __ASM_VTABLE(out_of_range,
713 VTABLE_ADD_FUNC(MSVCP_logic_error_what)
714 VTABLE_ADD_FUNC(MSVCP_exception__Doraise));
715 __ASM_VTABLE(invalid_argument,
716 VTABLE_ADD_FUNC(MSVCP_logic_error_what)
717 VTABLE_ADD_FUNC(MSVCP_exception__Doraise));
718 __ASM_VTABLE(runtime_error,
719 VTABLE_ADD_FUNC(MSVCP_runtime_error_what)
720 VTABLE_ADD_FUNC(MSVCP_exception__Doraise));
725 /* Internal: throws selected exception */
726 void throw_exception(exception_type et, const char *str)
731 MSVCP_exception_ctor(&e, str);
732 _CxxThrowException(&e, &exception_cxx_type);
734 case EXCEPTION_BAD_ALLOC: {
736 MSVCP_bad_alloc_ctor(&e, str);
737 _CxxThrowException(&e, &bad_alloc_cxx_type);
739 case EXCEPTION_LOGIC_ERROR: {
741 MSVCP_logic_error_ctor(&e, str);
742 _CxxThrowException((exception*)&e, &logic_error_cxx_type);
744 case EXCEPTION_LENGTH_ERROR: {
746 MSVCP_length_error_ctor(&e, str);
747 _CxxThrowException((exception*)&e, &length_error_cxx_type);
749 case EXCEPTION_OUT_OF_RANGE: {
751 MSVCP_out_of_range_ctor(&e, str);
752 _CxxThrowException((exception*)&e, &out_of_range_cxx_type);
754 case EXCEPTION_INVALID_ARGUMENT: {
756 MSVCP_invalid_argument_ctor(&e, str);
757 _CxxThrowException((exception*)&e, &invalid_argument_cxx_type);
759 case EXCEPTION_RUNTIME_ERROR: {
761 MSVCP_runtime_error_ctor(&e, str);
762 _CxxThrowException((exception*)&e, &runtime_error_cxx_type);