mirror of
https://github.com/idapython/src
synced 2026-06-08 14:47:00 +00:00
IDA Pro 6.5 support
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.
This commit is contained in:
+11
-15
@@ -9,10 +9,12 @@ struct py_idcfunc_ctx_t
|
||||
int nargs;
|
||||
py_idcfunc_ctx_t(PyObject *py_func, const char *name, int nargs): py_func(py_func), name(name), nargs(nargs)
|
||||
{
|
||||
PYW_GIL_CHECK_LOCKED_SCOPE();
|
||||
Py_INCREF(py_func);
|
||||
}
|
||||
~py_idcfunc_ctx_t()
|
||||
{
|
||||
PYW_GIL_CHECK_LOCKED_SCOPE();
|
||||
Py_DECREF(py_func);
|
||||
}
|
||||
};
|
||||
@@ -26,25 +28,25 @@ static error_t py_call_idc_func(
|
||||
// Convert IDC arguments to Python list
|
||||
py_idcfunc_ctx_t *ctx = (py_idcfunc_ctx_t *)_ctx;
|
||||
int cvt;
|
||||
ppyobject_vec_t pargs;
|
||||
char errbuf[MAXSTR];
|
||||
if ( !pyw_convert_idc_args(argv, ctx->nargs, pargs, NULL, errbuf, sizeof(errbuf)) )
|
||||
|
||||
PYW_GIL_CHECK_LOCKED_SCOPE();
|
||||
ref_vec_t pargs;
|
||||
if ( !pyw_convert_idc_args(argv, ctx->nargs, pargs, true, errbuf, sizeof(errbuf)) )
|
||||
{
|
||||
// Error during conversion? Create an IDC exception
|
||||
return PyW_CreateIdcException(r, errbuf);
|
||||
}
|
||||
|
||||
// Call the Python function
|
||||
PYW_GIL_ENSURE;
|
||||
PyObject *py_result = PyObject_CallObject(
|
||||
ctx->py_func,
|
||||
pargs.empty() ? NULL : pargs[0]);
|
||||
|
||||
newref_t py_result(PyObject_CallObject(
|
||||
ctx->py_func,
|
||||
pargs.empty() ? NULL : pargs[0].o));
|
||||
|
||||
error_t err;
|
||||
if ( PyW_GetError(errbuf, sizeof(errbuf)) )
|
||||
{
|
||||
err = PyW_CreateIdcException(r, errbuf);
|
||||
Py_XDECREF(py_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -55,13 +57,7 @@ static error_t py_call_idc_func(
|
||||
err = PyW_CreateIdcException(r, "ERROR: bad return value");
|
||||
else
|
||||
err = eOk;
|
||||
if ( cvt != CIP_OK_NODECREF )
|
||||
Py_XDECREF(py_result);
|
||||
}
|
||||
PYW_GIL_RELEASE;
|
||||
|
||||
// Free the converted args
|
||||
pyw_free_idc_args(pargs);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -153,4 +149,4 @@ bool CompileLine_wrap(const char *line, char *errbuf, size_t errbufsize)
|
||||
}
|
||||
|
||||
//</inline(py_expr)>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user