IDA SDK
Public Attributes | List of all members
loader_t Struct Reference

Detailed Description

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

Public Attributes

uint32 version
 api version, should be IDP_INTERFACE_VERSION
 
uint32 flags
 Loader flags
 
int(idaapiaccept_file )(qstring *fileformatname, qstring *processor, linput_t *li, const char *filename)
 Check input file format. More...
 
void(idaapiload_file )(linput_t *li, ushort neflags, const char *fileformatname)
 Load file into the database. More...
 
int(idaapisave_file )(FILE *fp, const char *fileformatname)
 Create output file from the database. More...
 
int(idaapimove_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(idaapiprocess_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...
 

Member Data Documentation

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

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

Create output file from the database.

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

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

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

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);

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
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 NULL
errbuferror message if 0 is returned, may be NULL
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: