Latest available version: IDA and decompilers v8.4.240320sp1 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon
loader_t Struct Reference

Loader description block - must be exported from the loader module. More...

#include <loader.hpp>

Public Attributes

uint32 version
 api version, should be IDP_INTERFACE_VERSION
 
uint32 flags
 Loader flags
 
int(idaapi * accept_file )(qstring *fileformatname, qstring *processor, linput_t *li, const char *filename)
 Check input file format. More...
 
void(idaapi * load_file )(linput_t *li, ushort neflags, const char *fileformatname)
 Load file into the database. More...
 
int(idaapi * save_file )(FILE *fp, const char *fileformatname)
 Create output file from the database. More...
 
int(idaapi * move_segm )(ea_t from, ea_t to, asize_t size, const char *fileformatname)
 Take care of a moved segment (fix up relocations, for example). More...
 
int(idaapi * process_archive )(qstring *temp_file, linput_t *li, qstring *module_name, ushort *neflags, const char *fileformatname, const char *defmember, qstring *errbuf)
 Display list of archive members and let the user select one. More...
 

Detailed Description

Loader description block - must be exported from the loader module.

Member Data Documentation

◆ accept_file

int(idaapi * loader_t::accept_file) (qstring *fileformatname, qstring *processor, linput_t *li, const char *filename)

Check input file format.

This function will be called one or more times depending on the result value.

Parameters
[out]fileformatname of file format
[out]processordesired processor (optional)
liinput file
filenamename of the input file, if it is an archive member name then the actual file doesn't exist
Returns
1 if file format is recognized, and fills 'fileformatname', otherwise returns 0. This function may return a unique file format number instead of 1. To get this unique number, please contact the author. If the return value is ORed with ACCEPT_ARCHIVE, then it is an archive loader. Its process_archive() will be called instead of load_file(). If the return value is ORed with ACCEPT_CONTINUE, then this function will be called another time. If the return value is ORed with ACCEPT_FIRST, then this format should be placed first in the "load file" dialog box. In the sorting order of file formats the archive formats have priority.

◆ load_file

void(idaapi * loader_t::load_file) (linput_t *li, ushort neflags, const char *fileformatname)

Load file into the database.

Parameters
liinput file
neflagsLoad file flags
fileformatnamename of type of the file (it was returned by accept_file)

If this function fails, loader_failure() should be called

◆ save_file

int(idaapi * loader_t::save_file) (FILE *fp, const char *fileformatname)

Create output file from the database.

This function may be absent. If fp == nullptr, then this function returns:

  • 0: can't create file of this type
  • 1: ok, can create file of this type

If fp != nullptr, then this function should create the output file

◆ move_segm

int(idaapi * loader_t::move_segm) (ea_t from, ea_t to, asize_t size, const char *fileformatname)

Take care of a moved segment (fix up relocations, for example).

This function may be absent. A special calling method

move_segm(BADADDR, delta, 0, formatname);
#define BADADDR
this value is used for 'bad address'
Definition: pro.h:488
int(idaapi * move_segm)(ea_t from, ea_t to, asize_t size, const char *fileformatname)
Take care of a moved segment (fix up relocations, for example).
Definition: loader.hpp:152

means that the whole program has been moved in the memory (rebased) by delta bytes

Parameters
fromprevious linear address of the segment
tocurrent linear address of the segment
sizesize of the moved segment
fileformatnamethe file format
Return values
1ok
0failure

◆ process_archive

int(idaapi * loader_t::process_archive) (qstring *temp_file, linput_t *li, qstring *module_name, ushort *neflags, const char *fileformatname, const char *defmember, qstring *errbuf)

Display list of archive members and let the user select one.

Extract the selected archive member into a temporary file.

Parameters
[out]temp_filename of the file with the extracted archive member.
liinput file
[in,out]module_namein: name of archive out: name of the extracted archive member
[in,out]neflagsLoad file flags
fileformatnamename of type of the file (it was returned by accept_file)
defmemberextract the specified member, for example "subdir/member.exe", may be nullptr
errbuferror message if 0 is returned, may be nullptr
Returns
-1-cancelled by the user, 1-ok, 0-error, see errbuf for details

The documentation for this struct was generated from the following file: