[MSVCRT_WINETEST]: Sync to Wine 1.5.13.
[reactos.git] / rostests / winetests / msvcrt / cpp.c
1 /* Unit test suite for msvcrt C++ objects
2 *
3 * Copyright 2003 Jon Griffiths
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19 #include "wine/test.h"
20 #include "winbase.h"
21 #include "winnt.h"
22
23 typedef void (*vtable_ptr)(void);
24
25 typedef struct __exception
26 {
27 vtable_ptr *vtable;
28 char *name;
29 int do_free;
30 } exception;
31
32 typedef struct __type_info
33 {
34 vtable_ptr *vtable;
35 char *name;
36 char mangled[16];
37 } type_info;
38
39 #undef __thiscall
40 #ifdef __i386__
41 #define __thiscall __stdcall
42 #else
43 #define __thiscall __cdecl
44 #endif
45
46 /* Function pointers. We need to use these to call these funcs as __thiscall */
47 static HMODULE hMsvcrt;
48
49 static void* (__cdecl *poperator_new)(unsigned int);
50 static void (__cdecl *poperator_delete)(void*);
51 static void* (__cdecl *pmalloc)(unsigned int);
52 static void (__cdecl *pfree)(void*);
53
54 /* exception */
55 static void (__thiscall *pexception_ctor)(exception*,LPCSTR*);
56 static void (__thiscall *pexception_copy_ctor)(exception*,exception*);
57 static void (__thiscall *pexception_default_ctor)(exception*);
58 static void (__thiscall *pexception_dtor)(exception*);
59 static exception* (__thiscall *pexception_opequals)(exception*,exception*);
60 static char* (__thiscall *pexception_what)(exception*);
61 static vtable_ptr *pexception_vtable;
62 static void (__thiscall *pexception_vector_dtor)(exception*,unsigned int);
63 static void (__thiscall *pexception_scalar_dtor)(exception*,unsigned int);
64
65 /* bad_typeid */
66 static void (__thiscall *pbad_typeid_ctor)(exception*,LPCSTR);
67 static void (__thiscall *pbad_typeid_ctor_closure)(exception*);
68 static void (__thiscall *pbad_typeid_copy_ctor)(exception*,exception*);
69 static void (__thiscall *pbad_typeid_dtor)(exception*);
70 static exception* (__thiscall *pbad_typeid_opequals)(exception*,exception*);
71 static char* (__thiscall *pbad_typeid_what)(exception*);
72 static vtable_ptr *pbad_typeid_vtable;
73 static void (__thiscall *pbad_typeid_vector_dtor)(exception*,unsigned int);
74 static void (__thiscall *pbad_typeid_scalar_dtor)(exception*,unsigned int);
75
76 /* bad_cast */
77 static void (__thiscall *pbad_cast_ctor)(exception*,LPCSTR*);
78 static void (__thiscall *pbad_cast_ctor2)(exception*,LPCSTR);
79 static void (__thiscall *pbad_cast_ctor_closure)(exception*);
80 static void (__thiscall *pbad_cast_copy_ctor)(exception*,exception*);
81 static void (__thiscall *pbad_cast_dtor)(exception*);
82 static exception* (__thiscall *pbad_cast_opequals)(exception*,exception*);
83 static char* (__thiscall *pbad_cast_what)(exception*);
84 static vtable_ptr *pbad_cast_vtable;
85 static void (__thiscall *pbad_cast_vector_dtor)(exception*,unsigned int);
86 static void (__thiscall *pbad_cast_scalar_dtor)(exception*,unsigned int);
87
88 /* __non_rtti_object */
89 static void (__thiscall *p__non_rtti_object_ctor)(exception*,LPCSTR);
90 static void (__thiscall *p__non_rtti_object_copy_ctor)(exception*,exception*);
91 static void (__thiscall *p__non_rtti_object_dtor)(exception*);
92 static exception* (__thiscall *p__non_rtti_object_opequals)(exception*,exception*);
93 static char* (__thiscall *p__non_rtti_object_what)(exception*);
94 static vtable_ptr *p__non_rtti_object_vtable;
95 static void (__thiscall *p__non_rtti_object_vector_dtor)(exception*,unsigned int);
96 static void (__thiscall *p__non_rtti_object_scalar_dtor)(exception*,unsigned int);
97
98 /* type_info */
99 static void (__thiscall *ptype_info_dtor)(type_info*);
100 static char* (__thiscall *ptype_info_raw_name)(type_info*);
101 static char* (__thiscall *ptype_info_name)(type_info*);
102 static int (__thiscall *ptype_info_before)(type_info*,type_info*);
103 static int (__thiscall *ptype_info_opequals_equals)(type_info*,type_info*);
104 static int (__thiscall *ptype_info_opnot_equals)(type_info*,type_info*);
105
106 /* RTTI */
107 static type_info* (__cdecl *p__RTtypeid)(void*);
108 static void* (__cdecl *p__RTCastToVoid)(void*);
109 static void* (__cdecl *p__RTDynamicCast)(void*,int,void*,void*,int);
110
111 /*Demangle*/
112 static char* (__cdecl *p__unDName)(char*,const char*,int,void*,void*,unsigned short int);
113
114
115 /* _very_ early native versions have serious RTTI bugs, so we check */
116 static void* bAncientVersion;
117
118 /* Emulate a __thiscall */
119 #ifdef __i386__
120
121 #include "pshpack1.h"
122 struct thiscall_thunk
123 {
124 BYTE pop_eax; /* popl %eax (ret addr) */
125 BYTE pop_edx; /* popl %edx (func) */
126 BYTE pop_ecx; /* popl %ecx (this) */
127 BYTE push_eax; /* pushl %eax */
128 WORD jmp_edx; /* jmp *%edx */
129 };
130 #include "poppack.h"
131
132 static void * (WINAPI *call_thiscall_func1)( void *func, void *this );
133 static void * (WINAPI *call_thiscall_func2)( void *func, void *this, const void *a );
134
135 static void init_thiscall_thunk(void)
136 {
137 struct thiscall_thunk *thunk = VirtualAlloc( NULL, sizeof(*thunk),
138 MEM_COMMIT, PAGE_EXECUTE_READWRITE );
139 thunk->pop_eax = 0x58; /* popl %eax */
140 thunk->pop_edx = 0x5a; /* popl %edx */
141 thunk->pop_ecx = 0x59; /* popl %ecx */
142 thunk->push_eax = 0x50; /* pushl %eax */
143 thunk->jmp_edx = 0xe2ff; /* jmp *%edx */
144 call_thiscall_func1 = (void *)thunk;
145 call_thiscall_func2 = (void *)thunk;
146 }
147
148 #define call_func1(func,_this) call_thiscall_func1(func,_this)
149 #define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)a)
150
151 #else
152
153 #define init_thiscall_thunk() do { } while(0)
154 #define call_func1(func,_this) func(_this)
155 #define call_func2(func,_this,a) func(_this,a)
156
157 #endif /* __i386__ */
158
159 /* Some exports are only available in later versions */
160 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
161 #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
162
163 static BOOL InitFunctionPtrs(void)
164 {
165 hMsvcrt = GetModuleHandleA("msvcrt.dll");
166 if (!hMsvcrt)
167 hMsvcrt = GetModuleHandleA("msvcrtd.dll");
168 ok(hMsvcrt != 0, "GetModuleHandleA failed\n");
169 if (!hMsvcrt)
170 {
171 win_skip("Could not load msvcrt.dll\n");
172 return FALSE;
173 }
174
175 SET(pmalloc, "malloc");
176 SET(pfree, "free");
177
178 SET(pexception_vtable, "??_7exception@@6B@");
179 SET(pbad_typeid_vtable, "??_7bad_typeid@@6B@");
180 SET(pbad_cast_vtable, "??_7bad_cast@@6B@");
181 SET(p__non_rtti_object_vtable, "??_7__non_rtti_object@@6B@");
182
183 SET(p__RTtypeid, "__RTtypeid");
184 SET(p__RTCastToVoid, "__RTCastToVoid");
185 SET(p__RTDynamicCast, "__RTDynamicCast");
186
187 SET(p__unDName,"__unDName");
188
189 /* Extremely early versions export logic_error, and crash in RTTI */
190 SETNOFAIL(bAncientVersion, "??0logic_error@@QAE@ABQBD@Z");
191 if (sizeof(void *) > sizeof(int)) /* 64-bit initialization */
192 {
193 SETNOFAIL(poperator_new, "??_U@YAPEAX_K@Z");
194 SETNOFAIL(poperator_delete, "??_V@YAXPEAX@Z");
195
196 SET(pexception_ctor, "??0exception@@QEAA@AEBQEBD@Z");
197 SET(pexception_copy_ctor, "??0exception@@QEAA@AEBV0@@Z");
198 SET(pexception_default_ctor, "??0exception@@QEAA@XZ");
199 SET(pexception_dtor, "??1exception@@UEAA@XZ");
200 SET(pexception_opequals, "??4exception@@QEAAAEAV0@AEBV0@@Z");
201 SET(pexception_what, "?what@exception@@UEBAPEBDXZ");
202 pexception_vector_dtor = (void*)pexception_vtable[0];
203 pexception_scalar_dtor = (void*)pexception_vtable[0];
204
205 SET(pbad_typeid_ctor, "??0bad_typeid@@QEAA@PEBD@Z");
206 SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@@QEAAXXZ");
207 SET(pbad_typeid_copy_ctor, "??0bad_typeid@@QEAA@AEBV0@@Z");
208 SET(pbad_typeid_dtor, "??1bad_typeid@@UEAA@XZ");
209 SET(pbad_typeid_opequals, "??4bad_typeid@@QEAAAEAV0@AEBV0@@Z");
210 SET(pbad_typeid_what, "?what@exception@@UEBAPEBDXZ");
211 pbad_typeid_vector_dtor = (void*)pbad_typeid_vtable[0];
212 pbad_typeid_scalar_dtor = (void*)pbad_typeid_vtable[0];
213
214 SET(pbad_cast_ctor, "??0bad_cast@@QEAA@AEBQEBD@Z");
215 SET(pbad_cast_ctor2, "??0bad_cast@@QEAA@PEBD@Z");
216 SET(pbad_cast_ctor_closure, "??_Fbad_cast@@QEAAXXZ");
217 SET(pbad_cast_copy_ctor, "??0bad_cast@@QEAA@AEBV0@@Z");
218 SET(pbad_cast_dtor, "??1bad_cast@@UEAA@XZ");
219 SET(pbad_cast_opequals, "??4bad_cast@@QEAAAEAV0@AEBV0@@Z");
220 SET(pbad_cast_what, "?what@exception@@UEBAPEBDXZ");
221 pbad_cast_vector_dtor = (void*)pbad_cast_vtable[0];
222 pbad_cast_scalar_dtor = (void*)pbad_cast_vtable[0];
223
224 SET(p__non_rtti_object_ctor, "??0__non_rtti_object@@QEAA@PEBD@Z");
225 SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@@QEAA@AEBV0@@Z");
226 SET(p__non_rtti_object_dtor, "??1__non_rtti_object@@UEAA@XZ");
227 SET(p__non_rtti_object_opequals, "??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z");
228 SET(p__non_rtti_object_what, "?what@exception@@UEBAPEBDXZ");
229 p__non_rtti_object_vector_dtor = (void*)p__non_rtti_object_vtable[0];
230 p__non_rtti_object_scalar_dtor = (void*)p__non_rtti_object_vtable[0];
231
232 SET(ptype_info_dtor, "??1type_info@@UEAA@XZ");
233 SET(ptype_info_raw_name, "?raw_name@type_info@@QEBAPEBDXZ");
234 SET(ptype_info_name, "?name@type_info@@QEBAPEBDXZ");
235 SET(ptype_info_before, "?before@type_info@@QEBAHAEBV1@@Z");
236 SET(ptype_info_opequals_equals, "??8type_info@@QEBAHAEBV0@@Z");
237 SET(ptype_info_opnot_equals, "??9type_info@@QEBAHAEBV0@@Z");
238 }
239 else
240 {
241 SETNOFAIL(poperator_new, "??_U@YAPAXI@Z");
242 SETNOFAIL(poperator_delete, "??_V@YAXPAX@Z");
243
244 SET(pexception_ctor, "??0exception@@QAE@ABQBD@Z");
245 SET(pexception_copy_ctor, "??0exception@@QAE@ABV0@@Z");
246 SET(pexception_default_ctor, "??0exception@@QAE@XZ");
247 SET(pexception_dtor, "??1exception@@UAE@XZ");
248 SET(pexception_opequals, "??4exception@@QAEAAV0@ABV0@@Z");
249 SET(pexception_what, "?what@exception@@UBEPBDXZ");
250 SET(pexception_vector_dtor, "??_Eexception@@UAEPAXI@Z");
251 SET(pexception_scalar_dtor, "??_Gexception@@UAEPAXI@Z");
252
253 SET(pbad_typeid_ctor, "??0bad_typeid@@QAE@PBD@Z");
254 SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@@QAEXXZ");
255 SET(pbad_typeid_copy_ctor, "??0bad_typeid@@QAE@ABV0@@Z");
256 SET(pbad_typeid_dtor, "??1bad_typeid@@UAE@XZ");
257 SET(pbad_typeid_opequals, "??4bad_typeid@@QAEAAV0@ABV0@@Z");
258 SET(pbad_typeid_what, "?what@exception@@UBEPBDXZ");
259 SET(pbad_typeid_vector_dtor, "??_Ebad_typeid@@UAEPAXI@Z");
260 SET(pbad_typeid_scalar_dtor, "??_Gbad_typeid@@UAEPAXI@Z");
261
262 SETNOFAIL(pbad_cast_ctor, "??0bad_cast@@QAE@ABQBD@Z");
263 if (!pbad_cast_ctor)
264 SET(pbad_cast_ctor, "??0bad_cast@@AAE@PBQBD@Z");
265 SETNOFAIL(pbad_cast_ctor2, "??0bad_cast@@QAE@PBD@Z");
266 SETNOFAIL(pbad_cast_ctor_closure, "??_Fbad_cast@@QAEXXZ");
267 SET(pbad_cast_copy_ctor, "??0bad_cast@@QAE@ABV0@@Z");
268 SET(pbad_cast_dtor, "??1bad_cast@@UAE@XZ");
269 SET(pbad_cast_opequals, "??4bad_cast@@QAEAAV0@ABV0@@Z");
270 SET(pbad_cast_what, "?what@exception@@UBEPBDXZ");
271 SET(pbad_cast_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
272 SET(pbad_cast_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
273
274 SET(p__non_rtti_object_ctor, "??0__non_rtti_object@@QAE@PBD@Z");
275 SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@@QAE@ABV0@@Z");
276 SET(p__non_rtti_object_dtor, "??1__non_rtti_object@@UAE@XZ");
277 SET(p__non_rtti_object_opequals, "??4__non_rtti_object@@QAEAAV0@ABV0@@Z");
278 SET(p__non_rtti_object_what, "?what@exception@@UBEPBDXZ");
279 SET(p__non_rtti_object_vector_dtor, "??_E__non_rtti_object@@UAEPAXI@Z");
280 SET(p__non_rtti_object_scalar_dtor, "??_G__non_rtti_object@@UAEPAXI@Z");
281
282 SET(ptype_info_dtor, "??1type_info@@UAE@XZ");
283 SET(ptype_info_raw_name, "?raw_name@type_info@@QBEPBDXZ");
284 SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
285 SET(ptype_info_before, "?before@type_info@@QBEHABV1@@Z");
286 SET(ptype_info_opequals_equals, "??8type_info@@QBEHABV0@@Z");
287 SET(ptype_info_opnot_equals, "??9type_info@@QBEHABV0@@Z");
288 }
289
290 if (!poperator_new)
291 poperator_new = pmalloc;
292 if (!poperator_delete)
293 poperator_delete = pfree;
294
295 init_thiscall_thunk();
296 return TRUE;
297 }
298
299 static void test_exception(void)
300 {
301 static const char* e_name = "An exception name";
302 char* name;
303 exception e, e2, e3, *pe;
304
305 if (!poperator_new || !poperator_delete ||
306 !pexception_ctor || !pexception_copy_ctor || !pexception_default_ctor ||
307 !pexception_dtor || !pexception_opequals || !pexception_what ||
308 !pexception_vtable || !pexception_vector_dtor || !pexception_scalar_dtor)
309 return;
310
311 /* 'const char*&' ctor */
312 memset(&e, 0, sizeof(e));
313 call_func2(pexception_ctor, &e, &e_name);
314 ok(e.vtable != NULL, "Null exception vtable for e\n");
315 ok(e.name && e.name != e_name && !strcmp(e.name, "An exception name"), "Bad name '%s' for e\n", e.name);
316 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
317
318 /* Copy ctor */
319 memset(&e2, 0, sizeof(e2));
320 call_func2(pexception_copy_ctor, &e2, &e);
321 ok(e2.vtable != NULL, "Null exception vtable for e2\n");
322 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
323 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
324
325 /* Default ctor */
326 memset(&e3, 1, sizeof(e3));
327 call_func1(pexception_default_ctor, &e3);
328 ok(e3.vtable != NULL, "Null exception vtable for e3\n");
329 ok(e3.name == NULL, "Bad exception name for e3\n");
330 ok(e3.do_free == 0, "do_free set to %d for e3\n", e3.do_free);
331
332 ok(e.vtable == e2.vtable && e.vtable == e3.vtable, "exception vtables differ!\n");
333
334 /* Test calling the dtors */
335 call_func1(pexception_dtor, &e2);
336 call_func1(pexception_dtor, &e3);
337
338 /* Operator equals */
339 memset(&e2, 0, sizeof(e2));
340 call_func1(pexception_default_ctor, &e2);
341 pe = call_func2(pexception_opequals, &e2, &e);
342 ok(e2.vtable != NULL, "Null exception vtable for e2\n");
343 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
344 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
345 ok(pe == &e2, "opequals didn't return e2\n");
346
347 /* what() */
348 name = call_func1(pexception_what, &e2);
349 ok(e2.name == name, "Bad exception name from e2::what()\n");
350
351 /* vtable ptr */
352 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
353 call_func1(pexception_dtor, &e2);
354
355 /* new() */
356 pe = poperator_new(sizeof(exception));
357 ok(pe != NULL, "new() failed\n");
358 if (pe)
359 {
360 call_func2(pexception_ctor, pe, &e_name);
361 /* scalar dtor */
362 call_func2(pexception_scalar_dtor, pe, 0); /* Shouldn't delete pe */
363 pe->name = NULL;
364 pe->do_free = 0;
365 call_func2(pexception_scalar_dtor, pe, 1); /* Should delete pe */
366 }
367
368 pe = poperator_new(sizeof(exception));
369 ok(pe != NULL, "new() failed\n");
370 if (pe)
371 {
372 /* vector dtor, single element */
373 call_func2(pexception_ctor, pe, &e_name);
374 call_func2(pexception_vector_dtor, pe, 1); /* Should delete pe as single element*/
375 }
376
377 pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
378 ok(pe != NULL, "new() failed\n");
379 if (pe)
380 {
381 /* vector dtor, multiple elements */
382 char name[] = "a constant";
383 *((size_t*)pe) = 3;
384 pe = (exception*)((size_t*)pe + 1);
385 call_func2(pexception_ctor, &pe[0], &e_name);
386 call_func2(pexception_ctor, &pe[1], &e_name);
387 call_func2(pexception_ctor, &pe[2], &e_name);
388 pe[3].name = name;
389 pe[3].do_free = 1; /* Crash if we try to free this */
390 call_func2(pexception_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
391 }
392
393 /* test our exported vtable is kosher */
394 pe = (void*)pexception_vtable; /* Use the exception struct to get vtable ptrs */
395 pexception_vector_dtor = (void*)pe->vtable;
396 pexception_what = (void*)pe->name;
397
398 name = call_func1(pexception_what, &e);
399 ok(e.name == name, "Bad exception name from vtable e::what()\n");
400
401 if (p__RTtypeid && !bAncientVersion)
402 {
403 /* Check the rtti */
404 type_info *ti = p__RTtypeid(&e);
405 ok (ti && ti->mangled &&
406 !strcmp(ti->mangled, ".?AVexception@@"), "bad rtti for e\n");
407
408 if (ti)
409 {
410 /* Check the returned type_info has rtti too */
411 type_info *ti2 = p__RTtypeid(ti);
412 ok (ti2 != NULL && !strcmp(ti2->mangled, ".?AVtype_info@@"), "bad rtti for e's type_info\n");
413 }
414 }
415
416 call_func2(pexception_vector_dtor, &e, 0); /* Should delete e.name, but not e */
417 }
418
419 /* This test is basically a cut 'n' paste of the exception test. but it verifies that
420 * bad_typeid works the exact same way... */
421 static void test_bad_typeid(void)
422 {
423 static const char* e_name = "A bad_typeid name";
424 char* name;
425 exception e, e2, e3, *pe;
426
427 if (!poperator_new || !poperator_delete ||
428 !pbad_typeid_ctor || !pbad_typeid_copy_ctor ||
429 !pbad_typeid_dtor || !pbad_typeid_opequals || !pbad_typeid_what ||
430 !pbad_typeid_vtable || !pbad_typeid_vector_dtor || !pbad_typeid_scalar_dtor)
431 return;
432
433 /* 'const char*' ctor */
434 memset(&e, 0, sizeof(e));
435 call_func2(pbad_typeid_ctor, &e, e_name);
436 ok(e.vtable != NULL, "Null bad_typeid vtable for e\n");
437 ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_typeid name"), "Bad name '%s' for e\n", e.name);
438 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
439
440 /* Copy ctor */
441 memset(&e2, 0, sizeof(e2));
442 call_func2(pbad_typeid_copy_ctor, &e2, &e);
443 ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
444 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad name '%s' for e2\n", e2.name);
445 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
446
447 /* Ctor closure */
448 if (pbad_typeid_ctor_closure)
449 {
450 memset(&e3, 1, sizeof(e3));
451 call_func1(pbad_typeid_ctor_closure, &e3);
452 ok(e3.vtable != NULL, "Null bad_typeid vtable for e3\n");
453 ok(e3.name && !strcmp(e3.name, "bad typeid"), "Bad bad_typeid name for e3\n");
454 ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
455 ok(e.vtable == e3.vtable, "bad_typeid closure vtables differ!\n");
456 call_func1(pbad_typeid_dtor, &e3);
457 }
458 ok(e.vtable == e2.vtable, "bad_typeid vtables differ!\n");
459
460 /* Test calling the dtors */
461 call_func1(pbad_typeid_dtor, &e2);
462
463 /* Operator equals */
464 memset(&e2, 1, sizeof(e2));
465 call_func1(pexception_default_ctor, &e2);
466 pe = call_func2(pbad_typeid_opequals, &e2, &e);
467 ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
468 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad bad_typeid name for e2\n");
469 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
470 ok(pe == &e2, "opequals didn't return e2\n");
471
472 /* what() */
473 name = call_func1(pbad_typeid_what, &e2);
474 ok(e2.name == name, "Bad bad_typeid name from e2::what()\n");
475
476 /* vtable ptr */
477 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
478 call_func1(pbad_typeid_dtor, &e2);
479
480 /* new() */
481 pe = poperator_new(sizeof(exception));
482 ok(pe != NULL, "new() failed\n");
483 if (pe)
484 {
485 call_func2(pbad_typeid_ctor, pe, e_name);
486 /* scalar dtor */
487 call_func2(pbad_typeid_scalar_dtor, pe, 0); /* Shouldn't delete pe */
488 pe->name = NULL;
489 pe->do_free = 0;
490 call_func2(pbad_typeid_scalar_dtor, pe, 1); /* Should delete pe */
491 }
492
493 pe = poperator_new(sizeof(exception));
494 ok(pe != NULL, "new() failed\n");
495 if (pe)
496 {
497 /* vector dtor, single element */
498 call_func2(pbad_typeid_ctor, pe, e_name);
499 call_func2(pbad_typeid_vector_dtor, pe, 1); /* Should delete pe as single element*/
500 }
501
502 pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
503 ok(pe != NULL, "new() failed\n");
504 if (pe)
505 {
506 /* vector dtor, multiple elements */
507 *((size_t*)pe) = 3;
508 pe = (exception*)((size_t*)pe + 1);
509 call_func2(pbad_typeid_ctor, &pe[0], e_name);
510 call_func2(pbad_typeid_ctor, &pe[1], e_name);
511 call_func2(pbad_typeid_ctor, &pe[2], e_name);
512 pe[3].name = 0;
513 pe[3].do_free = 1; /* Crash if we try to free this element */
514 call_func2(pbad_typeid_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
515 }
516
517 /* test our exported vtable is kosher */
518 pe = (void*)pbad_typeid_vtable; /* Use the exception struct to get vtable ptrs */
519 pbad_typeid_vector_dtor = (void*)pe->vtable;
520 pbad_typeid_what = (void*)pe->name;
521
522 name = call_func1(pbad_typeid_what, &e);
523 ok(e.name == name, "Bad bad_typeid name from vtable e::what()\n");
524
525 if (p__RTtypeid && !bAncientVersion)
526 {
527 /* Check the rtti */
528 type_info *ti = p__RTtypeid(&e);
529 ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_typeid@@"), "bad rtti for e (%s)\n",
530 !ti ? "null" : ti->mangled);
531 }
532
533 call_func2(pbad_typeid_vector_dtor, &e, 0); /* Should delete e.name, but not e */
534 }
535
536
537 /* Ditto for this test... */
538 static void test_bad_cast(void)
539 {
540 static const char* e_name = "A bad_cast name";
541 char* name;
542 exception e, e2, e3, *pe;
543
544 if (!poperator_new || !poperator_delete ||
545 !pbad_cast_ctor || !pbad_cast_copy_ctor ||
546 !pbad_cast_dtor || !pbad_cast_opequals || !pbad_cast_what ||
547 !pbad_cast_vtable || !pbad_cast_vector_dtor || !pbad_cast_scalar_dtor)
548 return;
549
550 if (pbad_cast_ctor2)
551 {
552 /* 'const char*' ctor */
553 memset(&e, 0, sizeof(e));
554 call_func2(pbad_cast_ctor2, &e, e_name);
555 ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
556 ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
557 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
558 call_func1(pbad_cast_dtor, &e);
559 }
560
561 /* 'const char*&' ctor */
562 memset(&e, 0, sizeof(e));
563 call_func2(pbad_cast_ctor, &e, &e_name);
564 ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
565 ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
566 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
567
568 /* Copy ctor */
569 memset(&e2, 0, sizeof(e2));
570 call_func2(pbad_cast_copy_ctor, &e2, &e);
571 ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
572 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad name '%s' for e2\n", e2.name);
573 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
574
575 /* Ctor closure */
576 if (pbad_cast_ctor_closure)
577 {
578 memset(&e3, 1, sizeof(e3));
579 call_func1(pbad_cast_ctor_closure, &e3);
580 ok(e3.vtable != NULL, "Null bad_cast vtable for e3\n");
581 ok(e3.name && !strcmp(e3.name, "bad cast"), "Bad bad_cast name for e3\n");
582 ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
583 ok(e.vtable == e3.vtable, "bad_cast closure vtables differ!\n");
584 call_func1(pbad_cast_dtor, &e3);
585 }
586 ok(e.vtable == e2.vtable, "bad_cast vtables differ!\n");
587
588 /* Test calling the dtors */
589 call_func1(pbad_cast_dtor, &e2);
590
591 /* Operator equals */
592 memset(&e2, 1, sizeof(e2));
593 call_func1(pexception_default_ctor, &e2);
594 pe = call_func2(pbad_cast_opequals, &e2, &e);
595 ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
596 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad bad_cast name for e2\n");
597 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
598 ok(pe == &e2, "opequals didn't return e2\n");
599
600 /* what() */
601 name = call_func1(pbad_cast_what, &e2);
602 ok(e2.name == name, "Bad bad_cast name from e2::what()\n");
603
604 /* vtable ptr */
605 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
606 call_func1(pbad_cast_dtor, &e2);
607
608 /* new() */
609 pe = poperator_new(sizeof(exception));
610 ok(pe != NULL, "new() failed\n");
611 if (pe)
612 {
613 call_func2(pbad_cast_ctor, pe, &e_name);
614 /* scalar dtor */
615 call_func2(pbad_cast_scalar_dtor, pe, 0); /* Shouldn't delete pe */
616 pe->name = NULL;
617 pe->do_free = 0;
618 call_func2(pbad_cast_scalar_dtor, pe, 1); /* Should delete pe */
619 }
620
621 pe = poperator_new(sizeof(exception));
622 ok(pe != NULL, "new() failed\n");
623 if (pe)
624 {
625 /* vector dtor, single element */
626 call_func2(pbad_cast_ctor, pe, &e_name);
627 call_func2(pbad_cast_vector_dtor, pe, 1); /* Should delete pe as single element*/
628 }
629
630 pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
631 ok(pe != NULL, "new() failed\n");
632 if (pe)
633 {
634 /* vector dtor, multiple elements */
635 *((size_t*)pe) = 3;
636 pe = (exception*)((size_t*)pe + 1);
637 call_func2(pbad_cast_ctor, &pe[0], &e_name);
638 call_func2(pbad_cast_ctor, &pe[1], &e_name);
639 call_func2(pbad_cast_ctor, &pe[2], &e_name);
640 pe[3].name = 0;
641 pe[3].do_free = 1; /* Crash if we try to free this element */
642 call_func2(pbad_cast_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
643 }
644
645 /* test our exported vtable is kosher */
646 pe = (void*)pbad_cast_vtable; /* Use the exception struct to get vtable ptrs */
647 pbad_cast_vector_dtor = (void*)pe->vtable;
648 pbad_cast_what = (void*)pe->name;
649
650 name = call_func1(pbad_cast_what, &e);
651 ok(e.name == name, "Bad bad_cast name from vtable e::what()\n");
652
653 if (p__RTtypeid && !bAncientVersion)
654 {
655 /* Check the rtti */
656 type_info *ti = p__RTtypeid(&e);
657 ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_cast@@"), "bad rtti for e\n");
658 }
659 call_func2(pbad_cast_vector_dtor, &e, 0); /* Should delete e.name, but not e */
660 }
661
662 /* ... and this one */
663 static void test___non_rtti_object(void)
664 {
665 static const char* e_name = "A __non_rtti_object name";
666 char* name;
667 exception e, e2, *pe;
668
669 if (!poperator_new || !poperator_delete ||
670 !p__non_rtti_object_ctor || !p__non_rtti_object_copy_ctor ||
671 !p__non_rtti_object_dtor || !p__non_rtti_object_opequals || !p__non_rtti_object_what ||
672 !p__non_rtti_object_vtable || !p__non_rtti_object_vector_dtor || !p__non_rtti_object_scalar_dtor)
673 return;
674
675 /* 'const char*' ctor */
676 memset(&e, 0, sizeof(e));
677 call_func2(p__non_rtti_object_ctor, &e, e_name);
678 ok(e.vtable != NULL, "Null __non_rtti_object vtable for e\n");
679 ok(e.name && e.name != e_name && !strcmp(e.name, "A __non_rtti_object name"), "Bad name '%s' for e\n", e.name);
680 ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
681
682 /* Copy ctor */
683 memset(&e2, 0, sizeof(e2));
684 call_func2(p__non_rtti_object_copy_ctor, &e2, &e);
685 ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
686 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad name '%s' for e2\n", e2.name);
687 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
688 ok(e.vtable == e2.vtable, "__non_rtti_object vtables differ!\n");
689
690 /* Test calling the dtors */
691 call_func1(p__non_rtti_object_dtor, &e2);
692
693 /* Operator equals */
694 memset(&e2, 1, sizeof(e2));
695 call_func1(pexception_default_ctor, &e2);
696 pe = call_func2(p__non_rtti_object_opequals, &e2, &e);
697 ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
698 ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad __non_rtti_object name for e2\n");
699 ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
700 ok(pe == &e2, "opequals didn't return e2\n");
701
702 /* what() */
703 name = call_func1(p__non_rtti_object_what, &e2);
704 ok(e2.name == name, "Bad __non_rtti_object name from e2::what()\n");
705
706 /* vtable ptr */
707 ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
708 call_func1(p__non_rtti_object_dtor, &e2);
709
710 /* new() */
711 pe = poperator_new(sizeof(exception));
712 ok(pe != NULL, "new() failed\n");
713 if (pe)
714 {
715 call_func2(p__non_rtti_object_ctor, pe, e_name);
716 /* scalar dtor */
717 call_func2(p__non_rtti_object_scalar_dtor, pe, 0); /* Shouldn't delete pe */
718 pe->name = NULL;
719 pe->do_free = 0;
720 call_func2(p__non_rtti_object_scalar_dtor, pe, 1); /* Should delete pe */
721 }
722
723 pe = poperator_new(sizeof(exception));
724 ok(pe != NULL, "new() failed\n");
725 if (pe)
726 {
727 /* vector dtor, single element */
728 call_func2(p__non_rtti_object_ctor, pe, e_name);
729 call_func2(p__non_rtti_object_vector_dtor, pe, 1); /* Should delete pe as single element*/
730 }
731
732 pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
733 ok(pe != NULL, "new() failed\n");
734 if (pe)
735 {
736 /* vector dtor, multiple elements */
737 *((size_t*)pe) = 3;
738 pe = (exception*)((size_t*)pe + 1);
739 call_func2(p__non_rtti_object_ctor, &pe[0], e_name);
740 call_func2(p__non_rtti_object_ctor, &pe[1], e_name);
741 call_func2(p__non_rtti_object_ctor, &pe[2], e_name);
742 pe[3].name = 0;
743 pe[3].do_free = 1; /* Crash if we try to free this element */
744 call_func2(p__non_rtti_object_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
745 }
746
747 /* test our exported vtable is kosher */
748 pe = (void*)p__non_rtti_object_vtable; /* Use the exception struct to get vtable ptrs */
749 p__non_rtti_object_vector_dtor = (void*)pe->vtable;
750 p__non_rtti_object_what = (void*)pe->name;
751
752 name = call_func1(p__non_rtti_object_what, &e);
753 ok(e.name == name, "Bad __non_rtti_object name from vtable e::what()\n");
754
755 if (p__RTtypeid && !bAncientVersion)
756 {
757 /* Check the rtti */
758 type_info *ti = p__RTtypeid(&e);
759 ok (ti != NULL && !strcmp(ti->mangled, ".?AV__non_rtti_object@@"), "bad rtti for e\n");
760 }
761 call_func2(p__non_rtti_object_vector_dtor, &e, 0); /* Should delete e.name, but not e */
762 }
763
764 static void test_type_info(void)
765 {
766 static type_info t1 = { NULL, NULL,{'.','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
767 static type_info t1_1 = { NULL, NULL,{'?','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
768 static type_info t2 = { NULL, NULL, {'.','?','A','V','t','e','s','t','2','@','@',0,0,0,0,0 } };
769 char* name;
770 int res;
771
772 if (!pmalloc || !pfree || !ptype_info_dtor || !ptype_info_raw_name ||
773 !ptype_info_name || !ptype_info_before ||
774 !ptype_info_opequals_equals || !ptype_info_opnot_equals)
775 return;
776
777 /* Test calling the dtors */
778 call_func1(ptype_info_dtor, &t1); /* No effect, since name is NULL */
779 t1.name = pmalloc(64);
780 strcpy(t1.name, "foo");
781 call_func1(ptype_info_dtor, &t1); /* Frees t1.name using 'free' */
782
783 /* raw_name */
784 t1.name = NULL;
785 name = call_func1(ptype_info_raw_name, &t1);
786
787 /* FIXME: This fails on native; it shouldn't though - native bug?
788 * ok(name && !strcmp(name, t1.mangled), "bad raw_name '%s' for t1 (expected '%s')\n", name, t1.mangled);
789 */
790 ok(t1.name == NULL, "raw_name() set name for t1\n");
791
792 /* name */
793 t1.name = NULL;
794 name = call_func1(ptype_info_name, &t1);
795 ok(name && t1.name && !strcmp(name, t1.name), "bad name '%s' for t1\n", name);
796
797 ok(t1.name && !strcmp(t1.name, "class test1"), "demangled to '%s' for t1\n", t1.name);
798 call_func1(ptype_info_dtor, &t1);
799
800 /* before */
801 t1.name = NULL;
802 res = (int)call_func2(ptype_info_before, &t1, &t1);
803 ok(res == 0, "expected 0, got %d\n", res);
804 res = (int)call_func2(ptype_info_before, &t2, &t1);
805 ok(res == 0, "expected 0, got %d\n", res);
806 res = (int)call_func2(ptype_info_before, &t1, &t2);
807 ok(res == 1, "expected 1, got %d\n", res);
808 /* Doesn't check first char */
809 res = (int)call_func2(ptype_info_before, &t1, &t1_1);
810 ok(res == 0, "expected 0, got %d\n", res);
811
812 /* opequals_equals */
813 t1.name = NULL;
814 res = (int)call_func2(ptype_info_opequals_equals, &t1, &t1);
815 ok(res == 1, "expected 1, got %d\n", res);
816 res = (int)call_func2(ptype_info_opequals_equals, &t1, &t2);
817 ok(res == 0, "expected 0, got %d\n", res);
818 res = (int)call_func2(ptype_info_opequals_equals, &t2, &t1);
819 ok(res == 0, "expected 0, got %d\n", res);
820
821 /* opnot_equals */
822 t1.name = NULL;
823 res = (int)call_func2(ptype_info_opnot_equals, &t1, &t1);
824 ok(res == 0, "expected 0, got %d\n", res);
825 res = (int)call_func2(ptype_info_opnot_equals, &t1, &t2);
826 ok(res == 1, "expected 1, got %d\n", res);
827 res = (int)call_func2(ptype_info_opnot_equals, &t2, &t1);
828 ok(res == 1, "expected 1, got %d\n", res);
829 }
830
831 static inline vtable_ptr *get_vtable( void *obj )
832 {
833 return *(vtable_ptr **)obj;
834 }
835
836 static inline void/*rtti_object_locator*/ *get_obj_locator( void *cppobj )
837 {
838 const vtable_ptr *vtable = get_vtable( cppobj );
839 return (void *)vtable[-1];
840 }
841
842 #ifndef __x86_64__
843 #define DEFINE_RTTI_REF(type, name) type *name
844 #define RTTI_REF(instance, name) &instance.name
845 #define RTTI_REF_SIG0(instance, name, base) RTTI_REF(instance, name)
846 #else
847 #define DEFINE_RTTI_REF(type, name) unsigned name
848 #define RTTI_REF(instance, name) FIELD_OFFSET(struct rtti_data, name)
849 #define RTTI_REF_SIG0(instance, name, base) ((char*)&instance.name-base)
850 #endif
851 /* Test RTTI functions */
852 static void test_rtti(void)
853 {
854 struct _object_locator
855 {
856 unsigned int signature;
857 int base_class_offset;
858 unsigned int flags;
859 DEFINE_RTTI_REF(type_info, type_descriptor);
860 DEFINE_RTTI_REF(struct _rtti_object_hierarchy, type_hierarchy);
861 DEFINE_RTTI_REF(void, object_locator);
862 } *obj_locator;
863
864 struct rtti_data
865 {
866 type_info type_info[4];
867
868 struct _rtti_base_descriptor
869 {
870 DEFINE_RTTI_REF(type_info, type_descriptor);
871 int num_base_classes;
872 struct {
873 int this_offset;
874 int vbase_descr;
875 int vbase_offset;
876 } this_ptr_offsets;
877 unsigned int attributes;
878 } base_descriptor[4];
879
880 struct _rtti_base_array {
881 DEFINE_RTTI_REF(struct _rtti_base_descriptor, bases[4]);
882 } base_array;
883
884 struct _rtti_object_hierarchy {
885 unsigned int signature;
886 unsigned int attributes;
887 int array_len;
888 DEFINE_RTTI_REF(struct _rtti_base_array, base_classes);
889 } object_hierarchy;
890
891 struct _object_locator object_locator;
892 } simple_class_rtti = {
893 { {NULL, NULL, "simple_class"} },
894 { {RTTI_REF(simple_class_rtti, type_info[0]), 0, {0, 0, 0}, 0} },
895 { {RTTI_REF(simple_class_rtti, base_descriptor[0])} },
896 {0, 0, 1, RTTI_REF(simple_class_rtti, base_array)},
897 {1, 0, 0, RTTI_REF(simple_class_rtti, type_info[0]), RTTI_REF(simple_class_rtti, object_hierarchy), RTTI_REF(simple_class_rtti, object_locator)}
898 }, child_class_rtti = {
899 { {NULL, NULL, "simple_class"}, {NULL, NULL, "child_class"} },
900 { {RTTI_REF(child_class_rtti, type_info[1]), 0, {4, -1, 0}, 0}, {RTTI_REF(child_class_rtti, type_info[0]), 0, {8, -1, 0}, 0} },
901 { {RTTI_REF(child_class_rtti, base_descriptor[0]), RTTI_REF(child_class_rtti, base_descriptor[1])} },
902 {0, 0, 2, RTTI_REF(child_class_rtti, base_array)},
903 {1, 0, 0, RTTI_REF(child_class_rtti, type_info[1]), RTTI_REF(child_class_rtti, object_hierarchy), RTTI_REF(child_class_rtti, object_locator)}
904 };
905 static struct rtti_data simple_class_sig0_rtti, child_class_sig0_rtti;
906
907 void *simple_class_vtbl[2] = {&simple_class_rtti.object_locator};
908 void *simple_class = &simple_class_vtbl[1];
909 void *child_class_vtbl[2] = {&child_class_rtti.object_locator};
910 void *child_class = &child_class_vtbl[1];
911 void *simple_class_sig0_vtbl[2] = {&simple_class_sig0_rtti.object_locator};
912 void *simple_class_sig0 = &simple_class_sig0_vtbl[1];
913 void *child_class_sig0_vtbl[2] = {&child_class_sig0_rtti.object_locator};
914 void *child_class_sig0 = &child_class_sig0_vtbl[1];
915
916 static const char* e_name = "name";
917 type_info *ti,*bti;
918 exception e,b;
919 void *casted;
920 BOOL old_signature;
921 #ifdef __x86_64__
922 char *base = (char*)GetModuleHandleW(NULL);
923 #endif
924
925 if (bAncientVersion ||
926 !p__RTCastToVoid || !p__RTtypeid || !pexception_ctor || !pbad_typeid_ctor
927 || !p__RTDynamicCast || !pexception_dtor || !pbad_typeid_dtor)
928 return;
929
930 call_func2(pexception_ctor, &e, &e_name);
931 call_func2(pbad_typeid_ctor, &b, e_name);
932
933 obj_locator = get_obj_locator(&e);
934 if(obj_locator->signature!=1 && sizeof(void*)>sizeof(int))
935 old_signature = TRUE;
936 else
937 old_signature = FALSE;
938
939 /* dynamic_cast to void* */
940 casted = p__RTCastToVoid(&e);
941 ok (casted == (void*)&e, "failed cast to void\n");
942
943 /* dynamic_cast up */
944 ti = p__RTtypeid(&e);
945 bti = p__RTtypeid(&b);
946
947 casted = p__RTDynamicCast(&b, 0, NULL, ti, 0);
948 if (casted)
949 {
950 /* New versions do not allow this conversion due to compiler changes */
951 ok (casted == (void*)&b, "failed cast from bad_typeid to exception\n");
952 }
953
954 /* dynamic_cast down */
955 casted = p__RTDynamicCast(&e, 0, NULL, bti, 0);
956 ok (casted == NULL, "Cast succeeded\n");
957
958 call_func1(pexception_dtor, &e);
959 call_func1(pbad_typeid_dtor, &b);
960
961 memcpy(&simple_class_sig0_rtti, &simple_class_rtti, sizeof(struct rtti_data));
962 simple_class_sig0_rtti.object_locator.signature = 0;
963 simple_class_sig0_rtti.base_descriptor[0].type_descriptor = RTTI_REF_SIG0(simple_class_sig0_rtti, type_info[0], base);
964 simple_class_sig0_rtti.base_array.bases[0] = RTTI_REF_SIG0(simple_class_sig0_rtti, base_descriptor[0], base);
965 simple_class_sig0_rtti.object_hierarchy.base_classes = RTTI_REF_SIG0(simple_class_sig0_rtti, base_array, base);
966 simple_class_sig0_rtti.object_locator.type_descriptor = RTTI_REF_SIG0(simple_class_sig0_rtti, type_info[0], base);
967 simple_class_sig0_rtti.object_locator.type_hierarchy = RTTI_REF_SIG0(simple_class_sig0_rtti, object_hierarchy, base);
968
969 memcpy(&child_class_sig0_rtti, &child_class_rtti, sizeof(struct rtti_data));
970 child_class_sig0_rtti.object_locator.signature = 0;
971 child_class_sig0_rtti.base_descriptor[0].type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[1], base);
972 child_class_sig0_rtti.base_descriptor[1].type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[0], base);
973 child_class_sig0_rtti.base_array.bases[0] = RTTI_REF_SIG0(child_class_sig0_rtti, base_descriptor[0], base);
974 child_class_sig0_rtti.base_array.bases[1] = RTTI_REF_SIG0(child_class_sig0_rtti, base_descriptor[1], base);
975 child_class_sig0_rtti.object_hierarchy.base_classes = RTTI_REF_SIG0(child_class_sig0_rtti, base_array, base);
976 child_class_sig0_rtti.object_locator.type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[1], base);
977 child_class_sig0_rtti.object_locator.type_hierarchy = RTTI_REF_SIG0(child_class_sig0_rtti, object_hierarchy, base);
978
979 ti = p__RTtypeid(&simple_class_sig0);
980 ok (ti && ti->mangled && !strcmp(ti->mangled, "simple_class"),
981 "incorrect rtti data\n");
982
983 casted = p__RTCastToVoid(&simple_class_sig0);
984 ok (casted == (void*)&simple_class_sig0, "failed cast to void\n");
985
986 ti = p__RTtypeid(&child_class_sig0);
987 ok (ti && ti->mangled && !strcmp(ti->mangled, "child_class"),
988 "incorrect rtti data\n");
989
990 casted = p__RTCastToVoid(&child_class_sig0);
991 ok (casted == (void*)&child_class_sig0, "failed cast to void\n");
992
993 casted = p__RTDynamicCast(&child_class_sig0, 0, NULL, simple_class_sig0_rtti.type_info, 0);
994 if(casted)
995 {
996 ok (casted == (char*)&child_class_sig0+8, "failed cast to simple_class (%p %p)\n", casted, &child_class_sig0);
997 }
998
999 casted = p__RTDynamicCast(&child_class_sig0, 0, &child_class_sig0_rtti.type_info[0], &child_class_sig0_rtti.type_info[1], 0);
1000 ok(casted == (char*)&child_class_sig0+4, "failed cast to child class (%p %p)\n", casted, &child_class_sig0);
1001
1002 if(old_signature) {
1003 skip("signature==1 is not supported\n");
1004 return;
1005 }
1006
1007 ti = p__RTtypeid(&simple_class);
1008 ok (ti && ti->mangled && !strcmp(ti->mangled, "simple_class"),
1009 "incorrect rtti data\n");
1010
1011 casted = p__RTCastToVoid(&simple_class);
1012 ok (casted == (void*)&simple_class, "failed cast to void\n");
1013
1014 ti = p__RTtypeid(&child_class);
1015 ok (ti && ti->mangled && !strcmp(ti->mangled, "child_class"),
1016 "incorrect rtti data\n");
1017
1018 casted = p__RTCastToVoid(&child_class);
1019 ok (casted == (void*)&child_class, "failed cast to void\n");
1020
1021 casted = p__RTDynamicCast(&child_class, 0, NULL, simple_class_rtti.type_info, 0);
1022 if(casted)
1023 {
1024 ok (casted == (char*)&child_class+8, "failed cast to simple_class (%p %p)\n", casted, &child_class);
1025 }
1026
1027 casted = p__RTDynamicCast(&child_class, 0, &child_class_rtti.type_info[0], &child_class_rtti.type_info[1], 0);
1028 ok(casted == (char*)&child_class+4, "failed cast to child class (%p %p)\n", casted, &child_class);
1029 }
1030
1031 struct _demangle {
1032 LPCSTR mangled;
1033 LPCSTR result;
1034 BOOL test_in_wine;
1035 };
1036
1037 static void test_demangle_datatype(void)
1038 {
1039 char * name;
1040 struct _demangle demangle[]={
1041 /* { "BlaBla"," ?? ::Bla", FALSE}, */
1042 { "ABVVec4@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
1043 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
1044 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
1045 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
1046 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
1047 { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
1048 /* { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE}, */
1049 };
1050 int i, num_test = (sizeof(demangle)/sizeof(struct _demangle));
1051
1052 for (i = 0; i < num_test; i++)
1053 {
1054 name = p__unDName(0, demangle[i].mangled, 0, pmalloc, pfree, 0x2800);
1055 if (demangle[i].test_in_wine)
1056 ok(name != NULL && !strcmp(name,demangle[i].result), "Got name \"%s\" for %d\n", name, i);
1057 else
1058 todo_wine ok(name != NULL && !strcmp(name,demangle[i].result), "Got name %s for %d\n", name, i);
1059 if(name)
1060 pfree(name);
1061 }
1062 }
1063
1064 /* Compare two strings treating multiple spaces (' ', ascii 0x20) in s2
1065 as single space. Needed for test_demangle as __unDName() returns sometimes
1066 two spaces instead of one in some older native msvcrt dlls. */
1067 static int strcmp_space(const char *s1, const char *s2)
1068 {
1069 const char* s2start = s2;
1070 do {
1071 while (*s1 == *s2 && *s1) {
1072 s1++;
1073 s2++;
1074 }
1075 if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == ' ')
1076 s2++;
1077 else
1078 break;
1079 } while (*s1 && *s2);
1080 return *s1 - *s2;
1081 }
1082
1083 static void test_demangle(void)
1084 {
1085 static struct {const char* in; const char* out; const char *broken; unsigned int flags;} test[] = {
1086 /* 0 */ {"??0bad_alloc@std@@QAE@ABV01@@Z",
1087 "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)",
1088 "public: __thiscall std::bad_alloc::bad_alloc(class bad_alloc::bad_alloc const &)"},
1089 /* 1 */ {"??0bad_alloc@std@@QAE@PBD@Z",
1090 "public: __thiscall std::bad_alloc::bad_alloc(char const *)"},
1091 /* 2 */ {"??0bad_cast@@AAE@PBQBD@Z",
1092 "private: __thiscall bad_cast::bad_cast(char const * const *)"},
1093 /* 3 */ {"??0bad_cast@@QAE@ABQBD@Z",
1094 "public: __thiscall bad_cast::bad_cast(char const * const &)"},
1095 /* 4 */ {"??0bad_cast@@QAE@ABV0@@Z",
1096 "public: __thiscall bad_cast::bad_cast(class bad_cast const &)"},
1097 /* 5 */ {"??0bad_exception@std@@QAE@ABV01@@Z",
1098 "public: __thiscall std::bad_exception::bad_exception(class std::bad_exception const &)",
1099 "public: __thiscall std::bad_exception::bad_exception(class bad_exception::bad_exception const &)"},
1100 /* 6 */ {"??0bad_exception@std@@QAE@PBD@Z",
1101 "public: __thiscall std::bad_exception::bad_exception(char const *)"},
1102 /* 7 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z",
1103 "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(class std::basic_filebuf<char,struct std::char_traits<char> > const &)",
1104 "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(class basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> > const &)"},
1105 /* 8 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z",
1106 "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf *)"},
1107 /* 9 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z",
1108 "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(enum std::_Uninitialized)",
1109 "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(enum basic_filebuf<char,struct std::char_traits<char> >::_Uninitialized)"},
1110 /* 10 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z",
1111 "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(class std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> > const &)",
1112 "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(class basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> > const &)"},
1113 /* 11 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z",
1114 "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(struct _iobuf *)"},
1115 /* 12 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z",
1116 "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(enum std::_Uninitialized)",
1117 "public: __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >(enum basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::_Uninitialized)"},
1118 /* 13 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z",
1119 "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > const &)",
1120 "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1121 /* 14 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z",
1122 "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)",
1123 "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(class basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)"},
1124 /* 15 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z",
1125 "public: __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >(int)"},
1126 /* 16 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z",
1127 "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)",
1128 "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1129 /* 17 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z",
1130 "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,int)",
1131 "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(class basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,int)"},
1132 /* 18 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z",
1133 "public: __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >(int)"},
1134 /* 19 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
1135 "public: __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(class std::_Locinfo const &,unsigned int)",
1136 "public: __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(class num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::_Locinfo const &,unsigned int)"},
1137 /* 20 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z",
1138 "public: __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(unsigned int)"},
1139 /* 21 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
1140 "public: __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(class std::_Locinfo const &,unsigned int)",
1141 "public: __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(class num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::_Locinfo const &,unsigned int)"},
1142 /* 22 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z", "public: __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(unsigned int)"},
1143 /* 23 */ {"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall streambuf::streambuf(class streambuf const &)"},
1144 /* 24 */ {"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall strstreambuf::strstreambuf(class strstreambuf const &)"},
1145 /* 25 */ {"??0strstreambuf@@QAE@H@Z", "public: __thiscall strstreambuf::strstreambuf(int)"},
1146 /* 26 */ {"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"},
1147 /* 27 */ {"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall strstreambuf::strstreambuf(char *,int,char *)"},
1148 /* 28 */ {"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"},
1149 /* 29 */ {"??0strstreambuf@@QAE@XZ", "public: __thiscall strstreambuf::strstreambuf(void)"},
1150 /* 30 */ {"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall std::__non_rtti_object::~__non_rtti_object(void)"},
1151 /* 31 */ {"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall __non_rtti_object::~__non_rtti_object(void)"},
1152 /* 32 */ {"??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::~num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >(void)"},
1153 /* 33 */ {"??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ", "public: virtual __thiscall std::num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >::~num_get<unsigned short,class std::istreambuf_iterator<unsigned short,struct std::char_traits<unsigned short> > >(void)"},
1154 /* 34 */ {"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign const &)"},
1155 /* 35 */ {"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream & __thiscall istream_withassign::operator=(class istream const &)"},
1156 /* 36 */ {"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class istream & __thiscall istream_withassign::operator=(class streambuf *)"},
1157 /* 37 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z", "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,signed char &)"},
1158 /* 38 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z", "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,char &)"},
1159 /* 39 */ {"??5std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z", "class std::basic_istream<char,struct std::char_traits<char> > & __cdecl std::operator>>(class std::basic_istream<char,struct std::char_traits<char> > &,unsigned char &)"},
1160 /* 40 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z", "public: class std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >::operator<<(class std::ios_base & (__cdecl*)(class std::ios_base &))"},
1161 /* 41 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z", "public: class std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >::operator<<(class std::basic_streambuf<unsigned short,struct std::char_traits<unsigned short> > *)"},
1162 /* 42 */ {"??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z", "public: class std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >::operator<<(void const *)"},
1163 /* 43 */ {"??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@", "const std::basic_fstream<char,struct std::char_traits<char> >::`vbtable'{for `std::basic_ostream<char,struct std::char_traits<char> >'}"},
1164 /* 44 */ {"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream<unsigned short,struct std::char_traits<unsigned short> >::`vbtable'{for `std::basic_istream<unsigned short,struct std::char_traits<unsigned short> >'}"},
1165 /* 45 */ {"??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@", "const std::basic_fstream<unsigned short,struct std::char_traits<unsigned short> >::`vbtable'{for `std::basic_ostream<unsigned short,struct std::char_traits<unsigned short> >'}"},
1166 /* 46 */ {"??9std@@YA_NPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z", "bool __cdecl std::operator!=(char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1167 /* 47 */ {"??9std@@YA_NPBGABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z", "bool __cdecl std::operator!=(unsigned short const *,class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1168 /* 48 */ {"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAADI@Z", "public: char & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator[](unsigned int)"},
1169 /* 49 */ {"??A?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDI@Z", "public: char const & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator[](unsigned int)const "},
1170 /* 50 */ {"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEAAGI@Z", "public: unsigned short & __thiscall std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::operator[](unsigned int)"},
1171 /* 51 */ {"??A?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEABGI@Z", "public: unsigned short const & __thiscall std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::operator[](unsigned int)const "},
1172 /* 52 */ {"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class std::complex<float> const &)"},
1173 /* 53 */ {"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class std::complex<double> const &)"},
1174 /* 54 */ {"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class std::complex<long double> const &)"},
1175 /* 55 */ {"?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A", "class std::basic_istream<char,struct std::char_traits<char> > std::cin"},
1176 /* 56 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAG@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,unsigned short &)const "},
1177 /* 57 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAI@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,unsigned int &)const "},
1178 /* 58 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,long &)const "},
1179 /* 59 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAK@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,unsigned long &)const "},
1180 /* 60 */ {"?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAM@Z", "protected: virtual class std::istreambuf_iterator<char,struct std::char_traits<char> > __thiscall std::num_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::do_get(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::ios_base &,int &,float &)const "},
1181 /* 61 */ {"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)"},
1182 /* 62 */ {"?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z", "public: void __thiscall std::ios_base::register_callback(void (__cdecl*)(enum std::ios_base::event,class std::ios_base &,int),int)"},
1183 /* 63 */ {"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream<char,struct std::char_traits<char> > & __thiscall std::basic_istream<char,struct std::char_traits<char> >::seekg(long,enum std::ios_base::seekdir)"},
1184 /* 64 */ {"?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream<char,struct std::char_traits<char> > & __thiscall std::basic_istream<char,struct std::char_traits<char> >::seekg(class std::fpos<int>)"},
1185 /* 65 */ {"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JW4seekdir@ios_base@2@@Z", "public: class std::basic_istream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_istream<unsigned short,struct std::char_traits<unsigned short> >::seekg(long,enum std::ios_base::seekdir)"},
1186 /* 66 */ {"?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z", "public: class std::basic_istream<unsigned short,struct std::char_traits<unsigned short> > & __thiscall std::basic_istream<unsigned short,struct std::char_traits<unsigned short> >::seekg(class std::fpos<int>)"},
1187 /* 67 */ {"?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos<int> __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::seekoff(long,enum std::ios_base::seekdir,int)"},
1188 /* 68 */ {"?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JW4seekdir@ios_base@2@H@Z", "protected: virtual class std::fpos<int> __thiscall std::basic_filebuf<unsigned short,struct std::char_traits<unsigned short> >::seekoff(long,enum std::ios_base::seekdir,int)"},
1189 /* 69 */ {"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void)"},
1190 /* 70 */ {"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_istringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1191 /* 71 */ {"?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_istringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1192 /* 72 */ {"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_istringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1193 /* 73 */ {"?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_istringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1194 /* 74 */ {"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1195 /* 75 */ {"?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1196 /* 76 */ {"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_ostringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1197 /* 77 */ {"?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_ostringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1198 /* 78 */ {"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1199 /* 79 */ {"?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_stringbuf<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1200 /* 80 */ {"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringbuf<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1201 /* 81 */ {"?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_stringbuf<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1202 /* 82 */ {"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z", "public: void __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"},
1203 /* 83 */ {"?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ", "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const "},
1204 /* 84 */ {"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z", "public: void __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &)"},
1205 /* 85 */ {"?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ", "public: class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > __thiscall std::basic_stringstream<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >::str(void)const "},
1206 /* 86 */ {"?_Sync@ios_base@std@@0_NA", "private: static bool std::ios_base::_Sync"},
1207 /* 87 */ {"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"},
1208 /* 88 */ {"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"},
1209 /* 89 */ {"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class std::_Complex_base<float> & __thiscall std::_Complex_base<float>::operator*=(float const &)"},
1210 /* 90 */ {"??Xstd@@YAAAV?$complex@M@0@AAV10@ABV10@@Z", "class std::complex<float> & __cdecl std::operator*=(class std::complex<float> &,class std::complex<float> const &)"},
1211 /* 91 */ {"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"},
1212 /* 92 */ {"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb & volatile)"},
1213 /* 93 */ {"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"},
1214 /* 94 */ {"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"},
1215 /* 95 */ {"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"},
1216 /* 96 */ {"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const volatile)"},
1217 /* 97 */ {"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"},
1218 /* 98 */ {"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"},
1219 /* 99 */ {"??2?$aaa@AAUbbb@@AAUccc@@AAU2@@ddd@1eee@2@QAEHXZ", "public: int __thiscall eee::eee::ddd::ddd::aaa<struct bbb &,struct ccc &,struct ccc &>::operator new(void)"},
1220 /* 100 */ {"?pSW@@3P6GHKPAX0PAU_tagSTACKFRAME@@0P6GH0K0KPAK@ZP6GPAX0K@ZP6GK0K@ZP6GK00PAU_tagADDRESS@@@Z@ZA", "int (__stdcall* pSW)(unsigned long,void *,void *,struct _tagSTACKFRAME *,void *,int (__stdcall*)(void *,unsigned long,void *,unsigned long,unsigned long *),void * (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,unsigned long),unsigned long (__stdcall*)(void *,void *,struct _tagADDRESS *))"},
1221 /* 101 */ {"?$_aaa@Vbbb@@", "_aaa<class bbb>"},
1222 /* 102 */ {"?$aaa@Vbbb@ccc@@Vddd@2@", "aaa<class ccc::bbb,class ccc::ddd>"},
1223 /* 103 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "public: __thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)"},
1224 /* 104 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "__thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)", NULL, 0x880},
1225 /* 105 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "private: static int (__cdecl** Bar::Qux)(class Bar *,int &,int &,int *)" },
1226 /* 106 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "Bar::Qux", NULL, 0x1800},
1227 /* 107 */ {"?$AAA@$DBAB@", "AAA<`template-parameter257'>"},
1228 /* 108 */ {"?$AAA@?C@", "AAA<`template-parameter-2'>"},
1229 /* 109 */ {"?$AAA@PAUBBB@@", "AAA<struct BBB *>"},
1230 /* 110 */ {"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z",
1231 "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa * *,class ee *)",
1232 "??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z"},
1233 /* 111 */ {"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
1234 /* 112 */ {"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
1235 /* 113 */ {"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
1236 /* 114 */ {"??0?$Foo@U?$vector_c@H$00$01$0?1$0A@$0A@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@@mpl@boost@@@@QAE@XZ",
1237 "public: __thiscall Foo<struct boost::mpl::vector_c<int,1,2,-2,0,0,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647> >::Foo<struct boost::mpl::vector_c<int,1,2,-2,0,0,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647> >(void)"},
1238 /* 115 */ {"?swprintf@@YAHPAGIPBGZZ", "int __cdecl swprintf(unsigned short *,unsigned int,unsigned short const *,...)"},
1239 /* 116 */ {"?vswprintf@@YAHPAGIPBGPAD@Z", "int __cdecl vswprintf(unsigned short *,unsigned int,unsigned short const *,char *)"},
1240 /* 117 */ {"?vswprintf@@YAHPA_WIPB_WPAD@Z", "int __cdecl vswprintf(wchar_t *,unsigned int,wchar_t const *,char *)"},
1241 /* 118 */ {"?swprintf@@YAHPA_WIPB_WZZ", "int __cdecl swprintf(wchar_t *,unsigned int,wchar_t const *,...)"},
1242 /* 119 */ {"??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z", "class std::complex<float> & __ptr64 __cdecl std::operator*=(class std::complex<float> & __ptr64,class std::complex<float> const & __ptr64)"},
1243 /* 120 */ {"?_Doraise@bad_cast@std@@MEBAXXZ", "protected: virtual void __cdecl std::bad_cast::_Doraise(void)const __ptr64"},
1244 /* 121 */ {"??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z",
1245 "class std::complex<float> __cdecl std::operator*<float>(float const &,class std::complex<float> const &)",
1246 "??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z"},
1247 /* 122 */ {"?_R2@?BN@???$_Fabs@N@std@@YANAEBV?$complex@N@1@PEAH@Z@4NB",
1248 "double const `double __cdecl std::_Fabs<double>(class std::complex<double> const & __ptr64,int * __ptr64)'::`29'::_R2",
1249 "?_R2@?BN@???$_Fabs@N@std@@YANAEBV?$complex@N@1@PEAH@Z@4NB"},
1250
1251 };
1252 int i, num_test = (sizeof(test)/sizeof(test[0]));
1253 char* name;
1254
1255 for (i = 0; i < num_test; i++)
1256 {
1257 name = p__unDName(0, test[i].in, 0, pmalloc, pfree, test[i].flags);
1258 ok(name != NULL, "%u: unDName failed\n", i);
1259 if (!name) continue;
1260 ok( !strcmp_space(test[i].out, name) ||
1261 broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1262 "%u: Got name \"%s\"\n", i, name );
1263 ok( !strcmp_space(test[i].out, name) ||
1264 broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1265 "%u: Expected \"%s\"\n", i, test[i].out );
1266 pfree(name);
1267 }
1268 }
1269
1270 START_TEST(cpp)
1271 {
1272 if (!InitFunctionPtrs())
1273 return;
1274
1275 test_exception();
1276 test_bad_typeid();
1277 test_bad_cast();
1278 test___non_rtti_object();
1279 test_type_info();
1280 test_rtti();
1281 test_demangle_datatype();
1282 test_demangle();
1283 }