ReactOS  0.4.14-dev-98-gb0d4763
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
18 typedef struct _METATYPEOBJ
19 {
28 
29 
30 /* System Service Calls ******************************************************/
31 
32 /*
33  * @implemented
34  */
35 HDC
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  */
49 HANDLE
52  IN DWORD iType,
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 
76  _SEH2_TRY
77  {
78  ProbeForRead( pjData, cjData, 1 );
79  RtlCopyMemory( pmto->pjData, pjData, cjData) ;
80  }
82  {
83  Pass = FALSE;
84  }
85  _SEH2_END;
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  */
105 ULONG
106 APIENTRY
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  {
133  _SEH2_TRY
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  */
170 LONG
171 APIENTRY
173  IN OUT PRECTL pRect)
174 {
176  return 0;
177 }
178 
179 /* EOF */
#define IN
Definition: typedefs.h:38
PGDIOBJ NTAPI GDIOBJ_LockObject(HGDIOBJ hobj, UCHAR objt)
Definition: gdiobj.c:823
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
HANDLE APIENTRY NtGdiCreateServerMetaFile(IN DWORD iType, IN ULONG cjData, IN PBYTE pjData, IN DWORD mm, IN DWORD xExt, IN DWORD yExt)
Definition: metafile.c:51
PBYTE pjData[4]
Definition: metafile.c:26
ULONG APIENTRY NtGdiGetServerMetaFileBits(IN HANDLE hmo, IN ULONG cjData, OUT OPTIONAL PBYTE pjData, OUT PDWORD piType, OUT PDWORD pmm, OUT PDWORD pxExt, OUT PDWORD pyExt)
Definition: metafile.c:107
_In_ ULONG iType
Definition: winddi.h:3748
DWORD xExt
Definition: metafile.c:23
static HDC
Definition: imagelist.c:92
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
DWORD iType
Definition: metafile.c:21
struct _METATYPEOBJ * PMETATYPEOBJ
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:416
#define GDITAG_TYPE_MFP
Definition: ntgdityp.h:246
struct _METATYPEOBJ METATYPEOBJ
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1108
HDC APIENTRY GreCreateCompatibleDC(HDC hdc, BOOL bAltDc)
Definition: dclife.c:817
DWORD yExt
Definition: metafile.c:24
LONG APIENTRY NtGdiConvertMetafileRect(IN HDC hDC, IN OUT PRECTL pRect)
Definition: metafile.c:172
HDC APIENTRY NtGdiCreateMetafileDC(IN HDC hdc)
Definition: metafile.c:37
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:877
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
ULONG cjData
Definition: metafile.c:25
BASEOBJECT BaseObject
Definition: metafile.c:20
HDC hdc
Definition: main.c:9
#define GDITAG_TYPE_EMF
Definition: ntgdityp.h:245
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
Definition: gdiobj.c:1485
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
DWORD * PDWORD
Definition: pedump.c:68
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
VOID NTAPI GDIOBJ_vSetObjectOwner(POBJ pobj, ULONG ulNewOwner)
Definition: gdiobj.c:962
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
static struct proto Pass[]
Definition: mkg3states.c:58
DWORD mm
Definition: metafile.c:22
BYTE * PBYTE
Definition: pedump.c:66
#define APIENTRY
Definition: api.h:79
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68