summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/format/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/format/format.c')
-rw-r--r--plugins/pychrysalide/format/format.c167
1 files changed, 5 insertions, 162 deletions
diff --git a/plugins/pychrysalide/format/format.c b/plugins/pychrysalide/format/format.c
index 6c1d2da..34826cf 100644
--- a/plugins/pychrysalide/format/format.c
+++ b/plugins/pychrysalide/format/format.c
@@ -33,6 +33,7 @@
#include "constants.h"
#include "executable.h"
+#include "known.h"
#include "symbol.h"
#include "symiter.h"
#include "../access.h"
@@ -53,9 +54,6 @@ static PyObject *py_binary_format_unset_flag(PyObject *, PyObject *);
/* Détermine si un format possède un fanion particulier. */
static PyObject *py_binary_format_has_flag(PyObject *, PyObject *);
-/* Assure l'interprétation d'un format en différé. */
-static PyObject *py_binary_format_analyze(PyObject *, PyObject *, PyObject *);
-
/* Enregistre une adresse comme début d'une zone de code. */
static PyObject *py_binary_format_register_code_point(PyObject *, PyObject *);
@@ -80,15 +78,6 @@ static PyObject *py_binary_format_resolve_symbol(PyObject *, PyObject *);
/* Fournit les particularités du format. */
static PyObject *py_binary_format_get_flags(PyObject *, void *);
-/* Indique la désignation interne du format. */
-static PyObject *py_binary_format_get_name(PyObject *, void *);
-
-/* Indique la désignation humaine du format. */
-static PyObject *py_binary_format_get_description(PyObject *, void *);
-
-/* Fournit une référence vers le contenu binaire analysé. */
-static PyObject *py_binary_format_get_content(PyObject *, void *);
-
/* Fournit la liste de tous les symboles détectés. */
static PyObject *py_binary_format_get_symbols(PyObject *, void *);
@@ -263,50 +252,6 @@ static PyObject *py_binary_format_has_flag(PyObject *self, PyObject *args)
/******************************************************************************
* *
-* Paramètres : self = contenu binaire à manipuler. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Assure l'interprétation d'un format en différé. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_format_analyze(PyObject *self, PyObject *args, PyObject *kwds)
-{
- PyObject *result; /* Bilan à retourner */
- GBinFormat *format; /* Version GLib de l'élément */
- bool status; /* Bilan d'analyse à recevoir */
-
-#define BINARY_FORMAT_ANALYZE_METHOD PYTHON_METHOD_DEF \
-( \
- analyze, "$self", \
- METH_NOARGS, py_binary_format, \
- "Analyze the the format recognized from a binary content.\n" \
- "\n" \
- "Once this analysis is done, a few early symbols and the mapped" \
- " sections are expected to be defined.\n" \
- "\n" \
- "The return value is a boolean status of the operation." \
-)
-
- format = G_BIN_FORMAT(pygobject_get(self));
-
- status = g_binary_format_analyze(format, 0, NULL);
-
- result = status ? Py_True : Py_False;
- Py_INCREF(result);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : self = classe représentant un format. *
* args = arguments fournis à l'appel. *
* *
@@ -642,98 +587,6 @@ static PyObject *py_binary_format_get_flags(PyObject *self, void *closure)
/******************************************************************************
* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Indique la désignation interne du format. *
-* *
-* Retour : Description du format. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_format_get_name(PyObject *self, void *closure)
-{
- PyObject *result; /* Trouvailles à retourner */
- GBinFormat *format; /* Format de binaire manipulé */
- const char *name; /* Description interne */
-
- format = G_BIN_FORMAT(pygobject_get(self));
-
- name = g_binary_format_get_name(format);
-
- result = PyUnicode_FromString(name);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Indique la désignation humaine du format. *
-* *
-* Retour : Description du format. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_format_get_description(PyObject *self, void *closure)
-{
- PyObject *result; /* Trouvailles à retourner */
- GBinFormat *format; /* Format de binaire manipulé */
- const char *desc; /* Description humaine */
-
- format = G_BIN_FORMAT(pygobject_get(self));
-
- desc = g_binary_format_get_description(format);
-
- result = PyUnicode_FromString(desc);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Fournit une référence vers le contenu binaire analysé. *
-* *
-* Retour : Gestionnaire de contenu binaire en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_format_get_content(PyObject *self, void *closure)
-{
- PyObject *result; /* Trouvailles à retourner */
- GBinFormat *format; /* Format de binaire manipulé */
- GBinContent *content; /* Instance GLib correspondante*/
-
- format = G_BIN_FORMAT(pygobject_get(self));
-
- content = g_binary_format_get_content(format);
-
- result = pygobject_new(G_OBJECT(content));
-
- g_object_unref(content);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : self = classe représentant un format binaire. *
* closure = adresse non utilisée ici. *
* *
@@ -884,7 +737,6 @@ PyTypeObject *get_python_binary_format_type(void)
BINARY_FORMAT_SET_FLAG_METHOD,
BINARY_FORMAT_UNSET_FLAG_METHOD,
BINARY_FORMAT_HAS_FLAG_METHOD,
- BINARY_FORMAT_ANALYZE_METHOD,
{
"register_code_point", py_binary_format_register_code_point,
METH_VARARGS,
@@ -931,18 +783,6 @@ PyTypeObject *get_python_binary_format_type(void)
static PyGetSetDef py_bin_format_getseters[] = {
BINARY_FORMAT_FLAGS_ATTRIB,
{
- "name", py_binary_format_get_name, NULL,
- "Internal name of the binary format.", NULL
- },
- {
- "description", py_binary_format_get_description, NULL,
- "Human description of the binary format.", NULL
- },
- {
- "content", py_binary_format_get_content, NULL,
- "Content of the binary format.", NULL
- },
- {
"symbols", py_binary_format_get_symbols, NULL,
"Iterable list of all symbols found in the binary format.", NULL
},
@@ -1002,7 +842,10 @@ bool ensure_python_binary_format_is_registered(void)
dict = PyModule_GetDict(module);
- if (!register_class_for_pygobject(dict, G_TYPE_BIN_FORMAT, type, &PyGObject_Type))
+ if (!ensure_python_known_format_is_registered())
+ return false;
+
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_FORMAT, type, get_python_known_format_type()))
return false;
if (!define_binary_format_constants(type))