diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-27 22:24:07 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-27 22:24:07 (GMT) |
commit | d33e8935c5186ab2459dfa6c9340396377524fb1 (patch) | |
tree | 951e4dd3edcf9782c90fda5f564d390c01abce35 /plugins/elf/python/dynamic.c | |
parent | c8dce9ce407b2f8248d669df196a4bf0f9523723 (diff) |
Extended the Python bindings.
Diffstat (limited to 'plugins/elf/python/dynamic.c')
-rw-r--r-- | plugins/elf/python/dynamic.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/plugins/elf/python/dynamic.c b/plugins/elf/python/dynamic.c index 9fe6eb4..32c7826 100644 --- a/plugins/elf/python/dynamic.c +++ b/plugins/elf/python/dynamic.c @@ -37,7 +37,7 @@ /****************************************************************************** * * * Paramètres : self = format Elf à manipuler. * -* args = indice de la section visée. * +* args = indice de l'élément recherché. * * * * Description : Retrouve un élément dans la section dynamique par son indice.* * * @@ -79,6 +79,49 @@ PyObject *py_elf_format_find_dynamic_item_by_index(PyObject *self, PyObject *arg /****************************************************************************** * * +* Paramètres : self = format Elf à manipuler. * +* args = sorte d'élément recherché. * +* * +* Description : Retrouve un élément dans la section dynamique par son type. * +* * +* Retour : Elément trouvé ou rien (None). * +* * +* Remarques : - * +* * +******************************************************************************/ + +PyObject *py_elf_format_find_dynamic_item_by_type(PyObject *self, PyObject *args) +{ + PyObject *result; /* Trouvaille à retourner */ + GElfFormat *format; /* Version GLib du format */ + unsigned long type; /* Type de l'élément visé */ + int ret; /* Bilan de lecture des args. */ + elf_dyn item; /* Informations remontées */ + bool found; /* Recherches concluantes ? */ + + format = G_ELF_FORMAT(pygobject_get(self)); + + ret = PyArg_ParseTuple(args, "k", &type); + if (!ret) return NULL; + + found = find_elf_dynamic_item_by_type(format, type, &item); + + if (found) + result = translate_elf_dyn_to_python(format, &item); + + else + { + result = Py_None; + Py_INCREF(result); + } + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : self = classe représentant un format ELF. * * closure = adresse non utilisée ici. * * * |