summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-11-19 18:49:21 -0500
committermidipix <writeonce@midipix.org>2016-11-19 18:50:05 -0500
commitb8d16a54c152350766d1724c924c53c5bd3236fe (patch)
tree6dd68d8ffa7b43ef922d7263abf6ea15b564e4c9
parentfef53e0131407861a8aad760ecda7b781712a6b9 (diff)
downloadpemagine-b8d16a54c152350766d1724c924c53c5bd3236fe.tar.bz2
pemagine-b8d16a54c152350766d1724c924c53c5bd3236fe.tar.xz
pe_get_image_coff_hdr_addr(): code maintenance.
-rw-r--r--src/headers/pe_get_image_coff_hdr_addr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/headers/pe_get_image_coff_hdr_addr.c b/src/headers/pe_get_image_coff_hdr_addr.c
index 1a2d9cf..516c30b 100644
--- a/src/headers/pe_get_image_coff_hdr_addr.c
+++ b/src/headers/pe_get_image_coff_hdr_addr.c
@@ -9,7 +9,7 @@
#include <pemagine/pe_structs.h>
#include <pemagine/pemagine.h>
-pe_api
+
struct pe_raw_coff_file_hdr * pe_get_image_coff_hdr_addr(const void * base)
{
struct pe_raw_image_dos_hdr * dos;
@@ -19,12 +19,12 @@ struct pe_raw_coff_file_hdr * pe_get_image_coff_hdr_addr(const void * base)
if (!(dos = pe_get_image_dos_hdr_addr(base)))
return 0;
- offset = (uint32_t *)(dos->dos_lfanew);
- coff = (struct pe_raw_coff_file_hdr *)pe_va_from_rva(base,*offset);
+ offset = (uint32_t *)(dos->dos_lfanew);
+ coff = (struct pe_raw_coff_file_hdr *)pe_va_from_rva(base,*offset);
- if ((coff->signature[0] == 'P') && (coff->signature[1] == 'E')
- && (coff->signature[2] == '\0') && (coff->signature[3] == '\0'))
- return coff;
- else
- return 0;
+ return ((coff->signature[0] == 'P')
+ && (coff->signature[1] == 'E')
+ && (coff->signature[2] == '\0')
+ && (coff->signature[3] == '\0'))
+ ? coff : 0;
}