summaryrefslogtreecommitdiff
path: root/src/format/dex/method.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-06-01 22:53:05 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-06-01 22:53:05 (GMT)
commite72eea33b9967d4169d2c8ffcb4a9e85c4c3ee8c (patch)
treed376a1bded84bcd82ff28d0a1c7fb0c062c9a663 /src/format/dex/method.c
parent6a2287739080535fd9f82ab2453abe916a9bc28d (diff)
Registered all found DEX routines.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@164 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/dex/method.c')
-rw-r--r--src/format/dex/method.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/format/dex/method.c b/src/format/dex/method.c
index 3a604d0..4888c89 100644
--- a/src/format/dex/method.c
+++ b/src/format/dex/method.c
@@ -111,6 +111,7 @@ static void g_dex_method_init(GDexMethod *method)
* *
* Paramètres : format = représentation interne du format DEX à consulter. *
* seed = graine des informations à extraire. *
+* last = dernier indice utilisé (à mettre à jour). [OUT] *
* *
* Description : Crée une nouvelle représentation de methode issue de code. *
* *
@@ -120,7 +121,7 @@ static void g_dex_method_init(GDexMethod *method)
* *
******************************************************************************/
-GDexMethod *g_dex_method_new(const GDexFormat *format, const encoded_method *seed)
+GDexMethod *g_dex_method_new(const GDexFormat *format, const encoded_method *seed, uleb128_t *last)
{
GDexMethod *result; /* Composant à retourner */
off_t offset; /* Tête de lecture */
@@ -142,19 +143,22 @@ GDexMethod *g_dex_method_new(const GDexFormat *format, const encoded_method *see
//printf(" code size :: %d\n", item.insns_size);
- routine = get_routine_from_dex_pool(format, seed->method_idx_diff);
+ *last += seed->method_idx_diff;
+ routine = get_routine_from_dex_pool(format, *last);
+ printf(" method idx :: %lld\n", *last);
result->offset = seed->code_off + 4 * sizeof(uint16_t) + 2 *sizeof(uint32_t);/* TODO : faire plus propre ! */
+ printf(" method off :: 0x%08x\n", result->offset);
- g_binary_routine_set_address(routine, result->offset);
+ g_binary_routine_set_address(routine, result->offset);
- g_binary_format_add_routine(G_BIN_FORMAT(format), routine);
+ result->routine = routine;
return result;
@@ -166,6 +170,25 @@ GDexMethod *g_dex_method_new(const GDexFormat *format, const encoded_method *see
* *
* Paramètres : method = représentation interne du format DEX à consulter. *
* *
+* Description : Fournit la routine OpenIDA correspondant à la méthode. *
+* *
+* Retour : Instance de routine mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GBinRoutine *g_dex_method_get_routine(const GDexMethod *method)
+{
+ return method->routine;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : method = représentation interne du format DEX à consulter. *
+* *
* Description : Fournit la zone binaire correspondant à la méthode. *
* *
* Retour : Zone binaire à analyser. *