summaryrefslogtreecommitdiff
path: root/src/analysis/binary.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-11-06 00:29:36 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-11-06 00:29:36 (GMT)
commit828124e38d266e382bb1477ef51c9fac8e81c591 (patch)
tree37d1d6af336987030791ba4c41b89a8cf144d270 /src/analysis/binary.c
parentc1ff0021b42fb5738a0cb31da15c12eb6dfac816 (diff)
Defined the entry point for decompilations.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@189 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/binary.c')
-rw-r--r--src/analysis/binary.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 63450a3..949bb31 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -142,6 +142,10 @@ 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 */
+
GBreakGroup **brk_groups; /* Groupes de points d'arrêt */
size_t brk_count; /* Taille de cette liste */
GBreakGroup *brk_default; /* Groupe par défaut */
@@ -1340,9 +1344,41 @@ GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *binary
}
+/******************************************************************************
+* *
+* Paramètres : binary = élément binaire à consulter. *
+* filename = nom de fichier à retrouver. *
+* *
+* Description : Fournit le tampon associé au contenu d'un fichier source. *
+* *
+* Retour : Tampon mis en place ou NULL si aucun (!). *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *binary, const char *filename)
+{
+ GCodeBuffer *result; /* Tampon à retourner */
+ size_t i; /* Boucle de parcours */
+ result = NULL;
+ 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;
+ }
+
+ }
+
+ return result;
+
+}
/******************************************************************************
@@ -1495,6 +1531,22 @@ void ack_completed_disassembly(GDelayedDisassembly *disass, GOpenidaBinary *bina
size_t i; /* Boucle de parcours */
+ /* 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");
+
+
+
+
+
+
+
+
g_rendering_line_merge(&binary->lines, &disass->lines);