2003-05-18 17:16:18 +00:00
|
|
|
/*
|
2008-06-01 17:47:46 +00:00
|
|
|
* PROJECT: ReactOS Win32k Subsystem
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2015-11-10 17:41:55 +00:00
|
|
|
* FILE: win32ss/gdi/ntgdi/metafile.c
|
2019-05-30 21:36:33 +00:00
|
|
|
* PURPOSE: Metafile Implementations, Metafile Clipboard Data Xfers
|
2008-06-01 17:47:46 +00:00
|
|
|
* PROGRAMMERS: ...
|
2003-05-18 17:16:18 +00:00
|
|
|
*/
|
2008-06-01 17:47:46 +00:00
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
1999-07-22 16:21:53 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2008-06-01 17:47:46 +00:00
|
|
|
|
2019-06-01 02:44:17 +00:00
|
|
|
// Internal Use Only
|
2019-05-30 21:36:33 +00:00
|
|
|
typedef struct _METATYPEOBJ
|
2008-06-01 17:47:46 +00:00
|
|
|
{
|
2019-05-30 21:36:33 +00:00
|
|
|
BASEOBJECT BaseObject;
|
|
|
|
DWORD iType;
|
|
|
|
DWORD mm;
|
|
|
|
DWORD xExt;
|
|
|
|
DWORD yExt;
|
|
|
|
ULONG cjData;
|
|
|
|
PBYTE pjData[4];
|
|
|
|
} METATYPEOBJ, *PMETATYPEOBJ;
|
|
|
|
|
|
|
|
|
|
|
|
/* System Service Calls ******************************************************/
|
|
|
|
|
2008-06-01 17:47:46 +00:00
|
|
|
/*
|
2011-01-10 01:36:14 +00:00
|
|
|
* @implemented
|
2008-06-01 17:47:46 +00:00
|
|
|
*/
|
2000-02-20 22:52:50 +00:00
|
|
|
HDC
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2008-06-01 05:40:53 +00:00
|
|
|
NtGdiCreateMetafileDC(IN HDC hdc)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2019-05-30 21:36:33 +00:00
|
|
|
//if (hdc)
|
|
|
|
/* Call the internal function to create an alternative info DC */
|
|
|
|
return GreCreateCompatibleDC(hdc, TRUE);
|
|
|
|
// No HDC call NtUser.
|
|
|
|
//return UserGetDesktopDC(DCTYPE_INFO, TRUE, FALSE);
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2008-06-01 17:47:46 +00:00
|
|
|
/*
|
2019-05-30 21:36:33 +00:00
|
|
|
* @implemented
|
2008-06-01 17:47:46 +00:00
|
|
|
*/
|
|
|
|
HANDLE
|
|
|
|
APIENTRY
|
2019-05-30 21:36:33 +00:00
|
|
|
NtGdiCreateServerMetaFile(
|
|
|
|
IN DWORD iType,
|
|
|
|
IN ULONG cjData,
|
|
|
|
IN PBYTE pjData,
|
|
|
|
IN DWORD mm,
|
|
|
|
IN DWORD xExt,
|
|
|
|
IN DWORD yExt
|
|
|
|
)
|
2008-06-01 17:47:46 +00:00
|
|
|
{
|
2019-05-30 21:36:33 +00:00
|
|
|
BOOL Pass = TRUE;
|
|
|
|
PMETATYPEOBJ pmto;
|
|
|
|
|
|
|
|
if ( ( iType == GDITAG_TYPE_EMF || iType == GDITAG_TYPE_MFP ) &&
|
|
|
|
cjData &&
|
|
|
|
pjData )
|
|
|
|
{
|
2019-06-01 02:44:17 +00:00
|
|
|
pmto = (PMETATYPEOBJ)GDIOBJ_AllocObjWithHandle(GDILoObjType_LO_META_TYPE, sizeof(METATYPEOBJ) + cjData);
|
2019-05-30 21:36:33 +00:00
|
|
|
if ( pmto )
|
|
|
|
{
|
|
|
|
pmto->iType = iType;
|
|
|
|
pmto->mm = mm;
|
|
|
|
pmto->xExt = xExt;
|
|
|
|
pmto->yExt = yExt;
|
|
|
|
pmto->cjData = cjData;
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
2019-06-01 02:44:17 +00:00
|
|
|
ProbeForRead( pjData, cjData, 1 );
|
|
|
|
RtlCopyMemory( pmto->pjData, pjData, cjData) ;
|
2019-05-30 21:36:33 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Pass = FALSE;
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
if (Pass)
|
|
|
|
{
|
|
|
|
GDIOBJ_vSetObjectOwner(&pmto->BaseObject, GDI_OBJ_HMGR_PUBLIC);
|
2019-06-01 02:44:17 +00:00
|
|
|
GDIOBJ_vUnlockObject(&pmto->BaseObject);
|
2019-05-30 21:36:33 +00:00
|
|
|
return pmto->BaseObject.hHmgr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GDIOBJ_vDeleteObject(&pmto->BaseObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-01 17:47:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2014-12-29 13:12:05 +00:00
|
|
|
|
2008-06-01 17:47:46 +00:00
|
|
|
/*
|
2019-05-30 21:36:33 +00:00
|
|
|
* @implemented
|
2008-06-01 17:47:46 +00:00
|
|
|
*/
|
|
|
|
ULONG
|
|
|
|
APIENTRY
|
2019-05-30 21:36:33 +00:00
|
|
|
NtGdiGetServerMetaFileBits(
|
|
|
|
IN HANDLE hmo,
|
|
|
|
IN ULONG cjData,
|
|
|
|
OUT OPTIONAL PBYTE pjData,
|
|
|
|
OUT PDWORD piType,
|
|
|
|
OUT PDWORD pmm,
|
|
|
|
OUT PDWORD pxExt,
|
|
|
|
OUT PDWORD pyExt
|
|
|
|
)
|
|
|
|
{
|
|
|
|
ULONG cjRet = 0;
|
|
|
|
PMETATYPEOBJ pmto;
|
|
|
|
|
2019-06-01 02:44:17 +00:00
|
|
|
pmto = (PMETATYPEOBJ) GDIOBJ_LockObject( hmo, GDIObjType_META_TYPE);
|
2019-05-30 21:36:33 +00:00
|
|
|
|
|
|
|
if (!pmto)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ( pmto->iType == GDITAG_TYPE_EMF || pmto->iType == GDITAG_TYPE_MFP )
|
|
|
|
{
|
|
|
|
cjRet = pmto->cjData;
|
|
|
|
|
|
|
|
if ( cjData )
|
|
|
|
{
|
|
|
|
if (cjData == pmto->cjData)
|
|
|
|
{
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForWrite( piType, sizeof(DWORD), 1);
|
|
|
|
*piType = pmto->iType;
|
|
|
|
|
|
|
|
ProbeForWrite( pmm, sizeof(DWORD), 1);
|
|
|
|
*pmm = pmto->mm;
|
|
|
|
|
|
|
|
ProbeForWrite( pxExt, sizeof(DWORD), 1);
|
|
|
|
*pxExt = pmto->xExt;
|
|
|
|
|
|
|
|
ProbeForWrite( pyExt, sizeof(DWORD), 1);
|
|
|
|
*pyExt = pmto->yExt;
|
|
|
|
|
|
|
|
ProbeForWrite( pjData, cjData, 1 );
|
|
|
|
RtlCopyMemory( pjData, pmto->pjData, cjData) ;
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
cjRet = 0;
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cjRet = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-01 02:44:17 +00:00
|
|
|
GDIOBJ_vUnlockObject(&pmto->BaseObject);
|
2019-05-30 21:36:33 +00:00
|
|
|
return cjRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
LONG
|
|
|
|
APIENTRY
|
|
|
|
NtGdiConvertMetafileRect(IN HDC hDC,
|
|
|
|
IN OUT PRECTL pRect)
|
2008-06-01 17:47:46 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return 0;
|
|
|
|
}
|
1999-07-23 19:57:18 +00:00
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|