summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/analysis/contents/restricted.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/analysis/contents/restricted.c')
-rw-r--r--plugins/pychrysa/analysis/contents/restricted.c70
1 files changed, 8 insertions, 62 deletions
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;