summaryrefslogtreecommitdiff
path: root/src/format/elf/section.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/elf/section.c')
-rw-r--r--src/format/elf/section.c60
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, &section);
+
+ if (result)
+ get_elf_section_range(format, &section, 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. *