|
| DbgHelp - Determining Pointer Data Type |
 |
Tue, 18 Mar 2008 10:37:57 -070 |
Hi All,
I'm able to determine basic types such as char, int, long. However,
when I declare a pointer to a type, SymGetTypeInfo( ...,
TI_GET_BASETYPE, &dwBaseType ) returns false. This is despite the fact
that dwBaseType is set to 0 (BasicType::btNoType).
Should this be handled as a special case? Also, I'm curious why
SymFromName(...) returns a Tag of SymTagData rather than
SymTagPointerType. The basic logic is outlined below.
Thanks in advance for any suggestions.
Jeff
Jeffrey Walton
INT* p
// Buffer is correctly set per MSDN
PSYMBOL_INFO pSymbol = ...
// OK
SymFromName( .., szSymbolName /* p */, pSymbol )
// pSymbol->Tag = SymTagData (not SymTagPointerType?)
// OK
DWORD dwIndex
SymGetTypeInfo( ..., pSymbol->Index, TI_GET_TYPE, &dwIndex )
// dwIndex is index into BaseType Array
// Fails, but dwBaseType is populated
DWORD dwBaseType
SymGetTypeInfo( ..., dwIndex, TI_GET_BASETYPE, &dwBaseType )
|
| Post Reply
|
| Re: DbgHelp - Determining Pointer Data Type |
 |
Tue, 18 Mar 2008 10:39:13 -070 |
Hi All,
I should have mention 6.8.4.0.
Jefff
On Mar 18, 1:37 pm, Jeffrey Walton <noloa...@gmail.com> wrote:
> Hi All,
>
> I'm able to determine basic types such as char, int, long. However,
> when I declare a pointer to a type, SymGetTypeInfo( ...,
> TI_GET_BASETYPE, &dwBaseType ) returns false. This is despite the fact
> that dwBaseType is set to 0 (BasicType::btNoType).
>
|
| Post Reply
|
| Re: DbgHelp - Determining Pointer Data Type |
 |
Tue, 18 Mar 2008 10:48:14 -070 |
On Mar 18, 5:39 pm, Jeffrey Walton <noloa...@gmail.com> wrote:
> Hi All,
>
> I should have mention 6.8.4.0.
>
> Jefff
>
> On Mar 18, 1:37 pm, Jeffrey Walton <noloa...@gmail.com> wrote:> Hi
All,
>
> > I'm able to determine basic types such as char, int, long. However,
> > when I declare a pointer to a type, SymGetTypeInfo( ...,
> > TI_GET_BASETYPE, &dwBaseType ) returns false. This is despite the
fact
> > that dwBaseType is set to 0 (BasicType::btNoType).
>
> [SNIP]
For case SymTagPointerType you get the pointed to type using:
GetTypeInfo( ModBase, TypeIndex, TI_GET_TYPEID, &ti );
and process this like a base type.
Regards,
|
| Post Reply
|
| Re: DbgHelp - Determining Pointer Data Type |
 |
Tue, 18 Mar 2008 11:23:52 -070 |
On Mar 18, 1:48 pm, roger....@gmail.com wrote:
> On Mar 18, 5:39 pm, Jeffrey Walton <noloa...@gmail.com> wrote:
>
> > On Mar 18, 1:37 pm, Jeffrey Walton <noloa...@gmail.com>
wrote:> Hi All,
>
> > > I'm able to determine basic types such as char, int, long.
However,
> > > when I declare a pointer to a type, SymGetTypeInfo( ...,
> > > TI_GET_BASETYPE, &dwBaseType ) returns false. This is despite
the fact
> > > that dwBaseType is set to 0 (BasicType::btNoType).
>
> > [SNIP]
>
> For case SymTagPointerType you get the pointed to type using:
>
> GetTypeInfo( ModBase, TypeIndex, TI_GET_TYPEID, &ti );
>
My issue is that pSymbol->Tag is not SymTagPointerType from
SymFromName(...) on a pointer.
I also called SymGetTypeInfo(..., TI_GET_TYPEID, ...) just in case -
no joy. The result is the same as if I had called with
TI_GET_BASETYPE.
Jeff
|
| Post Reply
|
| Re: DbgHelp - Determining Pointer Data Type |
 |
Tue, 18 Mar 2008 11:57:35 -070 |
Hi Roger,
I see what is going on... Don't trust SYMBOL_INFO.Tag member returned
in SymFromName(...). I imagine that it holds useful information, but
not with respect to what I am doing.
After I call SymFromName(...), I should call SymGetTypeInfo( ...,
TI_GET_SYMTAG, ...) to get a valid tag. Then I can go into the
cracker. I actually found this off of another of your posts [1].
Jeff
[1]
http://groups.google.com/group/microsoft.public.windbg/browse_thread/thread/5d26
372af841c247
On Mar 18, 1:48 pm, roger....@gmail.com wrote:
> On Mar 18, 5:39 pm, Jeffrey Walton <noloa...@gmail.com> wrote:
>
> > Hi All,
>
> > I should have mention 6.8.4.0.
>
> > Jefff
>
> > On Mar 18, 1:37 pm, Jeffrey Walton <noloa...@gmail.com>
wrote:> Hi All,
>
> > > I'm able to determine basic types such as char, int, long.
However,
> > > when I declare a pointer to a type, SymGetTypeInfo( ...,
> > > TI_GET_BASETYPE, &dwBaseType ) returns false. This is despite
the fact
> > > that dwBaseType is set to 0 (BasicType::btNoType).
>
> > [SNIP]
>
> For case SymTagPointerType you get the pointed to type using:
>
> GetTypeInfo( ModBase, TypeIndex, TI_GET_TYPEID, &ti );
>
> and process this like a base type.
>
|
| Post Reply
|
|
|