De onderstaande snippet is de omgedraaide versie van MakeStruct:
def GetStructureIdAt(ea): flags = idaapi.getFlags(ea) if isStruct(flags): ti = idaapi.opinfo_t() idaapi.get_opinfo(ea, 0, flags, ti), "get_opinfo() failed" return ti.tid return BADADDR
tid = GetStructureIdAt(ScreenEA()) print GetStrucName(tid)
NOTA: de onderstaande versie is compatibel met oudere versies van IDA-python:
def GetStructureIdAt(ea): flags = idaapi.getFlags(ea) if isStruct(flags): try: ti = idaapi.typeinfo_t() assert idaapi.get_typeinfo(ea, 0, flags, ti), "get_typeinfo() failed" except AttributeError: ti = idaapi.opinfo_t() assert idaapi.get_opinfo(ea, 0, flags, ti), "get_opinfo() failed" return ti.tid return BADADDR
09-11-2012, 00:00
Geschreven door Fibergeek 
|