summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-10-28 15:59:12 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-10-28 15:59:12 (GMT)
commitc3aba0893c29cc098c029306fd7a4c8c1fa2eee2 (patch)
tree49432db1af3115758a216ac5bfd92d5935929858 /src/format
parent55866b34f5cff022a465d58f808450f25f354218 (diff)
Updated the code of the old panel and displayed found strings again.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@276 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format')
-rwxr-xr-xsrc/format/dex/dex.c8
-rw-r--r--src/format/dex/pool.c38
-rw-r--r--src/format/dex/pool.h3
-rw-r--r--src/format/symbol.c2
4 files changed, 50 insertions, 1 deletions
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index b286f7c..f0fb421 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -197,6 +197,14 @@ GBinFormat *g_dex_format_new(const bin_t *content, off_t length)
g_dex_format_find_all_sources(result);
+
+ if (!find_all_dex_strings(result))
+ {
+ g_object_unref(G_OBJECT(result));
+ return NULL;
+ }
+
+
return G_BIN_FORMAT(result);
}
diff --git a/src/format/dex/pool.c b/src/format/dex/pool.c
index 9237839..f8c5a4a 100644
--- a/src/format/dex/pool.c
+++ b/src/format/dex/pool.c
@@ -24,6 +24,9 @@
#include "pool.h"
+#include <string.h>
+
+
#include "dex-int.h"
#include "../mangling/demangler.h"
@@ -31,6 +34,41 @@
/******************************************************************************
* *
+* Paramètres : format = description de l'exécutable à analyser. *
+* *
+* Description : Charge en mémoire toutes les chaînes trouvées. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool find_all_dex_strings(GDexFormat *format)
+{
+ uint32_t i; /* Boucle de parcours */
+ const char *text; /* Texte issu du binaire */
+ GBinSymbol *symbol; /* Nouveau symbole construit */
+
+ for (i = 0; i < format->header.string_ids_size; i++)
+ {
+ text = get_string_from_dex_pool(format, i);
+ if (text == NULL) continue;
+
+ symbol = g_binary_symbol_new(STP_STRING, NULL, i);
+ g_binary_symbol_set_alt_name(symbol, strdup(text));
+
+ g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol);
+
+ }
+
+ return true;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : format = représentation interne du format DEX à consulter. *
* index = index du type recherchée. *
* *
diff --git a/src/format/dex/pool.h b/src/format/dex/pool.h
index 6894da1..62c3aef 100644
--- a/src/format/dex/pool.h
+++ b/src/format/dex/pool.h
@@ -30,6 +30,9 @@
+/* Charge en mémoire toutes les chaînes trouvées. */
+bool find_all_dex_strings(GDexFormat *);
+
/* Extrait une chaîne de caractères d'une table DEX. */
const char *get_string_from_dex_pool(const GDexFormat *, uint32_t);
diff --git a/src/format/symbol.c b/src/format/symbol.c
index 3ac2d6d..986586c 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -247,7 +247,7 @@ off_t g_binary_symbol_get_size(const GBinSymbol *symbol)
void g_binary_symbol_set_alt_name(GBinSymbol *symbol, char *alt)
{
- return symbol->alt = alt;
+ symbol->alt = alt;
}