summaryrefslogtreecommitdiff
path: root/plugins/dex/python
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-05-07 21:53:40 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-05-07 21:53:40 (GMT)
commitdd2b41538e20de5472cd8c888c530327a1351866 (patch)
tree7f9a24a32ecd33aacb98a5d1ec4234011c1364a6 /plugins/dex/python
parentb92a5e56de9198c08956ce486cd12712d7034731 (diff)
Read raw Dex items by extending the API.
Diffstat (limited to 'plugins/dex/python')
-rw-r--r--plugins/dex/python/format.c75
-rw-r--r--plugins/dex/python/method.c45
-rw-r--r--plugins/dex/python/pool.c330
-rw-r--r--plugins/dex/python/translate.c246
-rw-r--r--plugins/dex/python/translate.h15
5 files changed, 711 insertions, 0 deletions
diff --git a/plugins/dex/python/format.c b/plugins/dex/python/format.c
index 77ebef6..9bbbfbd 100644
--- a/plugins/dex/python/format.c
+++ b/plugins/dex/python/format.c
@@ -37,7 +37,9 @@
#include "constants.h"
+#include "translate.h"
#include "../class.h"
+#include "../dex-int.h"
#include "../format.h"
@@ -98,6 +100,78 @@ static PyObject *py_dex_format_new(PyTypeObject *type, PyObject *args, PyObject
/******************************************************************************
* *
+* Paramètres : self = objet représentant un format de fichier Dex. *
+* args = arguments fournis pour l'opération. *
+* *
+* Description : Procède à la lecture d'une liste de types DEX. *
+* *
+* Retour : Instance mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_dex_format_read_type_list(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ unsigned int offset; /* Position de l'élément visé */
+ int ret; /* Bilan de lecture des args. */
+ GDexFormat *format; /* Format de fichier Dex */
+ vmpa2t addr; /* Tête de lecture générique */
+ type_list list; /* Elément à transmettre */
+ bool status; /* Bilan de l'opération */
+ uint32_t i; /* Boucle de parcours */
+
+#define DEX_POOL_READ_TYPE_LIST_METHOD PYTHON_METHOD_DEF \
+( \
+ "read_type_list", "$self, offset, /", \
+ METH_VARARGS, py_dex_format_read_type_list, \
+ "Provide the raw data of a given type list as an array of pychrysalide.PyStructObject" \
+ " instances." \
+ "\n" \
+ "All the items are fields extracted from the Dex *type_list* structure:\n" \
+ "* type_idx: index into the *type_ids* list.\n" \
+ "\n" \
+ "In case of error, the function returns None." \
+)
+
+ ret = PyArg_ParseTuple(args, "I", &offset);
+ if (!ret) return NULL;
+
+ format = G_DEX_FORMAT(pygobject_get(self));
+
+ init_vmpa(&addr, offset, VMPA_NO_VIRTUAL);
+
+ status = read_dex_type_list(format, &addr, &list);
+
+ if (status)
+ {
+ result = PyTuple_New(list.size);
+
+ for (i = 0; i < list.size; i++)
+ {
+#ifndef NDEBUG
+ ret = PyTuple_SetItem(result, i, translate_dex_type_item_to_python(&list.list[i]));
+ assert(ret == 0);
+#else
+ PyTuple_SetItem(result, i, translate_dex_type_item_to_python(&list.list[i]));
+#endif
+ }
+
+ }
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
@@ -149,6 +223,7 @@ static PyObject *py_dex_format_get_pool(PyObject *self, void *closure)
PyTypeObject *get_python_dex_format_type(void)
{
static PyMethodDef py_dex_format_methods[] = {
+ DEX_POOL_READ_TYPE_LIST_METHOD,
{ NULL }
};
diff --git a/plugins/dex/python/method.c b/plugins/dex/python/method.c
index 5a06403..1bffbff 100644
--- a/plugins/dex/python/method.c
+++ b/plugins/dex/python/method.c
@@ -36,6 +36,9 @@
+/* Fournit les identifiants Dex concernant la méthode. */
+static PyObject *py_dex_method_get_id_item(PyObject *, void *);
+
/* Fournit les indications Dex concernant la méthode. */
static PyObject *py_dex_method_get_encoded(PyObject *, void *);
@@ -52,6 +55,47 @@ static PyObject *py_dex_method_get_routine(PyObject *, void *);
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
+* Description : Fournit les identifiants Dex concernant la méthode. *
+* *
+* Retour : Données brutes issues du binaire chargé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_dex_method_get_id_item(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GDexMethod *method; /* Version native */
+ const method_id_item *id_item; /* Elément à traiter */
+
+#define DEX_METHOD_ID_ITEM_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ id_item, py_dex_method, \
+ "pychrysalide.PyStructObject instance of identifiers used by the method.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *method_id_item* structure:\n" \
+ "* class_idx: index into the *type_ids* list for the definer of the method ;\n" \
+ "* proto_idx: index into the *proto_ids* list for the prototype of the method ;\n" \
+ "* name_idx: index into the *string_ids* list for the name of the method." \
+)
+
+ method = G_DEX_METHOD(pygobject_get(self));
+
+ id_item = g_dex_method_get_dex_id_item(method);
+
+ result = translate_dex_method_id_to_python(id_item);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
* Description : Fournit les indications Dex concernant la méthode. *
* *
* Retour : Données brutes issues du binaire chargé. *
@@ -165,6 +209,7 @@ PyTypeObject *get_python_dex_method_type(void)
};
static PyGetSetDef py_dex_method_getseters[] = {
+ DEX_METHOD_ID_ITEM_ATTRIB,
{
"encoded", py_dex_method_get_encoded, NULL,
"Encoded information about the Dex method.", NULL
diff --git a/plugins/dex/python/pool.c b/plugins/dex/python/pool.c
index eae1e86..695e07f 100644
--- a/plugins/dex/python/pool.c
+++ b/plugins/dex/python/pool.c
@@ -36,6 +36,21 @@
+/* Reconstitue les éléments bruts d'un type Dex. */
+static PyObject *py_dex_pool_get_raw_type(PyObject *, PyObject *);
+
+/* Reconstitue les éléments bruts d'un champ Dex. */
+static PyObject *py_dex_pool_get_raw_field(PyObject *, PyObject *);
+
+/* Reconstitue les éléments bruts d'une routine Dex. */
+static PyObject *py_dex_pool_get_raw_prototype(PyObject *, PyObject *);
+
+/* Reconstitue les éléments bruts d'une méthode Dex. */
+static PyObject *py_dex_pool_get_raw_method(PyObject *, PyObject *);
+
+/* Reconstitue les éléments bruts d'une classe Dex. */
+static PyObject *py_dex_pool_get_raw_class(PyObject *, PyObject *);
+
/* Fournit la liste de toutes les chaînes de la table globale. */
static PyObject *py_dex_pool_get_strings(PyObject *, void *);
@@ -65,6 +80,316 @@ static PyObject *py_dex_pool_get_classes(PyObject *, void *);
/******************************************************************************
* *
+* Paramètres : self = objet représentant une table de ressources Dex. *
+* args = arguments fournis pour l'opération. *
+* *
+* Description : Reconstitue les éléments bruts d'un type Dex. *
+* *
+* Retour : Instance mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_dex_pool_get_raw_type(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ unsigned int index; /* Indice de l'élément visé */
+ int ret; /* Bilan de lecture des args. */
+ GDexPool *pool; /* Table de ressources Dex */
+ type_id_item type_id; /* Elément à transmettre */
+ bool status; /* Bilan de l'opération */
+
+#define DEX_POOL_GET_RAW_TYPE_METHOD PYTHON_METHOD_DEF \
+( \
+ "get_raw_type", "$self, index, /", \
+ METH_VARARGS, py_dex_pool_get_raw_type, \
+ "Provide the raw data of a given type in the Dex pool as a pychrysalide.PyStructObject" \
+ " instance." \
+ "\n" \
+ "Indexes start at 0.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *type_id_item* structure:\n" \
+ "* descriptor_idx: index into the string_ids list for the descriptor string.\n" \
+ "\n" \
+ "In case of error, the function returns None." \
+)
+
+ ret = PyArg_ParseTuple(args, "I", &index);
+ if (!ret) return NULL;
+
+ pool = G_DEX_POOL(pygobject_get(self));
+
+ status = g_dex_pool_get_raw_type(pool, index, &type_id);
+
+ if (status)
+ result = translate_dex_type_id_to_python(&type_id);
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet représentant une table de ressources Dex. *
+* args = arguments fournis pour l'opération. *
+* *
+* Description : Reconstitue les éléments bruts d'un champ Dex. *
+* *
+* Retour : Instance mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_dex_pool_get_raw_field(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ unsigned int index; /* Indice de l'élément visé */
+ int ret; /* Bilan de lecture des args. */
+ GDexPool *pool; /* Table de ressources Dex */
+ field_id_item field_id; /* Elément à transmettre */
+ bool status; /* Bilan de l'opération */
+
+#define DEX_POOL_GET_RAW_FIELD_METHOD PYTHON_METHOD_DEF \
+( \
+ "get_raw_field", "$self, index, /", \
+ METH_VARARGS, py_dex_pool_get_raw_field, \
+ "Provide the raw data of a given field in the Dex pool as a pychrysalide.PyStructObject" \
+ " instance." \
+ "\n" \
+ "Indexes start at 0.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *field_id_item* structure:\n" \
+ "* class_idx: index into the type_ids list for the definer of the field ;\n" \
+ "* type_idx: index into the type_ids list for the type of the field ;\n" \
+ "* name_idx: index into the string_ids list for the name of the field.\n" \
+ "\n" \
+ "In case of error, the function returns None." \
+)
+
+ ret = PyArg_ParseTuple(args, "I", &index);
+ if (!ret) return NULL;
+
+ pool = G_DEX_POOL(pygobject_get(self));
+
+ status = g_dex_pool_get_raw_field(pool, index, &field_id);
+
+ if (status)
+ result = translate_dex_field_id_to_python(&field_id);
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet représentant une table de ressources Dex. *
+* args = arguments fournis pour l'opération. *
+* *
+* Description : Reconstitue les éléments bruts d'une routine Dex. *
+* *
+* Retour : Instance mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_dex_pool_get_raw_prototype(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ unsigned int index; /* Indice de l'élément visé */
+ int ret; /* Bilan de lecture des args. */
+ GDexPool *pool; /* Table de ressources Dex */
+ proto_id_item proto_id; /* Elément à transmettre */
+ bool status; /* Bilan de l'opération */
+
+#define DEX_POOL_GET_RAW_PROTOTYPE_METHOD PYTHON_METHOD_DEF \
+( \
+ "get_raw_prototype", "$self, index, /", \
+ METH_VARARGS, py_dex_pool_get_raw_prototype, \
+ "Provide the raw data of a given prototype in the Dex pool as a pychrysalide.PyStructObject" \
+ " instance." \
+ "\n" \
+ "Indexes start at 0.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *proto_id_item* structure:\n" \
+ "* shorty_idx: index into the *string_ids* list for the short-form descriptor string ;\n" \
+ "* return_type_idx: index into the *type_ids* list for the return type ;\n" \
+ "* parameters_off: offset from the start of the Dex file to the list of parameter types." \
+ "\n" \
+ "In case of error, the function returns None." \
+)
+
+ ret = PyArg_ParseTuple(args, "I", &index);
+ if (!ret) return NULL;
+
+ pool = G_DEX_POOL(pygobject_get(self));
+
+ status = g_dex_pool_get_raw_prototype(pool, index, &proto_id);
+
+ if (status)
+ result = translate_dex_proto_id_to_python(&proto_id);
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet représentant une table de ressources Dex. *
+* args = arguments fournis pour l'opération. *
+* *
+* Description : Reconstitue les éléments bruts d'une méthode Dex. *
+* *
+* Retour : Instance mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_dex_pool_get_raw_method(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ unsigned int index; /* Indice de l'élément visé */
+ int ret; /* Bilan de lecture des args. */
+ GDexPool *pool; /* Table de ressources Dex */
+ method_id_item method_id; /* Elément à transmettre */
+ bool status; /* Bilan de l'opération */
+
+#define DEX_POOL_GET_RAW_METHOD_METHOD PYTHON_METHOD_DEF \
+( \
+ "get_raw_method", "$self, index, /", \
+ METH_VARARGS, py_dex_pool_get_raw_method, \
+ "Provide the raw data of a given method in the Dex pool as a pychrysalide.PyStructObject" \
+ " instance." \
+ "\n" \
+ "Indexes start at 0.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *method_id_item* structure:\n" \
+ "* class_idx: index into the type_ids list for the definer of the method ;\n" \
+ "* proto_idx: index into the proto_ids list for the prototype of the method ;\n" \
+ "* name_idx: index into the string_ids list for the name of the method.\n" \
+ "\n" \
+ "In case of error, the function returns None." \
+)
+
+ ret = PyArg_ParseTuple(args, "I", &index);
+ if (!ret) return NULL;
+
+ pool = G_DEX_POOL(pygobject_get(self));
+
+ status = g_dex_pool_get_raw_method(pool, index, &method_id);
+
+ if (status)
+ result = translate_dex_method_id_to_python(&method_id);
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet représentant une table de ressources Dex. *
+* args = arguments fournis pour l'opération. *
+* *
+* Description : Reconstitue les éléments bruts d'une classe Dex. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_dex_pool_get_raw_class(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ unsigned int index; /* Indice de l'élément visé */
+ int ret; /* Bilan de lecture des args. */
+ GDexPool *pool; /* Table de ressources Dex */
+ class_def_item class_def; /* Elément à transmettre */
+ bool status; /* Bilan de l'opération */
+
+#define DEX_POOL_GET_RAW_CLASS_METHOD PYTHON_METHOD_DEF \
+( \
+ "get_raw_class", "$self, index, /", \
+ METH_VARARGS, py_dex_pool_get_raw_class, \
+ "Provide the raw data of a given class in the Dex pool as a pychrysalide.PyStructObject" \
+ " instance." \
+ "\n" \
+ "Indexes start at 0.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *class_def_item* structure:\n" \
+ "* class_idx: index into the type_ids list for this class ;\n" \
+ "* access_flags: access flags for the class (public, final, etc.) ;\n" \
+ "* superclass_idx: index into the type_ids list for the superclass, or the constant value" \
+ " NO_INDEX if the class has no superclass ;\n" \
+ "* interfaces_off: offset from the start of the file to the list of interfaces, or 0" \
+ " if there are none ;\n" \
+ "* source_file_idx: index into the string_ids list for the name of the file containing" \
+ " the original source for (at least most of) this class, or the special value NO_INDEX to" \
+ " represent a lack of this information ;\n" \
+ "* annotations_off: offset from the start of the file to the annotations structure, or 0" \
+ " if there are no annotation ;\n" \
+ "* class_data_off: offset from the start of the file to the associated class data, or 0" \
+ " if there is no class data ;\n" \
+ "* static_values_off: offset from the start of the file to the list of initial values" \
+ " for static fields, or 0 if there are none.\n" \
+ "\n" \
+ "In case of error, the function returns None." \
+)
+
+ ret = PyArg_ParseTuple(args, "I", &index);
+ if (!ret) return NULL;
+
+ pool = G_DEX_POOL(pygobject_get(self));
+
+ status = g_dex_pool_get_raw_class(pool, index, &class_def);
+
+ if (status)
+ result = translate_dex_class_definition_to_python(&class_def);
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
@@ -437,6 +762,11 @@ static PyObject *py_dex_pool_get_classes(PyObject *self, void *closure)
PyTypeObject *get_python_dex_pool_type(void)
{
static PyMethodDef py_dex_pool_methods[] = {
+ DEX_POOL_GET_RAW_TYPE_METHOD,
+ DEX_POOL_GET_RAW_FIELD_METHOD,
+ DEX_POOL_GET_RAW_PROTOTYPE_METHOD,
+ DEX_POOL_GET_RAW_METHOD_METHOD,
+ DEX_POOL_GET_RAW_CLASS_METHOD,
{ NULL }
};
diff --git a/plugins/dex/python/translate.c b/plugins/dex/python/translate.c
index eb80c43..3d73616 100644
--- a/plugins/dex/python/translate.c
+++ b/plugins/dex/python/translate.c
@@ -39,6 +39,152 @@
* *
* Paramètres : info = ensemble d'informations Dex à décrire en Python. *
* *
+* Description : Traduit des informations de type Dex en Python. *
+* *
+* Retour : Structure mise en place ou NULL en cas d'erreur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyObject *translate_dex_type_id_to_python(const type_id_item *info)
+{
+ PyObject *result; /* Construction à retourner */
+ PyTypeObject *base; /* Modèle d'objet à créer */
+ PyObject *attrib; /* Attribut à constituer */
+ int ret; /* Bilan d'une mise en place */
+
+ base = get_python_py_struct_type();
+
+ result = PyObject_CallFunction((PyObject *)base, NULL);
+ assert(result != NULL);
+
+ /* Champs réguliers */
+
+#define TRANSLATE_ENCODED_TYPE_PROP(_f) \
+ do \
+ { \
+ attrib = PyLong_FromUnsignedLongLong(info->_f); \
+ ret = PyDict_SetItemString(result, #_f, attrib); \
+ if (ret != 0) goto tdcdtp_failed; \
+ } \
+ while (0);
+
+ TRANSLATE_ENCODED_TYPE_PROP(descriptor_idx);
+
+ return result;
+
+ tdcdtp_failed:
+
+ Py_DECREF(result);
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : info = ensemble d'informations Dex à décrire en Python. *
+* *
+* Description : Traduit des informations de type Dex en Python. *
+* *
+* Retour : Structure mise en place ou NULL en cas d'erreur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyObject *translate_dex_type_item_to_python(const type_item *info)
+{
+ PyObject *result; /* Construction à retourner */
+ PyTypeObject *base; /* Modèle d'objet à créer */
+ PyObject *attrib; /* Attribut à constituer */
+ int ret; /* Bilan d'une mise en place */
+
+ base = get_python_py_struct_type();
+
+ result = PyObject_CallFunction((PyObject *)base, NULL);
+ assert(result != NULL);
+
+ /* Champs réguliers */
+
+#define TRANSLATE_ENCODED_TYPE_PROP(_f) \
+ do \
+ { \
+ attrib = PyLong_FromUnsignedLongLong(info->_f); \
+ ret = PyDict_SetItemString(result, #_f, attrib); \
+ if (ret != 0) goto tdcdtp_failed; \
+ } \
+ while (0);
+
+ TRANSLATE_ENCODED_TYPE_PROP(type_idx);
+
+ return result;
+
+ tdcdtp_failed:
+
+ Py_DECREF(result);
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : info = ensemble d'informations Dex à décrire en Python. *
+* *
+* Description : Traduit des informations de champ Dex en Python. *
+* *
+* Retour : Structure mise en place ou NULL en cas d'erreur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyObject *translate_dex_field_id_to_python(const field_id_item *info)
+{
+ PyObject *result; /* Construction à retourner */
+ PyTypeObject *base; /* Modèle d'objet à créer */
+ PyObject *attrib; /* Attribut à constituer */
+ int ret; /* Bilan d'une mise en place */
+
+ base = get_python_py_struct_type();
+
+ result = PyObject_CallFunction((PyObject *)base, NULL);
+ assert(result != NULL);
+
+ /* Champs réguliers */
+
+#define TRANSLATE_ENCODED_FIELD_PROP(_f) \
+ do \
+ { \
+ attrib = PyLong_FromUnsignedLongLong(info->_f); \
+ ret = PyDict_SetItemString(result, #_f, attrib); \
+ if (ret != 0) goto tdcdtp_failed; \
+ } \
+ while (0);
+
+ TRANSLATE_ENCODED_FIELD_PROP(class_idx);
+ TRANSLATE_ENCODED_FIELD_PROP(type_idx);
+ TRANSLATE_ENCODED_FIELD_PROP(name_idx);
+
+ return result;
+
+ tdcdtp_failed:
+
+ Py_DECREF(result);
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : info = ensemble d'informations Dex à décrire en Python. *
+* *
* Description : Traduit des informations de champ de classe Dex en Python. *
* *
* Retour : Structure mise en place ou NULL en cas d'erreur. *
@@ -88,6 +234,106 @@ PyObject *translate_dex_field_info_to_python(const encoded_field *info)
* *
* Paramètres : info = ensemble d'informations Dex à décrire en Python. *
* *
+* Description : Traduit des identifiants de prototype Dex en Python. *
+* *
+* Retour : Structure mise en place ou NULL en cas d'erreur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyObject *translate_dex_proto_id_to_python(const proto_id_item *info)
+{
+ PyObject *result; /* Construction à retourner */
+ PyTypeObject *base; /* Modèle d'objet à créer */
+ PyObject *attrib; /* Attribut à constituer */
+ int ret; /* Bilan d'une mise en place */
+
+ base = get_python_py_struct_type();
+
+ result = PyObject_CallFunction((PyObject *)base, NULL);
+ assert(result != NULL);
+
+ /* Champs réguliers */
+
+#define TRANSLATE_ID_PROTO_PROP(_f) \
+ do \
+ { \
+ attrib = PyLong_FromUnsignedLongLong(info->_f); \
+ ret = PyDict_SetItemString(result, #_f, attrib); \
+ if (ret != 0) goto failed; \
+ } \
+ while (0);
+
+ TRANSLATE_ID_PROTO_PROP(shorty_idx);
+ TRANSLATE_ID_PROTO_PROP(return_type_idx);
+ TRANSLATE_ID_PROTO_PROP(parameters_off);
+
+ return result;
+
+ failed:
+
+ Py_DECREF(result);
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : info = ensemble d'informations Dex à décrire en Python. *
+* *
+* Description : Traduit des identifiants de méthode Dex en Python. *
+* *
+* Retour : Structure mise en place ou NULL en cas d'erreur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyObject *translate_dex_method_id_to_python(const method_id_item *info)
+{
+ PyObject *result; /* Construction à retourner */
+ PyTypeObject *base; /* Modèle d'objet à créer */
+ PyObject *attrib; /* Attribut à constituer */
+ int ret; /* Bilan d'une mise en place */
+
+ base = get_python_py_struct_type();
+
+ result = PyObject_CallFunction((PyObject *)base, NULL);
+ assert(result != NULL);
+
+ /* Champs réguliers */
+
+#define TRANSLATE_ID_METHOD_PROP(_f) \
+ do \
+ { \
+ attrib = PyLong_FromUnsignedLongLong(info->_f); \
+ ret = PyDict_SetItemString(result, #_f, attrib); \
+ if (ret != 0) goto tdcdtp_failed; \
+ } \
+ while (0);
+
+ TRANSLATE_ID_METHOD_PROP(class_idx);
+ TRANSLATE_ID_METHOD_PROP(proto_idx);
+ TRANSLATE_ID_METHOD_PROP(name_idx);
+
+ return result;
+
+ tdcdtp_failed:
+
+ Py_DECREF(result);
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : info = ensemble d'informations Dex à décrire en Python. *
+* *
* Description : Traduit des informations de méthode Dex en Python. *
* *
* Retour : Structure mise en place ou NULL en cas d'erreur. *
diff --git a/plugins/dex/python/translate.h b/plugins/dex/python/translate.h
index 29a0155..b360618 100644
--- a/plugins/dex/python/translate.h
+++ b/plugins/dex/python/translate.h
@@ -33,9 +33,24 @@
+/* Traduit des informations de type Dex en Python. */
+PyObject *translate_dex_type_id_to_python(const type_id_item *);
+
+/* Traduit des informations de type Dex en Python. */
+PyObject *translate_dex_type_item_to_python(const type_item *);
+
+/* Traduit des informations de champ Dex en Python. */
+PyObject *translate_dex_field_id_to_python(const field_id_item *);
+
/* Traduit des informations de champ de classe Dex en Python. */
PyObject *translate_dex_field_info_to_python(const encoded_field *);
+/* Traduit des identifiants de prototype Dex en Python. */
+PyObject *translate_dex_proto_id_to_python(const proto_id_item *);
+
+/* Traduit des identifiants de méthode Dex en Python. */
+PyObject *translate_dex_method_id_to_python(const method_id_item *);
+
/* Traduit des informations de méthode Dex en Python. */
PyObject *translate_dex_method_info_to_python(const encoded_method *);