Alexandre Julliard : gdi32: Fix SetEnhMetaFileBits last error handling.

Alexandre Julliard julliard at winehq.org
Wed Apr 8 10:05:31 CDT 2009


Module: wine
Branch: master
Commit: 55fc90220fea198ff9a62154e8a411b6de78e928
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=55fc90220fea198ff9a62154e8a411b6de78e928

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr  7 20:44:12 2009 +0200

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 9ca8517..25b3389 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 233d1e9..077977e 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);
 }




More information about the wine-cvs mailing list