mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-24 18:16:55 +01:00
78c79f85b9
What's new: - Proper multi-threaded support - Better PyObject reference counting with ref_t and newref_t helper classes - Improved the pywraps/deployment script - Added IDAViewWrapper class and example - Added idc.GetDisasmEx() - Added idc.AddSegEx() - Added idc.GetLocalTinfo() - Added idc.ApplyType() - Updated type information implementation - Introduced the idaapi.require() - see http://www.hexblog.com/?p=749 - set REMOVE_CWD_SYS_PATH=1 by default in python.cfg (remove current directory from the import search path). Various bugfixes: - fixed various memory leaks - asklong/askaddr/asksel (and corresponding idc.py functions) were returning results truncated to 32 bits in IDA64 - fix wrong documentation for idc.SizeOf - GetFloat/GetDouble functions did not take into account endianness of the processor - idaapi.NO_PROCESS was not defined, and was causing GetProcessPid() to fail - idc.py: insert escape characters to string parameter when call Eval() - idc.SaveFile/savefile were always overwriting an existing file instead of writing only the new data - PluginForm.Close() wasn't passing its arguments to the delegate function, resulting in an error.
80 lines
2.6 KiB
C++
80 lines
2.6 KiB
C++
#include "py_dbg.hpp"
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyObject *ex_getthreadsregbase(PyObject * /*self*/, PyObject *args)
|
|
{
|
|
PyObject *py_tid, *py_sreg_value;
|
|
if ( !PyArg_ParseTuple(args, "OO", &py_tid, &py_sreg_value) )
|
|
return NULL;
|
|
return dbg_get_thread_sreg_base(py_tid, py_sreg_value);
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyObject *ex_readmemory(PyObject * /*self*/, PyObject *args)
|
|
{
|
|
PyObject *py_ea, *py_size;
|
|
if ( !PyArg_ParseTuple(args, "OO", &py_ea, &py_size) )
|
|
return NULL;
|
|
return dbg_read_memory(py_ea, py_size);
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyObject *ex_writememory(PyObject * /*self*/, PyObject *args)
|
|
{
|
|
PyObject *py_ea, *py_buf;
|
|
if ( !PyArg_ParseTuple(args, "OO", &py_ea, &py_buf) )
|
|
return NULL;
|
|
return dbg_write_memory(py_ea, py_buf);
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyObject *ex_getmeminfo(PyObject * /*self*/, PyObject *args)
|
|
{
|
|
return dbg_get_memory_info();
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyObject *ex_getregs(PyObject *self, PyObject *args)
|
|
{
|
|
return dbg_get_registers();
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyObject *ex_appcall(PyObject * /*self*/, PyObject *args)
|
|
{
|
|
PyObject *app_args, *type, *fields;
|
|
int func_ea, tid;
|
|
if ( !PyArg_ParseTuple(args, "iiOOO", &func_ea, &tid, &type, &fields, &app_args) )
|
|
return NULL;
|
|
return py_appcall(func_ea, tid, type, fields, app_args);
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyObject *ex_pytoidc(
|
|
PyObject *self,
|
|
PyObject *args)
|
|
{
|
|
if ( !PyArg_ParseTuple(args, "O", &self) )
|
|
return NULL;
|
|
idc_value_t v;
|
|
int sn = 0;
|
|
borref_t self_ref(self);
|
|
if ( pyvar_to_idcvar(self_ref, &v, &sn) < CIP_OK )
|
|
Py_RETURN_NONE;
|
|
Py_RETURN_TRUE;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
static PyMethodDef py_methods_dbg[] =
|
|
{
|
|
{"getregs", ex_getregs, METH_VARARGS, ""},
|
|
{"getmeminfo", ex_getmeminfo, METH_VARARGS, ""},
|
|
{"readmemory", ex_readmemory, METH_VARARGS, ""},
|
|
{"writememory", ex_writememory, METH_VARARGS, ""},
|
|
{"getthreadsregbase", ex_getthreadsregbase, METH_VARARGS, ""},
|
|
{"appcall", ex_appcall, METH_VARARGS, ""},
|
|
{"pytoidc", ex_pytoidc, METH_VARARGS, ""},
|
|
{NULL, NULL, 0, NULL} /* Sentinel */
|
|
};
|
|
DRIVER_INIT_METHODS(dbg);
|