From 55fc90220fea198ff9a62154e8a411b6de78e928 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 7 Apr 2009 20:44:12 +0200 Subject: [PATCH] gdi32: Fix SetEnhMetaFileBits last error handling. --- dlls/gdi32/enhmetafile.c | 8 ++++++-- dlls/gdi32/tests/metafile.c | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/enhmetafile.c b/dlls/gdi32/enhmetafile.c index 9ca85177eb9..25b33894ab4 100644 --- a/dlls/gdi32/enhmetafile.c +++ b/dlls/gdi32/enhmetafile.c @@ -252,12 +252,16 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) HENHMETAFILE hmf; ENHMETAFILEOBJ *metaObj; - if (emh->iType != EMR_HEADER || emh->dSignature != ENHMETA_SIGNATURE || + if (emh->iType != EMR_HEADER) + { + SetLastError(ERROR_INVALID_DATA); + return 0; + } + if (emh->dSignature != ENHMETA_SIGNATURE || (emh->nBytes & 3)) /* refuse to load unaligned EMF as Windows does */ { WARN("Invalid emf header type 0x%08x sig 0x%08x.\n", emh->iType, emh->dSignature); - SetLastError(ERROR_INVALID_DATA); return 0; } diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index 233d1e9a9da..077977ec0de 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -2349,7 +2349,6 @@ static void test_SetEnhMetaFileBits(void) ok(!hemf || broken(hemf != NULL), /* Win9x, WinMe */ "SetEnhMetaFileBits should fail\n"); - todo_wine ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError()); DeleteEnhMetaFile(hemf); @@ -2360,7 +2359,6 @@ static void test_SetEnhMetaFileBits(void) ok(!hemf || broken(hemf != NULL), /* Win9x, WinMe */ "SetEnhMetaFileBits should fail\n"); - todo_wine ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError()); DeleteEnhMetaFile(hemf); }