mirror of
https://github.com/cemu-project/idapython.git
synced 2024-12-29 11:11:51 +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.
79 lines
1.9 KiB
C++
79 lines
1.9 KiB
C++
#ifndef __PY_CHOOSE__
|
|
#define __PY_CHOOSE__
|
|
|
|
//---------------------------------------------------------------------------
|
|
//<inline(py_kernwin)>
|
|
//---------------------------------------------------------------------------
|
|
uint32 idaapi choose_sizer(void *self)
|
|
{
|
|
PYW_GIL_GET;
|
|
newref_t pyres(PyObject_CallMethod((PyObject *)self, "sizer", ""));
|
|
return PyInt_AsLong(pyres.o);
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
char *idaapi choose_getl(void *self, uint32 n, char *buf)
|
|
{
|
|
PYW_GIL_GET;
|
|
newref_t pyres(
|
|
PyObject_CallMethod(
|
|
(PyObject *)self,
|
|
"getl",
|
|
"l",
|
|
n));
|
|
|
|
const char *res;
|
|
if (pyres == NULL || (res = PyString_AsString(pyres.o)) == NULL )
|
|
qstrncpy(buf, "<Empty>", MAXSTR);
|
|
else
|
|
qstrncpy(buf, res, MAXSTR);
|
|
return buf;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
void idaapi choose_enter(void *self, uint32 n)
|
|
{
|
|
PYW_GIL_GET;
|
|
newref_t res(PyObject_CallMethod((PyObject *)self, "enter", "l", n));
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
uint32 choose_choose(
|
|
void *self,
|
|
int flags,
|
|
int x0,int y0,
|
|
int x1,int y1,
|
|
int width,
|
|
int deflt,
|
|
int icon)
|
|
{
|
|
PYW_GIL_CHECK_LOCKED_SCOPE();
|
|
newref_t pytitle(PyObject_GetAttrString((PyObject *)self, "title"));
|
|
const char *title = pytitle != NULL ? PyString_AsString(pytitle.o) : "Choose";
|
|
|
|
int r = choose(
|
|
flags,
|
|
x0, y0,
|
|
x1, y1,
|
|
self,
|
|
width,
|
|
choose_sizer,
|
|
choose_getl,
|
|
title,
|
|
icon,
|
|
deflt,
|
|
NULL, /* del */
|
|
NULL, /* inst */
|
|
NULL, /* update */
|
|
NULL, /* edit */
|
|
choose_enter,
|
|
NULL, /* destroy */
|
|
NULL, /* popup_names */
|
|
NULL);/* get_icon */
|
|
|
|
return r;
|
|
}
|
|
//</inline(py_kernwin)>
|
|
|
|
#endif // __PY_CHOOSE__
|