summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-10-14 06:47:29 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-10-14 06:47:29 (GMT)
commit810bce688d9b0e271d86886e182b62aa7166319f (patch)
tree33f9e4751616784fa1f97ea152f063d00c8509b6 /plugins
parentd405d93f41f9376c55ac8af7acde62eec80386ec (diff)
Improve some reference counters inside binary contents.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysalide/analysis/content.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/content.c b/plugins/pychrysalide/analysis/content.c
index 68ecba2..f94e3f7 100644
--- a/plugins/pychrysalide/analysis/content.c
+++ b/plugins/pychrysalide/analysis/content.c
@@ -99,6 +99,9 @@ static int py_binary_content_set_attributes(PyObject *, PyObject *, void *);
/* Fournit l'ensemble des attributs associés à un contenu. */
static PyObject *py_binary_content_get_attributes(PyObject *, void *);
+/* Donne l'origine d'un contenu binaire. */
+static PyObject *py_binary_content_get_root(PyObject *, void *);
+
/* Fournit une empreinte unique (SHA256) pour les données. */
static PyObject *py_binary_content_get_checksum(PyObject *, void *);
@@ -1133,6 +1136,48 @@ static PyObject *py_binary_content_get_attributes(PyObject *self, void *closure)
* Paramètres : self = contenu binaire à manipuler. *
* closure = adresse non utilisée ici. *
* *
+* Description : Donne l'origine d'un contenu binaire. *
+* *
+* Retour : Contenu à l'origine du contenu courant. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_content_get_root(PyObject *self, void *closure)
+{
+ PyObject *result; /* Instance à retourner */
+ GBinContent *content; /* Version GLib du format */
+ GContentAttributes *attribs; /* Attributs à transmettre */
+
+#define BINARY_CONTENT_ROOT_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ root, py_binary_content, \
+ "Provide, as a pychrysalide.analysis.BinContent instance, the root" \
+ " content leading to the current content." \
+ "\n" \
+ "This property is relevant only for" \
+ " pychrysalide.analysis.contents.EncapsulatedContent objects." \
+)
+
+ content = G_BIN_CONTENT(pygobject_get(self));
+
+ attribs = g_binary_content_get_attributes(content);
+
+ result = pygobject_new(G_OBJECT(attribs));
+
+ g_object_unref(attribs);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = contenu binaire à manipuler. *
+* closure = adresse non utilisée ici. *
+* *
* Description : Fournit une empreinte unique (SHA256) pour les données. *
* *
* Retour : Bilan de l'opération. *
@@ -1347,6 +1392,7 @@ PyTypeObject *get_python_binary_content_type(void)
static PyGetSetDef py_binary_content_getseters[] = {
BINARY_CONTENT_ATTRIBUTES_ATTRIB,
+ BINARY_CONTENT_ROOT_ATTRIB,
BINARY_CONTENT_CHECKSUM_ATTRIB,
BINARY_CONTENT_SIZE_ATTRIB,
BINARY_CONTENT_START_POS_ATTRIB,