From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/Makefile.in | 1 + tools/winedump/dump.c | 1 + tools/winedump/emfspool.c | 158 +++++++++++++++++++++++++++++++++++++ tools/winedump/winedump.h | 4 +- 4 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 tools/winedump/emfspool.c
diff --git a/tools/winedump/Makefile.in b/tools/winedump/Makefile.in index 54028024b0d..04dcacf0216 100644 --- a/tools/winedump/Makefile.in +++ b/tools/winedump/Makefile.in @@ -7,6 +7,7 @@ C_SRCS = \ dos.c \ dump.c \ emf.c \ + emfspool.c \ font.c \ le.c \ lib.c \ diff --git a/tools/winedump/dump.c b/tools/winedump/dump.c index cf52761290b..f2cb601b295 100644 --- a/tools/winedump/dump.c +++ b/tools/winedump/dump.c @@ -255,6 +255,7 @@ dumpers[] = {SIG_MDMP, get_kind_mdmp, mdmp_dump}, {SIG_LNK, get_kind_lnk, lnk_dump}, {SIG_EMF, get_kind_emf, emf_dump}, + {SIG_EMFSPOOL, get_kind_emfspool, emfspool_dump}, {SIG_MF, get_kind_mf, mf_dump}, {SIG_FNT, get_kind_fnt, fnt_dump}, {SIG_TLB, get_kind_tlb, tlb_dump}, diff --git a/tools/winedump/emfspool.c b/tools/winedump/emfspool.c new file mode 100644 index 00000000000..a10b3be2788 --- /dev/null +++ b/tools/winedump/emfspool.c @@ -0,0 +1,158 @@ +/* + * Dump an EMF Spool File + * + * Copyright 2022 Piotr Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "winedump.h" + +#define EMFSPOOL_VERSION 0x10000 + +typedef enum +{ + EMRI_METAFILE = 1, + EMRI_ENGINE_FONT, + EMRI_DEVMODE, + EMRI_TYPE1_FONT, + EMRI_PRESTARTPAGE, + EMRI_DESIGNVECTOR, + EMRI_SUBSET_FONT, + EMRI_DELTA_FONT, + EMRI_FORM_METAFILE, + EMRI_BW_METAFILE, + EMRI_BW_FORM_METAFILE, + EMRI_METAFILE_DATA, + EMRI_METAFILE_EXT, + EMRI_BW_METAFILE_EXT, + EMRI_ENGINE_FONT_EXT, + EMRI_TYPE1_FONT_EXT, + EMRI_DESIGNVECTOR_EXT, + EMRI_SUBSET_FONT_EXT, + EMRI_DELTA_FONT_EXT, + EMRI_PS_JOB_DATA, + EMRI_EMBED_FONT_EXT, +} record_type; + +typedef struct +{ + unsigned int dwVersion; + unsigned int cjSize; + unsigned int dpszDocName; + unsigned int dpszOutput; +} header; + +typedef struct +{ + unsigned int ulID; + unsigned int cjSize; +} record_hdr; + +static const WCHAR* read_wstr(unsigned long off) +{ + const WCHAR *beg, *end; + + if (!off) + return NULL; + + beg = end = PRD(off, sizeof(WCHAR)); + off += sizeof(WCHAR); + if (!beg) + fatal("can't read Unicode string, corrupted file\n"); + + while (*end) + { + end = PRD(off, sizeof(WCHAR)); + off += sizeof(WCHAR); + if (!end) + fatal("can't read Unicode string, corrupted file\n"); + } + return beg; +} + +#define EMRICASE(x) case x: printf("%-24s %08x\n", #x, hdr->cjSize); break +static unsigned long dump_emfspool_record(unsigned long off) +{ + const record_hdr *hdr; + + hdr = PRD(off, sizeof(*hdr)); + if (!hdr) + return 0; + + switch (hdr->ulID) + { + EMRICASE(EMRI_METAFILE); + EMRICASE(EMRI_ENGINE_FONT); + EMRICASE(EMRI_DEVMODE); + EMRICASE(EMRI_TYPE1_FONT); + EMRICASE(EMRI_PRESTARTPAGE); + EMRICASE(EMRI_DESIGNVECTOR); + EMRICASE(EMRI_SUBSET_FONT); + EMRICASE(EMRI_DELTA_FONT); + EMRICASE(EMRI_FORM_METAFILE); + EMRICASE(EMRI_BW_METAFILE); + EMRICASE(EMRI_BW_FORM_METAFILE); + EMRICASE(EMRI_METAFILE_DATA); + EMRICASE(EMRI_METAFILE_EXT); + EMRICASE(EMRI_BW_METAFILE_EXT); + EMRICASE(EMRI_ENGINE_FONT_EXT); + EMRICASE(EMRI_TYPE1_FONT_EXT); + EMRICASE(EMRI_DESIGNVECTOR_EXT); + EMRICASE(EMRI_SUBSET_FONT_EXT); + EMRICASE(EMRI_DELTA_FONT_EXT); + EMRICASE(EMRI_PS_JOB_DATA); + EMRICASE(EMRI_EMBED_FONT_EXT); + default: + printf("%u %08x\n", hdr->ulID, hdr->cjSize); + break; + } + + dump_data((const unsigned char *)(hdr + 1), hdr->cjSize, ""); + return off + sizeof(*hdr) + hdr->cjSize; +} + +enum FileSig get_kind_emfspool(void) +{ + const header *hdr; + + hdr = PRD(0, sizeof(*hdr)); + if (hdr && hdr->dwVersion == EMFSPOOL_VERSION) + return SIG_EMFSPOOL; + return SIG_UNKNOWN; +} + +void emfspool_dump(void) +{ + const WCHAR *doc_name, *output; + unsigned long off; + const header *hdr; + + hdr = PRD(0, sizeof(*hdr)); + if(!hdr) + return; + doc_name = read_wstr(hdr->dpszDocName); + output = read_wstr(hdr->dpszOutput); + + printf("File Header\n"); + printf(" %-20s %#x\n", "dwVersion:", hdr->dwVersion); + printf(" %-20s %#x\n", "cjSize:", hdr->cjSize); + printf(" %-20s %#x %s\n", "dpszDocName:", hdr->dpszDocName, get_unicode_str(doc_name, -1)); + printf(" %-20s %#x %s\n", "dpszOutput:", hdr->dpszOutput, get_unicode_str(output, -1)); + printf("\n"); + + off = hdr->cjSize; + while ((off = dump_emfspool_record(off))); +} diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h index 361f44b62b0..505470436d0 100644 --- a/tools/winedump/winedump.h +++ b/tools/winedump/winedump.h @@ -214,7 +214,7 @@ const char *get_machine_str(int mach);
/* file dumping functions */ enum FileSig {SIG_UNKNOWN, SIG_DOS, SIG_PE, SIG_DBG, SIG_PDB, SIG_NE, SIG_LE, SIG_MDMP, SIG_COFFLIB, SIG_LNK, - SIG_EMF, SIG_MF, SIG_FNT, SIG_TLB, SIG_NLS}; + SIG_EMF, SIG_EMFSPOOL, SIG_MF, SIG_FNT, SIG_TLB, SIG_NLS};
const void* PRD(unsigned long prd, unsigned long len); unsigned long Offset(const void* ptr); @@ -249,6 +249,8 @@ enum FileSig get_kind_lnk(void); void lnk_dump( void ); enum FileSig get_kind_emf(void); void emf_dump( void ); +enum FileSig get_kind_emfspool(void); +void emfspool_dump(void); enum FileSig get_kind_mf(void); void mf_dump(void); enum FileSig get_kind_pdb(void);
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/emf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/winedump/emf.c b/tools/winedump/emf.c index 48a67141ace..8c74702ecff 100644 --- a/tools/winedump/emf.c +++ b/tools/winedump/emf.c @@ -49,7 +49,7 @@ static const char *debugstr_wn(const WCHAR *wstr, unsigned int n) i = 0; p = buf; *p++ = '"'; - while (i < n && i < sizeof(buf) - 2 && wstr[i]) + while (i < n && i < sizeof(buf) - 3 && wstr[i]) { if (wstr[i] < 127) *p++ = wstr[i]; else *p++ = '.';
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/emf.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/tools/winedump/emf.c b/tools/winedump/emf.c index 8c74702ecff..f27a9903320 100644 --- a/tools/winedump/emf.c +++ b/tools/winedump/emf.c @@ -77,15 +77,13 @@ 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 offset = 0; - -static int dump_emfrecord(void) +static unsigned long dump_emfrecord(unsigned long offset) { const unsigned char* ptr; unsigned int type, length, i;
ptr = PRD(offset, 8); - if (!ptr) return -1; + if (!ptr) return 0;
type = read_int(ptr); length = read_int(ptr + 4); @@ -277,7 +275,7 @@ static int dump_emfrecord(void) }
if (length<sizeof(*header) || header->Size%4) - return -1; + return 0;
length -= sizeof(*header); offset += sizeof(*header); @@ -286,7 +284,7 @@ static int dump_emfrecord(void) { if (i%16 == 0) printf(" "); - if (!(ptr = PRD(offset, 4))) return -1; + if (!(ptr = PRD(offset, 4))) return 0; length -= 4; offset += 4; printf("%08x ", read_int(ptr)); @@ -295,7 +293,7 @@ static int dump_emfrecord(void) } }
- return 0; + return offset; }
break; @@ -463,7 +461,7 @@ static int dump_emfrecord(void) }
if ( (length < 8) || (length % 4) ) - return -1; + return 0;
length -= 8;
@@ -473,14 +471,14 @@ static int dump_emfrecord(void) { if (i%16 == 0) printf(" "); - if (!(ptr = PRD(offset, 4))) return -1; + if (!(ptr = PRD(offset, 4))) return 0; offset += 4; printf("%08x ", read_int(ptr)); if ( (i % 16 == 12) || (i + 4 == length)) printf("\n"); }
- return 0; + return offset; }
enum FileSig get_kind_emf(void) @@ -495,6 +493,6 @@ enum FileSig get_kind_emf(void)
void emf_dump(void) { - offset = 0; - while (!dump_emfrecord()); + unsigned long offset = 0; + while ((offset = dump_emfrecord(offset))); }
From: Piotr Caban piotr@codeweavers.com
--- 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);
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/emf.c | 93 ++++++++++++++++++++------------------- tools/winedump/emfspool.c | 2 +- tools/winedump/winedump.h | 2 +- 3 files changed, 49 insertions(+), 48 deletions(-)
diff --git a/tools/winedump/emf.c b/tools/winedump/emf.c index 9f73fc365e9..8a04886571c 100644 --- a/tools/winedump/emf.c +++ b/tools/winedump/emf.c @@ -74,10 +74,11 @@ static unsigned int read_int(const unsigned char *buffer) + (buffer[3]<<24); }
-#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 +#define EMRCASE(x) case x: printf("%s%-20s %08x\n", pfx, #x, length); break +#define EMRPLUSCASE(x) case x: printf("%s %-20s %04x %08x %08x\n", pfx, #x, \ + (UINT)header->Flags, (UINT)header->Size, (UINT)header->DataSize); break
-unsigned long dump_emfrecord(unsigned long offset) +unsigned long dump_emfrecord(const char *pfx, unsigned long offset) { const unsigned char* ptr; unsigned int type, length, i; @@ -94,12 +95,12 @@ unsigned long dump_emfrecord(unsigned long offset) { const ENHMETAHEADER *header = PRD(offset, sizeof(*header));
- printf("%-20s %08x\n", "EMR_HEADER", length); - printf("bounds (%s) frame (%s) signature %#x version %#x bytes %#x records %#x\n" - "handles %#x reserved %#x palette entries %#x px %dx%d mm %dx%d μm %dx%d opengl %d description %s\n", - debugstr_rect( &header->rclBounds ), debugstr_rect( &header->rclFrame ), + printf("%s%-20s %08x\n", pfx, "EMR_HEADER", length); + printf("%sbounds (%s) frame (%s) signature %#x version %#x bytes %#x records %#x\n" + "%shandles %#x reserved %#x palette entries %#x px %dx%d mm %dx%d μm %dx%d opengl %d description %s\n", + pfx, debugstr_rect( &header->rclBounds ), debugstr_rect( &header->rclFrame ), (UINT)header->dSignature, (UINT)header->nVersion, (UINT)header->nBytes, - (UINT)header->nRecords, (UINT)header->nHandles, header->sReserved, (UINT)header->nPalEntries, + (UINT)header->nRecords, pfx, (UINT)header->nHandles, header->sReserved, (UINT)header->nPalEntries, (UINT)header->szlDevice.cx, (UINT)header->szlDevice.cy, (UINT)header->szlMillimeters.cx, (UINT)header->szlMillimeters.cy, (UINT)header->szlMicrometers.cx, (UINT)header->szlMicrometers.cy, @@ -141,8 +142,8 @@ unsigned long dump_emfrecord(unsigned long offset) { const EMRINTERSECTCLIPRECT *clip = PRD(offset, sizeof(*clip));
- printf("%-20s %08x\n", "EMR_INTERSECTCLIPRECT", length); - printf("rect %s\n", debugstr_rect( &clip->rclClip )); + printf("%s%-20s %08x\n", pfx, "EMR_INTERSECTCLIPRECT", length); + printf("%srect %s\n", pfx, debugstr_rect( &clip->rclClip )); break; }
@@ -187,7 +188,7 @@ unsigned long dump_emfrecord(unsigned long offset)
case EMR_GDICOMMENT: { - printf("%-20s %08x\n", "EMR_GDICOMMENT", length); + printf("%s%-20s %08x\n", pfx, "EMR_GDICOMMENT", length);
/* Handle EMF+ records */ if (length >= 16 && !memcmp((char*)PRD(offset + 12, sizeof(unsigned int)), "EMF+", 4)) @@ -198,7 +199,7 @@ unsigned long dump_emfrecord(unsigned long offset) offset += 8; length -= 8; data_size = PRD(offset, sizeof(*data_size)); - printf("data size = %x\n", *data_size); + printf("%sdata size = %x\n", pfx, *data_size); offset += 8; length -= 8;
@@ -269,8 +270,8 @@ unsigned long dump_emfrecord(unsigned long offset) EMRPLUSCASE(EmfPlusRecordTotal);
default: - printf(" unknown EMF+ record %x %04x %08x\n", - (UINT)header->Type, (UINT)header->Flags, (UINT)header->Size); + printf("%s unknown EMF+ record %x %04x %08x\n", + pfx, (UINT)header->Type, (UINT)header->Flags, (UINT)header->Size); break; }
@@ -283,7 +284,7 @@ unsigned long dump_emfrecord(unsigned long offset) for (i=0; i<header->Size-sizeof(*header); i+=4) { if (i%16 == 0) - printf(" "); + printf("%s ", pfx); if (!(ptr = PRD(offset, 4))) return 0; length -= 4; offset += 4; @@ -314,10 +315,10 @@ unsigned long dump_emfrecord(unsigned long offset) if (length >= sizeof(*clip) + sizeof(*data)) rc_count = data->rdh.nCount;
- printf("%-20s %08x\n", "EMR_EXTSELECTCLIPRGN", length); - printf("mode %d, rects %d\n", (UINT)clip->iMode, rc_count); + printf("%s%-20s %08x\n", pfx, "EMR_EXTSELECTCLIPRGN", length); + printf("%smode %d, rects %d\n", pfx, (UINT)clip->iMode, rc_count); for (i = 0, rc = (const RECTL *)data->Buffer; i < rc_count; i++) - printf(" (%s)", debugstr_rect( &rc[i] )); + printf("%s (%s)", pfx, debugstr_rect( &rc[i] )); if (rc_count != 0) printf("\n"); break; } @@ -329,19 +330,19 @@ unsigned long dump_emfrecord(unsigned long offset) const EMRSTRETCHBLT *blt = PRD(offset, sizeof(*blt)); const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blt + blt->offBmiSrc);
- printf("%-20s %08x\n", "EMR_STRETCHBLT", length); - printf("bounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n" - "bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n", - debugstr_rect( &blt->rclBounds ), (UINT)blt->xDest, (UINT)blt->yDest, (UINT)blt->cxDest, (UINT)blt->cyDest, + printf("%s%-20s %08x\n", pfx, "EMR_STRETCHBLT", length); + printf("%sbounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n" + "%sbk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n", + pfx, debugstr_rect( &blt->rclBounds ), (UINT)blt->xDest, (UINT)blt->yDest, (UINT)blt->cxDest, (UINT)blt->cyDest, (UINT)blt->xSrc, (UINT)blt->ySrc, (UINT)blt->cxSrc, (UINT)blt->cySrc, (UINT)blt->dwRop, blt->xformSrc.eM11, blt->xformSrc.eM12, blt->xformSrc.eM21, blt->xformSrc.eM22, blt->xformSrc.eDx, blt->xformSrc.eDy, - (UINT)blt->crBkColorSrc, (UINT)blt->iUsageSrc, (UINT)blt->offBmiSrc, (UINT)blt->cbBmiSrc, + pfx, (UINT)blt->crBkColorSrc, (UINT)blt->iUsageSrc, (UINT)blt->offBmiSrc, (UINT)blt->cbBmiSrc, (UINT)blt->offBitsSrc, (UINT)blt->cbBitsSrc); - printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n" - "biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n", - (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes, - (UINT)bmih->biBitCount, (UINT)bmih->biCompression, (UINT)bmih->biSizeImage, + printf("%sBITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n" + "%sbiSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n", + pfx, (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes, + (UINT)bmih->biBitCount, (UINT)bmih->biCompression, pfx, (UINT)bmih->biSizeImage, (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed, (UINT)bmih->biClrImportant); break; @@ -357,9 +358,9 @@ unsigned long dump_emfrecord(unsigned long offset) const EMREXTCREATEFONTINDIRECTW *pf = PRD(offset, sizeof(*pf)); const LOGFONTW *plf = &pf->elfw.elfLogFont;
- printf("%-20s %08x\n", "EMR_EXTCREATEFONTINDIRECTW", length); - printf("(%d %d %d %d %x out %d clip %x quality %d charset %d) %s %s %s %s\n", - (UINT)plf->lfHeight, (UINT)plf->lfWidth, (UINT)plf->lfEscapement, (UINT)plf->lfOrientation, + printf("%s%-20s %08x\n", pfx, "EMR_EXTCREATEFONTINDIRECTW", length); + printf("%s(%d %d %d %d %x out %d clip %x quality %d charset %d) %s %s %s %s\n", + pfx, (UINT)plf->lfHeight, (UINT)plf->lfWidth, (UINT)plf->lfEscapement, (UINT)plf->lfOrientation, (UINT)plf->lfPitchAndFamily, (UINT)plf->lfOutPrecision, (UINT)plf->lfClipPrecision, plf->lfQuality, plf->lfCharSet, debugstr_wn(plf->lfFaceName, LF_FACESIZE), @@ -376,13 +377,13 @@ unsigned long dump_emfrecord(unsigned long offset) const EMREXTTEXTOUTW *etoW = PRD(offset, sizeof(*etoW)); const int *dx = (const int *)((const BYTE *)etoW + etoW->emrtext.offDx);
- printf("%-20s %08x\n", "EMR_EXTTEXTOUTW", length); - printf("bounds (%s) mode %#x x_scale %f y_scale %f pt (%d,%d) rect (%s) flags %#x, %s\n", - debugstr_rect( &etoW->rclBounds ), (UINT)etoW->iGraphicsMode, etoW->exScale, etoW->eyScale, + printf("%s%-20s %08x\n", pfx, "EMR_EXTTEXTOUTW", length); + printf("%sbounds (%s) mode %#x x_scale %f y_scale %f pt (%d,%d) rect (%s) flags %#x, %s\n", + pfx, debugstr_rect( &etoW->rclBounds ), (UINT)etoW->iGraphicsMode, etoW->exScale, etoW->eyScale, (UINT)etoW->emrtext.ptlReference.x, (UINT)etoW->emrtext.ptlReference.y, debugstr_rect( &etoW->emrtext.rcl ), (UINT)etoW->emrtext.fOptions, debugstr_wn((LPCWSTR)((const BYTE *)etoW + etoW->emrtext.offString), etoW->emrtext.nChars)); - printf("dx_offset %u {", (UINT)etoW->emrtext.offDx); + printf("%sdx_offset %u {", pfx, (UINT)etoW->emrtext.offDx); for (i = 0; i < etoW->emrtext.nChars; ++i) { printf("%d", dx[i]); @@ -428,19 +429,19 @@ unsigned long dump_emfrecord(unsigned long offset) const EMRALPHABLEND *blend = PRD(offset, sizeof(*blend)); const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blend + blend->offBmiSrc);
- printf("%-20s %08x\n", "EMR_ALPHABLEND", length); - printf("bounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n" - "bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n", - debugstr_rect( &blend->rclBounds ), (UINT)blend->xDest, (UINT)blend->yDest, (UINT)blend->cxDest, (UINT)blend->cyDest, + printf("%s%-20s %08x\n", pfx, "EMR_ALPHABLEND", length); + printf("%sbounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n" + "%sbk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n", + pfx, debugstr_rect( &blend->rclBounds ), (UINT)blend->xDest, (UINT)blend->yDest, (UINT)blend->cxDest, (UINT)blend->cyDest, (UINT)blend->xSrc, (UINT)blend->ySrc, (UINT)blend->cxSrc, (UINT)blend->cySrc, (UINT)blend->dwRop, blend->xformSrc.eM11, blend->xformSrc.eM12, blend->xformSrc.eM21, blend->xformSrc.eM22, blend->xformSrc.eDx, blend->xformSrc.eDy, - (UINT)blend->crBkColorSrc, (UINT)blend->iUsageSrc, (UINT)blend->offBmiSrc, + pfx, (UINT)blend->crBkColorSrc, (UINT)blend->iUsageSrc, (UINT)blend->offBmiSrc, (UINT)blend->cbBmiSrc, (UINT)blend->offBitsSrc, (UINT)blend->cbBitsSrc); - printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n" - "biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n", - (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes, - (UINT)bmih->biBitCount, (UINT)bmih->biCompression, (UINT)bmih->biSizeImage, + printf("%sBITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n" + "%sbiSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n", + pfx, (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes, + (UINT)bmih->biBitCount, (UINT)bmih->biCompression, pfx, (UINT)bmih->biSizeImage, (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed, (UINT)bmih->biClrImportant); break; @@ -456,7 +457,7 @@ unsigned long dump_emfrecord(unsigned long offset) EMRCASE(EMR_CREATECOLORSPACEW);
default: - printf("%u %08x\n", type, length); + printf("%s%u %08x\n", pfx, type, length); break; }
@@ -470,7 +471,7 @@ unsigned long dump_emfrecord(unsigned long offset) for(i=0; i<length; i+=4) { if (i%16 == 0) - printf(" "); + printf("%s ", pfx); if (!(ptr = PRD(offset, 4))) return 0; offset += 4; printf("%08x ", read_int(ptr)); @@ -494,5 +495,5 @@ enum FileSig get_kind_emf(void) void emf_dump(void) { unsigned long offset = 0; - while ((offset = dump_emfrecord(offset))); + while ((offset = dump_emfrecord("", offset))); } diff --git a/tools/winedump/emfspool.c b/tools/winedump/emfspool.c index d65e580b22e..9e591f6dd67 100644 --- a/tools/winedump/emfspool.c +++ b/tools/winedump/emfspool.c @@ -129,7 +129,7 @@ static unsigned long dump_emfspool_record(unsigned long off) 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); + while ((emf_off = dump_emfrecord(" ", emf_off)) && emf_off < off + sizeof(*hdr) + hdr->cjSize); break; }
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h index 09f4a9301e7..caa47392144 100644 --- a/tools/winedump/winedump.h +++ b/tools/winedump/winedump.h @@ -248,7 +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); +unsigned long dump_emfrecord(const char *pfx, unsigned long offset); void emf_dump( void ); enum FileSig get_kind_emfspool(void); void emfspool_dump(void);
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/emfspool.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/tools/winedump/emfspool.c b/tools/winedump/emfspool.c index 9e591f6dd67..7d6344facd1 100644 --- a/tools/winedump/emfspool.c +++ b/tools/winedump/emfspool.c @@ -61,6 +61,14 @@ typedef struct unsigned int cjSize; } record_hdr;
+static inline void print_longlong(ULONGLONG value) +{ + if (sizeof(value) > sizeof(unsigned long) && value >> 32) + printf("0x%lx%08lx", (unsigned long)(value >> 32), (unsigned long)value); + else + printf("0x%lx", (unsigned long)value); +} + static const WCHAR* read_wstr(unsigned long off) { const WCHAR *beg, *end; @@ -133,6 +141,20 @@ static unsigned long dump_emfspool_record(unsigned long off) break; }
+ case EMRI_METAFILE_EXT: + case EMRI_BW_METAFILE_EXT: + { + const ULONGLONG *emf_off = PRD(off + sizeof(*hdr), sizeof(*emf_off)); + if (!emf_off) + fatal("truncated file\n"); + printf(" %-20s ", "offset"); + print_longlong(*emf_off); + printf(" (absolute position "); + print_longlong(off - *emf_off); + printf(")\n"); + break; + } + default: dump_data((const unsigned char *)(hdr + 1), hdr->cjSize, ""); break;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125030
Your paranoid android.
=== debian11 (32 bit report) ===
ddraw: ddraw7.c:15663: Test failed: Expected unsynchronised map for flags 0x1000. ddraw7.c:15663: Test failed: Expected unsynchronised map for flags 0x3000.
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24751. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24751. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24751.