idaman int ida_export
gen_file(ofile_type_t otype, FILE *fp, ea_t ea1, ea_t ea2, int flags)
Generate an output file, *fp, based on the currently open IDB file. ea1 and ea2 are the start and end addresses respectively, however these are ignored for some output types. otype must be one of the following, taken from loader.hpp:
flags can be any combination of the following, also taken from loader.hpp:
#define GENFLG_MAPSEG 0x0001 // map: generate map of segments
#define GENFLG_MAPNAME 0x0002 // map: include dummy names
#define GENFLG_MAPDMNG 0x0004 // map: demangle names
#define GENFLG_MAPLOC 0x0008 // map: include local names
#define GENFLG_IDCTYPE 0x0008 // idc: gen only information about types
#define GENFLG_ASMTYPE 0x0010 // asm&lst: gen information about types too
#define GENFLG_GENHTML 0x0020 // asm&lst: generate html (ui_genfile_callback will be used)
#define GENFLG_ASMINC 0x0040 // asm&lst: gen information only about types
The function will return -1 if there was an error, or the number of lines generated if it was a success. For OFILE_EXE files, it returns 0 for failure, 1 for success.
Examples:
#include <loader.hpp>
// Open the output file
FILE *fp = qfopen("C:\\output.idc", "w");
// Generate an IDC output file
gen_file(OFILE_IDC, fp, inf.minEA, inf.maxEA, 0);
// Close the output file
qfclose(fp);