IDA SDK
Functions | Variables
Numbered types

Detailed Description

Functions to work with numbered (ordinal) types.

Numbered types may be named or anonymous. They are referenced by their ordinal number. Access to them is faster because there is no need to resolve their names. Also, they can stay anonymous and be aliased. They can be used only in the local type library created by IDA (in idati).

Functions

idaman bool ida_export enable_numbered_types (til_t *ti, bool enable)
 Enable the use of numbered types in til. More...
 
idaman bool ida_export get_numbered_type (const til_t *ti, uint32 ordinal, const type_t **type=NULL, const p_list **fields=NULL, const char **cmt=NULL, const p_list **fieldcmts=NULL, sclass_t *sclass=NULL)
 Retrieve a type by its ordinal number.
 
idaman uint32 ida_export alloc_type_ordinals (til_t *ti, int qty)
 Allocate a range of ordinal numbers for new types. More...
 
uint32 alloc_type_ordinal (til_t *ti)
 alloc_type_ordinals(ti, 1)
 
idaman uint32 ida_export get_ordinal_qty (const til_t *ti)
 Get number of allocated ordinals. More...
 
idaman tinfo_code_t ida_export set_numbered_type (til_t *ti, uint32 ordinal, int ntf_flags, const char *name, const type_t *type, const p_list *fields=NULL, const char *cmt=NULL, const p_list *fldcmts=NULL, const sclass_t *sclass=NULL)
 Store a type in the til. More...
 
idaman bool ida_export del_numbered_type (til_t *ti, uint32 ordinal)
 Delete a numbered type.
 
idaman bool ida_export set_type_alias (til_t *ti, uint32 src_ordinal, uint32 dst_ordinal)
 Create a type alias. More...
 
idaman uint32 ida_export get_alias_target (const til_t *ti, uint32 ordinal)
 Find the final alias destination. More...
 
int32 get_type_ordinal (const til_t *ti, const char *name)
 Get type ordinal by its name.
 
idaman const char *ida_export get_numbered_type_name (const til_t *ti, uint32 ordinal)
 Get type name (if exists) by its ordinal. More...
 
idaman ssize_t ida_export create_numbered_type_name (qstring *buf, int32 ord)
 Create anonymous name for numbered type. More...
 
idaman bool ida_export is_ordinal_name (const char *name, uint32 *ord=NULL)
 Check if the name is an ordinal name. More...
 
idaman int ida_export get_ordinal_from_idb_type (const char *name, const type_t *type)
 Get ordinal number of an idb type (struct/enum). More...
 
bool idaapi is_autosync (const char *name, const type_t *type)
 Is the specified idb type automatically synchronized?
 
bool idaapi is_autosync (const char *name, const tinfo_t &tif)
 copydoc is_autosync(const char*, const type_t *)
 
idaman void ida_export build_anon_type_name (qstring *buf, const type_t *type, const p_list *fields)
 Generate a name like $hex_numbers based on the field types and names.
 
idaman int ida_export compact_numbered_types (til_t *ti, uint32 min_ord=0, intvec_t *p_ordmap=NULL, int flags=0)
 Compact numbered types to get rid of empty slots. More...
 

Variables

const uint32 BADORD = uint32(-1)
 invalid type ordinal
 

Function Documentation

idaman bool ida_export enable_numbered_types ( til_t ti,
bool  enable 
)

Enable the use of numbered types in til.

Currently it is impossible to disable numbered types once they are enabled

idaman uint32 ida_export alloc_type_ordinals ( til_t ti,
int  qty 
)

Allocate a range of ordinal numbers for new types.

Parameters
titype library
qtynumber of ordinals to allocate
Returns
the first ordinal. 0 means failure.
idaman uint32 ida_export get_ordinal_qty ( const til_t ti)

Get number of allocated ordinals.

Returns
uint32(-1) if failed
idaman tinfo_code_t ida_export set_numbered_type ( til_t ti,
uint32  ordinal,
int  ntf_flags,
const char *  name,
const type_t type,
const p_list fields = NULL,
const char *  cmt = NULL,
const p_list fldcmts = NULL,
const sclass_t sclass = NULL 
)

Store a type in the til.

'name' may be NULL for anonymous types. The specified ordinal must be free (no other type is using it). For ntf_flags, only NTF_REPLACE is consulted.

idaman bool ida_export set_type_alias ( til_t ti,
uint32  src_ordinal,
uint32  dst_ordinal 
)

Create a type alias.

Redirects all references to source type to the destination type. This is equivalent to instantaneous replacement all reference to srctype by dsttype.

idaman uint32 ida_export get_alias_target ( const til_t ti,
uint32  ordinal 
)

Find the final alias destination.

If the ordinal has not been aliased, return the specified ordinal itself If failed, returns 0.

idaman const char* ida_export get_numbered_type_name ( const til_t ti,
uint32  ordinal 
)

Get type name (if exists) by its ordinal.

If the type is anonymous, returns "". If failed, returns NULL

idaman ssize_t ida_export create_numbered_type_name ( qstring buf,
int32  ord 
)

Create anonymous name for numbered type.

This name can be used to reference a numbered type by its ordinal Ordinal names have the following format: '#' + set_de(ord) Returns: -1 if error, otherwise the name length

idaman bool ida_export is_ordinal_name ( const char *  name,
uint32 ord = NULL 
)

Check if the name is an ordinal name.

Ordinal names have the following format: '#' + set_de(ord)

idaman int ida_export get_ordinal_from_idb_type ( const char *  name,
const type_t type 
)

Get ordinal number of an idb type (struct/enum).

The 'type' parameter is used only to determine the kind of the type (struct or enum) Use this function to find out the correspondence between idb types and til types

idaman int ida_export compact_numbered_types ( til_t ti,
uint32  min_ord = 0,
intvec_t p_ordmap = NULL,
int  flags = 0 
)

Compact numbered types to get rid of empty slots.

Parameters
titype library to compact
min_ordminimal ordinal number to start to compact. lower ordinals are not modified
p_ordmapthe resulting mapping (for example, the new ordinal of min_ord will be in ordmap[0])
flagsreserved
Returns
number of freed type slots