ReactOS 0.4.15-dev-8408-g466a198
metafile.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Win32k Subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: win32ss/gdi/ntgdi/metafile.c
5 * PURPOSE: Metafile Implementations, Metafile Clipboard Data Xfers
6 * PROGRAMMERS: ...
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <win32k.h>
12
13#define NDEBUG
14#include <debug.h>
15
16
17// Internal Use Only
18typedef struct _METATYPEOBJ
19{
28
29
30/* System Service Calls ******************************************************/
31
32/*
33 * @implemented
34 */
35HDC
38{
39 //if (hdc)
40 /* Call the internal function to create an alternative info DC */
42 // No HDC call NtUser.
43 //return UserGetDesktopDC(DCTYPE_INFO, TRUE, FALSE);
44}
45
46/*
47 * @implemented
48 */
53 IN ULONG cjData,
54 IN PBYTE pjData,
55 IN DWORD mm,
56 IN DWORD xExt,
57 IN DWORD yExt
58)
59{
60 BOOL Pass = TRUE;
61 PMETATYPEOBJ pmto;
62
63 if ( ( iType == GDITAG_TYPE_EMF || iType == GDITAG_TYPE_MFP ) &&
64 cjData &&
65 pjData )
66 {
68 if ( pmto )
69 {
70 pmto->iType = iType;
71 pmto->mm = mm;
72 pmto->xExt = xExt;
73 pmto->yExt = yExt;
74 pmto->cjData = cjData;
75
77 {
78 ProbeForRead( pjData, cjData, 1 );
79 RtlCopyMemory( pmto->pjData, pjData, cjData) ;
80 }
82 {
83 Pass = FALSE;
84 }
86
87 if (Pass)
88 {
91 return pmto->BaseObject.hHmgr;
92 }
93 else
94 {
96 }
97 }
98 }
99 return NULL;
100}
101
102/*
103 * @implemented
104 */
105ULONG
108 IN HANDLE hmo,
109 IN ULONG cjData,
110 OUT OPTIONAL PBYTE pjData,
111 OUT PDWORD piType,
112 OUT PDWORD pmm,
113 OUT PDWORD pxExt,
114 OUT PDWORD pyExt
115)
116{
117 ULONG cjRet = 0;
118 PMETATYPEOBJ pmto;
119
121
122 if (!pmto)
123 return 0;
124
125 if ( pmto->iType == GDITAG_TYPE_EMF || pmto->iType == GDITAG_TYPE_MFP )
126 {
127 cjRet = pmto->cjData;
128
129 if ( cjData )
130 {
131 if (cjData == pmto->cjData)
132 {
134 {
135 ProbeForWrite( piType, sizeof(DWORD), 1);
136 *piType = pmto->iType;
137
138 ProbeForWrite( pmm, sizeof(DWORD), 1);
139 *pmm = pmto->mm;
140
141 ProbeForWrite( pxExt, sizeof(DWORD), 1);
142 *pxExt = pmto->xExt;
143
144 ProbeForWrite( pyExt, sizeof(DWORD), 1);
145 *pyExt = pmto->yExt;
146
147 ProbeForWrite( pjData, cjData, 1 );
148 RtlCopyMemory( pjData, pmto->pjData, cjData) ;
149 }
151 {
152 cjRet = 0;
153 }
154 _SEH2_END;
155 }
156 else
157 {
158 cjRet = 0;
159 }
160 }
161 }
162
164 return cjRet;
165}
166
167/*
168 * @unimplemented
169 */
170LONG
173 IN OUT PRECTL pRect)
174{
176 return 0;
177}
178
179/* EOF */
static HDC hDC
Definition: 3dtext.c:33
#define UNIMPLEMENTED
Definition: debug.h:118
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
HDC APIENTRY GreCreateCompatibleDC(HDC hdc, BOOL bAltDc)
Definition: dclife.c:817
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ GDILoObjType_LO_META_TYPE
Definition: gdi_private.h:42
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static struct proto Pass[]
Definition: mkg3states.c:58
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
__kernel_entry W32KAPI ULONG APIENTRY NtGdiGetServerMetaFileBits(_In_ HANDLE hmo, _In_ ULONG cjData, _Out_writes_bytes_opt_(cjData) LPBYTE pjData, _Out_ PDWORD piType, _Out_ PDWORD pmm, _Out_ PDWORD pxExt, _Out_ PDWORD pyExt)
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiCreateServerMetaFile(_In_ DWORD iType, _In_ ULONG cjData, _In_reads_bytes_(cjData) LPBYTE pjData, _In_ DWORD mm, _In_ DWORD xExt, _In_ DWORD yExt)
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
#define GDITAG_TYPE_EMF
Definition: ntgdityp.h:246
@ GDIObjType_META_TYPE
Definition: ntgdityp.h:141
#define GDITAG_TYPE_MFP
Definition: ntgdityp.h:247
BYTE * PBYTE
Definition: pedump.c:66
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
ULONG cjData
Definition: metafile.c:25
BASEOBJECT BaseObject
Definition: metafile.c:20
DWORD yExt
Definition: metafile.c:24
DWORD iType
Definition: metafile.c:21
PBYTE pjData[4]
Definition: metafile.c:26
DWORD mm
Definition: metafile.c:22
DWORD xExt
Definition: metafile.c:23
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
VOID NTAPI GDIOBJ_vSetObjectOwner(POBJ pobj, ULONG ulNewOwner)
Definition: gdiobj.c:965
PGDIOBJ NTAPI GDIOBJ_LockObject(HGDIOBJ hobj, UCHAR objt)
Definition: gdiobj.c:826
POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
Definition: gdiobj.c:1522
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:880
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1111
struct _METATYPEOBJ METATYPEOBJ
HDC APIENTRY NtGdiCreateMetafileDC(IN HDC hdc)
Definition: metafile.c:37
struct _METATYPEOBJ * PMETATYPEOBJ
LONG APIENTRY NtGdiConvertMetafileRect(IN HDC hDC, IN OUT PRECTL pRect)
Definition: metafile.c:172
_In_ ULONG iType
Definition: winddi.h:3748