diff options
Diffstat (limited to 'plugins/elf/python/dynamic.c')
-rw-r--r-- | plugins/elf/python/dynamic.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/plugins/elf/python/dynamic.c b/plugins/elf/python/dynamic.c index 5c060c1..9fe6eb4 100644 --- a/plugins/elf/python/dynamic.c +++ b/plugins/elf/python/dynamic.c @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * dynamic.c - prototypes pour l'équivalent Python du fichier "plugins/elf/dynamic.c" + * dynamic.c - équivalent Python du fichier "plugins/elf/dynamic.c" * * Copyright (C) 2017 Cyrille Bagard * @@ -29,12 +29,56 @@ #include <pygobject.h> +#include "translate.h" #include "../dynamic.h" /****************************************************************************** * * +* Paramètres : self = format Elf à manipuler. * +* args = indice de la section visée. * +* * +* Description : Retrouve un élément dans la section dynamique par son indice.* +* * +* Retour : Elément trouvé ou rien (None). * +* * +* Remarques : - * +* * +******************************************************************************/ + +PyObject *py_elf_format_find_dynamic_item_by_index(PyObject *self, PyObject *args) +{ + PyObject *result; /* Trouvaille à retourner */ + GElfFormat *format; /* Version GLib du format */ + unsigned long index; /* Indice 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", &index); + if (!ret) return NULL; + + found = find_elf_dynamic_item_by_index(format, index, &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. * * * |