diff options
author | midipix <writeonce@midipix.org> | 2016-11-19 18:49:21 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-19 18:50:05 -0500 |
commit | b8d16a54c152350766d1724c924c53c5bd3236fe (patch) | |
tree | 6dd68d8ffa7b43ef922d7263abf6ea15b564e4c9 /src/headers | |
parent | fef53e0131407861a8aad760ecda7b781712a6b9 (diff) | |
download | pemagine-b8d16a54c152350766d1724c924c53c5bd3236fe.tar.bz2 pemagine-b8d16a54c152350766d1724c924c53c5bd3236fe.tar.xz |
pe_get_image_coff_hdr_addr(): code maintenance.
Diffstat (limited to 'src/headers')
-rw-r--r-- | src/headers/pe_get_image_coff_hdr_addr.c | 16 |
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; } |