summaryrefslogtreecommitdiff
path: root/src/format/dex/dex.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-11-28 13:03:25 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-11-28 13:03:25 (GMT)
commitf2d479c16a427696790441fa1459e7194f49bb6a (patch)
treec9c5f7b6d75bec1ab22932f36ca7f4142b29d4b9 /src/format/dex/dex.c
parent6ceb627a1d7c0752124563c636cd9ef6241e8a3a (diff)
Loaded all buffers of decompiled files.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@195 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/dex/dex.c')
-rwxr-xr-xsrc/format/dex/dex.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index e30ed7a..25482af 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -45,6 +45,9 @@ static void g_dex_format_class_init(GDexFormatClass *);
/* Initialise une instance de format d'exécutable DEX. */
static void g_dex_format_init(GDexFormat *);
+/* Détermine tous les fichiers source indiqués. */
+static void g_dex_format_find_all_sources(GDexFormat *);
+
/* Procède à la décompilation complète du format. */
static void g_dex_format_decompile(const GDexFormat *, GCodeBuffer *, const char *);
@@ -191,6 +194,7 @@ GBinFormat *g_dex_format_new(const bin_t *content, off_t length)
register_all_dex_class_methods(result);
+ g_dex_format_find_all_sources(result);
return G_BIN_FORMAT(result);
@@ -200,6 +204,48 @@ GBinFormat *g_dex_format_new(const bin_t *content, off_t length)
/******************************************************************************
* *
+* Paramètres : format = informations chargées à mettre à jour. *
+* *
+* Description : Détermine tous les fichiers source indiqués. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dex_format_find_all_sources(GDexFormat *format)
+{
+ GBinFormat *bf; /* Instance parente */
+ size_t i; /* Boucle de parcours #1 */
+ const char *source; /* Fichier source trouvé */
+ bool found; /* Présence dans la liste */
+ size_t k; /* Boucle de parcours #2 */
+
+ bf = G_BIN_FORMAT(format);
+
+ for (i = 0; i < format->classes_count; i++)
+ {
+ source = g_dex_class_get_source_file(format->classes[i], format);
+ found = false;
+
+ for (k = 0; k < bf->src_count && !found; k++)
+ found = (strcmp(source, bf->src_files[k]) == 0);
+
+ if (!found)
+ {
+ bf->src_files = (const char **)realloc(bf->src_files,
+ ++bf->src_count * sizeof(const char **));
+ bf->src_files[bf->src_count - 1] = source;
+ }
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : format = informations chargées à consulter. *
* buffer = tampon mis à disposition pour la sortie. *
* filename = nom du fichier source à cibler. *