51#define LDRF_RELOAD 0x0001
52#define LDRF_REQ_PROC 0x0002
76 int (idaapi *accept_file)(
84#define ACCEPT_ARCHIVE 0x2000
87#define ACCEPT_CONTINUE 0x4000
90#define ACCEPT_FIRST 0x8000
106#define NEF_SEGS 0x0001
107#define NEF_RSCS 0x0002
108#define NEF_NAME 0x0004
109#define NEF_MAN 0x0008
110#define NEF_FILL 0x0010
111#define NEF_IMPS 0x0020
112#define NEF_FIRST 0x0080
114#define NEF_CODE 0x0100
116#define NEF_RELOAD 0x0200
125#define NEF_FLAT 0x0400
126#define NEF_MINI 0x0800
129#define NEF_LOPT 0x1000
130#define NEF_LALL 0x2000
205#elif defined(__LINUX__)
207#elif defined(__MAC__)
208# define DLLEXT "dylib"
210# error Unknown loader ext
216# define LOADER_DLL "*." DLLEXT
218# define LOADER_DLL "*32." DLLEXT
239#define LIF_ARCHLDR 0x0001
296 const char *filename,
320 const char *filename,
322 const char *sysdlldir,
337 const char *defmember,
374#define GENFLG_MAPSEG 0x0001
375#define GENFLG_MAPNAME 0x0002
376#define GENFLG_MAPDMNG 0x0004
377#define GENFLG_MAPLOC 0x0008
378#define GENFLG_IDCTYPE 0x0008
379#define GENFLG_ASMTYPE 0x0010
380#define GENFLG_GENHTML 0x0020
381#define GENFLG_ASMINC 0x0040
407#define FILEREG_PATCHABLE 1
410#define FILEREG_NOTPATCHABLE 0
454 char **temp_file_ptr,
585#define PLUGIN_MOD 0x0001
588#define PLUGIN_DRAW 0x0002
589#define PLUGIN_SEG 0x0004
590#define PLUGIN_UNL 0x0008
595#define PLUGIN_HIDE 0x0010
597#define PLUGIN_DBG 0x0020
599#define PLUGIN_PROC 0x0040
601#define PLUGIN_FIX 0x0080
602#define PLUGIN_MULTI 0x0100
606#define PLUGIN_SCRIPTED 0x8000
611#if !defined(NO_OBSOLETE_FUNCS) || defined(__DEFINE_PLUGIN_RETURN_CODES__)
616#define PLUGIN_SKIP nullptr
617#define PLUGIN_OK ((plugmod_t *)1)
619#define PLUGIN_KEEP ((plugmod_t *)2)
626 bool (idaapi *run)(
size_t arg);
642#if !defined(__KERNEL__) && !defined(PLUGIN_SUBMODULE)
658# define PLUGIN_DLL "*." DLLEXT
660# define PLUGIN_DLL "*32." DLLEXT
670extern char dlldata[4096];
671#define DLLDATASTART 0xA0
672extern char ldrdata[64];
673#define LDRDATASTART (DLLDATASTART+sizeof(dlldata))
678 void *dllinfo[LNE_MAXSEG];
680 idadll_t(
void) { dllinfo[0] =
nullptr; entry =
nullptr; }
681 bool is_loaded(
void)
const {
return dllinfo[0] !=
nullptr; }
684#define MODULE_ENTRY_LOADER "LDSC"
685#define MODULE_ENTRY_PLUGIN "PLUGIN"
686#define MODULE_ENTRY_IDP "LPH"
688int _load_core_module(
704void load_core_module_or_die(
708idaman
bool ida_export load_core_module(
713idaman
void ida_export free_dll(idadll_t *dllmem);
750# define IDP_DLL "*." DLLEXT
752# define IDP_DLL "*32." DLLEXT
775 memset(
this, 0,
sizeof(*
this));
890#define MAX_DATABASE_DESCRIPTION 128
899 snapshot_t &operator=(
const snapshot_t &);
902 int compare(
const snapshot_t &r)
const
904 return ::compare(
id, r.
id);
913#define SSF_AUTOMATIC 0x0001
915 char desc[MAX_DATABASE_DESCRIPTION];
919 DECLARE_COMPARISON_OPERATORS(snapshot_t)
961 const char *filename,
969#define SSUF_DESC 0x00000001
970#define SSUF_PATH 0x00000002
971#define SSUF_FLAGS 0x00000004
984 int (idaapi *callback)(
snapshot_t *ss,
void *ud),
1009 const char *outfile=
nullptr,
1017#define DBFL_KILL 0x01
1018#define DBFL_COMP 0x02
1019#define DBFL_BAK 0x04
1020#define DBFL_TEMP 0x08
idaman bool ida_export is_loaded(ea_t ea)
Does the specified address have a byte value (is initialized?)
A plugin is a module in the plugins subdirectory that can perform an action asked by the user.
Definition loader.hpp:578
void(idaapi *term)(void)
Terminate plugin.
plugmod_t *idaapi * init(void)
Initialize plugin - returns a pointer to plugmod_t.
bool(idaapi *run)(size_t arg)
Invoke plugin.
int version
Should be equal to IDP_INTERFACE_VERSION.
Definition loader.hpp:580
const char * help
Multiline help about the plugin.
Definition loader.hpp:631
const char * wanted_hotkey
The preferred hotkey to run the plugin.
Definition loader.hpp:633
int flags
Plugin features
Definition loader.hpp:581
const char * comment
Long comment about the plugin.
Definition loader.hpp:628
const char * wanted_name
The preferred short name of the plugin.
Definition loader.hpp:632
Reimplementation of vector class from STL.
Definition pro.h:2250
snapshot_t ** iterator
Definition pro.h:2606
Snapshot attributes.
Definition loader.hpp:897
snapshot_t()
Definition loader.hpp:931
uint16 flags
Snapshot flags
Definition loader.hpp:909
qtime64_t id
snapshot ID. This value is computed using qgettimeofday()
Definition loader.hpp:908
char filename[QMAXPATH]
snapshot file name
Definition loader.hpp:916
char desc[MAX_DATABASE_DESCRIPTION]
snapshot description
Definition loader.hpp:915
~snapshot_t()
Definition loader.hpp:937
DEFINE_MEMORY_ALLOCATION_FUNCS() DECLARE_COMPARISON_OPERATORS(snapshot_t) void clear()
Definition loader.hpp:918
snapshots_t children
snapshot children
Definition loader.hpp:917
path_type_t
Definition loader.hpp:1044
@ PATH_TYPE_IDB
full path of IDB file
Definition loader.hpp:1046
@ PATH_TYPE_CMD
full path to the file specified in the command line
Definition loader.hpp:1045
@ PATH_TYPE_ID0
full path of ID0 file
Definition loader.hpp:1047
idaman THREAD_SAFE va_list va
See qsscanf()
Definition err.h:21
idaman THREAD_SAFE const char * format
Definition fpro.h:78
idaman THREAD_SAFE AS_PRINTF(1, 0) void ida_export vqperror(const char *format
Print error message to stderr (analog of perror)
idaman move_segm_code_t ida_export move_segm(segment_t *s, ea_t to, int flags=0)
This function moves all information to the new address.
Contains the inf structure definition and some functions common to the whole IDA project.
filetype_t
Known input file formats (kept in idainfo::filetype):
Definition ida.hpp:35
int nbytes
Definition kernwin.hpp:2861
uval_t uval_t
Definition kernwin.hpp:1878
idaman int64 pos
Definition kernwin.hpp:1365
unsigned __int64 uint64
Definition llong.hpp:13
idaman int ida_export flush_buffers(void)
Flush buffers to the disk.
CASSERT(sizeof(plugin_t)==64)
idaman void ida_export init_plugins(int flag)
Initialize plugins with the specified flag.
void clr_database_flag(uint32 dbfl)
Definition loader.hpp:1034
idaman bool ida_export update_snapshot_attributes(const char *filename, const snapshot_t *root, const snapshot_t *attr, int uf)
Update the snapshot attributes.
idaman filetype_t ida_export get_basic_file_type(linput_t *li)
Get the input file type.
bool is_temp_database(void)
Is a temporary database?
Definition loader.hpp:1037
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.
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.
idaman bool ida_export reload_file(const char *file, bool is_remote)
Reload the input file.
idaman qoff64_t ida_export get_fileregion_offset(ea_t ea)
Get offset in the input file which corresponds to the given ea.
idaman int ida_export mem2base(const void *memptr, ea_t ea1, ea_t ea2, qoff64_t fpos)
Load database from the memory.
idaman plugin_info_t *ida_export get_plugins(void)
Get pointer to the list of plugins.
idaman bool ida_export is_database_ext(const char *ext)
Check the file extension.
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.
idaman int ida_export gen_exe_file(FILE *fp)
Generate an exe file (unload the database in binary form).
qvector< snapshot_t * > snapshots_t
vector of database snapshots
Definition loader.hpp:893
idaman load_info_t *ida_export build_loaders_list(linput_t *li, const char *filename)
Build list of potential loaders.
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.
int idaapi importer_t(linput_t *li, impinfo_t *ii)
Callback for checking dll module - passed to import_module().
Definition loader.hpp:506
idaman void ida_export create_filename_cmt(void)
Add long comment at idainfo::min_ea.
idaman int ida_export gen_file(ofile_type_t otype, FILE *fp, ea_t ea1, ea_t ea2, int flags)
Generate an output file.
idaman bool ida_export run_plugin(const plugin_t *ptr, size_t arg)
Run a loaded plugin with the specified argument.
idaman const char *ida_export get_path(path_type_t pt)
Get the file path.
DECLARE_TYPE_AS_MOVABLE(load_info_t)
idaman const char *ida_export get_plugin_options(const char *plugin)
Get plugin options from the command line.
idaman size_t ida_export get_file_type_name(char *buf, size_t bufsize)
Get name of the current file type.
bool idaapi load_and_run_plugin(const char *name, size_t arg)
Load & run a plugin.
Definition loader.hpp:809
idaman bool ida_export invoke_plugin(plugin_info_t *ptr)
Run a plugin as configured.
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.
idaman ida_module_data plugin_t PLUGIN
Definition loader.hpp:643
idaman AS_PRINTF(1, 0) NORETURN void ida_export vloader_failure(const char *format
See loader_failure()
idaman void ida_export set_database_flag(uint32 dbfl, bool cnd=true)
Set or clear database flag.
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.
idaman void ida_export set_import_ordinal(uval_t modnode, ea_t ea, uval_t ord)
Set information about the ordinal import entry.
idaman size_t ida_export get_debugger_plugins(const dbg_info_t **array)
Get information about available debuggers.
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.
idaman bool ida_export build_snapshot_tree(snapshot_t *root)
Build the snapshot tree.
idaman int ida_export load_ids_module(char *fname)
Load and apply IDS file.
idaman const char *ida_export get_elf_debug_file_directory()
Get the value of the ELF_DEBUG_FILE_DIRECTORY configuration directive.
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").
idaman void ida_export free_loaders_list(load_info_t *list)
Free the list of loaders.
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.
idaman void ida_export term_plugins(int flag)
Terminate plugins with the specified flag.
idaman bool ida_export is_database_flag(uint32 dbfl)
Get the current database flag.
idaman void ida_export set_path(path_type_t pt, const char *path)
Set the file path.
idaman bool ida_export is_trusted_idb(void)
Is the database considered as trusted?
qvector< idp_name_t > idp_names_t
vector of processor names
Definition loader.hpp:725
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::proce...
idaman int ida_export base2file(FILE *fp, qoff64_t pos, ea_t ea1, ea_t ea2)
Unload database to a binary file.
idaman plugin_t *ida_export find_plugin(const char *name, bool load_if_needed=false)
Find a user-defined plugin and optionally load it.
idaman void ida_export set_import_name(uval_t modnode, ea_t ea, const char *name)
Set information about the named import entry.
idaman const idp_descs_t *ida_export get_idp_descs(void)
Get IDA processor modules descriptions.
ofile_type_t
Output file types.
Definition loader.hpp:344
@ OFILE_DIF
Difference.
Definition loader.hpp:350
@ OFILE_EXE
Executable file.
Definition loader.hpp:346
@ OFILE_MAP
MAP file.
Definition loader.hpp:345
@ OFILE_ASM
Assembly.
Definition loader.hpp:349
@ OFILE_IDC
IDC file.
Definition loader.hpp:347
@ OFILE_LST
Disassembly listing.
Definition loader.hpp:348
vloader_failure(format, va)
idaman ea_t ida_export get_fileregion_ea(qoff64_t offset)
Get linear address which corresponds to the specified input file offset.
qvector< idp_desc_t > idp_descs_t
vector of processor module descriptions
Definition loader.hpp:739
plugin_t * load_plugin(const char *name)
Definition loader.hpp:794
unsigned short uint16
unsigned 16 bit value
Definition pro.h:346
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
uint64 asize_t
Definition pro.h:423
uint64 ea_t
Definition pro.h:421
uint64 qtime64_t
64-bit time value expressed as seconds and microseconds since the Epoch
Definition pro.h:499
idaman size_t bufsize
Definition pro.h:600
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:381
unsigned short ushort
unsigned 16 bit value
Definition pro.h:338
_qstring< char > qstring
regular string
Definition pro.h:3694
Information for the user interface about available debuggers.
Definition loader.hpp:823
struct debugger_t * dbg
Definition loader.hpp:825
dbg_info_t(plugin_info_t *_pi, struct debugger_t *_dbg)
Definition loader.hpp:826
plugin_info_t * pi
Definition loader.hpp:824
This structure describes a debugger API module.
Definition idd.hpp:948
bool is_remote() const
Definition idd.hpp:1072
External language (to support third party language interpreters)
Definition expr.hpp:655
Processor module description.
Definition loader.hpp:729
qstring path
module file name
Definition loader.hpp:730
qstring family
processor's family
Definition loader.hpp:732
idp_desc_t()
Definition loader.hpp:736
idp_names_t names
processor names
Definition loader.hpp:733
time_t mtime
time of last modification
Definition loader.hpp:731
bool checked
internal, for cache management
Definition loader.hpp:735
bool is_script
the processor module is a script
Definition loader.hpp:734
Processor name.
Definition loader.hpp:718
qstring lname
long processor name
Definition loader.hpp:719
idp_name_t()
Definition loader.hpp:722
bool hidden
is hidden
Definition loader.hpp:721
qstring sname
short processor name
Definition loader.hpp:720
See importer_t.
Definition loader.hpp:488
const char * dllname
Definition loader.hpp:489
const char * name
Definition loader.hpp:490
void(idaapi *func)(uval_t num
const char uval_t node
Definition loader.hpp:490
List of loaders.
Definition loader.hpp:226
filetype_t ftype
Definition loader.hpp:231
qstring dllname
Definition loader.hpp:228
uint32 lflags
loader info flags
Definition loader.hpp:233
load_info_t * next
Definition loader.hpp:227
qstring processor
desired processor name
Definition loader.hpp:230
bool is_archldr(void)
Definition loader.hpp:242
qstring ftypename
Definition loader.hpp:229
uint32 loader_flags
copy of loader_t::flags
Definition loader.hpp:232
int pri
2-archldr, 1-place first, 0-normal priority
Definition loader.hpp:234
Loader description block - must be exported from the loader module.
Definition loader.hpp:45
uint32 flags
Loader flags
Definition loader.hpp:47
linput_t qstring ushort const char const char qstring * errbuf
Definition loader.hpp:180
ushort neflags
Definition loader.hpp:101
qstring linput_t const char * filename
Definition loader.hpp:80
qstring * processor
Definition loader.hpp:78
int(idaapi *process_archive)(qstring *temp_file
Display list of archive members and let the user select one.
qstring linput_t * li
Definition loader.hpp:79
ushort const char * fileformatname
Definition loader.hpp:102
ea_t asize_t size
Definition loader.hpp:155
ea_t to
Definition loader.hpp:154
void(idaapi *load_file)(linput_t *li
Load file into the database.
linput_t qstring ushort const char const char * defmember
Definition loader.hpp:179
int(idaapi *accept_file)(qstring *fileformatname
Check input file format.
int(idaapi *move_segm)(ea_t from
Take care of a moved segment (fix up relocations, for example).
linput_t qstring * module_name
Definition loader.hpp:176
uint32 version
api version, should be IDP_INTERFACE_VERSION
Definition loader.hpp:46
Structure to store plugin information.
Definition loader.hpp:759
idadll_t dllmem
Definition loader.hpp:769
char * org_name
original short name of the plugin
Definition loader.hpp:762
plugin_t * entry
pointer to the plugin if it is already loaded
Definition loader.hpp:768
int flags
a copy of plugin_t::flags
Definition loader.hpp:770
plugin_info_t()
Definition loader.hpp:773
char * path
full path to the plugin
Definition loader.hpp:761
char * name
short name of the plugin it will appear in the menu
Definition loader.hpp:763
char * comment
a copy of plugin_t::comment
Definition loader.hpp:771
ushort org_hotkey
original hotkey to run the plugin
Definition loader.hpp:765
ushort hotkey
current hotkey to run the plugin
Definition loader.hpp:766
size_t arg
argument used to call the plugin
Definition loader.hpp:767
plugin_info_t * next
next plugin information
Definition loader.hpp:760
qstring idaplg_name
"name" provided by ida-plugin.json or basename of path (without extension)
Definition loader.hpp:772