From b8d16a54c152350766d1724c924c53c5bd3236fe Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 19 Nov 2016 18:49:21 -0500 Subject: pe_get_image_coff_hdr_addr(): code maintenance. --- src/headers/pe_get_image_coff_hdr_addr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/headers') 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 #include -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; } -- cgit v1.2.3