Module: wine Branch: master Commit: 3f296440f5247c5f05937db247adf545a8081298 URL: https://gitlab.winehq.org/wine/wine/-/commit/3f296440f5247c5f05937db247adf54...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jun 5 08:11:41 2024 +0200
winedump: Fix dumping of catchblocks for 32-bit modules.
The frame member isn't present on 32-bit.
---
tools/winedump/pe.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index 8f103e8e2a8..6acab7e4773 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -982,6 +982,14 @@ static void dump_cxx_exception_data( unsigned int rva, unsigned int func_rva ) UINT frame; } *catchblock;
+ const struct + { + UINT flags; + UINT type_info; + int offset; + UINT handler; + } *catchblock32; + const struct { UINT ip; @@ -1032,22 +1040,28 @@ static void dump_cxx_exception_data( unsigned int rva, unsigned int func_rva ) for (i = 0; i < func->tryblock_count; i++) { catchblock = RVA( tryblock[i].catchblock, sizeof(*catchblock) ); + catchblock32 = RVA( tryblock[i].catchblock, sizeof(*catchblock32) ); printf( " %d: start %d end %d catch %d count %u\n", i, tryblock[i].start, tryblock[i].end, tryblock[i].catch, tryblock[i].catchblock_count ); for (j = 0; j < tryblock[i].catchblock_count; j++) { const char *type = "<none>"; - if (catchblock[j].type_info) + + if (PE_nt_headers->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) + { + if (catchblock[j].type_info) type = RVA( catchblock[j].type_info + 16, 1 ); + printf( " %d: flags %x offset %+d handler %08x frame %x type %s\n", j, + catchblock[j].flags, catchblock[j].offset, + catchblock[j].handler, catchblock[j].frame, type ); + } + else { - if (PE_nt_headers->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) - type = RVA( catchblock[j].type_info + 16, 1 ); - else - type = RVA( catchblock[j].type_info + 8, 1 ); + if (catchblock32[j].type_info) type = RVA( catchblock32[j].type_info + 8, 1 ); + printf( " %d: flags %x offset %+d handler %08x type %s\n", j, + catchblock32[j].flags, catchblock32[j].offset, + catchblock32[j].handler, type ); } - printf( " %d: flags %x offset %+d handler %08x frame %x type %s\n", j, - catchblock[j].flags, catchblock[j].offset, - catchblock[j].handler, catchblock[j].frame, type ); } } }