diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/panel/Makefile.am | 20 | ||||
-rw-r--r-- | src/panel/log.c | 220 | ||||
-rw-r--r-- | src/panel/log.h | 56 | ||||
-rw-r--r-- | src/panel/panels.c | 77 | ||||
-rw-r--r-- | src/panel/panels.h | 54 | ||||
-rw-r--r-- | src/panel/registers.c | 236 | ||||
-rw-r--r-- | src/panel/registers.h | 47 | ||||
-rw-r--r-- | src/panel/strings.c | 150 | ||||
-rw-r--r-- | src/panel/strings.h | 44 | ||||
-rw-r--r-- | src/panel/symbols.c | 219 | ||||
-rw-r--r-- | src/panel/symbols.h | 45 |
11 files changed, 0 insertions, 1168 deletions
diff --git a/src/panel/Makefile.am b/src/panel/Makefile.am deleted file mode 100755 index 20ea22e..0000000 --- a/src/panel/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ - -noinst_LTLIBRARIES = libpanel.la - -libpanel_la_SOURCES = \ - log.h log.c \ - panels.h panels.c \ - registers.h registers.c \ - strings.h strings.c \ - symbols.h symbols.c - -libpanel_la_LDFLAGS = - - -INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CPPFLAGS = - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/panel/log.c b/src/panel/log.c deleted file mode 100644 index 32ad10d..0000000 --- a/src/panel/log.c +++ /dev/null @@ -1,220 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * log.c - panneau d'affichage des messages système - * - * Copyright (C) 2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "log.h" - - -#include <malloc.h> -#include <stdarg.h> -#include <stdio.h> - - -#include "panels.h" - - - -/* Colonnes de la liste des messages */ -typedef enum _LogColumn -{ - LGC_PICTURE, /* Image de représentation */ - LGC_STRING, /* Chaîne de caractères */ - - LGC_COUNT /* Nombre de colonnes */ - -} LogColumn; - - -#define _(str) str - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Construit le panneau d'affichage des messages système. * -* * -* Retour : Adresse du panneau mis en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GtkWidget *build_log_panel(void) -{ - GtkWidget *result; /* Panneau à retourner */ - GtkTreeStore *store; /* Modèle de gestion */ - GtkWidget *treeview; /* Affichage de la liste */ - GtkCellRenderer *renderer; /* Moteur de rendu de colonne */ - GtkTreeViewColumn *column; /* Colonne de la liste */ - - result = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_show(result); - - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN); - - store = gtk_tree_store_new(LGC_COUNT, G_TYPE_STRING, G_TYPE_STRING); - g_object_set_data(G_OBJECT(result), "store", store); - - treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); - gtk_widget_show(treeview); - gtk_container_add(GTK_CONTAINER(result), treeview); - - g_object_unref(G_OBJECT(store)); - - column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_visible(column, FALSE); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column); - - column = gtk_tree_view_column_new(); - - renderer = gtk_cell_renderer_pixbuf_new(); - gtk_tree_view_column_pack_start(column, renderer, FALSE); - gtk_tree_view_column_add_attribute(column, renderer, "stock-id", LGC_PICTURE); - - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, "text", LGC_STRING); - - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : type = espèce du message à ajouter. * -* msg = message à faire apparaître à l'écran. * -* * -* Description : Affiche un message dans le journal des messages système. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void log_simple_message(LogMessageType type, const char *msg) -{ - GtkWidget *panel; /* Panneau à traiter */ - GtkTreeStore *store; /* Modèle de gestion */ - GtkTreeIter iter; /* Point d'insertion */ - - panel = get_panel(PNT_LOG); - store = g_object_get_data(G_OBJECT(panel), "store"); - - gtk_tree_store_append(store, &iter, NULL); - - switch (type) - { - case LMT_INFO: - gtk_tree_store_set(store, &iter, - LGC_PICTURE, "gtk-info", - LGC_STRING, msg, - -1); - break; - - case LMT_BAD_BINARY: - gtk_tree_store_set(store, &iter, - LGC_PICTURE, "gtk-dialog-warning", - LGC_STRING, msg, - -1); - break; - - case LMT_PROCESS: - gtk_tree_store_set(store, &iter, - LGC_PICTURE, "gtk-execute", - LGC_STRING, msg, - -1); - break; - - default: - gtk_tree_store_set(store, &iter, - LGC_STRING, msg, - -1); - break; - - } - -} - - -/****************************************************************************** -* * -* Paramètres : type = espèce du message à ajouter. * -* fmt = format du message à faire apparaître à l'écran. * -* ... = éventuels arguments venant compléter le message. * -* * -* Description : Affiche un message dans le journal des messages système. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void log_variadic_message(LogMessageType type, const char *fmt, ...) -{ - size_t len; /* Taille tampon disponible */ - char *buffer; /* Tampon du msg reconstitué */ - int ret; /* Bilan d'une impression */ - char *ptr; /* Nouvelle allocation */ - va_list ap; /* Liste d'arguments variable */ - - len = 100; - buffer = calloc(len, sizeof(char)); - - while (buffer != NULL) - { - va_start(ap, fmt); - ret = vsnprintf(buffer, len, fmt, ap); - va_end(ap); - - if (ret >= 0 && ret < len) break; - - else - { - if (ret > -1) len += 1; /* glibc 2.1 */ - else len *= 2; /* glibc 2.0 */ - - if ((ptr = realloc(buffer, len)) == NULL) - { - free(buffer); - buffer = NULL; - } - else buffer = ptr; - - } - - } - - log_simple_message(type, buffer); - - free(buffer); - -} diff --git a/src/panel/log.h b/src/panel/log.h deleted file mode 100644 index 48f8ad6..0000000 --- a/src/panel/log.h +++ /dev/null @@ -1,56 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * log.h - prototypes pour le panneau d'affichage des messages système - * - * Copyright (C) 2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef _PANEL_LOG_H -#define _PANEL_LOG_H - - -#include <gtk/gtk.h> - - - -/* Type de messages disponibles */ -typedef enum _LogMessageType -{ - LMT_INFO, /* Information sur l'exécution */ - LMT_BAD_BINARY, /* Binaire malformé */ - LMT_PROCESS, /* Début de tâche quelconque */ - - LMT_COUNT - -} LogMessageType; - - -/* Construit le panneau d'affichage des messages système. */ -GtkWidget *build_log_panel(void); - -/* Affiche un message dans le journal des messages système. */ -void log_simple_message(LogMessageType, const char *); - -/* Affiche un message dans le journal des messages système. */ -void log_variadic_message(LogMessageType, const char *, ...); - - - -#endif /* _PANEL_LOG_H */ diff --git a/src/panel/panels.c b/src/panel/panels.c deleted file mode 100644 index 262f6a2..0000000 --- a/src/panel/panels.c +++ /dev/null @@ -1,77 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * panels.h - gestion des différents panneaux - * - * Copyright (C) 2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "panels.h" - - -#include "log.h" -#include "registers.h" -#include "strings.h" -#include "symbols.h" - - - -static GtkWidget *panel_list[PNT_COUNT]; - - - -/****************************************************************************** -* * -* Paramètres : ref = espace de référencements global. * -* * -* Description : Procède au chargement de tous les panneaux. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void init_panels(GObject *ref) -{ - panel_list[PNT_LOG] = build_log_panel(); - panel_list[PNT_REGISTERS] = build_registers_panel(); - panel_list[PNT_SYMBOLS] = build_symbols_panel(ref); - panel_list[PNT_STRINGS] = build_strings_panel(ref); - -} - - -/****************************************************************************** -* * -* Paramètres : id = identifiant du panneau visé. * -* * -* Description : Fournit la référence d'un panneau donné. * -* * -* Retour : Adresse du composant GTK en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GtkWidget *get_panel(PanelType id) -{ - return (id < PNT_COUNT ? panel_list[id] : NULL); - -} diff --git a/src/panel/panels.h b/src/panel/panels.h deleted file mode 100644 index ef07dbf..0000000 --- a/src/panel/panels.h +++ /dev/null @@ -1,54 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * panels.h - prototypes pour la gestion des différents panneaux - * - * Copyright (C) 2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef _PANEL_PANELS_H -#define _PANEL_PANELS_H - - -#include <gtk/gtk.h> - - - -/* Liste de tous les panneaux */ -typedef enum _PanelType -{ - PNT_LOG, /* Messages système */ - PNT_REGISTERS, /* Registres d'architecture */ - PNT_SYMBOLS, /* Symboles d'exécutable */ - PNT_STRINGS, /* Chaînes de carac. trouvées */ - - PNT_COUNT - -} PanelType; - - -/* Procède au chargement de tous les panneaux. */ -void init_panels(GObject *); - -/* Fournit la référence d'un panneau donné. */ -GtkWidget *get_panel(PanelType); - - - -#endif /* _PANEL_PANELS_H */ diff --git a/src/panel/registers.c b/src/panel/registers.c deleted file mode 100644 index 76e546d..0000000 --- a/src/panel/registers.c +++ /dev/null @@ -1,236 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * registers.c - panneau d'affichage des registres d'architecture - * - * Copyright (C) 2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "registers.h" - - -#include "../gtkext/easygtk.h" - - - -#define _(str) str - - - - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Construit le panneau d'affichage des registres. * -* * -* Retour : Adresse du panneau mis en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GtkWidget *build_registers_panel(void) -{ - GtkWidget *result; /* Panneau à retourner */ - - - GtkWidget *vbox1; - GtkWidget *label1; - GtkWidget *table1; - GtkWidget *label3; - GtkWidget *label4; - GtkWidget *label5; - GtkWidget *label6; - GtkWidget *label7; - GtkWidget *label8; - GtkWidget *label9; - GtkWidget *label10; - GtkWidget *label11; - GtkWidget *label12; - GtkWidget *label13; - GtkWidget *label14; - GtkWidget *label15; - GtkWidget *label16; - GtkWidget *entry1; - GtkWidget *entry2; - GtkWidget *entry3; - GtkWidget *entry4; - GtkWidget *entry6; - GtkWidget *entry5; - GtkWidget *entry7; - GtkWidget *label2; - - GtkWidget *label; /* Etiquette textuelle */ - GtkWidget *alignment; /* Décallage de contenu */ - GtkWidget *entry; /* Zone de saisie */ - - - - result = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_show(result); - - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN); - - - - - vbox1 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox1); - gtk_container_add (GTK_CONTAINER (result), vbox1); - - label1 = gtk_label_new (_("Registers:")); - gtk_widget_show (label1); - gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0); - gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); - - - alignment = qck_create_padded_alignment(0, 0, 8, 0); - gtk_box_pack_start(GTK_BOX(vbox1), alignment, FALSE, TRUE, 0); - - table1 = gtk_table_new(7, 3, FALSE); - gtk_widget_show(table1); - gtk_container_add(GTK_CONTAINER(alignment), table1); - - label = qck_create_label(NULL, NULL, "eax: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "eax", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "ebx: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "ebx", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "ecx: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "ecx", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "edx: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "edx", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 3, 4, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "esi: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "esi", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 4, 5, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "edi: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 5, 6, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "edi", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 5, 6, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "ebp: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 6, 7, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "ebp", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 6, 7, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "esp: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 7, 8, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "esp", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 7, 8, GTK_FILL, 0, 0, 0); - - label = qck_create_label(NULL, NULL, "eip: "); - gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 8, 9, GTK_FILL, 0, 0, 0); - - entry = qck_create_entry(G_OBJECT(result), "eip", NULL); - gtk_entry_set_width_chars(GTK_ENTRY(entry), 8); - gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 8, 9, GTK_FILL, 0, 0, 0); - - - - - label2 = gtk_label_new (_("Segments:")); - gtk_widget_show (label2); - gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0); - gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5); - - - - - return result; - -} - - - - - - -/****************************************************************************** -* * -* Paramètres : panel = panneau contenant les champs utiles. * -* values = liste des registres avec leur valeur. * -* count = taille de cette liste. * -* * -* Description : Met à jour l'affichage des valeurs de registre. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void refresh_registers_panel_with_registers(GtkWidget *panel, register_value *values, size_t count) -{ - GObject *ref; /* Espace de référencement */ - size_t i; /* Boucle de parcours */ - GtkEntry *entry; /* Zone de texte */ - char buffer[32]; - - ref = G_OBJECT(panel); - - for (i = 0; i < count; i++) - { - entry = GTK_ENTRY(g_object_get_data(ref, values[i].name)); - if (entry == NULL) continue; - - snprintf(buffer, 32, "%08llx", values[i].value); - - gtk_entry_set_text(entry, buffer); - - - - - - } - - - -} diff --git a/src/panel/registers.h b/src/panel/registers.h deleted file mode 100644 index 635dbcf..0000000 --- a/src/panel/registers.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * registers.h - prototypes pour le panneau d'affichage des registres d'architecture - * - * Copyright (C) 2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef _PANEL_REGISTERS_H -#define _PANEL_REGISTERS_H - - -#include <gtk/gtk.h> - - -#include "../debug/debuggers.h" - - - -/* Construit le panneau d'affichage des registres. */ -GtkWidget *build_registers_panel(void); - - - -/* Met à jour l'affichage des valeurs de registre. */ -void refresh_registers_panel_with_registers(GtkWidget *, register_value *, size_t); - - - - -#endif /* _PANEL_REGISTERS_H */ diff --git a/src/panel/strings.c b/src/panel/strings.c deleted file mode 100644 index bed27ae..0000000 --- a/src/panel/strings.c +++ /dev/null @@ -1,150 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * strings.c - panneau d'affichage des chaînes de caractères - * - * Copyright (C) 2008-2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "strings.h" - - -#include "../format/format.h" - - - -/* Colonnes de la liste des symboles */ -typedef enum _StringsColumn -{ - STC_ADDRESS, /* Adresse mémoire du symbole */ - STC_STRING, /* Désignation humaine */ - - STC_COUNT /* Nombre de colonnes */ - -} StringsColumn; - - -#define _(str) str - - -/****************************************************************************** -* * -* Paramètres : ref = adresse de l'espace de référencements. * -* * -* Description : Construit le panneau d'affichage des symboles. * -* * -* Retour : Adresse du panneau mis en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GtkWidget *build_strings_panel(GObject *ref) -{ - GtkWidget *result; /* Panneau à retourner */ - GtkTreeStore *store; /* Modèle de gestion */ - GtkWidget *treeview; /* Affichage de la liste */ - GtkCellRenderer *renderer; /* Moteur de rendu de colonne */ - GtkTreeViewColumn *column; /* Colonne de la liste */ - GtkTreeSelection *select; /* Sélection dans la liste */ - - result = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_show(result); - - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN); - - store = gtk_tree_store_new(STC_COUNT, G_TYPE_STRING, G_TYPE_STRING); - g_object_set_data(G_OBJECT(result), "store", store); - - treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - gtk_widget_show(treeview); - gtk_container_add(GTK_CONTAINER(result), treeview); - - g_object_unref(G_OBJECT(store)); - - column = gtk_tree_view_column_new(); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Address"), renderer, "text", STC_ADDRESS, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("String"), renderer, "text", STC_STRING, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - - /* - select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); - gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); - g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(change_symbols_selection), ref); - */ - - - - return result; - -} - - - -/****************************************************************************** -* * -* Paramètres : panel = panneau à mettre à jour. * -* format = données sur l'exécutable à représenter. * -* * -* Description : Affiche la liste des symboles présents dans un exécutable. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void handle_new_exe_on_strings_panel(GtkWidget *panel, const GExeFormat *format) -{ - GtkTreeStore *store; /* Modèle de gestion */ - size_t count; /* Nombre des chaînes */ - GBinSymbol **symbols; /* Liste des chaînes trouvées */ - size_t i; /* Boucle de parcours */ - char address[11]; /* Conversion de l'adresse */ - GtkTreeIter iter; /* Point d'insertion */ - - store = g_object_get_data(G_OBJECT(panel), "store"); - - symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count); - - for (i = 0; i < count; i++) - { - if (g_binary_symbol_get_target_type(symbols[i]) != STP_STRING) continue; - - /* FIXME : adresses autres que 32 bits */ - snprintf(address, 11, "0x%08llx", g_binary_symbol_get_address(symbols[i])); - - gtk_tree_store_append(store, &iter, NULL); - gtk_tree_store_set(store, &iter, - STC_ADDRESS, address, - STC_STRING, g_binary_symbol_to_string(symbols[i]), - -1); - - } - -} diff --git a/src/panel/strings.h b/src/panel/strings.h deleted file mode 100644 index 18a302b..0000000 --- a/src/panel/strings.h +++ /dev/null @@ -1,44 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * strings.h - prototypes pour le panneau d'affichage des chaînes de caractères - * - * Copyright (C) 2008-2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef _PANEL_STRINGS_H -#define _PANEL_STRINGS_H - - -#include <gtk/gtk.h> - - -#include "../format/executable.h" - - - -/* Construit le panneau d'affichage des symboles. */ -GtkWidget *build_strings_panel(GObject *); - -/* Affiche la liste des symboles présents dans un exécutable. */ -void handle_new_exe_on_strings_panel(GtkWidget *, const GExeFormat *); - - - -#endif /* _PANEL_STRINGS_H */ diff --git a/src/panel/symbols.c b/src/panel/symbols.c deleted file mode 100644 index 0d22a7b..0000000 --- a/src/panel/symbols.c +++ /dev/null @@ -1,219 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * symbols.c - panneau d'affichage des symboles - * - * Copyright (C) 2008-2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "symbols.h" - - -#include <malloc.h> -#include <stdlib.h> - - -#include "../arch/processor.h" -#include "../format/format.h" -#include "../gtkext/gtkbinview.h" - - - -/* Colonnes de la liste des symboles */ -typedef enum _SymbolsColumn -{ - SBC_ADDRESS, /* Adresse mémoire du symbole */ - SBC_NAME, /* Désignation humaine */ - - SBC_COUNT /* Nombre de colonnes */ - -} SymbolsColumn; - - -/* Réagit au changement de sélection des symboles. */ -void change_symbols_selection(GtkTreeSelection *, gpointer); - - - -/****************************************************************************** -* * -* Paramètres : ref = adresse de l'espace de référencements. * -* * -* Description : Construit le panneau d'affichage des symboles. * -* * -* Retour : Adresse du panneau mis en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GtkWidget *build_symbols_panel(GObject *ref) -{ - GtkWidget *result; /* Panneau à retourner */ - GtkTreeStore *store; /* Modèle de gestion */ - GtkWidget *treeview; /* Affichage de la liste */ - GtkCellRenderer *renderer; /* Moteur de rendu de colonne */ - GtkTreeViewColumn *column; /* Colonne de la liste */ - GtkTreeSelection *select; /* Sélection dans la liste */ - - result = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_show(result); - - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN); - - store = gtk_tree_store_new(SBC_COUNT, G_TYPE_STRING, G_TYPE_STRING); - g_object_set_data(G_OBJECT(result), "store", store); - - treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); - gtk_widget_show(treeview); - gtk_container_add(GTK_CONTAINER(result), treeview); - - g_object_unref(G_OBJECT(store)); - - column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_visible(column, FALSE); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Address", renderer, "text", SBC_ADDRESS, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", SBC_NAME, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); - gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); - g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(change_symbols_selection), ref); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : selection = sélection modifiée. * -* data = adresse de l'espace de référencements. * -* * -* Description : Réagit au changement de sélection des symboles. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void change_symbols_selection(GtkTreeSelection *selection, gpointer data) -{ - GtkTreeIter iter; - GtkTreeModel *model; - gchar *string; /* Chaîne sélectionnée */ - vmpa_t address; /* Adresse à rejoindre */ - GtkBinView *binview; /* Affichage à faire défiler */ - - if (gtk_tree_selection_get_selected(selection, &model, &iter)) - { - gtk_tree_model_get(model, &iter, SBC_ADDRESS, &string, -1); - address = strtoll(string, NULL, 16); /* FIXME */ - g_free(string); - - binview = GTK_BIN_VIEW(g_object_get_data(G_OBJECT(data), "binview")); - - gtk_bin_view_scroll_to_address(binview, address); - - } - -} - - -/****************************************************************************** -* * -* Paramètres : panel = panneau à mettre à jour. * -* format = données sur l'exécutable à représenter. * -* * -* Description : Affiche la liste des symboles présents dans un exécutable. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void reload_symbols_panel_content(GtkWidget *panel, const GExeFormat *format) -{ - GBinSymbol **symbols; /* Symboles trouvés */ - size_t count; /* Nombre de ces symboles */ - GtkTreeStore *store; /* Modèle de gestion */ - GArchProcessor *proc; /* Architecture utilisée */ - size_t i; /* Boucle de parcours */ - vmpa_t address; /* Adresse associée au symbole */ - char tmp[19]; /* Version humainement lisible */ - GtkTreeIter iter; /* Point d'insertion */ - - symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count); - - if (symbols != NULL) - { - store = g_object_get_data(G_OBJECT(panel), "store"); - - proc = get_arch_processor_from_format(format); - - for (i = 0; i < count; i++) - { - if (g_binary_symbol_get_target_type(symbols[i]) == STP_STRING) - continue; - - address = g_binary_symbol_get_address(symbols[i]); - - switch (g_arch_processor_get_memory_size(proc)) - { - case MDS_8_BITS: - snprintf(tmp, 19, "0x%02llx", address); - break; - - case MDS_16_BITS: - snprintf(tmp, 19, "0x%04llx", address); - break; - - case MDS_32_BITS: - snprintf(tmp, 19, "0x%08llx", address); - break; - - default: - case MDS_64_BITS: - snprintf(tmp, 19, "0x%16llx", address); - break; - - } - - gtk_tree_store_append(store, &iter, NULL); - gtk_tree_store_set(store, &iter, - SBC_ADDRESS, tmp, - SBC_NAME, g_binary_symbol_to_string(symbols[i]), - -1); - - } - - } - -} diff --git a/src/panel/symbols.h b/src/panel/symbols.h deleted file mode 100644 index 09898c5..0000000 --- a/src/panel/symbols.h +++ /dev/null @@ -1,45 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * pan_symbols.h - prototypes pour le panneau d'affichage des symboles - * - * Copyright (C) 2008-2009 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef _PAN_SYMBOLS_H -#define _PAN_SYMBOLS_H - - -#include <gtk/gtk.h> - - -#include "../format/executable.h" - - - -/* Construit le panneau d'affichage des symboles. */ -GtkWidget *build_symbols_panel(GObject *); - - -/* Affiche la liste des symboles présents dans un exécutable. */ -void reload_symbols_panel_content(GtkWidget *, const GExeFormat *); - - - -#endif /* _PAN_SYMBOLS_H */ |