Types
types
Classes:
-
ArrayDetails
– -
BitfieldAttr
–Bitfield Type flags
-
BitfieldDetails
–Bitfield type details
-
EnumAttr
–Enum Type flags
-
EnumDetails
–Enum type details.
-
FuncAttr
–Function Type flags
-
FuncDetails
–Function type details.
-
LibraryAddFlags
–Flags for changing the way type libraries are added to the database
-
LibraryAddResult
–Return values for library add operation
-
NotSupportedWarning
–Warning for unsupported features in the underlying idapython API
-
PtrAttr
–Pointer Type Flags
-
PtrDetails
– -
TypeApplyFlags
–Flags that control how type information is applied to a given address
-
TypeAttr
–General Type attributes
-
TypeDetails
–Comprehensive type information with category-specific attributes
-
TypeDetailsVisitor
–Visitor class for types.
-
TypeFormattingFlags
–Type formatting flags used to control type parsing, formatting and printing
-
TypeKind
–Type category enumeration.
-
TypeManipulationFlags
–Flags to be used
-
Types
–Provides access to type information and manipulation in the IDA database.
-
UdtAttr
–User Defined Type flags
-
UdtDetails
–User Defined Type details
ArrayDetails
ArrayDetails()
Methods:
-
from_tinfo_t
–Extract array type attributes and details.
Attributes:
-
base
(int
) –Get array base.
-
element_type
(tinfo_t
) –Get array element type.
-
length
(int
) –Get number of elements.
base
property
base: int
Get array base.
element_type
property
element_type: tinfo_t
Get array element type.
length
property
length: int
Get number of elements.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[ArrayDetails]
Extract array type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Array type details object filled with extracted information.
BitfieldAttr
BitfieldDetails
BitfieldDetails()
Bitfield type details
Methods:
-
from_tinfo_t
–Extract bitfield type attributes and details.
Attributes:
-
attributes
(Optional[BitfieldAttr]
) –Get the bitfield type attributes.
from_tinfo_t
classmethod
from_tinfo_t(
type_info: tinfo_t,
) -> Optional[BitfieldDetails]
Extract bitfield type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Bitfield type details object filled with extracted information.
EnumAttr
Bases: Flag
Enum Type flags
Attributes:
-
BINARY
– -
BITMASK
– -
CHAR
– -
DECIMAL
– -
HEXADECIMAL
– -
LEADING_ZEROS
– -
OCTAL
– -
SIGNED
– -
SIGNED_BINARY
– -
SIGNED_HEXADECIMAL
– -
SIGNED_OCTAL
– -
UNSIGNED_DECIMAL
–
BINARY
class-attribute
instance-attribute
BINARY = auto()
BITMASK
class-attribute
instance-attribute
BITMASK = auto()
CHAR
class-attribute
instance-attribute
CHAR = auto()
DECIMAL
class-attribute
instance-attribute
DECIMAL = auto()
HEXADECIMAL
class-attribute
instance-attribute
HEXADECIMAL = auto()
LEADING_ZEROS
class-attribute
instance-attribute
LEADING_ZEROS = auto()
OCTAL
class-attribute
instance-attribute
OCTAL = auto()
SIGNED
class-attribute
instance-attribute
SIGNED = auto()
SIGNED_BINARY
class-attribute
instance-attribute
SIGNED_BINARY = auto()
SIGNED_HEXADECIMAL
class-attribute
instance-attribute
SIGNED_HEXADECIMAL = auto()
SIGNED_OCTAL
class-attribute
instance-attribute
SIGNED_OCTAL = auto()
UNSIGNED_DECIMAL
class-attribute
instance-attribute
UNSIGNED_DECIMAL = auto()
EnumDetails
EnumDetails()
Enum type details.
Methods:
-
from_tinfo_t
–Extract enum type attributes and details.
Attributes:
-
attributes
(Optional[EnumAttr]
) –Get enum type attributes
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[EnumDetails]
Extract enum type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Enum type details object filled with extracted information.
FuncAttr
Bases: Flag
Function Type flags
Attributes:
-
CONST
– -
CONSTRUCTOR
– -
DESTRUCTOR
– -
GOLANG_CC
– -
HIGH_LEVEL
– -
NO_RET
– -
PURE
– -
STATIC
– -
SWIFT_CC
– -
USER_CC
– -
VARARG_CC
– -
VIRTUAL
–
CONST
class-attribute
instance-attribute
CONST = auto()
CONSTRUCTOR
class-attribute
instance-attribute
CONSTRUCTOR = auto()
DESTRUCTOR
class-attribute
instance-attribute
DESTRUCTOR = auto()
GOLANG_CC
class-attribute
instance-attribute
GOLANG_CC = auto()
HIGH_LEVEL
class-attribute
instance-attribute
HIGH_LEVEL = auto()
NO_RET
class-attribute
instance-attribute
NO_RET = auto()
PURE
class-attribute
instance-attribute
PURE = auto()
STATIC
class-attribute
instance-attribute
STATIC = auto()
SWIFT_CC
class-attribute
instance-attribute
SWIFT_CC = auto()
USER_CC
class-attribute
instance-attribute
USER_CC = auto()
VARARG_CC
class-attribute
instance-attribute
VARARG_CC = auto()
VIRTUAL
class-attribute
instance-attribute
VIRTUAL = auto()
FuncDetails
FuncDetails()
Function type details.
Methods:
-
from_tinfo_t
–Extract function type attributes and details.
Attributes:
-
attributes
(Optional[FuncAttr]
) –Get the function type attributes.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[FuncDetails]
Extract function type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Function type details object filled with extracted information.
LibraryAddFlags
Bases: IntFlag
Flags for changing the way type libraries are added to the database
Attributes:
-
ADD_DEFAULT
–Default behavior
-
ADD_INCOMPATIBLE
–Add incompatible type libraries
-
ADD_SILENT
–Do not ask any questions
ADD_DEFAULT
class-attribute
instance-attribute
ADD_DEFAULT = ADDTIL_DEFAULT
Default behavior
ADD_INCOMPATIBLE
class-attribute
instance-attribute
ADD_INCOMPATIBLE = ADDTIL_INCOMP
Add incompatible type libraries
ADD_SILENT
class-attribute
instance-attribute
ADD_SILENT = ADDTIL_SILENT
Do not ask any questions
LibraryAddResult
Bases: IntEnum
Return values for library add operation
Attributes:
-
ABORTED
–Library not loaded, rejected by the user
-
FAILED
–Loading library failed
-
INCOMPATIBLE
–Library loaded but is incompatible
-
SUCCESS
–Library successfully loaded
ABORTED
class-attribute
instance-attribute
ABORTED = ADDTIL_ABORTED
Library not loaded, rejected by the user
FAILED
class-attribute
instance-attribute
FAILED = ADDTIL_FAILED
Loading library failed
INCOMPATIBLE
class-attribute
instance-attribute
INCOMPATIBLE = ADDTIL_COMP
Library loaded but is incompatible
SUCCESS
class-attribute
instance-attribute
SUCCESS = ADDTIL_OK
Library successfully loaded
NotSupportedWarning
Bases: Warning
Warning for unsupported features in the underlying idapython API
PtrAttr
Bases: Flag
Pointer Type Flags
Attributes:
-
CODE_POINTER
– -
SHIFTED
–
CODE_POINTER
class-attribute
instance-attribute
CODE_POINTER = auto()
SHIFTED
class-attribute
instance-attribute
SHIFTED = auto()
PtrDetails
PtrDetails()
Methods:
-
from_tinfo_t
–Extract pointer type attributes and details.
Attributes:
-
attributes
(Optional[PtrAttr]
) –Get pointer type attributes.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[PtrDetails]
Extract pointer type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Pointer type details object filled with extracted information.
TypeApplyFlags
Bases: IntFlag
Flags that control how type information is applied to a given address
Attributes:
DEFINITE
class-attribute
instance-attribute
DEFINITE = TINFO_DEFINITE
DELAYFUNC
class-attribute
instance-attribute
DELAYFUNC = TINFO_DELAYFUNC
GUESSED
class-attribute
instance-attribute
GUESSED = TINFO_GUESSED
STRICT
class-attribute
instance-attribute
STRICT = TINFO_STRICT
TypeAttr
Bases: Flag
General Type attributes
Attributes:
-
ARITHMETIC
– -
ARRAY
– -
ATTACHED
– -
BITFIELD
– -
BOOL
– -
CHAR
– -
COMPLEX
– -
CONST
– -
CORRECT
– -
DECL_ARRAY
– -
DECL_BITFIELD
– -
DECL_BOOL
– -
DECL_CHAR
– -
DECL_COMPLEX
– -
DECL_CONST
– -
DECL_DOUBLE
– -
DECL_ENUM
– -
DECL_FLOAT
– -
DECL_FLOATING
– -
DECL_FUNC
– -
DECL_INT
– -
DECL_INT128
– -
DECL_INT16
– -
DECL_INT32
– -
DECL_INT64
– -
DECL_LAST
– -
DECL_LDOUBLE
– -
DECL_PAF
– -
DECL_PARTIAL
– -
DECL_PTR
– -
DECL_STRUCT
– -
DECL_SUE
– -
DECL_TBYTE
– -
DECL_TYPEDEF
– -
DECL_UCHAR
– -
DECL_UDT
– -
DECL_UINT
– -
DECL_UINT128
– -
DECL_UINT16
– -
DECL_UINT32
– -
DECL_UINT64
– -
DECL_UNION
– -
DECL_UNKNOWN
– -
DECL_VOID
– -
DECL_VOLATILE
– -
DOUBLE
– -
ENUM
– -
EXT_ARITHMETIC
– -
EXT_INTEGRAL
– -
FLOAT
– -
FLOATING
– -
FUNC
– -
FUNC_PTR
– -
HIGH_LEVEL_FUNC
– -
INT
– -
INT128
– -
INT16
– -
INT32
– -
INT64
– -
INTEGRAL
– -
LDOUBLE
– -
PAF
– -
PARTIAL
– -
POINTER_UNKNOWN
– -
POINTER_VOID
– -
PTR
– -
PTR_OR_ARRAY
– -
PURGING_CALLING_CONVENTION
– -
SCALAR
– -
SHIFTED_PTR
– -
STRUCT
– -
SUE
– -
TBYTE
– -
UCHAR
– -
UDT
– -
UINT
– -
UINT128
– -
UINT16
– -
UINT32
– -
UINT64
– -
UNION
– -
UNKNOWN
– -
USER_CALLING_CONVENTION
– -
VARARG_CALLING_CONVENTION
– -
VARIABLE_STRUCT
– -
VARIABLE_STRUCT_MEMBER
– -
VOID
– -
VOLATILE
– -
WELL_DEFINED
–
ARITHMETIC
class-attribute
instance-attribute
ARITHMETIC = auto()
ARRAY
class-attribute
instance-attribute
ARRAY = auto()
ATTACHED
class-attribute
instance-attribute
ATTACHED = auto()
BITFIELD
class-attribute
instance-attribute
BITFIELD = auto()
BOOL
class-attribute
instance-attribute
BOOL = auto()
CHAR
class-attribute
instance-attribute
CHAR = auto()
COMPLEX
class-attribute
instance-attribute
COMPLEX = auto()
CONST
class-attribute
instance-attribute
CONST = auto()
CORRECT
class-attribute
instance-attribute
CORRECT = auto()
DECL_ARRAY
class-attribute
instance-attribute
DECL_ARRAY = auto()
DECL_BITFIELD
class-attribute
instance-attribute
DECL_BITFIELD = auto()
DECL_BOOL
class-attribute
instance-attribute
DECL_BOOL = auto()
DECL_CHAR
class-attribute
instance-attribute
DECL_CHAR = auto()
DECL_COMPLEX
class-attribute
instance-attribute
DECL_COMPLEX = auto()
DECL_CONST
class-attribute
instance-attribute
DECL_CONST = auto()
DECL_DOUBLE
class-attribute
instance-attribute
DECL_DOUBLE = auto()
DECL_ENUM
class-attribute
instance-attribute
DECL_ENUM = auto()
DECL_FLOAT
class-attribute
instance-attribute
DECL_FLOAT = auto()
DECL_FLOATING
class-attribute
instance-attribute
DECL_FLOATING = auto()
DECL_FUNC
class-attribute
instance-attribute
DECL_FUNC = auto()
DECL_INT
class-attribute
instance-attribute
DECL_INT = auto()
DECL_INT128
class-attribute
instance-attribute
DECL_INT128 = auto()
DECL_INT16
class-attribute
instance-attribute
DECL_INT16 = auto()
DECL_INT32
class-attribute
instance-attribute
DECL_INT32 = auto()
DECL_INT64
class-attribute
instance-attribute
DECL_INT64 = auto()
DECL_LAST
class-attribute
instance-attribute
DECL_LAST = auto()
DECL_LDOUBLE
class-attribute
instance-attribute
DECL_LDOUBLE = auto()
DECL_PAF
class-attribute
instance-attribute
DECL_PAF = auto()
DECL_PARTIAL
class-attribute
instance-attribute
DECL_PARTIAL = auto()
DECL_PTR
class-attribute
instance-attribute
DECL_PTR = auto()
DECL_STRUCT
class-attribute
instance-attribute
DECL_STRUCT = auto()
DECL_SUE
class-attribute
instance-attribute
DECL_SUE = auto()
DECL_TBYTE
class-attribute
instance-attribute
DECL_TBYTE = auto()
DECL_TYPEDEF
class-attribute
instance-attribute
DECL_TYPEDEF = auto()
DECL_UCHAR
class-attribute
instance-attribute
DECL_UCHAR = auto()
DECL_UDT
class-attribute
instance-attribute
DECL_UDT = auto()
DECL_UINT
class-attribute
instance-attribute
DECL_UINT = auto()
DECL_UINT128
class-attribute
instance-attribute
DECL_UINT128 = auto()
DECL_UINT16
class-attribute
instance-attribute
DECL_UINT16 = auto()
DECL_UINT32
class-attribute
instance-attribute
DECL_UINT32 = auto()
DECL_UINT64
class-attribute
instance-attribute
DECL_UINT64 = auto()
DECL_UNION
class-attribute
instance-attribute
DECL_UNION = auto()
DECL_UNKNOWN
class-attribute
instance-attribute
DECL_UNKNOWN = auto()
DECL_VOID
class-attribute
instance-attribute
DECL_VOID = auto()
DECL_VOLATILE
class-attribute
instance-attribute
DECL_VOLATILE = auto()
DOUBLE
class-attribute
instance-attribute
DOUBLE = auto()
ENUM
class-attribute
instance-attribute
ENUM = auto()
EXT_ARITHMETIC
class-attribute
instance-attribute
EXT_ARITHMETIC = auto()
EXT_INTEGRAL
class-attribute
instance-attribute
EXT_INTEGRAL = auto()
FLOAT
class-attribute
instance-attribute
FLOAT = auto()
FLOATING
class-attribute
instance-attribute
FLOATING = auto()
FUNC
class-attribute
instance-attribute
FUNC = auto()
FUNC_PTR
class-attribute
instance-attribute
FUNC_PTR = auto()
HIGH_LEVEL_FUNC
class-attribute
instance-attribute
HIGH_LEVEL_FUNC = auto()
INT
class-attribute
instance-attribute
INT = auto()
INT128
class-attribute
instance-attribute
INT128 = auto()
INT16
class-attribute
instance-attribute
INT16 = auto()
INT32
class-attribute
instance-attribute
INT32 = auto()
INT64
class-attribute
instance-attribute
INT64 = auto()
INTEGRAL
class-attribute
instance-attribute
INTEGRAL = auto()
LDOUBLE
class-attribute
instance-attribute
LDOUBLE = auto()
PAF
class-attribute
instance-attribute
PAF = auto()
PARTIAL
class-attribute
instance-attribute
PARTIAL = auto()
POINTER_UNKNOWN
class-attribute
instance-attribute
POINTER_UNKNOWN = auto()
POINTER_VOID
class-attribute
instance-attribute
POINTER_VOID = auto()
PTR
class-attribute
instance-attribute
PTR = auto()
PTR_OR_ARRAY
class-attribute
instance-attribute
PTR_OR_ARRAY = auto()
PURGING_CALLING_CONVENTION
class-attribute
instance-attribute
PURGING_CALLING_CONVENTION = auto()
SCALAR
class-attribute
instance-attribute
SCALAR = auto()
SHIFTED_PTR
class-attribute
instance-attribute
SHIFTED_PTR = auto()
STRUCT
class-attribute
instance-attribute
STRUCT = auto()
SUE
class-attribute
instance-attribute
SUE = auto()
TBYTE
class-attribute
instance-attribute
TBYTE = auto()
UCHAR
class-attribute
instance-attribute
UCHAR = auto()
UDT
class-attribute
instance-attribute
UDT = auto()
UINT
class-attribute
instance-attribute
UINT = auto()
UINT128
class-attribute
instance-attribute
UINT128 = auto()
UINT16
class-attribute
instance-attribute
UINT16 = auto()
UINT32
class-attribute
instance-attribute
UINT32 = auto()
UINT64
class-attribute
instance-attribute
UINT64 = auto()
UNION
class-attribute
instance-attribute
UNION = auto()
UNKNOWN
class-attribute
instance-attribute
UNKNOWN = auto()
USER_CALLING_CONVENTION
class-attribute
instance-attribute
USER_CALLING_CONVENTION = auto()
VARARG_CALLING_CONVENTION
class-attribute
instance-attribute
VARARG_CALLING_CONVENTION = auto()
VARIABLE_STRUCT
class-attribute
instance-attribute
VARIABLE_STRUCT = auto()
VARIABLE_STRUCT_MEMBER
class-attribute
instance-attribute
VARIABLE_STRUCT_MEMBER = auto()
VOID
class-attribute
instance-attribute
VOID = auto()
VOLATILE
class-attribute
instance-attribute
VOLATILE = auto()
WELL_DEFINED
class-attribute
instance-attribute
WELL_DEFINED = auto()
TypeDetails
TypeDetails()
Comprehensive type information with category-specific attributes
Methods:
-
from_tinfo_t
–Extract all type attributes and details.
Attributes:
-
array
(Optional[ArrayDetails]
) –Get the array type details, if any.
-
attributes
(TypeAttr
) –Get the general type attributes.
-
bitfield
(Optional[BitfieldDetails]
) –Get the bitfield type details, if any.
-
enum
(Optional[EnumDetails]
) –Get the enum type details, if any.
-
func
(Optional[FuncDetails]
) –Get the function type details, if any.
-
name
(str
) –Get the name of the type.
-
ptr
(Optional[PtrDetails]
) –Get the pointer type details, if any.
-
size
(int
) –Get the size of the type.
-
udt
(Optional[UdtDetails]
) –Get the user-defined type details, if any.
name
property
name: str
Get the name of the type.
size
property
size: int
Get the size of the type.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> TypeDetails
Extract all type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Type details object filled with extracted information.
TypeDetailsVisitor
TypeDetailsVisitor(db: Database)
Bases: tinfo_visitor_t
Visitor class for types. Used to recursively traverse types and gather the type members details. Instances of this class can be passed to the traverse() method to initiate the traversal.
Methods:
Attributes:
-
db
– -
output
(list[TypeDetails]
) –
db
instance-attribute
db = db
visit_type
visit_type(
out: type_mods_t, tif: tinfo_t, name: str, comment: str
) -> int
TypeFormattingFlags
Bases: IntFlag
Type formatting flags used to control type parsing, formatting and printing
Attributes:
-
HTI_DCL
–Don't complain about redeclarations
-
HTI_EXT
–Debug: print external representation of types
-
HTI_FIL
–"Input" is file name, otherwise "input" contains a C declaration
-
HTI_HIGH
–Assume high level prototypes (with hidden args, etc)
-
HTI_INT
–Debug: print internal representation of types
-
HTI_LEX
–Debug: print tokens
-
HTI_LOWER
–Lower the function prototypes
-
HTI_MAC
–Define macros from the base tils
-
HTI_NDC
–Don't decorate names
-
HTI_NER
–Ignore all errors but display them
-
HTI_NOBASE
–Do not inspect base tils
-
HTI_NWR
–No warning messages
-
HTI_PAK
–Explicit structure pack value (#pragma pack)
-
HTI_PAK1
–pragma pack(1)
-
HTI_PAK16
–pragma pack(16)
-
HTI_PAK2
–pragma pack(2)
-
HTI_PAK4
–pragma pack(4)
-
HTI_PAK8
–pragma pack(8)
-
HTI_PAKDEF
–Default pack value
-
HTI_PAK_SHIFT
–Shift for HTI_PAK. This field should be used if you want to remember
-
HTI_RAWARGS
–Leave argument names unchanged (do not remove underscores)
-
HTI_RELAXED
–Accept references to unknown namespaces
-
HTI_SEMICOLON
–Do not complain if the terminating semicolon is absent
-
HTI_TST
–Test mode: discard the result
-
HTI_UNP
–Debug: check the result by unpacking it
HTI_DCL
class-attribute
instance-attribute
HTI_DCL = HTI_DCL
Don't complain about redeclarations
HTI_EXT
class-attribute
instance-attribute
HTI_EXT = HTI_EXT
Debug: print external representation of types
HTI_FIL
class-attribute
instance-attribute
HTI_FIL = HTI_FIL
"Input" is file name, otherwise "input" contains a C declaration
HTI_HIGH
class-attribute
instance-attribute
HTI_HIGH = HTI_HIGH
Assume high level prototypes (with hidden args, etc)
HTI_INT
class-attribute
instance-attribute
HTI_INT = HTI_INT
Debug: print internal representation of types
HTI_LEX
class-attribute
instance-attribute
HTI_LEX = HTI_LEX
Debug: print tokens
HTI_LOWER
class-attribute
instance-attribute
HTI_LOWER = HTI_LOWER
Lower the function prototypes
HTI_MAC
class-attribute
instance-attribute
HTI_MAC = HTI_MAC
Define macros from the base tils
HTI_NDC
class-attribute
instance-attribute
HTI_NDC = HTI_NDC
Don't decorate names
HTI_NER
class-attribute
instance-attribute
HTI_NER = HTI_NER
Ignore all errors but display them
HTI_NOBASE
class-attribute
instance-attribute
HTI_NOBASE = HTI_NOBASE
Do not inspect base tils
HTI_NWR
class-attribute
instance-attribute
HTI_NWR = HTI_NWR
No warning messages
HTI_PAK
class-attribute
instance-attribute
HTI_PAK = HTI_PAK
Explicit structure pack value (#pragma pack)
HTI_PAK1
class-attribute
instance-attribute
HTI_PAK1 = HTI_PAK1
pragma pack(1)
HTI_PAK16
class-attribute
instance-attribute
HTI_PAK16 = HTI_PAK16
pragma pack(16)
HTI_PAK2
class-attribute
instance-attribute
HTI_PAK2 = HTI_PAK2
pragma pack(2)
HTI_PAK4
class-attribute
instance-attribute
HTI_PAK4 = HTI_PAK4
pragma pack(4)
HTI_PAK8
class-attribute
instance-attribute
HTI_PAK8 = HTI_PAK8
pragma pack(8)
HTI_PAKDEF
class-attribute
instance-attribute
HTI_PAKDEF = HTI_PAKDEF
Default pack value
HTI_PAK_SHIFT
class-attribute
instance-attribute
HTI_PAK_SHIFT = HTI_PAK_SHIFT
Shift for HTI_PAK. This field should be used if you want to remember an explicit pack value for each structure/union type. See HTI_PAK... definitions
HTI_RAWARGS
class-attribute
instance-attribute
HTI_RAWARGS = HTI_RAWARGS
Leave argument names unchanged (do not remove underscores)
HTI_RELAXED
class-attribute
instance-attribute
HTI_RELAXED = HTI_RELAXED
Accept references to unknown namespaces
HTI_SEMICOLON
class-attribute
instance-attribute
HTI_SEMICOLON = HTI_SEMICOLON
Do not complain if the terminating semicolon is absent
HTI_TST
class-attribute
instance-attribute
HTI_TST = HTI_TST
Test mode: discard the result
HTI_UNP
class-attribute
instance-attribute
HTI_UNP = HTI_UNP
Debug: check the result by unpacking it
TypeKind
TypeManipulationFlags
Bases: IntFlag
Flags to be used
Attributes:
-
NTF_64BIT
–value is 64bit
-
NTF_CHKSYNC
–check that synchronization to IDB passed OK (set_numbered_type, set_named_type)
-
NTF_COPY
–save a new type definition, not a typeref
-
NTF_FIXNAME
–force-validate the name of the type when setting (set_named_type, set_numbered_type only)
-
NTF_IDBENC
–the name is given in the IDB encoding;
-
NTF_NOBASE
–don't inspect base tils (for get_named_type)
-
NTF_NOCUR
–don't inspect current til file (for get_named_type)
-
NTF_NO_NAMECHK
–do not validate type name (set_numbered_type, set_named_type)
-
NTF_REPLACE
–replace original type (for set_named_type)
-
NTF_SYMM
–symbol, name is mangled ('_func'); only one of NTF_TYPE and NTF_SYMU, NTF_SYMM can be used
-
NTF_SYMU
–symbol, name is unmangled ('func')
-
NTF_TYPE
–type name
-
NTF_UMANGLED
–name is unmangled (don't use this flag)
NTF_64BIT
class-attribute
instance-attribute
NTF_64BIT = NTF_64BIT
value is 64bit
NTF_CHKSYNC
class-attribute
instance-attribute
NTF_CHKSYNC = NTF_CHKSYNC
check that synchronization to IDB passed OK (set_numbered_type, set_named_type)
NTF_COPY
class-attribute
instance-attribute
NTF_COPY = NTF_COPY
save a new type definition, not a typeref (tinfo_t::set_numbered_type, tinfo_t::set_named_type)
NTF_FIXNAME
class-attribute
instance-attribute
NTF_FIXNAME = NTF_FIXNAME
force-validate the name of the type when setting (set_named_type, set_numbered_type only)
NTF_IDBENC
class-attribute
instance-attribute
NTF_IDBENC = NTF_IDBENC
the name is given in the IDB encoding; non-ASCII bytes will be decoded accordingly (set_named_type, set_numbered_type only)
NTF_NOBASE
class-attribute
instance-attribute
NTF_NOBASE = NTF_NOBASE
don't inspect base tils (for get_named_type)
NTF_NOCUR
class-attribute
instance-attribute
NTF_NOCUR = NTF_NOCUR
don't inspect current til file (for get_named_type)
NTF_NO_NAMECHK
class-attribute
instance-attribute
NTF_NO_NAMECHK = NTF_NO_NAMECHK
do not validate type name (set_numbered_type, set_named_type)
NTF_REPLACE
class-attribute
instance-attribute
NTF_REPLACE = NTF_REPLACE
replace original type (for set_named_type)
NTF_SYMM
class-attribute
instance-attribute
NTF_SYMM = NTF_SYMM
symbol, name is mangled ('_func'); only one of NTF_TYPE and NTF_SYMU, NTF_SYMM can be used
NTF_SYMU
class-attribute
instance-attribute
NTF_SYMU = NTF_SYMU
symbol, name is unmangled ('func')
NTF_TYPE
class-attribute
instance-attribute
NTF_TYPE = NTF_TYPE
type name
NTF_UMANGLED
class-attribute
instance-attribute
NTF_UMANGLED = NTF_UMANGLED
name is unmangled (don't use this flag)
Types
Types(database: Database)
Bases: DatabaseEntity
Provides access to type information and manipulation in the IDA database.
Can be used to iterate over all types in the opened database.
Args: database: Reference to the active IDA database.
Methods:
-
apply_at
–Applies a named type to the given address.
-
copy_type
–Copies a type and all dependent types from one library to another.
-
create_library
–Initializes a new type library.
-
export_to_library
–Export all types from local library to external library.
-
export_type
–Exports a type and all dependent types from the local (database) library
-
get_all
–Retrieves an iterator over all types in the specified type library.
-
get_at
–Retrieves the type information of the item at the given address.
-
get_by_name
–Retrieve a type information object by name.
-
get_comment
–Get comment for type.
-
get_details
–Get type details and attributes.
-
import_from_library
–Imports the types from an external library to the local (database) library.
-
import_type
–Imports a type and all dependent types from an external (loaded) library
-
load_library
–Loads a type library file in memory.
-
parse_declarations
–Parse type declarations from string and store created types into a library.
-
parse_header_file
–Parse type declarations from file and store created types into a library.
-
parse_one_declaration
–Parse one declaration from string and create a named type.
-
save_library
–Stores the type library to a file.
-
set_comment
–Set comment for type.
-
traverse
–Traverse the given type using the provided visitor class.
-
unload_library
–Unload library (free underlying object).
Attributes:
-
database
(Database
) –Get the database reference, guaranteed to be non-None when called from
-
m_database
–
database
property
database: Database
Get the database reference, guaranteed to be non-None when called from methods decorated with @check_db_open.
Returns: The active database instance.
Note: This property should only be used in methods decorated with @check_db_open, which ensures m_database is not None.
m_database
instance-attribute
m_database = database
apply_at
apply_at(
type: tinfo_t, ea: ea_t, flags: TypeApplyFlags = GUESSED
) -> bool
Applies a named type to the given address.
Args: ea: The effective address. type: The name of the type to apply. flags: Type apply flags.
Returns: True if the type was applied successfully, false otherwise.
Raises: InvalidEAError: If the effective address is invalid.
copy_type
copy_type(
source: til_t, destination: til_t, name: str
) -> int
Copies a type and all dependent types from one library to another.
Args: source: The source library. destination: The destination library. name: The name of the type.
Raises: RuntimeError: If the copy operation failed.
Returns: The ordinal number of the copied type.
create_library
create_library(file: Path, description: str) -> til_t
Initializes a new type library.
Args: file: The name of the library. description: The description of the library.
Returns: An initialized library.
export_to_library
export_to_library(library: til_t) -> None
Export all types from local library to external library. Numbered types will be automatically enabled for the external library.
Args: library: The destination library.
export_type
export_type(destination: til_t, name: str) -> int
Exports a type and all dependent types from the local (database) library into a loaded (external) library.
Numbered types will be automatically enabled for the external library.
Args: destination: The loaded type library from where to import the type. name: The name of the type.
Raises: RuntimeError: If the export operation failed.
Returns: The ordinal number of the imported type.
get_all
Retrieves an iterator over all types in the specified type library.
Args: library: library instance to iterate over (defaults to local library). type_kind: type kind to iterate over (defaults to 'NAMED').
Returns: A types iterator.
get_at
get_at(ea: ea_t) -> Optional[tinfo_t]
Retrieves the type information of the item at the given address.
Args: ea: The effective address.
Returns: The type information object or None if it does not exist.
Raises: InvalidEAError: If the effective address is invalid.
get_by_name
get_by_name(
name: str, library: til_t = None
) -> Optional[tinfo_t]
Retrieve a type information object by name.
Args: name: Name of the type to retrieve. library: Type library to retrieve from, defaults to local library.
Returns: The named type information object or None if not found.
get_comment
get_comment(type_info: tinfo_t) -> str
Get comment for type.
Args: type_info: The type info object to get comment from.
Returns: Comment text, or empty string if no comment exists.
get_details
get_details(type_info: tinfo_t) -> TypeDetails
Get type details and attributes.
Args: type_info: The type information object for which to gather details.
Returns: Type details object.
import_from_library
import_from_library(library: til_t) -> None
Imports the types from an external library to the local (database) library.
Args: library: The library instance to import from.
Returns: The status of the add library operation.
import_type
import_type(source: til_t, name: str) -> int
Imports a type and all dependent types from an external (loaded) library into the local (database) library.
Args: source: The loaded type library from where to import the type. name: The name of the type.
Raises: RuntimeError: If the import operation failed.
Returns: The ordinal number of the imported type.
load_library
load_library(file: Path) -> til_t
Loads a type library file in memory.
Args: file: The path of the library file to load. The library name can be passed with or without extension (.til extension will be forced) and as a relative (default ida til directory will be used) or absolute path.
Returns: The loaded til_t object.
parse_declarations
parse_declarations(
library: til_t,
decl: str,
flags: TypeFormattingFlags = HTI_DCL | HTI_PAKDEF,
) -> int
Parse type declarations from string and store created types into a library.
Args: library: The type library into where the parsed types will be stored. decl: C type declarations input string. flags: Optional combination of TypeFormattingFlags.
Returns: Number of parse errors.
parse_header_file
parse_header_file(
library: til_t,
header: Path,
flags: TypeFormattingFlags = HTI_FIL | HTI_PAKDEF,
) -> int
Parse type declarations from file and store created types into a library.
Args: library: The type library into where the parsed types will be stored. header: The path to a header file. flags: Optional combination of TypeFormattingFlags.
Returns: Number of parse errors.
parse_one_declaration
parse_one_declaration(
library: til_t,
decl: str,
name: str,
flags: TypeFormattingFlags = HTI_DCL | HTI_PAKDEF,
) -> tinfo_t
Parse one declaration from string and create a named type.
Args: library: The type library used for parsing context. decl: C type declaration string to parse. name: The name to assign to the parsed type. flags: Optional combination of TypeFormattingFlags for parsing behavior.
Returns: The tinfo_t instance on success.
Raises: InvalidParameterError: If name/decl is empty, decl cannot be parsed, or name cannot be used to save the declaration.
save_library
save_library(library: til_t, file: Path) -> bool
Stores the type library to a file. If the library contains garbage, it will be collected before storing it. Also compacts the library before saving.
Args: library: The type library instance to save to disk. file: The path to save the library to.
Returns: True if the operation succeeded, False otherwise.
set_comment
set_comment(type_info: tinfo_t, comment: str) -> bool
Set comment for type. This function works only for non-trivial types
Args: type_info: The type info object to set comment for. comment: Comment text to set.
Returns: True if successful, False otherwise.
traverse
traverse(
type_info: tinfo_t, visitor: tinfo_visitor_t
) -> None
Traverse the given type using the provided visitor class.
Args: type_info: The type information object to visit. visitor: A type visitor subclassed object.
Returns: True if traversal was successful, False otherwise.
unload_library
unload_library(library: til_t) -> None
Unload library (free underlying object).
Args: library: The library instance to unload.
UdtAttr
Bases: Flag
User Defined Type flags
Attributes:
CPP_OBJ
class-attribute
instance-attribute
CPP_OBJ = auto()
FIXED
class-attribute
instance-attribute
FIXED = auto()
MS_STRUCT
class-attribute
instance-attribute
MS_STRUCT = auto()
TUPLE
class-attribute
instance-attribute
TUPLE = auto()
UNALIGNED
class-attribute
instance-attribute
UNALIGNED = auto()
UNION
class-attribute
instance-attribute
UNION = auto()
VFTABLE
class-attribute
instance-attribute
VFTABLE = auto()
UdtDetails
UdtDetails()
User Defined Type details
Methods:
-
from_tinfo_t
–Extract UDT type attributes and details.
Attributes:
-
attributes
(Optional[UdtAttr]
) –Get UDT attributes.
-
num_members
(int
) –Get number of members.
num_members
property
num_members: int
Get number of members.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[UdtDetails]
Extract UDT type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: UDT type details object filled with extracted information.