2 * File types.c - management of types (hierarchical tree)
4 * Copyright (C) 1997, Eric Youngdale.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * Note: This really doesn't do much at the moment, but it forms the framework
22 * upon which full support for datatype handling will eventually be built.
32 #include "wine/debug.h"
33 #include "dbghelp_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp
);
36 WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt
);
38 static const char* symt_get_tag_str(DWORD tag
)
42 case SymTagNull
: return "SymTagNull";
43 case SymTagExe
: return "SymTagExe";
44 case SymTagCompiland
: return "SymTagCompiland";
45 case SymTagCompilandDetails
: return "SymTagCompilandDetails";
46 case SymTagCompilandEnv
: return "SymTagCompilandEnv";
47 case SymTagFunction
: return "SymTagFunction";
48 case SymTagBlock
: return "SymTagBlock";
49 case SymTagData
: return "SymTagData";
50 case SymTagAnnotation
: return "SymTagAnnotation";
51 case SymTagLabel
: return "SymTagLabel";
52 case SymTagPublicSymbol
: return "SymTagPublicSymbol";
53 case SymTagUDT
: return "SymTagUDT";
54 case SymTagEnum
: return "SymTagEnum";
55 case SymTagFunctionType
: return "SymTagFunctionType";
56 case SymTagPointerType
: return "SymTagPointerType";
57 case SymTagArrayType
: return "SymTagArrayType";
58 case SymTagBaseType
: return "SymTagBaseType";
59 case SymTagTypedef
: return "SymTagTypedef,";
60 case SymTagBaseClass
: return "SymTagBaseClass";
61 case SymTagFriend
: return "SymTagFriend";
62 case SymTagFunctionArgType
: return "SymTagFunctionArgType,";
63 case SymTagFuncDebugStart
: return "SymTagFuncDebugStart,";
64 case SymTagFuncDebugEnd
: return "SymTagFuncDebugEnd";
65 case SymTagUsingNamespace
: return "SymTagUsingNamespace,";
66 case SymTagVTableShape
: return "SymTagVTableShape";
67 case SymTagVTable
: return "SymTagVTable";
68 case SymTagCustom
: return "SymTagCustom";
69 case SymTagThunk
: return "SymTagThunk";
70 case SymTagCustomType
: return "SymTagCustomType";
71 case SymTagManagedType
: return "SymTagManagedType";
72 case SymTagDimension
: return "SymTagDimension";
73 default: return "---";
77 const char* symt_get_name(const struct symt
* sym
)
82 case SymTagData
: return ((const struct symt_data
*)sym
)->hash_elt
.name
;
83 case SymTagFunction
: return ((const struct symt_function
*)sym
)->hash_elt
.name
;
84 case SymTagPublicSymbol
: return ((const struct symt_public
*)sym
)->hash_elt
.name
;
85 case SymTagBaseType
: return ((const struct symt_basic
*)sym
)->hash_elt
.name
;
86 case SymTagLabel
: return ((const struct symt_hierarchy_point
*)sym
)->hash_elt
.name
;
87 case SymTagThunk
: return ((const struct symt_thunk
*)sym
)->hash_elt
.name
;
89 case SymTagEnum
: return ((const struct symt_enum
*)sym
)->name
;
90 case SymTagTypedef
: return ((const struct symt_typedef
*)sym
)->hash_elt
.name
;
91 case SymTagUDT
: return ((const struct symt_udt
*)sym
)->hash_elt
.name
;
93 FIXME("Unsupported sym-tag %s\n", symt_get_tag_str(sym
->tag
));
96 case SymTagPointerType
:
97 case SymTagFunctionType
:
102 static struct symt
* symt_find_type_by_name(const struct module
* module
,
103 enum SymTagEnum sym_tag
,
104 const char* typename
)
107 struct symt_ht
* type
;
108 struct hash_table_iter hti
;
113 hash_table_iter_init(&module
->ht_types
, &hti
, typename
);
114 while ((ptr
= hash_table_iter_up(&hti
)))
116 type
= GET_ENTRY(ptr
, struct symt_ht
, hash_elt
);
118 if ((sym_tag
== SymTagNull
|| type
->symt
.tag
== sym_tag
) &&
119 type
->hash_elt
.name
&& !strcmp(type
->hash_elt
.name
, typename
))
122 SetLastError(ERROR_INVALID_NAME
); /* FIXME ?? */
126 static void symt_add_type(struct module
* module
, struct symt
* symt
)
129 p
= vector_add(&module
->vtypes
, &module
->pool
);
134 struct symt_basic
* symt_new_basic(struct module
* module
, enum BasicType bt
,
135 const char* typename
, unsigned size
)
137 struct symt_basic
* sym
;
141 sym
= (struct symt_basic
*)symt_find_type_by_name(module
, SymTagBaseType
,
143 if (sym
&& sym
->bt
== bt
&& sym
->size
== size
)
146 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
148 sym
->symt
.tag
= SymTagBaseType
;
151 sym
->hash_elt
.name
= pool_strdup(&module
->pool
, typename
);
152 hash_table_add(&module
->ht_types
, &sym
->hash_elt
);
153 } else sym
->hash_elt
.name
= NULL
;
156 symt_add_type(module
, &sym
->symt
);
161 struct symt_udt
* symt_new_udt(struct module
* module
, const char* typename
,
162 unsigned size
, enum UdtKind kind
)
164 struct symt_udt
* sym
;
166 TRACE_(dbghelp_symt
)("Adding udt %s:%s\n",
167 debugstr_w(module
->module
.ModuleName
), typename
);
168 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
170 sym
->symt
.tag
= SymTagUDT
;
175 sym
->hash_elt
.name
= pool_strdup(&module
->pool
, typename
);
176 hash_table_add(&module
->ht_types
, &sym
->hash_elt
);
177 } else sym
->hash_elt
.name
= NULL
;
178 vector_init(&sym
->vchildren
, sizeof(struct symt
*), 8);
179 symt_add_type(module
, &sym
->symt
);
184 BOOL
symt_set_udt_size(struct module
* module
, struct symt_udt
* udt
, unsigned size
)
186 assert(udt
->symt
.tag
== SymTagUDT
);
187 if (vector_length(&udt
->vchildren
) != 0)
189 if (udt
->size
!= size
)
190 FIXME_(dbghelp_symt
)("Changing size for %s from %u to %u\n",
191 udt
->hash_elt
.name
, udt
->size
, size
);
198 /******************************************************************
199 * symt_add_udt_element
201 * add an element to a udt (struct, class, union)
202 * the size & offset parameters are expressed in bits (not bytes) so that
203 * we can mix in the single call bytes aligned elements (regular fields) and
204 * the others (bit fields)
206 BOOL
symt_add_udt_element(struct module
* module
, struct symt_udt
* udt_type
,
207 const char* name
, struct symt
* elt_type
,
208 unsigned offset
, unsigned size
)
213 assert(udt_type
->symt
.tag
== SymTagUDT
);
215 TRACE_(dbghelp_symt
)("Adding %s to UDT %s\n", name
, udt_type
->hash_elt
.name
);
219 for (i
=0; i
<vector_length(&udt_type
->vchildren
); i
++)
221 m
= *(struct symt_data
**)vector_at(&udt_type
->vchildren
, i
);
223 assert(m
->symt
.tag
== SymTagData
);
224 if (strcmp(m
->hash_elt
.name
, name
) == 0)
229 if ((m
= pool_alloc(&module
->pool
, sizeof(*m
))) == NULL
) return FALSE
;
230 memset(m
, 0, sizeof(*m
));
231 m
->symt
.tag
= SymTagData
;
232 m
->hash_elt
.name
= name
? pool_strdup(&module
->pool
, name
) : "";
233 m
->hash_elt
.next
= NULL
;
235 m
->kind
= DataIsMember
;
236 m
->container
= &udt_type
->symt
;
238 m
->u
.member
.offset
= offset
;
239 m
->u
.member
.length
= ((offset
& 7) || (size
& 7)) ? size
: 0;
240 p
= vector_add(&udt_type
->vchildren
, &module
->pool
);
246 struct symt_enum
* symt_new_enum(struct module
* module
, const char* typename
,
247 struct symt
* basetype
)
249 struct symt_enum
* sym
;
251 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
253 sym
->symt
.tag
= SymTagEnum
;
254 sym
->name
= (typename
) ? pool_strdup(&module
->pool
, typename
) : NULL
;
255 sym
->base_type
= basetype
;
256 vector_init(&sym
->vchildren
, sizeof(struct symt
*), 8);
261 BOOL
symt_add_enum_element(struct module
* module
, struct symt_enum
* enum_type
,
262 const char* name
, int value
)
267 assert(enum_type
->symt
.tag
== SymTagEnum
);
268 e
= pool_alloc(&module
->pool
, sizeof(*e
));
269 if (e
== NULL
) return FALSE
;
271 e
->symt
.tag
= SymTagData
;
272 e
->hash_elt
.name
= pool_strdup(&module
->pool
, name
);
273 e
->hash_elt
.next
= NULL
;
274 e
->kind
= DataIsConstant
;
275 e
->container
= &enum_type
->symt
;
276 e
->type
= enum_type
->base_type
;
277 e
->u
.value
.n1
.n2
.vt
= VT_I4
;
278 e
->u
.value
.n1
.n2
.n3
.lVal
= value
;
280 p
= vector_add(&enum_type
->vchildren
, &module
->pool
);
281 if (!p
) return FALSE
; /* FIXME we leak e */
287 struct symt_array
* symt_new_array(struct module
* module
, int min
, int max
,
288 struct symt
* base
, struct symt
* index
)
290 struct symt_array
* sym
;
292 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
294 sym
->symt
.tag
= SymTagArrayType
;
297 sym
->base_type
= base
;
298 sym
->index_type
= index
;
299 symt_add_type(module
, &sym
->symt
);
304 struct symt_function_signature
* symt_new_function_signature(struct module
* module
,
305 struct symt
* ret_type
,
306 enum CV_call_e call_conv
)
308 struct symt_function_signature
* sym
;
310 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
312 sym
->symt
.tag
= SymTagFunctionType
;
313 sym
->rettype
= ret_type
;
314 vector_init(&sym
->vchildren
, sizeof(struct symt
*), 4);
315 sym
->call_conv
= call_conv
;
316 symt_add_type(module
, &sym
->symt
);
321 BOOL
symt_add_function_signature_parameter(struct module
* module
,
322 struct symt_function_signature
* sig_type
,
326 struct symt_function_arg_type
* arg
;
328 assert(sig_type
->symt
.tag
== SymTagFunctionType
);
329 arg
= pool_alloc(&module
->pool
, sizeof(*arg
));
330 if (!arg
) return FALSE
;
331 arg
->symt
.tag
= SymTagFunctionArgType
;
332 arg
->arg_type
= param
;
333 arg
->container
= &sig_type
->symt
;
334 p
= vector_add(&sig_type
->vchildren
, &module
->pool
);
335 if (!p
) return FALSE
; /* FIXME we leak arg */
341 struct symt_pointer
* symt_new_pointer(struct module
* module
, struct symt
* ref_type
)
343 struct symt_pointer
* sym
;
345 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
347 sym
->symt
.tag
= SymTagPointerType
;
348 sym
->pointsto
= ref_type
;
349 symt_add_type(module
, &sym
->symt
);
354 struct symt_typedef
* symt_new_typedef(struct module
* module
, struct symt
* ref
,
357 struct symt_typedef
* sym
;
359 if ((sym
= pool_alloc(&module
->pool
, sizeof(*sym
))))
361 sym
->symt
.tag
= SymTagTypedef
;
363 sym
->hash_elt
.name
= pool_strdup(&module
->pool
, name
);
364 hash_table_add(&module
->ht_types
, &sym
->hash_elt
);
365 symt_add_type(module
, &sym
->symt
);
370 /******************************************************************
371 * SymEnumTypes (DBGHELP.@)
374 BOOL WINAPI
SymEnumTypes(HANDLE hProcess
, ULONG64 BaseOfDll
,
375 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
,
378 struct module_pair pair
;
379 char buffer
[sizeof(SYMBOL_INFO
) + 256];
380 SYMBOL_INFO
* sym_info
= (SYMBOL_INFO
*)buffer
;
386 TRACE("(%p %s %p %p)\n",
387 hProcess
, wine_dbgstr_longlong(BaseOfDll
), EnumSymbolsCallback
,
390 if (!(pair
.pcs
= process_find_by_handle(hProcess
))) return FALSE
;
391 pair
.requested
= module_find_by_addr(pair
.pcs
, BaseOfDll
, DMT_UNKNOWN
);
392 if (!module_get_debug(&pair
)) return FALSE
;
394 sym_info
->SizeOfStruct
= sizeof(SYMBOL_INFO
);
395 sym_info
->MaxNameLen
= sizeof(buffer
) - sizeof(SYMBOL_INFO
);
397 for (i
=0; i
<vector_length(&pair
.effective
->vtypes
); i
++)
399 type
= *(struct symt
**)vector_at(&pair
.effective
->vtypes
, i
);
400 sym_info
->TypeIndex
= (DWORD
)type
;
401 sym_info
->info
= 0; /* FIXME */
402 symt_get_info(type
, TI_GET_LENGTH
, &size
);
403 sym_info
->Size
= size
;
404 sym_info
->ModBase
= pair
.requested
->module
.BaseOfImage
;
405 sym_info
->Flags
= 0; /* FIXME */
406 sym_info
->Value
= 0; /* FIXME */
407 sym_info
->Address
= 0; /* FIXME */
408 sym_info
->Register
= 0; /* FIXME */
409 sym_info
->Scope
= 0; /* FIXME */
410 sym_info
->Tag
= type
->tag
;
411 tmp
= symt_get_name(type
);
414 sym_info
->NameLen
= min(strlen(tmp
),sym_info
->MaxNameLen
-1);
415 memcpy(sym_info
->Name
, tmp
, sym_info
->NameLen
);
416 sym_info
->Name
[sym_info
->NameLen
] = '\0';
419 sym_info
->Name
[sym_info
->NameLen
= 0] = '\0';
420 if (!EnumSymbolsCallback(sym_info
, sym_info
->Size
, UserContext
)) break;
425 struct enum_types_AtoW
427 char buffer
[sizeof(SYMBOL_INFOW
) + 256 * sizeof(WCHAR
)];
429 PSYM_ENUMERATESYMBOLS_CALLBACKW callback
;
432 BOOL CALLBACK
enum_types_AtoW(PSYMBOL_INFO si
, ULONG addr
, PVOID _et
)
434 struct enum_types_AtoW
* et
= _et
;
435 SYMBOL_INFOW
* siW
= (SYMBOL_INFOW
*)et
->buffer
;
437 copy_symbolW(siW
, si
);
438 return et
->callback(siW
, addr
, et
->user
);
441 /******************************************************************
442 * SymEnumTypesW (DBGHELP.@)
445 BOOL WINAPI
SymEnumTypesW(HANDLE hProcess
, ULONG64 BaseOfDll
,
446 PSYM_ENUMERATESYMBOLS_CALLBACKW EnumSymbolsCallback
,
449 struct enum_types_AtoW et
;
451 et
.callback
= EnumSymbolsCallback
;
452 et
.user
= UserContext
;
454 return SymEnumTypes(hProcess
, BaseOfDll
, enum_types_AtoW
, &et
);
457 /******************************************************************
460 * Retrieves information about a symt (either symbol or type)
462 BOOL
symt_get_info(const struct symt
* type
, IMAGEHLP_SYMBOL_TYPE_INFO req
,
467 if (!type
) return FALSE
;
469 /* helper to typecast pInfo to its expected type (_t) */
470 #define X(_t) (*((_t*)pInfo))
474 case TI_FINDCHILDREN
:
476 const struct vector
* v
;
479 TI_FINDCHILDREN_PARAMS
* tifp
= pInfo
;
483 case SymTagUDT
: v
= &((const struct symt_udt
*)type
)->vchildren
; break;
484 case SymTagEnum
: v
= &((const struct symt_enum
*)type
)->vchildren
; break;
485 case SymTagFunctionType
: v
= &((const struct symt_function_signature
*)type
)->vchildren
; break;
486 case SymTagFunction
: v
= &((const struct symt_function
*)type
)->vchildren
; break;
488 FIXME("Unsupported sym-tag %s for find-children\n",
489 symt_get_tag_str(type
->tag
));
492 for (i
= 0; i
< tifp
->Count
; i
++)
494 if (!(pt
= vector_at(v
, tifp
->Start
+ i
))) return FALSE
;
495 tifp
->ChildId
[i
] = (DWORD
)*pt
;
504 switch (((const struct symt_data
*)type
)->kind
)
507 case DataIsFileStatic
:
508 X(ULONG64
) = ((const struct symt_data
*)type
)->u
.var
.offset
;
510 default: return FALSE
;
514 X(ULONG64
) = ((const struct symt_function
*)type
)->address
;
516 case SymTagPublicSymbol
:
517 X(ULONG64
) = ((const struct symt_public
*)type
)->address
;
519 case SymTagFuncDebugStart
:
520 case SymTagFuncDebugEnd
:
522 if (!symt_get_info(((const struct symt_hierarchy_point
*)type
)->parent
,
525 X(ULONG64
) += ((const struct symt_hierarchy_point
*)type
)->loc
.offset
;
528 X(ULONG64
) = ((const struct symt_thunk
*)type
)->address
;
530 case SymTagCompiland
:
531 X(ULONG64
) = ((const struct symt_compiland
*)type
)->address
;
534 FIXME("Unsupported sym-tag %s for get-address\n",
535 symt_get_tag_str(type
->tag
));
540 case TI_GET_BASETYPE
:
544 X(DWORD
) = ((const struct symt_basic
*)type
)->bt
;
554 case TI_GET_BITPOSITION
:
555 if (type
->tag
== SymTagData
&&
556 ((const struct symt_data
*)type
)->kind
== DataIsMember
&&
557 ((const struct symt_data
*)type
)->u
.member
.length
!= 0)
558 X(DWORD
) = ((const struct symt_data
*)type
)->u
.member
.offset
& 7;
562 case TI_GET_CHILDRENCOUNT
:
566 X(DWORD
) = vector_length(&((const struct symt_udt
*)type
)->vchildren
);
569 X(DWORD
) = vector_length(&((const struct symt_enum
*)type
)->vchildren
);
571 case SymTagFunctionType
:
572 X(DWORD
) = vector_length(&((const struct symt_function_signature
*)type
)->vchildren
);
575 X(DWORD
) = vector_length(&((const struct symt_function
*)type
)->vchildren
);
577 case SymTagPointerType
: /* MS does it that way */
578 case SymTagArrayType
: /* MS does it that way */
579 case SymTagThunk
: /* MS does it that way */
583 FIXME("Unsupported sym-tag %s for get-children-count\n",
584 symt_get_tag_str(type
->tag
));
587 case SymTagPublicSymbol
:
596 case SymTagArrayType
:
597 X(DWORD
) = ((const struct symt_array
*)type
)->end
-
598 ((const struct symt_array
*)type
)->start
+ 1;
600 case SymTagFunctionType
:
601 /* this seems to be wrong for (future) C++ methods, where 'this' parameter
602 * should be included in this value (and not in GET_CHILDREN_COUNT)
604 X(DWORD
) = vector_length(&((const struct symt_function_signature
*)type
)->vchildren
);
606 default: return FALSE
;
610 case TI_GET_DATAKIND
:
611 if (type
->tag
!= SymTagData
) return FALSE
;
612 X(DWORD
) = ((const struct symt_data
*)type
)->kind
;
619 X(DWORD64
) = ((const struct symt_basic
*)type
)->size
;
622 X(DWORD64
) = ((const struct symt_function
*)type
)->size
;
624 case SymTagPointerType
:
625 X(DWORD64
) = sizeof(void*);
628 X(DWORD64
) = ((const struct symt_udt
*)type
)->size
;
631 X(DWORD64
) = sizeof(int); /* FIXME: should be size of base-type of enum !!! */
634 if (((const struct symt_data
*)type
)->kind
!= DataIsMember
||
635 !((const struct symt_data
*)type
)->u
.member
.length
)
637 X(DWORD64
) = ((const struct symt_data
*)type
)->u
.member
.length
;
639 case SymTagArrayType
:
640 if (!symt_get_info(((const struct symt_array
*)type
)->base_type
,
641 TI_GET_LENGTH
, pInfo
))
643 X(DWORD64
) *= ((const struct symt_array
*)type
)->end
-
644 ((const struct symt_array
*)type
)->start
+ 1;
646 case SymTagPublicSymbol
:
647 X(DWORD64
) = ((const struct symt_public
*)type
)->size
;
650 return symt_get_info(((const struct symt_typedef
*)type
)->type
, TI_GET_LENGTH
, pInfo
);
652 X(DWORD64
) = ((const struct symt_thunk
*)type
)->size
;
658 FIXME("Unsupported sym-tag %s for get-length\n",
659 symt_get_tag_str(type
->tag
));
661 case SymTagFunctionType
:
666 case TI_GET_LEXICALPARENT
:
670 X(DWORD
) = (DWORD
)((const struct symt_block
*)type
)->container
;
673 X(DWORD
) = (DWORD
)((const struct symt_data
*)type
)->container
;
676 X(DWORD
) = (DWORD
)((const struct symt_function
*)type
)->container
;
679 X(DWORD
) = (DWORD
)((const struct symt_thunk
*)type
)->container
;
681 case SymTagFunctionArgType
:
682 X(DWORD
) = (DWORD
)((const struct symt_function_arg_type
*)type
)->container
;
685 FIXME("Unsupported sym-tag %s for get-lexical-parent\n",
686 symt_get_tag_str(type
->tag
));
707 switch (((const struct symt_data
*)type
)->kind
)
711 X(ULONG
) = ((const struct symt_data
*)type
)->u
.var
.offset
;
714 X(ULONG
) = ((const struct symt_data
*)type
)->u
.member
.offset
>> 3;
717 FIXME("Unknown kind (%u) for get-offset\n",
718 ((const struct symt_data
*)type
)->kind
);
723 FIXME("Unsupported sym-tag %s for get-offset\n",
724 symt_get_tag_str(type
->tag
));
731 const char* name
= symt_get_name(type
);
732 if (!name
) return FALSE
;
733 len
= MultiByteToWideChar(CP_ACP
, 0, name
, -1, NULL
, 0);
734 X(WCHAR
*) = HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
735 if (!X(WCHAR
*)) return FALSE
;
736 MultiByteToWideChar(CP_ACP
, 0, name
, -1, X(WCHAR
*), len
);
741 X(DWORD
) = type
->tag
;
748 /* hierarchical => hierarchical */
749 case SymTagArrayType
:
750 X(DWORD
) = (DWORD
)((const struct symt_array
*)type
)->base_type
;
752 case SymTagPointerType
:
753 X(DWORD
) = (DWORD
)((const struct symt_pointer
*)type
)->pointsto
;
755 case SymTagFunctionType
:
756 X(DWORD
) = (DWORD
)((const struct symt_function_signature
*)type
)->rettype
;
759 X(DWORD
) = (DWORD
)((const struct symt_typedef
*)type
)->type
;
761 /* lexical => hierarchical */
763 X(DWORD
) = (DWORD
)((const struct symt_data
*)type
)->type
;
766 X(DWORD
) = (DWORD
)((const struct symt_function
*)type
)->type
;
769 X(DWORD
) = (DWORD
)((const struct symt_enum
*)type
)->base_type
;
771 case SymTagFunctionArgType
:
772 X(DWORD
) = (DWORD
)((const struct symt_function_arg_type
*)type
)->arg_type
;
775 FIXME("Unsupported sym-tag %s for get-type\n",
776 symt_get_tag_str(type
->tag
));
777 case SymTagPublicSymbol
:
785 if (type
->tag
!= SymTagUDT
) return FALSE
;
786 X(DWORD
) = ((const struct symt_udt
*)type
)->kind
;
790 if (type
->tag
!= SymTagData
|| ((const struct symt_data
*)type
)->kind
!= DataIsConstant
)
792 X(VARIANT
) = ((const struct symt_data
*)type
)->u
.value
;
795 case TI_GET_CALLING_CONVENTION
:
796 if (type
->tag
!= SymTagFunctionType
) return FALSE
;
797 if (((const struct symt_function_signature
*)type
)->call_conv
== -1)
799 FIXME("No support for calling convention for this signature\n");
800 X(DWORD
) = CV_CALL_FAR_C
; /* FIXME */
802 else X(DWORD
) = ((const struct symt_function_signature
*)type
)->call_conv
;
804 case TI_GET_ARRAYINDEXTYPEID
:
805 if (type
->tag
!= SymTagArrayType
) return FALSE
;
806 X(DWORD
) = (DWORD
)((const struct symt_array
*)type
)->index_type
;
809 case TI_GET_CLASSPARENTID
:
810 /* FIXME: we don't support properly C++ for now, pretend this symbol doesn't
811 * belong to a parent class
817 case TI_GET_ADDRESSOFFSET
:
818 case TI_GET_SYMINDEX
:
819 case TI_GET_THISADJUST
:
820 case TI_GET_VIRTUALBASECLASS
:
821 case TI_GET_VIRTUALBASEPOINTEROFFSET
:
822 case TI_GET_VIRTUALTABLESHAPEID
:
824 FIXME("Unsupported GetInfo request (%u)\n", req
);
827 FIXME("Unknown GetInfo request (%u)\n", req
);
834 /******************************************************************
835 * SymGetTypeInfo (DBGHELP.@)
838 BOOL WINAPI
SymGetTypeInfo(HANDLE hProcess
, DWORD64 ModBase
,
839 ULONG TypeId
, IMAGEHLP_SYMBOL_TYPE_INFO GetType
,
842 struct module_pair pair
;
844 pair
.pcs
= process_find_by_handle(hProcess
);
845 if (!pair
.pcs
) return FALSE
;
847 pair
.requested
= module_find_by_addr(pair
.pcs
, ModBase
, DMT_UNKNOWN
);
848 if (!module_get_debug(&pair
))
850 FIXME("Someone didn't properly set ModBase (%s)\n", wine_dbgstr_longlong(ModBase
));
854 return symt_get_info((struct symt
*)TypeId
, GetType
, pInfo
);
857 /******************************************************************
858 * SymGetTypeFromName (DBGHELP.@)
861 BOOL WINAPI
SymGetTypeFromName(HANDLE hProcess
, ULONG64 BaseOfDll
,
862 PCSTR Name
, PSYMBOL_INFO Symbol
)
864 struct process
* pcs
= process_find_by_handle(hProcess
);
865 struct module
* module
;
868 if (!pcs
) return FALSE
;
869 module
= module_find_by_addr(pcs
, BaseOfDll
, DMT_UNKNOWN
);
870 if (!module
) return FALSE
;
871 type
= symt_find_type_by_name(module
, SymTagNull
, Name
);
872 if (!type
) return FALSE
;
873 Symbol
->TypeIndex
= (DWORD
)type
;