diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 36 | ||||
-rw-r--r-- | src/analysis/binary.h | 2 |
2 files changed, 16 insertions, 22 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 0159b29..4093f6e 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -142,9 +142,9 @@ struct _GOpenidaBinary GRenderingLine *lines; /* Lignes de rendu en place */ GRenderingOptions *options; /* Options de désassemblage */ - char **src_files; /* Nom des fichiers source */ GCodeBuffer **dec_buffers; /* Sources sous forme de texte */ size_t decbuf_count; /* Taille des tableaux */ + size_t defsrc; /* Fichier source principal */ GBreakGroup **brk_groups; /* Groupes de points d'arrêt */ size_t brk_count; /* Taille de cette liste */ @@ -1362,8 +1362,8 @@ GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *binary /****************************************************************************** * * -* Paramètres : binary = élément binaire à consulter. * -* filename = nom de fichier à retrouver. * +* Paramètres : binary = élément binaire à consulter. * +* index = indice du fichier à retrouver. * * * * Description : Fournit le tampon associé au contenu d'un fichier source. * * * @@ -1373,24 +1373,15 @@ GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *binary * * ******************************************************************************/ -GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *binary, const char *filename) +GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *binary, size_t index) { GCodeBuffer *result; /* Tampon à retourner */ - size_t i; /* Boucle de parcours */ - result = NULL; + if (index >= binary->decbuf_count) + result = binary->dec_buffers[binary->defsrc]; - for (i = 0; i < binary->decbuf_count; i++) - { - /* Si aucune demande précise, on renvoie le premier ! */ - if (filename == NULL - || strcmp(binary->src_files[i], filename) == 0) - { - result = binary->dec_buffers[i]; - break; - } - - } + else + result = binary->dec_buffers[index]; return result; @@ -1546,17 +1537,20 @@ void ack_completed_disassembly(GDelayedDisassembly *disass, GOpenidaBinary *bina size_t pgcount; /* Taille de cette liste */ size_t i; /* Boucle de parcours */ + const char * const *files; /* Liste de fichiers source */ + /* Décompilation... */ - binary->decbuf_count++; - binary->src_files = (char **)calloc(binary->decbuf_count, sizeof(char *)); - binary->dec_buffers = (GCodeBuffer **)calloc(binary->decbuf_count, sizeof(GCodeBuffer *)); - binary->dec_buffers[0] = decompile_all_from_file(binary, "RC4.java"); + files = g_binary_format_get_source_files(G_BIN_FORMAT(binary->format), + &binary->decbuf_count, &binary->defsrc); + binary->dec_buffers = (GCodeBuffer **)calloc(binary->decbuf_count, sizeof(GCodeBuffer *)); + for (i = 0; i < binary->decbuf_count; i++) + binary->dec_buffers[i] = decompile_all_from_file(binary, files[i]); diff --git a/src/analysis/binary.h b/src/analysis/binary.h index 666cfaa..cac3b86 100644 --- a/src/analysis/binary.h +++ b/src/analysis/binary.h @@ -110,7 +110,7 @@ GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *); GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *); /* Fournit le tampon associé au contenu d'un fichier source. */ -GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *, const char *); +GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *, size_t); |