diff options
Diffstat (limited to 'plugins/pychrysalide/analysis/binary.c')
-rw-r--r-- | plugins/pychrysalide/analysis/binary.c | 91 |
1 files changed, 8 insertions, 83 deletions
diff --git a/plugins/pychrysalide/analysis/binary.c b/plugins/pychrysalide/analysis/binary.c index 6be767c..1ca5b3c 100644 --- a/plugins/pychrysalide/analysis/binary.c +++ b/plugins/pychrysalide/analysis/binary.c @@ -34,8 +34,8 @@ #include <analysis/binary.h> -#include "content.h" #include "../helpers.h" +#include "../format/executable.h" @@ -45,12 +45,6 @@ static PyObject *py_loaded_binary_new(PyTypeObject *, PyObject *, PyObject *); /* Fournit le nom associé à l'élément binaire. */ static PyObject *py_loaded_binary_get_name(PyObject *, void *); -/* Lance l'analyse d'un élément binaire chargé. */ -static PyObject *py_loaded_binary_analyse(PyObject *, PyObject *); - -/* Lance l'analyse d'un binaire chargé et attend sa conclusion. */ -static PyObject *py_loaded_binary_analyse_and_wait(PyObject *, PyObject *); - /* Fournit le format de fichier reconnu dans le contenu binaire. */ static PyObject *py_loaded_binary_get_format(PyObject *, void *); @@ -79,23 +73,18 @@ static PyObject *py_loaded_binary_get_disassembled_cache(PyObject *, void *); static PyObject *py_loaded_binary_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyObject *result; /* Instance à retourner */ - PyObject *content_obj; /* Objet pour le contenu */ + PyObject *format_obj; /* Objet pour le contenu */ int ret; /* Bilan de lecture des args. */ - GBinContent *content; /* Instance GLib correspondante*/ - GLoadedBinary *binary; /* Version GLib du format */ + GExeFormat *format; /* Instance GLib correspondante*/ + GLoadedContent *binary; /* Version GLib du binaire */ - ret = PyArg_ParseTuple(args, "O", &content_obj); + ret = PyArg_ParseTuple(args, "O!", get_python_executable_format_type(), &format_obj); if (!ret) return NULL; - ret = PyObject_IsInstance(content_obj, (PyObject *)get_python_binary_content_type()); - if (ret == 0) - { - PyErr_SetString(PyExc_TypeError, _("Expected a BinContent as argument")); - return NULL; - } + format = G_EXE_FORMAT(pygobject_get(format_obj)); - content = G_BIN_CONTENT(pygobject_get(content_obj)); - binary = g_loaded_binary_new(content); + g_object_ref(G_OBJECT(format)); + binary = g_loaded_binary_new(format); result = pygobject_new(G_OBJECT(binary)); @@ -138,58 +127,6 @@ static PyObject *py_loaded_binary_get_name(PyObject *self, void *closure) /****************************************************************************** * * -* Paramètres : self = contenu binaire à manipuler. * -* args = non utilisé ici. * -* * -* Description : Lance l'analyse d'un élément binaire chargé. * -* * -* Retour : Rien (None). * -* * -* Remarques : - * -* * -******************************************************************************/ - -static PyObject *py_loaded_binary_analyse(PyObject *self, PyObject *args) -{ - GLoadedBinary *binary; /* Version GLib du format */ - - binary = G_LOADED_BINARY(pygobject_get(self)); - - g_loaded_binary_analyse(binary); - - Py_RETURN_NONE; - -} - - -/****************************************************************************** -* * -* Paramètres : self = contenu binaire à manipuler. * -* args = non utilisé ici. * -* * -* Description : Lance l'analyse d'un binaire chargé et attend sa conclusion. * -* * -* Retour : Rien (None). * -* * -* Remarques : - * -* * -******************************************************************************/ - -static PyObject *py_loaded_binary_analyse_and_wait(PyObject *self, PyObject *args) -{ - GLoadedBinary *binary; /* Version GLib du format */ - - binary = G_LOADED_BINARY(pygobject_get(self)); - - g_loaded_binary_analyse_and_wait(binary); - - Py_RETURN_NONE; - -} - - -/****************************************************************************** -* * * Paramètres : self = objet Python concerné par l'appel. * * closure = non utilisé ici. * * * @@ -296,18 +233,6 @@ static PyObject *py_loaded_binary_get_disassembled_cache(PyObject *self, void *c PyTypeObject *get_python_loaded_binary_type(void) { static PyMethodDef py_loaded_binary_methods[] = { - { - "analyse", py_loaded_binary_analyse, - METH_NOARGS, - "analyse(/)\n--\n\nStart the analysis of the loaded binary and " \ - "send a \"disassembly-done\" signal when done." - }, - { - "analyse_and_wait", py_loaded_binary_analyse_and_wait, - METH_NOARGS, - "analyse_and_wait(/)\n--\n\nRun the analysis of the loaded binary and " \ - "wait for its completion." - }, { NULL } }; |