summaryrefslogtreecommitdiff
path: root/src/format/executable.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-07-08 10:14:12 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-07-08 10:14:12 (GMT)
commit9b018cede5af54594c0a20847239233153b04ce1 (patch)
tree0492a9d831b682bab10dd113d7bb01e0b2700638 /src/format/executable.c
parent1194c79f2b7ccca24d9f89090722ed1157cbc5e1 (diff)
Scrolled to the main address at startup without using a nested function.
Diffstat (limited to 'src/format/executable.c')
-rw-r--r--src/format/executable.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/format/executable.c b/src/format/executable.c
index 3d3847c..fe3448d 100644
--- a/src/format/executable.c
+++ b/src/format/executable.c
@@ -242,6 +242,47 @@ const char *g_exe_format_get_target_machine(const GExeFormat *format)
/******************************************************************************
* *
+* Paramètres : format = description de l'exécutable à consulter. *
+* addr = adresse principale trouvée si possible. [OUT] *
+* *
+* Description : Fournit l'adresse principale associée à un format. *
+* *
+* Retour : Bilan des recherches. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_exe_format_get_main_address(GExeFormat *format, vmpa2t *addr)
+{
+ bool result; /* Bilan à retourner */
+ GBinFormat *base; /* Version d'instance parente */
+
+ result = false;
+
+ if (G_EXE_FORMAT_GET_CLASS(format)->get_main_addr != NULL)
+ result = G_EXE_FORMAT_GET_CLASS(format)->get_main_addr(format, addr);
+
+ if (!result)
+ {
+ base = G_BIN_FORMAT(format);
+
+ g_rw_lock_reader_lock(&base->pt_lock);
+
+ if (base->ep_count > 0)
+ result = g_exe_format_translate_address_into_vmpa(format, base->entry_points[0], addr);
+
+ g_rw_lock_reader_unlock(&base->pt_lock);
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : format = instance à traiter. *
* status = barre de statut à tenir informée. *
* *