Unicodify CreateMetaFile.
This commit is contained in:
parent
7b8d745a4f
commit
4eaf41b535
|
@ -356,7 +356,7 @@ extern BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc);
|
||||||
/* metafile.c */
|
/* metafile.c */
|
||||||
extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh);
|
extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh);
|
||||||
extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh);
|
extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh);
|
||||||
extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCSTR filename);
|
extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode );
|
||||||
|
|
||||||
/* path.c */
|
/* path.c */
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ static BOOL MFDRV_DeleteDC( PHYSDEV dev )
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* CreateMetaFileA (GDI32.@)
|
* CreateMetaFileW (GDI32.@)
|
||||||
*
|
*
|
||||||
* Create a new DC and associate it with a metafile. Pass a filename
|
* Create a new DC and associate it with a metafile. Pass a filename
|
||||||
* to create a disk-based metafile, NULL to create a memory metafile.
|
* to create a disk-based metafile, NULL to create a memory metafile.
|
||||||
|
@ -230,14 +230,14 @@ static BOOL MFDRV_DeleteDC( PHYSDEV dev )
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* A handle to the metafile DC if successful, NULL on failure.
|
* A handle to the metafile DC if successful, NULL on failure.
|
||||||
*/
|
*/
|
||||||
HDC WINAPI CreateMetaFileA( LPCSTR filename ) /* [in] Filename of disk metafile */
|
HDC WINAPI CreateMetaFileW( LPCWSTR filename ) /* [in] Filename of disk metafile */
|
||||||
{
|
{
|
||||||
HDC ret;
|
HDC ret;
|
||||||
DC *dc;
|
DC *dc;
|
||||||
METAFILEDRV_PDEVICE *physDev;
|
METAFILEDRV_PDEVICE *physDev;
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
|
|
||||||
TRACE("'%s'\n", filename );
|
TRACE("'%s'\n", debugstr_w(filename) );
|
||||||
|
|
||||||
if (!(dc = MFDRV_AllocMetaFile())) return 0;
|
if (!(dc = MFDRV_AllocMetaFile())) return 0;
|
||||||
physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
|
physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
|
||||||
|
@ -245,12 +245,12 @@ HDC WINAPI CreateMetaFileA( LPCSTR filename ) /* [in] Filename of disk metafile
|
||||||
if (filename) /* disk based metafile */
|
if (filename) /* disk based metafile */
|
||||||
{
|
{
|
||||||
physDev->mh->mtType = METAFILE_DISK;
|
physDev->mh->mtType = METAFILE_DISK;
|
||||||
if ((hFile = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
|
if ((hFile = CreateFileW(filename, GENERIC_WRITE, 0, NULL,
|
||||||
CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
|
CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
|
||||||
MFDRV_DeleteDC( dc->physDev );
|
MFDRV_DeleteDC( dc->physDev );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!WriteFile( hFile, (LPSTR)physDev->mh, sizeof(*physDev->mh), NULL,
|
if (!WriteFile( hFile, physDev->mh, sizeof(*physDev->mh), NULL,
|
||||||
NULL )) {
|
NULL )) {
|
||||||
MFDRV_DeleteDC( dc->physDev );
|
MFDRV_DeleteDC( dc->physDev );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -258,7 +258,7 @@ HDC WINAPI CreateMetaFileA( LPCSTR filename ) /* [in] Filename of disk metafile
|
||||||
physDev->hFile = hFile;
|
physDev->hFile = hFile;
|
||||||
|
|
||||||
/* Grow METAHEADER to include filename */
|
/* Grow METAHEADER to include filename */
|
||||||
physDev->mh = MF_CreateMetaHeaderDisk(physDev->mh, filename);
|
physDev->mh = MF_CreateMetaHeaderDisk(physDev->mh, filename, TRUE);
|
||||||
}
|
}
|
||||||
else /* memory based metafile */
|
else /* memory based metafile */
|
||||||
physDev->mh->mtType = METAFILE_MEMORY;
|
physDev->mh->mtType = METAFILE_MEMORY;
|
||||||
|
@ -270,23 +270,23 @@ HDC WINAPI CreateMetaFileA( LPCSTR filename ) /* [in] Filename of disk metafile
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* CreateMetaFileW (GDI32.@)
|
* CreateMetaFileA (GDI32.@)
|
||||||
*/
|
*/
|
||||||
HDC WINAPI CreateMetaFileW(LPCWSTR filename)
|
HDC WINAPI CreateMetaFileA(LPCSTR filename)
|
||||||
{
|
{
|
||||||
LPSTR filenameA;
|
LPWSTR filenameW;
|
||||||
DWORD len;
|
DWORD len;
|
||||||
HDC hReturnDC;
|
HDC hReturnDC;
|
||||||
|
|
||||||
if (!filename) return CreateMetaFileA(NULL);
|
if (!filename) return CreateMetaFileW(NULL);
|
||||||
|
|
||||||
len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
|
len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
|
||||||
filenameA = HeapAlloc( GetProcessHeap(), 0, len );
|
filenameW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
||||||
WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );
|
MultiByteToWideChar( CP_ACP, 0, filename, -1, filenameW, len );
|
||||||
|
|
||||||
hReturnDC = CreateMetaFileA(filenameA);
|
hReturnDC = CreateMetaFileW(filenameW);
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, filenameA );
|
HeapFree( GetProcessHeap(), 0, filenameW );
|
||||||
|
|
||||||
return hReturnDC;
|
return hReturnDC;
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,7 @@ static METAHEADER *MF_LoadDiskBasedMetaFile(METAHEADER *mh)
|
||||||
* Take a memory based METAHEADER and change it to a disk based METAHEADER
|
* Take a memory based METAHEADER and change it to a disk based METAHEADER
|
||||||
* assosiated with filename. Note: Trashes contents of old one.
|
* assosiated with filename. Note: Trashes contents of old one.
|
||||||
*/
|
*/
|
||||||
METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mh, LPCSTR filename)
|
METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mh, LPCVOID filename, BOOL uni )
|
||||||
{
|
{
|
||||||
METAHEADERDISK *mhd;
|
METAHEADERDISK *mhd;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
@ -380,7 +380,12 @@ METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mh, LPCSTR filename)
|
||||||
mh->mtType = METAFILE_DISK;
|
mh->mtType = METAFILE_DISK;
|
||||||
size = HeapSize( GetProcessHeap(), 0, mh );
|
size = HeapSize( GetProcessHeap(), 0, mh );
|
||||||
mhd = (METAHEADERDISK *)((char *)mh + sizeof(METAHEADER));
|
mhd = (METAHEADERDISK *)((char *)mh + sizeof(METAHEADER));
|
||||||
strcpy(mhd->filename, filename);
|
|
||||||
|
if( uni )
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, filename, -1,
|
||||||
|
mhd->filename, sizeof mhd->filename, NULL, NULL);
|
||||||
|
else
|
||||||
|
lstrcpynA( mhd->filename, filename, sizeof mhd->filename );
|
||||||
return mh;
|
return mh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +418,7 @@ HMETAFILE16 WINAPI CopyMetaFile16( HMETAFILE16 hSrcMetaFile, LPCSTR lpFilename)
|
||||||
}
|
}
|
||||||
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
|
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename);
|
mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MF_Create_HMETAFILE16( mh2 );
|
return MF_Create_HMETAFILE16( mh2 );
|
||||||
|
@ -455,8 +460,6 @@ HMETAFILE WINAPI CopyMetaFileW(
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lpFilename) { /* disk based metafile */
|
if(lpFilename) { /* disk based metafile */
|
||||||
DWORD len;
|
|
||||||
LPSTR lpFilenameA;
|
|
||||||
if((hFile = CreateFileW(lpFilename, GENERIC_WRITE, 0, NULL,
|
if((hFile = CreateFileW(lpFilename, GENERIC_WRITE, 0, NULL,
|
||||||
CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
|
CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
|
||||||
HeapFree( GetProcessHeap(), 0, mh2 );
|
HeapFree( GetProcessHeap(), 0, mh2 );
|
||||||
|
@ -464,11 +467,7 @@ HMETAFILE WINAPI CopyMetaFileW(
|
||||||
}
|
}
|
||||||
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
|
WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL);
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
len = WideCharToMultiByte(CP_ACP, 0, lpFilename, -1, NULL, 0, NULL, NULL);
|
mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename, TRUE);
|
||||||
lpFilenameA = HeapAlloc(GetProcessHeap(), 0, len);
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, lpFilename, -1, lpFilenameA, len, NULL, NULL);
|
|
||||||
mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilenameA);
|
|
||||||
HeapFree(GetProcessHeap(), 0, lpFilenameA);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MF_Create_HMETAFILE( mh2 );
|
return MF_Create_HMETAFILE( mh2 );
|
||||||
|
|
Loading…
Reference in New Issue