Nikolay Sivov : gdi32: Use documented structure layout for EMF-to-WMF embedding records.
Alexandre Julliard
julliard at winehq.org
Thu Aug 5 16:13:38 CDT 2021
Module: wine
Branch: master
Commit: 0dab1e414a91fc78f9c5ff7c825bd3eafc33b829
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0dab1e414a91fc78f9c5ff7c825bd3eafc33b829
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Aug 4 19:08:34 2021 +0300
gdi32: Use documented structure layout for EMF-to-WMF embedding records.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/enhmetafile.c | 2 +-
dlls/gdi32/metafile.c | 10 ++++------
dlls/gdi32/ntgdi_private.h | 10 ++++------
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/dlls/gdi32/enhmetafile.c b/dlls/gdi32/enhmetafile.c
index 25ffcff93bf..b12db98d9e6 100644
--- a/dlls/gdi32/enhmetafile.c
+++ b/dlls/gdi32/enhmetafile.c
@@ -2804,7 +2804,7 @@ static HENHMETAFILE extract_emf_from_comment( const BYTE *buf, UINT mf_size )
chunk = (emf_in_wmf_comment *)(mr->rdParm + 2);
if (mr->rdFunction != META_ESCAPE || mr->rdParm[0] != MFCOMMENT) goto done;
- if (chunk->magic != WMFC_MAGIC) goto done;
+ if (chunk->comment_id != WMFC_MAGIC) goto done;
if (!emf_bits)
{
diff --git a/dlls/gdi32/metafile.c b/dlls/gdi32/metafile.c
index b0428960b50..6b4df5680ba 100644
--- a/dlls/gdi32/metafile.c
+++ b/dlls/gdi32/metafile.c
@@ -1096,13 +1096,11 @@ static BOOL add_mf_comment(HDC hdc, HENHMETAFILE emf)
chunk = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(emf_in_wmf_comment, emf_data[max_chunk_size]));
if(!chunk) goto end;
- chunk->magic = WMFC_MAGIC;
- chunk->unk04 = 1;
- chunk->unk06 = 0;
- chunk->unk08 = 0;
- chunk->unk0a = 1;
+ chunk->comment_id = WMFC_MAGIC;
+ chunk->comment_type = 0x1;
+ chunk->version = 0x00010000;
chunk->checksum = 0; /* We fixup the first chunk's checksum before returning from GetWinMetaFileBits */
- chunk->unk0e = 0;
+ chunk->flags = 0;
chunk->num_chunks = (size + max_chunk_size - 1) / max_chunk_size;
chunk->chunk_size = max_chunk_size;
chunk->remaining_size = size;
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index 5f3f88f870c..d256a356d01 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -462,13 +462,11 @@ extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
#include <pshpack2.h>
typedef struct
{
- DWORD magic; /* WMFC */
- WORD unk04; /* 1 */
- WORD unk06; /* 0 */
- WORD unk08; /* 0 */
- WORD unk0a; /* 1 */
+ DWORD comment_id; /* WMFC */
+ DWORD comment_type; /* Always 0x00000001 */
+ DWORD version; /* Always 0x00010000 */
WORD checksum;
- DWORD unk0e; /* 0 */
+ DWORD flags; /* Always 0 */
DWORD num_chunks;
DWORD chunk_size;
DWORD remaining_size;
More information about the wine-cvs
mailing list