gdi32: Use documented structure layout for EMF-to-WMF embedding records.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-08-04 19:08:34 +03:00 committed by Alexandre Julliard
parent cade5944be
commit 0dab1e414a
3 changed files with 9 additions and 13 deletions

View file

@ -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)
{

View file

@ -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;

View file

@ -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;