operand_to_struct_member

summary: turn instruction operand into a structure offset

description:

The goal of this script is to demonstrate some usage of the type API. In this script, we:

  • ask the user to choose the structure that will be used for

the conversion. * build the structure path and call ida_bytes.op_stroff. In case an enum is found a modal chooser is displayed in order to select a member.

level: advanced

Classes

union_member_chooser_t

Chooser wrapper class.

Functions

choose_union_member(tif)

Display a chooser containing the list of the union

build_strpath(tif, offset)

Build the structure path and return it.

main(ea)

Module Contents

class operand_to_struct_member.union_member_chooser_t(title, udm_list)

Bases: ida_kernwin.Choose

Chooser wrapper class.

Some constants are defined in this class. Please refer to kernwin.hpp for more information.

items
icon = 5
OnGetSize()

Get the number of elements in the chooser.

This callback is mandatory

Returns:

the number of elements

OnGetLine(n)

Get data for an element

This callback is mandatory

Parameters:

n – the index to fetch data for

Returns:

a list of strings

operand_to_struct_member.choose_union_member(tif)

Display a chooser containing the list of the union members. The selected entry (0-based) is returned or -1.

operand_to_struct_member.build_strpath(tif, offset)

Build the structure path and return it.

operand_to_struct_member.main(ea)