diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
commit | fb315963527f6412273829f09513325e446eb6c9 (patch) | |
tree | 361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/analysis/binary.c | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/binary.c')
-rw-r--r-- | plugins/pychrysalide/analysis/binary.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/plugins/pychrysalide/analysis/binary.c b/plugins/pychrysalide/analysis/binary.c index 1ca5b3c..8640bc2 100644 --- a/plugins/pychrysalide/analysis/binary.c +++ b/plugins/pychrysalide/analysis/binary.c @@ -34,6 +34,8 @@ #include <analysis/binary.h> +#include "loaded.h" +#include "../access.h" #include "../helpers.h" #include "../format/executable.h" @@ -279,7 +281,7 @@ PyTypeObject *get_python_loaded_binary_type(void) /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : - * * * * Description : Prend en charge l'objet 'pychrysalide.analysis.LoadedBinary'.* * * @@ -289,17 +291,27 @@ PyTypeObject *get_python_loaded_binary_type(void) * * ******************************************************************************/ -bool register_python_loaded_binary(PyObject *module) +bool ensure_python_loaded_binary_is_registered(void) { - PyTypeObject *py_loaded_binary_type; /* Type Python 'LoadedBinary' */ + PyTypeObject *type; /* Type Python 'ProxyFeeder' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_loaded_binary_type = get_python_loaded_binary_type(); + type = get_python_loaded_binary_type(); + + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis"); + + dict = PyModule_GetDict(module); + + if (!ensure_python_loaded_content_is_registered()) + return false; - dict = PyModule_GetDict(module); + if (!register_class_for_pygobject(dict, G_TYPE_LOADED_BINARY, type, &PyGObject_Type)) + return false; - if (!register_class_for_pygobject(dict, G_TYPE_LOADED_BINARY, py_loaded_binary_type, &PyGObject_Type)) - return false; + } return true; |