summaryrefslogtreecommitdiff
path: root/plugins/pychrysa
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa')
-rw-r--r--plugins/pychrysa/analysis/binary.c16
-rw-r--r--plugins/pychrysa/analysis/block.c14
-rw-r--r--plugins/pychrysa/analysis/blocks/flow.c19
-rw-r--r--plugins/pychrysa/analysis/blocks/virtual.c16
-rw-r--r--plugins/pychrysa/analysis/content.c27
-rw-r--r--plugins/pychrysa/analysis/contents/file.c71
-rw-r--r--plugins/pychrysa/analysis/contents/file.h2
-rw-r--r--plugins/pychrysa/analysis/contents/restricted.c70
-rw-r--r--plugins/pychrysa/analysis/contents/restricted.h2
-rw-r--r--plugins/pychrysa/analysis/db/collection.c17
-rw-r--r--plugins/pychrysa/analysis/db/item.c17
-rw-r--r--plugins/pychrysa/analysis/db/items/comment.c15
-rw-r--r--plugins/pychrysa/analysis/routine.c17
-rw-r--r--plugins/pychrysa/arch/arm/instruction.c17
-rw-r--r--plugins/pychrysa/arch/arm/processor.c16
-rw-r--r--plugins/pychrysa/arch/arm/v7/instruction.c16
-rw-r--r--plugins/pychrysa/arch/arm/v7/processor.c15
-rw-r--r--plugins/pychrysa/arch/instruction.c18
-rw-r--r--plugins/pychrysa/arch/processor.c16
-rw-r--r--plugins/pychrysa/format/dex/class.c17
-rw-r--r--plugins/pychrysa/format/dex/dex.c16
-rw-r--r--plugins/pychrysa/format/elf/elf.c16
-rw-r--r--plugins/pychrysa/format/executable.c15
-rw-r--r--plugins/pychrysa/format/format.c16
-rw-r--r--plugins/pychrysa/format/symbol.c14
-rw-r--r--plugins/pychrysa/glibext/bufferline.c14
-rw-r--r--plugins/pychrysa/glibext/codebuffer.c15
-rw-r--r--plugins/pychrysa/glibext/configuration.c34
-rw-r--r--plugins/pychrysa/gtkext/blockview.c15
-rw-r--r--plugins/pychrysa/gtkext/bufferview.c15
-rw-r--r--plugins/pychrysa/gtkext/viewpanel.c16
-rw-r--r--plugins/pychrysa/gui/editem.c16
-rw-r--r--plugins/pychrysa/gui/panels/log.c14
-rw-r--r--plugins/pychrysa/gui/panels/panel.c14
-rw-r--r--plugins/pychrysa/helpers.c55
-rw-r--r--plugins/pychrysa/helpers.h5
-rw-r--r--plugins/pychrysa/plugin.c14
-rw-r--r--plugins/pychrysa/pychrysa.c207
38 files changed, 193 insertions, 736 deletions
diff --git a/plugins/pychrysa/analysis/binary.c b/plugins/pychrysa/analysis/binary.c
index 93b1c57..14bf450 100644
--- a/plugins/pychrysa/analysis/binary.c
+++ b/plugins/pychrysa/analysis/binary.c
@@ -330,27 +330,15 @@ PyTypeObject *get_python_loaded_binary_type(void)
bool register_python_loaded_binary(PyObject *module)
{
PyTypeObject *py_loaded_binary_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_loaded_binary_type = get_python_loaded_binary_type();
- py_loaded_binary_type->tp_base = &PyGObject_Type;
- py_loaded_binary_type->tp_basicsize = py_loaded_binary_type->tp_base->tp_basicsize;
-
- //APPLY_ABSTRACT_FLAG(py_loaded_binary_type);
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_loaded_binary_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_LOADED_BINARY, py_loaded_binary_type, &PyGObject_Type))
return false;
- Py_INCREF(py_loaded_binary_type);
- ret = PyModule_AddObject(module, "LoadedBinary", (PyObject *)py_loaded_binary_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "LoadedBinary", G_TYPE_LOADED_BINARY, py_loaded_binary_type,
- Py_BuildValue("(O)", py_loaded_binary_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/analysis/block.c b/plugins/pychrysa/analysis/block.c
index 4cbc353..3ee7fcd 100644
--- a/plugins/pychrysa/analysis/block.c
+++ b/plugins/pychrysa/analysis/block.c
@@ -257,28 +257,18 @@ PyTypeObject *get_python_instr_block_type(void)
bool register_python_instr_block(PyObject *module)
{
PyTypeObject *py_instr_block_type; /* Type Python 'InstrBlock' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_instr_block_type = get_python_instr_block_type();
- py_instr_block_type->tp_base = &PyGObject_Type;
- py_instr_block_type->tp_basicsize = py_instr_block_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_instr_block_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_INSTR_BLOCK, py_instr_block_type, &PyGObject_Type))
return false;
if (!py_instructions_block_define_constants(py_instr_block_type))
return false;
- Py_INCREF(py_instr_block_type);
- ret = PyModule_AddObject(module, "InstrBlock", (PyObject *)py_instr_block_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "InstrBlock", G_TYPE_INSTR_BLOCK, py_instr_block_type,
- Py_BuildValue("(O)", py_instr_block_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/analysis/blocks/flow.c b/plugins/pychrysa/analysis/blocks/flow.c
index 626d5c8..aa0e3bf 100644
--- a/plugins/pychrysa/analysis/blocks/flow.c
+++ b/plugins/pychrysa/analysis/blocks/flow.c
@@ -32,6 +32,7 @@
#include "../block.h"
+#include "../../helpers.h"
@@ -177,8 +178,8 @@ bool register_python_flow_block(PyObject *module)
Py_INCREF(&py_flow_block_type);
ret = PyModule_AddObject(module, "FlowBlock", (PyObject *)&py_flow_block_type);
- pygobject_register_class(module, "GFlowBlock", G_TYPE_FLOW_BLOCK, &py_flow_block_type,
- Py_BuildValue("(O)", py_flow_block_type.tp_base));
+ register_class_for_pygobject(module, "GFlowBlock", G_TYPE_FLOW_BLOCK, &py_flow_block_type,
+ Py_BuildValue("(O)", py_flow_block_type.tp_base));
return (ret == 0);
@@ -261,25 +262,15 @@ PyTypeObject *get_python_flow_block_type(void)
bool register_python_flow_block(PyObject *module)
{
PyTypeObject *py_flow_block_type; /* Type Python 'FlowBlock' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_flow_block_type = get_python_flow_block_type();
- py_flow_block_type->tp_base = get_python_instr_block_type();
- py_flow_block_type->tp_basicsize = py_flow_block_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_flow_block_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_FLOW_BLOCK, py_flow_block_type, get_python_instr_block_type()))
return false;
- Py_INCREF(py_flow_block_type);
- ret = PyModule_AddObject(module, "FlowBlock", (PyObject *)py_flow_block_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "FlowBlock", G_TYPE_FLOW_BLOCK, py_flow_block_type,
- Py_BuildValue("(O)", py_flow_block_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/analysis/blocks/virtual.c b/plugins/pychrysa/analysis/blocks/virtual.c
index bdc81b0..6a35925 100644
--- a/plugins/pychrysa/analysis/blocks/virtual.c
+++ b/plugins/pychrysa/analysis/blocks/virtual.c
@@ -32,6 +32,7 @@
#include "../block.h"
+#include "../../helpers.h"
@@ -92,25 +93,16 @@ PyTypeObject *get_python_virtual_block_type(void)
bool register_python_virtual_block(PyObject *module)
{
PyTypeObject *py_virtual_block_type; /* Type Python 'VirtualBlock' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_virtual_block_type = get_python_virtual_block_type();
- py_virtual_block_type->tp_base = get_python_instr_block_type();
- py_virtual_block_type->tp_basicsize = py_virtual_block_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_virtual_block_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_VIRTUAL_BLOCK,
+ py_virtual_block_type, get_python_instr_block_type()))
return false;
- Py_INCREF(py_virtual_block_type);
- ret = PyModule_AddObject(module, "VirtualBlock", (PyObject *)py_virtual_block_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "VirtualBlock", G_TYPE_VIRTUAL_BLOCK, py_virtual_block_type,
- Py_BuildValue("(O)", py_virtual_block_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/analysis/content.c b/plugins/pychrysa/analysis/content.c
index d3da2b1..fa59d69 100644
--- a/plugins/pychrysa/analysis/content.c
+++ b/plugins/pychrysa/analysis/content.c
@@ -60,7 +60,6 @@ static PyObject *py_binary_content_read_u64(PyObject *, PyObject *);
-
/******************************************************************************
* *
* Paramètres : self = contenu binaire à manipuler. *
@@ -213,6 +212,7 @@ static PyObject *py_binary_content_read_u16(PyObject *self, PyObject *args)
}
+
/******************************************************************************
* *
* Paramètres : self = contenu binaire à manipuler. *
@@ -306,13 +306,6 @@ static PyObject *py_binary_content_read_u64(PyObject *self, PyObject *args)
}
-
-
-
-
-
-
-
/******************************************************************************
* *
* Paramètres : - *
@@ -401,28 +394,10 @@ PyTypeObject *get_python_binary_content_type(void)
bool register_python_binary_content(PyObject *module)
{
PyTypeObject *py_binary_content_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_binary_content_type = get_python_binary_content_type();
- //py_binary_content_type->tp_base = &PyGObject_Type;
- //py_binary_content_type->tp_basicsize = py_binary_content_type->tp_base->tp_basicsize;
-
- //py_binary_content_type->tp_base = &PyObject_Type;
- //py_binary_content_type->tp_basicsize = py_binary_content_type->tp_base->tp_basicsize;
-
- /*
- if (PyType_Ready(py_binary_content_type) != 0)
- return false;
- */
-
- /*
- Py_INCREF(py_binary_content_type);
- ret = PyModule_AddObject(module, "BinContent", (PyObject *)py_binary_content_type);
- if (ret != 0) return false;
- */
-
dict = PyModule_GetDict(module);
pyg_register_interface(dict, "BinContent", G_TYPE_BIN_CONTENT, py_binary_content_type);
diff --git a/plugins/pychrysa/analysis/contents/file.c b/plugins/pychrysa/analysis/contents/file.c
index 897561e..c9f880f 100644
--- a/plugins/pychrysa/analysis/contents/file.c
+++ b/plugins/pychrysa/analysis/contents/file.c
@@ -31,6 +31,9 @@
#include <analysis/contents/file.h>
+#include "../../helpers.h"
+
+
/* Crée un nouvel objet Python de type 'BinContent'. */
static PyObject *py_file_content_new(PyTypeObject *, PyObject *, PyObject *);
@@ -85,41 +88,8 @@ static PyObject *py_file_content_new(PyTypeObject *type, PyObject *args, PyObjec
* *
******************************************************************************/
-
-
-PyMethodDef py_file_content_methods[] = {
- { NULL }
-};
-
-PyGetSetDef py_file_content_getseters[] = {
- { NULL }
-};
-
-PyTypeObject py_file_content_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.analysis.contents.FileContent",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyChrysalide binary file content",
-
- /*
- .tp_methods = py_file_content_methods,
- .tp_getset = py_file_content_getseters,
- .tp_new = (newfunc)py_file_content_new
- */
- .tp_new = (newfunc)py_file_content_new
-
-};
-
-
-
PyTypeObject *get_python_file_content_type(void)
{
-#if 0
static PyMethodDef py_file_content_methods[] = {
{ NULL }
};
@@ -135,18 +105,16 @@ PyTypeObject *get_python_file_content_type(void)
.tp_name = "pychrysalide.analysis.contents.FileContent",
.tp_basicsize = sizeof(PyGObject),
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | 1 << 9,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.tp_doc = "PyChrysalide binary file content",
- /*
.tp_methods = py_file_content_methods,
.tp_getset = py_file_content_getseters,
.tp_new = (newfunc)py_file_content_new
- */
};
-#endif
+
return &py_file_content_type;
}
@@ -156,46 +124,25 @@ PyTypeObject *get_python_file_content_type(void)
* *
* Paramètres : module = module dont la définition est à compléter. *
* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.BinContent'. *
+* Description : Prend en charge l'objet 'pychrysalide.....FileContent'. *
* *
* Retour : Bilan de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-#include "../content.h"//////////////////////////////////////////
+
bool register_python_file_content(PyObject *module)
{
- PyTypeObject *py_file_content_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
+ PyTypeObject *py_file_content_type; /* Type Python 'FileContent' */
PyObject *dict; /* Dictionnaire du module */
py_file_content_type = get_python_file_content_type();
- //py_file_content_type->tp_base = &PyGObject_Type;
- //py_file_content_type->tp_basicsize = py_file_content_type->tp_base->tp_basicsize;
-
- /*
- if (PyType_Ready(py_file_content_type) != 0)
- return false;
- */
-
- /*
- Py_INCREF(py_file_content_type);
- ret = PyModule_AddObject(module, "FileContent", (PyObject *)py_file_content_type);
- if (ret != 0) return false;
- */
-
dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "FileContent", G_TYPE_FILE_CONTENT, py_file_content_type,
- Py_BuildValue("(O)", &PyGObject_Type/*py_file_content_type->tp_base*/,
- get_python_binary_content_type()));
- /*
- if (PyType_Ready(py_file_content_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_FILE_CONTENT, py_file_content_type, &PyGObject_Type))
return false;
- */
-
return true;
diff --git a/plugins/pychrysa/analysis/contents/file.h b/plugins/pychrysa/analysis/contents/file.h
index a9edcef..4652ad6 100644
--- a/plugins/pychrysa/analysis/contents/file.h
+++ b/plugins/pychrysa/analysis/contents/file.h
@@ -34,7 +34,7 @@
/* Fournit un accès à une définition de type à diffuser. */
PyTypeObject *get_python_file_content_type(void);
-/* Prend en charge l'objet 'pychrysalide.glibext.BinContent'. */
+/* Prend en charge l'objet 'pychrysalide.analysis.contents.FileContent'. */
bool register_python_file_content(PyObject *);
diff --git a/plugins/pychrysa/analysis/contents/restricted.c b/plugins/pychrysa/analysis/contents/restricted.c
index 0b8c7da..300031a 100644
--- a/plugins/pychrysa/analysis/contents/restricted.c
+++ b/plugins/pychrysa/analysis/contents/restricted.c
@@ -35,6 +35,7 @@
#include "../content.h"
+#include "../../helpers.h"
#include "../../arch/vmpa.h"
@@ -110,41 +111,8 @@ static PyObject *py_restricted_content_new(PyTypeObject *type, PyObject *args, P
* *
******************************************************************************/
-
-
-PyMethodDef py_restricted_content_methods[] = {
- { NULL }
-};
-
-PyGetSetDef py_restricted_content_getseters[] = {
- { NULL }
-};
-
-PyTypeObject py_restricted_content_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.analysis.contents.RestrictedContent",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyChrysalide binary restricted content",
-
- /*
- .tp_methods = py_restricted_content_methods,
- .tp_getset = py_restricted_content_getseters,
- .tp_new = (newfunc)py_restricted_content_new
- */
- .tp_new = (newfunc)py_restricted_content_new
-
-};
-
-
-
PyTypeObject *get_python_restricted_content_type(void)
{
-#if 0
static PyMethodDef py_restricted_content_methods[] = {
{ NULL }
};
@@ -160,18 +128,16 @@ PyTypeObject *get_python_restricted_content_type(void)
.tp_name = "pychrysalide.analysis.contents.RestrictedContent",
.tp_basicsize = sizeof(PyGObject),
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | 1 << 9,
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.tp_doc = "PyChrysalide binary restricted content",
- /*
.tp_methods = py_restricted_content_methods,
.tp_getset = py_restricted_content_getseters,
.tp_new = (newfunc)py_restricted_content_new
- */
};
-#endif
+
return &py_restricted_content_type;
}
@@ -181,46 +147,26 @@ PyTypeObject *get_python_restricted_content_type(void)
* *
* Paramètres : module = module dont la définition est à compléter. *
* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.BinContent'. *
+* Description : Prend en charge l'objet 'pychrysalide.....RestrictedContent'.*
* *
* Retour : Bilan de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-#include "../content.h"//////////////////////////////////////////
+
bool register_python_restricted_content(PyObject *module)
{
- PyTypeObject *py_restricted_content_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
+ PyTypeObject *py_restricted_content_type;/* Type Python 'BinContent' */
PyObject *dict; /* Dictionnaire du module */
py_restricted_content_type = get_python_restricted_content_type();
- //py_restricted_content_type->tp_base = &PyGObject_Type;
- //py_restricted_content_type->tp_basicsize = py_restricted_content_type->tp_base->tp_basicsize;
-
- /*
- if (PyType_Ready(py_restricted_content_type) != 0)
- return false;
- */
-
- /*
- Py_INCREF(py_restricted_content_type);
- ret = PyModule_AddObject(module, "RestrictedContent", (PyObject *)py_restricted_content_type);
- if (ret != 0) return false;
- */
-
dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "RestrictedContent", G_TYPE_RESTRICTED_CONTENT, py_restricted_content_type,
- Py_BuildValue("(O)", &PyGObject_Type/*py_restricted_content_type->tp_base*/,
- get_python_binary_content_type()));
- /*
- if (PyType_Ready(py_restricted_content_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_RESTRICTED_CONTENT,
+ py_restricted_content_type, &PyGObject_Type))
return false;
- */
-
return true;
diff --git a/plugins/pychrysa/analysis/contents/restricted.h b/plugins/pychrysa/analysis/contents/restricted.h
index 24f2697..46875e2 100644
--- a/plugins/pychrysa/analysis/contents/restricted.h
+++ b/plugins/pychrysa/analysis/contents/restricted.h
@@ -34,7 +34,7 @@
/* Fournit un accès à une définition de type à diffuser. */
PyTypeObject *get_python_restricted_content_type(void);
-/* Prend en charge l'objet 'pychrysalide.glibext.BinContent'. */
+/* Prend en charge l'objet 'pychrysalide.analysis.contents.RestrictedContent'. */
bool register_python_restricted_content(PyObject *);
diff --git a/plugins/pychrysa/analysis/db/collection.c b/plugins/pychrysa/analysis/db/collection.c
index 87d46e5..60afb02 100644
--- a/plugins/pychrysa/analysis/db/collection.c
+++ b/plugins/pychrysa/analysis/db/collection.c
@@ -32,6 +32,9 @@
#include <analysis/db/collection.h>
+#include "../../helpers.h"
+
+
/******************************************************************************
* *
@@ -93,25 +96,15 @@ PyTypeObject *get_python_db_collection_type(void)
bool register_python_db_collection(PyObject *module)
{
PyTypeObject *py_db_collection_type; /* Type Python 'DbCollection' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_db_collection_type = get_python_db_collection_type();
- py_db_collection_type->tp_base = &PyGObject_Type;
- py_db_collection_type->tp_basicsize = py_db_collection_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_db_collection_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_DB_COLLECTION, py_db_collection_type, &PyGObject_Type))
return false;
- Py_INCREF(py_db_collection_type);
- ret = PyModule_AddObject(module, "DbCollection", (PyObject *)py_db_collection_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "DbCollection", G_TYPE_DB_COLLECTION, py_db_collection_type,
- Py_BuildValue("(O)", py_db_collection_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/analysis/db/item.c b/plugins/pychrysa/analysis/db/item.c
index 4f536b4..e314552 100644
--- a/plugins/pychrysa/analysis/db/item.c
+++ b/plugins/pychrysa/analysis/db/item.c
@@ -32,6 +32,9 @@
#include <analysis/db/item.h>
+#include "../../helpers.h"
+
+
/* Indique si l'élément contient des données à oublier ou non. */
static PyObject *py_db_item_get_volatile(PyObject *, void *);
@@ -165,25 +168,15 @@ PyTypeObject *get_python_db_item_type(void)
bool register_python_db_item(PyObject *module)
{
PyTypeObject *py_db_item_type; /* Type Python 'DbItem' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_db_item_type = get_python_db_item_type();
- py_db_item_type->tp_base = &PyGObject_Type;
- py_db_item_type->tp_basicsize = py_db_item_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_db_item_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_DB_ITEM, py_db_item_type, &PyGObject_Type))
return false;
- Py_INCREF(py_db_item_type);
- ret = PyModule_AddObject(module, "DbItem", (PyObject *)py_db_item_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "DbItem", G_TYPE_DB_ITEM, py_db_item_type,
- Py_BuildValue("(O)", py_db_item_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/analysis/db/items/comment.c b/plugins/pychrysa/analysis/db/items/comment.c
index ead5179..5ce54c9 100644
--- a/plugins/pychrysa/analysis/db/items/comment.c
+++ b/plugins/pychrysa/analysis/db/items/comment.c
@@ -33,6 +33,7 @@
#include "../item.h"
+#include "../../../helpers.h"
#include "../../../arch/vmpa.h"
@@ -213,25 +214,15 @@ PyTypeObject *get_python_db_comment_type(void)
bool register_python_db_comment(PyObject *module)
{
PyTypeObject *py_db_comment_type; /* Type Python 'DbComment' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_db_comment_type = get_python_db_comment_type();
- py_db_comment_type->tp_base = get_python_db_item_type();
- py_db_comment_type->tp_basicsize = py_db_comment_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_db_comment_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_DB_COMMENT, py_db_comment_type, get_python_db_item_type()))
return false;
- Py_INCREF(py_db_comment_type);
- ret = PyModule_AddObject(module, "DbComment", (PyObject *)py_db_comment_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "DbComment", G_TYPE_DB_COMMENT, py_db_comment_type,
- Py_BuildValue("(O)", py_db_comment_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/analysis/routine.c b/plugins/pychrysa/analysis/routine.c
index e42650a..39025b5 100644
--- a/plugins/pychrysa/analysis/routine.c
+++ b/plugins/pychrysa/analysis/routine.c
@@ -37,6 +37,7 @@
#include "block.h"
+#include "../helpers.h"
@@ -277,26 +278,16 @@ PyTypeObject *get_python_binary_routine_type(void)
bool register_python_binary_routine(PyObject *module)
{
- PyTypeObject *py_binary_routine_type; /* Type Python 'BinRoutine' */
- int ret; /* Bilan d'un appel */
+ PyTypeObject *py_binary_routine_type; /* Type Python 'BinRoutine' */
PyObject *dict; /* Dictionnaire du module */
py_binary_routine_type = get_python_binary_routine_type();
- py_binary_routine_type->tp_base = &PyGObject_Type;
- py_binary_routine_type->tp_basicsize = py_binary_routine_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_binary_routine_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_ROUTINE, py_binary_routine_type, &PyGObject_Type))
return false;
- Py_INCREF(py_binary_routine_type);
- ret = PyModule_AddObject(module, "BinRoutine", (PyObject *)py_binary_routine_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "BinRoutine", G_TYPE_BIN_ROUTINE, py_binary_routine_type,
- Py_BuildValue("(O)", py_binary_routine_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/arch/arm/instruction.c b/plugins/pychrysa/arch/arm/instruction.c
index ed53386..14c4ab5 100644
--- a/plugins/pychrysa/arch/arm/instruction.c
+++ b/plugins/pychrysa/arch/arm/instruction.c
@@ -94,26 +94,17 @@ PyTypeObject *get_python_arm_instruction_type(void)
bool register_python_arm_instruction(PyObject *module)
{
PyTypeObject *py_arm_instruction_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_arm_instruction_type = get_python_arm_instruction_type();
- py_arm_instruction_type->tp_base = get_python_arch_instruction_type();
- py_arm_instruction_type->tp_basicsize = py_arm_instruction_type->tp_base->tp_basicsize;
-
APPLY_ABSTRACT_FLAG(py_arm_instruction_type);
- if (PyType_Ready(py_arm_instruction_type) != 0)
- return false;
-
- Py_INCREF(py_arm_instruction_type);
- ret = PyModule_AddObject(module, "ArmInstruction", (PyObject *)py_arm_instruction_type);
- if (ret != 0) return false;
-
dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ArmInstruction", G_TYPE_ARM_INSTRUCTION, py_arm_instruction_type,
- Py_BuildValue("(O)", py_arm_instruction_type->tp_base));
+
+ if (!register_class_for_pygobject(dict, G_TYPE_ARM_INSTRUCTION,
+ py_arm_instruction_type, get_python_arch_instruction_type()))
+ return false;
return true;
diff --git a/plugins/pychrysa/arch/arm/processor.c b/plugins/pychrysa/arch/arm/processor.c
index 049dcb3..bac06ef 100644
--- a/plugins/pychrysa/arch/arm/processor.c
+++ b/plugins/pychrysa/arch/arm/processor.c
@@ -94,27 +94,15 @@ PyTypeObject *get_python_arm_processor_type(void)
bool register_python_arm_processor(PyObject *module)
{
PyTypeObject *py_arm_processor_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_arm_processor_type = get_python_arm_processor_type();
- py_arm_processor_type->tp_base = get_python_arch_processor_type();
- py_arm_processor_type->tp_basicsize = py_arm_processor_type->tp_base->tp_basicsize;
-
- APPLY_ABSTRACT_FLAG(py_arm_processor_type);
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_arm_processor_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_ARM_PROCESSOR, py_arm_processor_type, get_python_arch_processor_type()))
return false;
- Py_INCREF(py_arm_processor_type);
- ret = PyModule_AddObject(module, "ArmProcessor", (PyObject *)py_arm_processor_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ArmProcessor", G_TYPE_ARM_PROCESSOR, py_arm_processor_type,
- Py_BuildValue("(O)", py_arm_processor_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/arch/arm/v7/instruction.c b/plugins/pychrysa/arch/arm/v7/instruction.c
index 8a19259..08e9468 100644
--- a/plugins/pychrysa/arch/arm/v7/instruction.c
+++ b/plugins/pychrysa/arch/arm/v7/instruction.c
@@ -32,6 +32,7 @@
#include "../instruction.h"
+#include "../../../helpers.h"
@@ -93,25 +94,16 @@ PyTypeObject *get_python_armv7_instruction_type(void)
bool register_python_armv7_instruction(PyObject *module)
{
PyTypeObject *py_armv7_instruction_type;/* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_armv7_instruction_type = get_python_armv7_instruction_type();
- py_armv7_instruction_type->tp_base = get_python_arm_instruction_type();
- py_armv7_instruction_type->tp_basicsize = py_armv7_instruction_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_armv7_instruction_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_ARMV7_INSTRUCTION,
+ py_armv7_instruction_type, get_python_arm_instruction_type()))
return false;
- Py_INCREF(py_armv7_instruction_type);
- ret = PyModule_AddObject(module, "ArmV7Instruction", (PyObject *)py_armv7_instruction_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ArmV7Instruction", G_TYPE_ARMV7_INSTRUCTION, py_armv7_instruction_type,
- Py_BuildValue("(O)", py_armv7_instruction_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/arch/arm/v7/processor.c b/plugins/pychrysa/arch/arm/v7/processor.c
index 1844066..25bd1eb 100644
--- a/plugins/pychrysa/arch/arm/v7/processor.c
+++ b/plugins/pychrysa/arch/arm/v7/processor.c
@@ -32,6 +32,7 @@
#include "../processor.h"
+#include "../../../helpers.h"
@@ -93,25 +94,15 @@ PyTypeObject *get_python_armv7_processor_type(void)
bool register_python_armv7_processor(PyObject *module)
{
PyTypeObject *py_armv7_processor_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_armv7_processor_type = get_python_armv7_processor_type();
- py_armv7_processor_type->tp_base = get_python_arm_processor_type();
- py_armv7_processor_type->tp_basicsize = py_armv7_processor_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_armv7_processor_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_ARMV7_PROCESSOR, py_armv7_processor_type, get_python_arm_processor_type()))
return false;
- Py_INCREF(py_armv7_processor_type);
- ret = PyModule_AddObject(module, "ArmV7Processor", (PyObject *)py_armv7_processor_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ArmV7Processor", G_TYPE_ARMV7_PROCESSOR, py_armv7_processor_type,
- Py_BuildValue("(O)", py_armv7_processor_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/arch/instruction.c b/plugins/pychrysa/arch/instruction.c
index 2a06ede..5e4c19d 100644
--- a/plugins/pychrysa/arch/instruction.c
+++ b/plugins/pychrysa/arch/instruction.c
@@ -369,26 +369,16 @@ PyTypeObject *get_python_arch_instruction_type(void)
bool register_python_arch_instruction(PyObject *module)
{
PyTypeObject *py_arch_instruction_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_arch_instruction_type = get_python_arch_instruction_type();
- py_arch_instruction_type->tp_base = &PyGObject_Type;
- py_arch_instruction_type->tp_basicsize = py_arch_instruction_type->tp_base->tp_basicsize;
-
APPLY_ABSTRACT_FLAG(py_arch_instruction_type);
- if (PyType_Ready(py_arch_instruction_type) != 0)
- return false;
-
- Py_INCREF(py_arch_instruction_type);
- ret = PyModule_AddObject(module, "ArchInstruction", (PyObject *)py_arch_instruction_type);
- if (ret != 0) return false;
-
dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ArchInstruction", G_TYPE_ARCH_INSTRUCTION, py_arch_instruction_type,
- Py_BuildValue("(O)", py_arch_instruction_type->tp_base));
+
+ if (!register_class_for_pygobject(dict, G_TYPE_ARCH_INSTRUCTION, py_arch_instruction_type, &PyGObject_Type))
+ return false;
return true;
@@ -781,7 +771,7 @@ bool register_python_arch_instruction(PyObject *module)
Py_INCREF(&py_arch_instruction_type);
ret = PyModule_AddObject(module, "ArchInstruction", (PyObject *)&py_arch_instruction_type);
- pygobject_register_class(module, "GArchInstruction", G_TYPE_ARCH_INSTRUCTION,
+ register_class_for_pygobject(module, "GArchInstruction", G_TYPE_ARCH_INSTRUCTION,
&py_arch_instruction_type,
Py_BuildValue("(O)", py_arch_instruction_type.tp_base));
diff --git a/plugins/pychrysa/arch/processor.c b/plugins/pychrysa/arch/processor.c
index 0a9ae3a..bed3a3a 100644
--- a/plugins/pychrysa/arch/processor.c
+++ b/plugins/pychrysa/arch/processor.c
@@ -386,27 +386,15 @@ PyTypeObject *get_python_arch_processor_type(void)
bool register_python_arch_processor(PyObject *module)
{
PyTypeObject *py_arch_processor_type; /* Type Python 'BinContent' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_arch_processor_type = get_python_arch_processor_type();
- py_arch_processor_type->tp_base = &PyGObject_Type;
- py_arch_processor_type->tp_basicsize = py_arch_processor_type->tp_base->tp_basicsize;
-
- APPLY_ABSTRACT_FLAG(py_arch_processor_type);
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_arch_processor_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_ARCH_PROCESSOR, py_arch_processor_type, &PyGObject_Type))
return false;
- Py_INCREF(py_arch_processor_type);
- ret = PyModule_AddObject(module, "ArchProcessor", (PyObject *)py_arch_processor_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ArchProcessor", G_TYPE_ARCH_PROCESSOR, py_arch_processor_type,
- Py_BuildValue("(O)", py_arch_processor_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/format/dex/class.c b/plugins/pychrysa/format/dex/class.c
index 1741b52..59dfe44 100644
--- a/plugins/pychrysa/format/dex/class.c
+++ b/plugins/pychrysa/format/dex/class.c
@@ -31,6 +31,9 @@
#include <format/dex/class.h>
+#include "../../helpers.h"
+
+
/******************************************************************************
* *
@@ -90,25 +93,15 @@ PyTypeObject *get_python_dex_class_type(void)
bool register_python_dex_class(PyObject *module)
{
PyTypeObject *py_dex_class_type; /* Type Python 'DexClass' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_dex_class_type = get_python_dex_class_type();
- py_dex_class_type->tp_base = &PyGObject_Type;
- py_dex_class_type->tp_basicsize = py_dex_class_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_dex_class_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_DEX_CLASS, py_dex_class_type, &PyGObject_Type))
return false;
- Py_INCREF(py_dex_class_type);
- ret = PyModule_AddObject(module, "DexClass", (PyObject *)py_dex_class_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "DexClass", G_TYPE_DEX_CLASS, py_dex_class_type,
- Py_BuildValue("(O)", py_dex_class_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/format/dex/dex.c b/plugins/pychrysa/format/dex/dex.c
index dac6c90..6bb1888 100644
--- a/plugins/pychrysa/format/dex/dex.c
+++ b/plugins/pychrysa/format/dex/dex.c
@@ -34,6 +34,7 @@
#include "../executable.h"
#include "../../analysis/content.h"
+#include "../../helpers.h"
@@ -239,25 +240,16 @@ PyTypeObject *get_python_dex_format_type(void)
bool register_python_dex_format(PyObject *module)
{
PyTypeObject *py_dex_format_type; /* Type Python 'DexFormat' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_dex_format_type = get_python_dex_format_type();
- py_dex_format_type->tp_base = get_python_executable_format_type();
- py_dex_format_type->tp_basicsize = py_dex_format_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_dex_format_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_DEX_FORMAT,
+ py_dex_format_type, get_python_executable_format_type()))
return false;
- Py_INCREF(py_dex_format_type);
- ret = PyModule_AddObject(module, "DexFormat", (PyObject *)py_dex_format_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "DexFormat", G_TYPE_DEX_FORMAT, py_dex_format_type,
- Py_BuildValue("(O)", py_dex_format_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/format/elf/elf.c b/plugins/pychrysa/format/elf/elf.c
index 2787702..8778d56 100644
--- a/plugins/pychrysa/format/elf/elf.c
+++ b/plugins/pychrysa/format/elf/elf.c
@@ -36,6 +36,7 @@
#include "../executable.h"
#include "../../analysis/content.h"
+#include "../../helpers.h"
@@ -147,25 +148,16 @@ PyTypeObject *get_python_elf_format_type(void)
bool register_python_elf_format(PyObject *module)
{
PyTypeObject *py_elf_format_type; /* Type Python 'ElfFormat' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_elf_format_type = get_python_elf_format_type();
- py_elf_format_type->tp_base = get_python_executable_format_type();
- py_elf_format_type->tp_basicsize = py_elf_format_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_elf_format_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_ELF_FORMAT,
+ py_elf_format_type, get_python_executable_format_type()))
return false;
- Py_INCREF(py_elf_format_type);
- ret = PyModule_AddObject(module, "ElfFormat", (PyObject *)py_elf_format_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ElfFormat", G_TYPE_ELF_FORMAT, py_elf_format_type,
- Py_BuildValue("(O)", py_elf_format_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/format/executable.c b/plugins/pychrysa/format/executable.c
index e7e218d..c48ae2f 100644
--- a/plugins/pychrysa/format/executable.c
+++ b/plugins/pychrysa/format/executable.c
@@ -32,6 +32,7 @@
#include "format.h"
+#include "../helpers.h"
@@ -93,25 +94,15 @@ PyTypeObject *get_python_executable_format_type(void)
bool register_python_executable_format(PyObject *module)
{
PyTypeObject *py_exe_format_type; /* Type Python 'ExeFormat' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_exe_format_type = get_python_executable_format_type();
- py_exe_format_type->tp_base = get_python_binary_format_type();
- py_exe_format_type->tp_basicsize = py_exe_format_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_exe_format_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_EXE_FORMAT, py_exe_format_type, get_python_binary_format_type()))
return false;
- Py_INCREF(py_exe_format_type);
- ret = PyModule_AddObject(module, "ExeFormat", (PyObject *)py_exe_format_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ExeFormat", G_TYPE_EXE_FORMAT, py_exe_format_type,
- Py_BuildValue("(O)", py_exe_format_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/format/format.c b/plugins/pychrysa/format/format.c
index fb8b249..22ade20 100644
--- a/plugins/pychrysa/format/format.c
+++ b/plugins/pychrysa/format/format.c
@@ -576,26 +576,16 @@ PyTypeObject *get_python_binary_format_type(void)
bool register_python_binary_format(PyObject *module)
{
PyTypeObject *py_bin_format_type; /* Type Python 'BinFormat' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_bin_format_type = get_python_binary_format_type();
- py_bin_format_type->tp_base = &PyGObject_Type;
- py_bin_format_type->tp_basicsize = py_bin_format_type->tp_base->tp_basicsize;
-
APPLY_ABSTRACT_FLAG(py_bin_format_type);
- if (PyType_Ready(py_bin_format_type) != 0)
- return false;
-
- Py_INCREF(py_bin_format_type);
- ret = PyModule_AddObject(module, "BinFormat", (PyObject *)py_bin_format_type);
- if (ret != 0) return false;
-
dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "BinFormat", G_TYPE_BIN_FORMAT, py_bin_format_type,
- Py_BuildValue("(O)", py_bin_format_type->tp_base));
+
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_FORMAT, py_bin_format_type, &PyGObject_Type))
+ return false;
return true;
diff --git a/plugins/pychrysa/format/symbol.c b/plugins/pychrysa/format/symbol.c
index 1fc868e..27674e0 100644
--- a/plugins/pychrysa/format/symbol.c
+++ b/plugins/pychrysa/format/symbol.c
@@ -693,28 +693,18 @@ PyTypeObject *get_python_binary_symbol_type(void)
bool register_python_binary_symbol(PyObject *module)
{
PyTypeObject *py_bin_symbol_type; /* Type Python 'BinSymbol' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_bin_symbol_type = get_python_binary_symbol_type();
- py_bin_symbol_type->tp_base = &PyGObject_Type;
- py_bin_symbol_type->tp_basicsize = py_bin_symbol_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_bin_symbol_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_SYMBOL, py_bin_symbol_type, &PyGObject_Type))
return false;
if (!py_binary_symbol_define_constants(py_bin_symbol_type))
return false;
- Py_INCREF(py_bin_symbol_type);
- ret = PyModule_AddObject(module, "BinSymbol", (PyObject *)py_bin_symbol_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "BinSymbol", G_TYPE_BIN_SYMBOL, py_bin_symbol_type,
- Py_BuildValue("(O)", py_bin_symbol_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/glibext/bufferline.c b/plugins/pychrysa/glibext/bufferline.c
index ce85cfb..f3ef2c0 100644
--- a/plugins/pychrysa/glibext/bufferline.c
+++ b/plugins/pychrysa/glibext/bufferline.c
@@ -356,28 +356,18 @@ PyTypeObject *get_python_buffer_line_type(void)
bool register_python_buffer_line(PyObject *module)
{
PyTypeObject *py_buffer_line_type; /* Type Python 'BufferLine' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_buffer_line_type = get_python_buffer_line_type();
- py_buffer_line_type->tp_base = &PyGObject_Type;
- py_buffer_line_type->tp_basicsize = py_buffer_line_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_buffer_line_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_BUFFER_LINE, py_buffer_line_type, &PyGObject_Type))
return false;
if (!py_buffer_line_define_constants(py_buffer_line_type))
return false;
- Py_INCREF(py_buffer_line_type);
- ret = PyModule_AddObject(module, "BufferLine", (PyObject *)py_buffer_line_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "BufferLine", G_TYPE_BUFFER_LINE, py_buffer_line_type,
- Py_BuildValue("(O)", py_buffer_line_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/glibext/codebuffer.c b/plugins/pychrysa/glibext/codebuffer.c
index 9d9bc96..efe3141 100644
--- a/plugins/pychrysa/glibext/codebuffer.c
+++ b/plugins/pychrysa/glibext/codebuffer.c
@@ -32,6 +32,7 @@
#include "../arch/vmpa.h"
+#include "../helpers.h"
@@ -146,25 +147,15 @@ PyTypeObject *get_python_code_buffer_type(void)
bool register_python_code_buffer(PyObject *module)
{
PyTypeObject *py_code_buffer_type; /* Type Python 'CodeBuffer' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_code_buffer_type = get_python_code_buffer_type();
- py_code_buffer_type->tp_base = &PyGObject_Type;
- py_code_buffer_type->tp_basicsize = py_code_buffer_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_code_buffer_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_CODE_BUFFER, py_code_buffer_type, &PyGObject_Type))
return false;
- Py_INCREF(py_code_buffer_type);
- ret = PyModule_AddObject(module, "CodeBuffer", (PyObject *)py_code_buffer_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "CodeBuffer", G_TYPE_CODE_BUFFER, py_code_buffer_type,
- Py_BuildValue("(O)", py_code_buffer_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/glibext/configuration.c b/plugins/pychrysa/glibext/configuration.c
index fd35b19..b35806a 100644
--- a/plugins/pychrysa/glibext/configuration.c
+++ b/plugins/pychrysa/glibext/configuration.c
@@ -31,6 +31,9 @@
#include <glibext/configuration.h>
+#include "../helpers.h"
+
+
/* ---------------------------- ELEMENT DE CONFIGURATION ---------------------------- */
@@ -574,29 +577,19 @@ static bool py_config_param_define_constants(PyObject *dict)
bool register_python_config_param(PyObject *module)
{
- PyTypeObject *py_config_param_type; /* Type Python 'ConfigParam' */
- int ret; /* Bilan d'un appel */
+ PyTypeObject *py_config_param_type; /* Type Python 'ConfigParam' */
PyObject *dict; /* Dictionnaire du module */
py_config_param_type = get_python_config_param_type();
- py_config_param_type->tp_base = &PyGObject_Type;
- py_config_param_type->tp_basicsize = py_config_param_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_config_param_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_CFG_PARAM, py_config_param_type, &PyGObject_Type))
return false;
if (!py_config_param_define_constants(py_config_param_type->tp_dict))
return false;
- Py_INCREF(py_config_param_type);
- ret = PyModule_AddObject(module, "ConfigParam", (PyObject *)py_config_param_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ConfigParam", G_TYPE_CFG_PARAM, py_config_param_type,
- Py_BuildValue("(O)", py_config_param_type->tp_base));
-
return true;
}
@@ -779,7 +772,7 @@ PyTypeObject *get_python_config_param_iterator_type(void)
bool register_python_config_param_iterator(PyObject *module)
{
- PyTypeObject *py_config_param_iterator_type; /* Type Python 'ConfigParamIterator' */
+ PyTypeObject *py_config_param_iterator_type;/* Type Python 'Cnf...Iter'*/
int ret; /* Bilan d'un appel */
py_config_param_iterator_type = get_python_config_param_iterator_type();
@@ -1158,24 +1151,17 @@ PyTypeObject *get_python_generic_config_type(void)
bool register_python_generic_config(PyObject *module)
{
PyTypeObject *py_generic_config_type; /* Type Python 'GenConfig' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_generic_config_type = get_python_generic_config_type();
- py_generic_config_type->tp_base = &PyGObject_Type;
- py_generic_config_type->tp_basicsize = py_generic_config_type->tp_base->tp_basicsize;
-
if (PyType_Ready(py_generic_config_type) != 0)
return false;
- Py_INCREF(py_generic_config_type);
- ret = PyModule_AddObject(module, "GenConfig", (PyObject *)py_generic_config_type);
- if (ret != 0) return false;
-
dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "GenConfig", G_TYPE_GEN_CONFIG, py_generic_config_type,
- Py_BuildValue("(O)", py_generic_config_type->tp_base));
+
+ if (!register_class_for_pygobject(dict, G_TYPE_GEN_CONFIG, py_generic_config_type, &PyGObject_Type))
+ return false;
return true;
diff --git a/plugins/pychrysa/gtkext/blockview.c b/plugins/pychrysa/gtkext/blockview.c
index 973538b..5b8ab79 100644
--- a/plugins/pychrysa/gtkext/blockview.c
+++ b/plugins/pychrysa/gtkext/blockview.c
@@ -32,6 +32,7 @@
#include "bufferview.h"
+#include "../helpers.h"
@@ -93,25 +94,15 @@ PyTypeObject *get_python_block_view_type(void)
bool register_python_block_view(PyObject *module)
{
PyTypeObject *py_block_view_type; /* Type Python 'BlockView' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_block_view_type = get_python_block_view_type();
- py_block_view_type->tp_base = get_python_buffer_view_type();
- py_block_view_type->tp_basicsize = py_block_view_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_block_view_type) != 0)
+ if (!register_class_for_pygobject(dict, GTK_TYPE_BLOCK_VIEW, py_block_view_type, get_python_buffer_view_type()))
return false;
- Py_INCREF(py_block_view_type);
- ret = PyModule_AddObject(module, "BlockView", (PyObject *)py_block_view_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "BlockView", GTK_TYPE_BLOCK_VIEW, py_block_view_type,
- Py_BuildValue("(O)", py_block_view_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/gtkext/bufferview.c b/plugins/pychrysa/gtkext/bufferview.c
index a8b86e8..00f32bc 100644
--- a/plugins/pychrysa/gtkext/bufferview.c
+++ b/plugins/pychrysa/gtkext/bufferview.c
@@ -32,6 +32,7 @@
#include "viewpanel.h"
+#include "../helpers.h"
@@ -93,25 +94,15 @@ PyTypeObject *get_python_buffer_view_type(void)
bool register_python_buffer_view(PyObject *module)
{
PyTypeObject *py_buffer_view_type; /* Type Python 'Bufferview' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_buffer_view_type = get_python_buffer_view_type();
- py_buffer_view_type->tp_base = get_python_view_panel_type();
- py_buffer_view_type->tp_basicsize = py_buffer_view_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_buffer_view_type) != 0)
+ if (!register_class_for_pygobject(dict, GTK_TYPE_BUFFER_VIEW, py_buffer_view_type, get_python_view_panel_type()))
return false;
- Py_INCREF(py_buffer_view_type);
- ret = PyModule_AddObject(module, "Bufferview", (PyObject *)py_buffer_view_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "Bufferview", GTK_TYPE_BUFFER_VIEW, py_buffer_view_type,
- Py_BuildValue("(O)", py_buffer_view_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/gtkext/viewpanel.c b/plugins/pychrysa/gtkext/viewpanel.c
index c031627..f8d6d4e 100644
--- a/plugins/pychrysa/gtkext/viewpanel.c
+++ b/plugins/pychrysa/gtkext/viewpanel.c
@@ -228,7 +228,7 @@ bool register_python_view_panel(PyObject *module)
{
PyTypeObject *py_view_panel_type; /* Type Python 'ViewPanel' */
PyObject *parent_mod; /* Module Python Fixed */
- int ret; /* Bilan d'un appel */
+ PyObject *fixed; /* Module "GtkFixed" */
PyObject *dict; /* Dictionnaire du module */
py_view_panel_type = get_python_view_panel_type();
@@ -236,25 +236,17 @@ bool register_python_view_panel(PyObject *module)
parent_mod = PyImport_ImportModule("gi.repository.Gtk");
if (parent_mod == NULL) return false;
- py_view_panel_type->tp_base = (PyTypeObject *)PyObject_GetAttrString(parent_mod, "Fixed");
+ fixed = PyObject_GetAttrString(parent_mod, "Fixed");
Py_DECREF(parent_mod);
- py_view_panel_type->tp_basicsize = py_view_panel_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_view_panel_type) != 0)
+ if (!register_class_for_pygobject(dict, GTK_TYPE_VIEW_PANEL, py_view_panel_type, (PyTypeObject *)fixed))
return false;
if (!py_view_panel_define_constants(py_view_panel_type))
return false;
- Py_INCREF(py_view_panel_type);
- ret = PyModule_AddObject(module, "ViewPanel", (PyObject *)py_view_panel_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "ViewPanel", GTK_TYPE_VIEW_PANEL, py_view_panel_type,
- Py_BuildValue("(O)", py_view_panel_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/gui/editem.c b/plugins/pychrysa/gui/editem.c
index e2289b0..495e5e4 100644
--- a/plugins/pychrysa/gui/editem.c
+++ b/plugins/pychrysa/gui/editem.c
@@ -439,26 +439,16 @@ PyTypeObject *get_python_editor_item_type(void)
bool register_python_editor_item(PyObject *module)
{
- PyTypeObject *py_editor_item_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
+ PyTypeObject *py_editor_item_type; /* Type Python 'LoadedBinary' */
PyObject *dict; /* Dictionnaire du module */
py_editor_item_type = get_python_editor_item_type();
- py_editor_item_type->tp_base = &PyGObject_Type;
- py_editor_item_type->tp_basicsize = py_editor_item_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_editor_item_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_EDITOR_ITEM, py_editor_item_type, &PyGObject_Type))
return false;
- Py_INCREF(py_editor_item_type);
- ret = PyModule_AddObject(module, "EditorItem", (PyObject *)py_editor_item_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "EditorItem", G_TYPE_EDITOR_ITEM, py_editor_item_type,
- Py_BuildValue("(O)", py_editor_item_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/gui/panels/log.c b/plugins/pychrysa/gui/panels/log.c
index ba68fe9..fcf5ac5 100644
--- a/plugins/pychrysa/gui/panels/log.c
+++ b/plugins/pychrysa/gui/panels/log.c
@@ -183,28 +183,18 @@ PyTypeObject *get_python_log_panel_type(void)
bool register_python_log_panel(PyObject *module)
{
PyTypeObject *py_log_panel_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_log_panel_type = get_python_log_panel_type();
- py_log_panel_type->tp_base = get_python_panel_item_type();
- py_log_panel_type->tp_basicsize = py_log_panel_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_log_panel_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_LOG_PANEL, py_log_panel_type, get_python_panel_item_type()))
return false;
if (!define_python_log_constants(py_log_panel_type))
return false;
- Py_INCREF(py_log_panel_type);
- ret = PyModule_AddObject(module, "LogPanel", (PyObject *)py_log_panel_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "LogPanel", G_TYPE_LOG_PANEL, py_log_panel_type,
- Py_BuildValue("(O)", py_log_panel_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index bfdfb5f..0e15fb1 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -226,28 +226,18 @@ static bool py_panel_item_define_constants(PyTypeObject *obj_type)
bool register_python_panel_item(PyObject *module)
{
PyTypeObject *py_panel_item_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_panel_item_type = get_python_panel_item_type();
- py_panel_item_type->tp_base = get_python_editor_item_type();
- py_panel_item_type->tp_basicsize = py_panel_item_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_panel_item_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_PANEL_ITEM, py_panel_item_type, get_python_editor_item_type()))
return false;
if (!py_panel_item_define_constants(py_panel_item_type))
return false;
- Py_INCREF(py_panel_item_type);
- ret = PyModule_AddObject(module, "PanelItem", (PyObject *)py_panel_item_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "PanelItem", G_TYPE_PANEL_ITEM, py_panel_item_type,
- Py_BuildValue("(O)", py_panel_item_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/helpers.c b/plugins/pychrysa/helpers.c
index 5ba2fb4..d2047df 100644
--- a/plugins/pychrysa/helpers.c
+++ b/plugins/pychrysa/helpers.c
@@ -24,6 +24,10 @@
#include "helpers.h"
+#include <assert.h>
+#include <pygobject.h>
+
+
/******************************************************************************
* *
@@ -181,3 +185,54 @@ bool PyDict_AddStringConstant(PyTypeObject *obj_type, const char *key, const cha
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module où conserver une référence au type créé. *
+* gtype = type dans sa version GLib. *
+* type = type dans sa version Python. *
+* base = type de base de l'objet. *
+* *
+* Description : Enregistre correctement une surcouche de conversion GObject. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_class_for_pygobject(PyObject *dict, GType gtype, PyTypeObject *type, PyTypeObject *base)
+{
+ /**
+ * pygobject_register_class() définit type->tp_base à partir des arguments fournis,
+ * puis fait appel à PyType_Ready().
+ *
+ * PyType_Ready() complète la définition via inherit_special() :
+ *
+ * type->tp_basicsize = type->tp_base->tp_basicsize
+ *
+ * Cependant, il y a un appel à mro_internal() avant, qui mène à solid_base()
+ * puis à extra_ivars(). Et là :
+ *
+ * size_t t_size = type->tp_basicsize;
+ * size_t b_size = base->tp_basicsize;
+ *
+ * assert(t_size >= b_size);
+ *
+ * Si le type de base est spécifié, une taille doit être indiquée.
+ *
+ * Et quelqu'un doit se coller à la tâche. PyGObject ne fait rien, donc...
+ */
+
+ if (type->tp_basicsize < base->tp_basicsize)
+ {
+ assert(type->tp_basicsize == 0);
+ type->tp_basicsize = base->tp_basicsize;
+ }
+
+ pygobject_register_class(dict, NULL, gtype, type, Py_BuildValue("(O)", base));
+
+ return true;
+
+}
diff --git a/plugins/pychrysa/helpers.h b/plugins/pychrysa/helpers.h
index bd11459..d7e9666 100644
--- a/plugins/pychrysa/helpers.h
+++ b/plugins/pychrysa/helpers.h
@@ -25,6 +25,7 @@
#define _PLUGINS_HELPERS_H
+#include <glib-object.h>
#include <Python.h>
#include <stdbool.h>
@@ -60,5 +61,9 @@ bool PyDict_AddStringConstant(PyTypeObject *, const char *, const char *);
#define APPLY_ABSTRACT_FLAG(tp) tp->tp_new = PyBaseObject_Type.tp_new
+/* Enregistre correctement une surcouche de conversion GObject. */
+bool register_class_for_pygobject(PyObject *, GType, PyTypeObject *, PyTypeObject *);
+
+
#endif /* _PLUGINS_HELPERS_H */
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index 5e968e2..3703343 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -791,28 +791,18 @@ PyTypeObject *get_python_plugin_module_type(void)
bool register_python_plugin_module(PyObject *module)
{
PyTypeObject *py_plugin_module_type; /* Type Python 'PluginModule' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_plugin_module_type = get_python_plugin_module_type();
- py_plugin_module_type->tp_base = &PyGObject_Type;
- py_plugin_module_type->tp_basicsize = py_plugin_module_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_plugin_module_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_PLUGIN_MODULE, py_plugin_module_type, &PyGObject_Type))
return false;
if (!py_plugin_module_define_constants(py_plugin_module_type))
return false;
- Py_INCREF(py_plugin_module_type);
- ret = PyModule_AddObject(module, "PluginModule", (PyObject *)py_plugin_module_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "PluginModule", G_TYPE_PLUGIN_MODULE, py_plugin_module_type,
- Py_BuildValue("(O)", py_plugin_module_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c
index a985294..ebe79d8 100644
--- a/plugins/pychrysa/pychrysa.c
+++ b/plugins/pychrysa/pychrysa.c
@@ -24,203 +24,7 @@
#include "pychrysa.h"
-
-
-#if 0
-
-#include <dirent.h>
-#include <pygobject.h>
-#include <string.h>
-//#include <pygtk/pygtk.h>
-
-
-#include <config.h>
-
-
-#include "quirks.h"
-#include "analysis/module.h"
-#include "arch/module.h"
-#include "debug/module.h"
-#include "format/module.h"
-#include "glibext/module.h"
-#include "gtkext/module.h"
-#include "gui/module.h"
-
-/*
-#include "analysis/py_binary.h"
-#include "analysis/py_line.h"
-#include "analysis/py_line_code.h"
-#include "analysis/roptions.h"
-*/
-#include "../../src/common/environment.h"
-#include "../../src/common/extstr.h"
-#include "../../src/plugins/plugin-int.h"
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : plugin = instance représentant le greffon en chargement. *
-* ref = espace de référencement global. *
-* *
-* Description : Initialise le greffon permettant l'usage de Python. *
-* *
-* Retour : true. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool init_plugin(GPluginModule *plugin, GObject *ref)
-{
- char *paths; /* Emplacements de greffons */
- char *path; /* Chemin à fouiller */
- char *save; /* Sauvegarde pour ré-entrance */
- DIR *dir; /* Répertoire à parcourir */
- struct dirent entry; /* Elément trouvé */
- struct dirent *next; /* Prochain élément fourni */
- int ret; /* Bilan d'un appel système */
- char *filename; /* Chemin d'accès reconstruit */
-
-
-
-
- GPluginModule *pyplugin;
-
-
-
- /* Définition des zones d'influence */
-
- add_to_env_var("PYTHONPATH", PLUGINS_DIR G_DIR_SEPARATOR_S "python", ";");
-
- paths = get_env_var("PYTHONPATH");
-
- /* Intialisations Python */
-
-
- //return false;
-
- define_internal_ref(ref);
-
- Py_Initialize();
-
- //pychrysalide_set_gc_threshold(INT_MAX, INT_MAX, INT_MAX);
- //pychrysalide_set_gc_threshold(1, 1, 1);
-
- initpychrysa();
-
-
-
- /* Chargement des greffons */
-
- save = NULL; /* gcc... */
-
- for (path = strtok_r(paths, ";", &save);
- path != NULL;
- path = strtok_r(NULL, ";", &save))
- {
- dir = opendir(path);
- if (dir == NULL)
- {
- perror("opendir");
- continue;
- }
-
- for (ret = readdir_r(dir, &entry, &next);
- ret == 0 && next != NULL;
- ret = readdir_r(dir, &entry, &next))
- {
- if (entry.d_name[0] == '.') continue;
- //if (strcmp(entry.d_name, "test") != 0) continue;
-
- printf("NAME :: '%s'\n", entry.d_name);
- if (strcmp(entry.d_name, "apkfiles") != 0) continue;
-
- filename = strdup(entry.d_name);
- filename = stradd(filename, ".");
- filename = stradd(filename, "__init__");
-
- pyplugin = g_python_plugin_new(entry.d_name, filename);
-
- if (pyplugin == NULL)
- g_plugin_module_log_variadic_message(plugin, LMT_ERROR,
- _("No suitable Python plugin found in '%s'"),
- filename);
- else
- {
- g_plugin_module_log_variadic_message(plugin, LMT_PROCESS,
- _("Loaded Python plugin '<b>%s</b>' from the '<b>%s</b>' directory"),
- g_plugin_module_get_name(G_PLUGIN_MODULE(pyplugin)), path);
- add_plugin_to_main_list(pyplugin);
- }
-
- free(filename);
-
- }
-
- closedir(dir);
-
- }
-
- return true;
-
-}
-
-
-
-
-
-
-
-#endif
-
-
-
-
-
-
-#include <locale.h>
#include <pygobject.h>
-
-
-
-
-
-#include <core/core.h>
-
-
-
-#include "analysis/module.h"
-#include "arch/module.h"
-#include "common/module.h"
-#include "core/module.h"
-#include "format/module.h"
-#include "glibext/module.h"
-#include "gtkext/module.h"
-#include "gui/module.h"
-
-
-
-// TODO : à bouger ?
-#include "../../src/arch/processor.h"
-#include "../../src/format/format.h"
-
-
-
-
-
-
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:///////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:///////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:///////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:///////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:///////////////////////////
-
-
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
@@ -231,14 +35,21 @@ bool init_plugin(GPluginModule *plugin, GObject *ref)
#include <common/cpp.h>
#include <common/environment.h>
#include <common/extstr.h>
+#include <core/core.h>
#include <plugins/plugin-def.h>
#include <plugins/plugin-int.h>
#include "plugin.h"
#include "quirks.h"
-
-
+#include "analysis/module.h"
+#include "arch/module.h"
+#include "common/module.h"
+#include "core/module.h"
+#include "format/module.h"
+#include "glibext/module.h"
+#include "gtkext/module.h"
+#include "gui/module.h"