diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-01-26 23:00:18 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-01-26 23:00:18 (GMT) |
commit | 84790a5b420d0a9ce658013573b180ce059db325 (patch) | |
tree | 5000d25a0d5ede63e671364e1e017fbb6674b5f5 /src/gui/menus | |
parent | abb191e42e356914bd09176a6d6c5bf89ec50bbf (diff) |
Saved the first steps of the migration to GTK+ v3.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@367 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui/menus')
-rw-r--r-- | src/gui/menus/project.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c index dbf61bc..19ced97 100644 --- a/src/gui/menus/project.c +++ b/src/gui/menus/project.c @@ -33,10 +33,14 @@ #include "../editem-int.h" #include "../../analysis/binaries/file.h" +#include "../../dialogs/shellcode.h" #include "../../gtkext/easygtk.h" +/* Affiche la boîte d'ajout d'un shellcode au projet courant. */ +static void mcb_project_add_shellcode(GtkMenuItem *, GMenuBar *); + /* Affiche la boîte d'ajout d'un binaire au projet courant. */ static void mcb_project_add_binary_file(GtkMenuItem *, GMenuBar *); @@ -79,6 +83,10 @@ GtkWidget *build_menu_project(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b deepmenubar = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), deepmenubar); + deepmenuitem = qck_create_menu_item(NULL, NULL, _("Shellcode"), + G_CALLBACK(mcb_project_add_shellcode), bar); + gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem); + deepmenuitem = qck_create_menu_item(NULL, NULL, _("File"), G_CALLBACK(mcb_project_add_binary_file), bar); gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem); @@ -163,6 +171,92 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project, * Paramètres : menuitem = élément de menu sélectionné. * * bar = barre de menu parente. * * * +* Description : Affiche la boîte d'ajout d'un shellcode au projet courant. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void mcb_project_add_shellcode(GtkMenuItem *menuitem, GMenuBar *bar) +{ + GStudyProject *project; /* Projet courant */ + GtkWindow *parent; /* Respect de la hiérarchie */ + GtkWidget *dialog; /* Boîte à afficher */ + + project = get_current_project(); + parent = GTK_WINDOW(G_EDITOR_ITEM(bar)->ref); + + dialog = NULL; + + run_shellcode_assistant(project, parent); + + //if (run_shellcode_assistant(project, parent)) == GTK_RESPONSE_ACCEPT) + { + + ; + + + } + +#if 0 + GtkWidget *dialog; /* Boîte à afficher */ + char *dir; /* Répertoire courant */ + gchar *filename; /* Nom du fichier à intégrer */ + GLoadedBinary *binary; /* Représentation chargée */ + + dialog = gtk_file_chooser_dialog_new(_("Open a binary file"), + GTK_WINDOW(G_EDITOR_ITEM(bar)->ref), + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + if (g_study_project_get_filename(get_current_project()) != NULL) + { + dir = strdup(g_study_project_get_filename(get_current_project())); + dir = dirname(dir); + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir); + free(dir); + } + + if (g_study_project_get_filename(get_current_project()) != NULL) + { + dir = strdup(g_study_project_get_filename(get_current_project())); + dir = dirname(dir); + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir); + free(dir); + } + + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + { + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + + binary = g_file_binary_new_from_file(filename); + + if (binary != NULL) + { + g_signal_connect(binary, "disassembly-done", + G_CALLBACK(g_study_project_add_loaded_binary), get_current_project()); + g_loaded_binary_analyse(binary); + } + + g_free(filename); + + } + + gtk_widget_destroy(dialog); +#endif +} + + + +/****************************************************************************** +* * +* Paramètres : menuitem = élément de menu sélectionné. * +* bar = barre de menu parente. * +* * * Description : Affiche la boîte d'ajout d'un binaire au projet courant. * * * * Retour : - * |