xref: /reactos/win32ss/gdi/gdi32/include/gdi32p.h (revision 9592728f)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS System Libraries
4  * FILE:            win32ss/gdi/gdi32/include/gdi32p.h
5  * PURPOSE:         User-Mode Win32 GDI Library Private Header
6  * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
7  */
8 
9 #pragma once
10 
11 /* DATA **********************************************************************/
12 
13 extern PGDI_TABLE_ENTRY GdiHandleTable;
14 extern PGDI_SHARED_HANDLE_TABLE GdiSharedHandleTable;
15 extern HANDLE hProcessHeap;
16 extern HANDLE CurrentProcessId;
17 extern DWORD GDI_BatchLimit;
18 extern PDEVCAPS GdiDevCaps;
19 extern BOOL gbLpk;          // Global bool LanguagePack
20 extern HANDLE ghSpooler;
21 extern RTL_CRITICAL_SECTION semLocal;
22 
23 typedef INT
24 (CALLBACK* EMFPLAYPROC)(
25     HDC hdc,
26     INT iFunction,
27     HANDLE hPageQuery
28 );
29 
30 typedef BOOL
31 (WINAPI* LPKETO)(
32     HDC hdc,
33     int x,
34     int y,
35     UINT fuOptions,
36     const RECT *lprc,
37     LPCWSTR lpString,
38     UINT uCount,
39     const INT *lpDx,
40     INT unknown
41 );
42 
43 typedef DWORD
44 (WINAPI* LPKGCP)(
45     HDC hdc,
46     LPCWSTR lpString,
47     INT uCount,
48     INT nMaxExtent,
49     LPGCP_RESULTSW lpResults,
50     DWORD dwFlags,
51     DWORD dwUnused
52 );
53 
54 typedef BOOL
55 (WINAPI* LPKGTEP)(
56     HDC hdc,
57     LPCWSTR lpString,
58     INT cString,
59     INT nMaxExtent,
60     LPINT lpnFit,
61     LPINT lpnDx,
62     LPSIZE lpSize,
63     DWORD dwUnused,
64     int unknown
65 );
66 
67 extern HINSTANCE hLpk;
68 extern LPKETO LpkExtTextOut;
69 extern LPKGCP LpkGetCharacterPlacement;
70 extern LPKGTEP LpkGetTextExtentExPoint;
71 
72 /* DEFINES *******************************************************************/
73 
74 #define HANDLE_LIST_INC 20
75 
76 #define METAFILE_MEMORY 1
77 #define METAFILE_DISK   2
78 
79 #define SAPCALLBACKDELAY 244
80 
81 #define LPK_INIT 1
82 #define LPK_ETO  2
83 #define LPK_GCP  3
84 #define LPK_GTEP 4
85 
86 /* MACRO ********************************************************************/
87 
88 #define ROP_USES_SOURCE(Rop)   (((Rop) << 2 ^ Rop) & 0xCC0000)
89 #define RCAST(_Type, _Value)   (*((_Type*)&_Value))
90 
91 
92 /* TYPES *********************************************************************/
93 
94 // Based on wmfapi.h and Wine.
95 typedef struct tagMETAFILEDC
96 {
97     PVOID       pvMetaBuffer;
98     HANDLE      hFile;
99     DWORD       Size;
100     DWORD       dwWritten;
101     METAHEADER  mh;
102     WORD        reserved;
103     HLOCAL      MFObjList;
104     HPEN        hPen;
105     HBRUSH      hBrush;
106     HDC         hDc;
107     HGDIOBJ     hMetaDc;
108     HPALETTE    hPalette;
109     HFONT       hFont;
110     HBITMAP     hBitmap;
111     HRGN        hRegion;
112     HGDIOBJ     hMetafile;
113     HGDIOBJ     hMemDc;
114     HPEN        hExtPen;
115     HGDIOBJ     hEnhMetaDc;
116     HGDIOBJ     hEnhMetaFile;
117     HCOLORSPACE hColorSpace;
118     WCHAR       Filename[MAX_PATH+2];
119 } METAFILEDC,*PMETAFILEDC;
120 
121 // Metafile Entry handle
122 typedef struct tagMF_ENTRY
123 {
124     LIST_ENTRY   List;
125     HGDIOBJ      hmDC;             // Handle return from NtGdiCreateClientObj.
126     PMETAFILEDC pmfDC;
127 } MF_ENTRY, *PMF_ENTRY;
128 
129 typedef struct tagENHMETAFILE
130 {
131     PVOID      pvMetaBuffer;
132     HANDLE     hFile;      /* Handle for disk based MetaFile */
133     DWORD      Size;
134     INT        iType;
135     PENHMETAHEADER emf;
136     UINT       handles_size, cur_handles;
137     HGDIOBJ   *handles;
138     INT        horzres, vertres;
139     INT        horzsize, vertsize;
140     INT        logpixelsx, logpixelsy;
141     INT        bitspixel;
142     INT        textcaps;
143     INT        rastercaps;
144     INT        technology;
145     INT        planes;
146 } ENHMETAFILE,*PENHMETAFILE;
147 
148 
149 #define PDEV_UMPD_ID  0xFEDCBA98
150 // UMPDEV flags
151 #define UMPDEV_NO_ESCAPE      0x0002
152 #define UMPDEV_SUPPORT_ESCAPE 0x0004
153 typedef struct _UMPDEV
154 {
155     DWORD_PTR       Sig;            // Init with PDEV_UMPD_ID
156     struct _UMPDEV *pumpdNext;
157     PDRIVER_INFO_5W pdi5Info;
158     HMODULE         hModule;
159     DWORD           dwFlags;
160     DWORD           dwDriverAttributes;
161     DWORD           dwConfigVersion; // Number of times the configuration
162     // file for this driver has been upgraded
163     // or downgraded since the last spooler restart.
164     DWORD           dwDriverCount;   // After init should be 2
165     DWORD           WOW64_UMPDev;
166     DWORD           WOW64_hMod;
167     DWORD           Unknown;
168     PVOID           apfn[INDEX_LAST]; // Print Driver pfn
169 } UMPDEV, *PUMPDEV;
170 
171 #define LOCALFONT_COUNT 10
172 typedef struct _LOCALFONT
173 {
174     FONT_ATTR  lfa[LOCALFONT_COUNT];
175 } LOCALFONT, *PLOCALFONT;
176 
177 // sdk/winspool.h
178 typedef BOOL (WINAPI *ABORTPRINTER) (HANDLE);
179 typedef BOOL (WINAPI *CLOSEPRINTER) (HANDLE);
180 typedef BOOL (WINAPI *CLOSESPOOLFILEHANDLE) (HANDLE, HANDLE); // W2k8
181 typedef HANDLE (WINAPI *COMMITSPOOLDATA) (HANDLE,HANDLE,DWORD); // W2k8
182 typedef LONG (WINAPI *DOCUMENTPROPERTIESW) (HWND,HANDLE,LPWSTR,PDEVMODEW,PDEVMODEW,DWORD);
183 typedef BOOL (WINAPI *ENDDOCPRINTER) (HANDLE);
184 typedef BOOL (WINAPI *ENDPAGEPRINTER) (HANDLE);
185 typedef BOOL (WINAPI *GETPRINTERW) (HANDLE,DWORD,LPBYTE,DWORD,LPDWORD);
186 typedef BOOL (WINAPI *GETPRINTERDRIVERW) (HANDLE,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD);
187 typedef HANDLE (WINAPI *GETSPOOLFILEHANDLE) (HANDLE); // W2k8
188 typedef BOOL (WINAPI *ISVALIDDEVMODEW) (PDEVMODEW,size_t);
189 typedef BOOL (WINAPI *OPENPRINTERW) (LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW);
190 typedef BOOL (WINAPI *READPRINTER) (HANDLE,PVOID,DWORD,PDWORD);
191 typedef BOOL (WINAPI *RESETPRINTERW) (HANDLE,LPPRINTER_DEFAULTSW);
192 typedef LPWSTR (WINAPI *STARTDOCDLGW) (HANDLE,DOCINFOW *);
193 typedef DWORD (WINAPI *STARTDOCPRINTERW) (HANDLE,DWORD,PBYTE);
194 typedef BOOL (WINAPI *STARTPAGEPRINTER) (HANDLE);
195 // ddk/winsplp.h
196 typedef BOOL (WINAPI *SEEKPRINTER) (HANDLE,LARGE_INTEGER,PLARGE_INTEGER,DWORD,BOOL);
197 typedef BOOL (WINAPI *SPLREADPRINTER) (HANDLE,LPBYTE *,DWORD);
198 // Same as ddk/winsplp.h DriverUnloadComplete?
199 typedef BOOL (WINAPI *SPLDRIVERUNLOADCOMPLETE) (LPWSTR);
200 // Driver support:
201 // DrvDocumentEvent api/winddiui.h not W2k8 DocumentEventAW
202 typedef INT (WINAPI *DOCUMENTEVENT) (HANDLE,HDC,INT,ULONG,PVOID,ULONG,PVOID);
203 // DrvQueryColorProfile
204 typedef BOOL (WINAPI *QUERYCOLORPROFILE) (HANDLE,PDEVMODEW,ULONG,VOID*,ULONG,FLONG);
205 // Unknown:
206 typedef DWORD (WINAPI *QUERYSPOOLMODE) (HANDLE,DWORD,DWORD);
207 typedef DWORD (WINAPI *QUERYREMOTEFONTS) (DWORD,DWORD,DWORD);
208 
209 extern CLOSEPRINTER fpClosePrinter;
210 extern OPENPRINTERW fpOpenPrinterW;
211 
212 /* FUNCTIONS *****************************************************************/
213 
214 PVOID
215 HEAP_alloc(DWORD len);
216 
217 NTSTATUS
218 HEAP_strdupA2W(
219     LPWSTR* ppszW,
220     LPCSTR lpszA
221 );
222 
223 VOID
224 HEAP_free(LPVOID memory);
225 
226 VOID
227 FASTCALL
228 FONT_TextMetricWToA(
229     const TEXTMETRICW *ptmW,
230     LPTEXTMETRICA ptmA
231 );
232 
233 VOID
234 FASTCALL
235 NewTextMetricW2A(
236     NEWTEXTMETRICA *tma,
237     NEWTEXTMETRICW *tmw
238 );
239 
240 VOID
241 FASTCALL
242 NewTextMetricExW2A(
243     NEWTEXTMETRICEXA *tma,
244     NEWTEXTMETRICEXW *tmw
245 );
246 
247 BOOL
248 FASTCALL
249 DeleteRegion( HRGN );
250 
251 BOOL
252 WINAPI
253 GdiValidateHandle(HGDIOBJ);
254 
255 BOOL
256 GdiGetHandleUserData(
257     HGDIOBJ hGdiObj,
258     DWORD ObjectType,
259     PVOID *UserData
260 );
261 
262 PLDC
263 FASTCALL
264 GdiGetLDC(HDC hDC);
265 
266 BOOL
267 FASTCALL
268 GdiSetLDC(HDC hdc, PVOID pvLDC);
269 
270 HGDIOBJ
271 WINAPI
272 GdiFixUpHandle(HGDIOBJ hGO);
273 
274 BOOL
275 WINAPI
276 CalculateColorTableSize(
277     CONST BITMAPINFOHEADER *BitmapInfoHeader,
278     UINT *ColorSpec,
279     UINT *ColorTableSize
280 );
281 
282 LPBITMAPINFO
283 WINAPI
284 ConvertBitmapInfo(
285     CONST BITMAPINFO *BitmapInfo,
286     UINT ColorSpec,
287     UINT *BitmapInfoSize,
288     BOOL FollowedByData
289 );
290 
291 DWORD
292 WINAPI
293 GetAndSetDCDWord(
294     _In_ HDC hdc,
295     _In_ UINT u,
296     _In_ DWORD dwIn,
297     _In_ ULONG ulMFId,
298     _In_ USHORT usMF16Id,
299     _In_ DWORD dwError);
300 
301 DWORD
302 WINAPI
303 GetDCDWord(
304     _In_ HDC hdc,
305     _In_ UINT u,
306     _In_ DWORD dwError);
307 
308 HGDIOBJ
309 WINAPI
310 GetDCObject( HDC, INT);
311 
312 VOID
313 NTAPI
314 LogFontA2W(
315     LPLOGFONTW pW,
316     CONST LOGFONTA *pA
317 );
318 
319 VOID
320 NTAPI
321 LogFontW2A(
322     LPLOGFONTA pA,
323     CONST LOGFONTW *pW
324 );
325 
326 VOID
327 WINAPI
328 EnumLogFontExW2A(
329     LPENUMLOGFONTEXA fontA,
330     CONST ENUMLOGFONTEXW *fontW );
331 
332 BOOL
333 WINAPI
334 LoadLPK(
335     INT LpkFunctionID
336 );
337 
338 VOID
339 WINAPI
340 GdiInitializeLanguagePack(
341     _In_ DWORD InitParam);
342 
343 VOID
344 WINAPI
345 InitializeLpkHooks(
346     _In_ FARPROC *hookfuncs);
347 
348 BOOL
349 WINAPI
350 GetETM(HDC hdc,
351        EXTTEXTMETRIC *petm);
352 
353 /* FIXME: Put in some public header */
354 UINT
355 WINAPI
356 UserRealizePalette(HDC hDC);
357 
358 int
359 WINAPI
360 GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv);
361 
362 VOID
363 WINAPI
364 GdiSetLastError( DWORD dwErrCode );
365 
366 DWORD WINAPI GdiGetCodePage(HDC);
367 
368 int
369 WINAPI
370 GdiGetBitmapBitsSize(BITMAPINFO *lpbmi);
371 
372 VOID GdiSAPCallback(PLDC pldc);
373 HGDIOBJ FASTCALL hGetPEBHandle(HANDLECACHETYPE,COLORREF);
374 
375 int FASTCALL DocumentEventEx(PVOID,HANDLE,HDC,int,ULONG,PVOID,ULONG,PVOID);
376 BOOL FASTCALL EndPagePrinterEx(PVOID,HANDLE);
377 BOOL FASTCALL LoadTheSpoolerDrv(VOID);
378 
379 FORCEINLINE
380 PVOID
381 GdiAllocBatchCommand(
382     HDC hdc,
383     USHORT Cmd)
384 {
385     PTEB pTeb;
386     USHORT cjSize;
387     PGDIBATCHHDR pHdr;
388 
389     /* Get a pointer to the TEB */
390     pTeb = NtCurrentTeb();
391 
392     /* Check if we have a valid environment */
393     if (!pTeb || !pTeb->Win32ThreadInfo) return NULL;
394 
395     /* Get the size of the entry */
396     if      (Cmd == GdiBCPatBlt) cjSize = sizeof(GDIBSPATBLT);
397     else if (Cmd == GdiBCPolyPatBlt) cjSize = sizeof(GDIBSPPATBLT);
398     else if (Cmd == GdiBCTextOut) cjSize = sizeof(GDIBSTEXTOUT);
399     else if (Cmd == GdiBCExtTextOut) cjSize = sizeof(GDIBSEXTTEXTOUT);
400     else if (Cmd == GdiBCSetBrushOrg) cjSize = sizeof(GDIBSSETBRHORG);
401     else if (Cmd == GdiBCExtSelClipRgn) cjSize = sizeof(GDIBSEXTSELCLPRGN);
402     else if (Cmd == GdiBCSelObj) cjSize = sizeof(GDIBSOBJECT);
403     else if (Cmd == GdiBCDelRgn) cjSize = sizeof(GDIBSOBJECT);
404     else if (Cmd == GdiBCDelObj) cjSize = sizeof(GDIBSOBJECT);
405     else cjSize = 0;
406 
407     /* Unsupported operation */
408     if (cjSize == 0) return NULL;
409 
410     /* Do we use a DC? */
411     if (hdc)
412     {
413         /* If the batch DC is NULL, we set this one as the new one */
414         if (!pTeb->GdiTebBatch.HDC) pTeb->GdiTebBatch.HDC = hdc;
415 
416         /* If not, check if the batch DC equal to our DC */
417         else if (pTeb->GdiTebBatch.HDC != hdc) return NULL;
418     }
419 
420     /* Check if the buffer is full */
421     if ((pTeb->GdiBatchCount >= GDI_BatchLimit) ||
422         ((pTeb->GdiTebBatch.Offset + cjSize) > GDIBATCHBUFSIZE))
423     {
424         /* Call win32k, the kernel will call NtGdiFlushUserBatch to flush
425            the current batch */
426         NtGdiFlush();
427 
428         // If Flushed, lose the hDC for this batch job! See CORE-15839.
429         if (hdc)
430         {
431             if (!pTeb->GdiTebBatch.HDC) pTeb->GdiTebBatch.HDC = hdc;
432         }
433     }
434 
435     /* Get the head of the entry */
436     pHdr = (PVOID)((PUCHAR)pTeb->GdiTebBatch.Buffer + pTeb->GdiTebBatch.Offset);
437 
438     /* Update Offset and batch count */
439     pTeb->GdiTebBatch.Offset += cjSize;
440     pTeb->GdiBatchCount++;
441 
442     /* Fill in the core fields */
443     pHdr->Cmd = Cmd;
444     pHdr->Size = cjSize;
445 
446     return pHdr;
447 }
448 
449 FORCEINLINE
450 PDC_ATTR
451 GdiGetDcAttr(HDC hdc)
452 {
453     GDILOOBJTYPE eDcObjType;
454     PDC_ATTR pdcattr;
455 
456     /* Check DC object type */
457     eDcObjType = GDI_HANDLE_GET_TYPE(hdc);
458     if ((eDcObjType != GDILoObjType_LO_DC_TYPE) &&
459         (eDcObjType != GDILoObjType_LO_ALTDC_TYPE))
460     {
461         return NULL;
462     }
463 
464     /* Get the DC attribute */
465     if (!GdiGetHandleUserData((HGDIOBJ)hdc, eDcObjType, (PVOID*)&pdcattr))
466     {
467         return NULL;
468     }
469 
470     return pdcattr;
471 }
472 
473 FORCEINLINE
474 PRGN_ATTR
475 GdiGetRgnAttr(HRGN hrgn)
476 {
477     PRGN_ATTR prgnattr;
478 
479     /* Get the region attribute */
480     if (!GdiGetHandleUserData(hrgn, GDILoObjType_LO_REGION_TYPE, (PVOID*)&prgnattr))
481     {
482         return NULL;
483     }
484 
485     return prgnattr;
486 }
487 
488 #ifdef _M_IX86
489 FLOATL FASTCALL EFtoF(EFLOAT_S * efp);
490 #define FOtoF(pfo) EFtoF((EFLOAT_S*)pfo)
491 #else
492 #define FOtoF(pfo) (*(pfo))
493 #endif
494 
495 /* This is an inlined version of lrintf. */
496 FORCEINLINE
497 int
498 _lrintf(float f)
499 {
500 #if defined(_M_IX86) && defined(__GNUC__)
501     int result;
502     __asm__ __volatile__ ("fistpl %0" : "=m" (result) : "t" (f) : "st");
503     return result;
504 #elif defined(_M_IX86) && defined(_MSC_VER)
505     int result;
506     __asm
507     {
508         fld f;
509         fistp result;
510     }
511 #else
512     /* slow, but portable */
513     return (int)(f >= 0 ? f+0.5 : f-0.5);
514 #endif
515 }
516 
517 HBRUSH
518 WINAPI
519 GdiSelectBrush(
520     _In_ HDC hdc,
521     _In_ HBRUSH hbr);
522 
523 HPEN
524 WINAPI
525 GdiSelectPen(
526     _In_ HDC hdc,
527     _In_ HPEN hpen);
528 
529 HFONT
530 WINAPI
531 GdiSelectFont(
532     _In_ HDC hdc,
533     _In_ HFONT hfont);
534 
535 HGDIOBJ
536 WINAPI
537 GdiCreateClientObj(
538     _In_ PVOID pvObject,
539     _In_ GDILOOBJTYPE eObjType);
540 
541 PVOID
542 WINAPI
543 GdiDeleteClientObj(
544     _In_ HGDIOBJ hobj);
545 
546 BOOL
547 WINAPI
548 GdiCreateClientObjLink(
549     _In_ HGDIOBJ hobj,
550     _In_ PVOID pvObject);
551 
552 PVOID
553 WINAPI
554 GdiGetClientObjLink(
555     _In_ HGDIOBJ hobj);
556 
557 PVOID
558 WINAPI
559 GdiRemoveClientObjLink(
560     _In_ HGDIOBJ hobj);
561 
562 extern ULONG gcClientObj;
563 
564 VOID
565 WINAPI
566 METADC_DeleteObject(HGDIOBJ hobj);
567 
568 BOOL
569 WINAPI
570 METADC_DeleteDC(
571     _In_ HDC hdc);
572 
573 INT
574 WINAPI
575 METADC16_Escape(
576     _In_ HDC hdc,
577     _In_ INT nEscape,
578     _In_ INT cbInput,
579     _In_ LPCSTR lpvInData,
580     _Out_ LPVOID lpvOutData);
581 
582 BOOL
583 WINAPI
584 METADC_ExtTextOutW(
585     HDC hdc,
586     INT x,
587     INT y,
588     UINT fuOptions,
589     const RECT *lprc,
590     LPCWSTR lpString,
591     UINT cchString,
592     const INT *lpDx);
593 
594 BOOL
595 WINAPI
596 METADC_PatBlt(
597     _In_ HDC hdc,
598     _In_ INT xLeft,
599     _In_ INT yTop,
600     _In_ INT nWidth,
601     _In_ INT nHeight,
602     _In_ DWORD dwRop);
603 
604 
605 /* The following METADC_* functions follow this pattern: */
606 #define HANDLE_METADC0P(_RetType, _Func, dwError, hdc, ...) \
607     if (GDI_HANDLE_GET_TYPE(hdc) != GDILoObjType_LO_DC_TYPE) \
608     { \
609         DWORD_PTR dwResult; \
610         if (METADC_Dispatch(DCFUNC_##_Func, &dwResult, (DWORD_PTR)dwError, hdc)) \
611         { \
612             return (_RetType)dwResult; \
613         } \
614     }
615 
616 #define HANDLE_METADC(_RetType, _Func, dwError, hdc, ...) \
617     if (GDI_HANDLE_GET_TYPE(hdc) != GDILoObjType_LO_DC_TYPE) \
618     { \
619         DWORD_PTR dwResult = 1; \
620         if (METADC_Dispatch(DCFUNC_##_Func, &dwResult, (DWORD_PTR)dwError, hdc, __VA_ARGS__)) \
621         { \
622             return (_RetType)dwResult; \
623         } \
624     }
625 
626 
627 typedef enum _DCFUNC
628 {
629     //DCFUNC_AbortDoc,
630     DCFUNC_AbortPath,
631     DCFUNC_AlphaBlend, // UNIMPLEMENTED
632     DCFUNC_AngleArc, // UNIMPLEMENTED
633     DCFUNC_Arc,
634     DCFUNC_ArcTo, // UNIMPLEMENTED
635     DCFUNC_BeginPath,
636     //DCFUNC_BitBlt,
637     DCFUNC_Chord,
638     DCFUNC_CloseFigure,
639     DCFUNC_Ellipse,
640     DCFUNC_EndPath,
641     DCFUNC_ExcludeClipRect,
642     DCFUNC_ExtEscape,
643     DCFUNC_ExtFloodFill,
644     DCFUNC_ExtSelectClipRgn,
645     DCFUNC_ExtTextOut,
646     DCFUNC_FillPath,
647     DCFUNC_FillRgn,
648     DCFUNC_FlattenPath,
649     DCFUNC_FrameRgn,
650     DCFUNC_GetDeviceCaps,
651     DCFUNC_GdiComment,
652     DCFUNC_GradientFill, // UNIMPLEMENTED
653     DCFUNC_IntersectClipRect,
654     DCFUNC_InvertRgn,
655     DCFUNC_LineTo,
656     DCFUNC_MaskBlt, // UNIMPLEMENTED
657     DCFUNC_ModifyWorldTransform,
658     DCFUNC_MoveTo,
659     DCFUNC_OffsetClipRgn,
660     DCFUNC_OffsetViewportOrgEx,
661     DCFUNC_OffsetWindowOrgEx,
662     DCFUNC_PathToRegion, // UNIMPLEMENTED
663     DCFUNC_PatBlt,
664     DCFUNC_Pie,
665     DCFUNC_PlgBlt, // UNIMPLEMENTED
666     DCFUNC_PolyBezier,
667     DCFUNC_PolyBezierTo,
668     DCFUNC_PolyDraw,
669     DCFUNC_Polygon,
670     DCFUNC_Polyline,
671     DCFUNC_PolylineTo,
672     DCFUNC_PolyPolygon,
673     DCFUNC_PolyPolyline,
674     DCFUNC_RealizePalette,
675     DCFUNC_Rectangle,
676     DCFUNC_RestoreDC,
677     DCFUNC_RoundRect,
678     DCFUNC_SaveDC,
679     DCFUNC_ScaleViewportExtEx,
680     DCFUNC_ScaleWindowExtEx,
681     DCFUNC_SelectBrush,
682     DCFUNC_SelectClipPath,
683     DCFUNC_SelectFont,
684     DCFUNC_SelectPalette,
685     DCFUNC_SelectPen,
686     DCFUNC_SetDCBrushColor,
687     DCFUNC_SetDCPenColor,
688     DCFUNC_SetDIBitsToDevice,
689     DCFUNC_SetBkColor,
690     DCFUNC_SetBkMode,
691     DCFUNC_SetLayout,
692     //DCFUNC_SetMapMode,
693     DCFUNC_SetPixel,
694     DCFUNC_SetPolyFillMode,
695     DCFUNC_SetROP2,
696     DCFUNC_SetStretchBltMode,
697     DCFUNC_SetTextAlign,
698     DCFUNC_SetTextCharacterExtra,
699     DCFUNC_SetTextColor,
700     DCFUNC_SetTextJustification,
701     DCFUNC_SetViewportExtEx,
702     DCFUNC_SetViewportOrgEx,
703     DCFUNC_SetWindowExtEx,
704     DCFUNC_SetWindowOrgEx,
705     DCFUNC_SetWorldTransform,
706     DCFUNC_StretchBlt,
707     DCFUNC_StrokeAndFillPath,
708     DCFUNC_StrokePath,
709     DCFUNC_TransparentBlt, // UNIMPLEMENTED
710     DCFUNC_WidenPath,
711 
712 } DCFUNC;
713 
714 BOOL
715 METADC_Dispatch(
716     _In_ DCFUNC eFunction,
717     _Out_ PDWORD_PTR pdwResult,
718     _In_ DWORD_PTR dwError,
719     _In_ HDC hdc,
720     ...);
721 
722 #define HANDLE_METADC2(_RetType, _Func, hdc, ...) \
723     if (GDI_HANDLE_GET_TYPE(hdc) != GDILoObjType_LO_DC_TYPE) \
724     { \
725         _RetType result; \
726         if (METADC_##_Func(&result, hdc, __VA_ARGS__)) \
727         { \
728             return result; \
729         } \
730     }
731 
732 BOOL
733 WINAPI
734 METADC_GetAndSetDCDWord(
735     _Out_ PDWORD pdwResult,
736     _In_ HDC hdc,
737     _In_ UINT u,
738     _In_ DWORD dwIn,
739     _In_ ULONG ulMFId,
740     _In_ USHORT usMF16Id,
741     _In_ DWORD dwError);
742 
743 HDC WINAPI GdiConvertAndCheckDC(HDC hdc);
744 
745 /* EOF */
746