PlayMetaFile and EnumMetaFile should work if the hdc is a
(enh)metafile DC.
diff --git a/objects/metafile.c b/objects/metafile.c
index 6a23ac4..f16d1ba 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -472,7 +472,6 @@
HPEN hPen;
HBRUSH hBrush;
HFONT hFont;
- DC *dc;
BOOL loaded = FALSE;
if (!mh) return FALSE;
@@ -483,11 +482,10 @@
}
/* save the current pen, brush and font */
- if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
- hPen = dc->w.hPen;
- hBrush = dc->w.hBrush;
- hFont = dc->w.hFont;
- GDI_HEAP_UNLOCK(hdc);
+ hPen = GetCurrentObject(hdc, OBJ_PEN);
+ hBrush = GetCurrentObject(hdc, OBJ_BRUSH);
+ hFont = GetCurrentObject(hdc, OBJ_FONT);
+
/* create the handle table */
ht = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY,
sizeof(HANDLETABLE16) * mh->mtNoObjects);
@@ -575,7 +573,6 @@
HPEN hPen;
HBRUSH hBrush;
HFONT hFont;
- DC *dc;
BOOL16 result = TRUE, loaded = FALSE;
TRACE("(%04x, %04x, %08lx, %08lx)\n",
@@ -589,11 +586,10 @@
loaded = TRUE;
}
- if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
- hPen = dc->w.hPen;
- hBrush = dc->w.hBrush;
- hFont = dc->w.hFont;
- GDI_HEAP_UNLOCK(hdc);
+ /* save the current pen, brush and font */
+ hPen = GetCurrentObject(hdc, OBJ_PEN);
+ hBrush = GetCurrentObject(hdc, OBJ_BRUSH);
+ hFont = GetCurrentObject(hdc, OBJ_FONT);
/* create the handle table */
@@ -665,7 +661,6 @@
HANDLETABLE *ht;
BOOL result = TRUE, loaded = FALSE;
int i, offset = 0;
- DC *dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
HPEN hPen;
HBRUSH hBrush;
HFONT hFont;
@@ -680,12 +675,9 @@
}
/* save the current pen, brush and font */
- if (!dc) return 0;
- hPen = dc->w.hPen;
- hBrush = dc->w.hBrush;
- hFont = dc->w.hFont;
- GDI_HEAP_UNLOCK(hdc);
-
+ hPen = GetCurrentObject(hdc, OBJ_PEN);
+ hBrush = GetCurrentObject(hdc, OBJ_BRUSH);
+ hFont = GetCurrentObject(hdc, OBJ_FONT);
ht = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY,
sizeof(HANDLETABLE) * mh->mtNoObjects);