diff options
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/goto.c | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/src/gui/dialogs/goto.c b/src/gui/dialogs/goto.c index 1fe2bbd..1cb365f 100644 --- a/src/gui/dialogs/goto.c +++ b/src/gui/dialogs/goto.c @@ -30,6 +30,8 @@ #include <i18n.h> +#include "../core/global.h" +#include "../../analysis/binary.h" #include "../../gtkext/easygtk.h" @@ -150,6 +152,12 @@ GtkWidget *create_goto_dialog(GtkWindow *parent) GtkWidget *entry; /* Zone de saisie principale */ GtkWidget *hbox; /* Support à construire #2 */ GtkWidget *radio; /* Définition de localisation */ + GLoadedBinary *binary; /* Binaire en cours d'édition */ + vmpa2t *old_gotos; /* Liste de destinations */ + size_t count; /* Taille de cette liste */ + size_t i; /* Boucle de parcours */ + bool is_virt; /* Détermination de l'utile */ + VMPA_BUFFER(loc); /* Version humaintement lisible*/ result = gtk_dialog_new(); gtk_window_set_title(GTK_WINDOW(result), _("Go to address")); @@ -181,11 +189,6 @@ GtkWidget *create_goto_dialog(GtkWindow *parent) g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(validate_addresses), GTK_DIALOG(result)); - - /* TODO */ - //gtk_combo_box_append_text(combobox, "test"); - - /* Propriétés de la localisation */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); @@ -207,9 +210,36 @@ GtkWidget *create_goto_dialog(GtkWindow *parent) gtk_dialog_add_button(GTK_DIALOG(result), _("_Ok"), GTK_RESPONSE_OK); gtk_entry_set_text(GTK_ENTRY(entry), "0x"); - gtk_widget_grab_focus (entry); + gtk_widget_grab_focus(entry); gtk_editable_set_position(GTK_EDITABLE(entry), -1); + /* Restaurationd d'anciennes destinations */ + + binary = G_LOADED_BINARY(get_current_content()); + old_gotos = g_loaded_binary_get_old_gotos(binary, &count); + g_object_unref(G_OBJECT(binary)); + + if (old_gotos != NULL) + { + for (i = 0; i < count; i++) + { + is_virt = has_virt_addr(&old_gotos[i]); + + if (is_virt) + vmpa2_virt_to_string(&old_gotos[i], MDS_UNDEFINED, loc, NULL); + else + vmpa2_phys_to_string(&old_gotos[i], MDS_UNDEFINED, loc, NULL); + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), loc); + + } + + free(old_gotos); + + gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0); + + } + return result; } |