diff options
Diffstat (limited to 'src/analysis/disass/disassembler.c')
-rw-r--r-- | src/analysis/disass/disassembler.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c index c39073c..de9830c 100644 --- a/src/analysis/disass/disassembler.c +++ b/src/analysis/disass/disassembler.c @@ -89,7 +89,7 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *, GtkExtStatusBar /* Construit la description d'introduction du désassemblage. */ -static void build_disass_prologue(GCodeBuffer *, const char *, const uint8_t *, off_t); +static void build_disass_prologue(GCodeBuffer *, const char *, const char *); @@ -443,14 +443,12 @@ static void g_delayed_disassembly_process_old(GDelayedDisassembly *disass, GtkEx * * ******************************************************************************/ -static void build_disass_prologue(GCodeBuffer *buffer, const char *filename, const uint8_t *data, off_t length) +static void build_disass_prologue(GCodeBuffer *buffer, const char *filename, const char *checksum) { GLangOutput *output; /* Modèle de sortie adéquat */ GBufferLine *line; /* Ligne de destination */ size_t len; /* Taille du texte */ char *content; /* Contenu textuel d'une ligne */ - GChecksum *checksum; /* Calcul de l'empreinte */ - const gchar *hex; /* Valeur hexadécimale du SHA */ output = g_asm_output_new(); @@ -464,7 +462,7 @@ static void build_disass_prologue(GCodeBuffer *buffer, const char *filename, con g_buffer_line_start_merge_at(line, BLC_PHYSICAL); line = g_lang_output_continue_comments(output, buffer, - SL(_("Chrysalide is free software - © 2008-2014 Cyrille Bagard"))); + SL(_("Chrysalide is free software - © 2008-2015 Cyrille Bagard"))); g_buffer_line_start_merge_at(line, BLC_PHYSICAL); line = g_lang_output_continue_comments(output, buffer, NULL, 0); @@ -484,17 +482,10 @@ static void build_disass_prologue(GCodeBuffer *buffer, const char *filename, con /* Checksum SHA256 */ - checksum = g_checksum_new(G_CHECKSUM_SHA256); - - g_checksum_update(checksum, data, length); - hex = g_checksum_get_string(checksum); - - len = strlen(_("Sha256: ")) + strlen(hex); + len = strlen(_("Sha256: ")) + strlen(checksum); content = (char *)calloc(len + 1, sizeof(char)); - snprintf(content, len + 1, "%s%s", _("Sha256: "), hex); - - g_checksum_free(checksum); + snprintf(content, len + 1, "%s%s", _("Sha256: "), checksum); line = g_lang_output_continue_comments(output, buffer, content, len - 1); g_buffer_line_start_merge_at(line, BLC_PHYSICAL); @@ -535,15 +526,19 @@ static void build_disass_prologue(GCodeBuffer *buffer, const char *filename, con void disassemble_binary(GLoadedBinary *binary, GArchInstruction **instrs, GCodeBuffer **buffer, disassembly_ack_fc ack) { - const uint8_t *data; /* Données binaires brutes */ - off_t length; /* Quantité de ces données */ + GBinFormat *format; /* Format associé au binaire */ + GBinContent *content; /* Contenu bianire manipulé */ + const gchar *checksum; /* Identifiant de binaire */ GDelayedDisassembly *disass; /* Désassemblage à mener */ GWorkQueue *queue; /* Gestionnaire de différés */ *buffer = g_code_buffer_new(BLC_ASSEMBLY); - data = g_loaded_binary_get_data(binary, &length); - build_disass_prologue(*buffer, g_loaded_binary_get_name(binary, true), data, length); + format = G_BIN_FORMAT(g_loaded_binary_get_format(binary)); + content = g_binary_format_get_conten_(format); + checksum = g_binary_content_get_cheksum(content); + + build_disass_prologue(*buffer, g_loaded_binary_get_name(binary, true), checksum); disass = g_delayed_disassembly_new(binary, instrs, *buffer); g_signal_connect(disass, "work-completed", G_CALLBACK(ack), binary); |