Commit 1025ff0c authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

Implement CopyEnhMetaFileW.

parent f1f3b915
......@@ -31,7 +31,7 @@
@ stdcall CombineRgn(long long long long)
@ stdcall CombineTransform(ptr ptr ptr)
@ stdcall CopyEnhMetaFileA(long str)
@ stub CopyEnhMetaFileW
@ stdcall CopyEnhMetaFileW(long wstr)
@ stdcall CopyMetaFileA(long str)
@ stdcall CopyMetaFileW(long wstr)
@ stdcall CreateBitmap(long long long long ptr)
......
......@@ -2248,6 +2248,43 @@ HENHMETAFILE WINAPI CopyEnhMetaFileA(
return hmfDst;
}
/*****************************************************************************
* CopyEnhMetaFileW (GDI32.@) Duplicate an enhanced metafile
*
*
*/
HENHMETAFILE WINAPI CopyEnhMetaFileW(
HENHMETAFILE hmfSrc,
LPCWSTR file)
{
ENHMETAHEADER *emrSrc = EMF_GetEnhMetaHeader( hmfSrc ), *emrDst;
HENHMETAFILE hmfDst;
if(!emrSrc) return FALSE;
if (!file) {
emrDst = HeapAlloc( GetProcessHeap(), 0, emrSrc->nBytes );
memcpy( emrDst, emrSrc, emrSrc->nBytes );
hmfDst = EMF_Create_HENHMETAFILE( emrDst, FALSE );
} else {
HANDLE hFile;
hFile = CreateFileW( file, GENERIC_WRITE | GENERIC_READ, 0,
NULL, CREATE_ALWAYS, 0, 0);
WriteFile( hFile, emrSrc, emrSrc->nBytes, 0, 0);
CloseHandle( hFile );
/* Reopen file for reading only, so that apps can share
read access to the file while hmf is still valid */
hFile = CreateFileW( file, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, 0);
if(hFile == INVALID_HANDLE_VALUE) {
ERR("Can't reopen emf for reading\n");
return 0;
}
hmfDst = EMF_GetEnhMetaFile( hFile );
CloseHandle( hFile );
}
return hmfDst;
}
/* Struct to be used to be passed in the LPVOID parameter for cbEnhPaletteCopy */
typedef struct tagEMF_PaletteCopy
......
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