32#define MSVCRT_atoi atoi
33#define MSVCRT_isdigit isdigit
34#define MSVCRT_sprintf sprintf
106#define BLOCK_SIZE 1024
107#define AVAIL_SIZE (1024 - sizeof(void*))
163 a->start =
a->num =
a->max =
a->alloc = 0;
181 new =
und_alloc(sym, (
a->alloc = 32) *
sizeof(
a->elts[0]));
182 if (!
new)
return FALSE;
185 else if (
a->max >=
a->alloc)
187 new =
und_alloc(sym, (
a->alloc * 2) *
sizeof(
a->elts[0]));
188 if (!
new)
return FALSE;
189 memcpy(
new,
a->elts,
a->alloc *
sizeof(
a->elts[0]));
197 a->elts[
a->num][
len] =
'\0';
198 if (++
a->num >=
a->max)
a->max =
a->num;
203 for (
i =
a->max - 1;
i >= 0;
i--)
206 if (i < a->
start)
c =
'-';
207 else if (
i >=
a->num)
c =
'}';
225 WARN(
"Out of bounds: %p %d + %d >= %d\n",
229 TRACE(
"Returning %p[%d] => %s\n",
242 unsigned int len = 1,
i, sz;
257 case '%':
len++;
break;
284 case '%': *
p++ =
'%';
break;
354 struct array arg_collect;
355 char* args_str =
NULL;
373 if (z_term && !
strcmp(ct.
left,
"void"))
break;
384 if (arg_collect.
num == 0 ||
385 (arg_collect.
num == 1 && !
strcmp(arg_collect.
elts[0],
"void")))
387 for (
i = 1;
i < arg_collect.
num;
i++)
392 last = args_str ? args_str : arg_collect.
elts[0];
414 *ptr_modif =
"__ptr64";
416 *ptr_modif = *ptr_modif + 2;
423 case 'B': *
ret =
"const";
break;
424 case 'C': *
ret =
"volatile";
break;
425 case 'D': *
ret =
"const volatile";
break;
426 default:
return FALSE;
432 struct array *pmt_ref,
char modif,
BOOL in_args)
434 const char* modifier;
435 const char* str_modif;
436 const char *ptr_modif =
"";
443 ptr_modif =
" ptr64";
445 ptr_modif =
" __ptr64";
452 case 'A': str_modif =
str_printf(sym,
" &%s", ptr_modif);
break;
453 case 'B': str_modif =
str_printf(sym,
" &%s volatile", ptr_modif);
break;
454 case 'P': str_modif =
str_printf(sym,
" *%s", ptr_modif);
break;
455 case 'Q': str_modif =
str_printf(sym,
" *%s const", ptr_modif);
break;
456 case 'R': str_modif =
str_printf(sym,
" *%s volatile", ptr_modif);
break;
457 case 'S': str_modif =
str_printf(sym,
" *%s const volatile", ptr_modif);
break;
458 case '?': str_modif =
"";
break;
459 default:
return FALSE;
464 unsigned mark = sym->
stack.num;
477 if (str_modif[0] ==
' ' && !modifier)
482 str_modif =
str_printf(sym,
" (%s%s)", modifier, str_modif);
486 str_modif =
str_printf(sym,
" (%s)", str_modif);
500 if (!in_args && str_modif[0] && str_modif[1] ==
'*' && sub_ct.
left[
strlen(sub_ct.
left)-1] ==
'*')
505 sym->
stack.num = mark;
529 }
while (*++sym->
current !=
'@');
550 unsigned num_mark = sym->
names.num;
551 unsigned start_mark = sym->
names.start;
552 unsigned stack_mark = sym->
stack.num;
553 struct array array_pmt;
557 sym->
names.start = start_mark;
564 sym->
names.num = num_mark;
565 sym->
names.start = start_mark;
566 sym->
stack.num = stack_mark;
591 case '\0':
return FALSE;
593 case '0':
case '1':
case '2':
case '3':
594 case '4':
case '5':
case '6':
case '7':
645 unsigned int len, sz;
676 unsigned mark = sym->
stack.num;
681 sym->
stack.num = mark;
691 const char** exported,
unsigned flags)
693 *call_conv = *exported =
NULL;
699 if (((ch -
'A') % 2) == 1) *exported =
"dll_export ";
702 case 'A':
case 'B': *call_conv =
"cdecl";
break;
703 case 'C':
case 'D': *call_conv =
"pascal";
break;
704 case 'E':
case 'F': *call_conv =
"thiscall";
break;
705 case 'G':
case 'H': *call_conv =
"stdcall";
break;
706 case 'I':
case 'J': *call_conv =
"fastcall";
break;
707 case 'K':
case 'L':
break;
708 case 'M': *call_conv =
"clrcall";
break;
709 default:
ERR(
"Unknown calling convention %c\n", ch);
return FALSE;
714 if (((ch -
'A') % 2) == 1) *exported =
"__dll_export ";
717 case 'A':
case 'B': *call_conv =
"__cdecl";
break;
718 case 'C':
case 'D': *call_conv =
"__pascal";
break;
719 case 'E':
case 'F': *call_conv =
"__thiscall";
break;
720 case 'G':
case 'H': *call_conv =
"__stdcall";
break;
721 case 'I':
case 'J': *call_conv =
"__fastcall";
break;
722 case 'K':
case 'L':
break;
723 case 'M': *call_conv =
"__clrcall";
break;
724 default:
ERR(
"Unknown calling convention %c\n", ch);
return FALSE;
737 const char* type_string;
741 case 'C': type_string =
"signed char";
break;
742 case 'D': type_string =
"char";
break;
743 case 'E': type_string =
"unsigned char";
break;
744 case 'F': type_string =
"short";
break;
745 case 'G': type_string =
"unsigned short";
break;
746 case 'H': type_string =
"int";
break;
747 case 'I': type_string =
"unsigned int";
break;
748 case 'J': type_string =
"long";
break;
749 case 'K': type_string =
"unsigned long";
break;
750 case 'M': type_string =
"float";
break;
751 case 'N': type_string =
"double";
break;
752 case 'O': type_string =
"long double";
break;
753 case 'X': type_string =
"void";
break;
754 case 'Z': type_string =
"...";
break;
755 default: type_string =
NULL;
break;
766 const char* type_string;
770 case 'D': type_string =
"__int8";
break;
771 case 'E': type_string =
"unsigned __int8";
break;
772 case 'F': type_string =
"__int16";
break;
773 case 'G': type_string =
"unsigned __int16";
break;
774 case 'H': type_string =
"__int32";
break;
775 case 'I': type_string =
"unsigned __int32";
break;
776 case 'J': type_string =
"__int64";
break;
777 case 'K': type_string =
"unsigned __int64";
break;
778 case 'L': type_string =
"__int128";
break;
779 case 'M': type_string =
"unsigned __int128";
break;
780 case 'N': type_string =
"bool";
break;
781 case 'W': type_string =
"wchar_t";
break;
782 default: type_string =
NULL;
break;
809 case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
810 case 'H':
case 'I':
case 'J':
case 'K':
case 'M':
811 case 'N':
case 'O':
case 'X':
case 'Z':
822 const char* struct_name =
NULL;
823 const char* type_name =
NULL;
831 case 'T': type_name =
"union ";
break;
832 case 'U': type_name =
"struct ";
break;
833 case 'V': type_name =
"class ";
break;
834 case 'Y': type_name =
"cointerface ";
break;
860 if (!
get_modified_type(ct, sym, pmt_ref, in_args ? dt :
'P', in_args))
goto done;
872 const char* call_conv;
873 const char* exported;
875 unsigned mark = sym->
stack.num;
877 const char* modifier;
878 const char* ptr_modif;
887 modifier =
str_printf(sym,
"%s %s", modifier, ptr_modif);
891 &call_conv, &exported,
898 if (!
args)
goto done;
899 sym->
stack.num = mark;
902 sub_ct.
left, sub_ct.
right, call_conv,
class);
908 const char* call_conv;
909 const char* exported;
911 unsigned mark = sym->
stack.num;
916 &call_conv, &exported,
922 if (!
args)
goto done;
923 sym->
stack.num = mark;
941 ct->
left = enum_name;
947 case '0':
case '1':
case '2':
case '3':
case '4':
948 case '5':
case '6':
case '7':
case '8':
case '9':
951 if (!pmt_ref)
goto done;
954 if (!ct->
left)
goto done;
1000 unsigned mark = sym->
stack.num;
1002 const char* arr =
NULL;
1026 sym->
stack.num = mark;
1028 else if (*sym->
current ==
'C')
1030 const char *
ptr, *ptr_modif;
1041 ERR(
"Unknown type %c\n", dt);
1044 if (add_pmt && pmt_ref && in_args)
1064 const char* member_type =
NULL;
1065 const char* modifier =
NULL;
1066 const char* ptr_modif;
1086 case '0':
access =
"private: ";
break;
1087 case '1':
access =
"protected: ";
break;
1088 case '2':
access =
"public: ";
break;
1095 member_type =
"static ";
1102 case '0':
case '1':
case '2':
1103 case '3':
case '4':
case '5':
1105 unsigned mark = sym->
stack.num;
1111 if (!
get_modifier(sym, &modifier, &ptr_modif))
goto done;
1112 if (modifier && ptr_modif) modifier =
str_printf(sym,
"%s %s", modifier, ptr_modif);
1113 else if (!modifier) modifier = ptr_modif;
1114 sym->
stack.num = mark;
1120 if (!
get_modifier(sym, &modifier, &ptr_modif))
goto done;
1139 member_type, ct.
left,
1140 modifier && ct.
left ?
" " :
NULL, modifier,
1157 const char* member_type =
NULL;
1159 const char* call_conv;
1160 const char* modifier =
NULL;
1161 const char* exported;
1162 const char* args_str =
NULL;
1166 struct array array_pmt;
1208 access_id = (*sym->
current -
'0') / 2;
1209 else if (*sym->
current ==
'R')
1210 access_id = (sym->
current[1] -
'0') / 2;
1211 else if (*sym->
current !=
'B')
1214 else if (accmem >=
'A' && accmem <=
'Z')
1215 access_id = (accmem -
'A') / 8;
1221 case 0:
access =
"private: ";
break;
1222 case 1:
access =
"protected: ";
break;
1223 case 2:
access =
"public: ";
break;
1225 if (accmem ==
'$' || (accmem -
'A') % 8 == 6 || (accmem -
'A') % 8 == 7)
1228 if (accmem ==
'$' && *sym->
current !=
'B')
1229 member_type =
"virtual ";
1230 else if (accmem <=
'X')
1232 switch ((accmem -
'A') % 8)
1234 case 2:
case 3: member_type =
"static ";
break;
1235 case 4:
case 5:
case 6:
case 7: member_type =
"virtual ";
break;
1246 if (accmem ==
'$' && *sym->
current ==
'B')
1253 if(!
n || *sym->
current++ !=
'A')
goto done;
1258 else if (accmem ==
'$' && *sym->
current ==
'R')
1268 if(!
n1 || !
n2 || !
n3 || !
n4)
goto done;
1271 else if (accmem ==
'$')
1273 const char *
n1, *
n2;
1279 if (!
n1 || !
n2)
goto done;
1282 else if ((accmem -
'A') % 8 == 6 || (accmem -
'A') % 8 == 7)
1285 if (has_args && (accmem ==
'$' ||
1286 (accmem <=
'X' && (accmem -
'A') % 8 != 2 && (accmem -
'A') % 8 != 3)))
1288 const char *ptr_modif;
1291 if (!
get_modifier(sym, &modifier, &ptr_modif))
goto done;
1292 if (modifier || ptr_modif) modifier =
str_printf(sym,
"%s %s", modifier, ptr_modif);
1302 if (has_ret && *sym->
current ==
'@')
1304 ct_ret.
left =
"void";
1321 mark = sym->
stack.num;
1322 if (has_args && !(args_str =
get_args(sym, &array_pmt,
TRUE,
'(',
')')))
goto done;
1325 sym->
stack.num = mark;
1333 call_conv, call_conv ?
" " :
NULL, exported,
1334 name, args_str, modifier, ct_ret.
right);
1347 unsigned do_after = 0;
1348 static CHAR dashed_null[] =
"--null--";
1370 const char* function_name =
NULL;
1381 case '0': do_after = 1;
break;
1382 case '1': do_after = 2;
break;
1383 case '2': function_name =
"operator new";
break;
1384 case '3': function_name =
"operator delete";
break;
1385 case '4': function_name =
"operator=";
break;
1386 case '5': function_name =
"operator>>";
break;
1387 case '6': function_name =
"operator<<";
break;
1388 case '7': function_name =
"operator!";
break;
1389 case '8': function_name =
"operator==";
break;
1390 case '9': function_name =
"operator!=";
break;
1391 case 'A': function_name =
"operator[]";
break;
1392 case 'B': function_name =
"operator "; do_after = 3;
break;
1393 case 'C': function_name =
"operator->";
break;
1394 case 'D': function_name =
"operator*";
break;
1395 case 'E': function_name =
"operator++";
break;
1396 case 'F': function_name =
"operator--";
break;
1397 case 'G': function_name =
"operator-";
break;
1398 case 'H': function_name =
"operator+";
break;
1399 case 'I': function_name =
"operator&";
break;
1400 case 'J': function_name =
"operator->*";
break;
1401 case 'K': function_name =
"operator/";
break;
1402 case 'L': function_name =
"operator%";
break;
1403 case 'M': function_name =
"operator<";
break;
1404 case 'N': function_name =
"operator<=";
break;
1405 case 'O': function_name =
"operator>";
break;
1406 case 'P': function_name =
"operator>=";
break;
1407 case 'Q': function_name =
"operator,";
break;
1408 case 'R': function_name =
"operator()";
break;
1409 case 'S': function_name =
"operator~";
break;
1410 case 'T': function_name =
"operator^";
break;
1411 case 'U': function_name =
"operator|";
break;
1412 case 'V': function_name =
"operator&&";
break;
1413 case 'W': function_name =
"operator||";
break;
1414 case 'X': function_name =
"operator*=";
break;
1415 case 'Y': function_name =
"operator+=";
break;
1416 case 'Z': function_name =
"operator-=";
break;
1420 case '0': function_name =
"operator/=";
break;
1421 case '1': function_name =
"operator%=";
break;
1422 case '2': function_name =
"operator>>=";
break;
1423 case '3': function_name =
"operator<<=";
break;
1424 case '4': function_name =
"operator&=";
break;
1425 case '5': function_name =
"operator|=";
break;
1426 case '6': function_name =
"operator^=";
break;
1427 case '7': function_name =
"`vftable'";
break;
1428 case '8': function_name =
"`vbtable'";
break;
1429 case '9': function_name =
"`vcall'";
break;
1430 case 'A': function_name =
"`typeof'";
break;
1431 case 'B': function_name =
"`local static guard'";
break;
1432 case 'C': function_name =
"`string'"; do_after = 4;
break;
1433 case 'D': function_name =
"`vbase destructor'";
break;
1434 case 'E': function_name =
"`vector deleting destructor'";
break;
1435 case 'F': function_name =
"`default constructor closure'";
break;
1436 case 'G': function_name =
"`scalar deleting destructor'";
break;
1437 case 'H': function_name =
"`vector constructor iterator'";
break;
1438 case 'I': function_name =
"`vector destructor iterator'";
break;
1439 case 'J': function_name =
"`vector vbase constructor iterator'";
break;
1440 case 'K': function_name =
"`virtual displacement map'";
break;
1441 case 'L': function_name =
"`eh vector constructor iterator'";
break;
1442 case 'M': function_name =
"`eh vector destructor iterator'";
break;
1443 case 'N': function_name =
"`eh vector vbase constructor iterator'";
break;
1444 case 'O': function_name =
"`copy constructor closure'";
break;
1459 function_name =
str_printf(sym,
"%s%s `RTTI Type Descriptor'",
1473 function_name =
str_printf(sym,
"`RTTI Base Class Descriptor at (%s,%s,%s,%s)'",
1477 case '2': function_name =
"`RTTI Base Class Array'";
break;
1478 case '3': function_name =
"`RTTI Class Hierarchy Descriptor'";
break;
1479 case '4': function_name =
"`RTTI Complete Object Locator'";
break;
1481 ERR(
"Unknown RTTI operator: _R%c\n", *sym->
current);
1485 case 'S': function_name =
"`local vftable'";
break;
1486 case 'T': function_name =
"`local vftable constructor closure'";
break;
1487 case 'U': function_name =
"operator new[]";
break;
1488 case 'V': function_name =
"operator delete[]";
break;
1489 case 'X': function_name =
"`placement delete closure'";
break;
1490 case 'Y': function_name =
"`placement delete[] closure'";
break;
1492 ERR(
"Unknown operator: _%c\n", *sym->
current);
1498 ERR(
"Unknown operator: %c\n", *sym->
current);
1509 sym->
result = (
char*)function_name;
1515 struct array array_pmt;
1529 else if (*sym->
current ==
'$')
1543 case '@': sym->
current++;
break;
1553 case 0:
default:
break;
1556 if (sym->
stack.num <= 1)
goto done;
1565 sym->
flags &= ~UNDNAME_NO_FUNCTION_RETURNS;
1610 TRACE(
"(%p,%s,%d,%p,%p,%p,%x)\n",
1652 unsigned short int flags)
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define UNDNAME_NO_MS_KEYWORDS
#define UNDNAME_NO_THISTYPE
#define UNDNAME_NO_LEADING_UNDERSCORES
#define UNDNAME_NO_ALLOCATION_LANGUAGE
#define UNDNAME_NO_ARGUMENTS
#define UNDNAME_NO_FUNCTION_RETURNS
#define UNDNAME_NO_ACCESS_SPECIFIERS
#define UNDNAME_NO_MEMBER_TYPE
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
#define UNDNAME_NAME_ONLY
GLuint GLint GLboolean GLint GLenum access
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
void *(__cdecl * malloc_func_t)(MSVCRT_size_t)
void(__cdecl * free_func_t)(void *)
static unsigned __int64 next
#define UNDNAME_NO_COMPLEX_TYPE
malloc_func_t mem_alloc_ptr
static void und_free_all(struct parsed_symbol *sym)
static BOOL demangle_datatype(struct parsed_symbol *sym, struct datatype_t *ct, struct array *pmt, BOOL in_args)
static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol *sym, struct array *pmt_ref, char modif, BOOL in_args)
static const char * get_number(struct parsed_symbol *sym)
static BOOL get_modifier(struct parsed_symbol *sym, const char **ret, const char **ptr_modif)
static BOOL symbol_demangle(struct parsed_symbol *sym)
static char * get_args(struct parsed_symbol *sym, struct array *pmt_ref, BOOL z_term, char open_char, char close_char)
static BOOL get_calling_convention(char ch, const char **call_conv, const char **exported, unsigned flags)
static void str_array_init(struct array *a)
static char * get_literal_string(struct parsed_symbol *sym)
static char *WINAPIV str_printf(struct parsed_symbol *sym, const char *format,...)
static BOOL str_array_push(struct parsed_symbol *sym, const char *ptr, int len, struct array *a)
static BOOL get_class(struct parsed_symbol *sym)
static const char * get_extended_type(char c)
char *CDECL __unDNameEx(char *buffer, const char *mangled, int buflen, malloc_func_t memget, free_func_t memfree, void *unknown, unsigned short int flags)
static char * get_class_string(struct parsed_symbol *sym, int start)
static BOOL handle_method(struct parsed_symbol *sym, BOOL cast_op)
static char * get_template_name(struct parsed_symbol *sym)
static void * und_alloc(struct parsed_symbol *sym, unsigned int len)
static char * str_array_get_ref(struct array *cref, unsigned idx)
static const char * get_simple_type(char c)
static char * get_class_name(struct parsed_symbol *sym)
char *CDECL __unDName(char *buffer, const char *mangled, int buflen, malloc_func_t memget, free_func_t memfree, unsigned short int flags)
static BOOL handle_data(struct parsed_symbol *sym)