IDA SDK

- Main Page
- Header Files
- Classes
- Modules

- File List
- File Members

Classes | Functions | Macros | Typedefs | Enumerations
loader.hpp File Reference

## Detailed Description

Definitions of IDP, LDR, PLUGIN module interfaces.

This file also contains:

- functions to load files into the database
- functions to generate output files
- high level functions to work with the database (open, save, close)

The LDR interface consists of one structure: loader_t
The IDP interface consists of one structure: processor_t
The PLUGIN interface consists of one structure: plugin_t

Modules can't use standard FILE* functions. They must use functions from <fpro.h>

Modules can't use standard memory allocation functions. They must use functions from <pro.h>

The exported entry #1 in the module should point to the the appropriate structure. (loader_t for LDR module, for example)

## Classes
struct | loader_t
| Loader description block - must be exported from the loader module. More...
struct | load_info_t
| List of loaders. More...
struct | impinfo_t
| See importer_t. More...
class | plugin_t
| A plugin is a module in the plugins subdirectory that can perform an action asked by the user. More...
struct | idp_name_t
| Processor name. More...
struct | idp_desc_t
| Processor module description. More...
struct | plugin_info_t
| Structure to store Plugin information. More...
struct | dbg_info_t
| Information for the user interface about available debuggers. More...
class | snapshot_t
| Snapshot attributes. More...

## Functions
idaman NORETURN void ida_export | vloader_failure (const char *format, va_list va)
| See loader_failure()
NORETURN void | loader_failure (const char *format=NULL,...)
| Display a message about a loader failure and stop the loading process. More...
idaman load_info_t *ida_export | build_loaders_list (linput_t *li)
| Build list of potential loaders.
idaman void ida_export | free_loaders_list (load_info_t *list)
| Free the list of loaders.
idaman char *ida_export | get_loader_name_from_dll (char *dllname)
| Get name of loader from its DLL file (for example, for PE files we will get "PE"). More...
idaman ssize_t ida_export | get_loader_name (char *buf, size_t bufsize)
| Get name of loader used to load the input file into the database. More...
idaman bool ida_export | init_loader_options (linput_t *li, const load_info_t *loader)
| Initialize user configurable options from the given loader based on the input file. More...
idaman bool ida_export | load_binary_file (const char *filename, linput_t *li, ushort _neflags, int32 fileoff, ea_t basepara, ea_t binoff, uint32 nbytes)
| Load a binary file into the database. More...
idaman bool ida_export | load_nonbinary_file (const char *filename, linput_t *li, const char *sysdlldir, ushort _neflags, load_info_t *loader)
| Load a non-binary file into the database. More...
idaman int ida_export | gen_file (ofile_type_t otype, FILE *fp, ea_t ea1, ea_t ea2, int flags)
| Generate an output file. More...
idaman int ida_export | file2base (linput_t *li, int32 pos, ea_t ea1, ea_t ea2, int patchable)
| Load portion of file into the database. More...
idaman int ida_export | mem2base (const void *memptr, ea_t ea1, ea_t ea2, int32 fpos)
| Load database from the memory. More...
idaman int ida_export | base2file (FILE *fp, int32 pos, ea_t ea1, ea_t ea2)
| Unload database to a binary file. More...
idaman bool ida_export | extract_module_from_archive (char *filename, size_t bufsize, bool is_remote, char **temp_file_ptr)
| Extract a module for an archive file. More...
idaman void ida_export | create_filename_cmt (void)
| Add long comment at idainfo::minEA. More...
idaman filetype_t ida_export | get_basic_file_type (linput_t *li)
| Get the input file type. More...
idaman size_t ida_export | get_file_type_name (char *buf, size_t bufsize)
| Get name of the current file type. More...
idaman void ida_export | import_module (const char *module, const char *windir, uval_t modnode, importer_t importer, const char *ostype)
| Find and import a DLL module. More...
idaman int ida_export | load_ids_module (char *fname)
| Load and apply IDS file. More...
idaman bool ida_export | hook_to_notification_point (hook_type_t hook_type, hook_cb_t *cb, void *user_data)
| Register a callback for a class of events in IDA.
idaman int ida_export | unhook_from_notification_point (hook_type_t hook_type, hook_cb_t *cb, void *user_data=NULL)
| Unregister a callback (also see hook_to_notification_point()). More...
idaman int ida_export | invoke_callbacks (hook_type_t hook_type, int notification_code, va_list va)
| A well behaved processor module should call this function in its processor_t::notify() function. More...
idaman const char *ida_export | get_plugin_options (const char *plugin)
| Get plugin options from the command line. More...
idaman const idp_descs_t *ida_export | get_idp_descs (void)
| Get IDA processor modules descriptions.
idaman int ida_export | enum_plugins (int(idaapi *func)(const char *file, void *ud), void *ud, char *answer, size_t answer_size, const extlang_t **el=NULL)
| Enumerate IDA plugins. More...
idaman plugin_info_t *ida_export | get_plugins (void)
| Get pointer to the list of plugins. More...
idaman plugin_t *ida_export | load_plugin (const char *name)
| Load a user-defined plugin. More...
idaman bool ida_export | run_plugin (const plugin_t *ptr, int arg)
| Run a loaded plugin with the specified argument. More...
bool idaapi | load_and_run_plugin (const char *name, int arg)
| Load & run a plugin.
idaman bool ida_export | invoke_plugin (plugin_info_t *ptr)
| Run a plugin as configured. More...
idaman size_t ida_export | get_debugger_plugins (const dbg_info_t **array)
| Get information about available debuggers.
idaman void ida_export | init_plugins (int flag)
| Initialize plugins with the specified flag.
idaman void ida_export | term_plugins (int flag)
| Terminate plugins with the specified flag.
idaman int32 ida_export | get_fileregion_offset (ea_t ea)
| Get offset in the input file which corresponds to the given ea. More...
idaman ea_t ida_export | get_fileregion_ea (int32 offset)
| Get linear address which corresponds to the specified input file offset. More...
idaman int ida_export | gen_exe_file (FILE *fp)
| Generate an exe file (unload the database in binary form). More...
idaman int ida_export | reload_file (const char *file, bool is_remote)
| Reload the input file. More...
idaman bool ida_export | build_snapshot_tree (snapshot_t *root)
| Build the snapshot tree. More...
idaman bool ida_export | update_snapshot_attributes (const char *filename, const snapshot_t *root, const snapshot_t *attr, int uf)
| Update the snapshot attributes. More...
idaman int ida_export | visit_snapshot_tree (snapshot_t *root, int(idaapi *callback)(snapshot_t *ss, void *ud), void *ud)
| Visit the snapshot tree. More...
idaman int ida_export | flush_buffers (void)
| Flush buffers to the disk.
idaman bool ida_export | is_trusted_idb (void)
| Is the database considered as trusted?
idaman bool ida_export | save_database_ex (const char *outfile, uint32 flags, const snapshot_t *root=NULL, const snapshot_t *attr=NULL)
| Save current database using a new file name. More...
Regions
Work with file regions (for patching)
void | init_fileregions (void)
void | term_fileregions (void)
void | save_fileregions (void)
void | add_fileregion (ea_t ea1, ea_t ea2, int32 fpos)
void | move_fileregions (ea_t from, ea_t to, asize_t size)
void | del_fileregions (ea_t ea1, ea_t ea2)

## Lines
Callback functions to output lines:
#define | gen_outline_t html_line_cb_t
typedef int idaapi | html_header_cb_t(FILE *fp)
typedef int idaapi | html_footer_cb_t(FILE *fp)
typedef int idaapi | html_line_cb_t(FILE *fp, const char *line, bgcolor_t prefix_color, bgcolor_t bg_color)

## Macros
#define | MAX_FILE_FORMAT_NAME 64
| Max number of chars to describe a file format.
#define | LDRF_RELOAD 0x0001
| loader recognizes NEF_RELOAD flag
#define | ACCEPT_FIRST 0x8000
| Specify that a file format should be place first in "load file" dialog box. More...
#define | NEF_SEGS 0x0001
| Create segments.
#define | NEF_RSCS 0x0002
| Load resources.
#define | NEF_NAME 0x0004
| Rename entries.
#define | NEF_MAN 0x0008
| Manual load.
#define | NEF_FILL 0x0010
| Fill segment gaps.
#define | NEF_IMPS 0x0020
| Create import segment.
#define | NEF_FIRST 0x0080
| This is the first file loaded. More...
#define | NEF_CODE 0x0100
| for load_binary_file(): More...
#define | NEF_RELOAD 0x0200
| reload the file at the same place: More...
#define | NEF_FLAT 0x0400
| Autocreate FLAT group (PE)
#define | NEF_MINI 0x0800
| Create mini database (do not copy. More...
#define | NEF_LOPT 0x1000
| Display additional loader options dialog.
#define | NEF_LALL 0x2000
| Load all segments without questions.
#define | LOADER_EXT "ldw"
| Loader module filename extension.
#define | LOADER_DLL "*." LOADER_EXT
| Pattern to find loader files.
#define | GENFLG_MAPSEG 0x0001
| OFILE_MAP: generate map of segments
#define | GENFLG_MAPNAME 0x0002
| OFILE_MAP: include dummy names
#define | GENFLG_MAPDMNG 0x0004
| OFILE_MAP: demangle names
#define | GENFLG_MAPLOC 0x0008
| OFILE_MAP: include local names
#define | GENFLG_IDCTYPE 0x0008
| OFILE_IDC: gen only information about types
#define | GENFLG_ASMTYPE 0x0010
| OFILE_ASM,OFILE_LST: gen information about types too
#define | GENFLG_GENHTML 0x0020
| OFILE_ASM,OFILE_LST: generate html (ui_genfile_callback will be used)
#define | GENFLG_ASMINC 0x0040
| OFILE_ASM,OFILE_LST: gen information only about types
#define | FILEREG_PATCHABLE 1
| means that the input file may be More...
#define | FILEREG_NOTPATCHABLE 0
| the data is kept in some encoded More...
#define | PLUGIN_MOD 0x0001
| Plugin changes the database. More...
#define | PLUGIN_DRAW 0x0002
| IDA should redraw everything after calling the plugin.
#define | PLUGIN_SEG 0x0004
| Plugin may be applied only if the current address belongs to a segment.
#define | PLUGIN_UNL 0x0008
| Unload the plugin immediately after calling 'run'. More...
#define | PLUGIN_HIDE 0x0010
| Plugin should not appear in the Edit, Plugins menu. More...
#define | PLUGIN_DBG 0x0020
| A debugger plugin. More...
#define | PLUGIN_PROC 0x0040
| Load plugin when a processor module is loaded. More...
#define | PLUGIN_FIX 0x0080
| Load plugin when IDA starts and keep it in the memory until IDA stops.
#define | PLUGIN_SCRIPTED 0x8000
| Scripted plugin. More...
#define | PLUGIN_SKIP 0
| Plugin doesn't want to be loaded.
#define | PLUGIN_OK 1
| Plugin agrees to work with the current database. More...
#define | PLUGIN_KEEP 2
| Plugin agrees to work with the current database and wants to stay in the memory.
#define | PLUGIN_EXT "plw"
| PLUGIN module file name extensions.
#define | PLUGIN_DLL "*." PLUGIN_EXT
| Pattern to find plugin files.
#define | IDP_EXT "w32"
| IDP module file name extension.
#define | IDP_DLL "*." IDP_EXT
| Pattern to find idp files.
#define | MAX_DATABASE_DESCRIPTION 128
| Maximum database snapshot description length.
#define | SSF_AUTOMATIC 0x0001
| automatic snapshot
#define | SSUF_DESC 0x00000001
| Update the description.
#define | SSUF_PATH 0x00000002
| Update the path.
#define | SSUF_FLAGS 0x00000004
| Update the flags.
#define | DBFL_KILL 0x01
| delete unpacked database
#define | DBFL_COMP 0x02
| collect garbage
#define | DBFL_BAK 0x04
| create backup file (if !DBFL_KILL)
#define | DBFL_TEMP 0x08
| temporary database

## Typedefs
typedef int(idaapi * | importer_t) (linput_t *li, impinfo_t *ii)
| Callback for checking dll module - passed to import_module(). More...
typedef int idaapi | hook_cb_t(void *user_data, int notification_code, va_list va)
| Callback provided to hook_to_notification_point(). More...
typedef qvector< idp_name_t > | idp_names_t
| vector of processor names
typedef qvector< idp_desc_t > | idp_descs_t
| vector of processor module descriptions
typedef qvector< snapshot_t * > | snapshots_t
| vector of database snapshots

## Enumerations
enum | ofile_type_t { OFILE_MAP = 0, OFILE_EXE = 1, OFILE_IDC = 2, OFILE_LST = 3, OFILE_ASM = 4, OFILE_DIF = 5 }
| Output file types. More...
enum | hook_type_t { HT_IDP, HT_UI, HT_DBG, HT_IDB, HT_DEV, HT_VIEW, HT_OUTPUT, HT_LAST }
| Types of events that be hooked to with hook_to_notification_point() More...

## Macro Definition Documentation

#define ACCEPT_FIRST 0x8000

Specify that a file format should be place first in "load file" dialog box.

See loader_t::accept_file

#define FILEREG_PATCHABLE 1

means that the input file may be

patched (i.e. no compression, no iterated data, etc)

#define FILEREG_NOTPATCHABLE 0

the data is kept in some encoded

form in the file.

## Typedef Documentation

typedef int(idaapi* importer_t) (linput_t *li, impinfo_t *ii)

Callback for checking dll module - passed to import_module().

Parameters

  li | pointer to input file
  ii | import info. If the function finds that ii.dllname does not match the module name passed to import_module(), it returns 0. Otherwise it calls ii.func for each exported entry. If ii.dllname==NULL then ii.func will be called with num==0 and name==dllname.

Return values

  0 | dllname doesn't match, import_module() should continue
  1 | ok

typedef int idaapi hook_cb_t(void *user_data, int notification_code, va_list va)

Callback provided to hook_to_notification_point().

A plugin can hook to a notification point and receive notifications of all major events in IDA. The callback function will be called for each event.

Parameters

  user_data | data supplied in call to hook_to_notification_point()
  notification_code | processor_t::idp_notify or ui_notification_t, depending on the hook type
  va | additional parameters supplied with the notification. see the event descriptions for information

Return values

  0 | ok, the event should be processed further
  !=0 | the event is blocked and should be discarded. in the case of processor modules, the returned value is used as the return value of processor_t::notify()

## Enumeration Type Documentation

enum ofile_type_t

Output file types.

Enumerator
OFILE_MAP | MAP file.
OFILE_EXE | Executable file.
OFILE_IDC | IDC file.
OFILE_LST | Disassembly listing.
OFILE_ASM | Assembly.
OFILE_DIF | Difference.

enum hook_type_t

Types of events that be hooked to with hook_to_notification_point()

Enumerator
HT_IDP | Hook to the processor module. The callback will receive all processor_t::idp_notify events.
HT_UI | Hook to the user interface. The callback will receive all ui_notification_t events.
HT_DBG | Hook to the debugger. The callback will receive all dbg_notification_t events.
HT_IDB | Hook to the database events. These events are separated from the HT_IDP group to speed things up (there are too many plugins and modules hooking to the HT_IDP). Some essential events are still generated in th HT_IDP group: make_code, make_data, undefine, rename, add_func, del_func. This list is not exhaustive. A common trait of all events in this group: the kernel does not expect any reaction to the event and does not check the return code. For event names, see idb_event.
HT_DEV | Internal debugger events. Not stable and undocumented for the moment
HT_VIEW | Custom/IDA views notifications. Refer to view_notification_t for notification codes
HT_OUTPUT | Output window notifications. Refer to msg_notification_t (view_notification_t)

## Function Documentation

NORETURN void loader_failure | ( | const char * | format = `NULL`,
|  |  | ...
| ) |  |
| inline

Display a message about a loader failure and stop the loading process.

The kernel will destroy the database. If format == NULL, no message will be displayed This function does not return (it longjumps)! It may be called only from loader_t::load_file

idaman char* ida_export get_loader_name_from_dll | ( | char * | dllname | ) |

Get name of loader from its DLL file (for example, for PE files we will get "PE").

This function modifies the original string and returns a pointer into it. NB: if the file extension is a registered extlang extension (e.g. py or idc) the extension is retained

idaman ssize_t ida_export get_loader_name | ( | char * | buf,
|  | size_t | bufsize
| ) |  |

Get name of loader used to load the input file into the database.

If no external loader was used, returns -1. Otherwise copies the loader file name without the extension in the buf and returns its length (for example, for PE files we will get "PE"). For scripted loaders, the file extension is retained.

idaman bool ida_export init_loader_options | ( | linput_t * | li,
|  | const load_info_t * | loader
| ) |  |

Initialize user configurable options from the given loader based on the input file.

idaman bool ida_export load_binary_file | ( | const char * | filename,
|  | linput_t * | li,
|  | ushort | _neflags,
|  | int32 | fileoff,
|  | ea_t | basepara,
|  | ea_t | binoff,
|  | uint32 | nbytes
| ) |  |

Load a binary file into the database.

This function usually is called from ui.

Parameters

  filename | the name of input file as is (if the input file is from library, then this is the name from the library)
  li | loader input source
  _neflags | Load file flags. For the first file, the flag NEF_FIRST must be set.
  fileoff | Offset in the input file
  basepara | Load address in paragraphs
  binoff | Load offset (load_address=(basepara<<4)+binoff)
  nbytes | Number of bytes to load from the file. 0: up to the end of the file

If nbytes is bigger than the number of bytes rest, the kernel will load as much as possible

Return values

  true | ok
  false | failed (couldn't open the file)

idaman bool ida_export load_nonbinary_file | ( | const char * | filename,
|  | linput_t * | li,
|  | const char * | sysdlldir,
|  | ushort | _neflags,
|  | load_info_t * | loader
| ) |  |

Load a non-binary file into the database.

This function usually is called from ui.

Parameters

  filename | the name of input file as is (if the input file is from library, then this is the name from the library)
  li | loader input source
  sysdlldir | a directory with system dlls. Pass "." if unknown.
  _neflags | Load file flags. For the first file the flag NEF_FIRST must be set.
  loader | pointer to load_info_t structure. If the current IDP module has processor_t::loader != NULL then this argument is ignored.

Returns
  success

idaman int ida_export gen_file | ( | ofile_type_t | otype,
|  | FILE * | fp,
|  | ea_t | ea1,
|  | ea_t | ea2,
|  | int | flags
| ) |  |

Generate an output file.

Parameters

  otype | type of output file.
  fp | the output file handle
  ea1 | start address. For some file types this argument is ignored
  ea2 | end address. For some file types this argument is ignored as usual in ida, the end address of the range is not included
  flags | Generate file flags

For OFILE_EXE:

Return values

  0 | can't generate exe file
  1 | ok

For other file types:

Returns
  number of the generated lines. -1 if an error occurred

idaman int ida_export file2base | ( | linput_t * | li,
|  | int32 | pos,
|  | ea_t | ea1,
|  | ea_t | ea2,
|  | int | patchable
| ) |  |

Load portion of file into the database.

This function will include (ea1..ea2) into the addressing space of the program (make it enabled)

Parameters

  li | pointer of input source
  pos | position in the file
  ea1,ea2 | range of destination linear addresses
  patchable | should the kernel remember correspondence of file offsets to linear addresses.

Return values

  1 | ok
  0 | read error, a warning is displayed

idaman int ida_export mem2base | ( | const void * | memptr,
|  | ea_t | ea1,
|  | ea_t | ea2,
|  | int32 | fpos
| ) |  |

Load database from the memory.

This function works for wide byte processors too.

Parameters

  memptr | pointer to buffer with bytes
  ea1,ea2 | range of destination linear addresses
  fpos | position in the input file the data is taken from. if == -1, then no file position correspond to the data.

Returns
  1 always

idaman int ida_export base2file | ( | FILE * | fp,
|  | int32 | pos,
|  | ea_t | ea1,
|  | ea_t | ea2
| ) |  |

Unload database to a binary file.

This function works for wide byte processors too.

Parameters

  fp | pointer to file
  pos | position in the file
  ea1,ea2 | range of source linear addresses

Returns
  1-ok(always), write error leads to immediate exit

idaman bool ida_export extract_module_from_archive | ( | char * | filename,
|  | size_t | bufsize,
|  | bool | is_remote,
|  | char ** | temp_file_ptr
| ) |  |

Extract a module for an archive file.

Parse an archive file, show the list of modules to the user, allow him to select a module, extract the selected module to a file (if the extract module is an archive, repeat the process). This function can handle ZIP, AR, AIXAR, OMFLIB files. The temporary file will be automatically deleted by IDA at the end.

Parameters

  [in,out] | filename | in: input file. out: name of the selected module.
  | bufsize | size of the buffer with 'filename'
  | is_remote | is the input file remote?
  [out] | temp_file_ptr | will point to the name of the file that contains the extracted module

Return values

  true | ok
  false | something bad happened (error message has been displayed to the user)

idaman void ida_export create_filename_cmt | ( | void |  | ) |

Add long comment at idainfo::minEA.

- Input file: ....
- File format: ....

This function should be called only from the loader to describe the input file.

idaman filetype_t ida_export get_basic_file_type | ( | linput_t * | li | ) |

Get the input file type.

This function can recognize libraries and zip files.

idaman size_t ida_export get_file_type_name | ( | char * | buf,
|  | size_t | bufsize
| ) |  |

Get name of the current file type.

The current file type is kept in idainfo::filetype.

Parameters

  buf | buffer for the file type name
  bufsize | its size

Returns
  size of answer, this function always succeeds

idaman void ida_export import_module | ( | const char * | module,
|  | const char * | windir,
|  | uval_t | modnode,
|  | importer_t | importer,
|  | const char * | ostype
| ) |  |

Find and import a DLL module.

This function adds information to the database (renames functions, etc).

Parameters

  module | name of DLL
  windir | system directory with dlls
  modnode | node with information about imported entries. either altval or supval arrays may be absent. the node should never be deleted. imports by ordinals: altval(ord) contains linear address imports by name: supval(ea) contains the imported name
  importer | callback function (may be NULL) to check dll module
  ostype | type of operating system (subdir name). NULL means the IDS directory itself (not recommended)

idaman int ida_export load_ids_module | ( | char * | fname | ) |

Load and apply IDS file.

This function loads the specified IDS file and applies it to the database. If the program imports functions from a module with the same name as the name of the ids file being loaded, then only functions from this module will be affected. Otherwise (i.e. when the program does not import a module with this name) any function in the program may be affected.

Parameters

  fname | name of file to apply

Return values

  1 | ok
  0 | some error (a message is displayed). if the ids file does not exist, no message is displayed

idaman int ida_export unhook_from_notification_point | ( | hook_type_t | hook_type,
|  | hook_cb_t * | cb,
|  | void * | user_data = `NULL`
| ) |  |

Unregister a callback (also see hook_to_notification_point()).

A plugin should unhook before being unloaded (preferably in its termination function). If different callbacks have the same callback function pointer and user_data is not NULL, only the callback whose associated user defined data matches will be removed.

Returns
  number of unhooked functions.

idaman int ida_export invoke_callbacks | ( | hook_type_t | hook_type,
|  | int | notification_code,
|  | va_list | va
| ) |  |

A well behaved processor module should call this function in its processor_t::notify() function.

If this function returns 0, then the processor module should process the notification itself. Otherwise the code should be returned to the caller, like this:

1 int code = invoke_callbacks(HT_IDP, what, va);
2 if ( code ) return code;
3 ...

idaman const char* ida_export get_plugin_options | ( | const char * | plugin | ) |

Get plugin options from the command line.

If the user has specified the options in the -Oplugin_name:options format, them this function will return the 'options' part of it The 'plugin' parameter should denote the plugin name Returns NULL if there we no options specified

idaman int ida_export enum_plugins | ( | int(idaapi *)(const char *file, void *ud) | func,
|  | void * | ud,
|  | char * | answer,
|  | size_t | answer_size,
|  | const extlang_t ** | el = `NULL`
| ) |  |

Enumerate IDA plugins.

Returns when func() returns nonzero.

Parameters

  answer | buffer to contain the file name for which func()!=0 (answer may be == NULL)
  answer_size | size of 'answer'
  func | callback function called for each file file: full file name (with path) ud: user data

if 'func' returns non-zero value, the enumeration is stopped and full path of the current file is returned to the caller.

Parameters

  ud | user data. this pointer will be passed to the callback function
  el | If the plugin is a scripted plugin, then 'el' will point to the associated extlang. This parameter may be NULL

Returns
  zero or the code returned by func()

idaman plugin_info_t* ida_export get_plugins | ( | void |  | ) |

Get pointer to the list of plugins.

(some plugins might be listed several times in the list - once for each configured argument)

idaman plugin_t* ida_export load_plugin | ( | const char * | name | ) |

Load a user-defined plugin.

Parameters

  name | short plugin name without path and extension, or absolute path to the file name

Returns
  pointer to plugin description block

idaman bool ida_export run_plugin | ( | const plugin_t * | ptr,
|  | int | arg
| ) |  |

Run a loaded plugin with the specified argument.

Parameters

  ptr | pointer to plugin description block
  arg | argument to run with

idaman bool ida_export invoke_plugin | ( | plugin_info_t * | ptr | ) |

Run a plugin as configured.

Parameters

  ptr | pointer to plugin information block

idaman int32 ida_export get_fileregion_offset | ( | ea_t | ea | ) |

Get offset in the input file which corresponds to the given ea.

If the specified ea can't be mapped into the input file offset, return -1.

idaman ea_t ida_export get_fileregion_ea | ( | int32 | offset | ) |

Get linear address which corresponds to the specified input file offset.

If can't be found, return BADADDR

idaman int ida_export gen_exe_file | ( | FILE * | fp | ) |

Generate an exe file (unload the database in binary form).

Returns
  fp the output file handle. if fp == NULL then return:
  - 1: can generate an executable file
  - 0: can't generate an executable file

Return values

  1 | ok
  0 | failed

idaman int ida_export reload_file | ( | const char * | file,
|  | bool | is_remote
| ) |  |

Reload the input file.

This function reloads the byte values from the input file. It doesn't modify the segmentation, names, comments, etc.

Parameters

  file | name of the input file. if file == NULL then returns: 1: can reload the input file 0: can't reload the input file
  is_remote | is the file located on a remote computer with the debugger server?

Return values

  1 | ok
  0 | failed

idaman bool ida_export build_snapshot_tree | ( | snapshot_t * | root | ) |

Build the snapshot tree.

Parameters

  root | snapshot root that will contain the snapshot tree elements.

Returns
  success

idaman bool ida_export update_snapshot_attributes | ( | const char * | filename,
|  | const snapshot_t * | root,
|  | const snapshot_t * | attr,
|  | int | uf
| ) |  |

Update the snapshot attributes.

Note
  only the snapshot description can be updated.

Parameters

  filename | snapshot file name or NULL for the current database
  root | snapshot root (returned from build_snapshot_tree())
  attr | snapshot instance containing the updated attributes
  uf | Snapshot update flags

Returns
  success

idaman int ida_export visit_snapshot_tree | ( | snapshot_t * | root,
|  | int(idaapi *)(snapshot_t *ss, void *ud) | callback,
|  | void * | ud
| ) |  |

Visit the snapshot tree.

Parameters

  root | snapshot root to start the enumeration from
  callback | callback called for each child. return 0 to continue enumeration and non-zero to abort enumeration
  ud | user data. will be passed back to the callback

Returns
  true-ok, false-failed

idaman bool ida_export save_database_ex | ( | const char * | outfile,
|  | uint32 | flags,
|  | const snapshot_t * | root = `NULL`,
|  | const snapshot_t * | attr = `NULL`
| ) |  |

Save current database using a new file name.

Parameters

  outfile | output database file name
  flags | Database flags
  root | optional: snapshot tree root.
  attr | optional: snapshot attributes

Note
  when both root and attr are not NULL then the snapshot attributes will be updated, otherwise the snapshot attributes will be inherited from the current database.

Returns
  success