diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/dex/format.h | 3 | ||||
| -rw-r--r-- | plugins/elf/format.h | 3 | ||||
| -rw-r--r-- | plugins/mobicore/mclf.h | 3 | ||||
| -rw-r--r-- | plugins/pychrysalide/core/Makefile.am | 1 | ||||
| -rw-r--r-- | plugins/pychrysalide/core/formats.c | 201 | ||||
| -rw-r--r-- | plugins/pychrysalide/core/formats.h | 42 | ||||
| -rw-r--r-- | plugins/pychrysalide/core/module.c | 2 | ||||
| -rw-r--r-- | plugins/pychrysalide/plugin.c | 138 | ||||
| -rw-r--r-- | plugins/readdex/class.h | 1 | ||||
| -rw-r--r-- | plugins/readdex/ids.h | 1 | ||||
| -rw-r--r-- | plugins/ropgadgets/select.c | 249 | 
11 files changed, 9 insertions, 635 deletions
| diff --git a/plugins/dex/format.h b/plugins/dex/format.h index 1879da3..e0f1739 100644 --- a/plugins/dex/format.h +++ b/plugins/dex/format.h @@ -30,7 +30,8 @@  #include <sys/types.h> -#include <core/formats.h> +#include <analysis/content.h> +#include <format/executable.h>  #include "dex_def.h" diff --git a/plugins/elf/format.h b/plugins/elf/format.h index 895ae16..51caf87 100644 --- a/plugins/elf/format.h +++ b/plugins/elf/format.h @@ -29,7 +29,8 @@  #include <stdbool.h> -#include <core/formats.h> +#include <analysis/content.h> +#include <format/executable.h>  #include "elf_def.h" diff --git a/plugins/mobicore/mclf.h b/plugins/mobicore/mclf.h index d56968b..259f49d 100644 --- a/plugins/mobicore/mclf.h +++ b/plugins/mobicore/mclf.h @@ -29,7 +29,8 @@  #include <stdbool.h> -#include <core/formats.h> +#include <analysis/content.h> +#include <format/executable.h> diff --git a/plugins/pychrysalide/core/Makefile.am b/plugins/pychrysalide/core/Makefile.am index 9e467ff..b431dcc 100644 --- a/plugins/pychrysalide/core/Makefile.am +++ b/plugins/pychrysalide/core/Makefile.am @@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libpychrysacore.la  libpychrysacore_la_SOURCES =			\  	demanglers.h demanglers.c			\ -	formats.h formats.c					\  	global.h global.c					\  	logs.h logs.c						\  	module.h module.c					\ diff --git a/plugins/pychrysalide/core/formats.c b/plugins/pychrysalide/core/formats.c deleted file mode 100644 index f11bb46..0000000 --- a/plugins/pychrysalide/core/formats.c +++ /dev/null @@ -1,201 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * formats.c - équivalent Python du fichier "core/formats.c" - * - * Copyright (C) 2015-2017 Cyrille Bagard - * - *  This file is part of Chrysalide. - * - *  Chrysalide is free software; you can redistribute it and/or modify - *  it under the terms of the GNU General Public License as published by - *  the Free Software Foundation; either version 3 of the License, or - *  (at your option) any later version. - * - *  Chrysalide is distributed in the hope that it will be useful, - *  but WITHOUT ANY WARRANTY; without even the implied warranty of - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - *  GNU General Public License for more details. - * - *  You should have received a copy of the GNU General Public License - *  along with this program; if not, write to the Free Software - *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA - */ - - -#include "formats.h" - - -#include <pygobject.h> - - -#include <core/formats.h> - - -#include "../access.h" -#include "../helpers.h" - - - -/* Fournit le nom humain du format binaire visé. */ -static PyObject *py_formats_get_binary_format_name(PyObject *, PyObject *); - -/* Définit les constantes pour les paramètres. */ -static bool py_formats_define_constants(PyTypeObject *); - - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : self = NULL car méthode statique.                            * -*                args = non utilisé ici.                                      * -*                                                                             * -*  Description : Fournit le nom humain du format binaire visé.                * -*                                                                             * -*  Retour      : Désignation humaine trouvée ou None.                         * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static PyObject *py_formats_get_binary_format_name(PyObject *self, PyObject *args) -{ -    PyObject *result;                       /* Désignation à retourner     */ -    const char *key;                        /* Nom court du format         */ -    int ret;                                /* Bilan de lecture des args.  */ -    const char *name;                       /* Désignation humaine         */ - -    ret = PyArg_ParseTuple(args, "s", &key); -    if (!ret) return NULL; - -    name = get_binary_format_name(key); - -    if (name != NULL) -        result = PyUnicode_FromString(name); - -    else -    { -        result = Py_None; -        Py_INCREF(result); -    } - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : -                                                            * -*                                                                             * -*  Description : Fournit un accès à une définition de type à diffuser.        * -*                                                                             * -*  Retour      : Définition d'objet pour Python.                              * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -PyTypeObject *get_python_formats_type(void) -{ -    static PyMethodDef py_formats_methods[] = { - -        { "get_binary_format_name", py_formats_get_binary_format_name, -          METH_VARARGS | METH_STATIC, -          "get_binary_format_name(key, /)\n--\n\nGive access to the main configuration of Chrysalide." -        }, -        { NULL } - -    }; - -    static PyTypeObject py_formats_type = { - -        PyVarObject_HEAD_INIT(NULL, 0) - -        .tp_name = "pychrysalide.core.formats", -        .tp_basicsize = sizeof(PyObject), - -        .tp_flags = Py_TPFLAGS_DEFAULT, - -        .tp_doc = "Access to the code formats", - -        .tp_methods = py_formats_methods - -    }; - -    return &py_formats_type; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : obj_type = type dont le dictionnaire est à compléter.        * -*                                                                             * -*  Description : Définit les constantes pour les paramètres.                  * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static bool py_formats_define_constants(PyTypeObject *obj_type) -{ -    bool result;                            /* Bilan à retourner           */ - -    result = true; - -    result &= PyDict_AddIntMacro(obj_type, FMS_MATCHED); -    result &= PyDict_AddIntMacro(obj_type, FMS_FORWARDED); -    result &= PyDict_AddIntMacro(obj_type, FMS_UNKNOWN); - -    result &= PyDict_AddIntMacro(obj_type, FMS_COUNT); - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : module = module dont la définition est à compléter.          * -*                                                                             * -*  Description : Prend en charge l'objet 'pychrysalide.core.formats'.         * -*                                                                             * -*  Retour      : Bilan de l'opération.                                        * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -bool ensure_python_formats_is_registered(void) -{ -    PyTypeObject *type;                     /* Type Python pour 'formats'  */ -    PyObject *module;                       /* Module à recompléter        */ -    int ret;                                /* Bilan d'un appel            */ - -    type = get_python_formats_type(); - -    if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) -    { -        type->tp_new = PyType_GenericNew; - -        if (PyType_Ready(type) != 0) -            return false; - -        if (!py_formats_define_constants(type)) -            return false; - -        module = get_access_to_python_module("pychrysalide.core"); - -        Py_INCREF(type); -        ret = PyModule_AddObject(module, "formats", (PyObject *)type); - -        if (ret != 0) -            return false; - -    } - -    return true; - -} diff --git a/plugins/pychrysalide/core/formats.h b/plugins/pychrysalide/core/formats.h deleted file mode 100644 index 55d948a..0000000 --- a/plugins/pychrysalide/core/formats.h +++ /dev/null @@ -1,42 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * formats.h - prototypes pour l'équivalent Python du fichier "core/formats.h" - * - * Copyright (C) 2015-2017 Cyrille Bagard - * - *  This file is part of Chrysalide. - * - *  Chrysalide is free software; you can redistribute it and/or modify - *  it under the terms of the GNU General Public License as published by - *  the Free Software Foundation; either version 3 of the License, or - *  (at your option) any later version. - * - *  Chrysalide is distributed in the hope that it will be useful, - *  but WITHOUT ANY WARRANTY; without even the implied warranty of - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - *  GNU General Public License for more details. - * - *  You should have received a copy of the GNU General Public License - *  along with this program; if not, write to the Free Software - *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA - */ - - -#ifndef _PLUGINS_PYCHRYSALIDE_CORE_FORMATS_H -#define _PLUGINS_PYCHRYSALIDE_CORE_FORMATS_H - - -#include <Python.h> -#include <stdbool.h> - - - -/* Fournit un accès à une définition de type à diffuser. */ -PyTypeObject *get_python_formats_type(void); - -/* Prend en charge l'objet 'pychrysalide.core.formats'. */ -bool ensure_python_formats_is_registered(void); - - - -#endif  /* _PLUGINS_PYCHRYSALIDE_CORE_FORMATS_H */ diff --git a/plugins/pychrysalide/core/module.c b/plugins/pychrysalide/core/module.c index 6171e18..71fa508 100644 --- a/plugins/pychrysalide/core/module.c +++ b/plugins/pychrysalide/core/module.c @@ -29,7 +29,6 @@  #include "demanglers.h" -#include "formats.h"  #include "global.h"  #include "logs.h"  #include "params.h" @@ -93,7 +92,6 @@ bool populate_core_module(void)      result = true;      if (result) result = ensure_python_demanglers_is_registered(); -    if (result) result = ensure_python_formats_is_registered();      if (result) result = ensure_python_global_is_registered();      if (result) result = ensure_python_logs_is_registered();      if (result) result = ensure_python_params_is_registered(); diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c index b957eff..321fda9 100644 --- a/plugins/pychrysalide/plugin.c +++ b/plugins/pychrysalide/plugin.c @@ -32,8 +32,6 @@  #include <common/extstr.h> -#include "../../src/core/formats.h" -//#include <core/formats.h>  #include <plugins/plugin-int.h> @@ -88,9 +86,6 @@ static bool g_python_plugin_do_exit(GPythonPlugin *);  /* Procède à une opération liée à un contenu binaire. */  static void g_python_plugin_handle_binary_content(const GPythonPlugin *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *); -/* Indique si le format peut être pris en charge ici. */ -FormatMatchStatus python_plugin_is_matching(GBinContent *, GExeFormat *, GPythonPlugin *, char **); -  /* Exécute une action pendant un désassemblage de binaire. */  static void g_python_plugin_process_disass(const GPythonPlugin *, PluginAction, GLoadedBinary *, GtkStatusStack *, GProcContext *); @@ -387,22 +382,6 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)                          switch (action)                          { -                            case PGA_FORMAT_MATCHER: - -                                if (!has_python_method(instance, "is_format_matching")) -                                { -                                    log_variadic_message(LMT_ERROR, -                                                         _("No '%s' entry in plugin candidate '%s'"), -                                                         "is_format_matching", -                                                         G_PLUGIN_MODULE(result)->filename); -                                    goto gppn_bad_plugin; -                                } - -                                if (!register_format_matcher((format_match_fc)python_plugin_is_matching, result)) -                                    goto gppn_bad_plugin; - -                                break; -                              case PGA_FORMAT_LOADER_LAST:                                  /* TODO */                                  break; @@ -683,122 +662,6 @@ static void g_python_plugin_handle_binary_content(const GPythonPlugin *plugin, P  /******************************************************************************  *                                                                             * -*  Paramètres  : content = contenu binaire à parcourir.                       * -*                parent  = éventuel format exécutable déjà chargé.            * -*                plugin  = grefon C interne représentant le grefon Python.    * -*                key     = identifiant de format trouvé ou NULL. [OUT]        * -*                                                                             * -*  Description : Indique si le format peut être pris en charge ici.           * -*                                                                             * -*  Retour      : Conclusion de haut niveau sur la reconnaissance effectuée.   * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -FormatMatchStatus python_plugin_is_matching(GBinContent *content, GExeFormat *parent, GPythonPlugin *plugin, char **key) -{ -    FormatMatchStatus result;               /* Bilan à renvoyer            */ -    PyObject *args;                         /* Arguments pour l'appel      */ -    PyObject *value;                        /* Valeur obtenue              */ -    PyObject *arg;                          /* Argument en élément de tuple*/ - -    result = FMS_UNKNOWN; - -    args = PyTuple_New(2); -    PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(content))); -    PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(parent))); - -    value = run_python_method(plugin->instance, "is_format_matching", args); - -    if (PyTuple_Check(value)) -    { -        if (PyTuple_Size(value) > 0) -        { -            arg = PyTuple_GetItem(value, 0); - -            if (PyLong_Check(arg)) -            { -                result = PyLong_AsLong(arg); - -                switch (result) -                { -                    case FMS_MATCHED: - -                        if (PyTuple_Size(value) != 2) -                        { -                            g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR, -                                                                 _("Expecting only a tuple [ status, key ] " \ -                                                                   "as result for format matching.")); -                            result = FMS_UNKNOWN; -                            break; -                        } - -                        arg = PyTuple_GetItem(value, 1); - -                        if (PyUnicode_Check(arg)) -                            *key = strdup(PyUnicode_AsUTF8(arg)); - -                        else -                        { -                            g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR, -                                                                 _("Expecting a key string for format matching.")); -                            result = FMS_UNKNOWN; -                        } - -                        break; - -                    case FMS_FORWARDED: -                    case FMS_UNKNOWN: -                        if (PyTuple_Size(value) != 1) -                        { -                            g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_WARNING, -                                                 _("Unused second item for format matching.")); -                        } -                        break; - -                    default: -                        g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR, -                                                             _("Unexpected result for format matching.")); -                        result = FMS_UNKNOWN; -                        break; - -                } - -            } - -            else -            { -                g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR, -                                                     _("Unexpected result status for format matching.")); -                result = FMS_UNKNOWN; -            } - -        } -        else -            g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_WARNING, -                                                 _("Interpreting a empty tuple as FMS_UNKNOWN " \ -                                                   "for format matching.")); - -    } -    else -        g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR, -                                             _("Expected a tuple containing [ status, key ] as result " \ -                                               "for format matching.")); - -    Py_XDECREF(value); -    Py_DECREF(args); - -    return result; - - - - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : plugin  = greffon à manipuler.                               *  *                action  = type d'action attendue.                            *  *                binary  = binaire dont le contenu est en cours de traitement.* @@ -862,7 +725,6 @@ static bool py_plugin_module_define_constants(PyTypeObject *obj_type)      result &= PyDict_AddIntMacro(obj_type, PGA_PLUGIN_EXIT);      result &= PyDict_AddIntMacro(obj_type, PGA_CONTENT_EXPLORER);      result &= PyDict_AddIntMacro(obj_type, PGA_CONTENT_RESOLVER); -    result &= PyDict_AddIntMacro(obj_type, PGA_FORMAT_MATCHER);      result &= PyDict_AddIntMacro(obj_type, PGA_FORMAT_LOADER_LAST);      result &= PyDict_AddIntMacro(obj_type, PGA_DISASSEMBLY_STARTED);      result &= PyDict_AddIntMacro(obj_type, PGA_DISASSEMBLY_RAW); diff --git a/plugins/readdex/class.h b/plugins/readdex/class.h index a9f5079..4f5b7c3 100644 --- a/plugins/readdex/class.h +++ b/plugins/readdex/class.h @@ -26,6 +26,7 @@  #include <format/preload.h> +#include <gtkext/gtkstatusstack.h>  #include <plugins/dex/format.h> diff --git a/plugins/readdex/ids.h b/plugins/readdex/ids.h index 489d389..beb3828 100644 --- a/plugins/readdex/ids.h +++ b/plugins/readdex/ids.h @@ -26,6 +26,7 @@  #include <format/preload.h> +#include <gtkext/gtkstatusstack.h>  #include <plugins/dex/format.h> diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c index e8ee8c3..ea679bb 100644 --- a/plugins/ropgadgets/select.c +++ b/plugins/ropgadgets/select.c @@ -39,7 +39,6 @@  #include <core/global.h>  #include <common/cpp.h>  #include <common/extstr.h> -#include <core/formats.h>  #include <core/processors.h>  #include <gui/core/global.h>  #include <gtkext/easygtk.h> @@ -83,18 +82,9 @@ static void register_input_output_panel(GtkAssistant *, GObject *);  /* Construit la sélection d'un binaire déjà chargé. */  static GtkWidget *load_and_populate_current_project_binaries(GObject *); -/* Met à jour l'accès à la sélection du type d'entrée. */ -static void on_input_type_toggle(GtkToggleButton *, GObject *); -  /* Réagit à un changement de sélection du binaire d'entrée. */  static void on_loaded_binary_selection_change(GtkComboBox *, GObject *); -/* Réagit à un changement de fichier binaire d'entrée. */ -static void on_input_filename_change(GtkEditable *, GObject *); - -/* Sélectionne ou non un nouveau fichier d'entrée. */ -static void on_input_filename_browsing_clicked(GtkButton *, GObject *); -  /* Met à jour l'accès à la définition d'un fichier de sortie. */  static void on_output_need_toggle(GtkToggleButton *, GObject *); @@ -173,9 +163,6 @@ static void push_found_rop_gadgets(GObject *, GExeFormat *, found_rop_list *, si  /* Charge un format binaire interne déjà chargé. */  static GExeFormat *load_internal_format_for_rop_gadgets(GObject *); -/* Charge un format binaire externe. */ -static GExeFormat *load_external_format_for_rop_gadgets(GObject *); -  /* Procède à la recherche de gadgets de façon séparée. */  static gpointer look_for_rop_gadgets(GObject *); @@ -401,7 +388,6 @@ static void register_input_output_panel(GtkAssistant *assistant, GObject *ref)      GtkWidget *vbox;                        /* Support principal           */      GtkWidget *frame;                       /* Support avec encadrement    */      GtkWidget *sub_vbox;                    /* Division verticale          */ -    GtkWidget *radio;                       /* Choix du type d'entrée      */      GtkWidget *combobox;                    /* Sélection du binaire interne*/      GtkWidget *sub_hbox;                    /* Division horizontale        */      GtkWidget *entry;                       /* Zone de saisie de texte     */ @@ -419,34 +405,9 @@ static void register_input_output_panel(GtkAssistant *assistant, GObject *ref)      frame = qck_create_frame(_("<b>Input binary</b>"), sub_vbox, 0, 0, 12, 8);      gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0); -    radio = qck_create_radio_button(ref, "loaded_as_input", _("Use a binary from the current project:"), -                                    NULL, G_CALLBACK(on_input_type_toggle), ref); -    gtk_box_pack_start(GTK_BOX(sub_vbox), radio, FALSE, FALSE, 0); -      combobox = load_and_populate_current_project_binaries(ref);      gtk_box_pack_start(GTK_BOX(sub_vbox), combobox, TRUE, TRUE, 0); -    radio = qck_create_radio_button(ref, "extern_as_input", _("Open a new binary file:"), -                                    GTK_RADIO_BUTTON(radio), G_CALLBACK(on_input_type_toggle), ref); -    gtk_box_pack_start(GTK_BOX(sub_vbox), radio, FALSE, FALSE, 0); - -    sub_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); -    gtk_widget_show(sub_hbox); -    gtk_box_pack_start(GTK_BOX(sub_vbox), sub_hbox, FALSE, FALSE, 0); - -    entry = qck_create_entry(ref, "input_filename", NULL); -    g_signal_connect(entry, "changed", G_CALLBACK(on_input_filename_change), ref); -    gtk_box_pack_start(GTK_BOX(sub_hbox), entry, TRUE, TRUE, 0); - -    button = qck_create_button(ref, "input_browser", _("Browse..."), -                               G_CALLBACK(on_input_filename_browsing_clicked), assistant); -    gtk_box_pack_start(GTK_BOX(sub_hbox), button, FALSE, FALSE, 0); - -    /* Actualisation des accès */ - -    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE); -    on_input_type_toggle(GTK_TOGGLE_BUTTON(radio), ref); -      /* Fichier de sortie */      sub_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); @@ -586,61 +547,6 @@ static GtkWidget *load_and_populate_current_project_binaries(GObject *ref)  /******************************************************************************  *                                                                             * -*  Paramètres  : button = oche dont le status vient de changer.               * -*                ref    = espace de référencements inter-panneaux.            * -*                                                                             * -*  Description : Met à jour l'accès à la sélection du type d'entrée.          * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void on_input_type_toggle(GtkToggleButton *button, GObject *ref) -{ -    GtkToggleButton *internal;              /* Bouton de sélection interne */ -    gboolean state;                         /* Etat du bouton courant      */ -    GtkWidget *widget;                      /* Element dont l'accès change */ - -    internal = GTK_TOGGLE_BUTTON(g_object_get_data(ref, "loaded_as_input")); -    state = gtk_toggle_button_get_active(internal); - -    /* Elément de sélection interne */ - -    widget = GTK_WIDGET(g_object_get_data(ref, "input_binary")); - -    if (widget != NULL) -    { -        gtk_widget_set_sensitive(widget, state); - -        if (state) -            on_loaded_binary_selection_change(GTK_COMBO_BOX(widget), ref); - -    } - -    /* Elément de sélection externe */ - -    widget = GTK_WIDGET(g_object_get_data(ref, "input_filename")); - -    if (widget != NULL) -    { -        gtk_widget_set_sensitive(widget, !state); - -        if (!state) -            on_input_filename_change(GTK_EDITABLE(widget), ref); - -    } - -    widget = GTK_WIDGET(g_object_get_data(ref, "input_browser")); -    if (widget != NULL) -        gtk_widget_set_sensitive(widget, !state); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : combo = composant graphique de sélection concerné.           *  *                ref   = espace de référencement principal.                   *  *                                                                             * @@ -669,77 +575,6 @@ static void on_loaded_binary_selection_change(GtkComboBox *combo, GObject *ref)  /******************************************************************************  *                                                                             * -*  Paramètres  : editable = composant graphique d'édition concerné.           * -*                ref      = espace de référencement principal.                * -*                                                                             * -*  Description : Réagit à un changement de fichier binaire d'entrée.          * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void on_input_filename_change(GtkEditable *editable, GObject *ref) -{ -    guint16 length;                         /* Taille du texte fourni      */ -    GtkWidget *page;                        /* Page de la partie terminée  */ - -    length = gtk_entry_get_text_length(GTK_ENTRY(editable)); - -    page = gtk_assistant_get_nth_page(GTK_ASSISTANT(ref), 0); - -    if (page != NULL) -        gtk_assistant_set_page_complete(GTK_ASSISTANT(ref), page, length > 0); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : button = bouton d'édition de la sélection.                   * -*                ref    = espace de référencement principal.                  * -*                                                                             * -*  Description : Sélectionne ou non un nouveau fichier d'entrée.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void on_input_filename_browsing_clicked(GtkButton *button, GObject *ref) -{ -    GtkWidget *dialog;                      /* Boîte à afficher            */ -    gchar *filename;                        /* Nom du fichier à intégrer   */ -    GtkEntry *entry;                        /* Zone de saisie à maj.       */ - -    dialog = gtk_file_chooser_dialog_new(_("Choose an input filename"), GTK_WINDOW(ref), -                                         GTK_FILE_CHOOSER_ACTION_OPEN, -                                         _("_Cancel"), GTK_RESPONSE_CANCEL, -                                         _("_Open"), GTK_RESPONSE_ACCEPT, -                                         NULL); - -    entry = GTK_ENTRY(g_object_get_data(ref, "input_filename")); -    gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), gtk_entry_get_text(entry)); - -    if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) -    { -        filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - -        gtk_entry_set_text(GTK_ENTRY(entry), filename); - -        g_free(filename); - -    } - -    gtk_widget_destroy(dialog); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : button = coche dont le status vient de changer.              *  *                ref    = espace de référencements inter-panneaux.            *  *                                                                             * @@ -1310,79 +1145,6 @@ static GExeFormat *load_internal_format_for_rop_gadgets(GObject *ref)  *                                                                             *  *  Paramètres  : ref = espace de référencements inter-panneaux.               *  *                                                                             * -*  Description : Charge un format binaire externe.                            * -*                                                                             * -*  Retour      : Nouveau format au contenu à fouiller ou NULL en cas d'échec. * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static GExeFormat *load_external_format_for_rop_gadgets(GObject *ref) -{ -    GExeFormat *result;                     /* Format chargé à retourner   */ -    GtkEntry *entry;                        /* Zone de saisie de texte     */ -    const gchar *filename;                  /* Nom du fichier à charger    */ -    GBinContent *content;                   /* Contenu binaire chargé      */ -    FormatMatchStatus status;               /* Statut d'une reconnaissance */ -    char *target;                           /* Sous-traitance requise      */ -    const char *desc;                       /* Description humaine associée*/ - -    /* Récupération du nom de fichier */ - -    entry = GTK_ENTRY(g_object_get_data(ref, "input_filename")); - -    filename = gtk_entry_get_text(entry); - -    /* Récupération du contenu binaire */ - -    content = g_file_content_new(filename); -    if (content == NULL) -    { -        push_status_printing_of_rop_search_step(ref, "loading", _("unable to get the binary content"), false); -        goto leffrg_error; -    } - -    push_status_printing_of_rop_search_step(ref, "loading", _("done"), true); - -    /* Récupération du format de fichier associé */ - -    status = find_matching_format(content, NULL, &target); - -    if (status != FMS_MATCHED) -    { -        g_object_unref(G_OBJECT(content)); -        push_status_printing_of_rop_search_step(ref, "format", _("unknown binary format"), false); -        goto leffrg_error; -    } - -    desc = get_binary_format_name(target); - -    result = G_EXE_FORMAT(load_new_named_format(target, content, NULL)); - -    free(target); - -    if (result == NULL) -    { -        push_status_printing_of_rop_search_step(ref, "format", _("error while loading the binary"), false); -        goto leffrg_error; -    } - -    push_status_printing_of_rop_search_step(ref, "format", desc, true); - -    return result; - - leffrg_error: - -    return NULL; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : ref = espace de référencements inter-panneaux.               * -*                                                                             *  *  Description : Procède à la recherche de gadgets de façon séparée.          *  *                                                                             *  *  Retour      : ?                                                            * @@ -1393,8 +1155,6 @@ static GExeFormat *load_external_format_for_rop_gadgets(GObject *ref)  static gpointer look_for_rop_gadgets(GObject *ref)  { -    GtkToggleButton *internal;              /* Bouton de sélection interne */ -    gboolean state;                         /* Etat du bouton courant      */      GExeFormat *format;                     /* Format du binaire à traiter */      found_rop_list *list;                   /* Liste de gadgets ROP trouvés*/      size_t count;                           /* Nombre de ces listes        */ @@ -1402,14 +1162,7 @@ static gpointer look_for_rop_gadgets(GObject *ref)      size_t i;                               /* Boucle de parcours          */      char *msg;                              /* Message final à faire passer*/ -    internal = GTK_TOGGLE_BUTTON(g_object_get_data(ref, "loaded_as_input")); -    state = gtk_toggle_button_get_active(internal); - -    if (state) -        format = load_internal_format_for_rop_gadgets(ref); -    else -        format = load_external_format_for_rop_gadgets(ref); - +    format = load_internal_format_for_rop_gadgets(ref);      if (format == NULL) goto lfrg_unlock;      list = list_all_gadgets(format, 7, push_new_progress_fraction, ref, &count); | 
