Skip to content

Commit

Permalink
Use higher level type apis
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemk14ebr committed Oct 13, 2023
1 parent 5f3a1ad commit fd75e4c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions IDAPython/goresym_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ def is_autosync(name, tif):
idaapi.save_struc(struc, False)

def get_type_by_name(name):
ti = idaapi.get_idati()
type_ord = idaapi.get_type_ordinal(ti, name)
# typ_type, typ_fields, typ_cmt, typ_fieldcmts, typ_sclass
return ida_typeinf.get_numbered_type(ti, type_ord)
t = idaapi.tinfo_t()
t.get_named_type(None, name)
return t

def set_function_signature(ea, typedef):
idaapi.apply_type(ea, ida_typeinf.parse_decl(typedef, ida_typeinf.PT_SIL), idaapi.TINFO_DEFINITE)
Expand Down Expand Up @@ -128,8 +127,8 @@ def forward_declare_structs(types):

# IDA often thinks these are string pointers, lets undefine that, then set the type correctly
ida_bytes.del_items(typ['VA'], 0, 4)
abi_typ, abi_typ_fields, _, _, _ = get_type_by_name("abi_Type")
idaapi.apply_type(idaapi.get_idati(), abi_typ, abi_typ_fields, typ['VA'], idaapi.TINFO_DEFINITE)
abi_typ = get_type_by_name("abi_Type")
idaapi.apply_tinfo(typ['VA'], abi_typ, idaapi.TINFO_DEFINITE)

if iterable(hints['Interfaces']):
for typ in hints['Interfaces']:
Expand All @@ -138,8 +137,8 @@ def forward_declare_structs(types):

# IDA often thinks these are string pointers, lets undefine that, then set the type correctly
ida_bytes.del_items(typ['VA'], 0, 4)
abi_typ, abi_typ_fields, _, _, _ = get_type_by_name("abi_Type")
idaapi.apply_type(idaapi.get_idati(), abi_typ, abi_typ_fields, typ['VA'], idaapi.TINFO_DEFINITE)
abi_typ = get_type_by_name("abi_Type")
idaapi.apply_tinfo(typ['VA'], abi_typ, idaapi.TINFO_DEFINITE)

if hints['TabMeta'] is not None:
tabmeta = hints['TabMeta']
Expand Down

0 comments on commit fd75e4c

Please sign in to comment.