| IDA SDK

Classes | Functions | Macros | Typedefs | Enumerations | Variables
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=nullptr,...)
| 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, const char *filename)
| 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 | load_binary_file (const char *filename, linput_t *li, ushort _neflags, qoff64_t fileoff, ea_t basepara, ea_t binoff, uint64 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 | process_archive (qstring *temp_file, linput_t *li, qstring *module_name, ushort *neflags, const char *defmember, const load_info_t *loader, qstring *errbuf=nullptr)
| Calls loader_t::process_archive() For parameters and return value description look at loader_t::process_archive(). 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, qoff64_t 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, qoff64_t fpos)
| Load database from the memory. More...
idaman int ida_export | base2file (FILE *fp, qoff64_t 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, char **temp_file_ptr, bool is_remote)
| Extract a module for an archive file. More...
idaman void ida_export | create_filename_cmt (void)
| Add long comment at idainfo::min_ea. 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 void ida_export | set_import_ordinal (uval_t modnode, ea_t ea, uval_t ord)
| Set information about the ordinal import entry. More...
idaman void ida_export | set_import_name (uval_t modnode, ea_t ea, const char *name)
| Set information about the named import entry. More...
idaman int ida_export | load_ids_module (char *fname)
| Load and apply IDS file. More...
| CASSERT (sizeof(plugin_t)==36)
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 plugin_info_t *ida_export | get_plugins (void)
| Get pointer to the list of plugins. More...
idaman plugin_t *ida_export | find_plugin (const char *name, bool load_if_needed=false)
| Find a user-defined plugin and optionally load it. More...
plugin_t * | load_plugin (const char *name)
idaman bool ida_export | run_plugin (const plugin_t *ptr, size_t arg)
| Run a loaded plugin with the specified argument. More...
bool idaapi | load_and_run_plugin (const char *name, size_t 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 qoff64_t 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 (qoff64_t 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 bool 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=nullptr)
| 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 (const char *outfile=nullptr, uint32 flags=-1, const snapshot_t *root=nullptr, const snapshot_t *attr=nullptr)
| Save current database using a new file name. More...
idaman bool ida_export | is_database_flag (uint32 dbfl)
| Get the current database flag. More...
idaman void ida_export | set_database_flag (uint32 dbfl, bool cnd=true)
| Set or clear database flag. More...
void | clr_database_flag (uint32 dbfl)
bool | is_temp_database (void)
| Is a temporary database?
idaman const char *ida_export | get_path (path_type_t pt)
| Get the file path. More...
idaman void ida_export | set_path (path_type_t pt, const char *path)
| Set the file path. More...
idaman bool ida_export | is_database_ext (const char *ext)
| Check the file extension. More...
idaman const char *ida_export | get_elf_debug_file_directory ()
| Get the value of the ELF_DEBUG_FILE_DIRECTORY configuration directive. More...

## Macros
#define | LDRF_RELOAD 0x0001
| loader recognizes NEF_RELOAD flag
#define | LDRF_REQ_PROC 0x0002
| Requires a processor to be set. More...
#define | ACCEPT_ARCHIVE 0x2000
| Specify that a file format is served by archive loader See loader_t::accept_file.
#define | ACCEPT_CONTINUE 0x4000
| Specify that the function must be called another time See loader_t::accept_file.
#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 into the database. More...
#define | NEF_CODE 0x0100
| for load_binary_file(): load as a code segment
#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 segment bytes from the input file; use only the file header metadata)
#define | NEF_LOPT 0x1000
| Display additional loader options dialog.
#define | NEF_LALL 0x2000
| Load all segments without questions.
#define | DLLEXT "dll"
#define | LOADER_DLL "*32." DLLEXT
#define | LIF_ARCHLDR 0x0001
| archive loader
#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 patched (i.e. More...
#define | FILEREG_NOTPATCHABLE 0
| the data is kept in some encoded form in the file. 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_MULTI 0x0100
| The plugin can work with multiple idbs in parallel. More...
#define | PLUGIN_SCRIPTED 0x8000
| Scripted plugin. More...
#define | PLUGIN_DLL "*32." DLLEXT
| Pattern to find plugin files.
#define | IDP_DLL "*32." DLLEXT
#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 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 | path_type_t { PATH_TYPE_CMD , PATH_TYPE_IDB , PATH_TYPE_ID0 }

## Variables
idaman ida_module_data plugin_t | PLUGIN

## Macro Definition Documentation

## ◆ ACCEPT_FIRST

#define ACCEPT_FIRST 0x8000

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

See loader_t::accept_file

## ◆ FILEREG_PATCHABLE

#define FILEREG_PATCHABLE 1

means that the input file may be patched (i.e.

no compression, no iterated data, etc)

## ◆ FILEREG_NOTPATCHABLE

#define FILEREG_NOTPATCHABLE 0

the data is kept in some encoded form in the file.

## Typedef Documentation

## ◆ importer_t

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==nullptr 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

## Enumeration Type Documentation

## ◆ ofile_type_t

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.

## Function Documentation

## ◆ loader_failure()

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

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

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

## ◆ get_loader_name_from_dll()

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

## ◆ get_loader_name()

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.

## ◆ load_binary_file()

idaman bool ida_export load_binary_file | ( | const char * | filename,
|  | linput_t * | li,
|  | ushort | _neflags,
|  | qoff64_t | fileoff,
|  | ea_t | basepara,
|  | ea_t | binoff,
|  | uint64 | 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)

## ◆ load_nonbinary_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 != nullptr then this argument is ignored.

Returns
  success

## ◆ process_archive()

idaman int ida_export process_archive | ( | qstring * | temp_file,
|  | linput_t * | li,
|  | qstring * | module_name,
|  | ushort * | neflags,
|  | const char * | defmember,
|  | const load_info_t * | loader,
|  | qstring * | errbuf = `nullptr`
| ) |  |

Calls loader_t::process_archive() For parameters and return value description look at loader_t::process_archive().

Additional parameter 'loader' is a pointer to load_info_t structure.

## ◆ gen_file()

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

## ◆ file2base()

idaman int ida_export file2base | ( | linput_t * | li,
|  | qoff64_t | 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

Note
  The storage type of the specified range will be changed to STT_VA.

## ◆ mem2base()

idaman int ida_export mem2base | ( | const void * | memptr,
|  | ea_t | ea1,
|  | ea_t | ea2,
|  | qoff64_t | 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

Note
  The storage type of the specified range will be changed to STT_VA.

## ◆ base2file()

idaman int ida_export base2file | ( | FILE * | fp,
|  | qoff64_t | 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

## ◆ extract_module_from_archive()

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

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'
  [out] | temp_file_ptr | will point to the name of the file that contains the extracted module
  | is_remote | is the input file remote?

Return values

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

## ◆ create_filename_cmt()

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

Add long comment at idainfo::min_ea.

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

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

## ◆ get_basic_file_type()

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.

## ◆ get_file_type_name()

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

## ◆ import_module()

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 please use set_import_ordinal()/set_import_name() to work with MODNODE
  importer | callback function (may be nullptr) to check dll module
  ostype | type of operating system (subdir name). nullptr means the IDS directory itself (not recommended)

## ◆ set_import_ordinal()

idaman void ida_export set_import_ordinal | ( | uval_t | modnode,
|  | ea_t | ea,
|  | uval_t | ord
| ) |  |

Set information about the ordinal import entry.

This function performs 'modnode.altset(ord, ea2node(ea));'

Parameters

  modnode | node with information about imported entries
  ea | linear address of the entry
  ord | ordinal number of the entry

## ◆ set_import_name()

idaman void ida_export set_import_name | ( | uval_t | modnode,
|  | ea_t | ea,
|  | const char * | name
| ) |  |

Set information about the named import entry.

This function performs 'modnode.supset_ea(ea, name);'

Parameters

  modnode | node with information about imported entries
  ea | linear address of the entry
  name | name of the entry

## ◆ load_ids_module()

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

## ◆ get_plugin_options()

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 nullptr if there we no options specified

## ◆ get_plugins()

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)

## ◆ find_plugin()

idaman plugin_t *ida_export find_plugin | ( | const char * | name,
|  | bool | load_if_needed = `false`
| ) |  |

Find a user-defined plugin and optionally load it.

Parameters

  name | short plugin name without path and extension, or absolute path to the file name
  load_if_needed | if the plugin is not present in the memory, try to load it

Returns
  pointer to plugin description block

## ◆ run_plugin()

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

Run a loaded plugin with the specified argument.

Parameters

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

## ◆ invoke_plugin()

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

Run a plugin as configured.

Parameters

  ptr | pointer to plugin information block

## ◆ get_fileregion_offset()

idaman qoff64_t 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.

## ◆ get_fileregion_ea()

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

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

If can't be found, return BADADDR

## ◆ gen_exe_file()

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 == nullptr then return:
  - 1: can generate an executable file
  - 0: can't generate an executable file

Return values

  1 | ok
  0 | failed

## ◆ reload_file()

idaman bool 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 == nullptr 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?

Returns
  success

## ◆ build_snapshot_tree()

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

## ◆ update_snapshot_attributes()

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 nullptr 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

## ◆ visit_snapshot_tree()

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

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

## ◆ save_database()

idaman bool ida_export save_database | ( | const char * | outfile = `nullptr`,
|  | uint32 | flags = `-1`,
|  | const snapshot_t * | root = `nullptr`,
|  | const snapshot_t * | attr = `nullptr`
| ) |  |

Save current database using a new file name.

Parameters

  outfile | output database file name; nullptr means the current path
  flags | Database flags; -1 means the current flags
  root | optional: snapshot tree root.
  attr | optional: snapshot attributes

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

Returns
  success

## ◆ is_database_flag()

idaman bool ida_export is_database_flag | ( | uint32 | dbfl | ) |

Get the current database flag.

Parameters

  dbfl | flag Database flags

Returns
  the state of the flag (set or cleared)

## ◆ set_database_flag()

idaman void ida_export set_database_flag | ( | uint32 | dbfl,
|  | bool | cnd = `true`
| ) |  |

Set or clear database flag.

Parameters

  dbfl | flag Database flags
  cnd | set if true or clear flag otherwise

## ◆ get_path()

idaman const char *ida_export get_path | ( | path_type_t | pt | ) |

Get the file path.

Parameters

  pt | file path type Types of the file pathes

Returns
  file path, never returns nullptr

## ◆ set_path()

idaman void ida_export set_path | ( | path_type_t | pt,
|  | const char * | path
| ) |  |

Set the file path.

Parameters

  pt | file path type Types of the file pathes
  path | new file path, use nullptr or empty string to clear the file path

## ◆ is_database_ext()

idaman bool ida_export is_database_ext | ( | const char * | ext | ) |

Check the file extension.

Returns
  true if it is the reserved extension

## ◆ get_elf_debug_file_directory()

idaman const char *ida_export get_elf_debug_file_directory | ( |  | ) |

Get the value of the ELF_DEBUG_FILE_DIRECTORY configuration directive.