ida-minsc: Unable to set a structure member's custom type, it always is 'int'

@arizvisa hi, I have to come and ask you questions, I don’t know what went wrong, I can’t set the member’s custom type , it awaly is ‘int’:

import idaapi
import idc


st1 =structure.by_name('TTDBTextInfoGroup')
struct_name = 'TTDBTextInfoGroup*'
f1 = st1.members.by(offset=0)

print f1.typeinfo.dstr()
ordinal = f1.typeinfo.get_ordinal()
f1.typeinfo.set_numbered_type(idaapi.cvar.idati,ordinal,BTF_STRUCT, struct_name)
print f1.typeinfo.dstr()

_Originally posted by @gool123456 in https://github.com/arizvisa/ida-minsc/issues/61#issuecomment-664488530_

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Okay. Try PR #63 again. I also cleaned up the typeinfo so that it’s properly emitted when displaying the structure member or listing them with struc.list().

@arizvisa Show Error :

Script Default snippet error: Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "C:\Users\Hskyre\AppData\Roaming\Hex-Rays\IDA Pro\base\structure.py", line 1615, in typeinfo
    @typeinfo.setter
  File "C:\Users\Hskyre\AppData\Roaming\Hex-Rays\IDA Pro\base\_utils.py", line 988, in wrapper
    return F(*res, **kwds)
  File "C:\Users\Hskyre\AppData\Roaming\Hex-Rays\IDA Pro\base\structure.py", line 1634, in typeinfo
    res = idaapi.parse_decl2(til, terminated, ti, idaapi.PT_SIL) if idaapi.__version__ < 7.0 else idaapi.parse_decl(ti, til, terminated, idaapi.PT_SIL)
  File "D:\tools\IDA_Pro_v6.8_and_Hex-Rays_Decompiler_(ARM,x64,x86)_Hskyre\python\idaapi.py", line 32392, in parse_decl2
    return _idaapi.parse_decl2(*args)
TypeError: parse_decl2 expected 5 arguments, got 4

Ahh. Okay. Seems like IDA 6.8’s API is completely different from IDA 7.x’s. Lemme see what IDA 6.8 expects you to do here and create a PR.