ReactOS 0.4.16-dev-321-g63bb46a
enhmfile.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for enhmfile.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL WINAPI IsValidEnhMetaRecord (PVOID pv0, PVOID pv1)
 
BOOL WINAPI IsValidEnhMetaRecordOffExt (PVOID pv0, PVOID pv1, DWORD dwOffset, DWORD dwExtends)
 
HANDLE WINAPI GdiConvertEnhMetaFile (HENHMETAFILE hemf)
 
HENHMETAFILE WINAPI GdiCreateLocalEnhMetaFile (HANDLE hmo)
 
BOOL WINAPI GdiComment (_In_ HDC hdc, _In_ UINT cbSize, _In_ const BYTE *lpData)
 
UINT WINAPI GetEnhMetaFilePixelFormat (HENHMETAFILE hemf, UINT cbBuffer, PIXELFORMATDESCRIPTOR *ppfd)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 3 of file enhmfile.c.

Function Documentation

◆ GdiComment()

BOOL WINAPI GdiComment ( _In_ HDC  hdc,
_In_ UINT  cbSize,
_In_ const BYTE lpData 
)

Definition at line 127 of file enhmfile.c.

131{
133 return TRUE;
134
135 return EMFDC_GdiComment( hdc, cbSize, lpData );
136}
#define TRUE
Definition: types.h:120
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
HDC hdc
Definition: main.c:9

◆ GdiConvertEnhMetaFile()

HANDLE WINAPI GdiConvertEnhMetaFile ( HENHMETAFILE  hemf)

Definition at line 41 of file enhmfile.c.

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}
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
unsigned int UINT
Definition: ndis.h:50
__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
static void Exit(void)
Definition: sock.c:1330
#define LPTR
Definition: winbase.h:407
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2109
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
unsigned char BYTE
Definition: xxhash.c:193

◆ GdiCreateLocalEnhMetaFile()

HENHMETAFILE WINAPI GdiCreateLocalEnhMetaFile ( HANDLE  hmo)

Definition at line 74 of file enhmfile.c.

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}
unsigned long DWORD
Definition: ntddk_ex.h:95
__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)
#define GDITAG_TYPE_MFP
Definition: ntgdityp.h:247
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ ULONG iType
Definition: winddi.h:3748
HENHMETAFILE WINAPI SetEnhMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *pb)
HENHMETAFILE WINAPI SetWinMetaFileBits(_In_ UINT nSize, _In_reads_bytes_(nSize) const BYTE *lpMeta16Data, _In_opt_ HDC hdcRef, _In_opt_ const METAFILEPICT *lpMFP)

Referenced by GetClipboardData().

◆ GetEnhMetaFilePixelFormat()

UINT WINAPI GetEnhMetaFilePixelFormat ( HENHMETAFILE  hemf,
UINT  cbBuffer,
PIXELFORMATDESCRIPTOR ppfd 
)

Definition at line 143 of file enhmfile.c.

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 UlongToPtr(u)
Definition: config.h:106
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_In_ LONG _In_ ULONG _Out_opt_ PIXELFORMATDESCRIPTOR * ppfd
Definition: winddi.h:3490
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)

◆ IsValidEnhMetaRecord()

BOOL WINAPI IsValidEnhMetaRecord ( PVOID  pv0,
PVOID  pv1 
)

Definition at line 11 of file enhmfile.c.

14{
17 return FALSE;
18}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define FALSE
Definition: types.h:117
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752

◆ IsValidEnhMetaRecordOffExt()

BOOL WINAPI IsValidEnhMetaRecordOffExt ( PVOID  pv0,
PVOID  pv1,
DWORD  dwOffset,
DWORD  dwExtends 
)

Definition at line 25 of file enhmfile.c.