From fd75e4c4f89d889f4d8d87ae2e65a58ffd9aae8d Mon Sep 17 00:00:00 2001 From: Stephen Eckels Date: Fri, 13 Oct 2023 10:39:03 -0400 Subject: [PATCH] Use higher level type apis --- IDAPython/goresym_rename.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/IDAPython/goresym_rename.py b/IDAPython/goresym_rename.py index 3d02f6e..33b8e4d 100644 --- a/IDAPython/goresym_rename.py +++ b/IDAPython/goresym_rename.py @@ -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) @@ -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']: @@ -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']