From 1d3dfd9e8d9cd2d575e6783d57dc6cee409d219c Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sun, 1 May 2011 09:46:12 +0200 Subject: [PATCH] winedump: Correctly get to the optional header for 64 bit images. --- tools/winedump/pe.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index c1f6eb8ff88..1974a42b09e 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -941,13 +941,11 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx) static void dump_dir_debug(void) { - const IMAGE_DEBUG_DIRECTORY*debugDir = get_dir(IMAGE_FILE_DEBUG_DIRECTORY); unsigned nb_dbg, i; + const IMAGE_DEBUG_DIRECTORY*debugDir = get_dir_and_size(IMAGE_FILE_DEBUG_DIRECTORY, &nb_dbg); - if (!debugDir) return; - nb_dbg = PE_nt_headers->OptionalHeader.DataDirectory[IMAGE_FILE_DEBUG_DIRECTORY].Size / - sizeof(*debugDir); - if (!nb_dbg) return; + nb_dbg /= sizeof(*debugDir); + if (!debugDir || !nb_dbg) return; printf("Debug Table (%u directories)\n", nb_dbg);