summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/format/executable.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/format/executable.c')
-rw-r--r--plugins/pychrysalide/format/executable.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/pychrysalide/format/executable.c b/plugins/pychrysalide/format/executable.c
index 906fae5..5621d26 100644
--- a/plugins/pychrysalide/format/executable.c
+++ b/plugins/pychrysalide/format/executable.c
@@ -38,12 +38,16 @@
#include "../helpers.h"
#include "../arch/processor.h"
#include "../arch/vmpa.h"
+#include "../glibext/binportion.h"
/* ------------------------ DECLARATION DE FORMAT EXECUTABLE ------------------------ */
+/* Enregistre une portion artificielle pour le format. */
+static PyObject *py_exe_format_register_user_portion(PyObject *, PyObject *);
+
/* Fournit l'emplacement correspondant à une position physique. */
static PyObject *py_exe_format_translate_offset_into_vmpa(PyObject *, PyObject *);
@@ -62,6 +66,38 @@ static PyObject *py_exe_format_translate_address_into_vmpa(PyObject *, PyObject
* Paramètres : self = description de l'exécutable à consulter. *
* args = arguments accompagnant l'appel. *
* *
+* Description : Enregistre une portion artificielle pour le format. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_exe_format_register_user_portion(PyObject *self, PyObject *args)
+{
+ GBinPortion *portion; /* Portion binaire à conserver */
+ int ret; /* Bilan de lecture des args. */
+ GExeFormat *format; /* Version GLib du format */
+
+ ret = PyArg_ParseTuple(args, "O&", convert_to_binary_portion, &portion);
+ if (!ret) return NULL;
+
+ format = G_EXE_FORMAT(pygobject_get(self));
+
+ g_object_ref(G_OBJECT(portion));
+ g_exe_format_register_user_portion(format, portion);
+
+ Py_RETURN_NONE;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = description de l'exécutable à consulter. *
+* args = arguments accompagnant l'appel. *
+* *
* Description : Fournit l'emplacement correspondant à une position physique. *
* *
* Retour : Position correspondante ou None. *
@@ -161,6 +197,11 @@ PyTypeObject *get_python_executable_format_type(void)
{
static PyMethodDef py_exe_format_methods[] = {
{
+ "register_user_portion", py_exe_format_register_user_portion,
+ METH_VARARGS,
+ "register_user_portion($self, portion, /)\n--\n\nRemember a given user-defined binary portion as part of the executable format content."
+ },
+ {
"translate_offset_into_vmpa", py_exe_format_translate_offset_into_vmpa,
METH_VARARGS,
"translate_offset_into_vmpa($self, off, /)\n--\n\nTranslate a physical offset to a full location."