user32/tests: Make the test_char_from_pos() failures more informative.
[wine.git] / tools / winedump / emf.c
blob48a67141ace7547ace859317cc69ac33021e8420
1 /*
2 * Dump an Enhanced Meta File
4 * Copyright 2005 Mike McCormack
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <stdio.h>
24 #include <fcntl.h>
25 #include <stdarg.h>
27 #include "winedump.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "gdiplusenums.h"
33 typedef struct
35 WORD Type;
36 WORD Flags;
37 DWORD Size;
38 DWORD DataSize;
39 } EmfPlusRecordHeader;
41 static const char *debugstr_wn(const WCHAR *wstr, unsigned int n)
43 static char buf[80];
44 char *p;
45 unsigned int i;
47 if (!wstr) return "(null)";
49 i = 0;
50 p = buf;
51 *p++ = '\"';
52 while (i < n && i < sizeof(buf) - 2 && wstr[i])
54 if (wstr[i] < 127) *p++ = wstr[i];
55 else *p++ = '.';
56 i++;
58 *p++ = '\"';
59 *p = 0;
60 return buf;
63 static const char *debugstr_rect(const RECTL *rect)
65 return strmake( "%d,%d - %d,%d",
66 (UINT)rect->left, (UINT)rect->top, (UINT)rect->right, (UINT)rect->bottom );
69 static unsigned int read_int(const unsigned char *buffer)
71 return buffer[0]
72 + (buffer[1]<<8)
73 + (buffer[2]<<16)
74 + (buffer[3]<<24);
77 #define EMRCASE(x) case x: printf("%-20s %08x\n", #x, length); break
78 #define EMRPLUSCASE(x) case x: printf(" %-20s %04x %08x %08x\n", #x, (UINT)header->Flags, (UINT)header->Size, (UINT)header->DataSize); break
80 static unsigned offset = 0;
82 static int dump_emfrecord(void)
84 const unsigned char* ptr;
85 unsigned int type, length, i;
87 ptr = PRD(offset, 8);
88 if (!ptr) return -1;
90 type = read_int(ptr);
91 length = read_int(ptr + 4);
93 switch(type)
95 case EMR_HEADER:
97 const ENHMETAHEADER *header = PRD(offset, sizeof(*header));
99 printf("%-20s %08x\n", "EMR_HEADER", length);
100 printf("bounds (%s) frame (%s) signature %#x version %#x bytes %#x records %#x\n"
101 "handles %#x reserved %#x palette entries %#x px %dx%d mm %dx%d μm %dx%d opengl %d description %s\n",
102 debugstr_rect( &header->rclBounds ), debugstr_rect( &header->rclFrame ),
103 (UINT)header->dSignature, (UINT)header->nVersion, (UINT)header->nBytes,
104 (UINT)header->nRecords, (UINT)header->nHandles, header->sReserved, (UINT)header->nPalEntries,
105 (UINT)header->szlDevice.cx, (UINT)header->szlDevice.cy,
106 (UINT)header->szlMillimeters.cx, (UINT)header->szlMillimeters.cy,
107 (UINT)header->szlMicrometers.cx, (UINT)header->szlMicrometers.cy,
108 (UINT)header->bOpenGL,
109 debugstr_wn((LPCWSTR)((const BYTE *)header + header->offDescription), header->nDescription));
110 break;
113 EMRCASE(EMR_POLYBEZIER);
114 EMRCASE(EMR_POLYGON);
115 EMRCASE(EMR_POLYLINE);
116 EMRCASE(EMR_POLYBEZIERTO);
117 EMRCASE(EMR_POLYLINETO);
118 EMRCASE(EMR_POLYPOLYLINE);
119 EMRCASE(EMR_POLYPOLYGON);
120 EMRCASE(EMR_SETWINDOWEXTEX);
121 EMRCASE(EMR_SETWINDOWORGEX);
122 EMRCASE(EMR_SETVIEWPORTEXTEX);
123 EMRCASE(EMR_SETVIEWPORTORGEX);
124 EMRCASE(EMR_SETBRUSHORGEX);
125 EMRCASE(EMR_EOF);
126 EMRCASE(EMR_SETPIXELV);
127 EMRCASE(EMR_SETMAPPERFLAGS);
128 EMRCASE(EMR_SETMAPMODE);
129 EMRCASE(EMR_SETBKMODE);
130 EMRCASE(EMR_SETPOLYFILLMODE);
131 EMRCASE(EMR_SETROP2);
132 EMRCASE(EMR_SETSTRETCHBLTMODE);
133 EMRCASE(EMR_SETTEXTALIGN);
134 EMRCASE(EMR_SETCOLORADJUSTMENT);
135 EMRCASE(EMR_SETTEXTCOLOR);
136 EMRCASE(EMR_SETBKCOLOR);
137 EMRCASE(EMR_OFFSETCLIPRGN);
138 EMRCASE(EMR_MOVETOEX);
139 EMRCASE(EMR_SETMETARGN);
140 EMRCASE(EMR_EXCLUDECLIPRECT);
142 case EMR_INTERSECTCLIPRECT:
144 const EMRINTERSECTCLIPRECT *clip = PRD(offset, sizeof(*clip));
146 printf("%-20s %08x\n", "EMR_INTERSECTCLIPRECT", length);
147 printf("rect %s\n", debugstr_rect( &clip->rclClip ));
148 break;
151 EMRCASE(EMR_SCALEVIEWPORTEXTEX);
152 EMRCASE(EMR_SCALEWINDOWEXTEX);
153 EMRCASE(EMR_SAVEDC);
154 EMRCASE(EMR_RESTOREDC);
155 EMRCASE(EMR_SETWORLDTRANSFORM);
156 EMRCASE(EMR_MODIFYWORLDTRANSFORM);
157 EMRCASE(EMR_SELECTOBJECT);
158 EMRCASE(EMR_CREATEPEN);
159 EMRCASE(EMR_CREATEBRUSHINDIRECT);
160 EMRCASE(EMR_DELETEOBJECT);
161 EMRCASE(EMR_ANGLEARC);
162 EMRCASE(EMR_ELLIPSE);
163 EMRCASE(EMR_RECTANGLE);
164 EMRCASE(EMR_ROUNDRECT);
165 EMRCASE(EMR_ARC);
166 EMRCASE(EMR_CHORD);
167 EMRCASE(EMR_PIE);
168 EMRCASE(EMR_SELECTPALETTE);
169 EMRCASE(EMR_CREATEPALETTE);
170 EMRCASE(EMR_SETPALETTEENTRIES);
171 EMRCASE(EMR_RESIZEPALETTE);
172 EMRCASE(EMR_REALIZEPALETTE);
173 EMRCASE(EMR_EXTFLOODFILL);
174 EMRCASE(EMR_LINETO);
175 EMRCASE(EMR_ARCTO);
176 EMRCASE(EMR_POLYDRAW);
177 EMRCASE(EMR_SETARCDIRECTION);
178 EMRCASE(EMR_SETMITERLIMIT);
179 EMRCASE(EMR_BEGINPATH);
180 EMRCASE(EMR_ENDPATH);
181 EMRCASE(EMR_CLOSEFIGURE);
182 EMRCASE(EMR_FILLPATH);
183 EMRCASE(EMR_STROKEANDFILLPATH);
184 EMRCASE(EMR_STROKEPATH);
185 EMRCASE(EMR_FLATTENPATH);
186 EMRCASE(EMR_WIDENPATH);
187 EMRCASE(EMR_SELECTCLIPPATH);
188 EMRCASE(EMR_ABORTPATH);
190 case EMR_GDICOMMENT:
192 printf("%-20s %08x\n", "EMR_GDICOMMENT", length);
194 /* Handle EMF+ records */
195 if (length >= 16 && !memcmp((char*)PRD(offset + 12, sizeof(unsigned int)), "EMF+", 4))
197 const EmfPlusRecordHeader *header;
198 const unsigned int *data_size;
200 offset += 8;
201 length -= 8;
202 data_size = PRD(offset, sizeof(*data_size));
203 printf("data size = %x\n", *data_size);
204 offset += 8;
205 length -= 8;
207 while (length >= sizeof(*header))
209 header = PRD(offset, sizeof(*header));
210 switch(header->Type)
212 EMRPLUSCASE(EmfPlusRecordTypeInvalid);
213 EMRPLUSCASE(EmfPlusRecordTypeHeader);
214 EMRPLUSCASE(EmfPlusRecordTypeEndOfFile);
215 EMRPLUSCASE(EmfPlusRecordTypeComment);
216 EMRPLUSCASE(EmfPlusRecordTypeGetDC);
217 EMRPLUSCASE(EmfPlusRecordTypeMultiFormatStart);
218 EMRPLUSCASE(EmfPlusRecordTypeMultiFormatSection);
219 EMRPLUSCASE(EmfPlusRecordTypeMultiFormatEnd);
220 EMRPLUSCASE(EmfPlusRecordTypeObject);
221 EMRPLUSCASE(EmfPlusRecordTypeClear);
222 EMRPLUSCASE(EmfPlusRecordTypeFillRects);
223 EMRPLUSCASE(EmfPlusRecordTypeDrawRects);
224 EMRPLUSCASE(EmfPlusRecordTypeFillPolygon);
225 EMRPLUSCASE(EmfPlusRecordTypeDrawLines);
226 EMRPLUSCASE(EmfPlusRecordTypeFillEllipse);
227 EMRPLUSCASE(EmfPlusRecordTypeDrawEllipse);
228 EMRPLUSCASE(EmfPlusRecordTypeFillPie);
229 EMRPLUSCASE(EmfPlusRecordTypeDrawPie);
230 EMRPLUSCASE(EmfPlusRecordTypeDrawArc);
231 EMRPLUSCASE(EmfPlusRecordTypeFillRegion);
232 EMRPLUSCASE(EmfPlusRecordTypeFillPath);
233 EMRPLUSCASE(EmfPlusRecordTypeDrawPath);
234 EMRPLUSCASE(EmfPlusRecordTypeFillClosedCurve);
235 EMRPLUSCASE(EmfPlusRecordTypeDrawClosedCurve);
236 EMRPLUSCASE(EmfPlusRecordTypeDrawCurve);
237 EMRPLUSCASE(EmfPlusRecordTypeDrawBeziers);
238 EMRPLUSCASE(EmfPlusRecordTypeDrawImage);
239 EMRPLUSCASE(EmfPlusRecordTypeDrawImagePoints);
240 EMRPLUSCASE(EmfPlusRecordTypeDrawString);
241 EMRPLUSCASE(EmfPlusRecordTypeSetRenderingOrigin);
242 EMRPLUSCASE(EmfPlusRecordTypeSetAntiAliasMode);
243 EMRPLUSCASE(EmfPlusRecordTypeSetTextRenderingHint);
244 EMRPLUSCASE(EmfPlusRecordTypeSetTextContrast);
245 EMRPLUSCASE(EmfPlusRecordTypeSetInterpolationMode);
246 EMRPLUSCASE(EmfPlusRecordTypeSetPixelOffsetMode);
247 EMRPLUSCASE(EmfPlusRecordTypeSetCompositingMode);
248 EMRPLUSCASE(EmfPlusRecordTypeSetCompositingQuality);
249 EMRPLUSCASE(EmfPlusRecordTypeSave);
250 EMRPLUSCASE(EmfPlusRecordTypeRestore);
251 EMRPLUSCASE(EmfPlusRecordTypeBeginContainer);
252 EMRPLUSCASE(EmfPlusRecordTypeBeginContainerNoParams);
253 EMRPLUSCASE(EmfPlusRecordTypeEndContainer);
254 EMRPLUSCASE(EmfPlusRecordTypeSetWorldTransform);
255 EMRPLUSCASE(EmfPlusRecordTypeResetWorldTransform);
256 EMRPLUSCASE(EmfPlusRecordTypeMultiplyWorldTransform);
257 EMRPLUSCASE(EmfPlusRecordTypeTranslateWorldTransform);
258 EMRPLUSCASE(EmfPlusRecordTypeScaleWorldTransform);
259 EMRPLUSCASE(EmfPlusRecordTypeRotateWorldTransform);
260 EMRPLUSCASE(EmfPlusRecordTypeSetPageTransform);
261 EMRPLUSCASE(EmfPlusRecordTypeResetClip);
262 EMRPLUSCASE(EmfPlusRecordTypeSetClipRect);
263 EMRPLUSCASE(EmfPlusRecordTypeSetClipPath);
264 EMRPLUSCASE(EmfPlusRecordTypeSetClipRegion);
265 EMRPLUSCASE(EmfPlusRecordTypeOffsetClip);
266 EMRPLUSCASE(EmfPlusRecordTypeDrawDriverString);
267 EMRPLUSCASE(EmfPlusRecordTypeStrokeFillPath);
268 EMRPLUSCASE(EmfPlusRecordTypeSerializableObject);
269 EMRPLUSCASE(EmfPlusRecordTypeSetTSGraphics);
270 EMRPLUSCASE(EmfPlusRecordTypeSetTSClip);
271 EMRPLUSCASE(EmfPlusRecordTotal);
273 default:
274 printf(" unknown EMF+ record %x %04x %08x\n",
275 (UINT)header->Type, (UINT)header->Flags, (UINT)header->Size);
276 break;
279 if (length<sizeof(*header) || header->Size%4)
280 return -1;
282 length -= sizeof(*header);
283 offset += sizeof(*header);
285 for (i=0; i<header->Size-sizeof(*header); i+=4)
287 if (i%16 == 0)
288 printf(" ");
289 if (!(ptr = PRD(offset, 4))) return -1;
290 length -= 4;
291 offset += 4;
292 printf("%08x ", read_int(ptr));
293 if ((i % 16 == 12) || (i + 4 == header->Size - sizeof(*header)))
294 printf("\n");
298 return 0;
301 break;
304 EMRCASE(EMR_FILLRGN);
305 EMRCASE(EMR_FRAMERGN);
306 EMRCASE(EMR_INVERTRGN);
307 EMRCASE(EMR_PAINTRGN);
309 case EMR_EXTSELECTCLIPRGN:
311 const EMREXTSELECTCLIPRGN *clip = PRD(offset, sizeof(*clip));
312 const RGNDATA *data = (const RGNDATA *)clip->RgnData;
313 UINT i, rc_count = 0;
314 const RECTL *rc;
316 if (length >= sizeof(*clip) + sizeof(*data))
317 rc_count = data->rdh.nCount;
319 printf("%-20s %08x\n", "EMR_EXTSELECTCLIPRGN", length);
320 printf("mode %d, rects %d\n", (UINT)clip->iMode, rc_count);
321 for (i = 0, rc = (const RECTL *)data->Buffer; i < rc_count; i++)
322 printf(" (%s)", debugstr_rect( &rc[i] ));
323 if (rc_count != 0) printf("\n");
324 break;
327 EMRCASE(EMR_BITBLT);
329 case EMR_STRETCHBLT:
331 const EMRSTRETCHBLT *blt = PRD(offset, sizeof(*blt));
332 const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blt + blt->offBmiSrc);
334 printf("%-20s %08x\n", "EMR_STRETCHBLT", length);
335 printf("bounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n"
336 "bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n",
337 debugstr_rect( &blt->rclBounds ), (UINT)blt->xDest, (UINT)blt->yDest, (UINT)blt->cxDest, (UINT)blt->cyDest,
338 (UINT)blt->xSrc, (UINT)blt->ySrc, (UINT)blt->cxSrc, (UINT)blt->cySrc, (UINT)blt->dwRop,
339 blt->xformSrc.eM11, blt->xformSrc.eM12, blt->xformSrc.eM21,
340 blt->xformSrc.eM22, blt->xformSrc.eDx, blt->xformSrc.eDy,
341 (UINT)blt->crBkColorSrc, (UINT)blt->iUsageSrc, (UINT)blt->offBmiSrc, (UINT)blt->cbBmiSrc,
342 (UINT)blt->offBitsSrc, (UINT)blt->cbBitsSrc);
343 printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n"
344 "biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n",
345 (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes,
346 (UINT)bmih->biBitCount, (UINT)bmih->biCompression, (UINT)bmih->biSizeImage,
347 (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed,
348 (UINT)bmih->biClrImportant);
349 break;
352 EMRCASE(EMR_MASKBLT);
353 EMRCASE(EMR_PLGBLT);
354 EMRCASE(EMR_SETDIBITSTODEVICE);
355 EMRCASE(EMR_STRETCHDIBITS);
357 case EMR_EXTCREATEFONTINDIRECTW:
359 const EMREXTCREATEFONTINDIRECTW *pf = PRD(offset, sizeof(*pf));
360 const LOGFONTW *plf = &pf->elfw.elfLogFont;
362 printf("%-20s %08x\n", "EMR_EXTCREATEFONTINDIRECTW", length);
363 printf("(%d %d %d %d %x out %d clip %x quality %d charset %d) %s %s %s %s\n",
364 (UINT)plf->lfHeight, (UINT)plf->lfWidth, (UINT)plf->lfEscapement, (UINT)plf->lfOrientation,
365 (UINT)plf->lfPitchAndFamily, (UINT)plf->lfOutPrecision, (UINT)plf->lfClipPrecision,
366 plf->lfQuality, plf->lfCharSet,
367 debugstr_wn(plf->lfFaceName, LF_FACESIZE),
368 plf->lfWeight > 400 ? "Bold" : "",
369 plf->lfItalic ? "Italic" : "",
370 plf->lfUnderline ? "Underline" : "");
371 break;
374 EMRCASE(EMR_EXTTEXTOUTA);
376 case EMR_EXTTEXTOUTW:
378 const EMREXTTEXTOUTW *etoW = PRD(offset, sizeof(*etoW));
379 const int *dx = (const int *)((const BYTE *)etoW + etoW->emrtext.offDx);
381 printf("%-20s %08x\n", "EMR_EXTTEXTOUTW", length);
382 printf("bounds (%s) mode %#x x_scale %f y_scale %f pt (%d,%d) rect (%s) flags %#x, %s\n",
383 debugstr_rect( &etoW->rclBounds ), (UINT)etoW->iGraphicsMode, etoW->exScale, etoW->eyScale,
384 (UINT)etoW->emrtext.ptlReference.x, (UINT)etoW->emrtext.ptlReference.y,
385 debugstr_rect( &etoW->emrtext.rcl ), (UINT)etoW->emrtext.fOptions,
386 debugstr_wn((LPCWSTR)((const BYTE *)etoW + etoW->emrtext.offString), etoW->emrtext.nChars));
387 printf("dx_offset %u {", (UINT)etoW->emrtext.offDx);
388 for (i = 0; i < etoW->emrtext.nChars; ++i)
390 printf("%d", dx[i]);
391 if (i != etoW->emrtext.nChars - 1)
392 putchar(',');
394 printf("}\n");
395 break;
398 EMRCASE(EMR_POLYBEZIER16);
399 EMRCASE(EMR_POLYGON16);
400 EMRCASE(EMR_POLYLINE16);
401 EMRCASE(EMR_POLYBEZIERTO16);
402 EMRCASE(EMR_POLYLINETO16);
403 EMRCASE(EMR_POLYPOLYLINE16);
404 EMRCASE(EMR_POLYPOLYGON16);
405 EMRCASE(EMR_POLYDRAW16);
406 EMRCASE(EMR_CREATEMONOBRUSH);
407 EMRCASE(EMR_CREATEDIBPATTERNBRUSHPT);
408 EMRCASE(EMR_EXTCREATEPEN);
409 EMRCASE(EMR_POLYTEXTOUTA);
410 EMRCASE(EMR_POLYTEXTOUTW);
411 EMRCASE(EMR_SETICMMODE);
412 EMRCASE(EMR_CREATECOLORSPACE);
413 EMRCASE(EMR_SETCOLORSPACE);
414 EMRCASE(EMR_DELETECOLORSPACE);
415 EMRCASE(EMR_GLSRECORD);
416 EMRCASE(EMR_GLSBOUNDEDRECORD);
417 EMRCASE(EMR_PIXELFORMAT);
418 EMRCASE(EMR_DRAWESCAPE);
419 EMRCASE(EMR_EXTESCAPE);
420 EMRCASE(EMR_STARTDOC);
421 EMRCASE(EMR_SMALLTEXTOUT);
422 EMRCASE(EMR_FORCEUFIMAPPING);
423 EMRCASE(EMR_NAMEDESCAPE);
424 EMRCASE(EMR_COLORCORRECTPALETTE);
425 EMRCASE(EMR_SETICMPROFILEA);
426 EMRCASE(EMR_SETICMPROFILEW);
428 case EMR_ALPHABLEND:
430 const EMRALPHABLEND *blend = PRD(offset, sizeof(*blend));
431 const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blend + blend->offBmiSrc);
433 printf("%-20s %08x\n", "EMR_ALPHABLEND", length);
434 printf("bounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n"
435 "bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n",
436 debugstr_rect( &blend->rclBounds ), (UINT)blend->xDest, (UINT)blend->yDest, (UINT)blend->cxDest, (UINT)blend->cyDest,
437 (UINT)blend->xSrc, (UINT)blend->ySrc, (UINT)blend->cxSrc, (UINT)blend->cySrc,
438 (UINT)blend->dwRop, blend->xformSrc.eM11, blend->xformSrc.eM12, blend->xformSrc.eM21,
439 blend->xformSrc.eM22, blend->xformSrc.eDx, blend->xformSrc.eDy,
440 (UINT)blend->crBkColorSrc, (UINT)blend->iUsageSrc, (UINT)blend->offBmiSrc,
441 (UINT)blend->cbBmiSrc, (UINT)blend->offBitsSrc, (UINT)blend->cbBitsSrc);
442 printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n"
443 "biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n",
444 (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes,
445 (UINT)bmih->biBitCount, (UINT)bmih->biCompression, (UINT)bmih->biSizeImage,
446 (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed,
447 (UINT)bmih->biClrImportant);
448 break;
451 EMRCASE(EMR_SETLAYOUT);
452 EMRCASE(EMR_TRANSPARENTBLT);
453 EMRCASE(EMR_RESERVED_117);
454 EMRCASE(EMR_GRADIENTFILL);
455 EMRCASE(EMR_SETLINKEDUFI);
456 EMRCASE(EMR_SETTEXTJUSTIFICATION);
457 EMRCASE(EMR_COLORMATCHTOTARGETW);
458 EMRCASE(EMR_CREATECOLORSPACEW);
460 default:
461 printf("%u %08x\n", type, length);
462 break;
465 if ( (length < 8) || (length % 4) )
466 return -1;
468 length -= 8;
470 offset += 8;
472 for(i=0; i<length; i+=4)
474 if (i%16 == 0)
475 printf(" ");
476 if (!(ptr = PRD(offset, 4))) return -1;
477 offset += 4;
478 printf("%08x ", read_int(ptr));
479 if ( (i % 16 == 12) || (i + 4 == length))
480 printf("\n");
483 return 0;
486 enum FileSig get_kind_emf(void)
488 const ENHMETAHEADER* hdr;
490 hdr = PRD(0, sizeof(*hdr));
491 if (hdr && hdr->iType == EMR_HEADER && hdr->dSignature == ENHMETA_SIGNATURE)
492 return SIG_EMF;
493 return SIG_UNKNOWN;
496 void emf_dump(void)
498 offset = 0;
499 while (!dump_emfrecord());