I want to script a x86Emu plugin (an IDA emulator) with IdaPython. It's registered idc functions. Below is function names from the plugin source code.
/* add IDC functions for interacting with the emulator
EmuRun();
EmuTrace();
EmuStepOne();
EmuTraceOne();
EmuSync();
EmuGetReg(regno);
EmuSetReg(regno, value);
EmuAddBpt(addr);
*/
This functions works well in idc. I found a class calling idc function in idaapi.py
.
class _IdcFunction(object):
"""
Internal class that calls pyw_call_idc_func() with a context
"""
def \_\_init\_\_(self, ctxptr):
self.ctxptr = ctxptr
# Take a reference to the ctypes callback
# (note: this will create a circular reference)
self.cb = _IDCFUNC_CB_T(self)
fp_ptr = property(lambda self: ctypes.cast(self.cb, ctypes.c_void_p).value)
def \_\_call\_\_(self, args, res):
return call_idc_func__(self.ctxptr, args, res)
When I type this:
import ctypes
idaapi._IdcFuntion( ctypes ).\_\_call\_\_( 'EmuStepOne', ctypes.c_voidp )
I get the following error:
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: Don't know how to convert parameter 1
I don't know why I get this error, has anyone an idea ?
idc.Eval("Some IDC Expression")
is another option.