summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-03-01 22:54:45 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-03-01 22:54:45 (GMT)
commit0c638aecff9482b93621d77279ac77a8788584e9 (patch)
treec207e648c9d8f8429a29ba1c364fb2293dd4274b /plugins/pychrysalide
parenteb68c77804d9b85bc9b3c5a87ba3f64dd83afce1 (diff)
Given some priority to Elf PLT entries during the disassembly process.
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r--plugins/pychrysalide/arch/constants.c42
-rw-r--r--plugins/pychrysalide/arch/constants.h3
-rw-r--r--plugins/pychrysalide/arch/context.c4
-rw-r--r--plugins/pychrysalide/format/format.c6
4 files changed, 52 insertions, 3 deletions
diff --git a/plugins/pychrysalide/arch/constants.c b/plugins/pychrysalide/arch/constants.c
index b7dd8a1..f738ec3 100644
--- a/plugins/pychrysalide/arch/constants.c
+++ b/plugins/pychrysalide/arch/constants.c
@@ -150,3 +150,45 @@ bool define_arch_vmpa_constants(PyTypeObject *type)
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type dont le dictionnaire est à compléter. *
+* *
+* Description : Définit les constantes relatives aux contextes. *
+* *
+* Retour : true en cas de succès de l'opération, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool define_proc_context_constants(PyTypeObject *type)
+{
+ bool result; /* Bilan à retourner */
+ PyObject *values; /* Groupe de valeurs à établir */
+
+ values = PyDict_New();
+
+ result = add_const_to_group(values, "ENTRY_POINT", DPL_ENTRY_POINT);
+ if (result) result = add_const_to_group(values, "FORMAT_POINT", DPL_FORMAT_POINT);
+ if (result) result = add_const_to_group(values, "SYMBOL", DPL_SYMBOL);
+ if (result) result = add_const_to_group(values, "OTHER", DPL_OTHER);
+ if (result) result = add_const_to_group(values, "COUNT", DPL_COUNT);
+
+ if (!result)
+ {
+ Py_DECREF(values);
+ goto exit;
+ }
+
+ result = attach_constants_group_to_type(type, true, "DisassPriorityLevel", values,
+ "Level of priority for a given point during the" \
+ " disassembling process.");
+
+ exit:
+
+ return result;
+
+}
diff --git a/plugins/pychrysalide/arch/constants.h b/plugins/pychrysalide/arch/constants.h
index ecd6ce8..f047c56 100644
--- a/plugins/pychrysalide/arch/constants.h
+++ b/plugins/pychrysalide/arch/constants.h
@@ -37,6 +37,9 @@ bool define_arch_instruction_constants(PyTypeObject *);
/* Définit les constantes relatives aux emplacements. */
bool define_arch_vmpa_constants(PyTypeObject *);
+/* Définit les constantes relatives aux contextes. */
+bool define_proc_context_constants(PyTypeObject *);
+
#endif /* _PLUGINS_PYCHRYSALIDE_ARCH_CONSTANTS_H */
diff --git a/plugins/pychrysalide/arch/context.c b/plugins/pychrysalide/arch/context.c
index 4428075..f7c6549 100644
--- a/plugins/pychrysalide/arch/context.c
+++ b/plugins/pychrysalide/arch/context.c
@@ -32,6 +32,7 @@
#include <arch/context.h>
+#include "constants.h"
#include "../access.h"
#include "../helpers.h"
@@ -111,6 +112,9 @@ bool ensure_python_proc_context_is_registered(void)
if (!register_class_for_pygobject(dict, G_TYPE_PROC_CONTEXT, type, &PyGObject_Type))
return false;
+ if (!define_proc_context_constants(type))
+ return false;
+
}
return true;
diff --git a/plugins/pychrysalide/format/format.c b/plugins/pychrysalide/format/format.c
index 6cd706c..3709f6d 100644
--- a/plugins/pychrysalide/format/format.c
+++ b/plugins/pychrysalide/format/format.c
@@ -118,16 +118,16 @@ static bool define_python_binary_format_constants(PyTypeObject *);
static PyObject *py_binary_format_register_code_point(PyObject *self, PyObject *args)
{
unsigned long long pt; /* Adresse virtuelle du point */
- int entry; /* Nature du point fourni */
+ unsigned long level; /* Nature du point fourni */
int ret; /* Bilan de lecture des args. */
GBinFormat *format; /* Format de binaire manipulé */
- ret = PyArg_ParseTuple(args, "Kp", &pt, &entry);
+ ret = PyArg_ParseTuple(args, "Kk", &pt, &level);
if (!ret) return NULL;
format = G_BIN_FORMAT(pygobject_get(self));
- g_binary_format_register_code_point(format, pt, entry);
+ g_binary_format_register_code_point(format, pt, level);
Py_RETURN_NONE;