summaryrefslogtreecommitdiff
path: root/src/format/dex/dex.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-11-14 16:30:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-11-14 16:30:10 (GMT)
commit4fd2ebd6ef0875b5d7d632db735d0510e19d4570 (patch)
tree58778508862e4dc3412b3391b56109871831e126 /src/format/dex/dex.c
parentae8cf6257c8d929de1b7ee86e29fcb45ab4af91c (diff)
Loaded source file from Dex classes.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@193 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/dex/dex.c')
-rwxr-xr-xsrc/format/dex/dex.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index b87981f..5280f4d 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -28,7 +28,7 @@
#include "dex-int.h"
-
+#include "../format-int.h"
@@ -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 *);
+/* Procède à la décompilation complète du format. */
+static void g_dex_format_decompile(const GDexFormat *, GCodeBuffer *, const char *);
+
/* Indique le type d'architecture visée par le format. */
static FormatTargetMachine g_dex_format_get_target_machine(const GDexFormat *);
@@ -126,7 +129,12 @@ static void g_dex_format_class_init(GDexFormatClass *klass)
static void g_dex_format_init(GDexFormat *format)
{
- GExeFormat *exe_format; /* Format parent à constituer */
+ GExeFormat *exe_format; /* Format parent à compléter #1*/
+ GBinFormat *bin_format; /* Format parent à compléter #2*/
+
+ bin_format = G_BIN_FORMAT(format);
+
+ bin_format->decompile = (format_decompile_fc)g_dex_format_decompile;
exe_format = G_EXE_FORMAT(format);
@@ -192,6 +200,54 @@ GBinFormat *g_dex_format_new(const bin_t *content, off_t length)
/******************************************************************************
* *
+* Paramètres : format = informations chargées à consulter. *
+* buffer = tampon mis à disposition pour la sortie. *
+* filename = nom du fichier source à cibler. *
+* *
+* Description : Procède à la décompilation complète du format. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dex_format_decompile(const GDexFormat *format, GCodeBuffer *buffer, const char *filename)
+{
+ size_t i; /* Boucle de parcours */
+ const char *source; /* Fichier source trouvé */
+
+ for (i = 0; i < format->classes_count; i++)
+ {
+ source = g_dex_class_get_source_file(format->classes[i], format);
+ if (source == NULL || strcmp(source, filename) != 0) continue;
+
+ printf("SRC :: '%s'\n", source);
+
+#if 0
+ GOpenidaType *get_type_from_dex_pool(const GDexFormat *format, uint16_t index)
+
+
+ Décrit le type fourni sous forme de caractères. *
+* *
+* Retour : Chaîne à libérer de la mémoire après usage. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *_g_openida_type_to_string(const GOpenidaType *type, bool simple)
+
+#endi
+
+ }
+
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : format = informations chargées à consulter. *
* *
* Description : Indique le type d'architecture visée par le format. *