|
Hello, I am trying to automate the process of identifying structures then retyping the associated fields. I have been able to retype the necessary variables into a structure but I want to change the display type for a specific field. This field is a bitflag whose values are defined in an enumeration -- left as an integer it is tricky to immediately see what is being set. I have written the following in the Binja console: inst.function.source_function.set_int_display_type(
inst.address,
2,
IntegerDisplayType.EnumerationDisplayType, bv.get_type_id("MyEnum")
)Which is supposed to change the display type of an MLIL instruction (where into types defined by If I were to assign the field type to I'm not sure how to correctly determine the |
Replies: 1 comment
|
Apoligies for the delayed reply, we have had our heads down releasing Binary Ninja 5.2 for the past few weeks. You can retrieve the type id like so: >>> current_view.get_type_by_name('MyEnum').registered_name.type_id
'3fc496d9-f8a4-4ab5-a4ac-695cf24e4dfb' # Will differ for youExample: Screen.Recording.2025-11-20.at.7.21.01.PM.movtarget_typeid = current_view.get_type_by_name('RenderOptions').registered_name.type_id
target_address = 0x140002351
current_function.set_int_display_type(target_address, 0x155, 0xffffffff, IntegerDisplayType.EnumerationDisplayType, enum_display_typeid=target_typeid) |
Apoligies for the delayed reply, we have had our heads down releasing Binary Ninja 5.2 for the past few weeks.
You can retrieve the type id like so:
>>> current_view.get_type_by_name('MyEnum').registered_name.type_id '3fc496d9-f8a4-4ab5-a4ac-695cf24e4dfb' # Will differ for youExample:
Screen.Recording.2025-11-20.at.7.21.01.PM.mov