diff options
Diffstat (limited to 'src/gui/panels/strings.c')
-rw-r--r-- | src/gui/panels/strings.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index 23383a1..5942d03 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -35,6 +35,7 @@ #include "../../common/extstr.h" #include "../../core/params.h" #include "../../format/format.h" +#include "../../format/symiter.h" #include "../../gtkext/easygtk.h" #include "../../gtkext/gtkdockable-int.h" @@ -468,9 +469,8 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin GExeFormat *format; /* Format de travail */ GBinPortion *portions; /* 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 */ - size_t i; /* Boucle de parcours */ + sym_iter_t *siter; /* Parcours des symboles */ + GBinSymbol *symbol; /* Symbole manipulé */ const mrange_t *range; /* Couverture mémoire */ const vmpa2t *addr; /* Adressse liée à la chaîne */ VMPA_BUFFER(phys); /* Position physique */ @@ -509,13 +509,16 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin portions = g_exe_format_get_portions(format); content = g_binary_format_get_content(G_BIN_FORMAT(format)); - symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count); + siter = create_symbol_iterator(G_BIN_FORMAT(format), 0); - for (i = 0; i < count; i++) + for (symbol = get_symbol_iterator_current(siter); + symbol != NULL; + symbol = get_symbol_iterator_next(siter)) { - if (g_binary_symbol_get_target_type(symbols[i]) != STP_RO_STRING) continue; + if (g_binary_symbol_get_target_type(symbol) != STP_RO_STRING) + goto cspcb_next; - range = g_binary_symbol_get_range(symbols[i]); + range = g_binary_symbol_get_range(symbol); addr = get_mrange_addr(range); vmpa2_phys_to_string(addr, msize, phys, NULL); @@ -525,7 +528,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin area = g_binary_portion_get_desc(portion); g_object_unref(G_OBJECT(portion)); - label = g_binary_symbol_get_label(symbols[i]); + label = g_binary_symbol_get_label(symbol); text = (char *)calloc(get_mrange_length(range) + 1, sizeof(char)); @@ -534,13 +537,13 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin if (!g_binary_content_read_raw(content, &pos, get_mrange_length(range), (uint8_t *)text)) { free(text); - continue; + goto cspcb_next; } if (is_string_filtered(panel, label, text)) { free(text); - continue; + goto cspcb_next; } text = strrpl(text, "&", "&"); @@ -551,7 +554,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin gtk_tree_store_append(store, &iter, NULL); gtk_tree_store_set(store, &iter, - STC_STRING, symbols[i], + STC_STRING, symbol, STC_PHYSICAL, phys, STC_VIRTUAL, virt, STC_AREA, area, @@ -561,8 +564,14 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin free(text); + cspcb_next: + + g_object_unref(G_OBJECT(symbol)); + } + delete_symbol_iterator(siter); + g_object_unref(G_OBJECT(content)); g_object_unref(G_OBJECT(portions)); g_object_unref(G_OBJECT(format)); |