mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-30 21:14:20 +01:00
fbb5bfabd6
What's new: - added the decompiler bindings - Expose simpleline_t type to IDAPython. That lets the user to set the bgcolor & text for each line in the decompilation. - Wrapped new functions from the IDA SDK Various fixes: for non-code locations, idc.GetOpnd() would create instructions instead of returning empty result - idb_event::area_cmt_changed was never received in IDB_Hooks (and descendants) - idb_event::ti_changed, and idb_event::op_ti_changed notifications were not accessible in IDAPython - op_t.value was truncated to 32 bits under IDA64. - print_tinfo() wouldn't return a valid string. - readsel2() was not usable. - read_selection() was buggy for 64-bit programs. - StructMembers() considered holes in structures, and didn't properly iterate through the whole structure definition. - There was no way to call calc_switch_cases() from IDAPython. - when using multi-select/multi-edit choosers, erroneous event codes could be sent at beginning & end of batch deletion of lines. - When, in a PluginForm#OnCreate, the layout of IDA was requested to change (for example by starting a debugging session), that PluginForm could be deleted and create an access violation. - tinfo_t objects created from IDAPython could cause an assertion failure at exit time. - Usage of IDAPython's DropdownListControl was broken.
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
#ifndef __PY_IDA_VIEW__
|
|
#define __PY_IDA_VIEW__
|
|
|
|
//<code(py_idaview)>
|
|
class py_idaview_t : public py_customidamemo_t
|
|
{
|
|
typedef py_customidamemo_t inherited;
|
|
|
|
public:
|
|
static bool Bind(PyObject *self);
|
|
};
|
|
|
|
//-------------------------------------------------------------------------
|
|
bool py_idaview_t::Bind(PyObject *self)
|
|
{
|
|
// Already a py_idaview_t associated to this object?
|
|
py_idaview_t *_this = view_extract_this<py_idaview_t>(self);
|
|
if ( _this != NULL )
|
|
return false;
|
|
|
|
qstring title;
|
|
if ( !PyW_GetStringAttr(self, S_M_TITLE, &title) )
|
|
return false;
|
|
|
|
// Get the IDAView associated to this TForm
|
|
TForm *tform = find_tform(title.c_str());
|
|
if ( tform == NULL )
|
|
return false;
|
|
TCustomControl *v = get_tform_idaview(tform);
|
|
if ( v == NULL )
|
|
return false;
|
|
|
|
// Get unique py_idaview_t associated to that tform
|
|
py_idaview_t *py_view;
|
|
TCustomControl *found_view;
|
|
if ( lookup_info.find_by_form(&found_view, (py_customidamemo_t**) &py_view, tform) )
|
|
{
|
|
// If we have a py_idaview_t for that form, ensure it has
|
|
// the expected view.
|
|
QASSERT(30451, found_view == v);
|
|
}
|
|
else
|
|
{
|
|
py_view = new py_idaview_t();
|
|
lookup_info_t::entry_t &e = lookup_info.new_entry(py_view);
|
|
lookup_info.commit(e, tform, v);
|
|
}
|
|
|
|
// Finally, bind:
|
|
// py_idaview_t <=> IDAViewWrapper
|
|
// py_idaview_t => TCustomControl
|
|
bool ok = py_view->bind(self, v);
|
|
if ( ok )
|
|
{
|
|
ok = py_view->collect_pyobject_callbacks(self);
|
|
if ( !ok )
|
|
delete py_view;
|
|
}
|
|
return ok;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
bool pyidag_bind(PyObject *self)
|
|
{
|
|
return py_idaview_t::Bind(self);
|
|
}
|
|
|
|
//</code(py_idaview)>
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
//<inline(py_idaview)>
|
|
bool pyidag_bind(PyObject *self);
|
|
//</inline(py_idaview)>
|
|
|
|
#endif // __PY_IDA_VIEW__
|