diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-03-31 17:50:08 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-03-31 17:50:08 (GMT) |
commit | ebe248fe406de9565c8c7787187a1d439e68cd84 (patch) | |
tree | 8126ea63a5b753f549a90a107d6428db2b299ff2 /src/format/elf/section.c | |
parent | 24096140aaa73db9e982db4437bc42a013812658 (diff) |
Extracted strings from some extra ELF sections.
Diffstat (limited to 'src/format/elf/section.c')
-rw-r--r-- | src/format/elf/section.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/format/elf/section.c b/src/format/elf/section.c index 9583927..556c0ed 100644 --- a/src/format/elf/section.c +++ b/src/format/elf/section.c @@ -207,6 +207,37 @@ void get_elf_section_content(const GElfFormat *format, const elf_shdr *section, /****************************************************************************** * * * Paramètres : format = description de l'exécutable à consulter. * +* section = section à consulter. * +* range = emplacement de la fonction à renseigner. [OUT] * +* * +* Description : Fournit la localisation d'une section. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void get_elf_section_range(const GElfFormat *format, const elf_shdr *section, mrange_t *range) +{ + virt_t virt; /* Emplacement virtuel */ + vmpa2t tmp; /* Enregistrement intermédiaire*/ + + virt = ELF_SHDR(format, *section, sh_addr); + + if (virt == 0) + virt = VMPA_NO_VIRTUAL; + + init_vmpa(&tmp, ELF_SHDR(format, *section, sh_offset), virt); + + init_mrange(range, &tmp, ELF_SHDR(format, *section, sh_size)); + +} + + +/****************************************************************************** +* * +* Paramètres : format = description de l'exécutable à consulter. * * name = nom de la section recherchée. * * offset = position de la section trouvée. [OUT] * * size = taille de la section trouvée. [OUT] * @@ -237,6 +268,35 @@ bool find_elf_section_content_by_name(const GElfFormat *format, const char *name /****************************************************************************** * * +* Paramètres : format = description de l'exécutable à consulter. * +* name = nom de la section recherchée. * +* range = emplacement de la fonction à renseigner. [OUT] * +* * +* Description : Recherche une zone donnée au sein de binaire par nom. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool find_elf_section_range_by_name(const GElfFormat *format, const char *name, mrange_t *range) +{ + bool result; /* Bilan à retourner */ + elf_shdr section; /* Section trouvée ou non */ + + result = find_elf_section_by_name(format, name, §ion); + + if (result) + get_elf_section_range(format, §ion, range); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : format = description de l'exécutable à consulter. * * section = section contenant des chaînes terminées par '\0'. * * index = indice du premier caractères à cerner. * |