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