From f352f77edf298bf6e1ff865cd62a098587e928c7 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Sun, 22 Mar 2009 14:58:07 +0000 Subject: [PATCH] idp.i: Added assemble() function to idaapi. Thanks to Ero Carrera for the patch. --- swig/idp.i | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/swig/idp.i b/swig/idp.i index c5ed951..ff9e0a0 100644 --- a/swig/idp.i +++ b/swig/idp.i @@ -279,4 +279,32 @@ int idaapi IDB_Callback(void *ud, int notification_code, va_list va) } } } + +// Assemble an instruction (display a warning if an error is found) +// args: +// ea_t ea - linear address of instruction +// ea_t cs - cs of instruction +// ea_t ip - ip of instruction +// bool use32 - is 32bit segment? +// const char *line - line to assemble +// returns: 1: success, 0: failure +inline const int assemble(ea_t ea, ea_t cs, ea_t ip, bool use32, const char *line) +{ + int instr_len, i; + char buf[256]; // FIXME: Shouldn't be longer than this... is there a MAX_INSTR_LENGTH anywhere? + + if (ph.notify != NULL) + { + instr_len = ph.notify(ph.assemble, ea, cs, ip, use32, line, buf); + if (instr_len > 0) + { + for (i=0; i