diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-02-10 15:24:59 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-02-10 15:25:45 (GMT) |
commit | abc912f8500312c888832ff521d3dd17d8b2c613 (patch) | |
tree | f648295964509021f545a72ad5d173897ee45018 /src/gui | |
parent | dbd5e7fdfd43fba609fce3fafdcd38d704554d99 (diff) |
Displayed the name of the area containing a string, if any.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/panels/strings.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index a6ff7ca..abbf7ed 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -70,6 +70,7 @@ typedef enum _StringsColumn STC_PHYSICAL, /* Adresse phyisque */ STC_VIRTUAL, /* Adresse virtuelle */ + STC_AREA, /* Zone de localisation */ STC_NAME, /* Désignation humaine */ STC_VALUE, /* Chaîne de caractères */ @@ -229,7 +230,7 @@ static void g_strings_panel_init(GStringsPanel *panel) /* Partie chaînes */ store = gtk_tree_store_new(STC_COUNT, G_TYPE_OBJECT, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); panel->treeview = GTK_TREE_VIEW(treeview); @@ -263,6 +264,14 @@ static void g_strings_panel_init(GStringsPanel *panel) gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); renderer = gtk_cell_renderer_text_new(); + g_object_set(renderer, "xpad", 16, NULL); + column = gtk_tree_view_column_new_with_attributes(_("Area"), renderer, + "text", STC_AREA, + NULL); + gtk_tree_view_column_set_sort_column_id(column, STC_AREA); + gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + + renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(renderer, "edited", G_CALLBACK(on_string_value_edited), store); column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer, @@ -288,6 +297,9 @@ static void g_strings_panel_init(GStringsPanel *panel) gtk_tree_sortable_set_sort_func(sortable, STC_VIRTUAL, compare_strings_list_columns, GINT_TO_POINTER(STC_VIRTUAL), NULL); + gtk_tree_sortable_set_sort_func(sortable, STC_AREA, compare_strings_list_columns, + GINT_TO_POINTER(STC_AREA), NULL); + gtk_tree_sortable_set_sort_func(sortable, STC_NAME, compare_strings_list_columns, GINT_TO_POINTER(STC_NAME), NULL); @@ -460,6 +472,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin GArchProcessor *proc; /* Architecture du binaire */ MemoryDataSize msize; /* Taille par défaut */ GExeFormat *format; /* Format de travail */ + GPortionLayer *layer; /* Couche première de portions */ GBinContent *content; /* Contenu binaire en mémoire */ size_t count; /* Nombre des chaînes */ GBinSymbol **symbols; /* Liste des chaînes trouvées */ @@ -468,6 +481,8 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin const vmpa2t *addr; /* Adressse liée à la chaîne */ VMPA_BUFFER(phys); /* Position physique */ VMPA_BUFFER(virt); /* Adresse virtuelle */ + GBinPortion *portion; /* Zone mémoire d'appartenance */ + const char *area; /* Description de la zone */ const char *label; /* Etiquette liée au symbole */ vmpa2t pos; /* Tête de lecture modifiable */ char *text; /* Version imprimable du texte */ @@ -497,6 +512,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin g_object_unref(G_OBJECT(proc)); format = g_loaded_binary_get_format(binary); + layer = g_exe_format_get_main_layer(format); content = g_binary_format_get_content(G_BIN_FORMAT(format)); symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count); @@ -511,6 +527,9 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin vmpa2_phys_to_string(addr, msize, phys, NULL); vmpa2_virt_to_string(addr, msize, virt, NULL); + portion = g_portion_layer_find_portion_at_addr(layer, addr, (GdkRectangle []) { }); + area = g_binary_portion_get_desc(portion); + label = g_binary_symbol_get_label(symbols[i]); text = (char *)calloc(get_mrange_length(range) + 1, sizeof(char)); @@ -540,6 +559,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin STC_STRING, symbols[i], STC_PHYSICAL, phys, STC_VIRTUAL, virt, + STC_AREA, area, STC_NAME, label, STC_VALUE, text, -1); @@ -548,6 +568,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin } + g_object_unref(G_OBJECT(layer)); g_object_unref(G_OBJECT(content)); } |