Commit 55fc9022 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Fix SetEnhMetaFileBits last error handling.

parent eceed527
...@@ -252,12 +252,16 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) ...@@ -252,12 +252,16 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
HENHMETAFILE hmf; HENHMETAFILE hmf;
ENHMETAFILEOBJ *metaObj; 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 */ (emh->nBytes & 3)) /* refuse to load unaligned EMF as Windows does */
{ {
WARN("Invalid emf header type 0x%08x sig 0x%08x.\n", WARN("Invalid emf header type 0x%08x sig 0x%08x.\n",
emh->iType, emh->dSignature); emh->iType, emh->dSignature);
SetLastError(ERROR_INVALID_DATA);
return 0; return 0;
} }
......
...@@ -2349,7 +2349,6 @@ static void test_SetEnhMetaFileBits(void) ...@@ -2349,7 +2349,6 @@ static void test_SetEnhMetaFileBits(void)
ok(!hemf || ok(!hemf ||
broken(hemf != NULL), /* Win9x, WinMe */ broken(hemf != NULL), /* Win9x, WinMe */
"SetEnhMetaFileBits should fail\n"); "SetEnhMetaFileBits should fail\n");
todo_wine
ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError());
DeleteEnhMetaFile(hemf); DeleteEnhMetaFile(hemf);
...@@ -2360,7 +2359,6 @@ static void test_SetEnhMetaFileBits(void) ...@@ -2360,7 +2359,6 @@ static void test_SetEnhMetaFileBits(void)
ok(!hemf || ok(!hemf ||
broken(hemf != NULL), /* Win9x, WinMe */ broken(hemf != NULL), /* Win9x, WinMe */
"SetEnhMetaFileBits should fail\n"); "SetEnhMetaFileBits should fail\n");
todo_wine
ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError());
DeleteEnhMetaFile(hemf); DeleteEnhMetaFile(hemf);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment