summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-09-26 22:40:22 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-09-26 22:40:22 (GMT)
commitd8f695596e4225de797504f8f797e1347491dd14 (patch)
tree6daaae9757c6207f9cf94c9fc39bf4f597af243d /plugins/pychrysalide
parent3e97a551f9a7178717b8ad2810b312d8fbacd689 (diff)
Extended the API for binary contents.
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r--plugins/pychrysalide/analysis/content.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/content.c b/plugins/pychrysalide/analysis/content.c
index e657857..f828b1a 100644
--- a/plugins/pychrysalide/analysis/content.c
+++ b/plugins/pychrysalide/analysis/content.c
@@ -47,6 +47,12 @@ static PyObject *py_binary_content_get_checksum(PyObject *, PyObject *);
/* Détermine le nombre d'octets lisibles. */
static PyObject *py_binary_content_compute_size(PyObject *, PyObject *);
+/* Détermine la position initiale d'un contenu. */
+static PyObject *py_binary_content_compute_start_pos(PyObject *, PyObject *);
+
+/* Détermine la position finale d'un contenu. */
+static PyObject *py_binary_content_compute_end_pos(PyObject *, PyObject *);
+
/* Fournit une portion des données représentées. */
static PyObject *py_binary_content_read_raw(PyObject *, PyObject *);
@@ -132,6 +138,66 @@ static PyObject *py_binary_content_compute_size(PyObject *self, PyObject *args)
* Paramètres : self = contenu binaire à manipuler. *
* args = non utilisé ici. *
* *
+* Description : Détermine la position initiale d'un contenu. *
+* *
+* Retour : Position initiale. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_content_compute_start_pos(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance à retourner */
+ GBinContent *content; /* Version GLib du format */
+ vmpa2t pos; /* Position à transmettre */
+
+ content = G_BIN_CONTENT(pygobject_get(self));
+
+ g_binary_content_compute_start_pos(content, &pos);
+
+ result = build_from_internal_vmpa(&pos);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = contenu binaire à manipuler. *
+* args = non utilisé ici. *
+* *
+* Description : Détermine la position finale d'un contenu. *
+* *
+* Retour : Position finale. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_content_compute_end_pos(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance à retourner */
+ GBinContent *content; /* Version GLib du format */
+ vmpa2t pos; /* Position à transmettre */
+
+ content = G_BIN_CONTENT(pygobject_get(self));
+
+ g_binary_content_compute_end_pos(content, &pos);
+
+ result = build_from_internal_vmpa(&pos);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = contenu binaire à manipuler. *
+* args = non utilisé ici. *
+* *
* Description : Fournit une portion des données représentées. *
* *
* Retour : Bilan de l'opération. *
@@ -423,6 +489,16 @@ PyTypeObject *get_python_binary_content_type(void)
"compute_size($self, /)\n--\n\nCompute the quantity of readable bytes."
},
{
+ "compute_start_pos", py_binary_content_compute_start_pos,
+ METH_NOARGS,
+ "compute_start_pos($self, /)\n--\n\nCompute the starting position of the binary content."
+ },
+ {
+ "compute_end_pos", py_binary_content_compute_end_pos,
+ METH_NOARGS,
+ "compute_end_pos($self, /)\n--\n\nCompute the ending position of the binary content."
+ },
+ {
"read_raw", py_binary_content_read_raw,
METH_VARARGS,
"read_raw($self, addr, length, /)\n--\n\nRead bytes from a given position."