Module: wine Branch: master Commit: 4d649c6232fc53ebfcc1adf3ead93a8401c0cefb URL: https://gitlab.winehq.org/wine/wine/-/commit/4d649c6232fc53ebfcc1adf3ead93a8...
Author: Piotr Caban piotr@codeweavers.com Date: Sat Oct 15 20:36:33 2022 +0200
winedump: Dump metafiles in EMF spool files.
---
tools/winedump/emf.c | 2 +- tools/winedump/emfspool.c | 19 ++++++++++++++++++- tools/winedump/winedump.h | 1 + 3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/tools/winedump/emf.c b/tools/winedump/emf.c index f27a9903320..9f73fc365e9 100644 --- a/tools/winedump/emf.c +++ b/tools/winedump/emf.c @@ -77,7 +77,7 @@ static unsigned int read_int(const unsigned char *buffer) #define EMRCASE(x) case x: printf("%-20s %08x\n", #x, length); break #define EMRPLUSCASE(x) case x: printf(" %-20s %04x %08x %08x\n", #x, (UINT)header->Flags, (UINT)header->Size, (UINT)header->DataSize); break
-static unsigned long dump_emfrecord(unsigned long offset) +unsigned long dump_emfrecord(unsigned long offset) { const unsigned char* ptr; unsigned int type, length, i; diff --git a/tools/winedump/emfspool.c b/tools/winedump/emfspool.c index a10b3be2788..d65e580b22e 100644 --- a/tools/winedump/emfspool.c +++ b/tools/winedump/emfspool.c @@ -120,7 +120,24 @@ static unsigned long dump_emfspool_record(unsigned long off) break; }
- dump_data((const unsigned char *)(hdr + 1), hdr->cjSize, ""); + switch (hdr->ulID) + { + case EMRI_METAFILE: + case EMRI_FORM_METAFILE: + case EMRI_BW_METAFILE: + case EMRI_BW_FORM_METAFILE: + case EMRI_METAFILE_DATA: + { + unsigned long emf_off = off + sizeof(*hdr); + while ((emf_off = dump_emfrecord(emf_off)) && emf_off < off + sizeof(*hdr) + hdr->cjSize); + break; + } + + default: + dump_data((const unsigned char *)(hdr + 1), hdr->cjSize, ""); + break; + } + return off + sizeof(*hdr) + hdr->cjSize; }
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h index 505470436d0..09f4a9301e7 100644 --- a/tools/winedump/winedump.h +++ b/tools/winedump/winedump.h @@ -248,6 +248,7 @@ void dbg_dump( void ); enum FileSig get_kind_lnk(void); void lnk_dump( void ); enum FileSig get_kind_emf(void); +unsigned long dump_emfrecord(unsigned long offset); void emf_dump( void ); enum FileSig get_kind_emfspool(void); void emfspool_dump(void);