From 25e679c0c2bf3c769056ed44beb93c13acbb48f8 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 27 Jul 2017 23:24:49 +0200 Subject: [PATCH] export type, machine, version and entry header fields --- README.md | 4 ++++ elf.c | 10 ++++++++++ elf.h | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 80528ff..6f1ebf9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,10 @@ struct Fhdr { ... /* ELF Header */ + uint16_t type; + uint16_t machine; + uint32_t version; + uint64_t entry; uint64_t phoff; uint64_t shoff; uint16_t ehsize; /* ELF Header size */ diff --git a/elf.c b/elf.c index 0e65f43..4e7e8e9 100644 --- a/elf.c +++ b/elf.c @@ -164,6 +164,11 @@ readelf32ehdr(FILE *f, Fhdr *fp) return -1; } + fp->type = e.type; + fp->machine = e.machine; + fp->version = e.version; + fp->entry = e.entry; + fp->shoff = e.shoff; fp->phoff = e.phoff; fp->phnum = e.phnum; @@ -229,6 +234,11 @@ readelf64ehdr(FILE *f, Fhdr *fp) return -1; } + fp->type = e.type; + fp->machine = e.machine; + fp->version = e.version; + fp->entry = e.entry; + fp->shoff = e.shoff; fp->phoff = e.phoff; fp->phnum = e.phnum; diff --git a/elf.h b/elf.h index 7a045f5..9f23411 100644 --- a/elf.h +++ b/elf.h @@ -17,6 +17,10 @@ struct Fhdr { int (*readelfstrndx)(FILE*, Fhdr*); /* ELF Header */ + uint16_t type; + uint16_t machine; + uint32_t version; + uint64_t entry; uint64_t phoff; uint64_t shoff; uint16_t ehsize; /* ELF Header size */