A metafile is pretty simple, just a set of records that match the GDI functions you called to generate it. Each record has a number that corresponds to the specific GDI function, followed by the argument values you passed to that function. The declaration of the record from the winapi:
typedef struct tagENHMETARECORD {
DWORD iType;
DWORD nSize;
DWORD dParm[1];
} ENHMETARECORD, *PENHMETARECORD;
iType is the function number, nSize is the size of the record, dParm stores the function argument values.
So when you call PlayMetafile(), Windows simply makes the exact same GDI function calls again. The HDC argument you pass determines where the drawing output will go. Easy peasy.