diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-02-09 20:15:52 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-02-09 20:15:52 (GMT) |
commit | 8d326041a0379b87e54be44506d544367567e89b (patch) | |
tree | a3c3555c27c30858155fbee4df0ca236f33774f8 /src/analysis/binaries | |
parent | b70f428256963385a140e9eb503624106df5aa9b (diff) |
Registered all the supported processors in the system code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@467 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/binaries')
-rw-r--r-- | src/analysis/binaries/file.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/analysis/binaries/file.c b/src/analysis/binaries/file.c index d833828..a724cb7 100644 --- a/src/analysis/binaries/file.c +++ b/src/analysis/binaries/file.c @@ -33,6 +33,7 @@ #include "../binary-int.h" #include "../../common/extstr.h" +#include "../../core/processors.h" #include "../../gui/panels/log.h" @@ -164,6 +165,8 @@ GLoadedBinary *g_file_binary_new_from_file(const char *filename) struct stat info; /* Informations sur le fichier */ int ret; /* Bilan d'un appel */ void *content; /* Contenu brut du fichier */ + const char *target; /* Architecture requise */ + const char *desc; /* Description humaine associƩe*/ result = g_object_new(G_TYPE_FILE_BINARY, NULL); loaded = G_LOADED_BINARY(result); @@ -216,30 +219,24 @@ GLoadedBinary *g_file_binary_new_from_file(const char *filename) goto lbf_error; } - switch (g_exe_format_get_target_machine(loaded->format)) + target = g_exe_format_get_target_machine(loaded->format); + desc = get_arch_processor_name(target); + + if (desc == NULL) { - case FTM_ARM: - log_simple_message(LMT_INFO, _("Detected architecture: ARM")); - break; - case FTM_DALVIK: - log_simple_message(LMT_INFO, _("Detected architecture: Dalvik Virtual Machine")); - break; - case FTM_JVM: - log_simple_message(LMT_INFO, _("Detected architecture: Java Virtual Machine")); - break; - case FTM_MIPS: - log_simple_message(LMT_INFO, _("Detected architecture: Microprocessor without Interlocked Pipeline Stages")); - break; - case FTM_386: - log_simple_message(LMT_INFO, _("Detected architecture: i386")); - break; - default: - log_simple_message(LMT_INFO, _("Unknown architecture")); - goto lbf_error; - break; + log_simple_message(LMT_INFO, _("Unknown architecture")); + goto lbf_error; } + else + log_variadic_message(LMT_INFO, _("Detected architecture: %s"), desc); + + loaded->proc = get_arch_processor_for_type(target); - loaded->proc = get_arch_processor_from_format(loaded->format); + if (loaded->proc == NULL) + { + log_simple_message(LMT_ERROR, _("Unable to load the required processor")); + goto lbf_error; + } return G_LOADED_BINARY(result); |