diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-05-28 07:14:16 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-05-28 07:14:16 (GMT) |
commit | 5dcc4df15a8d84b214bb3f6f0fcfe30f21cb0972 (patch) | |
tree | 71647bc0f253d95c8a08762eeaf2ffa01e2de025 /plugins | |
parent | eef3392134b489fbff7c96046581c987ff7192bd (diff) |
Saved the first steps for a new loading process.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/dex/format.c | 14 | ||||
-rw-r--r-- | plugins/elf/format.c | 9 |
2 files changed, 15 insertions, 8 deletions
diff --git a/plugins/dex/format.c b/plugins/dex/format.c index 84ddb4d..ccf21a8 100644 --- a/plugins/dex/format.c +++ b/plugins/dex/format.c @@ -250,6 +250,7 @@ static void g_dex_format_finalize(GDexFormat *format) GExeFormat *g_dex_format_new(GBinContent *content) { GDexFormat *result; /* Structure à retourner */ + vmpa2t pos; /* Position de tête de lecture */ if (!check_dex_format(content)) return NULL; @@ -260,6 +261,14 @@ GExeFormat *g_dex_format_new(GBinContent *content) result->pool = g_dex_pool_new(result); + init_vmpa(&pos, 0, VMPA_NO_VIRTUAL); + + if (!read_dex_header(result, &pos, &result->header)) + { + g_object_unref(G_OBJECT(result)); + return NULL; + } + return G_EXE_FORMAT(result); } @@ -341,11 +350,6 @@ static bool g_dex_format_analyze(GDexFormat *format, wgroup_id_t gid, GtkStatusS base = G_BIN_FORMAT(format); exe = G_EXE_FORMAT(format); - init_vmpa(&pos, 0, VMPA_NO_VIRTUAL); - - if (!read_dex_header(format, &pos, &format->header)) - goto gdfa_error; - /* Vérification des tailles fournies */ size = g_binary_content_compute_size(G_KNOWN_FORMAT(base)->content); diff --git a/plugins/elf/format.c b/plugins/elf/format.c index 75b9a6c..9cf48ce 100644 --- a/plugins/elf/format.c +++ b/plugins/elf/format.c @@ -255,6 +255,12 @@ GExeFormat *g_elf_format_new(GBinContent *content) g_known_format_set_content(G_KNOWN_FORMAT(result), content); + if (!read_elf_header(result, &result->header, &result->is_32b, &result->endian)) + { + g_object_unref(G_OBJECT(result)); + return NULL; + } + return G_EXE_FORMAT(result); } @@ -331,9 +337,6 @@ static bool g_elf_format_analyze(GElfFormat *format, wgroup_id_t gid, GtkStatusS base = G_BIN_FORMAT(format); exe = G_EXE_FORMAT(format); - if (!read_elf_header(format, &format->header, &format->is_32b, &format->endian)) - goto error; - /* Vérification des tailles d'entrée de table */ if (ELF_HDR(format, format->header, e_phentsize) != ELF_SIZEOF_PHDR(format)) |