📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  IDA Pro  >>  IDAPython: get_typeinfo() broken?

Topic created on: June 17, 2007 13:45 CDT by stahl .

hi

i want to get the size of an operand (op 0 at ea)

sadly, idapython does not implement get_dtyp_size function...

so i wanted to do it manualy by

flags = idaapi.getFlags(ea)
ti = idaapi.get_typeinfo(ins,0,flags)
size = idaapi.get_data_type_size(flags,ti)
print "size", size

this doesnt work (get_type_info needs 4 args, 3 given)

so i tried:
ti = idaapi.typeinfo_t()
flags = idaapi.getFlags(ea)
idaapi.get_typeinfo(ins,0,flags, ti)
size = idaapi.get_data_type_size(flags,ti)
print "size", size

then size is always 1 (which is incorrect)

what am i doing wrong? how to do it right?

it seems to me that get_typeinfo should not need a fourth arg and return typeinfo instead?!

please help! thanks!

  gera     June 17, 2007 21:53.02 CDT
I don't know what's wrong, but get_typeinfo() apparently does need a 4th arg. I'm concluding this by looking at idc.py, where you can find something pretty similar to what you are doing:


def GetStringType(ea):
"""
Get string type

@param ea: linear address

Returns one of ASCSTR_... constants
"""
ti = idaapi.typeinfo_t()

if idaapi.get_typeinfo(ea, 0, GetFlags(ea), ti):
return ti.strtype
else:
return None


maybe you saw that already.

In any case, either get_typeinfo does take a 4th arg, or there's something wrong in idc.py (in the code I pasted)

  Dyce     June 19, 2007 12:28.55 CDT
Hi,

> stahl: hi
>
> i want to get the size of an operand (op 0 at ea)
>
> sadly, idapython does not implement get_dtyp_size function...

Now it does. ;) If you have IDA Pro 5.1, you can give the 0.9.51 test build
a quick spin. What you are looking for is done with the following code:


ua_ana0(here())
print get_dtyp_size(get_instruction_operand(cvar.cmd, 0).dtyp[0])


The test build is available from http://d-dome.net/idapython/testreleases


Gergo

  jms     June 20, 2007 10:07.23 CDT
Hey Gergo,

Did you ever take a look at the memory leak I sent in to you?

  stahl   June 22, 2007 07:54.49 CDT
hi dyce,

i am still  using ida 5.0.

is there any other way doing this here?

thanks for your answers!

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit