Re: SymGetTypeInfo and TI_GET_DATAKIND

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Oleg Starodumov (oleg_staro_at_hotmail.com)
Date: 04/13/04


Date: Tue, 13 Apr 2004 15:48:18 +0300


Hi,

> This time I want to know if a symbol is constant or a reference.
> I succeed to manage base type, pointer, array and UDT.
>
> but if i got a function like this
>
> - void function(const char* iStr, const MyStruct& iObject);
>
> when I try to recreate the signature of the function I obtained
>
> - void function(char* iStr, MyStruct* iObject);
>
> because I do not know how to get information about constant and reference.
>

"Reference" property is available in DIA, but it is not exposed via SymGetTypeInfo,
so with DbgHelp it is impossible to distinguish between pointers and references.

I don't know how to determine if a pointer is constant, even with DIA.

It looks like WinDbg debugger also cannot distinguish between constant and non-constant
pointers (it uses DbgHelp as its symbol engine), while VC debugger can (it does not use DbgHelp).

> In the cvconst.h from the DIA SDK there is
>
> enum LocationType
> {
> ...
> LocIsConstant,
> ...
> };
>

This is the "location" of a symbol, which describes where the symbol
(variable, function, block, etc.) is located (e.g. in a PE section, in a register,
this-relative (member of a UDT), constant (no location, only value is available), etc.)
and tells which property (in DIA) or SYMBOL_INFO member (in DbgHelp)
to use to get the location.

In DbgHelp, it is available via SYMBOL_INFO.Flags (SYMFLAG_*).

> enum DataKind
> {
> ....
> DataIsConstant
> };
>

This is the "data kind" of a variable (whether it is local, static local, parameter,
static, global, etc.).

It is available via SymGetTypeInfo() with TI_GET_DATAKIND
(supported for SymTagData symbols).

>
> There is the same problem for local variable which are static ? how to
> know it is static ?

Use TI_GET_DATAKIND for SymTagData symbol that represents
the variable, and check whether it is DataIsLocal or DataIsStaticLocal.

Regards,
Oleg



Relevant Pages

  • Cant get lineTranslateAddress() to populate UDT - PLEASE HELP
    ... But only populates 4 of the values in the UDT. ... dwDisplayableStringSize As Long ... Heck they're all zeros except for the number string and the UDT pointer. ...
    (microsoft.public.win32.programmer.tapi)
  • Re: Mass delete files and directories
    ... of the pointer lpszProgressTitle are for some reason being ... I've only tried it out on a few Vista machines, and they very definitely do not store a pointer unless you have at some stage assigned a string value or an empty string. ... If you create a variable of a UDT and if that UDT contains a standard variable length string then VB will leave the four "string pointer" bytes filled with zeros unless you assign something to the string, or unless you have previously done so and it is not a "fresh copy". ... Even if those bytes contain a valid pointer to a string they will cause a serious problem, because the pointer in the UDT data which VB passes to the SHFileOperation function is not in the place where SHFileOperation expects it to be, and is in fact offset by two bytes because of the "Integer padding" I mentioned. ...
    (microsoft.public.vb.general.discussion)
  • Re: Cant get lineTranslateAddress() to populate UDT - PLEASE HELP
    ... But only populates 4 of the values in the UDT. ... I can make it work with the same values with TAPI Browser ... Heck they're all zeros except for the number string and the UDT pointer. ...
    (microsoft.public.win32.programmer.tapi)
  • Re: SendMessage crashing
    ... I am writing ... >Couldn't you pass the pointer of your UDT to the other program and read the ... marshalling shared data cross-process including... ...
    (microsoft.public.vb.winapi)