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 
init_thiscall_thunk(void)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 
InitFunctionPtrs(void)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 #ifdef __arm__
242         SETNOFAIL(poperator_new, "??_U@YAPAXI@Z");
243         SETNOFAIL(poperator_delete, "??_V@YAXPAX@Z");
244 
245         SET(pexception_ctor, "??0exception@std@@QAA@ABQBD@Z");
246         SET(pexception_copy_ctor, "??0exception@std@@QAA@ABV01@@Z");
247         SET(pexception_default_ctor, "??0exception@std@@QAA@XZ");
248         SET(pexception_dtor, "??1exception@std@@UAA@XZ");
249         SET(pexception_opequals, "??4exception@std@@QAAAAV01@ABV01@@Z");
250         SET(pexception_what, "?what@exception@std@@UBAPBDXZ");
251         SET(pexception_vector_dtor, "??_Eexception@@UAEPAXI@Z");/**/
252         SET(pexception_scalar_dtor, "??_Gexception@@UAEPAXI@Z");/**/
253 
254         SET(pbad_typeid_ctor, "??0bad_typeid@std@@QAA@PBD@Z");
255         SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@std@@QAAXXZ");
256         SET(pbad_typeid_copy_ctor, "??0bad_typeid@std@@QAA@ABV01@@Z");
257         SET(pbad_typeid_dtor, "??1bad_typeid@std@@UAA@XZ");
258         SET(pbad_typeid_opequals, "??4bad_typeid@std@@QAAAAV01@ABV01@@Z");
259         SET(pbad_typeid_what, "?what@exception@std@@UBAPBDXZ");
260         SET(pbad_typeid_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
261         SET(pbad_typeid_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
262 
263         SETNOFAIL(pbad_cast_ctor, "??0bad_cast@@QAE@ABQBD@Z");
264         if (!pbad_cast_ctor)
265             SET(pbad_cast_ctor, "??0bad_cast@std@@AAA@PBQBD@Z");
266         SETNOFAIL(pbad_cast_ctor2, "??0bad_cast@std@@QAA@PBD@Z");
267         SETNOFAIL(pbad_cast_ctor_closure, "??_Fbad_cast@std@@QAAXXZ");
268         /* FIXME: No ARM equivalent for "??0bad_cast@@QAE@ABV0@@Z" */
269         SET(pbad_cast_dtor, "??1bad_cast@std@@UAA@XZ");
270         SET(pbad_cast_opequals, "??4bad_cast@std@@QAAAAV01@ABV01@@Z");
271         SET(pbad_cast_what, "?what@exception@std@@UBAPBDXZ");
272         SET(pbad_cast_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
273         SET(pbad_cast_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
274 
275         SET(p__non_rtti_object_ctor, "??0__non_rtti_object@std@@QAA@PBD@Z");
276         SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@std@@QAA@ABV01@@Z");
277         SET(p__non_rtti_object_dtor, "??1__non_rtti_object@std@@UAA@XZ");
278         SET(p__non_rtti_object_opequals, "??4__non_rtti_object@std@@QAAAAV01@ABV01@@Z");
279         SET(p__non_rtti_object_what, "?what@exception@std@@UBAPBDXZ");
280         SET(p__non_rtti_object_vector_dtor, "??_E__non_rtti_object@@UAEPAXI@Z");
281         SET(p__non_rtti_object_scalar_dtor, "??_G__non_rtti_object@@UAEPAXI@Z");
282 
283         SET(ptype_info_dtor, "??1type_info@@UAA@XZ");
284         SET(ptype_info_raw_name, "?raw_name@type_info@@QBAPBDXZ");
285         SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
286         SET(ptype_info_before, "?before@type_info@@QBA_NABV1@@Z");
287         SET(ptype_info_opequals_equals, "??8type_info@@QBA_NABV0@@Z");
288         SET(ptype_info_opnot_equals, "??9type_info@@QBA_NABV0@@Z");
289 #else
290         SETNOFAIL(poperator_new, "??_U@YAPAXI@Z");
291         SETNOFAIL(poperator_delete, "??_V@YAXPAX@Z");
292 
293         SET(pexception_ctor, "??0exception@@QAE@ABQBD@Z");
294         SET(pexception_copy_ctor, "??0exception@@QAE@ABV0@@Z");
295         SET(pexception_default_ctor, "??0exception@@QAE@XZ");
296         SET(pexception_dtor, "??1exception@@UAE@XZ");
297         SET(pexception_opequals, "??4exception@@QAEAAV0@ABV0@@Z");
298         SET(pexception_what, "?what@exception@@UBEPBDXZ");
299         SET(pexception_vector_dtor, "??_Eexception@@UAEPAXI@Z");
300         SET(pexception_scalar_dtor, "??_Gexception@@UAEPAXI@Z");
301 
302         SET(pbad_typeid_ctor, "??0bad_typeid@@QAE@PBD@Z");
303         SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@@QAEXXZ");
304         SET(pbad_typeid_copy_ctor, "??0bad_typeid@@QAE@ABV0@@Z");
305         SET(pbad_typeid_dtor, "??1bad_typeid@@UAE@XZ");
306         SET(pbad_typeid_opequals, "??4bad_typeid@@QAEAAV0@ABV0@@Z");
307         SET(pbad_typeid_what, "?what@exception@@UBEPBDXZ");
308         SET(pbad_typeid_vector_dtor, "??_Ebad_typeid@@UAEPAXI@Z");
309         SET(pbad_typeid_scalar_dtor, "??_Gbad_typeid@@UAEPAXI@Z");
310 
311         SETNOFAIL(pbad_cast_ctor, "??0bad_cast@@QAE@ABQBD@Z");
312         if (!pbad_cast_ctor)
313             SET(pbad_cast_ctor, "??0bad_cast@@AAE@PBQBD@Z");
314         SETNOFAIL(pbad_cast_ctor2, "??0bad_cast@@QAE@PBD@Z");
315         SETNOFAIL(pbad_cast_ctor_closure, "??_Fbad_cast@@QAEXXZ");
316         SET(pbad_cast_copy_ctor, "??0bad_cast@@QAE@ABV0@@Z");
317         SET(pbad_cast_dtor, "??1bad_cast@@UAE@XZ");
318         SET(pbad_cast_opequals, "??4bad_cast@@QAEAAV0@ABV0@@Z");
319         SET(pbad_cast_what, "?what@exception@@UBEPBDXZ");
320         SET(pbad_cast_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
321         SET(pbad_cast_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
322 
323         SET(p__non_rtti_object_ctor, "??0__non_rtti_object@@QAE@PBD@Z");
324         SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@@QAE@ABV0@@Z");
325         SET(p__non_rtti_object_dtor, "??1__non_rtti_object@@UAE@XZ");
326         SET(p__non_rtti_object_opequals, "??4__non_rtti_object@@QAEAAV0@ABV0@@Z");
327         SET(p__non_rtti_object_what, "?what@exception@@UBEPBDXZ");
328         SET(p__non_rtti_object_vector_dtor, "??_E__non_rtti_object@@UAEPAXI@Z");
329         SET(p__non_rtti_object_scalar_dtor, "??_G__non_rtti_object@@UAEPAXI@Z");
330 
331         SET(ptype_info_dtor, "??1type_info@@UAE@XZ");
332         SET(ptype_info_raw_name, "?raw_name@type_info@@QBEPBDXZ");
333         SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
334         SET(ptype_info_before, "?before@type_info@@QBEHABV1@@Z");
335         SET(ptype_info_opequals_equals, "??8type_info@@QBEHABV0@@Z");
336         SET(ptype_info_opnot_equals, "??9type_info@@QBEHABV0@@Z");
337 #endif /* __arm__ */
338     }
339 
340     if (!poperator_new)
341         poperator_new = pmalloc;
342     if (!poperator_delete)
343         poperator_delete = pfree;
344 
345     init_thiscall_thunk();
346     return TRUE;
347 }
348 
test_exception(void)349 static void test_exception(void)
350 {
351   static const char* e_name = "An exception name";
352   char* name;
353   exception e, e2, e3, *pe;
354 
355   if (!poperator_new || !poperator_delete ||
356       !pexception_ctor || !pexception_copy_ctor || !pexception_default_ctor ||
357       !pexception_dtor || !pexception_opequals || !pexception_what ||
358       !pexception_vtable || !pexception_vector_dtor || !pexception_scalar_dtor)
359     return;
360 
361   /* 'const char*&' ctor */
362   memset(&e, 0, sizeof(e));
363   call_func2(pexception_ctor, &e, &e_name);
364   ok(e.vtable != NULL, "Null exception vtable for e\n");
365   ok(e.name && e.name != e_name && !strcmp(e.name, "An exception name"), "Bad name '%s' for e\n", e.name);
366   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
367 
368   /* Copy ctor */
369   memset(&e2, 0, sizeof(e2));
370   call_func2(pexception_copy_ctor, &e2, &e);
371   ok(e2.vtable != NULL, "Null exception vtable for e2\n");
372   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
373   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
374 
375   /* Default ctor */
376   memset(&e3, 1, sizeof(e3));
377   call_func1(pexception_default_ctor, &e3);
378   ok(e3.vtable != NULL, "Null exception vtable for e3\n");
379   ok(e3.name == NULL, "Bad exception name for e3\n");
380   ok(e3.do_free == 0, "do_free set to %d for e3\n", e3.do_free);
381 
382   ok(e.vtable == e2.vtable && e.vtable == e3.vtable, "exception vtables differ!\n");
383 
384   /* Test calling the dtors */
385   call_func1(pexception_dtor, &e2);
386   call_func1(pexception_dtor, &e3);
387 
388   /* Operator equals */
389   memset(&e2, 0, sizeof(e2));
390   call_func1(pexception_default_ctor, &e2);
391   pe = call_func2(pexception_opequals, &e2, &e);
392   ok(e2.vtable != NULL, "Null exception vtable for e2\n");
393   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
394   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
395   ok(pe == &e2, "opequals didn't return e2\n");
396 
397   /* what() */
398   name = call_func1(pexception_what, &e2);
399   ok(e2.name == name, "Bad exception name from e2::what()\n");
400 
401   /* vtable ptr */
402   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
403   call_func1(pexception_dtor, &e2);
404 
405   /* new() */
406   pe = poperator_new(sizeof(exception));
407   ok(pe != NULL, "new() failed\n");
408   if (pe)
409   {
410     call_func2(pexception_ctor, pe, &e_name);
411     /* scalar dtor */
412     call_func2(pexception_scalar_dtor, pe, 0); /* Shouldn't delete pe */
413     pe->name = NULL;
414     pe->do_free = 0;
415     call_func2(pexception_scalar_dtor, pe, 1); /* Should delete pe */
416   }
417 
418   pe = poperator_new(sizeof(exception));
419   ok(pe != NULL, "new() failed\n");
420   if (pe)
421   {
422     /* vector dtor, single element */
423     call_func2(pexception_ctor, pe, &e_name);
424     call_func2(pexception_vector_dtor, pe, 1); /* Should delete pe as single element*/
425   }
426 
427   pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
428   ok(pe != NULL, "new() failed\n");
429   if (pe)
430   {
431     /* vector dtor, multiple elements */
432     char name[] = "a constant";
433     *((size_t*)pe) = 3;
434     pe = (exception*)((size_t*)pe + 1);
435     call_func2(pexception_ctor, &pe[0], &e_name);
436     call_func2(pexception_ctor, &pe[1], &e_name);
437     call_func2(pexception_ctor, &pe[2], &e_name);
438     pe[3].name = name;
439     pe[3].do_free = 1; /* Crash if we try to free this */
440     call_func2(pexception_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
441   }
442 
443   /* test our exported vtable is kosher */
444   pe = (void*)pexception_vtable; /* Use the exception struct to get vtable ptrs */
445   pexception_vector_dtor = (void*)pe->vtable;
446   pexception_what = (void*)pe->name;
447 
448   name = call_func1(pexception_what, &e);
449   ok(e.name == name, "Bad exception name from vtable e::what()\n");
450 
451   if (p__RTtypeid && !bAncientVersion)
452   {
453     /* Check the rtti */
454     type_info *ti = p__RTtypeid(&e);
455     ok (ti && !strcmp(ti->mangled, ".?AVexception@@"), "bad rtti for e\n");
456 
457     if (ti)
458     {
459       /* Check the returned type_info has rtti too */
460       type_info *ti2 = p__RTtypeid(ti);
461       ok (ti2 != NULL && !strcmp(ti2->mangled, ".?AVtype_info@@"), "bad rtti for e's type_info\n");
462     }
463   }
464 
465   call_func2(pexception_vector_dtor, &e, 0); /* Should delete e.name, but not e */
466 }
467 
468 /* This test is basically a cut 'n' paste of the exception test. but it verifies that
469  * bad_typeid works the exact same way... */
test_bad_typeid(void)470 static void test_bad_typeid(void)
471 {
472   static const char* e_name = "A bad_typeid name";
473   char* name;
474   exception e, e2, e3, *pe;
475 
476   if (!poperator_new || !poperator_delete ||
477       !pbad_typeid_ctor || !pbad_typeid_copy_ctor ||
478       !pbad_typeid_dtor || !pbad_typeid_opequals || !pbad_typeid_what ||
479       !pbad_typeid_vtable || !pbad_typeid_vector_dtor || !pbad_typeid_scalar_dtor)
480     return;
481 
482   /* 'const char*' ctor */
483   memset(&e, 0, sizeof(e));
484   call_func2(pbad_typeid_ctor, &e, e_name);
485   ok(e.vtable != NULL, "Null bad_typeid vtable for e\n");
486   ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_typeid name"), "Bad name '%s' for e\n", e.name);
487   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
488 
489   /* Copy ctor */
490   memset(&e2, 0, sizeof(e2));
491   call_func2(pbad_typeid_copy_ctor, &e2, &e);
492   ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
493   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad name '%s' for e2\n", e2.name);
494   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
495 
496   /* Ctor closure */
497   if (pbad_typeid_ctor_closure)
498   {
499     memset(&e3, 1, sizeof(e3));
500     call_func1(pbad_typeid_ctor_closure, &e3);
501     ok(e3.vtable != NULL, "Null bad_typeid vtable for e3\n");
502     ok(e3.name && !strcmp(e3.name, "bad typeid"), "Bad bad_typeid name for e3\n");
503     ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
504     ok(e.vtable == e3.vtable, "bad_typeid closure vtables differ!\n");
505     call_func1(pbad_typeid_dtor, &e3);
506   }
507   ok(e.vtable == e2.vtable, "bad_typeid vtables differ!\n");
508 
509   /* Test calling the dtors */
510   call_func1(pbad_typeid_dtor, &e2);
511 
512   /* Operator equals */
513   memset(&e2, 1, sizeof(e2));
514   call_func1(pexception_default_ctor, &e2);
515   pe = call_func2(pbad_typeid_opequals, &e2, &e);
516   ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
517   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad bad_typeid name for e2\n");
518   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
519   ok(pe == &e2, "opequals didn't return e2\n");
520 
521   /* what() */
522   name = call_func1(pbad_typeid_what, &e2);
523   ok(e2.name == name, "Bad bad_typeid name from e2::what()\n");
524 
525   /* vtable ptr */
526   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
527   call_func1(pbad_typeid_dtor, &e2);
528 
529   /* new() */
530   pe = poperator_new(sizeof(exception));
531   ok(pe != NULL, "new() failed\n");
532   if (pe)
533   {
534     call_func2(pbad_typeid_ctor, pe, e_name);
535     /* scalar dtor */
536     call_func2(pbad_typeid_scalar_dtor, pe, 0); /* Shouldn't delete pe */
537     pe->name = NULL;
538     pe->do_free = 0;
539     call_func2(pbad_typeid_scalar_dtor, pe, 1); /* Should delete pe */
540   }
541 
542   pe = poperator_new(sizeof(exception));
543   ok(pe != NULL, "new() failed\n");
544   if (pe)
545   {
546     /* vector dtor, single element */
547     call_func2(pbad_typeid_ctor, pe, e_name);
548     call_func2(pbad_typeid_vector_dtor, pe, 1); /* Should delete pe as single element*/
549   }
550 
551   pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
552   ok(pe != NULL, "new() failed\n");
553   if (pe)
554   {
555     /* vector dtor, multiple elements */
556     *((size_t*)pe) = 3;
557     pe = (exception*)((size_t*)pe + 1);
558     call_func2(pbad_typeid_ctor, &pe[0], e_name);
559     call_func2(pbad_typeid_ctor, &pe[1], e_name);
560     call_func2(pbad_typeid_ctor, &pe[2], e_name);
561     pe[3].name = 0;
562     pe[3].do_free = 1; /* Crash if we try to free this element */
563     call_func2(pbad_typeid_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
564   }
565 
566   /* test our exported vtable is kosher */
567   pe = (void*)pbad_typeid_vtable; /* Use the exception struct to get vtable ptrs */
568   pbad_typeid_vector_dtor = (void*)pe->vtable;
569   pbad_typeid_what = (void*)pe->name;
570 
571   name = call_func1(pbad_typeid_what, &e);
572   ok(e.name == name, "Bad bad_typeid name from vtable e::what()\n");
573 
574   if (p__RTtypeid && !bAncientVersion)
575   {
576     /* Check the rtti */
577     type_info *ti = p__RTtypeid(&e);
578     ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_typeid@@"), "bad rtti for e (%s)\n",
579         !ti ? "null" : ti->mangled);
580   }
581 
582   call_func2(pbad_typeid_vector_dtor, &e, 0); /* Should delete e.name, but not e */
583 }
584 
585 
586 /* Ditto for this test... */
test_bad_cast(void)587 static void test_bad_cast(void)
588 {
589   static const char* e_name = "A bad_cast name";
590   char* name;
591   exception e, e2, e3, *pe;
592 
593   if (!poperator_new || !poperator_delete ||
594       !pbad_cast_ctor || !pbad_cast_copy_ctor ||
595       !pbad_cast_dtor || !pbad_cast_opequals || !pbad_cast_what ||
596       !pbad_cast_vtable || !pbad_cast_vector_dtor || !pbad_cast_scalar_dtor)
597     return;
598 
599   if (pbad_cast_ctor2)
600   {
601     /* 'const char*' ctor */
602     memset(&e, 0, sizeof(e));
603     call_func2(pbad_cast_ctor2, &e, e_name);
604     ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
605     ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
606     ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
607     call_func1(pbad_cast_dtor, &e);
608   }
609 
610   /* 'const char*&' ctor */
611   memset(&e, 0, sizeof(e));
612   call_func2(pbad_cast_ctor, &e, &e_name);
613   ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
614   ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
615   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
616 
617   /* Copy ctor */
618   memset(&e2, 0, sizeof(e2));
619   call_func2(pbad_cast_copy_ctor, &e2, &e);
620   ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
621   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad name '%s' for e2\n", e2.name);
622   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
623 
624   /* Ctor closure */
625   if (pbad_cast_ctor_closure)
626   {
627     memset(&e3, 1, sizeof(e3));
628     call_func1(pbad_cast_ctor_closure, &e3);
629     ok(e3.vtable != NULL, "Null bad_cast vtable for e3\n");
630     ok(e3.name && !strcmp(e3.name, "bad cast"), "Bad bad_cast name for e3\n");
631     ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
632     ok(e.vtable == e3.vtable, "bad_cast closure vtables differ!\n");
633     call_func1(pbad_cast_dtor, &e3);
634   }
635   ok(e.vtable == e2.vtable, "bad_cast vtables differ!\n");
636 
637   /* Test calling the dtors */
638   call_func1(pbad_cast_dtor, &e2);
639 
640   /* Operator equals */
641   memset(&e2, 1, sizeof(e2));
642   call_func1(pexception_default_ctor, &e2);
643   pe = call_func2(pbad_cast_opequals, &e2, &e);
644   ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
645   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad bad_cast name for e2\n");
646   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
647   ok(pe == &e2, "opequals didn't return e2\n");
648 
649   /* what() */
650   name = call_func1(pbad_cast_what, &e2);
651   ok(e2.name == name, "Bad bad_cast name from e2::what()\n");
652 
653   /* vtable ptr */
654   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
655   call_func1(pbad_cast_dtor, &e2);
656 
657   /* new() */
658   pe = poperator_new(sizeof(exception));
659   ok(pe != NULL, "new() failed\n");
660   if (pe)
661   {
662     call_func2(pbad_cast_ctor, pe, &e_name);
663     /* scalar dtor */
664     call_func2(pbad_cast_scalar_dtor, pe, 0); /* Shouldn't delete pe */
665     pe->name = NULL;
666     pe->do_free = 0;
667     call_func2(pbad_cast_scalar_dtor, pe, 1); /* Should delete pe */
668   }
669 
670   pe = poperator_new(sizeof(exception));
671   ok(pe != NULL, "new() failed\n");
672   if (pe)
673   {
674     /* vector dtor, single element */
675     call_func2(pbad_cast_ctor, pe, &e_name);
676     call_func2(pbad_cast_vector_dtor, pe, 1); /* Should delete pe as single element*/
677   }
678 
679   pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
680   ok(pe != NULL, "new() failed\n");
681   if (pe)
682   {
683     /* vector dtor, multiple elements */
684     *((size_t*)pe) = 3;
685     pe = (exception*)((size_t*)pe + 1);
686     call_func2(pbad_cast_ctor, &pe[0], &e_name);
687     call_func2(pbad_cast_ctor, &pe[1], &e_name);
688     call_func2(pbad_cast_ctor, &pe[2], &e_name);
689     pe[3].name = 0;
690     pe[3].do_free = 1; /* Crash if we try to free this element */
691     call_func2(pbad_cast_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
692   }
693 
694   /* test our exported vtable is kosher */
695   pe = (void*)pbad_cast_vtable; /* Use the exception struct to get vtable ptrs */
696   pbad_cast_vector_dtor = (void*)pe->vtable;
697   pbad_cast_what = (void*)pe->name;
698 
699   name = call_func1(pbad_cast_what, &e);
700   ok(e.name == name, "Bad bad_cast name from vtable e::what()\n");
701 
702   if (p__RTtypeid && !bAncientVersion)
703   {
704     /* Check the rtti */
705     type_info *ti = p__RTtypeid(&e);
706     ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_cast@@"), "bad rtti for e\n");
707   }
708   call_func2(pbad_cast_vector_dtor, &e, 0); /* Should delete e.name, but not e */
709 }
710 
711 /* ... and this one */
test___non_rtti_object(void)712 static void test___non_rtti_object(void)
713 {
714   static const char* e_name = "A __non_rtti_object name";
715   char* name;
716   exception e, e2, *pe;
717 
718   if (!poperator_new || !poperator_delete ||
719       !p__non_rtti_object_ctor || !p__non_rtti_object_copy_ctor ||
720       !p__non_rtti_object_dtor || !p__non_rtti_object_opequals || !p__non_rtti_object_what ||
721       !p__non_rtti_object_vtable || !p__non_rtti_object_vector_dtor || !p__non_rtti_object_scalar_dtor)
722     return;
723 
724   /* 'const char*' ctor */
725   memset(&e, 0, sizeof(e));
726   call_func2(p__non_rtti_object_ctor, &e, e_name);
727   ok(e.vtable != NULL, "Null __non_rtti_object vtable for e\n");
728   ok(e.name && e.name != e_name && !strcmp(e.name, "A __non_rtti_object name"), "Bad name '%s' for e\n", e.name);
729   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
730 
731   /* Copy ctor */
732   memset(&e2, 0, sizeof(e2));
733   call_func2(p__non_rtti_object_copy_ctor, &e2, &e);
734   ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
735   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad name '%s' for e2\n", e2.name);
736   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
737   ok(e.vtable == e2.vtable, "__non_rtti_object vtables differ!\n");
738 
739   /* Test calling the dtors */
740   call_func1(p__non_rtti_object_dtor, &e2);
741 
742   /* Operator equals */
743   memset(&e2, 1, sizeof(e2));
744   call_func1(pexception_default_ctor, &e2);
745   pe = call_func2(p__non_rtti_object_opequals, &e2, &e);
746   ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
747   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad __non_rtti_object name for e2\n");
748   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
749   ok(pe == &e2, "opequals didn't return e2\n");
750 
751   /* what() */
752   name = call_func1(p__non_rtti_object_what, &e2);
753   ok(e2.name == name, "Bad __non_rtti_object name from e2::what()\n");
754 
755   /* vtable ptr */
756   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
757   call_func1(p__non_rtti_object_dtor, &e2);
758 
759   /* new() */
760   pe = poperator_new(sizeof(exception));
761   ok(pe != NULL, "new() failed\n");
762   if (pe)
763   {
764     call_func2(p__non_rtti_object_ctor, pe, e_name);
765     /* scalar dtor */
766     call_func2(p__non_rtti_object_scalar_dtor, pe, 0); /* Shouldn't delete pe */
767     pe->name = NULL;
768     pe->do_free = 0;
769     call_func2(p__non_rtti_object_scalar_dtor, pe, 1); /* Should delete pe */
770   }
771 
772   pe = poperator_new(sizeof(exception));
773   ok(pe != NULL, "new() failed\n");
774   if (pe)
775   {
776     /* vector dtor, single element */
777     call_func2(p__non_rtti_object_ctor, pe, e_name);
778     call_func2(p__non_rtti_object_vector_dtor, pe, 1); /* Should delete pe as single element*/
779   }
780 
781   pe = poperator_new(sizeof(exception) * 4 + sizeof(size_t));
782   ok(pe != NULL, "new() failed\n");
783   if (pe)
784   {
785     /* vector dtor, multiple elements */
786     *((size_t*)pe) = 3;
787     pe = (exception*)((size_t*)pe + 1);
788     call_func2(p__non_rtti_object_ctor, &pe[0], e_name);
789     call_func2(p__non_rtti_object_ctor, &pe[1], e_name);
790     call_func2(p__non_rtti_object_ctor, &pe[2], e_name);
791     pe[3].name = 0;
792     pe[3].do_free = 1; /* Crash if we try to free this element */
793     call_func2(p__non_rtti_object_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
794   }
795 
796   /* test our exported vtable is kosher */
797   pe = (void*)p__non_rtti_object_vtable; /* Use the exception struct to get vtable ptrs */
798   p__non_rtti_object_vector_dtor = (void*)pe->vtable;
799   p__non_rtti_object_what = (void*)pe->name;
800 
801   name = call_func1(p__non_rtti_object_what, &e);
802   ok(e.name == name, "Bad __non_rtti_object name from vtable e::what()\n");
803 
804   if (p__RTtypeid && !bAncientVersion)
805   {
806     /* Check the rtti */
807     type_info *ti = p__RTtypeid(&e);
808     ok (ti != NULL && !strcmp(ti->mangled, ".?AV__non_rtti_object@@"), "bad rtti for e\n");
809   }
810   call_func2(p__non_rtti_object_vector_dtor, &e, 0); /* Should delete e.name, but not e */
811 }
812 
test_type_info(void)813 static void test_type_info(void)
814 {
815   static type_info t1 = { NULL, NULL,{'.','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
816   static type_info t1_1 = { NULL, NULL,{'?','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
817   static type_info t2 = { NULL, NULL, {'.','?','A','V','t','e','s','t','2','@','@',0,0,0,0,0 } };
818   char* name;
819   int res;
820 
821   if (!pmalloc || !pfree || !ptype_info_dtor || !ptype_info_raw_name ||
822       !ptype_info_name || !ptype_info_before ||
823       !ptype_info_opequals_equals || !ptype_info_opnot_equals)
824     return;
825 
826   /* Test calling the dtors */
827   call_func1(ptype_info_dtor, &t1); /* No effect, since name is NULL */
828   t1.name = pmalloc(64);
829   strcpy(t1.name, "foo");
830   call_func1(ptype_info_dtor, &t1); /* Frees t1.name using 'free' */
831 
832   /* raw_name */
833   t1.name = NULL;
834   name = call_func1(ptype_info_raw_name, &t1);
835 
836   /* FIXME: This fails on native; it shouldn't though - native bug?
837    * ok(name && !strcmp(name, t1.mangled), "bad raw_name '%s' for t1 (expected '%s')\n", name, t1.mangled);
838    */
839   ok(t1.name == NULL, "raw_name() set name for t1\n");
840 
841   /* name */
842   t1.name = NULL;
843   name = call_func1(ptype_info_name, &t1);
844   ok(name && t1.name && !strcmp(name, t1.name), "bad name '%s' for t1\n", name);
845 
846   ok(t1.name && !strcmp(t1.name, "class test1"), "demangled to '%s' for t1\n", t1.name);
847   call_func1(ptype_info_dtor, &t1);
848 
849   /* before */
850   t1.name = NULL;
851   res = (int)call_func2(ptype_info_before, &t1, &t1);
852   ok(res == 0, "expected 0, got %d\n", res);
853   res = (int)call_func2(ptype_info_before, &t2, &t1);
854   ok(res == 0, "expected 0, got %d\n", res);
855   res = (int)call_func2(ptype_info_before, &t1, &t2);
856   ok(res == 1, "expected 1, got %d\n", res);
857   /* Doesn't check first char */
858   res = (int)call_func2(ptype_info_before, &t1, &t1_1);
859   ok(res == 0, "expected 0, got %d\n", res);
860 
861   /* opequals_equals */
862   t1.name = NULL;
863   res = (int)call_func2(ptype_info_opequals_equals, &t1, &t1);
864   ok(res == 1, "expected 1, got %d\n", res);
865   res = (int)call_func2(ptype_info_opequals_equals, &t1, &t2);
866   ok(res == 0, "expected 0, got %d\n", res);
867   res = (int)call_func2(ptype_info_opequals_equals, &t2, &t1);
868   ok(res == 0, "expected 0, got %d\n", res);
869 
870   /* opnot_equals */
871   t1.name = NULL;
872   res = (int)call_func2(ptype_info_opnot_equals, &t1, &t1);
873   ok(res == 0, "expected 0, got %d\n", res);
874   res = (int)call_func2(ptype_info_opnot_equals, &t1, &t2);
875   ok(res == 1, "expected 1, got %d\n", res);
876   res = (int)call_func2(ptype_info_opnot_equals, &t2, &t1);
877   ok(res == 1, "expected 1, got %d\n", res);
878 }
879 
get_vtable(void * obj)880 static inline vtable_ptr *get_vtable( void *obj )
881 {
882     return *(vtable_ptr **)obj;
883 }
884 
get_obj_locator(void * cppobj)885 static inline void/*rtti_object_locator*/ *get_obj_locator( void *cppobj )
886 {
887     const vtable_ptr *vtable = get_vtable( cppobj );
888     return (void *)vtable[-1];
889 }
890 
891 #ifndef __x86_64__
892 #define DEFINE_RTTI_REF(type, name) type *name
893 #define RTTI_REF(instance, name) &instance.name
894 #define RTTI_REF_SIG0(instance, name, base) RTTI_REF(instance, name)
895 #else
896 #define DEFINE_RTTI_REF(type, name) unsigned name
897 #define RTTI_REF(instance, name) FIELD_OFFSET(struct rtti_data, name)
898 #define RTTI_REF_SIG0(instance, name, base) ((char*)&instance.name-base)
899 #endif
900 /* Test RTTI functions */
test_rtti(void)901 static void test_rtti(void)
902 {
903   struct _object_locator
904   {
905       unsigned int signature;
906       int base_class_offset;
907       unsigned int flags;
908       DEFINE_RTTI_REF(type_info, type_descriptor);
909       DEFINE_RTTI_REF(struct _rtti_object_hierarchy, type_hierarchy);
910       DEFINE_RTTI_REF(void, object_locator);
911   } *obj_locator;
912 
913   struct rtti_data
914   {
915     type_info type_info[4];
916 
917     struct _rtti_base_descriptor
918     {
919       DEFINE_RTTI_REF(type_info, type_descriptor);
920       int num_base_classes;
921       struct {
922         int this_offset;
923         int vbase_descr;
924         int vbase_offset;
925       } this_ptr_offsets;
926       unsigned int attributes;
927     } base_descriptor[4];
928 
929     struct _rtti_base_array {
930       DEFINE_RTTI_REF(struct _rtti_base_descriptor, bases[4]);
931     } base_array;
932 
933     struct _rtti_object_hierarchy {
934       unsigned int signature;
935       unsigned int attributes;
936       int array_len;
937       DEFINE_RTTI_REF(struct _rtti_base_array, base_classes);
938     } object_hierarchy;
939 
940     struct _object_locator object_locator;
941   } simple_class_rtti = {
942     { {NULL, NULL, "simple_class"} },
943     { {RTTI_REF(simple_class_rtti, type_info[0]), 0, {0, 0, 0}, 0} },
944     { {RTTI_REF(simple_class_rtti, base_descriptor[0])} },
945     {0, 0, 1, RTTI_REF(simple_class_rtti, base_array)},
946     {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)}
947   }, child_class_rtti = {
948     { {NULL, NULL, "simple_class"}, {NULL, NULL, "child_class"} },
949     { {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} },
950     { {RTTI_REF(child_class_rtti, base_descriptor[0]), RTTI_REF(child_class_rtti, base_descriptor[1])} },
951     {0, 0, 2, RTTI_REF(child_class_rtti, base_array)},
952     {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)}
953   }, virtual_base_class_rtti = {
954     { {NULL, NULL, "simple_class"}, {NULL, NULL, "child_class"} },
955     { {RTTI_REF(virtual_base_class_rtti, type_info[1]), 0, {0x10, sizeof(void*), sizeof(int)}, 0}, {RTTI_REF(virtual_base_class_rtti, type_info[0]), 0, {8, -1, 0}, 0} },
956     { {RTTI_REF(virtual_base_class_rtti, base_descriptor[0]), RTTI_REF(virtual_base_class_rtti, base_descriptor[1])} },
957     {0, 0, 2, RTTI_REF(virtual_base_class_rtti, base_array)},
958     {1, 0, 0, RTTI_REF(virtual_base_class_rtti, type_info[1]), RTTI_REF(virtual_base_class_rtti, object_hierarchy), RTTI_REF(virtual_base_class_rtti, object_locator)}
959   };
960   static struct rtti_data simple_class_sig0_rtti, child_class_sig0_rtti;
961 
962   void *simple_class_vtbl[2] = {&simple_class_rtti.object_locator};
963   void *simple_class = &simple_class_vtbl[1];
964   void *child_class_vtbl[2] = {&child_class_rtti.object_locator};
965   void *child_class = &child_class_vtbl[1];
966   void *simple_class_sig0_vtbl[2] = {&simple_class_sig0_rtti.object_locator};
967   void *simple_class_sig0 = &simple_class_sig0_vtbl[1];
968   void *child_class_sig0_vtbl[2] = {&child_class_sig0_rtti.object_locator};
969   void *child_class_sig0 = &child_class_sig0_vtbl[1];
970   void *virtual_base_class_vtbl[2] = {&virtual_base_class_rtti.object_locator};
971   int virtual_base_class_vbtbl[2] = {0, 0x100};
972   struct {
973       void *virtual_base[2];
974       char data[0x110-sizeof(void*)];
975       void *vbthis;
976   } virtual_base_class = { {&virtual_base_class_vtbl[1], virtual_base_class_vbtbl} };
977 
978   static const char* e_name = "name";
979   type_info *ti,*bti;
980   exception e,b;
981   void *casted;
982   BOOL old_signature;
983 #ifdef __x86_64__
984   char *base = (char*)GetModuleHandleW(NULL);
985 #endif
986 
987   if (bAncientVersion ||
988       !p__RTCastToVoid || !p__RTtypeid || !pexception_ctor || !pbad_typeid_ctor
989       || !p__RTDynamicCast || !pexception_dtor || !pbad_typeid_dtor)
990     return;
991 
992   call_func2(pexception_ctor, &e, &e_name);
993   call_func2(pbad_typeid_ctor, &b, e_name);
994 
995   obj_locator = get_obj_locator(&e);
996   if(obj_locator->signature!=1 && sizeof(void*)>sizeof(int))
997     old_signature = TRUE;
998   else
999     old_signature = FALSE;
1000 
1001   /* dynamic_cast to void* */
1002   casted = p__RTCastToVoid(&e);
1003   ok (casted == (void*)&e, "failed cast to void\n");
1004 
1005   /* dynamic_cast up */
1006   ti = p__RTtypeid(&e);
1007   bti = p__RTtypeid(&b);
1008 
1009   casted = p__RTDynamicCast(&b, 0, NULL, ti, 0);
1010   if (casted)
1011   {
1012     /* New versions do not allow this conversion due to compiler changes */
1013     ok (casted == (void*)&b, "failed cast from bad_typeid to exception\n");
1014   }
1015 
1016   /* dynamic_cast down */
1017   casted = p__RTDynamicCast(&e, 0, NULL, bti, 0);
1018   ok (casted == NULL, "Cast succeeded\n");
1019 
1020   call_func1(pexception_dtor, &e);
1021   call_func1(pbad_typeid_dtor, &b);
1022 
1023   simple_class_sig0_rtti = simple_class_rtti;
1024   simple_class_sig0_rtti.object_locator.signature = 0;
1025   simple_class_sig0_rtti.base_descriptor[0].type_descriptor = RTTI_REF_SIG0(simple_class_sig0_rtti, type_info[0], base);
1026   simple_class_sig0_rtti.base_array.bases[0] = RTTI_REF_SIG0(simple_class_sig0_rtti, base_descriptor[0], base);
1027   simple_class_sig0_rtti.object_hierarchy.base_classes = RTTI_REF_SIG0(simple_class_sig0_rtti, base_array, base);
1028   simple_class_sig0_rtti.object_locator.type_descriptor = RTTI_REF_SIG0(simple_class_sig0_rtti, type_info[0], base);
1029   simple_class_sig0_rtti.object_locator.type_hierarchy = RTTI_REF_SIG0(simple_class_sig0_rtti, object_hierarchy, base);
1030 
1031   child_class_sig0_rtti = child_class_rtti;
1032   child_class_sig0_rtti.object_locator.signature = 0;
1033   child_class_sig0_rtti.base_descriptor[0].type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[1], base);
1034   child_class_sig0_rtti.base_descriptor[1].type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[0], base);
1035   child_class_sig0_rtti.base_array.bases[0] = RTTI_REF_SIG0(child_class_sig0_rtti, base_descriptor[0], base);
1036   child_class_sig0_rtti.base_array.bases[1] = RTTI_REF_SIG0(child_class_sig0_rtti, base_descriptor[1], base);
1037   child_class_sig0_rtti.object_hierarchy.base_classes = RTTI_REF_SIG0(child_class_sig0_rtti, base_array, base);
1038   child_class_sig0_rtti.object_locator.type_descriptor = RTTI_REF_SIG0(child_class_sig0_rtti, type_info[1], base);
1039   child_class_sig0_rtti.object_locator.type_hierarchy = RTTI_REF_SIG0(child_class_sig0_rtti, object_hierarchy, base);
1040 
1041   ti = p__RTtypeid(&simple_class_sig0);
1042   ok (ti && !strcmp(ti->mangled, "simple_class"), "incorrect rtti data\n");
1043 
1044   casted = p__RTCastToVoid(&simple_class_sig0);
1045   ok (casted == (void*)&simple_class_sig0, "failed cast to void\n");
1046 
1047   ti = p__RTtypeid(&child_class_sig0);
1048   ok (ti && !strcmp(ti->mangled, "child_class"), "incorrect rtti data\n");
1049 
1050   casted = p__RTCastToVoid(&child_class_sig0);
1051   ok (casted == (void*)&child_class_sig0, "failed cast to void\n");
1052 
1053   casted = p__RTDynamicCast(&child_class_sig0, 0, NULL, simple_class_sig0_rtti.type_info, 0);
1054   if(casted)
1055   {
1056       ok (casted == (char*)&child_class_sig0+8, "failed cast to simple_class (%p %p)\n", casted, &child_class_sig0);
1057   }
1058 
1059   casted = p__RTDynamicCast(&child_class_sig0, 0, &child_class_sig0_rtti.type_info[0], &child_class_sig0_rtti.type_info[1], 0);
1060   ok(casted == (char*)&child_class_sig0+4, "failed cast to child class (%p %p)\n", casted, &child_class_sig0);
1061 
1062   if(old_signature) {
1063       skip("signature==1 is not supported\n");
1064       return;
1065   }
1066 
1067   ti = p__RTtypeid(&simple_class);
1068   ok (ti && !strcmp(ti->mangled, "simple_class"), "incorrect rtti data\n");
1069 
1070   casted = p__RTCastToVoid(&simple_class);
1071   ok (casted == (void*)&simple_class, "failed cast to void\n");
1072 
1073   ti = p__RTtypeid(&child_class);
1074   ok (ti && !strcmp(ti->mangled, "child_class"), "incorrect rtti data\n");
1075 
1076   casted = p__RTCastToVoid(&child_class);
1077   ok (casted == (void*)&child_class, "failed cast to void\n");
1078 
1079   casted = p__RTDynamicCast(&child_class, 0, NULL, simple_class_rtti.type_info, 0);
1080   if(casted)
1081   {
1082     ok (casted == (char*)&child_class+8, "failed cast to simple_class (%p %p)\n", casted, &child_class);
1083   }
1084 
1085   casted = p__RTDynamicCast(&child_class, 0, &child_class_rtti.type_info[0], &child_class_rtti.type_info[1], 0);
1086   ok(casted == (char*)&child_class+4, "failed cast to child class (%p %p)\n", casted, &child_class);
1087 
1088   casted = p__RTDynamicCast(&virtual_base_class, 0, &virtual_base_class_rtti.type_info[0], &virtual_base_class_rtti.type_info[1], 0);
1089   ok(casted == &virtual_base_class.vbthis, "failed cast to child class (%p %p)\n", casted, &virtual_base_class);
1090 }
1091 
1092 struct _demangle {
1093     LPCSTR mangled;
1094     LPCSTR result;
1095     BOOL test_in_wine;
1096 };
1097 
test_demangle_datatype(void)1098 static void test_demangle_datatype(void)
1099 {
1100     char * name;
1101     struct _demangle demangle[]={
1102 /*	{ "BlaBla"," ?? ::Bla", FALSE}, */
1103 	{ "ABVVec4@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
1104 	{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
1105 	{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
1106 	{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
1107 	{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
1108 	{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
1109 /*	{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE}, */
1110     };
1111     int i, num_test = ARRAY_SIZE(demangle);
1112 
1113     for (i = 0; i < num_test; i++)
1114     {
1115 	name = p__unDName(0, demangle[i].mangled, 0, pmalloc, pfree, 0x2800);
1116         todo_wine_if (!demangle[i].test_in_wine)
1117             ok(name != NULL && !strcmp(name,demangle[i].result), "Got name \"%s\" for %d\n", name, i);
1118         if(name)
1119             pfree(name);
1120     }
1121 }
1122 
1123 /* Compare two strings treating multiple spaces (' ', ascii 0x20) in s2
1124    as single space. Needed for test_demangle as __unDName() returns sometimes
1125    two spaces instead of one in some older native msvcrt dlls. */
strcmp_space(const char * s1,const char * s2)1126 static int strcmp_space(const char *s1, const char *s2)
1127 {
1128     const char* s2start = s2;
1129     do {
1130         while (*s1 == *s2 && *s1) {
1131             s1++;
1132             s2++;
1133         }
1134         if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == ' ')
1135             s2++;
1136         else
1137             break;
1138     } while (*s1 && *s2);
1139     return *s1 - *s2;
1140 }
1141 
test_demangle(void)1142 static void test_demangle(void)
1143 {
1144     static struct {const char* in; const char* out; const char *broken; unsigned int flags;} test[] = {
1145 /* 0 */ {"??0bad_alloc@std@@QAE@ABV01@@Z",
1146          "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)",
1147          "public: __thiscall std::bad_alloc::bad_alloc(class bad_alloc::bad_alloc const &)"},
1148 /* 1 */ {"??0bad_alloc@std@@QAE@PBD@Z",
1149          "public: __thiscall std::bad_alloc::bad_alloc(char const *)"},
1150 /* 2 */ {"??0bad_cast@@AAE@PBQBD@Z",
1151          "private: __thiscall bad_cast::bad_cast(char const * const *)"},
1152 /* 3 */ {"??0bad_cast@@QAE@ABQBD@Z",
1153          "public: __thiscall bad_cast::bad_cast(char const * const &)"},
1154 /* 4 */ {"??0bad_cast@@QAE@ABV0@@Z",
1155          "public: __thiscall bad_cast::bad_cast(class bad_cast const &)"},
1156 /* 5 */ {"??0bad_exception@std@@QAE@ABV01@@Z",
1157          "public: __thiscall std::bad_exception::bad_exception(class std::bad_exception const &)",
1158          "public: __thiscall std::bad_exception::bad_exception(class bad_exception::bad_exception const &)"},
1159 /* 6 */ {"??0bad_exception@std@@QAE@PBD@Z",
1160          "public: __thiscall std::bad_exception::bad_exception(char const *)"},
1161 /* 7 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z",
1162          "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 &)",
1163          "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 &)"},
1164 /* 8 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z",
1165          "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf *)"},
1166 /* 9 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z",
1167          "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(enum std::_Uninitialized)",
1168          "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)"},
1169 /* 10 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z",
1170           "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 &)",
1171           "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 &)"},
1172 /* 11 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z",
1173           "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 *)"},
1174 /* 12 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z",
1175           "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)",
1176           "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)"},
1177 /* 13 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z",
1178           "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 &)",
1179           "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 &)"},
1180 /* 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",
1181           "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)",
1182           "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)"},
1183 /* 15 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z",
1184           "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)"},
1185 /* 16 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z",
1186           "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 &)",
1187           "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 &)"},
1188 /* 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",
1189           "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)",
1190           "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)"},
1191 /* 18 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z",
1192           "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)"},
1193 /* 19 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
1194           "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)",
1195           "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)"},
1196 /* 20 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z",
1197           "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)"},
1198 /* 21 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
1199           "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)",
1200           "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)"},
1201 /* 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)"},
1202 /* 23 */ {"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall streambuf::streambuf(class streambuf const &)"},
1203 /* 24 */ {"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall strstreambuf::strstreambuf(class strstreambuf const &)"},
1204 /* 25 */ {"??0strstreambuf@@QAE@H@Z", "public: __thiscall strstreambuf::strstreambuf(int)"},
1205 /* 26 */ {"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"},
1206 /* 27 */ {"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall strstreambuf::strstreambuf(char *,int,char *)"},
1207 /* 28 */ {"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"},
1208 /* 29 */ {"??0strstreambuf@@QAE@XZ", "public: __thiscall strstreambuf::strstreambuf(void)"},
1209 /* 30 */ {"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall std::__non_rtti_object::~__non_rtti_object(void)"},
1210 /* 31 */ {"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall __non_rtti_object::~__non_rtti_object(void)"},
1211 /* 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)"},
1212 /* 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)"},
1213 /* 34 */ {"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign const &)"},
1214 /* 35 */ {"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream & __thiscall istream_withassign::operator=(class istream const &)"},
1215 /* 36 */ {"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class istream & __thiscall istream_withassign::operator=(class streambuf *)"},
1216 /* 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 &)"},
1217 /* 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 &)"},
1218 /* 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 &)"},
1219 /* 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 &))"},
1220 /* 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> > *)"},
1221 /* 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 *)"},
1222 /* 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> >'}"},
1223 /* 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> >'}"},
1224 /* 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> >'}"},
1225 /* 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 &)"},
1226 /* 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 &)"},
1227 /* 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)"},
1228 /* 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 "},
1229 /* 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)"},
1230 /* 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 "},
1231 /* 52 */ {"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class std::complex<float> const &)"},
1232 /* 53 */ {"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class std::complex<double> const &)"},
1233 /* 54 */ {"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class std::complex<long double> const &)"},
1234 /* 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"},
1235 /* 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 "},
1236 /* 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 "},
1237 /* 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 "},
1238 /* 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 "},
1239 /* 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 "},
1240 /* 61 */ {"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)"},
1241 /* 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)"},
1242 /* 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)"},
1243 /* 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>)"},
1244 /* 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)"},
1245 /* 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>)"},
1246 /* 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)"},
1247 /* 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)"},
1248 /* 69 */ {"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void)"},
1249 /* 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 &)"},
1250 /* 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 "},
1251 /* 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 &)"},
1252 /* 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 "},
1253 /* 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 &)"},
1254 /* 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 "},
1255 /* 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 &)"},
1256 /* 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 "},
1257 /* 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 &)"},
1258 /* 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 "},
1259 /* 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 &)"},
1260 /* 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 "},
1261 /* 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 &)"},
1262 /* 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 "},
1263 /* 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 &)"},
1264 /* 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 "},
1265 /* 86 */ {"?_Sync@ios_base@std@@0_NA", "private: static bool std::ios_base::_Sync"},
1266 /* 87 */ {"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"},
1267 /* 88 */ {"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"},
1268 /* 89 */ {"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class std::_Complex_base<float> & __thiscall std::_Complex_base<float>::operator*=(float const &)"},
1269 /* 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 &)"},
1270 /* 91 */ {"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"},
1271 /* 92 */ {"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb & volatile)"},
1272 /* 93 */ {"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"},
1273 /* 94 */ {"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"},
1274 /* 95 */ {"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"},
1275 /* 96 */ {"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const volatile)"},
1276 /* 97 */ {"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"},
1277 /* 98 */ {"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"},
1278 /* 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)"},
1279 /* 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 *))"},
1280 /* 101 */ {"?$_aaa@Vbbb@@", "_aaa<class bbb>"},
1281 /* 102 */ {"?$aaa@Vbbb@ccc@@Vddd@2@", "aaa<class ccc::bbb,class ccc::ddd>"},
1282 /* 103 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "public: __thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)"},
1283 /* 104 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "__thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)", NULL, 0x880},
1284 /* 105 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "private: static int (__cdecl** Bar::Qux)(class Bar *,int &,int &,int *)" },
1285 /* 106 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "Bar::Qux", NULL, 0x1800},
1286 /* 107 */ {"?$AAA@$DBAB@", "AAA<`template-parameter257'>"},
1287 /* 108 */ {"?$AAA@?C@", "AAA<`template-parameter-2'>"},
1288 /* 109 */ {"?$AAA@PAUBBB@@", "AAA<struct BBB *>"},
1289 /* 110 */ {"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z",
1290            "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa * *,class ee *)",
1291            "??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z"},
1292 /* 111 */ {"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
1293 /* 112 */ {"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
1294 /* 113 */ {"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
1295 /* 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",
1296            "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)"},
1297 /* 115 */ {"?swprintf@@YAHPAGIPBGZZ", "int __cdecl swprintf(unsigned short *,unsigned int,unsigned short const *,...)"},
1298 /* 116 */ {"?vswprintf@@YAHPAGIPBGPAD@Z", "int __cdecl vswprintf(unsigned short *,unsigned int,unsigned short const *,char *)"},
1299 /* 117 */ {"?vswprintf@@YAHPA_WIPB_WPAD@Z", "int __cdecl vswprintf(wchar_t *,unsigned int,wchar_t const *,char *)"},
1300 /* 118 */ {"?swprintf@@YAHPA_WIPB_WZZ", "int __cdecl swprintf(wchar_t *,unsigned int,wchar_t const *,...)"},
1301 /* 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)"},
1302 /* 120 */ {"?_Doraise@bad_cast@std@@MEBAXXZ", "protected: virtual void __cdecl std::bad_cast::_Doraise(void)const __ptr64"},
1303 /* 121 */ {"??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z",
1304            "class std::complex<float> __cdecl std::operator*<float>(float const &,class std::complex<float> const &)",
1305            "??$?DM@std@@YA?AV?$complex@M@0@ABMABV10@@Z"},
1306 /* 122 */ {"?_R2@?BN@???$_Fabs@N@std@@YANAEBV?$complex@N@1@PEAH@Z@4NB",
1307            "double const `double __cdecl std::_Fabs<double>(class std::complex<double> const & __ptr64,int * __ptr64)'::`29'::_R2",
1308            "?_R2@?BN@???$_Fabs@N@std@@YANAEBV?$complex@N@1@PEAH@Z@4NB"},
1309 /* 123 */ {"?vtordisp_thunk@std@@$4PPPPPPPM@3EAA_NXZ",
1310            "[thunk]:public: virtual bool __cdecl std::vtordisp_thunk`vtordisp{4294967292,4}' (void) __ptr64",
1311            "[thunk]:public: virtual bool __cdecl std::vtordisp_thunk`vtordisp{-4,4}' (void) __ptr64"},
1312 /* 124 */ {"??_9CView@@$BBII@AE",
1313            "[thunk]: __thiscall CView::`vcall'{392,{flat}}' }'",
1314            "[thunk]: __thiscall CView::`vcall'{392,{flat}}' "},
1315 /* 125 */ {"?_dispatch@_impl_Engine@SalomeApp@@$R4CE@BA@PPPPPPPM@7AE_NAAVomniCallHandle@@@Z",
1316            "[thunk]:public: virtual bool __thiscall SalomeApp::_impl_Engine::_dispatch`vtordispex{36,16,4294967292,8}' (class omniCallHandle &)",
1317            "?_dispatch@_impl_Engine@SalomeApp@@$R4CE@BA@PPPPPPPM@7AE_NAAVomniCallHandle@@@Z"},
1318 /* 126 */ {"?_Doraise@bad_cast@std@@MEBAXXZ", "protected: virtual void __cdecl std::bad_cast::_Doraise(void)", NULL, 0x60},
1319 /* 127 */ {"??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)", NULL, 1},
1320 /* 128 */ {"??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z",
1321            "class std::complex<float> & std::operator*=(class std::complex<float> &,class std::complex<float> const &)",
1322            "??Xstd@@YAAEAV?$complex@M@0@AEAV10@AEBV10@@Z", 2},
1323 /* 129 */ {"??$run@XVTask_Render_Preview@@@QtConcurrent@@YA?AV?$QFuture@X@@PEAVTask_Render_Preview@@P82@EAAXXZ@Z",
1324            "class QFuture<void> __cdecl QtConcurrent::run<void,class Task_Render_Preview>(class Task_Render_Preview * __ptr64,void (__cdecl Task_Render_Preview::*)(void) __ptr64)",
1325            "??$run@XVTask_Render_Preview@@@QtConcurrent@@YA?AV?$QFuture@X@@PEAVTask_Render_Preview@@P82@EAAXXZ@Z"},
1326 /* 130 */ {"??_E?$TStrArray@$$BY0BAA@D$0BA@@@UAEPAXI@Z",
1327            "public: virtual void * __thiscall TStrArray<char [256],16>::`vector deleting destructor'(unsigned int)"},
1328     };
1329     int i, num_test = ARRAY_SIZE(test);
1330     char* name;
1331 
1332     for (i = 0; i < num_test; i++)
1333     {
1334 	name = p__unDName(0, test[i].in, 0, pmalloc, pfree, test[i].flags);
1335         ok(name != NULL, "%u: unDName failed\n", i);
1336         if (!name) continue;
1337         ok( !strcmp_space(test[i].out, name) ||
1338             broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1339            "%u: Got name \"%s\"\n", i, name );
1340         ok( !strcmp_space(test[i].out, name) ||
1341             broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1342            "%u: Expected \"%s\"\n", i, test[i].out );
1343         pfree(name);
1344     }
1345 }
1346 
START_TEST(cpp)1347 START_TEST(cpp)
1348 {
1349   if (!InitFunctionPtrs())
1350     return;
1351 
1352   test_exception();
1353   test_bad_typeid();
1354   test_bad_cast();
1355   test___non_rtti_object();
1356   test_type_info();
1357   test_rtti();
1358   test_demangle_datatype();
1359   test_demangle();
1360 }
1361