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/content.c | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/content.c')
-rw-r--r-- | plugins/pychrysalide/analysis/content.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/content.c b/plugins/pychrysalide/analysis/content.c index 4be318d..e657857 100644 --- a/plugins/pychrysalide/analysis/content.c +++ b/plugins/pychrysalide/analysis/content.c @@ -36,6 +36,7 @@ #include <common/endianness.h> +#include "../access.h" #include "../arch/vmpa.h" @@ -480,7 +481,7 @@ PyTypeObject *get_python_binary_content_type(void) /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : - * * * * Description : Prend en charge l'objet 'pychrysalide.analysis.BinContent'. * * * @@ -490,15 +491,22 @@ PyTypeObject *get_python_binary_content_type(void) * * ******************************************************************************/ -bool register_python_binary_content(PyObject *module) +bool ensure_python_binary_content_is_registered(void) { - PyTypeObject *py_binary_content_type; /* Type Python 'BinContent' */ + PyTypeObject *type; /* Type Python 'BinContent' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_binary_content_type = get_python_binary_content_type(); + type = get_python_binary_content_type(); + + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis"); - dict = PyModule_GetDict(module); - pyg_register_interface(dict, "BinContent", G_TYPE_BIN_CONTENT, py_binary_content_type); + dict = PyModule_GetDict(module); + pyg_register_interface(dict, "BinContent", G_TYPE_BIN_CONTENT, type); + + } return true; |