summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/format/constants.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-04-13 22:53:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-04-13 22:53:32 (GMT)
commit0794024b412604ae5e5aca0f104b5a8f3ec5412c (patch)
treec5b73975561cf95e9c65f84b27423f218ffab2b0 /plugins/pychrysalide/format/constants.c
parente75a1aea506869d441fc084f78102367be1f9ed2 (diff)
Avoided to look for syscalls in a kernel binary.
Diffstat (limited to 'plugins/pychrysalide/format/constants.c')
-rw-r--r--plugins/pychrysalide/format/constants.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/plugins/pychrysalide/format/constants.c b/plugins/pychrysalide/format/constants.c
index a0d71f7..0df7bd4 100644
--- a/plugins/pychrysalide/format/constants.c
+++ b/plugins/pychrysalide/format/constants.c
@@ -25,6 +25,7 @@
#include "constants.h"
+#include <format/format.h>
#include <format/symbol.h>
@@ -36,7 +37,60 @@
* *
* Paramètres : type = type dont le dictionnaire est à compléter. *
* *
-* Description : Définit les constantes pour le format Dex. *
+* Description : Définit les constantes pour les formats binaires. *
+* *
+* Retour : true en cas de succès de l'opération, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool define_binary_format_constants(PyTypeObject *type)
+{
+ bool result; /* Bilan à retourner */
+ PyObject *values; /* Groupe de valeurs à établir */
+
+ values = PyDict_New();
+
+ result = add_const_to_group(values, "SPECIFICATION", BFE_SPECIFICATION);
+ if (result) result = add_const_to_group(values, "STRUCTURE", BFE_STRUCTURE);
+
+ if (!result)
+ {
+ Py_DECREF(values);
+ goto exit;
+ }
+
+ result = attach_constants_group_to_type(type, true, "BinaryFormatError", values,
+ "Flags for error occurring while loading a binary format.");
+
+ values = PyDict_New();
+
+ result = add_const_to_group(values, "NONE", FFL_NONE);
+ if (result) result = add_const_to_group(values, "RUN_IN_KERNEL_SPACE", FFL_RUN_IN_KERNEL_SPACE);
+ if (result) result = add_const_to_group(values, "MASK", FFL_MASK);
+
+ if (!result)
+ {
+ Py_DECREF(values);
+ goto exit;
+ }
+
+ result = attach_constants_group_to_type(type, true, "FormatFlag", values,
+ "Extra indications for formats.");
+
+ exit:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type dont le dictionnaire est à compléter. *
+* *
+* Description : Définit les constantes pour les symboles binaires. *
* *
* Retour : true en cas de succès de l'opération, false sinon. *
* *