diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2017-12-31 16:16:20 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2017-12-31 16:16:20 (GMT) | 
| commit | 8599cd772627ed8f7c923615fe991808d3f5c882 (patch) | |
| tree | 95f266197c63c51c4f6513e5575f935a63af6fa0 /plugins/ropgadgets/select.c | |
| parent | e0ab9498f78ee6b4fbbba25400d78436db682899 (diff) | |
Updated the ROP gadgets finder.
Diffstat (limited to 'plugins/ropgadgets/select.c')
| -rw-r--r-- | plugins/ropgadgets/select.c | 42 | 
1 files changed, 28 insertions, 14 deletions
| diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c index 2294a9c..021a2fa 100644 --- a/plugins/ropgadgets/select.c +++ b/plugins/ropgadgets/select.c @@ -35,8 +35,8 @@  #include <i18n.h> -#include <analysis/project.h>  #include <analysis/contents/file.h> +#include <core/global.h>  #include <common/cpp.h>  #include <common/extstr.h>  #include <core/formats.h> @@ -502,16 +502,20 @@ static void register_input_output_panel(GtkAssistant *assistant, GObject *ref)  static GtkWidget *load_and_populate_current_project_binaries(GObject *ref)  {      GtkWidget *result;                      /* Composant à retourner       */ +    GStudyProject *project;                 /* Projet courant              */      GLoadedBinary *current;                 /* Binaire actif courant       */      gint selected;                          /* Indice à sélectionner       */      GtkListStore *store;                    /* Modèle de gestion en liste  */ -    GLoadedBinary **binaries;               /* Liste de binaires           */ +    GLoadedContent **contents;              /* Liste de contenus chargés   */      size_t count;                           /* Taille de cette liste       */      size_t i;                               /* Boucle de parcours          */ +    GLoadedBinary *binary;                  /* Contenu de code binaire     */       GtkTreeIter iter;                       /* Point d'insertion           */      GtkCellRenderer *renderer;              /* Moteur de rendu de colonne  */ -    /* Récupération du binaire courant */ +    /* Récupération des éléments courants */ + +    project = get_current_project();      current = get_current_binary(); @@ -521,26 +525,32 @@ static GtkWidget *load_and_populate_current_project_binaries(GObject *ref)      store = gtk_list_store_new(CPB_COUNT, G_TYPE_OBJECT, G_TYPE_STRING); -    binaries = g_study_project_get_binaries(get_current_project(), &count); +    contents = g_study_project_get_contents(project, &count); -    if (binaries != NULL) +    if (contents != NULL)      {          for (i = 0; i < count; i++)          { -            gtk_list_store_append(store, &iter); -            gtk_list_store_set(store, &iter, -                               CPB_BINARY, binaries[i], -                               CPB_FILENAME, g_loaded_binary_get_name(binaries[i], true), -                               -1); +            if (G_IS_LOADED_BINARY(contents[i])) +            { +                binary = G_LOADED_BINARY(contents[i]); -            if (binaries[i] == current) -                selected = i; +                gtk_list_store_append(store, &iter); +                gtk_list_store_set(store, &iter, +                                   CPB_BINARY, binary, +                                   CPB_FILENAME, g_loaded_binary_get_name(binary, true), +                                   -1); -            g_object_unref(G_OBJECT(binaries[i])); +                if (binary == current) +                    selected = i; + +            } + +            g_object_unref(G_OBJECT(contents[i]));          } -        free(binaries); +        free(contents);      } @@ -563,8 +573,12 @@ static GtkWidget *load_and_populate_current_project_binaries(GObject *ref)      g_object_unref(G_OBJECT(store)); +    /* Sortie propre */ +      g_object_unref(G_OBJECT(current)); +    g_object_unref(G_OBJECT(project)); +      return result;  } | 
