/* Chrysalide - Outil d'analyse de fichiers binaires * format.h - prototypes pour le support des différents formats binaires * * Copyright (C) 2009-2013 Cyrille Bagard * * This file is part of Chrysalide. * * 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 . */ #ifndef _FORMAT_FORMAT_H #define _FORMAT_FORMAT_H #include #include #include #include "symbol.h" #include "../analysis/content.h" #include "../analysis/routine.h" #include "../arch/context.h" #define G_TYPE_BIN_FORMAT g_binary_format_get_type() #define G_BIN_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_binary_format_get_type(), GBinFormat)) #define G_IS_BIN_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_binary_format_get_type())) #define G_BIN_FORMAT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_binary_format_get_type(), GBinFormatIface)) #define G_BIN_FORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BIN_FORMAT, GBinFormatClass)) /* Format binaire générique (instance) */ typedef struct _GBinFormat GBinFormat; /* Format binaire générique (classe) */ typedef struct _GBinFormatClass GBinFormatClass; /* Indique le type défini pour un format binaire générique. */ GType g_binary_format_get_type(void); /* Fournit une référence vers le contenu binaire analysé. */ GBinContent *g_binary_format_get_content(const GBinFormat *); /* Enregistre une adresse comme début d'une zone de code. */ void g_binary_format_register_code_point(GBinFormat *, virt_t, bool); /* Fournit un contexte initialisé pour un désassemblage. */ void g_binary_format_setup_disassembling_context(const GBinFormat *, GProcContext *); /* Ajoute un symbole à la collection du format binaire. */ void _g_binary_format_add_symbol(GBinFormat *, GBinSymbol *, bool); #define g_binary_format_add_symbol(fmt, sym) _g_binary_format_add_symbol(fmt, sym, true) /* Retire un symbole de la collection du format binaire. */ void g_binary_format_remove_symbol(GBinFormat *, GBinSymbol *); /* Réorganise si besoin est les symboles collectés. */ void g_binary_format_sort_symbols(GBinFormat *); /* Fournit la liste de tous les symboles détectés. */ GBinSymbol **g_binary_format_get_symbols(const GBinFormat *, size_t *); /* Construit une désignation pour chaîne de caractères. */ char *create_string_label(GBinFormat *, const vmpa2t *, const char *, size_t); /* Recherche le symbole correspondant à une étiquette. */ bool g_binary_format_find_symbol_by_label(const GBinFormat *, const char *, GBinSymbol **); /* Recherche le symbole correspondant à une adresse. */ bool g_binary_format_find_symbol_at(const GBinFormat *, const vmpa2t *, GBinSymbol **); /* Recherche le symbole suivant celui lié à une adresse. */ bool g_binary_format_find_next_symbol_at(const GBinFormat *, const vmpa2t *, GBinSymbol **); /* Recherche le symbole correspondant à une adresse. */ bool g_binary_format_resolve_symbol(const GBinFormat *, const vmpa2t *, GBinSymbol **, phys_t *); /* Ajoute une routine à la collection du format binaire. */ void g_binary_format_add_routine(GBinFormat *, GBinRoutine *) __attribute__ ((deprecated)); /* Retire une routine de la collection du format binaire. */ void g_binary_format_remove_routine(GBinFormat *, GBinRoutine *); /* Fournit le prototype de toutes les routines détectées. */ GBinRoutine **g_binary_format_get_routines(const GBinFormat *, size_t *); /* Fournit la liste des fichiers source détectés. */ const char * const *g_binary_format_get_source_files(const GBinFormat *, size_t *, size_t *); /* Procède à la décompilation complète du format. */ void g_binary_format_decompile(const GBinFormat *, GCodeBuffer *, const char *filename); /* Recherche une position dans une routine selon une adresse. */ bool g_binary_format_resolve_relative_routine(const GBinFormat *, const char **, vmpa_t *); #endif /* _FORMAT_FORMAT_H */