diff --git a/out_of_tree/parsed_notifications.zip b/out_of_tree/parsed_notifications.zip index 1ba40ef..05ec806 100644 Binary files a/out_of_tree/parsed_notifications.zip and b/out_of_tree/parsed_notifications.zip differ diff --git a/pywraps/py_idp.hpp b/pywraps/py_idp.hpp index eda6d8f..dcd48a0 100644 --- a/pywraps/py_idp.hpp +++ b/pywraps/py_idp.hpp @@ -621,6 +621,26 @@ struct IDP_Hooks : public hooks_base_t return ret; } +protected: + static PyObject *new_PyObject_from_idpopt_value( + int value_type, + const void *value) + { + switch ( value_type ) + { + case IDPOPT_STR: + return IDAPyStr_FromUTF8((const char *) value); + case IDPOPT_NUM: + return IDAPyInt_FromLong(*(const uval_t *) value); + case IDPOPT_BIT: + return IDAPyInt_FromLong(*(const int *) value); + case IDPOPT_I64: + return PyLong_FromLongLong(*(const int64 *) value); + default: + return nullptr; + } + } + private: static ssize_t bool_to_insn_t_size(bool in, const insn_t *insn) { return in ? insn->size : 0; } static ssize_t bool_to_1or0(bool in) { return in ? 1 : 0; } diff --git a/pywraps/py_idp.py.in b/pywraps/py_idp.py.in index 49d8b8c..e747bdb 100644 --- a/pywraps/py_idp.py.in +++ b/pywraps/py_idp.py.in @@ -131,10 +131,11 @@ class processor_t(IDP_Hooks): """ Base class for all processor module scripts - A processor_t instance is both an ida_idp.IDP_Hooks, and - an ida_idp.IDB_Hooks at the same time: any method of - those two classes can be overridden in your processor_t - subclass. + A processor_t instance is both an ida_idp.IDP_Hooks, and an + ida_idp.IDB_Hooks at the same time: any method of those two classes + can be overridden in your processor_t subclass (with the exception of + 'ida_idp.IDP_Hooks.ev_init' (replaced with processor_t.__init__), + and 'ida_idp.IDP_Hooks.ev_term' (replaced with processor_t.__del__)). """ def __init__(self): IDP_Hooks.__init__(self, ida_idaapi.HBF_CALL_WITH_NEW_EXEC) @@ -220,7 +221,7 @@ class processor_t(IDP_Hooks): def ev_endbinary(self, *args): return self._get_notify("endbinary")(*args) - def ev_set_idp_options(self, keyword, value_type, value): + def ev_set_idp_options(self, keyword, value_type, value, idb_loaded): res = self._get_notify("set_idp_options", unimp_val=None)(keyword, value_type, value) if res is None: return 0 diff --git a/release_pydoc_injections2.txt b/release_pydoc_injections2.txt index a27c30e..ebe2d75 100644 --- a/release_pydoc_injections2.txt +++ b/release_pydoc_injections2.txt @@ -41282,7 +41282,7 @@ class IDP_Hooks(__builtin__.object) | ev_set_code16_mode(self, ea, code16) -> int | | ev_set_idp_options(self, *args) - | ev_set_idp_options(self, keyword, value_type, value, errbuf, idb_loaded) -> int + | ev_set_idp_options(self, keyword, value_type, value, idb_loaded) -> int | | ev_set_proc_options(self, *args) | ev_set_proc_options(self, options, confidence) -> int @@ -42508,7 +42508,7 @@ class processor_t(IDP_Hooks) | | ev_rename(self, *args) | - | ev_set_idp_options(self, keyword, value_type, value) + | ev_set_idp_options(self, keyword, value_type, value, idb_loaded) | | ev_set_proc_options(self, *args) | @@ -71563,7 +71563,7 @@ class insn_t(__builtin__.object) | Methods defined here: | | __get_auxpref__(self, *args) - | __get_auxpref__(self) -> uint16 + | __get_auxpref__(self) -> uint32 | | __get_operand__(self, *args) | __get_operand__(self, n) -> op_t @@ -71653,7 +71653,7 @@ class insn_t(__builtin__.object) | list of weak references to the object (if defined) | | auxpref - | __get_auxpref__(self) -> uint16 + | __get_auxpref__(self) -> uint32 | | cs | insn_t_cs_get(self) -> ea_t @@ -75612,6 +75612,7 @@ get_idb_path() Help on function get_inf_attr in module idc: get_inf_attr(attr) + Deprecated. Please ida_ida.inf_get_* instead. Help on function get_input_file_path in module ida_nalt: @@ -78290,6 +78291,7 @@ set_ida_state(*args) Help on function set_inf_attr in module idc: set_inf_attr(attr, value) + Deprecated. Please ida_ida.inf_set_* instead. Help on function set_local_type in module idc: diff --git a/release_pydoc_injections3.txt b/release_pydoc_injections3.txt index 81c8e10..058ae4c 100644 --- a/release_pydoc_injections3.txt +++ b/release_pydoc_injections3.txt @@ -41265,7 +41265,7 @@ class IDP_Hooks(builtins.object) | ev_set_code16_mode(self, ea, code16) -> int | | ev_set_idp_options(self, *args) -> 'int' - | ev_set_idp_options(self, keyword, value_type, value, errbuf, idb_loaded) -> int + | ev_set_idp_options(self, keyword, value_type, value, idb_loaded) -> int | | ev_set_proc_options(self, *args) -> 'int' | ev_set_proc_options(self, options, confidence) -> int @@ -42632,8 +42632,8 @@ class processor_t(IDP_Hooks) | - If returns value <0, then the kernel should | not rename it. See also the 'renamed' event | - | ev_set_idp_options(self, keyword, value_type, value) - | ev_set_idp_options(self, keyword, value_type, value, errbuf, idb_loaded) -> int + | ev_set_idp_options(self, keyword, value_type, value, idb_loaded) + | ev_set_idp_options(self, keyword, value_type, value, idb_loaded) -> int | | ev_set_proc_options(self, *args) | ev_set_proc_options(self, options, confidence) -> int @@ -71611,8 +71611,8 @@ class insn_t(builtins.object) | | Methods defined here: | - | __get_auxpref__(self, *args) -> 'uint16' - | __get_auxpref__(self) -> uint16 + | __get_auxpref__(self, *args) -> 'uint32' + | __get_auxpref__(self) -> uint32 | | __get_operand__(self, *args) -> 'op_t *' | __get_operand__(self, n) -> op_t @@ -71705,7 +71705,7 @@ class insn_t(builtins.object) | list of weak references to the object (if defined) | | auxpref - | __get_auxpref__(self) -> uint16 + | __get_auxpref__(self) -> uint32 | | cs | insn_t_cs_get(self) -> ea_t diff --git a/swig/ua.i b/swig/ua.i index d31b742..7fa05bd 100644 --- a/swig/ua.i +++ b/swig/ua.i @@ -67,8 +67,8 @@ return wrapped_array_t($self->ops); } op_t *__get_operand__(int n) { QASSERT(30502, n >= 0 && n < UA_MAXOP); return &($self->ops[n]); } - uint16 __get_auxpref__() { return $self->auxpref; } - void __set_auxpref__(uint16 v) { $self->auxpref = v; } + uint32 __get_auxpref__() { return $self->auxpref; } + void __set_auxpref__(uint32 v) { $self->auxpref = v; } void assign(const insn_t &other) { *($self) = other; } diff --git a/tools/genhooks/recipe_idphooks.py b/tools/genhooks/recipe_idphooks.py index c906ca7..21bf6cc 100644 --- a/tools/genhooks/recipe_idphooks.py +++ b/tools/genhooks/recipe_idphooks.py @@ -181,4 +181,9 @@ recipe = { "convertor_pass_args" : True, } }, + "ev_set_idp_options" : { + "params" : { + "errbuf" : { "suppress_for_call" : True, "qnotused" : True }, + }, + }, } diff --git a/tools/patch_codegen.py b/tools/patch_codegen.py index 2f143da..ddac206 100644 --- a/tools/patch_codegen.py +++ b/tools/patch_codegen.py @@ -223,7 +223,10 @@ with open(args.input) as f: elif patch_kind == "repl_text": idx = line.find(patch_data[0]) if idx > -1: - subst = line.rstrip().replace(patch_data[0], patch_data[1]) + repl = patch_data[1] + if not isinstance(repl, str): + repl = "\n".join(repl) + subst = line.rstrip().replace(patch_data[0], repl) subst = "%s %s" % (subst, patched_cmt) elif patch_kind == "insert_before_text": idx = line.find(patch_data[0]) diff --git a/tools/patch_codegen/idp.py b/tools/patch_codegen/idp.py index 747f8ff..a9179e9 100644 --- a/tools/patch_codegen/idp.py +++ b/tools/patch_codegen/idp.py @@ -31,6 +31,19 @@ if ( __argcnt == 2 ) } } """)), + ], + "SwigDirector_IDP_Hooks::ev_set_idp_options" : [ + ( + "repl_text", + ( + "obj2 = SWIG_NewPointerObj(SWIG_as_voidptr(value), SWIGTYPE_p_void, 0 );", + ( + "obj2 = new_PyObject_from_idpopt_value(value_type, value);", + " if ( ((PyObject *) obj2) == nullptr )", + " Swig::DirectorException::raise(\"Unknown 'value_type'\");", + ), + ), + ), ], }