diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-02-23 22:56:59 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-02-23 22:56:59 (GMT) |
commit | a5cd2e6519456f49a0f0d9d76dfac0ff89d8bbb1 (patch) | |
tree | cc5c0d06836f132ba559eacf4323ce56b67e9d47 /src/analysis | |
parent | 08f3cc8d6262c9b5412a008c6210e88cd840da85 (diff) |
Fixed a bug: do not close the connection after the initial handshake.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@478 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 77 | ||||
-rw-r--r-- | src/analysis/binary.h | 1 | ||||
-rw-r--r-- | src/analysis/db/misc/rlestr.c | 2 | ||||
-rw-r--r-- | src/analysis/db/server.c | 2 |
4 files changed, 78 insertions, 4 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index b94071c..cf01e16 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -36,6 +36,7 @@ #include "binary-int.h" #include "routine.h" #include "binaries/file.h" +#include "db/items/bookmark.h" #include "decomp/decompiler.h" #include "disass/disassembler.h" #include "../common/extstr.h" @@ -78,6 +79,15 @@ static bool g_loaded_binary_save_storage(const GLoadedBinary *, xmlDocPtr, xmlXP +/* -------------------------- MANIPULATION DES COLLECTIONS -------------------------- */ + + +/* Actualise suite à un changement affectant les signets. */ +static void on_binary_bookmarks_change(GDbCollection *, DBAction, GDbBookmark *, GLoadedBinary *); + + + + /* Indique le type défini pour une description de fichier binaire. */ @@ -138,6 +148,8 @@ static void g_loaded_binary_class_init(GLoadedBinaryClass *klass) static void g_loaded_binary_init(GLoadedBinary *binary) { + GDbCollection *collec; /* Collection à lister ici */ + binary->username = strdup("default"); binary->remote_host = strdup("localhost"); @@ -150,6 +162,9 @@ static void g_loaded_binary_init(GLoadedBinary *binary) binary->collections = create_collections_list(); + collec = g_loaded_binary_find_collection(binary, DBF_BOOKMARKS); + g_signal_connect(collec, "content-changed", G_CALLBACK(on_binary_bookmarks_change), binary); + binary->col_display[BVW_BLOCK][BLC_PHYSICAL] = true; binary->col_display[BVW_BLOCK][BLC_VIRTUAL] = true; binary->col_display[BVW_BLOCK][BLC_BINARY] = true; @@ -811,6 +826,61 @@ bool _g_loaded_binary_add_to_collection(GLoadedBinary *binary, DBFeatures featur + + +/****************************************************************************** +* * +* Paramètres : collec = collection dont le contenu vient de changer. * +* action = type de modification notifiée par la collection. * +* bookmark = élément en cause dans le changement survenu. * +* binary = structure contenant les informations maîtresses. * +* * +* Description : Actualise suite à un changement affectant les signets. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void on_binary_bookmarks_change(GDbCollection *collec, DBAction action, GDbBookmark *bookmark, GLoadedBinary *binary) +{ + const vmpa2t *addr; /* Adressse associée au signet */ + GBufferLine *line; /* Ligne de tampon à marquer */ + + addr = g_db_bookmark_get_address(bookmark); + + line = g_code_buffer_find_line_by_addr(binary->disass_buffer, addr); + + if (line != NULL) + { + if (action == DBA_ADD_ITEM) + g_buffer_line_add_flag(line, BLF_BOOKMARK); + + else /*if (action == DBA_REM_ITEM)*/ + g_buffer_line_remove_flag(line, BLF_BOOKMARK); + + g_object_unref(G_OBJECT(line)); + + } + +} + + + + + + + + + + + + + + + + /****************************************************************************** * * * Paramètres : binary = élément binaire à traiter. * @@ -832,11 +902,13 @@ void g_loaded_binary_analyse(GLoadedBinary *binary) /* Contacts avec les serveurs */ - + // Déconnexion... disassemble_binary(binary, &binary->instrs, &binary->disass_buffer, ack_completed_disassembly); + + /* TODO : remme ! */ //ack_completed_disassembly(NULL, binary); @@ -1096,6 +1168,9 @@ void ack_completed_disassembly(GDelayedDisassembly *disass, GLoadedBinary *binar g_object_unref(G_OBJECT(disass)); + g_loaded_binary_connect(binary); + + /* Décompilation... */ diff --git a/src/analysis/binary.h b/src/analysis/binary.h index b0fb369..6878fe4 100644 --- a/src/analysis/binary.h +++ b/src/analysis/binary.h @@ -112,7 +112,6 @@ bool g_loaded_binary_connect(GLoadedBinary *); -/* ------------------------- INFORMATIONS D'ENREGISTREMENTS ------------------------- */ /* -------------------------- MANIPULATION DES COLLECTIONS -------------------------- */ diff --git a/src/analysis/db/misc/rlestr.c b/src/analysis/db/misc/rlestr.c index d75e7ab..631b1e9 100644 --- a/src/analysis/db/misc/rlestr.c +++ b/src/analysis/db/misc/rlestr.c @@ -331,7 +331,7 @@ bool send_rle_string(const rle_string *str, int fd, int flags) { bool status; /* Bilan d'une opération */ - status = safe_send(fd, (uint32_t []) { htobe32(str->length) }, sizeof(uint32_t), flags); + status = safe_send(fd, (uint32_t []) { htobe32(str->length) }, sizeof(uint32_t), MSG_MORE | flags); if (!status) return false; if (str->length > 0) diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c index 04b0dc4..c51c21e 100644 --- a/src/analysis/db/server.c +++ b/src/analysis/db/server.c @@ -390,7 +390,7 @@ static void *g_db_server_listener(GDbServer *server) if (archive != NULL) error = g_cdb_archive_add_client(archive, fd, &user); - + continue; gdsl_error: |