summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-06-15 22:44:16 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-06-15 22:44:16 (GMT)
commit0d7908e0c8282050ebbcc8a7c18fafd13152a36e (patch)
treef5d5ef551b4e87d400e13fa0ea309ebbba8ec9b3
parent1e2aada1204d3da43fe075478df5bfaaece937b0 (diff)
Looked at access flags for computing native methods size.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@168 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog6
-rwxr-xr-xsrc/format/dex/dex_def.h27
-rw-r--r--src/format/dex/method.c9
3 files changed, 40 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3130bbe..f084993 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+10-06-16 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/format/dex/dex_def.h:
+ * src/format/dex/method.c:
+ Look at access flags for computing native methods size.
+
10-06-15 Cyrille Bagard <nocbos@gmail.com>
* src/analysis/binary.c:
diff --git a/src/format/dex/dex_def.h b/src/format/dex/dex_def.h
index 3f6950d..ba88d69 100755
--- a/src/format/dex/dex_def.h
+++ b/src/format/dex/dex_def.h
@@ -29,6 +29,33 @@
+/* -------------------------- CONSTANTES POUR DEX DIVERSES -------------------------- */
+
+
+/* Définition des drapeaux d'accès */
+
+#define ACC_PUBLIC 0x00001 /* Elément publique */
+#define ACC_PRIVATE 0x00002 /* Elément privé */
+#define ACC_PROTECTED 0x00004 /* Elément protégé */
+#define ACC_STATIC 0x00008 /* Elément statique */
+#define ACC_FINAL 0x00010 /* Non dérivable / modifiable */
+#define ACC_SYNCHRONIZED 0x00020 /* Pose de verrou automatique */
+#define ACC_VOLATILE 0x00040 /* Accès spécial threads */
+#define ACC_BRIDGE 0x00040 /* Méthode pont */
+#define ACC_TRANSIENT 0x00080 /* Pas de sérialisation */
+#define ACC_VARARGS 0x00080 /* Arguments variables */
+#define ACC_NATIVE 0x00100 /* Implémentation en code natif*/
+#define ACC_INTERFACE 0x00200 /* Interface */
+#define ACC_ABSTRACT 0x00400 /* Non instanciable directement*/
+#define ACC_STRICT 0x00800 /* Règle pour les flottants */
+#define ACC_SYNTHETIC 0x01000 /* Non défini dans le code */
+#define ACC_ANNOTATION 0x02000 /* Annotation */
+#define ACC_ENUM 0x04000 /* Enumération */
+#define ACC_CONSTRUCTOR 0x10000 /* Constructeur */
+#define ACC_DECLARED_SYNCHRONIZED 0x20000 /* Pose de verrou automatique */
+
+
+
/* ------------------------ ELEMENTS DE TABLE DES CONSTANTES ------------------------ */
diff --git a/src/format/dex/method.c b/src/format/dex/method.c
index ce4d8dd..9bac013 100644
--- a/src/format/dex/method.c
+++ b/src/format/dex/method.c
@@ -38,6 +38,7 @@ struct _GDexMethod
GBinRoutine *routine; /* Représentation interne */
+ encoded_method info; /* Propriétés de la méthode */
code_item body; /* Corps de la méthode */
off_t offset; /* Position du code */
@@ -143,6 +144,7 @@ GDexMethod *g_dex_method_new(const GDexFormat *format, const encoded_method *see
result = g_object_new(G_TYPE_DEX_METHOD, NULL);
+ result->info = *seed;
result->body = item;
//printf(" method idx :: %d\n", seed->method_idx_diff);
@@ -203,13 +205,16 @@ GBinRoutine *g_dex_method_get_routine(const GDexMethod *method)
GBinPart *g_dex_method_as_part(const GDexMethod *method)
{
GBinPart *result; /* Instance à retourner */
+ off_t size; /* Taille du code associé */
result = g_binary_part_new();
g_binary_part_set_name(result, "name");
- g_binary_part_set_values(result,
- method->offset, method->body.insns_size * sizeof(uint16_t), method->offset);
+ if (method->info.access_flags & ACC_NATIVE) size = 0;
+ else size = method->body.insns_size * sizeof(uint16_t);
+
+ g_binary_part_set_values(result, method->offset, size, method->offset);
return result;