advapi32: Fix SystemFunction036 prototype to match ntsecapi.h.
[wine] / dlls / msvcrt / tests / 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  * NOTES
20  * This tests is only valid for ix86 platforms, on others it's a no-op.
21  * Some tests cannot be checked with ok(), for example the dtors. We simply
22  * call them to ensure we don't crash ;-)
23  *
24  * If we build this test with VC++ in debug mode, we will fail in _chkstk()
25  * or at program exit malloc() checking if these methods haven't been
26  * implemented correctly (they have).
27  *
28  * Tested with a range of native msvcrt's from v4 -> v7.
29  */
30 #include "wine/test.h"
31 #include "winbase.h"
32 #include "winnt.h"
33
34 #ifndef __i386__
35 /* Skip these tests for non x86 platforms */
36 START_TEST(cpp)
37 {
38 }
39 #else
40
41 typedef struct __exception
42 {
43   void *vtable;
44   char *name;
45   int   do_free;
46 } exception;
47
48 typedef struct __type_info
49 {
50   void *vtable;
51   char *name;
52   char  mangled[16];
53 } type_info;
54
55 /* Function pointers. We need to use these to call these funcs as __thiscall */
56 static HMODULE hMsvcrt;
57
58 static void* (__cdecl *poperator_new)(unsigned int);
59 static void  (__cdecl *poperator_delete)(void*);
60 static void* (__cdecl *pmalloc)(unsigned int);
61 static void  (__cdecl *pfree)(void*);
62
63 /* exception */
64 static void (WINAPI *pexception_ctor)(exception*,LPCSTR*);
65 static void (WINAPI *pexception_copy_ctor)(exception*,exception*);
66 static void (WINAPI *pexception_default_ctor)(exception*);
67 static void (WINAPI *pexception_dtor)(exception*);
68 static exception* (WINAPI *pexception_opequals)(exception*,exception*);
69 static char* (WINAPI *pexception_what)(exception*);
70 static void* (WINAPI *pexception_vtable)(exception*);
71 static void (WINAPI *pexception_vector_dtor)(exception*,unsigned int);
72 static void (WINAPI *pexception_scalar_dtor)(exception*,unsigned int);
73
74 /* bad_typeid */
75 static void (WINAPI *pbad_typeid_ctor)(exception*,LPCSTR);
76 static void (WINAPI *pbad_typeid_ctor_closure)(exception*);
77 static void (WINAPI *pbad_typeid_copy_ctor)(exception*,exception*);
78 static void (WINAPI *pbad_typeid_dtor)(exception*);
79 static exception* (WINAPI *pbad_typeid_opequals)(exception*,exception*);
80 static char* (WINAPI *pbad_typeid_what)(exception*);
81 static void* (WINAPI *pbad_typeid_vtable)(exception*);
82 static void (WINAPI *pbad_typeid_vector_dtor)(exception*,unsigned int);
83 static void (WINAPI *pbad_typeid_scalar_dtor)(exception*,unsigned int);
84
85 /* bad_cast */
86 static void (WINAPI *pbad_cast_ctor)(exception*,LPCSTR*);
87 static void (WINAPI *pbad_cast_ctor2)(exception*,LPCSTR);
88 static void (WINAPI *pbad_cast_ctor_closure)(exception*);
89 static void (WINAPI *pbad_cast_copy_ctor)(exception*,exception*);
90 static void (WINAPI *pbad_cast_dtor)(exception*);
91 static exception* (WINAPI *pbad_cast_opequals)(exception*,exception*);
92 static char* (WINAPI *pbad_cast_what)(exception*);
93 static void* (WINAPI *pbad_cast_vtable)(exception*);
94 static void (WINAPI *pbad_cast_vector_dtor)(exception*,unsigned int);
95 static void (WINAPI *pbad_cast_scalar_dtor)(exception*,unsigned int);
96
97 /* __non_rtti_object */
98 static void (WINAPI *p__non_rtti_object_ctor)(exception*,LPCSTR);
99 static void (WINAPI *p__non_rtti_object_copy_ctor)(exception*,exception*);
100 static void (WINAPI *p__non_rtti_object_dtor)(exception*);
101 static exception* (WINAPI *p__non_rtti_object_opequals)(exception*,exception*);
102 static char* (WINAPI *p__non_rtti_object_what)(exception*);
103 static void* (WINAPI *p__non_rtti_object_vtable)(exception*);
104 static void (WINAPI *p__non_rtti_object_vector_dtor)(exception*,unsigned int);
105 static void (WINAPI *p__non_rtti_object_scalar_dtor)(exception*,unsigned int);
106
107 /* type_info */
108 static void  (WINAPI *ptype_info_dtor)(type_info*);
109 static char* (WINAPI *ptype_info_raw_name)(type_info*);
110 static char* (WINAPI *ptype_info_name)(type_info*);
111 static int   (WINAPI *ptype_info_before)(type_info*,type_info*);
112 static int   (WINAPI *ptype_info_opequals_equals)(type_info*,type_info*);
113 static int   (WINAPI *ptype_info_opnot_equals)(type_info*,type_info*);
114
115 /* RTTI */
116 static type_info* (__cdecl *p__RTtypeid)(void*);
117 static void* (__cdecl *p__RTCastToVoid)(void*);
118 static void* (__cdecl *p__RTDynamicCast)(void*,int,void*,void*,int);
119
120 /*Demangle*/
121 static char* (__cdecl *p__unDName)(char*,const char*,int,void*,void*,unsigned short int);
122
123
124 /* _very_ early native versions have serious RTTI bugs, so we check */
125 static void* bAncientVersion;
126
127 /* Emulate a __thiscall */
128 #ifdef _MSC_VER
129 static inline void* do_call_func1(void *func, void *_this)
130 {
131   volatile void* retval = 0;
132   __asm
133   {
134     push ecx
135     mov ecx, _this
136     call func
137     mov retval, eax
138     pop ecx
139   }
140   return (void*)retval;
141 }
142
143 static inline void* do_call_func2(void *func, void *_this, const void* arg)
144 {
145   volatile void* retval = 0;
146   __asm
147   {
148     push ecx
149     push arg
150     mov ecx, _this
151     call func
152     mov retval, eax
153     pop ecx
154   }
155   return (void*)retval;
156 }
157 #else
158 static void* do_call_func1(void *func, void *_this)
159 {
160   void *ret, *dummy;
161   __asm__ __volatile__ ("call *%2"
162                         : "=a" (ret), "=c" (dummy)
163                         : "g" (func), "1" (_this)
164                         : "edx", "memory" );
165   return ret;
166 }
167 static void* do_call_func2(void *func, void *_this, const void* arg)
168 {
169   void *ret, *dummy;
170   __asm__ __volatile__ ("pushl %3\n\tcall *%2"
171                         : "=a" (ret), "=c" (dummy)
172                         : "r" (func), "r" (arg), "1" (_this)
173                         : "edx", "memory" );
174   return ret;
175 }
176 #endif
177
178 #define call_func1(x,y)   do_call_func1((void*)x,(void*)y)
179 #define call_func2(x,y,z) do_call_func2((void*)x,(void*)y,(const void*)z)
180
181 /* Some exports are only available in later versions */
182 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
183 #define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
184
185 static void InitFunctionPtrs(void)
186 {
187   hMsvcrt = GetModuleHandleA("msvcrt.dll");
188   if (!hMsvcrt)
189     hMsvcrt = GetModuleHandleA("msvcrtd.dll");
190   ok(hMsvcrt != 0, "GetModuleHandleA failed\n");
191   if (hMsvcrt)
192   {
193     SETNOFAIL(poperator_new, "??_U@YAPAXI@Z");
194     SETNOFAIL(poperator_delete, "??_V@YAXPAX@Z");
195     SET(pmalloc, "malloc");
196     SET(pfree, "free");
197
198     if (!poperator_new)
199       poperator_new = pmalloc;
200     if (!poperator_delete)
201       poperator_delete = pfree;
202
203     SET(pexception_ctor, "??0exception@@QAE@ABQBD@Z");
204     SET(pexception_copy_ctor, "??0exception@@QAE@ABV0@@Z");
205     SET(pexception_default_ctor, "??0exception@@QAE@XZ");
206     SET(pexception_dtor, "??1exception@@UAE@XZ");
207     SET(pexception_opequals, "??4exception@@QAEAAV0@ABV0@@Z");
208     SET(pexception_what, "?what@exception@@UBEPBDXZ");
209     SET(pexception_vtable, "??_7exception@@6B@");
210     SET(pexception_vector_dtor, "??_Eexception@@UAEPAXI@Z");
211     SET(pexception_scalar_dtor, "??_Gexception@@UAEPAXI@Z");
212
213     SET(pbad_typeid_ctor, "??0bad_typeid@@QAE@PBD@Z");
214     SETNOFAIL(pbad_typeid_ctor_closure, "??_Fbad_typeid@@QAEXXZ");
215     SET(pbad_typeid_copy_ctor, "??0bad_typeid@@QAE@ABV0@@Z");
216     SET(pbad_typeid_dtor, "??1bad_typeid@@UAE@XZ");
217     SET(pbad_typeid_opequals, "??4bad_typeid@@QAEAAV0@ABV0@@Z");
218     SET(pbad_typeid_what, "?what@exception@@UBEPBDXZ");
219     SET(pbad_typeid_vtable, "??_7bad_typeid@@6B@");
220     SET(pbad_typeid_vector_dtor, "??_Ebad_typeid@@UAEPAXI@Z");
221     SET(pbad_typeid_scalar_dtor, "??_Gbad_typeid@@UAEPAXI@Z");
222
223     SETNOFAIL(pbad_cast_ctor, "??0bad_cast@@QAE@ABQBD@Z");
224     if (!pbad_cast_ctor)
225       SET(pbad_cast_ctor, "??0bad_cast@@AAE@PBQBD@Z");
226     SETNOFAIL(pbad_cast_ctor2, "??0bad_cast@@QAE@PBD@Z");
227     SETNOFAIL(pbad_cast_ctor_closure, "??_Fbad_cast@@QAEXXZ");
228     SET(pbad_cast_copy_ctor, "??0bad_cast@@QAE@ABV0@@Z");
229     SET(pbad_cast_dtor, "??1bad_cast@@UAE@XZ");
230     SET(pbad_cast_opequals, "??4bad_cast@@QAEAAV0@ABV0@@Z");
231     SET(pbad_cast_what, "?what@exception@@UBEPBDXZ");
232     SET(pbad_cast_vtable, "??_7bad_cast@@6B@");
233     SET(pbad_cast_vector_dtor, "??_Ebad_cast@@UAEPAXI@Z");
234     SET(pbad_cast_scalar_dtor, "??_Gbad_cast@@UAEPAXI@Z");
235
236     SET(p__non_rtti_object_ctor, "??0__non_rtti_object@@QAE@PBD@Z");
237     SET(p__non_rtti_object_copy_ctor, "??0__non_rtti_object@@QAE@ABV0@@Z");
238     SET(p__non_rtti_object_dtor, "??1__non_rtti_object@@UAE@XZ");
239     SET(p__non_rtti_object_opequals, "??4__non_rtti_object@@QAEAAV0@ABV0@@Z");
240     SET(p__non_rtti_object_what, "?what@exception@@UBEPBDXZ");
241     SET(p__non_rtti_object_vtable, "??_7__non_rtti_object@@6B@");
242     SET(p__non_rtti_object_vector_dtor, "??_E__non_rtti_object@@UAEPAXI@Z");
243     SET(p__non_rtti_object_scalar_dtor, "??_G__non_rtti_object@@UAEPAXI@Z");
244
245     SET(ptype_info_dtor, "??1type_info@@UAE@XZ");
246     SET(ptype_info_raw_name, "?raw_name@type_info@@QBEPBDXZ");
247     SET(ptype_info_name, "?name@type_info@@QBEPBDXZ");
248     SET(ptype_info_before, "?before@type_info@@QBEHABV1@@Z");
249     SET(ptype_info_opequals_equals, "??8type_info@@QBEHABV0@@Z");
250     SET(ptype_info_opnot_equals, "??9type_info@@QBEHABV0@@Z");
251
252     SET(p__RTtypeid, "__RTtypeid");
253     SET(p__RTCastToVoid, "__RTCastToVoid");
254     SET(p__RTDynamicCast, "__RTDynamicCast");
255
256     SET(p__unDName,"__unDName");
257
258     /* Extremely early versions export logic_error, and crash in RTTI */
259     SETNOFAIL(bAncientVersion, "??0logic_error@@QAE@ABQBD@Z");
260   }
261 }
262
263 static void test_exception(void)
264 {
265   static const char* e_name = "An exception name";
266   char* name;
267   exception e, e2, e3, *pe;
268
269   if (!poperator_new || !poperator_delete ||
270       !pexception_ctor || !pexception_copy_ctor || !pexception_default_ctor ||
271       !pexception_dtor || !pexception_opequals || !pexception_what ||
272       !pexception_vtable || !pexception_vector_dtor || !pexception_scalar_dtor)
273     return;
274
275   /* 'const char*&' ctor */
276   memset(&e, 0, sizeof(e));
277   call_func2(pexception_ctor, &e, &e_name);
278   ok(e.vtable != NULL, "Null exception vtable for e\n");
279   ok(e.name && e.name != e_name && !strcmp(e.name, "An exception name"), "Bad name '%s' for e\n", e.name);
280   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
281
282   /* Copy ctor */
283   memset(&e2, 0, sizeof(e2));
284   call_func2(pexception_copy_ctor, &e2, &e);
285   ok(e2.vtable != NULL, "Null exception vtable for e2\n");
286   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
287   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
288
289   /* Default ctor */
290   memset(&e3, 1, sizeof(e3));
291   call_func1(pexception_default_ctor, &e3);
292   ok(e3.vtable != NULL, "Null exception vtable for e3\n");
293   ok(e3.name == NULL, "Bad exception name for e3\n");
294   ok(e3.do_free == 0, "do_free set to %d for e3\n", e3.do_free);
295
296   ok(e.vtable == e2.vtable && e.vtable == e3.vtable, "exception vtables differ!\n");
297
298   /* Test calling the dtors */
299   call_func1(pexception_dtor, &e2);
300   call_func1(pexception_dtor, &e3);
301
302   /* Operator equals */
303   memset(&e2, 0, sizeof(e2));
304   call_func1(pexception_default_ctor, &e2);
305   pe = call_func2(pexception_opequals, &e2, &e);
306   ok(e2.vtable != NULL, "Null exception vtable for e2\n");
307   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "An exception name"), "Bad exception name for e2\n");
308   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
309   ok(pe == &e2, "opequals didn't return e2\n");
310
311   /* what() */
312   name = call_func1(pexception_what, &e2);
313   ok(e2.name == name, "Bad exception name from e2::what()\n");
314
315   /* vtable ptr */
316   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
317   call_func1(pexception_dtor, &e2);
318
319   /* new() */
320   pe = poperator_new(sizeof(exception));
321   ok(pe != NULL, "new() failed\n");
322   if (pe)
323   {
324     call_func2(pexception_ctor, pe, &e_name);
325     /* scalar dtor */
326     call_func2(pexception_scalar_dtor, pe, 0); /* Shouldn't delete pe */
327     pe->name = NULL;
328     pe->do_free = 0;
329     call_func2(pexception_scalar_dtor, pe, 1); /* Should delete pe */
330   }
331
332   pe = poperator_new(sizeof(exception));
333   ok(pe != NULL, "new() failed\n");
334   if (pe)
335   {
336     /* vector dtor, single element */
337     call_func2(pexception_ctor, pe, &e_name);
338     call_func2(pexception_vector_dtor, pe, 1); /* Should delete pe as single element*/
339   }
340
341   pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
342   ok(pe != NULL, "new() failed\n");
343   if (pe)
344   {
345     /* vector dtor, multiple elements */
346     char name[] = "a constant";
347     *((int*)pe) = 3;
348     pe = (exception*)((int*)pe + 1);
349     call_func2(pexception_ctor, &pe[0], &e_name);
350     call_func2(pexception_ctor, &pe[1], &e_name);
351     call_func2(pexception_ctor, &pe[2], &e_name);
352     pe[3].name = name;
353     pe[3].do_free = 1; /* Crash if we try to free this */
354     call_func2(pexception_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
355   }
356
357   /* test our exported vtable is kosher */
358   pe = (void*)pexception_vtable; /* Use the exception struct to get vtable ptrs */
359   pexception_vector_dtor = (void*)pe->vtable;
360   pexception_what = (void*)pe->name;
361
362   name = call_func1(pexception_what, &e);
363   ok(e.name == name, "Bad exception name from vtable e::what()\n");
364
365   if (p__RTtypeid && !bAncientVersion)
366   {
367     /* Check the rtti */
368     type_info *ti = p__RTtypeid(&e);
369     ok (ti && ti->mangled &&
370         !strcmp(ti->mangled, ".?AVexception@@"), "bad rtti for e\n");
371
372     if (ti)
373     {
374       /* Check the returned type_info has rtti too */
375       type_info *ti2 = p__RTtypeid(ti);
376       ok (ti2 != NULL && !strcmp(ti2->mangled, ".?AVtype_info@@"), "bad rtti for e's type_info\n");
377     }
378   }
379
380   call_func2(pexception_vector_dtor, &e, 0); /* Should delete e.name, but not e */
381 }
382
383 /* This test is basically a cut 'n' paste of the exception test. but it verifies that
384  * bad_typeid works the exact same way... */
385 static void test_bad_typeid(void)
386 {
387   static const char* e_name = "A bad_typeid name";
388   char* name;
389   exception e, e2, e3, *pe;
390
391   if (!poperator_new || !poperator_delete ||
392       !pbad_typeid_ctor || !pbad_typeid_copy_ctor ||
393       !pbad_typeid_dtor || !pbad_typeid_opequals || !pbad_typeid_what ||
394       !pbad_typeid_vtable || !pbad_typeid_vector_dtor || !pbad_typeid_scalar_dtor)
395     return;
396
397   /* 'const char*' ctor */
398   memset(&e, 0, sizeof(e));
399   call_func2(pbad_typeid_ctor, &e, e_name);
400   ok(e.vtable != NULL, "Null bad_typeid vtable for e\n");
401   ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_typeid name"), "Bad name '%s' for e\n", e.name);
402   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
403
404   /* Copy ctor */
405   memset(&e2, 0, sizeof(e2));
406   call_func2(pbad_typeid_copy_ctor, &e2, &e);
407   ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
408   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad name '%s' for e2\n", e2.name);
409   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
410
411   /* Ctor closure */
412   if (pbad_typeid_ctor_closure)
413   {
414     memset(&e3, 1, sizeof(e3));
415     call_func1(pbad_typeid_ctor_closure, &e3);
416     ok(e3.vtable != NULL, "Null bad_typeid vtable for e3\n");
417     ok(e3.name && !strcmp(e3.name, "bad typeid"), "Bad bad_typeid name for e3\n");
418     ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
419     ok(e.vtable == e3.vtable, "bad_typeid closure vtables differ!\n");
420     call_func1(pbad_typeid_dtor, &e3);
421   }
422   ok(e.vtable == e2.vtable, "bad_typeid vtables differ!\n");
423
424   /* Test calling the dtors */
425   call_func1(pbad_typeid_dtor, &e2);
426
427   /* Operator equals */
428   memset(&e2, 1, sizeof(e2));
429   call_func1(pexception_default_ctor, &e2);
430   pe = call_func2(pbad_typeid_opequals, &e2, &e);
431   ok(e2.vtable != NULL, "Null bad_typeid vtable for e2\n");
432   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_typeid name"), "Bad bad_typeid name for e2\n");
433   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
434   ok(pe == &e2, "opequals didn't return e2\n");
435
436   /* what() */
437   name = call_func1(pbad_typeid_what, &e2);
438   ok(e2.name == name, "Bad bad_typeid name from e2::what()\n");
439
440   /* vtable ptr */
441   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
442   call_func1(pbad_typeid_dtor, &e2);
443
444   /* new() */
445   pe = poperator_new(sizeof(exception));
446   ok(pe != NULL, "new() failed\n");
447   if (pe)
448   {
449     call_func2(pbad_typeid_ctor, pe, e_name);
450     /* scalar dtor */
451     call_func2(pbad_typeid_scalar_dtor, pe, 0); /* Shouldn't delete pe */
452     pe->name = NULL;
453     pe->do_free = 0;
454     call_func2(pbad_typeid_scalar_dtor, pe, 1); /* Should delete pe */
455   }
456
457   pe = poperator_new(sizeof(exception));
458   ok(pe != NULL, "new() failed\n");
459   if (pe)
460   {
461     /* vector dtor, single element */
462     call_func2(pbad_typeid_ctor, pe, e_name);
463     call_func2(pbad_typeid_vector_dtor, pe, 1); /* Should delete pe as single element*/
464   }
465
466   pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
467   ok(pe != NULL, "new() failed\n");
468   if (pe)
469   {
470     /* vector dtor, multiple elements */
471     *((int*)pe) = 3;
472     pe = (exception*)((int*)pe + 1);
473     call_func2(pbad_typeid_ctor, &pe[0], e_name);
474     call_func2(pbad_typeid_ctor, &pe[1], e_name);
475     call_func2(pbad_typeid_ctor, &pe[2], e_name);
476     pe[3].name = 0;
477     pe[3].do_free = 1; /* Crash if we try to free this element */
478     call_func2(pbad_typeid_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
479   }
480
481   /* test our exported vtable is kosher */
482   pe = (void*)pbad_typeid_vtable; /* Use the exception struct to get vtable ptrs */
483   pbad_typeid_vector_dtor = (void*)pe->vtable;
484   pbad_typeid_what = (void*)pe->name;
485
486   name = call_func1(pbad_typeid_what, &e);
487   ok(e.name == name, "Bad bad_typeid name from vtable e::what()\n");
488
489   if (p__RTtypeid && !bAncientVersion)
490   {
491     /* Check the rtti */
492     type_info *ti = p__RTtypeid(&e);
493     ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_typeid@@"), "bad rtti for e (%s)\n",
494         !ti ? "null" : ti->mangled);
495   }
496
497   call_func2(pbad_typeid_vector_dtor, &e, 0); /* Should delete e.name, but not e */
498 }
499
500
501 /* Ditto for this test... */
502 static void test_bad_cast(void)
503 {
504   static const char* e_name = "A bad_cast name";
505   char* name;
506   exception e, e2, e3, *pe;
507
508   if (!poperator_new || !poperator_delete ||
509       !pbad_cast_ctor || !pbad_cast_copy_ctor ||
510       !pbad_cast_dtor || !pbad_cast_opequals || !pbad_cast_what ||
511       !pbad_cast_vtable || !pbad_cast_vector_dtor || !pbad_cast_scalar_dtor)
512     return;
513
514   if (pbad_cast_ctor2)
515   {
516     /* 'const char*' ctor */
517     memset(&e, 0, sizeof(e));
518     call_func2(pbad_cast_ctor2, &e, e_name);
519     ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
520     ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
521     ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
522     call_func1(pbad_cast_dtor, &e);
523   }
524
525   /* 'const char*&' ctor */
526   memset(&e, 0, sizeof(e));
527   call_func2(pbad_cast_ctor, &e, &e_name);
528   ok(e.vtable != NULL, "Null bad_cast vtable for e\n");
529   ok(e.name && e.name != e_name && !strcmp(e.name, "A bad_cast name"), "Bad name '%s' for e\n", e.name);
530   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
531
532   /* Copy ctor */
533   memset(&e2, 0, sizeof(e2));
534   call_func2(pbad_cast_copy_ctor, &e2, &e);
535   ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
536   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad name '%s' for e2\n", e2.name);
537   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
538
539   /* Ctor closure */
540   if (pbad_cast_ctor_closure)
541   {
542     memset(&e3, 1, sizeof(e3));
543     call_func1(pbad_cast_ctor_closure, &e3);
544     ok(e3.vtable != NULL, "Null bad_cast vtable for e3\n");
545     ok(e3.name && !strcmp(e3.name, "bad cast"), "Bad bad_cast name for e3\n");
546     ok(e3.do_free == 1, "do_free set to %d for e3\n", e3.do_free);
547     ok(e.vtable == e3.vtable, "bad_cast closure vtables differ!\n");
548     call_func1(pbad_cast_dtor, &e3);
549   }
550   ok(e.vtable == e2.vtable, "bad_cast vtables differ!\n");
551
552   /* Test calling the dtors */
553   call_func1(pbad_cast_dtor, &e2);
554
555   /* Operator equals */
556   memset(&e2, 1, sizeof(e2));
557   call_func1(pexception_default_ctor, &e2);
558   pe = call_func2(pbad_cast_opequals, &e2, &e);
559   ok(e2.vtable != NULL, "Null bad_cast vtable for e2\n");
560   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A bad_cast name"), "Bad bad_cast name for e2\n");
561   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
562   ok(pe == &e2, "opequals didn't return e2\n");
563
564   /* what() */
565   name = call_func1(pbad_cast_what, &e2);
566   ok(e2.name == name, "Bad bad_cast name from e2::what()\n");
567
568   /* vtable ptr */
569   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
570   call_func1(pbad_cast_dtor, &e2);
571
572   /* new() */
573   pe = poperator_new(sizeof(exception));
574   ok(pe != NULL, "new() failed\n");
575   if (pe)
576   {
577     call_func2(pbad_cast_ctor, pe, &e_name);
578     /* scalar dtor */
579     call_func2(pbad_cast_scalar_dtor, pe, 0); /* Shouldn't delete pe */
580     pe->name = NULL;
581     pe->do_free = 0;
582     call_func2(pbad_cast_scalar_dtor, pe, 1); /* Should delete pe */
583   }
584
585   pe = poperator_new(sizeof(exception));
586   ok(pe != NULL, "new() failed\n");
587   if (pe)
588   {
589     /* vector dtor, single element */
590     call_func2(pbad_cast_ctor, pe, &e_name);
591     call_func2(pbad_cast_vector_dtor, pe, 1); /* Should delete pe as single element*/
592   }
593
594   pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
595   ok(pe != NULL, "new() failed\n");
596   if (pe)
597   {
598     /* vector dtor, multiple elements */
599     *((int*)pe) = 3;
600     pe = (exception*)((int*)pe + 1);
601     call_func2(pbad_cast_ctor, &pe[0], &e_name);
602     call_func2(pbad_cast_ctor, &pe[1], &e_name);
603     call_func2(pbad_cast_ctor, &pe[2], &e_name);
604     pe[3].name = 0;
605     pe[3].do_free = 1; /* Crash if we try to free this element */
606     call_func2(pbad_cast_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
607   }
608
609   /* test our exported vtable is kosher */
610   pe = (void*)pbad_cast_vtable; /* Use the exception struct to get vtable ptrs */
611   pbad_cast_vector_dtor = (void*)pe->vtable;
612   pbad_cast_what = (void*)pe->name;
613
614   name = call_func1(pbad_cast_what, &e);
615   ok(e.name == name, "Bad bad_cast name from vtable e::what()\n");
616
617   if (p__RTtypeid && !bAncientVersion)
618   {
619     /* Check the rtti */
620     type_info *ti = p__RTtypeid(&e);
621     ok (ti != NULL && !strcmp(ti->mangled, ".?AVbad_cast@@"), "bad rtti for e\n");
622   }
623   call_func2(pbad_cast_vector_dtor, &e, 0); /* Should delete e.name, but not e */
624 }
625
626 /* ... and this one */
627 static void test___non_rtti_object(void)
628 {
629   static const char* e_name = "A __non_rtti_object name";
630   char* name;
631   exception e, e2, *pe;
632
633   if (!poperator_new || !poperator_delete ||
634       !p__non_rtti_object_ctor || !p__non_rtti_object_copy_ctor ||
635       !p__non_rtti_object_dtor || !p__non_rtti_object_opequals || !p__non_rtti_object_what ||
636       !p__non_rtti_object_vtable || !p__non_rtti_object_vector_dtor || !p__non_rtti_object_scalar_dtor)
637     return;
638
639   /* 'const char*' ctor */
640   memset(&e, 0, sizeof(e));
641   call_func2(p__non_rtti_object_ctor, &e, e_name);
642   ok(e.vtable != NULL, "Null __non_rtti_object vtable for e\n");
643   ok(e.name && e.name != e_name && !strcmp(e.name, "A __non_rtti_object name"), "Bad name '%s' for e\n", e.name);
644   ok(e.do_free == 1, "do_free set to %d for e\n", e.do_free);
645
646   /* Copy ctor */
647   memset(&e2, 0, sizeof(e2));
648   call_func2(p__non_rtti_object_copy_ctor, &e2, &e);
649   ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
650   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad name '%s' for e2\n", e2.name);
651   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
652   ok(e.vtable == e2.vtable, "__non_rtti_object vtables differ!\n");
653
654   /* Test calling the dtors */
655   call_func1(p__non_rtti_object_dtor, &e2);
656
657   /* Operator equals */
658   memset(&e2, 1, sizeof(e2));
659   call_func1(pexception_default_ctor, &e2);
660   pe = call_func2(p__non_rtti_object_opequals, &e2, &e);
661   ok(e2.vtable != NULL, "Null __non_rtti_object vtable for e2\n");
662   ok(e2.name && e2.name != e.name && !strcmp(e2.name, "A __non_rtti_object name"), "Bad __non_rtti_object name for e2\n");
663   ok(e2.do_free == 1, "do_free set to %d for e2\n", e2.do_free);
664   ok(pe == &e2, "opequals didn't return e2\n");
665
666   /* what() */
667   name = call_func1(p__non_rtti_object_what, &e2);
668   ok(e2.name == name, "Bad __non_rtti_object name from e2::what()\n");
669
670   /* vtable ptr */
671   ok(e2.vtable == pexception_vtable, "Bad vtable for e2\n");
672   call_func1(p__non_rtti_object_dtor, &e2);
673
674   /* new() */
675   pe = poperator_new(sizeof(exception));
676   ok(pe != NULL, "new() failed\n");
677   if (pe)
678   {
679     call_func2(p__non_rtti_object_ctor, pe, e_name);
680     /* scalar dtor */
681     call_func2(p__non_rtti_object_scalar_dtor, pe, 0); /* Shouldn't delete pe */
682     pe->name = NULL;
683     pe->do_free = 0;
684     call_func2(p__non_rtti_object_scalar_dtor, pe, 1); /* Should delete pe */
685   }
686
687   pe = poperator_new(sizeof(exception));
688   ok(pe != NULL, "new() failed\n");
689   if (pe)
690   {
691     /* vector dtor, single element */
692     call_func2(p__non_rtti_object_ctor, pe, e_name);
693     call_func2(p__non_rtti_object_vector_dtor, pe, 1); /* Should delete pe as single element*/
694   }
695
696   pe = poperator_new(sizeof(exception) * 4 + sizeof(int));
697   ok(pe != NULL, "new() failed\n");
698   if (pe)
699   {
700     /* vector dtor, multiple elements */
701     *((int*)pe) = 3;
702     pe = (exception*)((int*)pe + 1);
703     call_func2(p__non_rtti_object_ctor, &pe[0], e_name);
704     call_func2(p__non_rtti_object_ctor, &pe[1], e_name);
705     call_func2(p__non_rtti_object_ctor, &pe[2], e_name);
706     pe[3].name = 0;
707     pe[3].do_free = 1; /* Crash if we try to free this element */
708     call_func2(p__non_rtti_object_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
709   }
710
711   /* test our exported vtable is kosher */
712   pe = (void*)p__non_rtti_object_vtable; /* Use the exception struct to get vtable ptrs */
713   p__non_rtti_object_vector_dtor = (void*)pe->vtable;
714   p__non_rtti_object_what = (void*)pe->name;
715
716   name = call_func1(p__non_rtti_object_what, &e);
717   ok(e.name == name, "Bad __non_rtti_object name from vtable e::what()\n");
718
719   if (p__RTtypeid && !bAncientVersion)
720   {
721     /* Check the rtti */
722     type_info *ti = p__RTtypeid(&e);
723     ok (ti != NULL && !strcmp(ti->mangled, ".?AV__non_rtti_object@@"), "bad rtti for e\n");
724   }
725   call_func2(p__non_rtti_object_vector_dtor, &e, 0); /* Should delete e.name, but not e */
726 }
727
728
729 static void test_type_info(void)
730 {
731   static type_info t1 = { NULL, NULL,{'.','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
732   static type_info t1_1 = { NULL, NULL,{'?','?','A','V','t','e','s','t','1','@','@',0,0,0,0,0 } };
733   static type_info t2 = { NULL, NULL, {'.','?','A','V','t','e','s','t','2','@','@',0,0,0,0,0 } };
734   char* name;
735   int res;
736
737   if (!pmalloc || !pfree || !ptype_info_dtor || !ptype_info_raw_name ||
738       !ptype_info_name || !ptype_info_before ||
739       !ptype_info_opequals_equals || !ptype_info_opnot_equals)
740     return;
741
742   /* Test calling the dtors */
743   call_func1(ptype_info_dtor, &t1); /* No effect, since name is NULL */
744   t1.name = pmalloc(64);
745   strcpy(t1.name, "foo");
746   call_func1(ptype_info_dtor, &t1); /* Frees t1.name using 'free' */
747
748   /* raw_name */
749   t1.name = NULL;
750   name = call_func1(ptype_info_raw_name, &t1);
751
752   /* FIXME: This fails on native; it shouldn't though - native bug?
753    * ok(name && !strcmp(name, t1.mangled), "bad raw_name '%s' for t1 (expected '%s')\n", name, t1.mangled);
754    */
755   ok(t1.name == NULL, "raw_name() set name for t1\n");
756
757   /* name */
758   t1.name = NULL;
759   name = call_func1(ptype_info_name, &t1);
760   ok(name && t1.name && !strcmp(name, t1.name), "bad name '%s' for t1\n", name);
761
762   ok(t1.name && !strcmp(t1.name, "class test1"), "demangled to '%s' for t1\n", t1.name);
763   call_func1(ptype_info_dtor, &t1);
764
765   /* before */
766   t1.name = NULL;
767   res = (int)call_func2(ptype_info_before, &t1, &t1);
768   ok(res == 0, "expected 0, got %d\n", res);
769   res = (int)call_func2(ptype_info_before, &t2, &t1);
770   ok(res == 0, "expected 0, got %d\n", res);
771   res = (int)call_func2(ptype_info_before, &t1, &t2);
772   ok(res == 1, "expected 1, got %d\n", res);
773   /* Doesn't check first char */
774   res = (int)call_func2(ptype_info_before, &t1, &t1_1);
775   ok(res == 0, "expected 0, got %d\n", res);
776
777   /* opequals_equals */
778   t1.name = NULL;
779   res = (int)call_func2(ptype_info_opequals_equals, &t1, &t1);
780   ok(res == 1, "expected 1, got %d\n", res);
781   res = (int)call_func2(ptype_info_opequals_equals, &t1, &t2);
782   ok(res == 0, "expected 0, got %d\n", res);
783   res = (int)call_func2(ptype_info_opequals_equals, &t2, &t1);
784   ok(res == 0, "expected 0, got %d\n", res);
785
786   /* opnot_equals */
787   t1.name = NULL;
788   res = (int)call_func2(ptype_info_opnot_equals, &t1, &t1);
789   ok(res == 0, "expected 0, got %d\n", res);
790   res = (int)call_func2(ptype_info_opnot_equals, &t1, &t2);
791   ok(res == 1, "expected 1, got %d\n", res);
792   res = (int)call_func2(ptype_info_opnot_equals, &t2, &t1);
793   ok(res == 1, "expected 1, got %d\n", res);
794 }
795
796 /* Test RTTI functions */
797 static void test_rtti(void)
798 {
799   static const char* e_name = "name";
800   type_info *ti,*bti;
801   exception e,b;
802   void *casted;
803
804   if (bAncientVersion ||
805       !p__RTCastToVoid || !p__RTtypeid || !pexception_ctor || !pbad_typeid_ctor || !p__RTDynamicCast)
806     return;
807
808   call_func2(pexception_ctor, &e, &e_name);
809   call_func2(pbad_typeid_ctor, &b, e_name);
810
811   /* dynamic_cast to void* */
812   casted = p__RTCastToVoid(&e);
813   ok (casted == (void*)&e, "failed cast to void\n");
814
815   /* dynamic_cast up */
816   ti = p__RTtypeid(&e);
817   bti = p__RTtypeid(&b);
818
819   casted = p__RTDynamicCast(&b, 0, NULL, ti, 0);
820   if (casted)
821   {
822     /* New versions do not allow this conversion due to compiler changes */
823     ok (casted == (void*)&b, "failed cast from bad_typeid to exception\n");
824   }
825
826   /* dynamic_cast down */
827   casted = p__RTDynamicCast(&e, 0, NULL, bti, 0);
828   ok (casted == NULL, "Cast succeeded\n");
829 }
830
831 struct _demangle {
832     LPCSTR mangled;
833     LPCSTR result;
834     BOOL test_in_wine;
835 };
836
837 static void test_demangle_datatype(void)
838 {
839     char * name;
840     struct _demangle demangle[]={
841 /*      { "BlaBla"," ?? ::Bla", FALSE}, */
842         { "ABVVec4@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
843         { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
844         { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
845         { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
846         { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
847         { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
848 /*      { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE}, */
849     };
850     int i, num_test = (sizeof(demangle)/sizeof(struct _demangle));
851     
852     for (i = 0; i < num_test; i++)
853     {
854         name = p__unDName(0, demangle[i].mangled, 0, pmalloc, pfree, 0x2800);
855         if (demangle[i].test_in_wine)
856             ok(name != NULL && !strcmp(name,demangle[i].result), "Got name \"%s\" for %d\n", name, i);
857         else
858             todo_wine ok(name != NULL && !strcmp(name,demangle[i].result), "Got name %s for %d\n", name, i);
859               
860     }
861 }
862
863 /* Compare two strings treating multiple spaces (' ', ascii 0x20) in s2 
864    as single space. Needed for test_demangle as __unDName() returns sometimes
865    two spaces instead of one in some older native msvcrt dlls. */
866 static int strcmp_space(const char *s1, const char *s2)
867 {
868     const char* s2start = s2;
869     do {
870         while (*s1 == *s2 && *s1) {
871             s1++;
872             s2++;
873         }
874         if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == ' ')
875             s2++;
876         else
877             break;
878     } while (*s1 && *s2);
879     return *s1 - *s2;
880 }
881
882 static void test_demangle(void)
883 {
884     static struct {const char* in; const char* out; const char *broken; unsigned int flags;} test[] = {
885 /* 0 */ {"??0bad_alloc@std@@QAE@ABV01@@Z",
886          "public: __thiscall std::bad_alloc::bad_alloc(class std::bad_alloc const &)",
887          "public: __thiscall std::bad_alloc::bad_alloc(class bad_alloc::bad_alloc const &)"},
888 /* 1 */ {"??0bad_alloc@std@@QAE@PBD@Z",
889          "public: __thiscall std::bad_alloc::bad_alloc(char const *)"},
890 /* 2 */ {"??0bad_cast@@AAE@PBQBD@Z",
891          "private: __thiscall bad_cast::bad_cast(char const * const *)"},
892 /* 3 */ {"??0bad_cast@@QAE@ABQBD@Z",
893          "public: __thiscall bad_cast::bad_cast(char const * const &)"},
894 /* 4 */ {"??0bad_cast@@QAE@ABV0@@Z",
895          "public: __thiscall bad_cast::bad_cast(class bad_cast const &)"},
896 /* 5 */ {"??0bad_exception@std@@QAE@ABV01@@Z",
897          "public: __thiscall std::bad_exception::bad_exception(class std::bad_exception const &)",
898          "public: __thiscall std::bad_exception::bad_exception(class bad_exception::bad_exception const &)"},
899 /* 6 */ {"??0bad_exception@std@@QAE@PBD@Z",
900          "public: __thiscall std::bad_exception::bad_exception(char const *)"},
901 /* 7 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@ABV01@@Z",
902          "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 &)",
903          "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 &)"},
904 /* 8 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z",
905          "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(struct _iobuf *)"},
906 /* 9 */ {"??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z",
907          "public: __thiscall std::basic_filebuf<char,struct std::char_traits<char> >::basic_filebuf<char,struct std::char_traits<char> >(enum std::_Uninitialized)",
908          "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)"},
909 /* 10 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@ABV01@@Z",
910           "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 &)",
911           "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 &)"},
912 /* 11 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z",
913           "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 *)"},
914 /* 12 */ {"??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z",
915           "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)",
916           "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)"},
917 /* 13 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z",
918           "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 &)",
919           "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 &)"},
920 /* 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",
921           "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)",
922           "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)"},
923 /* 15 */ {"??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z",
924           "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)"},
925 /* 16 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV01@@Z",
926           "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 &)",
927           "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 &)"},
928 /* 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",
929           "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)",
930           "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)"},
931 /* 18 */ {"??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z",
932           "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)"},
933 /* 19 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
934           "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)",
935           "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)"},
936 /* 20 */ {"??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z",
937           "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)"},
938 /* 21 */ {"??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z",
939           "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)",
940           "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)"},
941 /* 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)"},
942 /* 23 */ {"??0streambuf@@QAE@ABV0@@Z", "public: __thiscall streambuf::streambuf(class streambuf const &)"},
943 /* 24 */ {"??0strstreambuf@@QAE@ABV0@@Z", "public: __thiscall strstreambuf::strstreambuf(class strstreambuf const &)"},
944 /* 25 */ {"??0strstreambuf@@QAE@H@Z", "public: __thiscall strstreambuf::strstreambuf(int)"},
945 /* 26 */ {"??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z", "public: __thiscall strstreambuf::strstreambuf(void * (__cdecl*)(long),void (__cdecl*)(void *))"},
946 /* 27 */ {"??0strstreambuf@@QAE@PADH0@Z", "public: __thiscall strstreambuf::strstreambuf(char *,int,char *)"},
947 /* 28 */ {"??0strstreambuf@@QAE@PAEH0@Z", "public: __thiscall strstreambuf::strstreambuf(unsigned char *,int,unsigned char *)"},
948 /* 29 */ {"??0strstreambuf@@QAE@XZ", "public: __thiscall strstreambuf::strstreambuf(void)"},
949 /* 30 */ {"??1__non_rtti_object@std@@UAE@XZ", "public: virtual __thiscall std::__non_rtti_object::~__non_rtti_object(void)"},
950 /* 31 */ {"??1__non_rtti_object@@UAE@XZ", "public: virtual __thiscall __non_rtti_object::~__non_rtti_object(void)"},
951 /* 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)"},
952 /* 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)"},
953 /* 34 */ {"??4istream_withassign@@QAEAAV0@ABV0@@Z", "public: class istream_withassign & __thiscall istream_withassign::operator=(class istream_withassign const &)"},
954 /* 35 */ {"??4istream_withassign@@QAEAAVistream@@ABV1@@Z", "public: class istream & __thiscall istream_withassign::operator=(class istream const &)"},
955 /* 36 */ {"??4istream_withassign@@QAEAAVistream@@PAVstreambuf@@@Z", "public: class istream & __thiscall istream_withassign::operator=(class streambuf *)"},
956 /* 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 &)"},
957 /* 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 &)"},
958 /* 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 &)"},
959 /* 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 &))"},
960 /* 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> > *)"},
961 /* 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 *)"},
962 /* 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> >'}"},
963 /* 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> >'}"},
964 /* 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> >'}"},
965 /* 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 &)"},
966 /* 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 &)"},
967 /* 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)"},
968 /* 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 "},
969 /* 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)"},
970 /* 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 "},
971 /* 52 */ {"?abs@std@@YAMABV?$complex@M@1@@Z", "float __cdecl std::abs(class std::complex<float> const &)"},
972 /* 53 */ {"?abs@std@@YANABV?$complex@N@1@@Z", "double __cdecl std::abs(class std::complex<double> const &)"},
973 /* 54 */ {"?abs@std@@YAOABV?$complex@O@1@@Z", "long double __cdecl std::abs(class std::complex<long double> const &)"},
974 /* 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"},
975 /* 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 "},
976 /* 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 "},
977 /* 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 "},
978 /* 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 "},
979 /* 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 "},
980 /* 61 */ {"?_query_new_handler@@YAP6AHI@ZXZ", "int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)"},
981 /* 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)"},
982 /* 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)"},
983 /* 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>)"},
984 /* 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)"},
985 /* 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>)"},
986 /* 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)"},
987 /* 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)"},
988 /* 69 */ {"?set_new_handler@@YAP6AXXZP6AXXZ@Z", "void (__cdecl*__cdecl set_new_handler(void (__cdecl*)(void)))(void)"},
989 /* 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 &)"},
990 /* 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 "},
991 /* 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 &)"},
992 /* 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 "},
993 /* 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 &)"},
994 /* 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 "},
995 /* 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 &)"},
996 /* 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 "},
997 /* 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 &)"},
998 /* 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 "},
999 /* 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 &)"},
1000 /* 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 "},
1001 /* 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 &)"},
1002 /* 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 "},
1003 /* 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 &)"},
1004 /* 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 "},
1005 /* 86 */ {"?_Sync@ios_base@std@@0_NA", "private: static bool std::ios_base::_Sync"},
1006 /* 87 */ {"??_U@YAPAXI@Z", "void * __cdecl operator new[](unsigned int)"},
1007 /* 88 */ {"??_V@YAXPAX@Z", "void __cdecl operator delete[](void *)"},
1008 /* 89 */ {"??X?$_Complex_base@M@std@@QAEAAV01@ABM@Z", "public: class std::_Complex_base<float> & __thiscall std::_Complex_base<float>::operator*=(float const &)"},
1009 /* 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 &)"},
1010 /* 91 */ {"?aaa@@YAHAAUbbb@@@Z", "int __cdecl aaa(struct bbb &)"},
1011 /* 92 */ {"?aaa@@YAHBAUbbb@@@Z", "int __cdecl aaa(struct bbb & volatile)"},
1012 /* 93 */ {"?aaa@@YAHPAUbbb@@@Z", "int __cdecl aaa(struct bbb *)"},
1013 /* 94 */ {"?aaa@@YAHQAUbbb@@@Z", "int __cdecl aaa(struct bbb * const)"},
1014 /* 95 */ {"?aaa@@YAHRAUbbb@@@Z", "int __cdecl aaa(struct bbb * volatile)"},
1015 /* 96 */ {"?aaa@@YAHSAUbbb@@@Z", "int __cdecl aaa(struct bbb * const volatile)"},
1016 /* 97 */ {"??0aa.a@@QAE@XZ", "??0aa.a@@QAE@XZ"},
1017 /* 98 */ {"??0aa$_3a@@QAE@XZ", "public: __thiscall aa$_3a::aa$_3a(void)"},
1018 /* 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)"},
1019 /* 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 *))"},
1020 /* 101 */ {"?$_aaa@Vbbb@@", "_aaa<class bbb>"},
1021 /* 102 */ {"?$aaa@Vbbb@ccc@@Vddd@2@", "aaa<class ccc::bbb,class ccc::ddd>"},
1022 /* 103 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "public: __thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)"},
1023 /* 104 */ { "??0?$Foo@P6GHPAX0@Z@@QAE@PAD@Z", "__thiscall Foo<int (__stdcall*)(void *,void *)>::Foo<int (__stdcall*)(void *,void *)>(char *)", NULL, 0x880},
1024 /* 105 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "private: static int (__cdecl** Bar::Qux)(class Bar *,int &,int &,int *)" },
1025 /* 106 */ { "?Qux@Bar@@0PAP6AHPAV1@AAH1PAH@ZA", "Bar::Qux", NULL, 0x1800},
1026 /* 107 */ {"?$AAA@$DBAB@", "AAA<`template-parameter257'>"},
1027 /* 108 */ {"?$AAA@?C@", "AAA<`template-parameter-2'>"},
1028 /* 109 */ {"?$AAA@PAUBBB@@", "AAA<struct BBB *>"},
1029 /* 110 */ {"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z",
1030            "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa * *,class ee *)",
1031            "??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z"},
1032 /* 111 */ {"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
1033 /* 112 */ {"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
1034 /* 113 */ {"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
1035 /* 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",
1036            "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)"},
1037 /* 115 */ {"?swprintf@@YAHPAGIPBGZZ", "int __cdecl swprintf(unsigned short *,unsigned int,unsigned short const *,...)"},
1038 /* 116 */ {"?vswprintf@@YAHPAGIPBGPAD@Z", "int __cdecl vswprintf(unsigned short *,unsigned int,unsigned short const *,char *)"},
1039 /* 117 */ {"?vswprintf@@YAHPA_WIPB_WPAD@Z", "int __cdecl vswprintf(wchar_t *,unsigned int,wchar_t const *,char *)"},
1040 /* 118 */ {"?swprintf@@YAHPA_WIPB_WZZ", "int __cdecl swprintf(wchar_t *,unsigned int,wchar_t const *,...)"},
1041
1042     };
1043     int i, num_test = (sizeof(test)/sizeof(test[0]));
1044     char* name;
1045
1046     for (i = 0; i < num_test; i++)
1047     {
1048         name = p__unDName(0, test[i].in, 0, pmalloc, pfree, test[i].flags);
1049         ok(name != NULL, "%u: unDName failed\n", i);
1050         if (!name) continue;
1051         ok( !strcmp_space(test[i].out, name) ||
1052             broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1053            "%u: Got name \"%s\"\n", i, name );
1054         ok( !strcmp_space(test[i].out, name) ||
1055             broken(test[i].broken && !strcmp_space(test[i].broken, name)),
1056            "%u: Expected \"%s\"\n", i, test[i].out );
1057         pfree(name);
1058     }
1059 }
1060
1061 START_TEST(cpp)
1062 {
1063   InitFunctionPtrs();
1064
1065   test_exception();
1066   test_bad_typeid();
1067   test_bad_cast();
1068   test___non_rtti_object();
1069   test_type_info();
1070   test_rtti();
1071   test_demangle_datatype();
1072   test_demangle();
1073 }
1074 #endif /* __i386__ */