diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-10-24 18:17:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-10-24 18:17:53 (GMT) |
commit | a27f101ec7351a006537e819f9af55271620bc50 (patch) | |
tree | a4ca058dc05e71732234febf58160bf61957786e /src/analysis/binary.c | |
parent | 810bce688d9b0e271d86886e182b62aa7166319f (diff) |
Link a class to loaded content nature.
Diffstat (limited to 'src/analysis/binary.c')
-rw-r--r-- | src/analysis/binary.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index ddd2e30..5d604be 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -156,8 +156,8 @@ static bool g_loaded_binary_save(GLoadedBinary *, xmlDoc *, xmlXPathContext *, c /* Fournit le contenu représenté de l'élément chargé. */ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *); -/* Fournit le contenu représenté de l'élément chargé. */ -static char *g_loaded_binary_get_format_name(const GLoadedBinary *); +/* Décrit la nature du contenu reconnu pour l'élément chargé. */ +static char *g_loaded_binary_get_content_class(const GLoadedBinary *, bool); /* Assure le désassemblage en différé. */ static bool g_loaded_binary_analyze(GLoadedBinary *, bool, bool, wgroup_id_t, GtkStatusStack *); @@ -225,7 +225,7 @@ static void g_loaded_binary_class_init(GLoadedBinaryClass *klass) loaded->save = (save_content_fc)g_loaded_binary_save; loaded->get_content = (get_content_fc)g_loaded_binary_get_content; - loaded->get_format_name = (get_format_name_fc)g_loaded_binary_get_format_name; + loaded->get_content_class = (get_content_class_fc)g_loaded_binary_get_content_class; loaded->analyze = (analyze_loaded_fc)g_loaded_binary_analyze; @@ -1310,9 +1310,10 @@ static bool g_loaded_binary_save(GLoadedBinary *binary, xmlDoc *xdoc, xmlXPathCo } + /* if (result) { - key = g_loaded_content_get_format_name(G_LOADED_CONTENT(binary)); + key = g_loaded_content_get_content_class(G_LOADED_CONTENT(binary)); result = add_string_attribute_to_node(xdoc, context, path, "format", key); free(key); } @@ -1323,6 +1324,7 @@ static bool g_loaded_binary_save(GLoadedBinary *binary, xmlDoc *xdoc, xmlXPathCo result = add_string_attribute_to_node(xdoc, context, path, "arch", key); free(key); } + */ if (result) result = g_loaded_binary_save_storage(binary, xdoc, context, path); @@ -1366,6 +1368,7 @@ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *binary) /****************************************************************************** * * * Paramètres : binary = élément chargé à manipuler. * +* human = description humaine attendue ? * * * * Description : Fournit le contenu représenté de l'élément chargé. * * * @@ -1375,11 +1378,37 @@ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *binary) * * ******************************************************************************/ -static char *g_loaded_binary_get_format_name(const GLoadedBinary *binary) +static char *g_loaded_binary_get_content_class(const GLoadedBinary *binary, bool human) { char *result; /* Désignation à retourner */ + char *part; /* Partie à intégrer */ + + if (human) + { + result = g_known_format_get_description(G_KNOWN_FORMAT(binary->format)); + + result = stradd(result, ", "); + + part = g_arch_processor_get_desc(binary->proc); + + result = stradd(result, part); + + free(part); + + } + else + { + result = g_known_format_get_key(G_KNOWN_FORMAT(binary->format)); + + result = stradd(result, "-"); - result = g_known_format_get_key(G_KNOWN_FORMAT(binary->format)); + part = g_arch_processor_get_key(binary->proc); + + result = stradd(result, part); + + free(part); + + } return result; |