diff options
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); |