summaryrefslogtreecommitdiff
path: root/src/format/executable.c
diff options
context:
space:
mode:
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. *
* *