ReactOS 0.4.15-dev-7924-g5949c20
enhmfile.c
Go to the documentation of this file.
1#include <precomp.h>
2
3#define NDEBUG
4#include <debug.h>
5
6/*
7 * @unimplemented
8 */
12 PVOID pv0,
13 PVOID pv1)
14{
17 return FALSE;
18}
19
20/*
21 * @unimplemented
22 */
23BOOL
26 PVOID pv0,
27 PVOID pv1,
29 DWORD dwExtends )
30{
33 return FALSE;
34}
35
36/*
37 * @implemented
38 */
41GdiConvertEnhMetaFile(HENHMETAFILE hemf)
42{
43 HANDLE hmo = NULL;
44 BYTE * Buffer = NULL;
45 UINT nSize;
46
47 nSize = GetEnhMetaFileBits( hemf, 0, NULL );
48 if (nSize == 0)
49 goto Exit;
50
51 // allocate buffer
53 if (Buffer == NULL)
54 goto Exit;
55
57 if (nSize == 0)
58 goto Exit;
59
61
62Exit:
63 // clean up
64 if (Buffer)
66 return hmo;
67}
68
69/*
70 * @implemented
71 */
72HENHMETAFILE
75{
76 HENHMETAFILE hEMF;
77 BYTE * Buffer = NULL;
78 UINT nSize;
79 DWORD iType, mm, xExt, yExt;
80
82 if (nSize == 0)
83 goto Exit;
84
85 // allocate buffer
87 if (Buffer == NULL)
88 goto Exit;
89
90 // store to buffer
91 nSize = NtGdiGetServerMetaFileBits( hmo, nSize, Buffer, &iType, &mm, &xExt, &yExt);
92 if (nSize == 0)
93 goto Exit;
94
95 if ( iType == GDITAG_TYPE_MFP ) // handle conversion to EMF
96 {
98
99 Info.hMF = NULL;
100 Info.mm = mm;
101 Info.xExt = xExt;
102 Info.yExt = yExt;
103
104 hEMF = SetWinMetaFileBits( nSize, Buffer, NULL, &Info ); // Translate from old style to new style.
105 if (hEMF == NULL)
106 goto Exit;
107 }
108 else
109 {
111 if (hEMF == NULL)
112 goto Exit;
113 }
114
115Exit:
116 // clean up
117 if (Buffer)
119 return hEMF;
120}
121
122/*
123 * @implemented
124 */
125BOOL
126WINAPI
128 _In_ HDC hdc,
129 _In_ UINT cbSize,
130 _In_ const BYTE *lpData)
131{
133 return TRUE;
134
135 return EMFDC_GdiComment( hdc, cbSize, lpData );
136}
137
138/*
139 * @implemented
140 */
141UINT
142WINAPI
144 HENHMETAFILE hemf,
145 UINT cbBuffer,
147{
148 ENHMETAHEADER pemh;
149
150 if(GetEnhMetaFileHeader(hemf, sizeof(ENHMETAHEADER), &pemh))
151 {
152 if(pemh.bOpenGL)
153 {
154 if(pemh.cbPixelFormat)
155 {
156 memcpy((void*)ppfd, UlongToPtr(pemh.offPixelFormat), cbBuffer );
157 return(pemh.cbPixelFormat);
158 }
159 }
160 }
161 return(0);
162}
#define UNIMPLEMENTED
Definition: debug.h:115
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752
#define UlongToPtr(u)
Definition: config.h:106
BOOL WINAPI IsValidEnhMetaRecord(PVOID pv0, PVOID pv1)
Definition: enhmfile.c:11
HANDLE WINAPI GdiConvertEnhMetaFile(HENHMETAFILE hemf)
Definition: enhmfile.c:41
HENHMETAFILE WINAPI GdiCreateLocalEnhMetaFile(HANDLE hmo)
Definition: enhmfile.c:74
UINT WINAPI GetEnhMetaFilePixelFormat(HENHMETAFILE hemf, UINT cbBuffer, PIXELFORMATDESCRIPTOR *ppfd)
Definition: enhmfile.c:143
BOOL WINAPI IsValidEnhMetaRecordOffExt(PVOID pv0, PVOID pv1, DWORD dwOffset, DWORD dwExtends)
Definition: enhmfile.c:25
BOOL WINAPI GdiComment(_In_ HDC hdc, _In_ UINT cbSize, _In_ const BYTE *lpData)
Definition: enhmfile.c:127
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EMFDC_GdiComment(HDC hdc, UINT bytes, const BYTE *buffer)
Definition: emfdc.c:2326
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
@ GDILoObjType_LO_ALTDC_TYPE
Definition: gdi_private.h:43
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define _In_
Definition: ms_sal.h:308
unsigned int UINT
Definition: ndis.h:50
__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)
_In_ DWORD _In_ DWORD dwOffset
Definition: ntgdi.h:2033
__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 GDITAG_TYPE_EMF
Definition: ntgdityp.h:246
#define GDITAG_TYPE_MFP
Definition: ntgdityp.h:247
static void Exit(void)
Definition: sock.c:1330
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
#define LPTR
Definition: winbase.h:381
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084
_In_ ULONG iType
Definition: winddi.h:3748
_In_ LONG _In_ ULONG _Out_opt_ PIXELFORMATDESCRIPTOR * ppfd
Definition: winddi.h:3490
#define WINAPI
Definition: msvc.h:6
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
HENHMETAFILE WINAPI SetEnhMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *pb)
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)
HENHMETAFILE WINAPI SetWinMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *lpMeta16Data, _In_opt_ HDC hdcRef, _In_opt_ const METAFILEPICT *lpMFP)
unsigned char BYTE
Definition: xxhash.c:193