我想用 IdaPython 编写一个 x86Emu 插件(一个 IDA 模拟器)。它是注册的 idc 函数。以下是插件源代码中的函数名称。
/* add IDC functions for interacting with the emulator
EmuRun();
EmuTrace();
EmuStepOne();
EmuTraceOne();
EmuSync();
EmuGetReg(regno);
EmuSetReg(regno, value);
EmuAddBpt(addr);
*/
此功能在 idc 中运行良好。我在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)
当我输入这个时:
import ctypes
idaapi._IdcFuntion( ctypes ).\_\_call\_\_( 'EmuStepOne', ctypes.c_voidp )
我收到以下错误:
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: Don't know how to convert parameter 1
我不知道为什么会出现此错误,有人知道吗?