summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/content.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-27 22:24:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-27 22:24:07 (GMT)
commitd33e8935c5186ab2459dfa6c9340396377524fb1 (patch)
tree951e4dd3edcf9782c90fda5f564d390c01abce35 /plugins/pychrysalide/analysis/content.c
parentc8dce9ce407b2f8248d669df196a4bf0f9523723 (diff)
Extended the Python bindings.
Diffstat (limited to 'plugins/pychrysalide/analysis/content.c')
-rw-r--r--plugins/pychrysalide/analysis/content.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/content.c b/plugins/pychrysalide/analysis/content.c
index 26e7654..fab7dfe 100644
--- a/plugins/pychrysalide/analysis/content.c
+++ b/plugins/pychrysalide/analysis/content.c
@@ -41,6 +41,9 @@
+/* Fournit le nom associé au contenu binaire. */
+static PyObject *py_binary_content_describe(PyObject *, PyObject *);
+
/* Fournit une portion des données représentées. */
static PyObject *py_binary_content_read_raw(PyObject *, PyObject *);
@@ -76,6 +79,42 @@ static PyObject *py_binary_content_get_all_bytes(PyObject *, void *);
/******************************************************************************
* *
* Paramètres : self = contenu binaire à manipuler. *
+* args = précise s'il s'agit d'une version longue ou non. *
+* *
+* Description : Fournit le nom associé au contenu binaire. *
+* *
+* Retour : Nom de fichier avec chemin absolu au besoin. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_content_describe(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance à retourner */
+ GBinContent *content; /* Version GLib du format */
+ int full; /* Description complète ? */
+ int ret; /* Bilan de lecture des args. */
+ const char *desc; /* Description obtenue */
+
+ content = G_BIN_CONTENT(pygobject_get(self));
+ assert(content != NULL);
+
+ ret = PyArg_ParseTuple(args, "p", &full);
+ if (!ret) return NULL;
+
+ desc = g_binary_content_describe(content, full);
+
+ result = PyUnicode_FromString(desc);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = contenu binaire à manipuler. *
* args = non utilisé ici. *
* *
* Description : Fournit une portion des données représentées. *
@@ -479,6 +518,11 @@ PyTypeObject *get_python_binary_content_type(void)
{
static PyMethodDef py_binary_content_methods[] = {
{
+ "describe", py_binary_content_describe,
+ METH_VARARGS,
+ "describe($self, full, /)\n--\n\nGet a (full ?) description 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."