/* OpenIDA - Outil d'analyse de fichiers binaires * executable.c - support des formats d'exécutables * * Copyright (C) 2009-2010 Cyrille Bagard * * This file is part of OpenIDA. * * OpenIDA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * OpenIDA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar. If not, see . */ #include "executable.h" #include "executable-int.h" #include "format.h" /* Initialise la classe des formats d'exécutables génériques. */ static void g_executable_format_class_init(GExeFormatClass *); /* Initialise une instance de format d'exécutable générique. */ static void g_executable_format_init(GExeFormat *); /* Indique le type défini pour un format d'exécutable générique. */ G_DEFINE_TYPE(GExeFormat, g_executable_format, G_TYPE_BIN_FORMAT); /****************************************************************************** * * * Paramètres : klass = classe à initialiser. * * * * Description : Initialise la classe des formats d'exécutables génériques. * * * * Retour : - * * * * Remarques : - * * * ******************************************************************************/ static void g_executable_format_class_init(GExeFormatClass *klass) { } /****************************************************************************** * * * Paramètres : format = instance à initialiser. * * * * Description : Initialise une instance de format d'exécutable générique. * * * * Retour : - * * * * Remarques : - * * * ******************************************************************************/ static void g_executable_format_init(GExeFormat *format) { } /****************************************************************************** * * * Paramètres : format = informations chargées à consulter. * * * * Description : Indique le type d'architecture visée par le format. * * * * Retour : Identifiant de l'architecture ciblée par le format. * * * * Remarques : - * * * ******************************************************************************/ FormatTargetMachine g_exe_format_get_target_machine(const GExeFormat *format) { return format->get_machine(format); } /****************************************************************************** * * * Paramètres : format = informations chargées à consulter. * * * * Description : Fournit l'adresse mémoire du point d'entrée du programme. * * * * Retour : Adresse de mémoire. * * * * Remarques : - * * * ******************************************************************************/ vmpa_t g_exe_format_get_entry_point(const GExeFormat *format) { return format->get_entry_point(format); } /****************************************************************************** * * * Paramètres : format = informations chargées à consulter. * * count = quantité de zones listées. [OUT] * * * * Description : Fournit les références aux zones binaires à analyser. * * * * Retour : Zones binaires à analyser. * * * * Remarques : - * * * ******************************************************************************/ GBinPart **g_exe_format_get_parts(const GExeFormat *format, size_t *count) { return format->get_parts(format, count); } /****************************************************************************** * * * Paramètres : format = description de l'exécutable à consulter. * * addr = adresse virtuelle à retrouver. * * pos = position correspondante. [OUT] * * * * Description : Fournit la position correspondant à une adresse virtuelle. * * * * Retour : Bilan de l'opération. * * * * Remarques : - * * * ******************************************************************************/ bool g_exe_format_translate_address_into_offset(const GExeFormat *format, vmpa_t addr, off_t *pos) { return format->translate_addr(format, addr, pos); } /****************************************************************************** * * * Paramètres : format = description de l'exécutable à consulter. * * pos = position dans le flux binaire à retrouver. * * addr = adresse virtuelle correspondante. [OUT] * * * * Description : Fournit l'adresse virtuelle correspondant à une position. * * * * Retour : Bilan de l'opération. * * * * Remarques : - * * * ******************************************************************************/ bool g_exe_format_translate_offset_into_address(const GExeFormat *format, off_t pos, vmpa_t *addr) { return format->translate_off(format, pos, addr); }