xref: /reactos/sdk/include/psdk/winddi.h (revision 420c0360)
1 /*
2  * winddi.h
3  *
4  * GDI device driver interface
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *   Annotations by Timo Kreuzer <timo.kreuzer@reactos.org>
11  *
12  * THIS SOFTWARE IS NOT COPYRIGHTED
13  *
14  * This source code is offered for use in the public domain. You may
15  * use, modify or distribute it freely.
16  *
17  * This code is distributed in the hope that it will be useful but
18  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19  * DISCLAIMED. This includes but is not limited to warranties of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21  *
22  */
23 
24 #ifndef _WINDDI_
25 #define _WINDDI_
26 #pragma once
27 
28 #ifdef __VIDEO_H__
29 #error video.h cannot be included with winddi.h
30 #else
31 
32 //#include <winapifamily.h>
33 #include <ddrawint.h>
34 #include <d3dnthal.h>
35 #include <specstrings.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #ifndef DECLSPEC_IMPORT
42 #define DECLSPEC_IMPORT __attribute__((dllimport))
43 #endif
44 
45 #if defined(_ENGINE_EXPORT_)
46  #define ENGAPI
47 #else
48  #define ENGAPI DECLSPEC_IMPORT
49 #endif
50 
51 #ifndef _NO_DDRAWINT_NO_COM
52 
53 #if !defined(EXTERN_C)
54  #ifdef __cplusplus
55   #define EXTERN_C extern "C"
56   #define __EXTERN_C extern "C"
57  #else
58   #define EXTERN_C extern
59   #define __EXTERN_C
60  #endif
61 #endif /* !defined(EXTERN_C) */
62 
63 #if !defined(DEFINE_GUID)
64  #ifdef INITGUID
65   #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
66       __EXTERN_C const GUID name = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
67  #else /* !INITGUID */
68   #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
69       EXTERN_C const GUID FAR name
70  #endif /* !INITGUID */
71 #endif /* !defined(DEFINE_GUID) */
72 
73 #if !defined(DEFINE_GUIDEX)
74  #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID name
75 #endif /* !defined(DEFINE_GUIDEX) */
76 
77 #if !defined(STATICGUIDOF)
78  #define STATICGUIDOF(guid) STATIC_##guid
79 #endif /* !defined(STATICGUIDOF) */
80 
81 #if !defined(GUID_DEFINED)
82  #define GUID_DEFINED
83  typedef struct _GUID
84  {
85      ULONG Data1;
86      USHORT Data2;
87      USHORT Data3;
88      UCHAR Data4[8];
89  } GUID;
90 #endif /* !defined(GUID_DEFINED) */
91 
92 #if !defined(IsEqualGUID)
93  #define IsEqualGUID(guid1, guid2) \
94      (!memcmp((guid1), (guid2), sizeof(GUID)))
95 #endif /* !defined(IsEqualGUID) */
96 
97 #ifndef IsEqualIID
98  #define IsEqualIID IsEqualGUID
99 #endif /* !defined(IsEqualIID) */
100 
101 #endif /* !_NO_DDRAWINT_NO_COM */
102 
103 #define DDI_DRIVER_VERSION_NT4            0x00020000
104 #define DDI_DRIVER_VERSION_SP3            0x00020003
105 #define DDI_DRIVER_VERSION_NT5            0x00030000
106 #define DDI_DRIVER_VERSION_NT5_01         0x00030100
107 #define DDI_DRIVER_VERSION_NT5_01_SP1     0x00030101
108 
109 #define GDI_DRIVER_VERSION                0x4000
110 
111 #if defined(_X86_) && !defined(USERMODE_DRIVER) && !defined(BUILD_WOW6432)
112 typedef DWORD FLOATL;
113 #else
114 typedef FLOAT FLOATL;
115 #endif
116 
117 typedef SHORT FWORD;
118 typedef LONG LDECI4;
119 typedef ULONG IDENT;
120 
121 typedef ULONG_PTR HFF;
122 typedef ULONG_PTR HFC;
123 
124 typedef LONG PTRDIFF;
125 typedef PTRDIFF *PPTRDIFF;
126 typedef LONG FIX;
127 typedef FIX *PFIX;
128 typedef ULONG ROP4;
129 typedef ULONG MIX;
130 typedef ULONG HGLYPH;
131 typedef HGLYPH *PHGLYPH;
132 
133 typedef LONG_PTR (APIENTRY *PFN)();
134 
135 DECLARE_HANDLE(HBM);
136 DECLARE_HANDLE(HDEV);
137 DECLARE_HANDLE(HSURF);
138 DECLARE_HANDLE(DHSURF);
139 DECLARE_HANDLE(DHPDEV);
140 DECLARE_HANDLE(HDRVOBJ);
141 DECLARE_HANDLE(HSEMAPHORE);
142 
143 typedef _Return_type_success_(return >= 0) long NTSTATUS;
144 
145 #ifndef _NTDDVDEO_
146 typedef struct _ENG_EVENT *PEVENT;
147 #endif
148 
149 #define OPENGL_CMD                        4352
150 #define OPENGL_GETINFO                    4353
151 #define WNDOBJ_SETUP                      4354
152 
153 #define FD_ERROR                          0xFFFFFFFF
154 #define DDI_ERROR                         0xFFFFFFFF
155 
156 #define HFF_INVALID                       ((HFF) 0)
157 #define HFC_INVALID                       ((HFC) 0)
158 #define HGLYPH_INVALID                    ((HGLYPH) -1)
159 
160 #define FP_ALTERNATEMODE                  1
161 #define FP_WINDINGMODE                    2
162 
163 #define DN_ACCELERATION_LEVEL             1
164 #define DN_DEVICE_ORIGIN                  2
165 #define DN_SLEEP_MODE                     3
166 #define DN_DRAWING_BEGIN                  4
167 #if (NTDDI_VERSION >= NTDDI_WIN8)
168 #define DN_ASSOCIATE_WINDOW               5
169 #define DN_COMPOSITION_CHANGED            6
170 #define DN_DRAWING_BEGIN_APIBITMAP        7
171 #define DN_SURFOBJ_DESTRUCTION            8
172 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
173 
174 #define SGI_EXTRASPACE                    0
175 
176 #define DCR_SOLID                         0
177 #define DCR_DRIVER                        1
178 #define DCR_HALFTONE                      2
179 
180 #define GX_IDENTITY                       0
181 #define GX_OFFSET                         1
182 #define GX_SCALE                          2
183 #define GX_GENERAL                        3
184 
185 #define LTOFX(x)        ((x) << 4)
186 #define FXTOL(x)        ((x) >> 4)
187 #define FXTOLFLOOR(x)   ((x) >> 4)
188 #define FXTOLCEILING(x) ((x + 0x0F) >> 4)
189 #define FXTOLROUND(x)   ((((x) >> 3) + 1) >> 1)
190 
191 #define SIZEOFDV(cAxes)   (offsetof(DESIGNVECTOR, dvValues) + (cAxes) * sizeof(LONG))
192 #define SIZEOFAXIW(cAxes) (offsetof(AXESLISTW, axlAxisInfo) + (cAxes) * sizeof(AXISINFOW))
193 #define SIZEOFAXIA(cAxes) (offsetof(AXESLISTA, axlAxisInfo) + (cAxes) * sizeof(AXISINFOA))
194 
195 typedef struct _POINTE {
196 	FLOATL  x;
197 	FLOATL  y;
198 } POINTE, *PPOINTE;
199 
200 typedef union _FLOAT_LONG {
201   FLOATL  e;
202   LONG  l;
203 } FLOAT_LONG, *PFLOAT_LONG;
204 
205 typedef struct _POINTFIX {
206   FIX  x;
207   FIX  y;
208 } POINTFIX, *PPOINTFIX;
209 
210 typedef struct _RECTFX {
211   FIX  xLeft;
212   FIX  yTop;
213   FIX  xRight;
214   FIX  yBottom;
215 } RECTFX, *PRECTFX;
216 
217 typedef struct _POINTQF {
218   LARGE_INTEGER  x;
219   LARGE_INTEGER  y;
220 } POINTQF, *PPOINTQF;
221 
222 
223 typedef struct _BLENDOBJ {
224   BLENDFUNCTION  BlendFunction;
225 } BLENDOBJ,*PBLENDOBJ;
226 
227 /* BRUSHOBJ.flColorType */
228 #define BR_DEVICE_ICM    0x01
229 #define BR_HOST_ICM      0x02
230 #define BR_CMYKCOLOR     0x04
231 #define BR_ORIGCOLOR     0x08
232 
233 typedef struct _BRUSHOBJ {
234   ULONG  iSolidColor;
235   PVOID  pvRbrush;
236   FLONG  flColorType;
237 } BRUSHOBJ;
238 
239 typedef struct _CIECHROMA {
240   LDECI4  x;
241   LDECI4  y;
242   LDECI4  Y;
243 } CIECHROMA;
244 
245 typedef struct _RUN {
246   LONG  iStart;
247   LONG  iStop;
248 } RUN, *PRUN;
249 
250 typedef struct _CLIPLINE {
251   POINTFIX  ptfxA;
252   POINTFIX  ptfxB;
253   LONG  lStyleState;
254   ULONG  c;
255   _Field_size_(c) RUN  arun[1];
256 } CLIPLINE, *PCLIPLINE;
257 
258 /* CLIPOBJ.iDComplexity constants */
259 #define DC_TRIVIAL                        0
260 #define DC_RECT                           1
261 #define DC_COMPLEX                        3
262 
263 /* CLIPOBJ.iFComplexity constants */
264 #define FC_RECT                           1
265 #define FC_RECT4                          2
266 #define FC_COMPLEX                        3
267 
268 /* CLIPOBJ.iMode constants */
269 #define TC_RECTANGLES                     0
270 #define TC_PATHOBJ                        2
271 
272 /* CLIPOBJ.fjOptions constants */
273 #define OC_BANK_CLIP                      1
274 
275 typedef struct _CLIPOBJ {
276   ULONG  iUniq;
277   RECTL  rclBounds;
278   BYTE  iDComplexity;
279   BYTE  iFComplexity;
280   BYTE  iMode;
281   BYTE  fjOptions;
282 } CLIPOBJ;
283 
284 typedef struct _COLORINFO {
285   CIECHROMA  Red;
286   CIECHROMA  Green;
287   CIECHROMA  Blue;
288   CIECHROMA  Cyan;
289   CIECHROMA  Magenta;
290   CIECHROMA  Yellow;
291   CIECHROMA  AlignmentWhite;
292   LDECI4  RedGamma;
293   LDECI4  GreenGamma;
294   LDECI4  BlueGamma;
295   LDECI4  MagentaInCyanDye;
296   LDECI4  YellowInCyanDye;
297   LDECI4  CyanInMagentaDye;
298   LDECI4  YellowInMagentaDye;
299   LDECI4  CyanInYellowDye;
300   LDECI4  MagentaInYellowDye;
301 } COLORINFO, *PCOLORINFO;
302 
303 /* DEVHTADJDATA.DeviceFlags constants */
304 #define DEVHTADJF_COLOR_DEVICE            0x00000001
305 #define DEVHTADJF_ADDITIVE_DEVICE         0x00000002
306 
307 typedef struct _DEVHTINFO {
308   DWORD  HTFlags;
309   DWORD  HTPatternSize;
310   DWORD  DevPelsDPI;
311   COLORINFO  ColorInfo;
312 } DEVHTINFO, *PDEVHTINFO;
313 
314 typedef struct _DEVHTADJDATA {
315   DWORD   DeviceFlags;
316   DWORD   DeviceXDPI;
317   DWORD   DeviceYDPI;
318   PDEVHTINFO  pDefHTInfo;
319   PDEVHTINFO  pAdjHTInfo;
320 } DEVHTADJDATA, *PDEVHTADJDATA;
321 
322 /* DEVINFO.flGraphicsCaps flags */
323 #define GCAPS_BEZIERS           0x00000001
324 #define GCAPS_GEOMETRICWIDE     0x00000002
325 #define GCAPS_ALTERNATEFILL     0x00000004
326 #define GCAPS_WINDINGFILL       0x00000008
327 #define GCAPS_HALFTONE          0x00000010
328 #define GCAPS_COLOR_DITHER      0x00000020
329 #define GCAPS_HORIZSTRIKE       0x00000040
330 #define GCAPS_VERTSTRIKE        0x00000080
331 #define GCAPS_OPAQUERECT        0x00000100
332 #define GCAPS_VECTORFONT        0x00000200
333 #define GCAPS_MONO_DITHER       0x00000400
334 #define GCAPS_ASYNCCHANGE       0x00000800
335 #define GCAPS_ASYNCMOVE         0x00001000
336 #define GCAPS_DONTJOURNAL       0x00002000
337 #define GCAPS_DIRECTDRAW        0x00004000
338 #define GCAPS_ARBRUSHOPAQUE     0x00008000
339 #define GCAPS_PANNING           0x00010000
340 #define GCAPS_HIGHRESTEXT       0x00040000
341 #define GCAPS_PALMANAGED        0x00080000
342 #define GCAPS_DITHERONREALIZE   0x00200000
343 #define GCAPS_NO64BITMEMACCESS  0x00400000
344 #define GCAPS_FORCEDITHER       0x00800000
345 #define GCAPS_GRAY16            0x01000000
346 #define GCAPS_ICM               0x02000000
347 #define GCAPS_CMYKCOLOR         0x04000000
348 #define GCAPS_LAYERED           0x08000000
349 #define GCAPS_ARBRUSHTEXT       0x10000000
350 #define GCAPS_SCREENPRECISION   0x20000000
351 #define GCAPS_FONT_RASTERIZER   0x40000000
352 #define GCAPS_NUP               0x80000000
353 
354 /* DEVINFO.iDitherFormat constants */
355 #define BMF_1BPP       1L
356 #define BMF_4BPP       2L
357 #define BMF_8BPP       3L
358 #define BMF_16BPP      4L
359 #define BMF_24BPP      5L
360 #define BMF_32BPP      6L
361 #define BMF_4RLE       7L
362 #define BMF_8RLE       8L
363 #define BMF_JPEG       9L
364 #define BMF_PNG       10L
365 
366 /* DEVINFO.flGraphicsCaps2 flags */
367 #define GCAPS2_JPEGSRC          0x00000001
368 #define GCAPS2_xxxx             0x00000002
369 #define GCAPS2_PNGSRC           0x00000008
370 #define GCAPS2_CHANGEGAMMARAMP  0x00000010
371 #define GCAPS2_ALPHACURSOR      0x00000020
372 #define GCAPS2_SYNCFLUSH        0x00000040
373 #define GCAPS2_SYNCTIMER        0x00000080
374 #define GCAPS2_ICD_MULTIMON     0x00000100
375 #define GCAPS2_MOUSETRAILS      0x00000200
376 #define GCAPS2_RESERVED1        0x00000400
377 #if (NTDDI_VERSION >= NTDDI_VISTA)
378 #define GCAPS2_EXCLUDELAYERED    0x00000800
379 #define GCAPS2_INCLUDEAPIBITMAPS 0x00001000
380 #define GCAPS2_SHOWHIDDENPOINTER 0x00002000
381 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
382 #if (NTDDI_VERSION >= NTDDI_WIN7)
383 #define GCAPS2_CLEARTYPE         0x00004000
384 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
385 #if (NTDDI_VERSION >= NTDDI_WIN8)
386 #define GCAPS2_ACC_DRIVER        0x00008000
387 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
388 
389 typedef struct _DEVINFO {
390   FLONG  flGraphicsCaps;
391   LOGFONTW  lfDefaultFont;
392   LOGFONTW  lfAnsiVarFont;
393   LOGFONTW  lfAnsiFixFont;
394   ULONG  cFonts;
395   ULONG  iDitherFormat;
396   USHORT  cxDither;
397   USHORT  cyDither;
398   HPALETTE  hpalDefault;
399   FLONG  flGraphicsCaps2;
400 } DEVINFO, *PDEVINFO;
401 
402 struct _DRIVEROBJ;
403 
404 typedef BOOL
405 (APIENTRY CALLBACK *FREEOBJPROC)(
406     _In_ struct _DRIVEROBJ  *pDriverObj);
407 
408 typedef struct _DRIVEROBJ {
409   PVOID  pvObj;
410   FREEOBJPROC  pFreeProc;
411   HDEV  hdev;
412   DHPDEV  dhpdev;
413 } DRIVEROBJ;
414 
415 /* DRVFN.iFunc constants */
416 #define INDEX_DrvEnablePDEV               0L
417 #define INDEX_DrvCompletePDEV             1L
418 #define INDEX_DrvDisablePDEV              2L
419 #define INDEX_DrvEnableSurface            3L
420 #define INDEX_DrvDisableSurface           4L
421 #define INDEX_DrvAssertMode               5L
422 #define INDEX_DrvOffset                   6L
423 #define INDEX_DrvResetPDEV                7L
424 #define INDEX_DrvDisableDriver            8L
425 #define INDEX_DrvUnknown1                 9L
426 #define INDEX_DrvCreateDeviceBitmap       10L
427 #define INDEX_DrvDeleteDeviceBitmap       11L
428 #define INDEX_DrvRealizeBrush             12L
429 #define INDEX_DrvDitherColor              13L
430 #define INDEX_DrvStrokePath               14L
431 #define INDEX_DrvFillPath                 15L
432 #define INDEX_DrvStrokeAndFillPath        16L
433 #define INDEX_DrvPaint                    17L
434 #define INDEX_DrvBitBlt                   18L
435 #define INDEX_DrvCopyBits                 19L
436 #define INDEX_DrvStretchBlt               20L
437 #define INDEX_DrvUnknown2                 21L
438 #define INDEX_DrvSetPalette               22L
439 #define INDEX_DrvTextOut                  23L
440 #define INDEX_DrvEscape                   24L
441 #define INDEX_DrvDrawEscape               25L
442 #define INDEX_DrvQueryFont                26L
443 #define INDEX_DrvQueryFontTree            27L
444 #define INDEX_DrvQueryFontData            28L
445 #define INDEX_DrvSetPointerShape          29L
446 #define INDEX_DrvMovePointer              30L
447 #define INDEX_DrvLineTo                   31L
448 #define INDEX_DrvSendPage                 32L
449 #define INDEX_DrvStartPage                33L
450 #define INDEX_DrvEndDoc                   34L
451 #define INDEX_DrvStartDoc                 35L
452 #define INDEX_DrvUnknown3                 36L
453 #define INDEX_DrvGetGlyphMode             37L
454 #define INDEX_DrvSynchronize              38L
455 #define INDEX_DrvUnknown4                 39L
456 #define INDEX_DrvSaveScreenBits           40L
457 #define INDEX_DrvGetModes                 41L
458 #define INDEX_DrvFree                     42L
459 #define INDEX_DrvDestroyFont              43L
460 #define INDEX_DrvQueryFontCaps            44L
461 #define INDEX_DrvLoadFontFile             45L
462 #define INDEX_DrvUnloadFontFile           46L
463 #define INDEX_DrvFontManagement           47L
464 #define INDEX_DrvQueryTrueTypeTable       48L
465 #define INDEX_DrvQueryTrueTypeOutline     49L
466 #define INDEX_DrvGetTrueTypeFile          50L
467 #define INDEX_DrvQueryFontFile            51L
468 #define INDEX_DrvMovePanning              52L
469 #define INDEX_DrvQueryAdvanceWidths       53L
470 #define INDEX_DrvSetPixelFormat           54L
471 #define INDEX_DrvDescribePixelFormat      55L
472 #define INDEX_DrvSwapBuffers              56L
473 #define INDEX_DrvStartBanding             57L
474 #define INDEX_DrvNextBand                 58L
475 #define INDEX_DrvGetDirectDrawInfo        59L
476 #define INDEX_DrvEnableDirectDraw         60L
477 #define INDEX_DrvDisableDirectDraw        61L
478 #define INDEX_DrvQuerySpoolType           62L
479 #define INDEX_DrvUnknown5                 63L
480 #define INDEX_DrvIcmCreateColorTransform  64L
481 #define INDEX_DrvIcmDeleteColorTransform  65L
482 #define INDEX_DrvIcmCheckBitmapBits       66L
483 #define INDEX_DrvIcmSetDeviceGammaRamp    67L
484 #define INDEX_DrvGradientFill             68L
485 #define INDEX_DrvStretchBltROP            69L
486 #define INDEX_DrvPlgBlt                   70L
487 #define INDEX_DrvAlphaBlend               71L
488 #define INDEX_DrvSynthesizeFont           72L
489 #define INDEX_DrvGetSynthesizedFontFiles  73L
490 #define INDEX_DrvTransparentBlt           74L
491 #define INDEX_DrvQueryPerBandInfo         75L
492 #define INDEX_DrvQueryDeviceSupport       76L
493 #define INDEX_DrvReserved1                77L
494 #define INDEX_DrvReserved2                78L
495 #define INDEX_DrvReserved3                79L
496 #define INDEX_DrvReserved4                80L
497 #define INDEX_DrvReserved5                81L
498 #define INDEX_DrvReserved6                82L
499 #define INDEX_DrvReserved7                83L
500 #define INDEX_DrvReserved8                84L
501 #define INDEX_DrvDeriveSurface            85L
502 #define INDEX_DrvQueryGlyphAttrs          86L
503 #define INDEX_DrvNotify                   87L
504 #define INDEX_DrvSynchronizeSurface       88L
505 #define INDEX_DrvResetDevice              89L
506 #define INDEX_DrvReserved9                90L
507 #define INDEX_DrvReserved10               91L
508 #define INDEX_DrvReserved11               92L
509 #if (NTDDI_VERSION >= NTDDI_VISTA)
510 #define INDEX_DrvRenderHint               93L
511 #if (NTDDI_VERSION >= NTDDI_WIN7)
512 #define INDEX_DrvCreateDeviceBitmapEx     94L
513 #define INDEX_DrvDeleteDeviceBitmapEx     95L
514 #define INDEX_DrvAssociateSharedSurface   96L
515 #define INDEX_DrvSynchronizeRedirectionBitmaps  97L
516 #define INDEX_DrvAccumulateD3DDirtyRect   98L
517 #define INDEX_DrvStartDxInterop           99L
518 #define INDEX_DrvEndDxInterop            100L
519 #define INDEX_DrvLockDisplayArea         101L
520 #define INDEX_DrvUnlockDisplayArea       102L
521 #define INDEX_LAST                       103L
522 #else /* (NTDDI_VERSION >= NTDDI_WIN7) */
523 #define INDEX_LAST                        94L
524 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
525 #else /* (NTDDI_VERSION >= NTDDI_VISTA) */
526 #define INDEX_LAST                        93L
527 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
528 
529 typedef struct _DRVFN {
530   ULONG  iFunc;
531   PFN  pfn;
532 } DRVFN, *PDRVFN;
533 
534 /* DRVENABLEDATA.iDriverVersion constants */
535 #define DDI_DRIVER_VERSION_NT4            0x00020000
536 #define DDI_DRIVER_VERSION_SP3            0x00020003
537 #define DDI_DRIVER_VERSION_NT5            0x00030000
538 #define DDI_DRIVER_VERSION_NT5_01         0x00030100
539 #define DDI_DRIVER_VERSION_NT5_01_SP1     0x00030101
540 
541 typedef struct tagDRVENABLEDATA {
542   ULONG  iDriverVersion;
543   ULONG  c;
544   DRVFN  *pdrvfn;
545 } DRVENABLEDATA, *PDRVENABLEDATA;
546 
547 /* Font file status values */
548 #define FF_SIGNATURE_VERIFIED             0x00000001L
549 #define FF_IGNORED_SIGNATURE              0x00000002L
550 
551  /* Obsolete in Windows 2000 and later */
552 typedef struct {
553   DWORD  nSize;
554   HDC  hdc;
555   PBYTE  pvEMF;
556   PBYTE  pvCurrentRecord;
557 } EMFINFO, *PEMFINFO;
558 
559 typedef struct _ENGSAFESEMAPHORE {
560   HSEMAPHORE  hsem;
561   LONG  lCount;
562 } ENGSAFESEMAPHORE;
563 
564 typedef struct _ENG_TIME_FIELDS {
565   _Field_range_(1601,MAXUSHORT) USHORT  usYear;
566   _Field_range_(1,12) USHORT  usMonth;
567   _Field_range_(1,31) USHORT  usDay;
568   _Field_range_(0,23) USHORT  usHour;
569   _Field_range_(0,59) USHORT  usMinute;
570   _Field_range_(0,59) USHORT  usSecond;
571   _Field_range_(0,999) USHORT  usMilliseconds;
572   _Field_range_(0,6) USHORT  usWeekday; // 0 == Sunday
573 } ENG_TIME_FIELDS, *PENG_TIME_FIELDS;
574 
575 typedef struct _ENUMRECTS {
576   ULONG  c;
577   RECTL  arcl[1];
578 } ENUMRECTS;
579 
580 typedef struct _FD_XFORM {
581   FLOATL  eXX;
582   FLOATL  eXY;
583   FLOATL  eYX;
584   FLOATL  eYY;
585 } FD_XFORM, *PFD_XFORM;
586 
587 /* FD_DEVICEMETRICS.flRealizedType constants */
588 #define FDM_TYPE_BM_SIDE_CONST            0x00000001
589 #define FDM_TYPE_MAXEXT_EQUAL_BM_SIDE     0x00000002
590 #define FDM_TYPE_CHAR_INC_EQUAL_BM_BASE   0x00000004
591 #define FDM_TYPE_ZERO_BEARINGS            0x00000008
592 #define FDM_TYPE_CONST_BEARINGS           0x00000010
593 
594 typedef struct _FD_DEVICEMETRICS {
595   FLONG  flRealizedType;
596   POINTE  pteBase;
597   POINTE  pteSide;
598   LONG  lD;
599   FIX  fxMaxAscender;
600   FIX  fxMaxDescender;
601   POINTL  ptlUnderline1;
602   POINTL  ptlStrikeout;
603   POINTL  ptlULThickness;
604   POINTL  ptlSOThickness;
605   ULONG  cxMax;
606   ULONG  cyMax;
607   ULONG  cjGlyphMax;
608   FD_XFORM  fdxQuantized;
609   LONG  lNonLinearExtLeading;
610   LONG  lNonLinearIntLeading;
611   LONG  lNonLinearMaxCharWidth;
612   LONG  lNonLinearAvgCharWidth;
613   LONG  lMinA;
614   LONG  lMinC;
615   LONG  lMinD;
616   LONG  alReserved[1];
617 } FD_DEVICEMETRICS, *PFD_DEVICEMETRICS;
618 
619 /* FD_GLYPHATTR.iMode constants */
620 #define FO_ATTR_MODE_ROTATE               1
621 
622 typedef struct _FD_GLYPHATTR {
623   ULONG  cjThis;
624   ULONG  cGlyphs;
625   ULONG  iMode;
626   _Field_size_((cGlyphs+7)/8) BYTE  aGlyphAttr[1];
627 } FD_GLYPHATTR, *PFD_GLYPHATTR;
628 
629 /* FD_GLYPHSET.flAccel */
630 #define GS_UNICODE_HANDLES                0x00000001
631 #define GS_8BIT_HANDLES                   0x00000002
632 #define GS_16BIT_HANDLES                  0x00000004
633 
634 typedef struct _WCRUN {
635   WCHAR  wcLow;
636   USHORT  cGlyphs;
637   HGLYPH  *phg;
638 } WCRUN, *PWCRUN;
639 
640 typedef struct _FD_GLYPHSET {
641   ULONG  cjThis;
642   FLONG  flAccel;
643   ULONG  cGlyphsSupported;
644   ULONG  cRuns;
645   _Field_size_(cRuns) WCRUN  awcrun[1];
646 } FD_GLYPHSET, *PFD_GLYPHSET;
647 
648 typedef struct _FD_KERNINGPAIR {
649   WCHAR  wcFirst;
650   WCHAR  wcSecond;
651   FWORD  fwdKern;
652 } FD_KERNINGPAIR;
653 
654  /* Obsolete in Windows 2000 and later */
655 typedef struct _LIGATURE {
656   ULONG culSize;
657   LPWSTR pwsz;
658   ULONG chglyph;
659   HGLYPH ahglyph[1];
660 } LIGATURE, *PLIGATURE;
661 
662  /* Obsolete in Windows 2000 and later */
663 typedef struct _FD_LIGATURE {
664   ULONG culThis;
665   ULONG ulType;
666   ULONG cLigatures;
667   LIGATURE alig[1];
668 } FD_LIGATURE;
669 
670 #if defined(_X86_) && !defined(USERMODE_DRIVER)
671 typedef struct _FLOATOBJ
672 {
673   ULONG  ul1;
674   ULONG  ul2;
675 } FLOATOBJ, *PFLOATOBJ;
676 #else
677 typedef FLOAT FLOATOBJ, *PFLOATOBJ;
678 #endif
679 
680 #ifndef USERMODE_DRIVER
681 typedef struct tagFLOATOBJ_XFORM {
682   FLOATOBJ  eM11;
683   FLOATOBJ  eM12;
684   FLOATOBJ  eM21;
685   FLOATOBJ  eM22;
686   FLOATOBJ  eDx;
687   FLOATOBJ  eDy;
688 } FLOATOBJ_XFORM, *PFLOATOBJ_XFORM, FAR *LPFLOATOBJ_XFORM;
689 #else
690 typedef XFORML FLOATOBJ_XFORM, *PFLOATOBJ_XFORM, FAR *LPFLOATOBJ_XFORM;
691 #endif
692 
693 /* FONTDIFF.fsSelection */
694 #define FM_SEL_ITALIC                     0x0001
695 #define FM_SEL_UNDERSCORE                 0x0002
696 #define FM_SEL_NEGATIVE                   0x0004
697 #define FM_SEL_OUTLINED                   0x0008
698 #define FM_SEL_STRIKEOUT                  0x0010
699 #define FM_SEL_BOLD                       0x0020
700 #define FM_SEL_REGULAR                    0x0040
701 
702 typedef struct _FONTDIFF {
703   BYTE  jReserved1;
704   BYTE  jReserved2;
705   BYTE  jReserved3;
706   BYTE  bWeight;
707   USHORT  usWinWeight;
708   FSHORT  fsSelection;
709   FWORD  fwdAveCharWidth;
710   FWORD  fwdMaxCharInc;
711   POINTL  ptlCaret;
712 } FONTDIFF;
713 
714 typedef struct _FONTSIM {
715   PTRDIFF  dpBold;
716   PTRDIFF  dpItalic;
717   PTRDIFF  dpBoldItalic;
718 } FONTSIM;
719 
720 /* FONTINFO.flCaps constants */
721 #define FO_DEVICE_FONT                    1L
722 #define FO_OUTLINE_CAPABLE                2L
723 
724 typedef struct _FONTINFO {
725   ULONG  cjThis;
726   FLONG  flCaps;
727   ULONG  cGlyphsSupported;
728   ULONG  cjMaxGlyph1;
729   ULONG  cjMaxGlyph4;
730   ULONG  cjMaxGlyph8;
731   ULONG  cjMaxGlyph32;
732 } FONTINFO, *PFONTINFO;
733 
734 /* FONTOBJ.flFontType constants */
735 #define FO_TYPE_RASTER   RASTER_FONTTYPE
736 #define FO_TYPE_DEVICE   DEVICE_FONTTYPE
737 #define FO_TYPE_TRUETYPE TRUETYPE_FONTTYPE
738 #define FO_TYPE_OPENTYPE OPENTYPE_FONTTYPE
739 
740 #define FO_SIM_BOLD      0x00002000
741 #define FO_SIM_ITALIC    0x00004000
742 #define FO_EM_HEIGHT     0x00008000
743 #define FO_GRAY16        0x00010000
744 #define FO_NOGRAY16      0x00020000
745 #define FO_NOHINTS       0x00040000
746 #define FO_NO_CHOICE     0x00080000
747 #define FO_CFF            0x00100000
748 #define FO_POSTSCRIPT     0x00200000
749 #define FO_MULTIPLEMASTER 0x00400000
750 #define FO_VERT_FACE      0x00800000
751 #define FO_DBCS_FONT      0X01000000
752 #define FO_NOCLEARTYPE    0x02000000
753 #define FO_CLEARTYPE_X    0x10000000
754 #define FO_CLEARTYPE_Y    0x20000000
755 #define FO_CLEARTYPENATURAL_X 0x40000000
756 
757 #define FD_NEGATIVE_FONT   1L /* Obsolete in Windows 2000 and later */
758 #define FO_DEVICE_FONT     1L
759 #define FO_OUTLINE_CAPABLE 2L
760 
761 typedef struct _FONTOBJ {
762   ULONG  iUniq;
763   ULONG  iFace;
764   ULONG  cxMax;
765   FLONG  flFontType;
766   ULONG_PTR  iTTUniq;
767   ULONG_PTR  iFile;
768   SIZE  sizLogResPpi;
769   ULONG  ulStyleSize;
770   PVOID  pvConsumer;
771   PVOID  pvProducer;
772 } FONTOBJ;
773 
774 typedef struct _GAMMARAMP {
775   WORD  Red[256];
776   WORD  Green[256];
777   WORD  Blue[256];
778 } GAMMARAMP, *PGAMMARAMP;
779 
780 /* GDIINFO.ulPrimaryOrder constants */
781 #define PRIMARY_ORDER_ABC                 0
782 #define PRIMARY_ORDER_ACB                 1
783 #define PRIMARY_ORDER_BAC                 2
784 #define PRIMARY_ORDER_BCA                 3
785 #define PRIMARY_ORDER_CBA                 4
786 #define PRIMARY_ORDER_CAB                 5
787 
788 /* GDIINFO.ulHTPatternSize constants */
789 #define HT_PATSIZE_2x2                    0
790 #define HT_PATSIZE_2x2_M                  1
791 #define HT_PATSIZE_4x4                    2
792 #define HT_PATSIZE_4x4_M                  3
793 #define HT_PATSIZE_6x6                    4
794 #define HT_PATSIZE_6x6_M                  5
795 #define HT_PATSIZE_8x8                    6
796 #define HT_PATSIZE_8x8_M                  7
797 #define HT_PATSIZE_10x10                  8
798 #define HT_PATSIZE_10x10_M                9
799 #define HT_PATSIZE_12x12                  10
800 #define HT_PATSIZE_12x12_M                11
801 #define HT_PATSIZE_14x14                  12
802 #define HT_PATSIZE_14x14_M                13
803 #define HT_PATSIZE_16x16                  14
804 #define HT_PATSIZE_16x16_M                15
805 #define HT_PATSIZE_SUPERCELL              16
806 #define HT_PATSIZE_SUPERCELL_M            17
807 #define HT_PATSIZE_USER                   18
808 #define HT_PATSIZE_MAX_INDEX              HT_PATSIZE_USER
809 #define HT_PATSIZE_DEFAULT                HT_PATSIZE_SUPERCELL_M
810 #define HT_USERPAT_CX_MIN                 4
811 #define HT_USERPAT_CX_MAX                 256
812 #define HT_USERPAT_CY_MIN                 4
813 #define HT_USERPAT_CY_MAX                 256
814 
815 /* GDIINFO.ulHTOutputFormat constants */
816 #define HT_FORMAT_1BPP                    0
817 #define HT_FORMAT_4BPP                    2
818 #define HT_FORMAT_4BPP_IRGB               3
819 #define HT_FORMAT_8BPP                    4
820 #define HT_FORMAT_16BPP                   5
821 #define HT_FORMAT_24BPP                   6
822 #define HT_FORMAT_32BPP                   7
823 
824 /* GDIINFO.flHTFlags */
825 #define HT_FLAG_SQUARE_DEVICE_PEL         0x00000001
826 #define HT_FLAG_HAS_BLACK_DYE             0x00000002
827 #define HT_FLAG_ADDITIVE_PRIMS            0x00000004
828 #define HT_FLAG_USE_8BPP_BITMASK          0x00000008
829 #define HT_FLAG_INK_HIGH_ABSORPTION       0x00000010
830 #define HT_FLAG_INK_ABSORPTION_INDICES    0x00000060
831 #define HT_FLAG_DO_DEVCLR_XFORM           0x00000080
832 #define HT_FLAG_OUTPUT_CMY                0x00000100
833 #define HT_FLAG_PRINT_DRAFT_MODE          0x00000200
834 #define HT_FLAG_INVERT_8BPP_BITMASK_IDX   0x00000400
835 #define HT_FLAG_8BPP_CMY332_MASK          0xFF000000
836 
837 #define MAKE_CMYMASK_BYTE(c,m,y)          ((BYTE)(((BYTE)(c) & 0x07) << 5) \
838                                           |(BYTE)(((BYTE)(m) & 0x07) << 2) \
839                                           |(BYTE)((BYTE)(y) & 0x03))
840 
841 #define MAKE_CMY332_MASK(c,m,y)           ((DWORD)(((DWORD)(c) & 0x07) << 29)\
842                                           |(DWORD)(((DWORD)(m) & 0x07) << 26)\
843                                           |(DWORD)(((DWORD)(y) & 0x03) << 24))
844 
845 /* GDIINFO.flHTFlags constants */
846 #define HT_FLAG_INK_ABSORPTION_IDX0       0x00000000
847 #define HT_FLAG_INK_ABSORPTION_IDX1       0x00000020
848 #define HT_FLAG_INK_ABSORPTION_IDX2       0x00000040
849 #define HT_FLAG_INK_ABSORPTION_IDX3       0x00000060
850 
851 #define HT_FLAG_HIGHEST_INK_ABSORPTION    (HT_FLAG_INK_HIGH_ABSORPTION \
852                                           |HT_FLAG_INK_ABSORPTION_IDX3)
853 #define HT_FLAG_HIGHER_INK_ABSORPTION     (HT_FLAG_INK_HIGH_ABSORPTION \
854                                           |HT_FLAG_INK_ABSORPTION_IDX2)
855 #define HT_FLAG_HIGH_INK_ABSORPTION       (HT_FLAG_INK_HIGH_ABSORPTION \
856                                           |HT_FLAG_INK_ABSORPTION_IDX1)
857 #define HT_FLAG_NORMAL_INK_ABSORPTION     HT_FLAG_INK_ABSORPTION_IDX0
858 #define HT_FLAG_LOW_INK_ABSORPTION        HT_FLAG_INK_ABSORPTION_IDX1
859 #define HT_FLAG_LOWER_INK_ABSORPTION      HT_FLAG_INK_ABSORPTION_IDX2
860 #define HT_FLAG_LOWEST_INK_ABSORPTION     HT_FLAG_INK_ABSORPTION_IDX3
861 
862 #define HT_BITMASKPALRGB                  (DWORD)'0BGR'
863 #define HT_SET_BITMASKPAL2RGB(pPal)       (*((LPDWORD)(pPal)) = HT_BITMASKPALRGB)
864 #define HT_IS_BITMASKPALRGB(pPal)         (*((LPDWORD)(pPal)) == (DWORD)0)
865 
866 /* GDIINFO.ulPhysicalPixelCharacteristics constants */
867 #define PPC_DEFAULT                       0x0
868 #define PPC_UNDEFINED                     0x1
869 #define PPC_RGB_ORDER_VERTICAL_STRIPES    0x2
870 #define PPC_BGR_ORDER_VERTICAL_STRIPES    0x3
871 #define PPC_RGB_ORDER_HORIZONTAL_STRIPES  0x4
872 #define PPC_BGR_ORDER_HORIZONTAL_STRIPES  0x5
873 
874 #define PPG_DEFAULT                       0
875 #define PPG_SRGB                          1
876 
877 typedef struct _GDIINFO {
878   ULONG  ulVersion;
879   ULONG  ulTechnology;
880   ULONG  ulHorzSize;
881   ULONG  ulVertSize;
882   ULONG  ulHorzRes;
883   ULONG  ulVertRes;
884   ULONG  cBitsPixel;
885   ULONG  cPlanes;
886   ULONG  ulNumColors;
887   ULONG  flRaster;
888   ULONG  ulLogPixelsX;
889   ULONG  ulLogPixelsY;
890   ULONG  flTextCaps;
891   ULONG  ulDACRed;
892   ULONG  ulDACGreen;
893   ULONG  ulDACBlue;
894   ULONG  ulAspectX;
895   ULONG  ulAspectY;
896   ULONG  ulAspectXY;
897   LONG  xStyleStep;
898   LONG  yStyleStep;
899   LONG  denStyleStep;
900   POINTL  ptlPhysOffset;
901   SIZEL  szlPhysSize;
902   ULONG  ulNumPalReg;
903   COLORINFO  ciDevice;
904   ULONG  ulDevicePelsDPI;
905   ULONG  ulPrimaryOrder;
906   ULONG  ulHTPatternSize;
907   ULONG  ulHTOutputFormat;
908   ULONG  flHTFlags;
909   ULONG  ulVRefresh;
910   ULONG  ulBltAlignment;
911   ULONG  ulPanningHorzRes;
912   ULONG  ulPanningVertRes;
913   ULONG  xPanningAlignment;
914   ULONG  yPanningAlignment;
915   ULONG  cxHTPat;
916   ULONG  cyHTPat;
917   LPBYTE  pHTPatA;
918   LPBYTE  pHTPatB;
919   LPBYTE  pHTPatC;
920   ULONG  flShadeBlend;
921   ULONG  ulPhysicalPixelCharacteristics;
922   ULONG  ulPhysicalPixelGamma;
923 } GDIINFO, *PGDIINFO;
924 
925 /* PATHDATA.flags constants */
926 #define PD_BEGINSUBPATH                   0x00000001
927 #define PD_ENDSUBPATH                     0x00000002
928 #define PD_RESETSTYLE                     0x00000004
929 #define PD_CLOSEFIGURE                    0x00000008
930 #define PD_BEZIERS                        0x00000010
931 #define PD_ALL                            (PD_BEGINSUBPATH \
932                                           |PD_ENDSUBPATH \
933                                           |PD_RESETSTYLE \
934                                           |PD_CLOSEFIGURE \
935                                           PD_BEZIERS)
936 
937 typedef struct _PATHDATA {
938   FLONG  flags;
939   ULONG  count;
940   POINTFIX  *pptfx;
941 } PATHDATA, *PPATHDATA;
942 
943 /* PATHOBJ.fl constants */
944 #define PO_BEZIERS                        0x00000001
945 #define PO_ELLIPSE                        0x00000002
946 #define PO_ALL_INTEGERS                   0x00000004
947 #define PO_ENUM_AS_INTEGERS               0x00000008
948 #if (NTDDI_VERSION >= NTDDI_WIN7)
949 #define PO_WIDENED                        0x00000010
950 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
951 
952 typedef struct _PATHOBJ {
953   FLONG  fl;
954   ULONG  cCurves;
955 } PATHOBJ;
956 
957 typedef BYTE GAMMA_TABLES[2][256];
958 
959 typedef struct _GLYPHBITS {
960   POINTL  ptlOrigin;
961   SIZEL  sizlBitmap;
962   BYTE  aj[1];
963 } GLYPHBITS;
964 
965 typedef union _GLYPHDEF {
966   GLYPHBITS  *pgb;
967   PATHOBJ  *ppo;
968 } GLYPHDEF;
969 
970 typedef struct _GLYPHPOS {
971   HGLYPH  hg;
972   GLYPHDEF  *pgdf;
973   POINTL  ptl;
974 } GLYPHPOS, *PGLYPHPOS;
975 
976 typedef struct _GLYPHDATA {
977   GLYPHDEF  gdf;
978   HGLYPH  hg;
979   FIX  fxD;
980   FIX  fxA;
981   FIX  fxAB;
982   FIX  fxInkTop;
983   FIX  fxInkBottom;
984   RECTL  rclInk;
985   POINTQF  ptqD;
986 } GLYPHDATA;
987 
988 typedef struct _IFIEXTRA {
989   ULONG  ulIdentifier;
990   PTRDIFF  dpFontSig;
991   ULONG  cig;
992   PTRDIFF  dpDesignVector;
993   PTRDIFF  dpAxesInfoW;
994   ULONG  aulReserved[1];
995 } IFIEXTRA, *PIFIEXTRA;
996 
997 /* IFIMETRICS constants */
998 
999 #define FM_VERSION_NUMBER                 0x0
1000 
1001 /* IFIMETRICS.fsType constants */
1002 #define FM_TYPE_LICENSED                  0x2
1003 #define FM_READONLY_EMBED                 0x4
1004 #define FM_EDITABLE_EMBED                 0x8
1005 #define FM_NO_EMBEDDING                   FM_TYPE_LICENSED
1006 
1007 /* IFIMETRICS.flInfo constants */
1008 #define FM_INFO_TECH_TRUETYPE             0x00000001
1009 #define FM_INFO_TECH_BITMAP               0x00000002
1010 #define FM_INFO_TECH_STROKE               0x00000004
1011 #define FM_INFO_TECH_OUTLINE_NOT_TRUETYPE 0x00000008
1012 #define FM_INFO_ARB_XFORMS                0x00000010
1013 #define FM_INFO_1BPP                      0x00000020
1014 #define FM_INFO_4BPP                      0x00000040
1015 #define FM_INFO_8BPP                      0x00000080
1016 #define FM_INFO_16BPP                     0x00000100
1017 #define FM_INFO_24BPP                     0x00000200
1018 #define FM_INFO_32BPP                     0x00000400
1019 #define FM_INFO_INTEGER_WIDTH             0x00000800
1020 #define FM_INFO_CONSTANT_WIDTH            0x00001000
1021 #define FM_INFO_NOT_CONTIGUOUS            0x00002000
1022 #define FM_INFO_TECH_MM                   0x00004000
1023 #define FM_INFO_RETURNS_OUTLINES          0x00008000
1024 #define FM_INFO_RETURNS_STROKES           0x00010000
1025 #define FM_INFO_RETURNS_BITMAPS           0x00020000
1026 #define FM_INFO_DSIG                      0x00040000
1027 #define FM_INFO_RIGHT_HANDED              0x00080000
1028 #define FM_INFO_INTEGRAL_SCALING          0x00100000
1029 #define FM_INFO_90DEGREE_ROTATIONS        0x00200000
1030 #define FM_INFO_OPTICALLY_FIXED_PITCH     0x00400000
1031 #define FM_INFO_DO_NOT_ENUMERATE          0x00800000
1032 #define FM_INFO_ISOTROPIC_SCALING_ONLY    0x01000000
1033 #define FM_INFO_ANISOTROPIC_SCALING_ONLY  0x02000000
1034 #define FM_INFO_TECH_CFF                  0x04000000
1035 #define FM_INFO_FAMILY_EQUIV              0x08000000
1036 #define FM_INFO_DBCS_FIXED_PITCH          0x10000000
1037 #define FM_INFO_NONNEGATIVE_AC            0x20000000
1038 #define FM_INFO_IGNORE_TC_RA_ABLE         0x40000000
1039 #define FM_INFO_TECH_TYPE1                0x80000000
1040 
1041 #define MAXCHARSETS                       16 /* Obsolete in Windows 2000 and later */
1042 
1043 /* IFIMETRICS.ulPanoseCulture constants */
1044 #define  FM_PANOSE_CULTURE_LATIN          0x0
1045 
1046 typedef struct _IFIMETRICS {
1047   ULONG  cjThis;
1048   ULONG  cjIfiExtra;
1049   PTRDIFF  dpwszFamilyName;
1050   PTRDIFF  dpwszStyleName;
1051   PTRDIFF  dpwszFaceName;
1052   PTRDIFF  dpwszUniqueName;
1053   PTRDIFF  dpFontSim;
1054   LONG  lEmbedId;
1055   LONG  lItalicAngle;
1056   LONG  lCharBias;
1057   PTRDIFF  dpCharSets;
1058   BYTE  jWinCharSet;
1059   BYTE  jWinPitchAndFamily;
1060   USHORT  usWinWeight;
1061   ULONG  flInfo;
1062   USHORT  fsSelection;
1063   USHORT  fsType;
1064   FWORD  fwdUnitsPerEm;
1065   FWORD  fwdLowestPPEm;
1066   FWORD  fwdWinAscender;
1067   FWORD  fwdWinDescender;
1068   FWORD  fwdMacAscender;
1069   FWORD  fwdMacDescender;
1070   FWORD  fwdMacLineGap;
1071   FWORD  fwdTypoAscender;
1072   FWORD  fwdTypoDescender;
1073   FWORD  fwdTypoLineGap;
1074   FWORD  fwdAveCharWidth;
1075   FWORD  fwdMaxCharInc;
1076   FWORD  fwdCapHeight;
1077   FWORD  fwdXHeight;
1078   FWORD  fwdSubscriptXSize;
1079   FWORD  fwdSubscriptYSize;
1080   FWORD  fwdSubscriptXOffset;
1081   FWORD  fwdSubscriptYOffset;
1082   FWORD  fwdSuperscriptXSize;
1083   FWORD  fwdSuperscriptYSize;
1084   FWORD  fwdSuperscriptXOffset;
1085   FWORD  fwdSuperscriptYOffset;
1086   FWORD  fwdUnderscoreSize;
1087   FWORD  fwdUnderscorePosition;
1088   FWORD  fwdStrikeoutSize;
1089   FWORD  fwdStrikeoutPosition;
1090   BYTE  chFirstChar;
1091   BYTE  chLastChar;
1092   BYTE  chDefaultChar;
1093   BYTE  chBreakChar;
1094   WCHAR  wcFirstChar;
1095   WCHAR  wcLastChar;
1096   WCHAR  wcDefaultChar;
1097   WCHAR  wcBreakChar;
1098   POINTL  ptlBaseline;
1099   POINTL  ptlAspect;
1100   POINTL  ptlCaret;
1101   RECTL  rclFontBox;
1102   BYTE  achVendId[4];
1103   ULONG  cKerningPairs;
1104   ULONG  ulPanoseCulture;
1105   PANOSE  panose;
1106 #if defined(_WIN64)
1107   PVOID  Align;
1108 #endif
1109 } IFIMETRICS, *PIFIMETRICS;
1110 
1111 /* LINEATTRS.fl */
1112 #define LA_GEOMETRIC                      0x00000001
1113 #define LA_ALTERNATE                      0x00000002
1114 #define LA_STARTGAP                       0x00000004
1115 #define LA_STYLED                         0x00000008
1116 
1117 /* LINEATTRS.iJoin */
1118 #define JOIN_ROUND                        0L
1119 #define JOIN_BEVEL                        1L
1120 #define JOIN_MITER                        2L
1121 
1122 /* LINEATTRS.iEndCap */
1123 #define ENDCAP_ROUND                      0L
1124 #define ENDCAP_SQUARE                     1L
1125 #define ENDCAP_BUTT                       2L
1126 
1127 typedef struct _LINEATTRS {
1128   FLONG  fl;
1129   ULONG  iJoin;
1130   ULONG  iEndCap;
1131   FLOAT_LONG  elWidth;
1132   FLOATL  eMiterLimit;
1133   ULONG  cstyle;
1134   PFLOAT_LONG  pstyle;
1135   FLOAT_LONG  elStyleState;
1136 } LINEATTRS, *PLINEATTRS;
1137 
1138 typedef struct _PALOBJ {
1139   ULONG  ulReserved;
1140 } PALOBJ;
1141 
1142 typedef struct _PERBANDINFO {
1143   BOOL  bRepeatThisBand;
1144   SIZEL  szlBand;
1145   ULONG  ulHorzRes;
1146   ULONG  ulVertRes;
1147 } PERBANDINFO, *PPERBANDINFO;
1148 
1149 /* STROBJ.flAccel constants */
1150 #define SO_FLAG_DEFAULT_PLACEMENT        0x00000001
1151 #define SO_HORIZONTAL                    0x00000002
1152 #define SO_VERTICAL                      0x00000004
1153 #define SO_REVERSED                      0x00000008
1154 #define SO_ZERO_BEARINGS                 0x00000010
1155 #define SO_CHAR_INC_EQUAL_BM_BASE        0x00000020
1156 #define SO_MAXEXT_EQUAL_BM_SIDE          0x00000040
1157 #define SO_DO_NOT_SUBSTITUTE_DEVICE_FONT 0x00000080
1158 #define SO_GLYPHINDEX_TEXTOUT            0x00000100
1159 #define SO_ESC_NOT_ORIENT                0x00000200
1160 #define SO_DXDY                          0x00000400
1161 #define SO_CHARACTER_EXTRA               0x00000800
1162 #define SO_BREAK_EXTRA                   0x00001000
1163 
1164 typedef struct _STROBJ {
1165   ULONG  cGlyphs;
1166   FLONG  flAccel;
1167   ULONG  ulCharInc;
1168   RECTL  rclBkGround;
1169   GLYPHPOS  *pgp;
1170   LPWSTR  pwszOrg;
1171 } STROBJ;
1172 
1173 
1174 /* SURFOBJ.iType constants */
1175 #define STYPE_BITMAP                      0L
1176 #define STYPE_DEVICE                      1L
1177 #define STYPE_DEVBITMAP                   3L
1178 
1179 /* SURFOBJ.fjBitmap constants */
1180 #define BMF_TOPDOWN                       0x0001
1181 #define BMF_NOZEROINIT                    0x0002
1182 #define BMF_DONTCACHE                     0x0004
1183 #define BMF_USERMEM                       0x0008
1184 #define BMF_KMSECTION                     0x0010
1185 #define BMF_NOTSYSMEM                     0x0020
1186 #define BMF_WINDOW_BLT                    0x0040
1187 #define BMF_UMPDMEM                       0x0080
1188 #if (NTDDI_VERSION >= NTDDI_WIN7)
1189 #define BMF_TEMP_ALPHA                    0x0100
1190 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
1191 #if (NTDDI_VERSION >= NTDDI_WIN8)
1192 #define BMF_ACC_NOTIFY                    0x8000
1193 #define BMF_RMT_ENTER                     0x4000
1194 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
1195 
1196 #if (NTDDI_VERSION >= NTDDI_WIN8)
1197 #define BMF_RESERVED                      0x3E00
1198 #elif (NTDDI_VERSION >= NTDDI_WIN7)
1199 #define BMF_RESERVED                      0xFE00
1200 #else
1201 #define BMF_RESERVED                      0xFF00
1202 #endif
1203 
1204 typedef struct _SURFOBJ {
1205   DHSURF  dhsurf;
1206   HSURF  hsurf;
1207   DHPDEV  dhpdev;
1208   HDEV  hdev;
1209   SIZEL  sizlBitmap;
1210   ULONG  cjBits;
1211   PVOID  pvBits;
1212   PVOID  pvScan0;
1213   LONG  lDelta;
1214   ULONG  iUniq;
1215   ULONG  iBitmapFormat;
1216   USHORT  iType;
1217   USHORT  fjBitmap;
1218 } SURFOBJ;
1219 
1220 typedef struct _TYPE1_FONT {
1221   HANDLE  hPFM;
1222   HANDLE  hPFB;
1223   ULONG  ulIdentifier;
1224 } TYPE1_FONT;
1225 
1226 typedef struct _WNDOBJ {
1227   CLIPOBJ  coClient;
1228   PVOID  pvConsumer;
1229   RECTL  rclClient;
1230   SURFOBJ  *psoOwner;
1231 } WNDOBJ, *PWNDOBJ;
1232 
1233 typedef struct _XFORML {
1234   FLOATL  eM11;
1235   FLOATL  eM12;
1236   FLOATL  eM21;
1237   FLOATL  eM22;
1238   FLOATL  eDx;
1239   FLOATL  eDy;
1240 } XFORML, *PXFORML;
1241 
1242 typedef struct _XFORMOBJ {
1243   ULONG  ulReserved;
1244 } XFORMOBJ;
1245 
1246 /* XLATEOBJ.flXlate constants */
1247 #define XO_TRIVIAL                        0x00000001
1248 #define XO_TABLE                          0x00000002
1249 #define XO_TO_MONO                        0x00000004
1250 #define XO_FROM_CMYK                      0x00000008
1251 #define XO_DEVICE_ICM                     0x00000010
1252 #define XO_HOST_ICM                       0x00000020
1253 
1254 typedef struct _XLATEOBJ {
1255   ULONG  iUniq;
1256   FLONG  flXlate;
1257   USHORT  iSrcType;
1258   USHORT  iDstType;
1259   ULONG  cEntries;
1260   ULONG  *pulXlate;
1261 } XLATEOBJ;
1262 
1263 /* WNDOBJCHANGEPROC.fl constants */
1264 #define WOC_RGN_CLIENT_DELTA              0x00000001
1265 #define WOC_RGN_CLIENT                    0x00000002
1266 #define WOC_RGN_SURFACE_DELTA             0x00000004
1267 #define WOC_RGN_SURFACE                   0x00000008
1268 #define WOC_CHANGED                       0x00000010
1269 #define WOC_DELETE                        0x00000020
1270 #define WOC_DRAWN                         0x00000040
1271 #define WOC_SPRITE_OVERLAP                0x00000080
1272 #define WOC_SPRITE_NO_OVERLAP             0x00000100
1273 #if (NTDDI_VERSION >= NTDDI_VISTA)
1274 #define WOC_RGN_SPRITE                    0x00000200
1275 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
1276 
1277 typedef VOID (APIENTRY CALLBACK *WNDOBJCHANGEPROC)(
1278     _In_ WNDOBJ *pwo,
1279     _In_ FLONG fl);
1280 
1281 
1282 ENGAPI
1283 HANDLE
1284 APIENTRY
1285 BRUSHOBJ_hGetColorTransform(
1286     _In_ BRUSHOBJ *pbo);
1287 
1288 _Ret_opt_bytecount_(cj)
1289 ENGAPI
1290 PVOID
1291 APIENTRY
1292 BRUSHOBJ_pvAllocRbrush(
1293     _In_ BRUSHOBJ *pbo,
1294     _In_ ULONG cj);
1295 
1296 ENGAPI
1297 PVOID
1298 APIENTRY
1299 BRUSHOBJ_pvGetRbrush(
1300     _In_ BRUSHOBJ *pbo);
1301 
1302 ENGAPI
1303 ULONG
1304 APIENTRY
1305 BRUSHOBJ_ulGetBrushColor(
1306     _In_ BRUSHOBJ *pbo);
1307 
1308 ENGAPI
1309 BOOL
1310 APIENTRY
1311 CLIPOBJ_bEnum(
1312     _In_ CLIPOBJ *pco,
1313     _In_ ULONG cj,
1314     _Out_bytecap_(cj) ULONG *pul);
1315 
1316 /* CLIPOBJ_cEnumStart.iType constants */
1317 #define CT_RECTANGLES                     0L
1318 
1319 /* CLIPOBJ_cEnumStart.iDirection constants */
1320 #define CD_RIGHTDOWN                      0x00000000
1321 #define CD_LEFTDOWN                       0x00000001
1322 #define CD_LEFTWARDS                      0x00000001
1323 #define CD_RIGHTUP                        0x00000002
1324 #define CD_UPWARDS                        0x00000002
1325 #define CD_LEFTUP                         0x00000003
1326 #define CD_ANY                            0x00000004
1327 
1328 ENGAPI
1329 ULONG
1330 APIENTRY
1331 CLIPOBJ_cEnumStart(
1332     _Inout_ CLIPOBJ *pco,
1333     _In_ BOOL bAll,
1334     _In_ ULONG iType,
1335     _In_ ULONG iDirection,
1336     _In_ ULONG cLimit);
1337 
1338 ENGAPI
1339 PATHOBJ*
1340 APIENTRY
1341 CLIPOBJ_ppoGetPath(
1342     _In_ CLIPOBJ *pco);
1343 
1344 #if (NTDDI_VERSION >= NTDDI_VISTA)
1345 ENGAPI
1346 HANDLE
1347 APIENTRY
1348 CLIPOBJ_GetRgn(
1349     _In_ CLIPOBJ* pco);
1350 #endif
1351 
1352 ENGAPI
1353 VOID
1354 APIENTRY
1355 EngAcquireSemaphore(
1356     _Inout_ HSEMAPHORE hsem);
1357 
1358 #define FL_ZERO_MEMORY                    0x00000001
1359 #define FL_NONPAGED_MEMORY                0x00000002
1360 #if (NTDDI_VERSION >= NTDDI_WIN7)
1361 #define FL_NON_SESSION                    0x00000004
1362 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
1363 
1364 #ifdef USERMODE_DRIVER
1365 
1366 #define EngAllocMem(fl, cj, tag) ((PVOID)GlobalAlloc(((fl) & FL_ZERO_MEMORY) ? GPTR : GMEM_FIXED, cj))
1367 #define EngAllocPrivateUserMem(psl, cj, tag) ((PVOID)GlobalAlloc(GMEM_FIXED, cj))
1368 #define EngAllocUserMem(cj, tag) ((PVOID)GlobalAlloc(GMEM_FIXED, cj))
1369 
1370 #else /* !USERMODE_DRIVER */
1371 
1372 _Must_inspect_result_
1373 _When_(fl & FL_ZERO_MEMORY, _Ret_opt_bytecount_(cjMemSize))
1374 _When_(!(fl & FL_ZERO_MEMORY), _Ret_opt_bytecap_(cjMemSize))
1375 __drv_allocatesMem(Mem)
1376 ENGAPI
1377 PVOID
1378 APIENTRY
1379 EngAllocMem(
1380     _In_ ULONG fl,
1381     _In_ ULONG cjMemSize,
1382     _In_ ULONG ulTag);
1383 
1384 _Must_inspect_result_
1385 _Ret_opt_bytecount_(cjMemSize)
1386 __drv_allocatesMem(PrivateUserMem)
1387 ENGAPI
1388 PVOID
1389 APIENTRY
1390 EngAllocPrivateUserMem(
1391     _In_ PDD_SURFACE_LOCAL psl,
1392     _In_ SIZE_T cjMemSize,
1393     _In_ ULONG ulTag);
1394 
1395 _Must_inspect_result_
1396 _Ret_opt_bytecount_(cjMemSize)
1397 __drv_allocatesMem(UserMem)
1398 ENGAPI
1399 PVOID
1400 APIENTRY
1401 EngAllocUserMem(
1402     _In_ SIZE_T cjMemSize,
1403     _In_ ULONG ulTag);
1404 
1405 #endif /* !USERMODE_DRIVER */
1406 
1407 ENGAPI
1408 BOOL
1409 APIENTRY
1410 EngAlphaBlend(
1411     _Inout_ SURFOBJ *psoDest,
1412     _In_ SURFOBJ *psoSrc,
1413     _In_opt_ CLIPOBJ *pco,
1414     _In_opt_ XLATEOBJ *pxlo,
1415     _In_ RECTL *prclDest,
1416     _In_ RECTL *prclSrc,
1417     _In_ BLENDOBJ *pBlendObj);
1418 
1419 /* EngAssociateSurface.flHooks constants */
1420 #define HOOK_BITBLT                       0x00000001
1421 #define HOOK_STRETCHBLT                   0x00000002
1422 #define HOOK_PLGBLT                       0x00000004
1423 #define HOOK_TEXTOUT                      0x00000008
1424 #define HOOK_PAINT                        0x00000010
1425 #define HOOK_STROKEPATH                   0x00000020
1426 #define HOOK_FILLPATH                     0x00000040
1427 #define HOOK_STROKEANDFILLPATH            0x00000080
1428 #define HOOK_LINETO                       0x00000100
1429 #define HOOK_COPYBITS                     0x00000400
1430 #define HOOK_MOVEPANNING                  0x00000800
1431 #define HOOK_SYNCHRONIZE                  0x00001000
1432 #define HOOK_STRETCHBLTROP                0x00002000
1433 #define HOOK_SYNCHRONIZEACCESS            0x00004000
1434 #define HOOK_TRANSPARENTBLT               0x00008000
1435 #define HOOK_ALPHABLEND                   0x00010000
1436 #define HOOK_GRADIENTFILL                 0x00020000
1437 #if (NTDDI_VERSION >= NTDDI_VISTA)
1438 #define HOOK_FLAGS                        0x0003b5ef
1439 #else
1440 #define HOOK_FLAGS                        0x0003b5ff
1441 #endif
1442 
1443 ENGAPI
1444 BOOL
1445 APIENTRY
1446 EngAssociateSurface(
1447     _In_ HSURF hsurf,
1448     _In_ HDEV hdev,
1449     _In_ FLONG flHooks);
1450 
1451 ENGAPI
1452 BOOL
1453 APIENTRY
1454 EngBitBlt(
1455     _Inout_ SURFOBJ *psoTrg,
1456     _In_opt_ SURFOBJ *psoSrc,
1457     _In_opt_ SURFOBJ *psoMask,
1458     _In_opt_ CLIPOBJ *pco,
1459     _In_opt_ XLATEOBJ *pxlo,
1460     _In_ RECTL *prclTrg,
1461     _In_opt_ POINTL *pptlSrc,
1462     _In_opt_ POINTL *pptlMask,
1463     _In_opt_ BRUSHOBJ *pbo,
1464     _In_opt_ POINTL *pptlBrush,
1465     _In_ ROP4 rop4);
1466 
1467 ENGAPI
1468 BOOL
1469 APIENTRY
1470 EngCheckAbort(
1471     _In_ SURFOBJ *pso);
1472 
1473 ENGAPI
1474 VOID
1475 APIENTRY
1476 EngClearEvent(
1477     _In_ PEVENT pEvent);
1478 
1479 _Success_(return != 0)
1480 ENGAPI
1481 FD_GLYPHSET*
1482 APIENTRY
1483 EngComputeGlyphSet(
1484     _In_ INT nCodePage,
1485     _In_ INT nFirstChar,
1486     _In_ INT cChars);
1487 
1488 /* EngControlSprites.fl constants */
1489 #define ECS_TEARDOWN                      0x00000001
1490 #define ECS_REDRAW                        0x00000002
1491 
1492 ENGAPI
1493 BOOL
1494 APIENTRY
1495 EngControlSprites(
1496     _Inout_ WNDOBJ *pwo,
1497     _In_ FLONG fl);
1498 
1499 ENGAPI
1500 BOOL
1501 APIENTRY
1502 EngCopyBits(
1503     _In_ SURFOBJ *psoDest,
1504     _In_ SURFOBJ *psoSrc,
1505     _In_opt_ CLIPOBJ *pco,
1506     _In_opt_ XLATEOBJ *pxlo,
1507     _In_ __in_data_source(USER_MODE) RECTL *prclDest,
1508     _In_ __in_data_source(USER_MODE) POINTL *pptlSrc);
1509 
1510 ENGAPI
1511 HBITMAP
1512 APIENTRY
1513 EngCreateBitmap(
1514     _In_ SIZEL sizl,
1515     _In_ LONG lWidth,
1516     _In_ ULONG iFormat,
1517     _In_ FLONG fl,
1518     _In_opt_ PVOID pvBits);
1519 
1520 ENGAPI
1521 CLIPOBJ*
1522 APIENTRY
1523 EngCreateClip(VOID);
1524 
1525 _Must_inspect_result_
1526 ENGAPI
1527 HBITMAP
1528 APIENTRY
1529 EngCreateDeviceBitmap(
1530     _In_ DHSURF dhsurf,
1531     _In_ SIZEL sizl,
1532     _In_ ULONG iFormatCompat);
1533 
1534 _Must_inspect_result_
1535 ENGAPI
1536 HSURF
1537 APIENTRY
1538 EngCreateDeviceSurface(
1539     _In_ DHSURF dhsurf,
1540     _In_ SIZEL sizl,
1541     _In_ ULONG iFormatCompat);
1542 
1543 _Must_inspect_result_
1544 ENGAPI
1545 HDRVOBJ
1546 APIENTRY
1547 EngCreateDriverObj(
1548     _In_ PVOID pvObj,
1549     _In_opt_ FREEOBJPROC pFreeObjProc,
1550     _In_ HDEV hdev);
1551 
1552 _Must_inspect_result_
1553 _Success_(return != FALSE)
1554 ENGAPI
1555 BOOL
1556 APIENTRY
1557 EngCreateEvent(
1558     _Outptr_ PEVENT *ppEvent);
1559 
1560 /* EngCreatePalette.iMode constants */
1561 #define PAL_INDEXED                       0x00000001
1562 #define PAL_BITFIELDS                     0x00000002
1563 #define PAL_RGB                           0x00000004
1564 #define PAL_BGR                           0x00000008
1565 #define PAL_CMYK                          0x00000010
1566 
1567 _Must_inspect_result_
1568 ENGAPI
1569 HPALETTE
1570 APIENTRY
1571 EngCreatePalette(
1572     _In_ ULONG iMode,
1573     _In_ ULONG cColors,
1574     _In_ ULONG *pulColors,
1575     _In_ FLONG flRed,
1576     _In_ FLONG flGreen,
1577     _In_ FLONG flBlue);
1578 
1579 ENGAPI
1580 PATHOBJ*
1581 APIENTRY
1582 EngCreatePath(VOID);
1583 
1584 __drv_allocatesMem(Mem)
1585 _Post_writable_byte_size_(sizeof(ERESOURCE))
1586 ENGAPI
1587 HSEMAPHORE
1588 APIENTRY
1589 EngCreateSemaphore(
1590     VOID);
1591 
1592 /* EngCreateWnd.fl constants */
1593 #define WO_RGN_CLIENT_DELTA               0x00000001
1594 #define WO_RGN_CLIENT                     0x00000002
1595 #define WO_RGN_SURFACE_DELTA              0x00000004
1596 #define WO_RGN_SURFACE                    0x00000008
1597 #define WO_RGN_UPDATE_ALL                 0x00000010
1598 #define WO_RGN_WINDOW                     0x00000020
1599 #define WO_DRAW_NOTIFY                    0x00000040
1600 #define WO_SPRITE_NOTIFY                  0x00000080
1601 #define WO_RGN_DESKTOP_COORD              0x00000100
1602 #if (NTDDI_VERSION >= NTDDI_VISTA)
1603 #define WO_RGN_SPRITE                     0x00000200
1604 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
1605 
1606 _Must_inspect_result_
1607 ENGAPI
1608 WNDOBJ*
1609 APIENTRY
1610 EngCreateWnd(
1611     _In_ SURFOBJ *pso,
1612     _In_ HWND hwnd,
1613     _In_ WNDOBJCHANGEPROC pfn,
1614     _In_ FLONG fl,
1615     _In_ INT iPixelFormat);
1616 
1617 _Analysis_noreturn_
1618 ENGAPI
1619 VOID
1620 APIENTRY
1621 EngDebugBreak(VOID);
1622 
1623 ENGAPI
1624 VOID
1625 APIENTRY
1626 EngDebugPrint(
1627     _In_z_ PCHAR StandardPrefix,
1628     _In_z_ PCHAR DebugMessage,
1629     _In_ va_list ap);
1630 
1631 ENGAPI
1632 VOID
1633 APIENTRY
1634 EngDeleteClip(
1635     _In_ _Post_ptr_invalid_ CLIPOBJ *pco);
1636 
1637 ENGAPI
1638 BOOL
1639 APIENTRY
1640 EngDeleteDriverObj(
1641     _In_ _Post_ptr_invalid_ HDRVOBJ hdo,
1642     _In_ BOOL bCallBack,
1643     _In_ BOOL bLocked);
1644 
1645 ENGAPI
1646 BOOL
1647 APIENTRY
1648 EngDeleteEvent(
1649     _In_ _Post_ptr_invalid_ PEVENT pEvent);
1650 
1651 ENGAPI
1652 BOOL
1653 APIENTRY
1654 EngDeleteFile(
1655     _In_ LPWSTR pwszFileName);
1656 
1657 ENGAPI
1658 BOOL
1659 APIENTRY
1660 EngDeletePalette(
1661     _In_ _Post_ptr_invalid_ HPALETTE hpal);
1662 
1663 ENGAPI
1664 VOID
1665 APIENTRY
1666 EngDeletePath(
1667     _In_ _Post_ptr_invalid_ PATHOBJ *ppo);
1668 
1669 ENGAPI
1670 VOID
1671 APIENTRY
1672 EngDeleteSafeSemaphore(
1673     _Inout_ _Post_invalid_ ENGSAFESEMAPHORE *pssem);
1674 
1675 _Requires_lock_not_held_(*hsem)
1676 ENGAPI
1677 VOID
1678 APIENTRY
1679 EngDeleteSemaphore(
1680     _Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem);
1681 
1682 ENGAPI
1683 BOOL
1684 APIENTRY
1685 EngDeleteSurface(
1686     _In_ _Post_ptr_invalid_ HSURF hsurf);
1687 
1688 ENGAPI
1689 VOID
1690 APIENTRY
1691 EngDeleteWnd(
1692     _In_ _Post_ptr_invalid_ WNDOBJ *pwo);
1693 
1694 _Success_(return==0)
1695 ENGAPI
1696 DWORD
1697 APIENTRY
1698 EngDeviceIoControl(
1699     _In_ HANDLE hDevice,
1700     _In_ DWORD dwIoControlCode,
1701     _In_reads_bytes_opt_(cjInBufferSize) LPVOID lpInBuffer,
1702     _In_ DWORD cjInBufferSize,
1703     _Out_writes_bytes_opt_(cjOutBufferSize) LPVOID lpOutBuffer,
1704     _In_ DWORD cjOutBufferSize,
1705     _Out_ LPDWORD lpBytesReturned);
1706 
1707 #define DM_DEFAULT                        0x00000001
1708 #define DM_MONOCHROME                     0x00000002
1709 
1710 ENGAPI
1711 ULONG
1712 APIENTRY
1713 EngDitherColor(
1714     _In_ HDEV hdev,
1715     _In_ ULONG iMode,
1716     _In_ ULONG rgb,
1717     _When_(iMode == DM_DEFAULT, _Out_writes_bytes_(16*8))
1718     _When_(iMode == DM_MONOCHROME, _Out_writes_bytes_(8))
1719         ULONG *pul);
1720 
1721 /* Obsolete in Windows 2000 and later */
1722 ENGAPI
1723 HRESULT
1724 APIENTRY
1725 EngDxIoctl(
1726     _In_ ULONG ulIoctl,
1727     _Inout_ PVOID pBuffer,
1728     _In_ ULONG ulBufferSize);
1729 
1730 #ifdef USERMODE_DRIVER
1731 #define EngEnumForms        EnumForms
1732 #else /* !USERMODE_DRIVER */
1733 ENGAPI
1734 BOOL
1735 APIENTRY
1736 EngEnumForms(
1737     _In_ HANDLE hPrinter,
1738     _In_ DWORD Level,
1739     _Out_writes_bytes_opt_(cbBuf) LPBYTE pForm,
1740     _In_ DWORD cbBuf,
1741     _Out_ LPDWORD pcbNeeded,
1742     _Out_ LPDWORD pcReturned);
1743 #endif /* !USERMODE_DRIVER */
1744 
1745 ENGAPI
1746 BOOL
1747 APIENTRY
1748 EngEraseSurface(
1749     _In_ SURFOBJ *pso,
1750     _In_ RECTL *prcl,
1751     _In_ ULONG iColor);
1752 
1753 ENGAPI
1754 BOOL
1755 APIENTRY
1756 EngFillPath(
1757     _Inout_ SURFOBJ *pso,
1758     _In_ PATHOBJ *ppo,
1759     _In_ CLIPOBJ *pco,
1760     _In_ BRUSHOBJ *pbo,
1761     _In_ POINTL *pptlBrushOrg,
1762     _In_ MIX mix,
1763     _In_ FLONG flOptions);
1764 
1765 #ifdef USERMODE_DRIVER
1766 #define EngFindImageProcAddress(h, procname) ((PVOID) GetProcAddress(h, procname))
1767 #else /* !USERMODE_DRIVER */
1768 ENGAPI
1769 PVOID
1770 APIENTRY
1771 EngFindImageProcAddress(
1772     _In_ HANDLE hModule,
1773     _In_ LPSTR lpProcName);
1774 #endif /* !USERMODE_DRIVER */
1775 
1776 ENGAPI
1777 PVOID
1778 APIENTRY
1779 EngFindResource(
1780     _In_ HANDLE h,
1781     _In_ INT iName,
1782     _In_ INT iType,
1783     _Out_ PULONG pulSize);
1784 
1785 _Must_inspect_result_
1786 _Ret_opt_bytecap_(cjSize)
1787 ENGAPI
1788 PVOID
1789 APIENTRY
1790 EngFntCacheAlloc(
1791     _In_ ULONG ulFastCheckSum,
1792     _In_ ULONG cjSize);
1793 
1794 /* EngFntCacheFault.iFaultMode constants */
1795 #define ENG_FNT_CACHE_READ_FAULT          0x00000001
1796 #define ENG_FNT_CACHE_WRITE_FAULT         0x00000002
1797 
1798 ENGAPI
1799 VOID
1800 APIENTRY
1801 EngFntCacheFault(
1802     _In_ ULONG ulFastCheckSum,
1803     _In_ ULONG iFaultMode);
1804 
1805 ENGAPI
1806 PVOID
1807 APIENTRY
1808 EngFntCacheLookUp(
1809     _In_ ULONG FastCheckSum,
1810     _Out_ ULONG *pulSize);
1811 
1812 #ifdef USERMODE_DRIVER
1813 
1814 #define EngFreeMem(p)               GlobalFree((HGLOBAL) (p))
1815 #define EngFreePrivateUserMem( psl, p)        GlobalFree((HGLOBAL) (p))
1816 #define EngFreeUserMem(p)           GlobalFree((HGLOBAL) (p))
1817 
1818 #else /* !USERMODE_DRIVER */
1819 
1820 ENGAPI
1821 VOID
1822 APIENTRY
1823 EngFreeMem(
1824     _Pre_notnull_ __drv_freesMem(Mem) PVOID pv);
1825 
1826 ENGAPI
1827 VOID
1828 APIENTRY
1829 EngFreePrivateUserMem(
1830     _In_ PDD_SURFACE_LOCAL psl,
1831     _Pre_notnull_ __drv_freesMem(PrivateUserMem) PVOID pv);
1832 
1833 ENGAPI
1834 VOID
1835 APIENTRY
1836 EngFreeUserMem(
1837     _Pre_notnull_ __drv_freesMem(UserMem) PVOID pv);
1838 
1839 #endif /* !USERMODE_DRIVER */
1840 
1841 ENGAPI
1842 VOID
1843 APIENTRY
1844 EngFreeModule(
1845     _In_ _Post_invalid_ HANDLE h);
1846 
1847 
1848 ENGAPI
1849 VOID
1850 APIENTRY
1851 EngGetCurrentCodePage(
1852     _Out_ PUSHORT OemCodePage,
1853     _Out_ PUSHORT AnsiCodePage);
1854 
1855 ENGAPI
1856 HANDLE
1857 APIENTRY
1858 EngGetCurrentProcessId(VOID);
1859 
1860 ENGAPI
1861 HANDLE
1862 APIENTRY
1863 EngGetCurrentThreadId(VOID);
1864 
1865 _Must_inspect_result_ _Ret_z_
1866 ENGAPI
1867 LPWSTR
1868 APIENTRY
1869 EngGetDriverName(
1870     _In_ HDEV hdev);
1871 
1872 ENGAPI
1873 BOOL
1874 APIENTRY
1875 EngGetFileChangeTime(
1876     _In_ HANDLE h,
1877     _Out_ LARGE_INTEGER *pChangeTime);
1878 
1879 ENGAPI
1880 BOOL
1881 APIENTRY
1882 EngGetFilePath(
1883     _In_ HANDLE h,
1884     _Out_ WCHAR (*pDest)[MAX_PATH+1]);
1885 
1886 #ifdef USERMODE_DRIVER
1887 #define EngGetForm GetForm
1888 #define EngGetLastError GetLastError
1889 #define EngGetPrinter GetPrinter
1890 #define EngGetPrinterData GetPrinterData
1891 #else /* !USERMODE_DRIVER */
1892 ENGAPI
1893 BOOL
1894 APIENTRY
1895 EngGetForm(
1896     _In_ HANDLE hPrinter,
1897     _In_ LPWSTR pFormName,
1898     _In_ DWORD Level,
1899     _In_reads_bytes_opt_(cbBuf) LPBYTE pForm,
1900     _In_ DWORD cbBuf,
1901     _Out_ LPDWORD pcbNeeded);
1902 
1903 ENGAPI
1904 ULONG
1905 APIENTRY
1906 EngGetLastError(VOID);
1907 
1908 ENGAPI
1909 BOOL
1910 APIENTRY
1911 EngGetPrinter(
1912     _In_ HANDLE hPrinter,
1913     _In_ DWORD dwLevel,
1914     _Out_writes_bytes_opt_(cbBuf) LPBYTE pPrinter,
1915     _In_ DWORD  cbBuf,
1916     _Out_ LPDWORD pcbNeeded);
1917 
1918 ENGAPI
1919 DWORD
1920 APIENTRY
1921 EngGetPrinterData(
1922     _In_ HANDLE hPrinter,
1923     _In_ LPWSTR pValueName,
1924     _Out_opt_ LPDWORD pType,
1925     _Out_writes_bytes_opt_(cjSize) LPBYTE pData,
1926     _In_ DWORD cjSize,
1927     _Out_ LPDWORD pcjNeeded);
1928 #endif /* !USERMODE_DRIVER */
1929 
1930 ENGAPI
1931 LPWSTR
1932 APIENTRY
1933 EngGetPrinterDataFileName(
1934     _In_ HDEV hdev);
1935 
1936 #ifdef USERMODE_DRIVER
1937 #define EngGetPrinterDriver GetPrinterDriver
1938 #else /* !USERMODE_DRIVER */
1939 ENGAPI
1940 BOOL
1941 APIENTRY
1942 EngGetPrinterDriver(
1943     _In_ HANDLE hPrinter,
1944     _In_opt_ LPWSTR pEnvironment,
1945     _In_ DWORD dwLevel,
1946     _Out_writes_bytes_opt_(cjBufSize) BYTE *lpbDrvInfo,
1947     _In_ DWORD cjBufSize,
1948     _Out_ DWORD *pcjNeeded);
1949 #endif /* !USERMODE_DRIVER */
1950 
1951 ENGAPI
1952 HANDLE
1953 APIENTRY
1954 EngGetProcessHandle(VOID);
1955 
1956 ENGAPI
1957 BOOL
1958 APIENTRY
1959 EngGetType1FontList(
1960     _In_ HDEV hdev,
1961     _Out_writes_bytes_opt_(cjType1Buffer) TYPE1_FONT *pType1Buffer,
1962     _In_ ULONG cjType1Buffer,
1963     _Out_ PULONG pulLocalFonts,
1964     _Out_ PULONG pulRemoteFonts,
1965     _Out_ LARGE_INTEGER *pLastModified);
1966 
1967 ENGAPI
1968 BOOL
1969 APIENTRY
1970 EngGradientFill(
1971     _Inout_ SURFOBJ *psoDest,
1972     _In_ CLIPOBJ *pco,
1973     _In_opt_ XLATEOBJ *pxlo,
1974     _In_ TRIVERTEX *pVertex,
1975     _In_ ULONG nVertex,
1976     _In_ PVOID pMesh,
1977     _In_ ULONG nMesh,
1978     _In_ RECTL *prclExtents,
1979     _In_ POINTL *pptlDitherOrg,
1980     _In_ ULONG ulMode);
1981 
1982 /* EngHangNotification return values */
1983 #define EHN_RESTORED                      0x00000000
1984 #define EHN_ERROR                         0x00000001
1985 
1986 ENGAPI
1987 ULONG
1988 APIENTRY
1989 EngHangNotification(
1990     _In_ HDEV hDev,
1991     _Reserved_ PVOID Reserved);
1992 
1993 ENGAPI
1994 BOOL
1995 APIENTRY
1996 EngInitializeSafeSemaphore(
1997     _Out_ ENGSAFESEMAPHORE *pssem);
1998 
1999 ENGAPI
2000 BOOL
2001 APIENTRY
2002 EngIsSemaphoreOwned(
2003     _In_ HSEMAPHORE hsem);
2004 
2005 ENGAPI
2006 BOOL
2007 APIENTRY
2008 EngIsSemaphoreOwnedByCurrentThread(
2009     _In_ HSEMAPHORE hsem);
2010 
2011 ENGAPI
2012 BOOL
2013 APIENTRY
2014 EngLineTo(
2015     _Inout_ SURFOBJ *pso,
2016     _In_ CLIPOBJ *pco,
2017     _In_ BRUSHOBJ *pbo,
2018     _In_ LONG x1,
2019     _In_ LONG y1,
2020     _In_ LONG x2,
2021     _In_ LONG y2,
2022     _In_opt_ RECTL *prclBounds,
2023     _In_ MIX mix);
2024 
2025 #ifdef USERMODE_DRIVER
2026 #define EngLoadImage(pwszDriver) ((HANDLE)LoadLibraryW(pwszDriver))
2027 #else /* !USERMODE_DRIVER */
2028 ENGAPI
2029 HANDLE
2030 APIENTRY
2031 EngLoadImage(
2032     _In_ LPWSTR pwszDriver);
2033 #endif /* !USERMODE_DRIVER */
2034 
2035 ENGAPI
2036 HANDLE
2037 APIENTRY
2038 EngLoadModule(
2039     _In_ LPWSTR pwsz);
2040 
2041 ENGAPI
2042 HANDLE
2043 APIENTRY
2044 EngLoadModuleForWrite(
2045     _In_ LPWSTR pwsz,
2046     _In_ ULONG cjSizeOfModule);
2047 
2048 ENGAPI
2049 PDD_SURFACE_LOCAL
2050 APIENTRY
2051 EngLockDirectDrawSurface(
2052     _In_ HANDLE hSurface);
2053 
2054 ENGAPI
2055 DRIVEROBJ*
2056 APIENTRY
2057 EngLockDriverObj(
2058     _In_ HDRVOBJ hdo);
2059 
2060 ENGAPI
2061 SURFOBJ*
2062 APIENTRY
2063 EngLockSurface(
2064     _In_ HSURF hsurf);
2065 
2066 ENGAPI
2067 BOOL
2068 APIENTRY
2069 EngLpkInstalled(VOID);
2070 
2071 ENGAPI
2072 PEVENT
2073 APIENTRY
2074 EngMapEvent(
2075     _In_ HDEV hDev,
2076     _In_ HANDLE hUserObject,
2077     _Reserved_ PVOID Reserved1,
2078     _Reserved_ PVOID Reserved2,
2079     _Reserved_ PVOID Reserved3);
2080 
2081 _Success_(return != 0)
2082 _When_(cjSize != 0, _At_(return, _Out_writes_bytes_(cjSize)))
2083 ENGAPI
2084 PVOID
2085 APIENTRY
2086 EngMapFile(
2087     _In_ LPWSTR pwsz,
2088     _In_ ULONG cjSize,
2089     _Out_ ULONG_PTR *piFile);
2090 
2091 __drv_preferredFunction("EngMapFontFileFD", "Obsolete")
2092 _Check_return_
2093 _Success_(return!=FALSE)
2094 ENGAPI
2095 BOOL
2096 APIENTRY
2097 EngMapFontFile(
2098     _In_ ULONG_PTR iFile,
2099     _Outptr_result_bytebuffer_(*pcjBuf) PULONG *ppjBuf,
2100     _Out_ ULONG *pcjBuf);
2101 
2102 _Check_return_
2103 _Success_(return!=FALSE)
2104 ENGAPI
2105 BOOL
2106 APIENTRY
2107 EngMapFontFileFD(
2108     _In_ ULONG_PTR iFile,
2109     _Outptr_result_bytebuffer_(*pcjBuf) PULONG *ppjBuf,
2110     _Out_ ULONG *pcjBuf);
2111 
2112 _Check_return_
2113 _Success_(return!=NULL)
2114 _Post_writable_byte_size_(*pulSize)
2115 ENGAPI
2116 PVOID
2117 APIENTRY
2118 EngMapModule(
2119     _In_  HANDLE h,
2120     _Out_ PULONG pulSize);
2121 
2122 ENGAPI
2123 BOOL
2124 APIENTRY
2125 EngMarkBandingSurface(
2126     _In_ HSURF hsurf);
2127 
2128 /* EngModifySurface.flSurface constants */
2129 #define MS_NOTSYSTEMMEMORY                0x00000001
2130 #define MS_SHAREDACCESS                   0x00000002
2131 #define MS_CDDDEVICEBITMAP                0x00000004
2132 
2133 ENGAPI
2134 BOOL
2135 APIENTRY
2136 EngModifySurface(
2137     _In_ HSURF hsurf,
2138     _In_ HDEV hdev,
2139     _In_ FLONG flHooks,
2140     _In_ FLONG flSurface,
2141     _In_ DHSURF dhsurf,
2142     _In_ PVOID pvScan0,
2143     _In_ LONG lDelta,
2144     _Reserved_ PVOID pvReserved);
2145 
2146 ENGAPI
2147 VOID
2148 APIENTRY
2149 EngMovePointer(
2150     _In_ SURFOBJ *pso,
2151     _In_ LONG x,
2152     _In_ LONG y,
2153     _In_ RECTL *prcl);
2154 
2155 #ifdef USERMODE_DRIVER
2156 #define EngMulDiv MulDiv
2157 #else /* !USERMODE_DRIVER */
2158 ENGAPI
2159 INT
2160 APIENTRY
2161 EngMulDiv(
2162     _In_ INT a,
2163     _In_ INT b,
2164     _In_ INT c);
2165 #endif /* !USERMODE_DRIVER */
2166 
2167 ENGAPI
2168 VOID
2169 APIENTRY
2170 EngMultiByteToUnicodeN(
2171     _Out_writes_bytes_to_(MaxBytesInUnicodeString, *BytesInUnicodeString) LPWSTR UnicodeString,
2172     _In_ ULONG MaxBytesInUnicodeString,
2173     _Out_opt_ PULONG BytesInUnicodeString,
2174     _In_reads_bytes_(BytesInMultiByteString) PCHAR MultiByteString,
2175     _In_ ULONG BytesInMultiByteString);
2176 
2177 ENGAPI
2178 INT
2179 APIENTRY
2180 EngMultiByteToWideChar(
2181     _In_ UINT CodePage,
2182     _Out_writes_bytes_opt_(cjWideCharString) LPWSTR WideCharString,
2183     _In_ INT cjWideCharString,
2184     _In_reads_bytes_opt_(cjMultiByteString) LPSTR MultiByteString,
2185     _In_ INT cjMultiByteString);
2186 
2187 ENGAPI
2188 BOOL
2189 APIENTRY
2190 EngPaint(
2191     _In_ SURFOBJ *pso,
2192     _In_ CLIPOBJ *pco,
2193     _In_ BRUSHOBJ *pbo,
2194     _In_ POINTL *pptlBrushOrg,
2195     _In_ __in_data_source(USER_MODE) MIX mix);
2196 
2197 ENGAPI
2198 BOOL
2199 APIENTRY
2200 EngPlgBlt(
2201     _In_ SURFOBJ *psoTrg,
2202     _In_ SURFOBJ *psoSrc,
2203     _In_opt_ SURFOBJ *psoMsk,
2204     _In_ CLIPOBJ *pco,
2205     _In_opt_ XLATEOBJ *pxlo,
2206     _In_ COLORADJUSTMENT *pca,
2207     _In_ POINTL *pptlBrushOrg,
2208     _In_ POINTFIX *pptfx,
2209     _In_ RECTL *prcl,
2210     _When_(psoMsk, _In_) POINTL *pptl,
2211     _In_ __in_data_source(USER_MODE) ULONG iMode);
2212 
2213 ENGAPI
2214 VOID
2215 APIENTRY
2216 EngProbeForRead(
2217     _In_reads_bytes_(Length) PVOID Address,
2218     _In_ SIZE_T Length,
2219     _In_ ULONG Alignment);
2220 
2221 ENGAPI
2222 VOID
2223 APIENTRY
2224 EngProbeForReadAndWrite(
2225     _Inout_updates_bytes_(Length) PVOID Address,
2226     _In_ SIZE_T Length,
2227     _In_ ULONG Alignment);
2228 
2229 typedef enum _ENG_DEVICE_ATTRIBUTE {
2230   QDA_RESERVED = 0,
2231   QDA_ACCELERATION_LEVEL
2232 } ENG_DEVICE_ATTRIBUTE;
2233 
2234 ENGAPI
2235 BOOL
2236 APIENTRY
2237 EngQueryDeviceAttribute(
2238     _In_ HDEV hdev,
2239     _In_ ENG_DEVICE_ATTRIBUTE devAttr,
2240     _In_reads_bytes_(cjInSize) PVOID pvIn,
2241     _In_ ULONG cjInSize,
2242     _Out_writes_bytes_(cjOutSize) PVOID pvOut,
2243     _In_ ULONG cjOutSize);
2244 
2245 /* Obsolete in Windows 2000 and later */
2246 DECLSPEC_DEPRECATED_DDK
2247 BOOL APIENTRY
2248 EngQueryEMFInfo(
2249     _In_ HDEV hdev,
2250     _Out_ EMFINFO *pEMFInfo);
2251 
2252 ENGAPI
2253 LARGE_INTEGER
2254 APIENTRY
2255 EngQueryFileTimeStamp(
2256     _In_ LPWSTR pwsz);
2257 
2258 ENGAPI
2259 VOID
2260 APIENTRY
2261 EngQueryLocalTime(
2262     _Out_ PENG_TIME_FIELDS ptf);
2263 
2264 ENGAPI
2265 ULONG
2266 APIENTRY
2267 EngQueryPalette(
2268     _In_ HPALETTE hPal,
2269     _Out_ ULONG *piMode,
2270     _In_ ULONG cColors,
2271     _Out_writes_opt_(cColors) ULONG *pulColors);
2272 
2273 ENGAPI
2274 VOID
2275 APIENTRY
2276 EngQueryPerformanceCounter(
2277     _Out_ LONGLONG *pPerformanceCount);
2278 
2279 ENGAPI
2280 VOID
2281 APIENTRY
2282 EngQueryPerformanceFrequency(
2283     _Out_ LONGLONG *pFrequency);
2284 
2285 typedef enum _ENG_SYSTEM_ATTRIBUTE {
2286   EngProcessorFeature = 1,
2287   EngNumberOfProcessors,
2288   EngOptimumAvailableUserMemory,
2289   EngOptimumAvailableSystemMemory,
2290 } ENG_SYSTEM_ATTRIBUTE;
2291 
2292 #define QSA_MMX                           0x00000100
2293 #define QSA_SSE                           0x00002000
2294 #define QSA_3DNOW                         0x00004000
2295 #if (NTDDI_VERSION >= NTDDI_VISTA)
2296 #define QSA_SSE1                          QSA_SSE
2297 #define QSA_SSE2                          0x00010000
2298 #define QSA_SSE3                          0x00080000
2299 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
2300 
2301 _Check_return_
2302 _Success_(return)
2303 ENGAPI
2304 BOOL
2305 APIENTRY
2306 EngQuerySystemAttribute(
2307     _In_ ENG_SYSTEM_ATTRIBUTE CapNum,
2308     _Out_ PDWORD pCapability);
2309 
2310 ENGAPI
2311 LONG
2312 APIENTRY
2313 EngReadStateEvent(
2314     _In_ PEVENT pEvent);
2315 
2316 _Requires_lock_held_(*hsem)
2317 _Releases_lock_(*hsem)
2318 _Releases_lock_(_Global_critical_region_)
2319 ENGAPI
2320 VOID
2321 APIENTRY
2322 EngReleaseSemaphore(
2323     _Inout_ HSEMAPHORE hsem);
2324 
2325 #if defined(_M_AMD64) && (NTDDI_VERSION >= NTDDI_VISTA)
2326 
2327 _Check_return_
_Success_(return)2328 _Success_(return)
2329 _Kernel_float_restored_
2330 _At_(*pBuffer, _Kernel_requires_resource_held_(EngFloatState)
2331                _Kernel_releases_resource_(EngFloatState))
2332 ENGAPI
2333 BOOL
2334 APIENTRY
2335 EngRestoreFloatingPointState(
2336     _In_reads_(_Inexpressible_(statesize))
2337     PVOID pBuffer)
2338 {
2339     UNREFERENCED_PARAMETER(pBuffer);
2340     return TRUE;
2341 }
2342 
2343 _Check_return_
2344 _Success_(((pBuffer != NULL && cjBufferSize != 0) && return == 1) ||
2345           ((pBuffer == NULL || cjBufferSize == 0) && return > 0))
2346 _When_(pBuffer != NULL && cjBufferSize != 0 && return == 1, _Kernel_float_saved_
2347     _At_(*pBuffer, _Post_valid_ _Kernel_acquires_resource_(EngFloatState)))
2348 _On_failure_(_Post_satisfies_(return == 0))
2349 ENGAPI
2350 ULONG
2351 APIENTRY
EngSaveFloatingPointState(_At_ (* pBuffer,_Kernel_requires_resource_not_held_ (EngFloatState))_Out_writes_bytes_opt_ (cjBufferSize)PVOID pBuffer,_Inout_ ULONG cjBufferSize)2352 EngSaveFloatingPointState(
2353     _At_(*pBuffer, _Kernel_requires_resource_not_held_(EngFloatState))
2354     _Out_writes_bytes_opt_(cjBufferSize) PVOID pBuffer,
2355     _Inout_ ULONG cjBufferSize)
2356 {
2357     return ((((pBuffer) == NULL) || ((cjBufferSize) == 0)) ? 8 : TRUE);
2358 }
2359 
2360 #else /* !(defined(_M_AMD64) && (NTDDI_VERSION >= NTDDI_VISTA)) */
2361 
2362 _Check_return_
2363 _Success_(return)
2364 _Kernel_float_restored_
2365 _At_(*pBuffer, _Kernel_requires_resource_held_(EngFloatState)
2366                _Kernel_releases_resource_(EngFloatState))
2367 ENGAPI
2368 BOOL
2369 APIENTRY
2370 EngRestoreFloatingPointState(
2371     _In_reads_(_Inexpressible_(statesize)) PVOID pBuffer);
2372 
2373 _Check_return_
2374 _Success_(((pBuffer != NULL && cjBufferSize != 0) && return == 1) ||
2375           ((pBuffer == NULL || cjBufferSize == 0) && return > 0))
2376 _When_(pBuffer != NULL && cjBufferSize != 0 && return == 1, _Kernel_float_saved_
2377     _At_(*pBuffer, _Post_valid_ _Kernel_acquires_resource_(EngFloatState)))
2378 _On_failure_(_Post_satisfies_(return == 0))
2379 ENGAPI
2380 ULONG
2381 APIENTRY
2382 EngSaveFloatingPointState(
2383     _At_(*pBuffer, _Kernel_requires_resource_not_held_(EngFloatState))
2384     _Out_writes_bytes_opt_(cjBufferSize) PVOID pBuffer,
2385     _Inout_ ULONG cjBufferSize);
2386 
2387 
2388 #endif /* defined(_M_AMD64) && (NTDDI_VERSION >= NTDDI_VISTA) */
2389 
2390 ENGAPI
2391 HANDLE
2392 APIENTRY
2393 EngSecureMem(
2394     _In_reads_bytes_(cjLength) PVOID Address,
2395     _In_ ULONG cjLength);
2396 
2397 ENGAPI
2398 LONG
2399 APIENTRY
2400 EngSetEvent(
2401     _In_ PEVENT pEvent);
2402 
2403 #ifdef USERMODE_DRIVER
2404 #define EngSetLastError SetLastError
2405 #else /* !USERMODE_DRIVER */
2406 ENGAPI
2407 VOID
2408 APIENTRY
2409 EngSetLastError(
2410     _In_ ULONG iError);
2411 #endif /* !USERMODE_DRIVER */
2412 
2413 ENGAPI
2414 ULONG
2415 APIENTRY
2416 EngSetPointerShape(
2417     _In_ SURFOBJ *pso,
2418     _In_opt_ SURFOBJ *psoMask,
2419     _In_opt_ SURFOBJ *psoColor,
2420     _In_opt_ XLATEOBJ *pxlo,
2421     _In_ LONG xHot,
2422     _In_ LONG yHot,
2423     _In_ LONG x,
2424     _In_ LONG y,
2425     _In_ RECTL *prcl,
2426     _In_ FLONG fl);
2427 
2428 __drv_preferredFunction("(see documentation)", "Obsolete, always returns false. ")
2429 ENGAPI
2430 BOOL
2431 APIENTRY
2432 EngSetPointerTag(
2433     _In_ HDEV hdev,
2434     _In_opt_ SURFOBJ *psoMask,
2435     _In_opt_ SURFOBJ *psoColor,
2436     _Reserved_ XLATEOBJ *pxlo,
2437     _In_ FLONG fl);
2438 
2439 #ifdef USERMODE_DRIVER
2440 #define EngSetPrinterData   SetPrinterData
2441 #else /* !USERMODE_DRIVER */
2442 ENGAPI
2443 DWORD
2444 APIENTRY
2445 EngSetPrinterData(
2446     _In_ HANDLE hPrinter,
2447     _In_ LPWSTR pType,
2448     _In_ DWORD dwType,
2449     _In_reads_bytes_(cjPrinterData) LPBYTE lpbPrinterData,
2450     _In_ DWORD cjPrinterData);
2451 #endif /* !USERMODE_DRIVER */
2452 
2453 typedef int (__cdecl /*CDECL*/ *SORTCOMP)(const void *pv1, const void *pv2);
2454 
2455 ENGAPI
2456 VOID
2457 APIENTRY
2458 EngSort(
2459     _Inout_updates_bytes_(c * cjElem) PBYTE pjBuf,
2460     _In_ ULONG c,
2461     _In_ ULONG cjElem,
2462     _In_ SORTCOMP pfnComp);
2463 
2464 ENGAPI
2465 BOOL
2466 APIENTRY
2467 EngStretchBlt(
2468     _In_ SURFOBJ *psoDest,
2469     _In_ SURFOBJ *psoSrc,
2470     _In_opt_ SURFOBJ *psoMask,
2471     _In_opt_ CLIPOBJ *pco,
2472     _In_opt_ XLATEOBJ *pxlo,
2473     _In_opt_ COLORADJUSTMENT *pca,
2474     _In_ POINTL *pptlHTOrg,
2475     _In_ RECTL *prclDest,
2476     _In_ RECTL *prclSrc,
2477     _When_(psoMask, _In_) POINTL *pptlMask,
2478     _In_ ULONG iMode);
2479 
2480 ENGAPI
2481 BOOL
2482 APIENTRY
2483 EngStretchBltROP(
2484     _In_ SURFOBJ *psoDest,
2485     _In_ SURFOBJ *psoSrc,
2486     _In_opt_ SURFOBJ *psoMask,
2487     _In_opt_ CLIPOBJ *pco,
2488     _In_opt_ XLATEOBJ *pxlo,
2489     _In_opt_ COLORADJUSTMENT *pca,
2490     _In_ POINTL *pptlHTOrg,
2491     _In_ RECTL *prclDest,
2492     _In_ RECTL *prclSrc,
2493     _When_(psoMask, _In_) POINTL *pptlMask,
2494     _In_ ULONG iMode,
2495     _In_opt_ BRUSHOBJ *pbo,
2496     _In_ DWORD rop4);
2497 
2498 ENGAPI
2499 BOOL
2500 APIENTRY
2501 EngStrokeAndFillPath(
2502     _Inout_ SURFOBJ *pso,
2503     _In_ PATHOBJ *ppo,
2504     _In_ CLIPOBJ *pco,
2505     _In_ XFORMOBJ *pxo,
2506     _In_ BRUSHOBJ *pboStroke,
2507     _In_ LINEATTRS *plineattrs,
2508     _In_ BRUSHOBJ *pboFill,
2509     _In_ POINTL *pptlBrushOrg,
2510     _In_ __in_data_source(USER_MODE) MIX mixFill,
2511     _In_ __in_data_source(USER_MODE) FLONG flOptions);
2512 
2513 ENGAPI
2514 BOOL
2515 APIENTRY
2516 EngStrokePath(
2517     _In_ SURFOBJ *pso,
2518     _In_ PATHOBJ *ppo,
2519     _In_ CLIPOBJ *pco,
2520     _In_ XFORMOBJ *pxo,
2521     _In_ BRUSHOBJ *pbo,
2522     _In_ POINTL *pptlBrushOrg,
2523     _In_ LINEATTRS *plineattrs,
2524     _In_ MIX mix);
2525 
2526 ENGAPI
2527 BOOL
2528 APIENTRY
2529 EngTextOut(
2530     _In_ SURFOBJ *pso,
2531     _In_ STROBJ *pstro,
2532     _In_ FONTOBJ *pfo,
2533     _In_ CLIPOBJ *pco,
2534     _Null_ RECTL *prclExtra,
2535     _In_opt_ RECTL *prclOpaque,
2536     _In_ BRUSHOBJ *pboFore,
2537     _In_ BRUSHOBJ *pboOpaque,
2538     _In_ POINTL *pptlOrg,
2539     _In_ MIX mix);
2540 
2541 ENGAPI
2542 BOOL
2543 APIENTRY
2544 EngTransparentBlt(
2545     _In_ SURFOBJ *psoDst,
2546     _In_ SURFOBJ *psoSrc,
2547     _In_opt_ CLIPOBJ *pco,
2548     _In_opt_ XLATEOBJ *pxlo,
2549     _In_ RECTL *prclDst,
2550     _In_ RECTL *prclSrc,
2551     _In_ ULONG iTransColor,
2552     _In_ ULONG ulReserved);
2553 
2554 ENGAPI
2555 VOID
2556 APIENTRY
2557 EngUnicodeToMultiByteN(
2558     _Out_writes_bytes_to_(cjMultiByteBuf, *pcjMultiByteString) PCHAR pchMultiByteString,
2559     _In_ ULONG cjMultiByteBuf,
2560     _Out_opt_ PULONG pcjMultiByteString,
2561     _In_reads_bytes_(cjUnicodeString) PWSTR pwszUnicodeString,
2562     _In_ ULONG cjUnicodeString);
2563 
2564 #ifdef USERMODE_DRIVER
2565 #define EngUnloadImage(h) FreeLibrary((HMODULE) (h))
2566 #else /* !USERMODE_DRIVER */
2567 ENGAPI
2568 VOID
2569 APIENTRY
2570 EngUnloadImage(
2571     _In_ HANDLE hModule);
2572 #endif /* !USERMODE_DRIVER */
2573 
2574 ENGAPI
2575 BOOL
2576 APIENTRY
2577 EngUnlockDirectDrawSurface(
2578     _In_ PDD_SURFACE_LOCAL pSurface);
2579 
2580 ENGAPI
2581 BOOL
2582 APIENTRY
2583 EngUnlockDriverObj(
2584     _In_ _Post_ptr_invalid_ HDRVOBJ hdo);
2585 
2586 ENGAPI
2587 VOID
2588 APIENTRY
2589 EngUnlockSurface(
2590     _In_ _Post_ptr_invalid_ SURFOBJ *pso);
2591 
2592 ENGAPI
2593 BOOL
2594 APIENTRY
2595 EngUnmapEvent(
2596     _In_ PEVENT pEvent);
2597 
2598 ENGAPI
2599 BOOL
2600 APIENTRY
2601 EngUnmapFile(
2602     _In_ ULONG_PTR iFile);
2603 
2604 __drv_preferredFunction("EngUnmapFontFileFD", "Obsolete")
2605 ENGAPI
2606 VOID
2607 APIENTRY
2608 EngUnmapFontFile(
2609     _In_ ULONG_PTR iFile);
2610 
2611 ENGAPI
2612 VOID
2613 APIENTRY
2614 EngUnmapFontFileFD(
2615     _In_ ULONG_PTR iFile);
2616 
2617 ENGAPI
2618 VOID
2619 APIENTRY
2620 EngUnsecureMem(
2621     _In_ HANDLE hSecure);
2622 
2623 ENGAPI
2624 BOOL
2625 APIENTRY
2626 EngWaitForSingleObject(
2627     _In_ PEVENT pEvent,
2628     _In_opt_ PLARGE_INTEGER pTimeOut);
2629 
2630 ENGAPI
2631 INT
2632 APIENTRY
2633 EngWideCharToMultiByte(
2634     _In_ UINT CodePage,
2635     _In_reads_bytes_opt_(cjWideCharString) LPWSTR pwszWideCharString,
2636     _In_ INT cjWideCharString,
2637     _Out_z_bytecap_(cjMultiByteString) LPSTR pszMultiByteString,
2638     _In_ INT cjMultiByteString);
2639 
2640 #ifdef USERMODE_DRIVER
2641 #define EngWritePrinter WritePrinter
2642 #else /* !USERMODE_DRIVER */
2643 ENGAPI
2644 BOOL
2645 APIENTRY
2646 EngWritePrinter(
2647     _In_ HANDLE hPrinter,
2648     _In_reads_bytes_(cjBuf) LPVOID pvBuf,
2649     _In_ DWORD cjBuf,
2650     _Out_ LPDWORD pcWritten);
2651 #endif /* !USERMODE_DRIVER */
2652 
2653 #if defined(_X86_) && !defined(USERMODE_DRIVER)
2654 ENGAPI
2655 VOID
2656 APIENTRY
2657 FLOATOBJ_Add(
2658     _Inout_ PFLOATOBJ pf,
2659     _In_ PFLOATOBJ pf1);
2660 
2661 ENGAPI
2662 VOID
2663 APIENTRY
2664 FLOATOBJ_AddFloat(
2665     _Inout_ PFLOATOBJ pf,
2666     _In_ FLOATL f);
2667 
2668 ENGAPI
2669 VOID
2670 APIENTRY
2671 FLOATOBJ_AddLong(
2672     _Inout_ PFLOATOBJ pf,
2673     _In_ LONG l);
2674 
2675 ENGAPI
2676 VOID
2677 APIENTRY
2678 FLOATOBJ_Div(
2679     _Inout_ PFLOATOBJ pf,
2680     _In_ PFLOATOBJ pf1);
2681 
2682 ENGAPI
2683 VOID
2684 APIENTRY
2685 FLOATOBJ_DivFloat(
2686     _Inout_ PFLOATOBJ pf,
2687     _In_ FLOATL f);
2688 
2689 ENGAPI
2690 VOID
2691 APIENTRY
2692 FLOATOBJ_DivLong(
2693     _Inout_ PFLOATOBJ pf,
2694     _In_ LONG l);
2695 
2696 ENGAPI
2697 BOOL
2698 APIENTRY
2699 FLOATOBJ_Equal(
2700     _In_ PFLOATOBJ pf,
2701     _In_ PFLOATOBJ pf1);
2702 
2703 ENGAPI
2704 BOOL
2705 APIENTRY
2706 FLOATOBJ_EqualLong(
2707     _In_ PFLOATOBJ pf,
2708     _In_ LONG l);
2709 
2710 ENGAPI
2711 LONG
2712 APIENTRY
2713 FLOATOBJ_GetFloat(
2714     _In_ PFLOATOBJ pf);
2715 
2716 ENGAPI
2717 LONG
2718 APIENTRY
2719 FLOATOBJ_GetLong(
2720     _In_ PFLOATOBJ pf);
2721 
2722 ENGAPI
2723 BOOL
2724 APIENTRY
2725 FLOATOBJ_GreaterThan(
2726     _In_ PFLOATOBJ pf,
2727     _In_ PFLOATOBJ pf1);
2728 
2729 ENGAPI
2730 BOOL
2731 APIENTRY
2732 FLOATOBJ_GreaterThanLong(
2733     _In_ PFLOATOBJ pf,
2734     _In_ LONG l);
2735 
2736 ENGAPI
2737 BOOL
2738 APIENTRY
2739 FLOATOBJ_LessThan(
2740     _In_ PFLOATOBJ pf,
2741     _In_ PFLOATOBJ pf1);
2742 
2743 ENGAPI
2744 BOOL
2745 APIENTRY
2746 FLOATOBJ_LessThanLong(
2747     _In_ PFLOATOBJ pf,
2748     _In_ LONG l);
2749 
2750 ENGAPI
2751 VOID
2752 APIENTRY
2753 FLOATOBJ_Mul(
2754     _Inout_ PFLOATOBJ pf,
2755     _In_ PFLOATOBJ pf1);
2756 
2757 ENGAPI
2758 VOID
2759 APIENTRY
2760 FLOATOBJ_MulFloat(
2761     _Inout_ PFLOATOBJ pf,
2762     _In_ FLOATL f);
2763 
2764 ENGAPI
2765 VOID
2766 APIENTRY
2767 FLOATOBJ_MulLong(
2768     _Inout_ PFLOATOBJ pf,
2769     _In_ LONG l);
2770 
2771 ENGAPI
2772 VOID
2773 APIENTRY
2774 FLOATOBJ_Neg(
2775     _Inout_ PFLOATOBJ pf);
2776 
2777 ENGAPI
2778 VOID
2779 APIENTRY
2780 FLOATOBJ_SetFloat(
2781     _Out_ PFLOATOBJ pf,
2782     _In_ FLOATL f);
2783 
2784 ENGAPI
2785 VOID
2786 APIENTRY
2787 FLOATOBJ_SetLong(
2788     _Out_ PFLOATOBJ pf,
2789     _In_ LONG l);
2790 
2791 ENGAPI
2792 VOID
2793 APIENTRY
2794 FLOATOBJ_Sub(
2795     _Inout_ PFLOATOBJ pf,
2796     _In_ PFLOATOBJ pf1);
2797 
2798 ENGAPI
2799 VOID
2800 APIENTRY
2801 FLOATOBJ_SubFloat(
2802     _Inout_ PFLOATOBJ pf,
2803     _In_ FLOATL f);
2804 
2805 ENGAPI
2806 VOID
2807 APIENTRY
2808 FLOATOBJ_SubLong(
2809     _Inout_ PFLOATOBJ pf,
2810     _In_ LONG l);
2811 
2812 #else
2813 
2814 #define FLOATOBJ_SetFloat(pf, f)        {*(pf) = (f);}
2815 #define FLOATOBJ_SetLong(pf, l)         {*(pf) = (FLOAT)(l);}
2816 #define FLOATOBJ_GetFloat(pf)           (*(PULONG)(pf))
2817 #define FLOATOBJ_GetLong(pf)            ((LONG)*(pf))
2818 #define FLOATOBJ_Add(pf, pf1)           {*(pf) += *(pf1);}
2819 #define FLOATOBJ_AddFloat(pf, f)        {*(pf) += (f);}
2820 #define FLOATOBJ_AddLong(pf, l)         {*(pf) += (l);}
2821 #define FLOATOBJ_Sub(pf, pf1)           {*(pf) -= *(pf1);}
2822 #define FLOATOBJ_SubFloat(pf, f)        {*(pf) -= (f);}
2823 #define FLOATOBJ_SubLong(pf, l)         {*(pf) -= (l);}
2824 #define FLOATOBJ_Mul(pf, pf1)           {*(pf) *= *(pf1);}
2825 #define FLOATOBJ_MulFloat(pf, f)        {*(pf) *= (f);}
2826 #define FLOATOBJ_MulLong(pf, l)         {*(pf) *= (l);}
2827 #define FLOATOBJ_Div(pf, pf1)           {*(pf) /= *(pf1);}
2828 #define FLOATOBJ_DivFloat(pf, f)        {*(pf) /= (f);}
2829 #define FLOATOBJ_DivLong(pf, l)         {*(pf) /= (l);}
2830 #define FLOATOBJ_Neg(pf)                {*(pf) = -(*(pf));}
2831 #define FLOATOBJ_Equal(pf, pf1)         (*(pf) == *(pf1))
2832 #define FLOATOBJ_GreaterThan(pf, pf1)   (*(pf) > *(pf1))
2833 #define FLOATOBJ_LessThan(pf, pf1)      (*(pf) < *(pf1))
2834 #define FLOATOBJ_EqualLong(pf, l)       (*(pf) == (FLOAT)(l))
2835 #define FLOATOBJ_GreaterThanLong(pf, l) (*(pf) > (FLOAT)(l))
2836 #define FLOATOBJ_LessThanLong(pf, l)    (*(pf) < (FLOAT)(l))
2837 
2838 #endif
2839 
2840 ENGAPI
2841 ULONG
2842 APIENTRY
2843 FONTOBJ_cGetAllGlyphHandles(
2844     _In_ FONTOBJ *pfo,
2845     _Out_opt_ HGLYPH *phg);
2846 
2847 ENGAPI
2848 ULONG
2849 APIENTRY
2850 FONTOBJ_cGetGlyphs(
2851     _In_ FONTOBJ *pfo,
2852     _In_ ULONG iMode,
2853     _In_ ULONG cGlyph,
2854     _In_count_(cGlyph) HGLYPH *phg,
2855     _Out_ PVOID *ppvGlyph);
2856 
2857 ENGAPI
2858 FD_GLYPHSET*
2859 APIENTRY
2860 FONTOBJ_pfdg(
2861     _In_ FONTOBJ *pfo);
2862 
2863 ENGAPI
2864 IFIMETRICS*
2865 APIENTRY
2866 FONTOBJ_pifi(
2867     _In_ FONTOBJ *pfo);
2868 
2869 _Ret_opt_bytecount_(*pcjTable)
2870 ENGAPI
2871 PBYTE
2872 APIENTRY
2873 FONTOBJ_pjOpenTypeTablePointer(
2874     _In_ FONTOBJ *pfo,
2875     _In_ ULONG ulTag,
2876     _Out_ ULONG *pcjTable);
2877 
2878 ENGAPI
2879 PFD_GLYPHATTR
2880 APIENTRY
2881 FONTOBJ_pQueryGlyphAttrs(
2882     _In_ FONTOBJ *pfo,
2883     _In_ ULONG iMode);
2884 
2885 _Ret_opt_bytecount_(*pcjFile)
2886 ENGAPI
2887 PVOID
2888 APIENTRY
2889 FONTOBJ_pvTrueTypeFontFile(
2890     _In_ FONTOBJ *pfo,
2891     _Out_ ULONG *pcjFile);
2892 
2893 ENGAPI
2894 LPWSTR
2895 APIENTRY
2896 FONTOBJ_pwszFontFilePaths(
2897     _In_ FONTOBJ *pfo,
2898     _Out_ ULONG *pcwc);
2899 
2900 ENGAPI
2901 XFORMOBJ*
2902 APIENTRY
2903 FONTOBJ_pxoGetXform(
2904     _In_ FONTOBJ *pfo);
2905 
2906 ENGAPI
2907 VOID
2908 APIENTRY
2909 FONTOBJ_vGetInfo(
2910     _In_ FONTOBJ *pfo,
2911     _In_ ULONG cjSize,
2912     _Out_bytecap_(cjSize) FONTINFO *pfi);
2913 
2914 #if (NTDDI_VERSION <= NTDDI_WINXP)
2915  /* Obsolete in Windows 2000 and later */
2916 GAMMA_TABLES*
2917 APIENTRY
2918 FONTOBJ_pGetGammaTables(
2919     _In_ FONTOBJ *pfo);
2920 #endif
2921 
2922 ENGAPI
2923 LONG
2924 APIENTRY
2925 HT_ComputeRGBGammaTable(
2926     _In_ USHORT GammaTableEntries,
2927     _In_ USHORT GammaTableType,
2928     _In_ USHORT RedGamma,
2929     _In_ USHORT GreenGamma,
2930     _In_ USHORT BlueGamma,
2931     _Out_writes_bytes_(GammaTableEntries * 3) LPBYTE pGammaTable);
2932 
2933 ENGAPI
2934 LONG
2935 APIENTRY
2936 HT_Get8BPPFormatPalette(
2937     _Out_opt_ LPPALETTEENTRY pPaletteEntry,
2938     _In_ USHORT RedGamma,
2939     _In_ USHORT GreenGamma,
2940     _In_ USHORT BlueGamma);
2941 
2942 ENGAPI
2943 LONG
2944 APIENTRY
2945 HT_Get8BPPMaskPalette(
2946     _Out_opt_ LPPALETTEENTRY pPaletteEntry,
2947     _In_ BOOL Use8BPPMaskPal,
2948     _In_ BYTE CMYMask,
2949     _In_ USHORT RedGamma,
2950     _In_ USHORT GreenGamma,
2951     _In_ USHORT BlueGamma);
2952 
2953 ENGAPI
2954 LONG
2955 APIENTRY
2956 HTUI_DeviceColorAdjustment(
2957     _In_ LPSTR pDeviceName,
2958     _Out_ PDEVHTADJDATA pDevHTAdjData);
2959 
2960 ENGAPI
2961 ULONG
2962 APIENTRY
2963 PALOBJ_cGetColors(
2964     _In_ PALOBJ *ppalo,
2965     _In_ ULONG iStart,
2966     _In_ ULONG cColors,
2967     _Out_writes_(cColors) ULONG *pulColors);
2968 
2969 ENGAPI
2970 BOOL
2971 APIENTRY
2972 PATHOBJ_bCloseFigure(
2973     _In_ PATHOBJ *ppo);
2974 
2975 ENGAPI
2976 BOOL
2977 APIENTRY
2978 PATHOBJ_bEnum(
2979     _In_ PATHOBJ *ppo,
2980     _Out_ PATHDATA *ppd);
2981 
2982 ENGAPI
2983 BOOL
2984 APIENTRY
2985 PATHOBJ_bEnumClipLines(
2986     _In_ PATHOBJ *ppo,
2987     _In_ ULONG cj,
2988     _Out_bytecap_(cj) CLIPLINE *pcl);
2989 
2990 ENGAPI
2991 BOOL
2992 APIENTRY
2993 PATHOBJ_bMoveTo(
2994     _In_ PATHOBJ *ppo,
2995     _In_ POINTFIX ptfx);
2996 
2997 ENGAPI
2998 BOOL
2999 APIENTRY
3000 PATHOBJ_bPolyBezierTo(
3001     _In_ PATHOBJ *ppo,
3002     _In_count_(cptfx) POINTFIX *pptfx,
3003     _In_ ULONG cptfx);
3004 
3005 ENGAPI
3006 BOOL
3007 APIENTRY
3008 PATHOBJ_bPolyLineTo(
3009     _In_ PATHOBJ *ppo,
3010     _In_count_(cptfx) POINTFIX *pptfx,
3011     _In_ ULONG cptfx);
3012 
3013 ENGAPI
3014 VOID
3015 APIENTRY
3016 PATHOBJ_vEnumStart(
3017     _Inout_ PATHOBJ *ppo);
3018 
3019 ENGAPI
3020 VOID
3021 APIENTRY
3022 PATHOBJ_vEnumStartClipLines(
3023     _Inout_ PATHOBJ *ppo,
3024     _In_ CLIPOBJ *pco,
3025     _In_ SURFOBJ *pso,
3026     _In_ LINEATTRS *pla);
3027 
3028 ENGAPI
3029 VOID
3030 APIENTRY
3031 PATHOBJ_vGetBounds(
3032     _In_ PATHOBJ *ppo,
3033     _Out_ PRECTFX prectfx);
3034 
3035 ENGAPI
3036 BOOL
3037 APIENTRY
3038 STROBJ_bEnum(
3039     _Inout_ STROBJ *pstro,
3040     _Out_ ULONG *pc,
3041     _Out_ PGLYPHPOS *ppgpos); // FIXME_ size?
3042 
3043 ENGAPI
3044 BOOL
3045 APIENTRY
3046 STROBJ_bEnumPositionsOnly(
3047     _In_ STROBJ *pstro,
3048     _Out_ ULONG *pc,
3049     _Out_ PGLYPHPOS *ppgpos); // FIXME_ size?
3050 
3051 ENGAPI
3052 BOOL
3053 APIENTRY
3054 STROBJ_bGetAdvanceWidths(
3055     _In_ STROBJ *pso,
3056     _In_ ULONG iFirst,
3057     _In_ ULONG c,
3058     _Out_cap_(c) POINTQF *pptqD);
3059 
3060 ENGAPI
3061 DWORD
3062 APIENTRY
3063 STROBJ_dwGetCodePage(
3064     _In_ STROBJ *pstro);
3065 
3066 ENGAPI
3067 FIX
3068 APIENTRY
3069 STROBJ_fxBreakExtra(
3070     _In_ STROBJ *pstro);
3071 
3072 ENGAPI
3073 FIX
3074 APIENTRY
3075 STROBJ_fxCharacterExtra(
3076     _In_ STROBJ *pstro);
3077 
3078 ENGAPI
3079 VOID
3080 APIENTRY
3081 STROBJ_vEnumStart(
3082     _Inout_ STROBJ *pstro);
3083 
3084 ENGAPI
3085 BOOL
3086 APIENTRY
3087 WNDOBJ_bEnum(
3088     _Inout_ WNDOBJ *pwo,
3089     _In_ ULONG cj,
3090     _Out_bytecap_(cj) ULONG *pul);
3091 
3092 ENGAPI
3093 ULONG
3094 APIENTRY
3095 WNDOBJ_cEnumStart(
3096     _Inout_ WNDOBJ *pwo,
3097     _In_ ULONG iType,
3098     _In_ ULONG iDirection,
3099     _In_ ULONG cLimit);
3100 
3101 ENGAPI
3102 VOID
3103 APIENTRY
3104 WNDOBJ_vSetConsumer(
3105     _Inout_ WNDOBJ *pwo,
3106     _In_ PVOID pvConsumer);
3107 
3108 /* XFORMOBJ_bApplyXform.iMode constants */
3109 #define XF_LTOL                           0L
3110 #define XF_INV_LTOL                       1L
3111 #define XF_LTOFX                          2L
3112 #define XF_INV_FXTOL                      3L
3113 
3114 ENGAPI
3115 BOOL
3116 APIENTRY
3117 XFORMOBJ_bApplyXform(
3118     _In_ XFORMOBJ *pxo,
3119     _In_ ULONG iMode,
3120     _In_ ULONG cPoints,
3121     _In_reads_bytes_(cPoints * sizeof(POINTL)) PVOID pvIn,
3122     _Out_writes_bytes_(cPoints * sizeof(POINTL)) PVOID pvOut);
3123 
3124 /* Obsolete in Windows 2000 and later */
3125 DECLSPEC_DEPRECATED_DDK
3126 ENGAPI
3127 HANDLE
3128 APIENTRY
3129 XFORMOBJ_cmGetTransform(
3130     XFORMOBJ *pxo);
3131 
3132 #if !defined(USERMODE_DRIVER)
3133 ENGAPI
3134 ULONG
3135 APIENTRY
3136 XFORMOBJ_iGetFloatObjXform(
3137     _In_ XFORMOBJ *pxo,
3138     _Out_ FLOATOBJ_XFORM *pxfo);
3139 #else
3140 #define XFORMOBJ_iGetFloatObjXform XFORMOBJ_iGetXform
3141 #endif
3142 
3143 ENGAPI
3144 ULONG
3145 APIENTRY
3146 XFORMOBJ_iGetXform(
3147     _In_ XFORMOBJ *pxo,
3148     _Out_ XFORML *pxform);
3149 
3150 /* XLATEOBJ_cGetPalette.iPal constants */
3151 #define XO_SRCPALETTE                     1
3152 #define XO_DESTPALETTE                    2
3153 #define XO_DESTDCPALETTE                  3
3154 #define XO_SRCBITFIELDS                   4
3155 #define XO_DESTBITFIELDS                  5
3156 
3157 ENGAPI
3158 ULONG
3159 APIENTRY
3160 XLATEOBJ_cGetPalette(
3161     _In_ XLATEOBJ *pxlo,
3162     _In_ ULONG iPal,
3163     _In_ ULONG cPal,
3164     _Out_cap_(cPal) ULONG *pPal);
3165 
3166 ENGAPI
3167 HANDLE
3168 APIENTRY
3169 XLATEOBJ_hGetColorTransform(
3170     _In_ XLATEOBJ *pxlo);
3171 
3172 ENGAPI
3173 ULONG
3174 APIENTRY
3175 XLATEOBJ_iXlate(
3176     _In_ XLATEOBJ *pxlo,
3177     _In_ ULONG iColor);
3178 
3179 ENGAPI
3180 ULONG*
3181 APIENTRY
3182 XLATEOBJ_piVector(
3183     _In_ XLATEOBJ *pxlo);
3184 
3185 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
3186 
3187 ENGAPI
3188 VOID
3189 APIENTRY
3190 EngBugCheckEx(
3191     _In_ ULONG BugCheckCode,
3192     _In_ ULONG_PTR P1,
3193     _In_ ULONG_PTR P2,
3194     _In_ ULONG_PTR P3,
3195     _In_ ULONG_PTR P4);
3196 
3197 #endif /* (NTDDI_VERSION >= NTDDI_WINXPSP2) */
3198 
3199 #if (NTDDI_VERSION >= NTDDI_VISTA)
3200 
3201 ENGAPI
3202 HANDLE
3203 APIENTRY
3204 EngCreateRectRgn(
3205     _In_ INT left,
3206     _In_ INT top,
3207     _In_ INT right,
3208     _In_ INT bottom);
3209 
3210 ENGAPI
3211 VOID
3212 APIENTRY
3213 EngDeleteRgn(
3214     _In_ HANDLE hrgn);
3215 
3216 ENGAPI
3217 INT
3218 APIENTRY
3219 EngCombineRgn(
3220     _In_ HANDLE hrgnTrg,
3221     _In_ HANDLE hrgnSrc1,
3222     _In_ HANDLE hrgnSrc2,
3223     _In_ INT iMode);
3224 
3225 ENGAPI
3226 INT
3227 APIENTRY
3228 EngCopyRgn(
3229     _In_ HANDLE hrgnDst,
3230     _In_ HANDLE hrgnSrc);
3231 
3232 ENGAPI
3233 INT
3234 APIENTRY
3235 EngIntersectRgn(
3236     _In_ HANDLE hrgnResult,
3237     _In_ HANDLE hRgnA,
3238     _In_ HANDLE hRgnB);
3239 
3240 ENGAPI
3241 INT
3242 APIENTRY
3243 EngSubtractRgn(
3244     _In_ HANDLE hrgnResult,
3245     _In_ HANDLE hRgnA,
3246     _In_ HANDLE hRgnB);
3247 
3248 ENGAPI
3249 INT
3250 APIENTRY
3251 EngUnionRgn(
3252     _In_ HANDLE hrgnResult,
3253     _In_ HANDLE hRgnA,
3254     _In_ HANDLE hRgnB);
3255 
3256 ENGAPI
3257 INT
3258 APIENTRY
3259 EngXorRgn(
3260     _In_ HANDLE hrgnResult,
3261     _In_ HANDLE hRgnA,
3262     _In_ HANDLE hRgnB);
3263 
3264 ENGAPI
3265 BOOL
3266 APIENTRY
3267 EngRectInRgn(
3268     _In_ HANDLE hrgn,
3269     _In_ LPRECT prcl);
3270 
3271 ENGAPI
3272 BOOL
3273 APIENTRY
3274 EngEqualRgn(
3275     _In_ HANDLE hrgn1,
3276     _In_ HANDLE hrgn2);
3277 
3278 ENGAPI
3279 DWORD
3280 APIENTRY
3281 EngGetRgnData(
3282     _In_ HANDLE hrgn,
3283     _In_ DWORD nCount,
3284     _Out_cap_(nCount) LPRGNDATA lpRgnData);
3285 
3286 ENGAPI
3287 BOOL
3288 APIENTRY
3289 EngSetRectRgn(
3290     _In_ HANDLE hrgn,
3291     _In_ INT left,
3292     _In_ INT top,
3293     _In_ INT right,
3294     _In_ INT bottom);
3295 
3296 ENGAPI
3297 INT
3298 APIENTRY
3299 EngGetRgnBox(
3300     _In_ HANDLE hrgn,
3301     _Out_ LPRECT prcl);
3302 
3303 ENGAPI
3304 INT
3305 APIENTRY
3306 EngOffsetRgn(
3307     _In_ HANDLE hrgn,
3308     _In_ INT x,
3309     _In_ INT y);
3310 
3311 ENGAPI
3312 VOID
3313 APIENTRY
3314 EngRenderHint(
3315     _In_ DHPDEV dhpdev,
3316     _In_ ULONG NotifyCode,
3317     _In_ SIZE_T Length,
3318     _In_reads_bytes_opt_(Length) PVOID Data);
3319 
3320 _Requires_lock_not_held_(*hsem)
3321 _Acquires_exclusive_lock_(*hsem)
3322 _Acquires_lock_(_Global_critical_region_)
3323 ENGAPI
3324 VOID
3325 APIENTRY
3326 EngAcquireSemaphore(
3327     _Inout_ HSEMAPHORE hsem);
3328 
3329 ENGAPI
3330 BOOL
3331 APIENTRY
3332 EngAcquireSemaphoreNoWait(
3333     _In_ HSEMAPHORE hsem);
3334 
3335 _Acquires_lock_(_Global_critical_region_)
3336 _Requires_lock_not_held_(*hsem)
3337 _Acquires_shared_lock_(*hsem)
3338 ENGAPI
3339 VOID
3340 NTAPI
3341 EngAcquireSemaphoreShared(
3342     _Inout_ HSEMAPHORE hsem);
3343 
3344 ENGAPI
3345 BOOL
3346 APIENTRY
3347 EngIsSemaphoreSharedByCurrentThread(
3348     _In_ HSEMAPHORE hsem);
3349 
3350 DECLARE_HANDLE(HFASTMUTEX);
3351 
3352 ENGAPI
3353 HFASTMUTEX
3354 APIENTRY
3355 EngCreateFastMutex(
3356     VOID);
3357 
3358 ENGAPI
3359 VOID
3360 APIENTRY
3361 EngDeleteFastMutex(
3362     _In_ HFASTMUTEX hfm);
3363 
3364 ENGAPI
3365 VOID
3366 APIENTRY
3367 EngAcquireFastMutex(
3368     _In_ HFASTMUTEX hfm);
3369 
3370 ENGAPI
3371 VOID
3372 APIENTRY
3373 EngReleaseFastMutex(
3374     _In_ HFASTMUTEX hfm);
3375 
3376 ENGAPI
3377 BOOL
3378 APIENTRY
3379 EngUpdateDeviceSurface(
3380     _In_ SURFOBJ *pso,
3381     _Inout_ CLIPOBJ **ppco);
3382 
3383 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
3384 
3385 #if (NTDDI_VERSION >= NTDDI_WIN7)
3386 
3387 ENGAPI
3388 HBITMAP
3389 APIENTRY
3390 EngCreateRedirectionDeviceBitmap(
3391     __in_data_source(USER_MODE) DHSURF dhsurf,
3392     __in_data_source(USER_MODE) SIZEL sizl,
3393     _In_ ULONG iFormatCompat);
3394 
3395 VOID
3396 APIENTRY
3397 EngCTGetGammaTable(
3398     _In_ ULONG ulGamma,
3399     _Out_ CONST BYTE** pGammaTable,
3400     _Out_ CONST BYTE** pInverseGammaTable);
3401 
3402 ULONG
3403 APIENTRY
3404 EngCTGetCurrentGamma(
3405     _In_ HDEV hdev);
3406 
3407 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3408 
3409 /* Graphics Driver Functions */
3410 
3411 typedef BOOL
3412 (APIENTRY FN_DrvAlphaBlend)(
3413     _Inout_ SURFOBJ *psoDest,
3414     _In_ SURFOBJ *psoSrc,
3415     _In_ CLIPOBJ *pco,
3416     _In_opt_ XLATEOBJ *pxlo,
3417     _In_ RECTL *prclDest,
3418     _In_ RECTL *prclSrc,
3419     _In_ BLENDOBJ *pBlendObj);
3420 typedef FN_DrvAlphaBlend *PFN_DrvAlphaBlend;
3421 extern FN_DrvAlphaBlend DrvAlphaBlend;
3422 
3423 typedef BOOL
3424 (APIENTRY FN_DrvAssertMode)(
3425     _In_ DHPDEV dhpdev,
3426     _In_ BOOL bEnable);
3427 typedef FN_DrvAssertMode *PFN_DrvAssertMode;
3428 extern FN_DrvAssertMode DrvAssertMode;
3429 
3430 typedef BOOL
3431 (APIENTRY FN_DrvBitBlt)(
3432     _Inout_ SURFOBJ *psoTrg,
3433     _In_opt_ SURFOBJ *psoSrc,
3434     _In_opt_ SURFOBJ *psoMask,
3435     _In_ CLIPOBJ *pco,
3436     _In_opt_ XLATEOBJ *pxlo,
3437     _In_ RECTL *prclTrg,
3438     _In_opt_ POINTL *pptlSrc,
3439     _In_opt_ POINTL *pptlMask,
3440     _In_opt_ BRUSHOBJ *pbo,
3441     _In_opt_ POINTL *pptlBrush,
3442     _In_ ROP4 rop4);
3443 typedef FN_DrvBitBlt *PFN_DrvBitBlt;
3444 extern FN_DrvBitBlt DrvBitBlt;
3445 
3446 typedef VOID
3447 (APIENTRY FN_DrvCompletePDEV)(
3448     _In_ DHPDEV dhpdev,
3449     _In_ HDEV hdev);
3450 typedef FN_DrvCompletePDEV *PFN_DrvCompletePDEV;
3451 extern FN_DrvCompletePDEV DrvCompletePDEV;
3452 
3453 typedef BOOL
3454 (APIENTRY FN_DrvCopyBits)(
3455     _In_ SURFOBJ *psoDest,
3456     _In_ SURFOBJ *psoSrc,
3457     _In_ CLIPOBJ *pco,
3458     _In_opt_ XLATEOBJ *pxlo,
3459     _In_ RECTL *prclDest,
3460     _In_ POINTL *pptlSrc);
3461 typedef FN_DrvCopyBits *PFN_DrvCopyBits;
3462 extern FN_DrvCopyBits DrvCopyBits;
3463 
3464 typedef HBITMAP
3465 (APIENTRY FN_DrvCreateDeviceBitmap)(
3466     _In_ DHPDEV  dhpdev,
3467     _In_ SIZEL  sizl,
3468     _In_ ULONG  iFormat);
3469 typedef FN_DrvCreateDeviceBitmap *PFN_DrvCreateDeviceBitmap;
3470 extern FN_DrvCreateDeviceBitmap DrvCreateDeviceBitmap;
3471 
3472 typedef VOID
3473 (APIENTRY FN_DrvDeleteDeviceBitmap)(
3474     _In_ _Post_ptr_invalid_ DHSURF dhsurf);
3475 typedef FN_DrvDeleteDeviceBitmap *PFN_DrvDeleteDeviceBitmap;
3476 extern FN_DrvDeleteDeviceBitmap DrvDeleteDeviceBitmap;
3477 
3478 typedef HBITMAP
3479 (APIENTRY FN_DrvDeriveSurface)(
3480     _In_ DD_DIRECTDRAW_GLOBAL *pDirectDraw,
3481     _In_ DD_SURFACE_LOCAL *pSurface);
3482 typedef FN_DrvDeriveSurface *PFN_DrvDeriveSurface;
3483 extern FN_DrvDeriveSurface DrvDeriveSurface;
3484 
3485 typedef LONG
3486 (APIENTRY FN_DrvDescribePixelFormat)(
3487     _In_ DHPDEV dhpdev,
3488     _In_ LONG iPixelFormat,
3489     _In_ ULONG cjpfd,
3490     _Out_opt_ PIXELFORMATDESCRIPTOR *ppfd);
3491 typedef FN_DrvDescribePixelFormat *PFN_DrvDescribePixelFormat;
3492 extern FN_DrvDescribePixelFormat DrvDescribePixelFormat;
3493 
3494 typedef VOID
3495 (APIENTRY FN_DrvDestroyFont)(
3496     _In_ FONTOBJ *pfo);
3497 typedef FN_DrvDestroyFont *PFN_DrvDestroyFont;
3498 extern FN_DrvDestroyFont DrvDestroyFont;
3499 
3500 typedef VOID
3501 (APIENTRY FN_DrvDisableDriver)(VOID);
3502 typedef FN_DrvDisableDriver *PFN_DrvDisableDriver;
3503 extern FN_DrvDisableDriver DrvDisableDriver;
3504 
3505 typedef VOID
3506 (APIENTRY FN_DrvDisablePDEV)(
3507     _In_ DHPDEV dhpdev);
3508 typedef FN_DrvDisablePDEV *PFN_DrvDisablePDEV;
3509 extern FN_DrvDisablePDEV DrvDisablePDEV;
3510 
3511 typedef VOID
3512 (APIENTRY FN_DrvDisableSurface)(
3513     _In_ DHPDEV dhpdev);
3514 typedef FN_DrvDisableSurface *PFN_DrvDisableSurface;
3515 extern FN_DrvDisableSurface DrvDisableSurface;
3516 
3517 typedef ULONG
3518 (APIENTRY FN_DrvDitherColor)(
3519     _In_ DHPDEV dhpdev,
3520     _In_ ULONG iMode,
3521     _In_ ULONG rgb,
3522     _Inout_updates_(8 * 8) ULONG *pul); // FIXME: compare EngDitherColor
3523 typedef FN_DrvDitherColor *PFN_DrvDitherColor;
3524 extern FN_DrvDitherColor DrvDitherColor;
3525 
3526 typedef ULONG
3527 (APIENTRY FN_DrvDrawEscape)(
3528     _In_ SURFOBJ *pso,
3529     _In_ ULONG iEsc,
3530     _In_ CLIPOBJ *pco,
3531     _In_ RECTL *prcl,
3532     _In_ ULONG cjIn,
3533     _In_reads_bytes_(cjIn) PVOID pvIn);
3534 typedef FN_DrvDrawEscape *PFN_DrvDrawEscape;
3535 extern FN_DrvDrawEscape DrvDrawEscape;
3536 
3537 typedef BOOL
3538 (APIENTRY FN_DrvEnableDriver)(
3539     _In_ ULONG iEngineVersion,
3540     _In_ ULONG cj,
3541     _Inout_bytecount_(cj) DRVENABLEDATA *pded); // Zero initialized
3542 typedef FN_DrvEnableDriver *PFN_DrvEnableDriver;
3543 extern FN_DrvEnableDriver DrvEnableDriver;
3544 
3545 typedef DHPDEV
3546 (APIENTRY FN_DrvEnablePDEV)(
3547     _In_ DEVMODEW *pdm,
3548     _In_ LPWSTR pwszLogAddress,
3549     _In_ ULONG cPat,
3550     _Out_opt_cap_(cPat) HSURF *phsurfPatterns,
3551     _In_ ULONG cjCaps,
3552     _Out_bytecap_(cjCaps) ULONG *pdevcaps,
3553     _In_ ULONG cjDevInfo,
3554     _Out_ DEVINFO *pdi,
3555     _In_ HDEV hdev,
3556     _In_ LPWSTR pwszDeviceName,
3557     _In_ HANDLE hDriver);
3558 typedef FN_DrvEnablePDEV *PFN_DrvEnablePDEV;
3559 extern FN_DrvEnablePDEV DrvEnablePDEV;
3560 
3561 typedef HSURF
3562 (APIENTRY FN_DrvEnableSurface)(
3563     _In_ DHPDEV dhpdev);
3564 typedef FN_DrvEnableSurface *PFN_DrvEnableSurface;
3565 extern FN_DrvEnableSurface DrvEnableSurface;
3566 
3567 /* DrvEndDoc.fl constants */
3568 #define ED_ABORTDOC                       0x00000001
3569 
3570 typedef BOOL
3571 (APIENTRY FN_DrvEndDoc)(
3572     _In_ SURFOBJ *pso,
3573     _In_ FLONG fl);
3574 typedef FN_DrvEndDoc *PFN_DrvEndDoc;
3575 extern FN_DrvEndDoc DrvEndDoc;
3576 
3577 typedef ULONG
3578 (APIENTRY FN_DrvEscape)(
3579     _In_ SURFOBJ *pso,
3580     _In_ ULONG iEsc,
3581     _In_ ULONG cjIn,
3582     _In_bytecount_(cjIn) PVOID pvIn,
3583     _In_ ULONG cjOut,
3584     _Out_bytecap_(cjOut) PVOID pvOut);
3585 typedef FN_DrvEscape *PFN_DrvEscape;
3586 extern FN_DrvEscape DrvEscape;
3587 
3588 typedef BOOL
3589 (APIENTRY FN_DrvFillPath)(
3590     _Inout_ SURFOBJ *pso,
3591     _In_ PATHOBJ *ppo,
3592     _In_ CLIPOBJ *pco,
3593     _In_ BRUSHOBJ *pbo,
3594     _In_ POINTL *pptlBrushOrg,
3595     _In_ MIX mix,
3596     _In_ FLONG flOptions);
3597 typedef FN_DrvFillPath *PFN_DrvFillPath;
3598 extern FN_DrvFillPath DrvFillPath;
3599 
3600 typedef ULONG
3601 (APIENTRY FN_DrvFontManagement)(
3602     _In_ SURFOBJ  *pso,
3603     _In_opt_ FONTOBJ  *pfo,
3604     _In_ ULONG  iMode,
3605     _In_ ULONG  cjIn,
3606     _In_bytecount_(cjIn) PVOID  pvIn,
3607     _In_ ULONG  cjOut,
3608     _Out_bytecap_(cjOut) PVOID  pvOut);
3609 typedef FN_DrvFontManagement *PFN_DrvFontManagement;
3610 extern FN_DrvFontManagement DrvFontManagement;
3611 
3612 typedef VOID
3613 (APIENTRY FN_DrvFree)(
3614     _In_ _Post_ptr_invalid_ PVOID pv,
3615     _In_ ULONG_PTR id);
3616 typedef FN_DrvFree *PFN_DrvFree;
3617 extern FN_DrvFree DrvFree;
3618 
3619 /* DrvGetGlyphMode return values */
3620 #define FO_HGLYPHS                        0L
3621 #define FO_GLYPHBITS                      1L
3622 #define FO_PATHOBJ                        2L
3623 
3624 typedef ULONG
3625 (APIENTRY FN_DrvGetGlyphMode)(
3626     _In_ DHPDEV dhpdev,
3627     _In_ FONTOBJ *pfo);
3628 typedef FN_DrvGetGlyphMode *PFN_DrvGetGlyphMode;
3629 extern FN_DrvGetGlyphMode DrvGetGlyphMode;
3630 
3631 typedef ULONG
3632 (APIENTRY FN_DrvGetModes)(
3633     _In_ HANDLE hDriver,
3634     _In_ ULONG cjSize,
3635     _Out_opt_bytecap_(cjSize) DEVMODEW *pdm);
3636 typedef FN_DrvGetModes *PFN_DrvGetModes;
3637 extern FN_DrvGetModes DrvGetModes;
3638 
3639 typedef PVOID
3640 (APIENTRY FN_DrvGetTrueTypeFile)(
3641     _In_ ULONG_PTR iFile,
3642     _In_ ULONG *pcj);
3643 typedef FN_DrvGetTrueTypeFile *PFN_DrvGetTrueTypeFile;
3644 extern FN_DrvGetTrueTypeFile DrvGetTrueTypeFile;
3645 
3646 typedef BOOL
3647 (APIENTRY FN_DrvGradientFill)(
3648     _Inout_ SURFOBJ *psoDest,
3649     _In_ CLIPOBJ *pco,
3650     _In_opt_ XLATEOBJ *pxlo,
3651     _In_ TRIVERTEX *pVertex,
3652     _In_ ULONG nVertex,
3653     _In_ PVOID pMesh,
3654     _In_ ULONG nMesh,
3655     _In_ RECTL *prclExtents,
3656     _In_ POINTL *pptlDitherOrg,
3657     _In_ ULONG ulMode);
3658 typedef FN_DrvGradientFill *PFN_DrvGradientFill;
3659 extern FN_DrvGradientFill DrvGradientFill;
3660 
3661 typedef BOOL
3662 (APIENTRY FN_DrvIcmCheckBitmapBits)(
3663     _In_ DHPDEV dhpdev,
3664     _In_ HANDLE hColorTransform,
3665     _In_ SURFOBJ *pso,
3666     _Out_bytecap_(pso->sizlBitmap.cx * pso->sizlBitmap.cy) PBYTE paResults);
3667 typedef FN_DrvIcmCheckBitmapBits *PFN_DrvIcmCheckBitmapBits;
3668 extern FN_DrvIcmCheckBitmapBits DrvIcmCheckBitmapBits;
3669 
3670 typedef HANDLE
3671 (APIENTRY FN_DrvIcmCreateColorTransform)(
3672     _In_ DHPDEV dhpdev,
3673     _In_ LPLOGCOLORSPACEW pLogColorSpace,
3674     _In_reads_bytes_opt_(cjSourceProfile) PVOID pvSourceProfile,
3675     _In_ ULONG cjSourceProfile,
3676     _In_reads_bytes_(cjDestProfile) PVOID pvDestProfile,
3677     _In_ ULONG cjDestProfile,
3678     _In_reads_bytes_opt_(cjTargetProfile) PVOID pvTargetProfile,
3679     _In_ ULONG cjTargetProfile,
3680     _In_ DWORD dwReserved);
3681 typedef FN_DrvIcmCreateColorTransform *PFN_DrvIcmCreateColorTransform;
3682 extern FN_DrvIcmCreateColorTransform DrvIcmCreateColorTransform;
3683 
3684 typedef BOOL
3685 (APIENTRY FN_DrvIcmDeleteColorTransform)(
3686     _In_ DHPDEV dhpdev,
3687     _In_ HANDLE hcmXform);
3688 typedef FN_DrvIcmDeleteColorTransform *PFN_DrvIcmDeleteColorTransform;
3689 extern FN_DrvIcmDeleteColorTransform DrvIcmDeleteColorTransform;
3690 
3691 /* DrvIcmSetDeviceGammaRamp.iFormat constants */
3692 #define IGRF_RGB_256BYTES                 0x00000000
3693 #define IGRF_RGB_256WORDS                 0x00000001
3694 
3695 typedef BOOL
3696 (APIENTRY FN_DrvIcmSetDeviceGammaRamp)(
3697     _In_ DHPDEV dhpdev,
3698     _In_ ULONG iFormat,
3699     _In_bytecount_(sizeof(GAMMARAMP)) LPVOID lpRamp);
3700 typedef FN_DrvIcmSetDeviceGammaRamp *PFN_DrvIcmSetDeviceGammaRamp;
3701 extern FN_DrvIcmSetDeviceGammaRamp DrvIcmSetDeviceGammaRamp;
3702 
3703 typedef BOOL
3704 (APIENTRY FN_DrvLineTo)(
3705     _Inout_ SURFOBJ *pso,
3706     _In_ CLIPOBJ *pco,
3707     _In_ BRUSHOBJ *pbo,
3708     _In_ LONG x1,
3709     _In_ LONG y1,
3710     _In_ LONG x2,
3711     _In_ LONG y2,
3712     _In_opt_ RECTL *prclBounds,
3713     _In_ MIX mix);
3714 typedef FN_DrvLineTo *PFN_DrvLineTo;
3715 extern FN_DrvLineTo DrvLineTo;
3716 
3717 typedef ULONG_PTR
3718 (APIENTRY FN_DrvLoadFontFile)(
3719     _In_ ULONG cFiles,
3720     _In_ ULONG_PTR *piFile,
3721     _In_count_(cFiles) PVOID *ppvView,
3722     _In_count_(cFiles) ULONG *pcjView,
3723     _In_opt_ DESIGNVECTOR *pdv,
3724     _In_ ULONG ulLangID,
3725     _In_ ULONG ulFastCheckSum);
3726 typedef FN_DrvLoadFontFile *PFN_DrvLoadFontFile;
3727 extern FN_DrvLoadFontFile DrvLoadFontFile;
3728 
3729 typedef VOID
3730 (APIENTRY FN_DrvMovePointer)(
3731     _In_ SURFOBJ *pso,
3732     _In_ LONG x,
3733     _In_ LONG y,
3734     _In_opt_ RECTL *prcl);
3735 typedef FN_DrvMovePointer *PFN_DrvMovePointer;
3736 extern FN_DrvMovePointer DrvMovePointer;
3737 
3738 typedef BOOL
3739 (APIENTRY FN_DrvNextBand)(
3740     _In_ SURFOBJ *pso,
3741     _In_ POINTL *pptl);
3742 typedef FN_DrvNextBand *PFN_DrvNextBand;
3743 extern FN_DrvNextBand DrvNextBand;
3744 
3745 typedef VOID
3746 (APIENTRY FN_DrvNotify)(
3747     _In_ SURFOBJ *pso,
3748     _In_ ULONG iType,
3749     _In_opt_ PVOID pvData);
3750 typedef FN_DrvNotify *PFN_DrvNotify;
3751 extern FN_DrvNotify DrvNotify;
3752 
3753 typedef BOOL
3754 (APIENTRY FN_DrvOffset)(
3755     _In_ SURFOBJ *pso,
3756     _In_ LONG x,
3757     _In_ LONG y,
3758     _In_ FLONG flReserved);
3759 typedef FN_DrvOffset *PFN_DrvOffset;
3760 extern FN_DrvOffset DrvOffset;
3761 
3762 typedef BOOL
3763 (APIENTRY FN_DrvPaint)(
3764     _Inout_ SURFOBJ *pso,
3765     _In_ CLIPOBJ *pco,
3766     _In_ BRUSHOBJ *pbo,
3767     _In_ POINTL *pptlBrushOrg,
3768     _In_ MIX mix);
3769 typedef FN_DrvPaint *PFN_DrvPaint;
3770 extern FN_DrvPaint DrvPaint;
3771 
3772 typedef BOOL
3773 (APIENTRY FN_DrvPlgBlt)(
3774     _Inout_ SURFOBJ *psoTrg,
3775     _Inout_ SURFOBJ *psoSrc,
3776     _In_opt_ SURFOBJ *psoMsk,
3777     _In_ CLIPOBJ *pco,
3778     _In_opt_ XLATEOBJ *pxlo,
3779     _In_opt_ COLORADJUSTMENT *pca,
3780     _In_opt_ POINTL *pptlBrushOrg,
3781     _In_ POINTFIX *pptfx,
3782     _In_ RECTL *prcl,
3783     _In_opt_ POINTL *pptl,
3784     _In_ ULONG iMode);
3785 typedef FN_DrvPlgBlt *PFN_DrvPlgBlt;
3786 extern FN_DrvPlgBlt DrvPlgBlt;
3787 
3788 /* DrvQueryAdvanceWidths.iMode constants */
3789 #define QAW_GETWIDTHS                     0
3790 #define QAW_GETEASYWIDTHS                 1
3791 
3792 typedef BOOL
3793 (APIENTRY FN_DrvQueryAdvanceWidths)(
3794     _In_ DHPDEV dhpdev,
3795     _In_ FONTOBJ *pfo,
3796     _In_ ULONG iMode,
3797     _In_reads_(cGlyphs) HGLYPH *phg,
3798     _Out_writes_bytes_(cGlyphs * sizeof(USHORT)) PVOID pvWidths,
3799     _In_ ULONG cGlyphs);
3800 typedef FN_DrvQueryAdvanceWidths *PFN_DrvQueryAdvanceWidths;
3801 extern FN_DrvQueryAdvanceWidths DrvQueryAdvanceWidths;
3802 
3803 /* DrvQueryDeviceSupport.iType constants */
3804 #define QDS_CHECKJPEGFORMAT               0x00000000
3805 #define QDS_CHECKPNGFORMAT                0x00000001
3806 
3807 typedef BOOL
3808 (APIENTRY FN_DrvQueryDeviceSupport)(
3809     _In_ SURFOBJ *pso,
3810     _In_ XLATEOBJ *pxlo,
3811     _In_ XFORMOBJ *pxo,
3812     _In_ ULONG iType,
3813     _In_ ULONG cjIn,
3814     _In_bytecount_(cjIn) PVOID pvIn,
3815     _In_ ULONG cjOut,
3816     _Out_bytecap_(cjOut) PVOID pvOut);
3817 typedef FN_DrvQueryDeviceSupport *PFN_DrvQueryDeviceSupport;
3818 extern FN_DrvQueryDeviceSupport DrvQueryDeviceSupport;
3819 
3820 /* DrvQueryDriverInfo.dwMode constants */
3821 #define DRVQUERY_USERMODE                 0x00000001
3822 
3823 typedef BOOL
3824 (APIENTRY FN_DrvQueryDriverInfo)(
3825     _In_ DWORD dwMode,
3826     _Out_bytecap_(cjBuf) PVOID pBuffer,
3827     _In_ DWORD cjBuf,
3828     _Out_ PDWORD pcbNeeded);
3829 typedef FN_DrvQueryDriverInfo *PFN_DrvQueryDriverInfo;
3830 extern FN_DrvQueryDriverInfo DrvQueryDriverInfo;
3831 
3832 typedef PIFIMETRICS
3833 (APIENTRY FN_DrvQueryFont)(
3834     _In_ DHPDEV dhpdev,
3835     _In_ ULONG_PTR iFile,
3836     _In_ ULONG iFace,
3837     _Out_ ULONG_PTR *pid);
3838 typedef FN_DrvQueryFont *PFN_DrvQueryFont;
3839 extern FN_DrvQueryFont DrvQueryFont;
3840 
3841 /* DrvQueryFontCaps.pulCaps constants */
3842 #define QC_OUTLINES                       0x00000001
3843 #define QC_1BIT                           0x00000002
3844 #define QC_4BIT                           0x00000004
3845 #define QC_FONTDRIVERCAPS (QC_OUTLINES | QC_1BIT | QC_4BIT)
3846 
3847 typedef LONG
3848 (APIENTRY FN_DrvQueryFontCaps)(
3849     _In_ ULONG culCaps,
3850     _Out_cap_(culCaps) ULONG *pulCaps);
3851 typedef FN_DrvQueryFontCaps *PFN_DrvQueryFontCaps;
3852 extern FN_DrvQueryFontCaps DrvQueryFontCaps;
3853 
3854 /* DrvQueryFontData.iMode constants */
3855 #define QFD_GLYPHANDBITMAP                1L
3856 #define QFD_GLYPHANDOUTLINE               2L
3857 #define QFD_MAXEXTENTS                    3L
3858 #define QFD_TT_GLYPHANDBITMAP             4L
3859 #define QFD_TT_GRAY1_BITMAP               5L
3860 #define QFD_TT_GRAY2_BITMAP               6L
3861 #define QFD_TT_GRAY4_BITMAP               8L
3862 #define QFD_TT_GRAY8_BITMAP               9L
3863 
3864 #define QFD_TT_MONO_BITMAP QFD_TT_GRAY1_BITMAP
3865 
3866 typedef LONG
3867 (APIENTRY FN_DrvQueryFontData)(
3868     _In_ DHPDEV dhpdev,
3869     _In_ FONTOBJ *pfo,
3870     _In_ ULONG iMode,
3871     _In_ HGLYPH hg,
3872     _In_opt_ GLYPHDATA *pgd,
3873     _Out_bytecap_(cjSize) PVOID pv,
3874     _In_ ULONG cjSize);
3875 typedef FN_DrvQueryFontData *PFN_DrvQueryFontData;
3876 extern FN_DrvQueryFontData DrvQueryFontData;
3877 
3878 /* DrvQueryFontFile.ulMode constants */
3879 #define QFF_DESCRIPTION                   0x00000001
3880 #define QFF_NUMFACES                      0x00000002
3881 
3882 typedef LONG
3883 (APIENTRY FN_DrvQueryFontFile)(
3884     _In_ ULONG_PTR iFile,
3885     _In_ ULONG ulMode,
3886     _In_ ULONG cjBuf,
3887     _Out_bytecap_(cjBuf) ULONG *pulBuf);
3888 typedef FN_DrvQueryFontFile *PFN_DrvQueryFontFile;
3889 extern FN_DrvQueryFontFile DrvQueryFontFile;
3890 
3891 /* DrvQueryFontTree.iMode constants */
3892 #define QFT_UNICODE                       0L
3893 #define QFT_LIGATURES                     1L
3894 #define QFT_KERNPAIRS                     2L
3895 #define QFT_GLYPHSET                      3L
3896 
3897 typedef PVOID
3898 (APIENTRY FN_DrvQueryFontTree)(
3899     _In_ DHPDEV dhpdev,
3900     _In_ ULONG_PTR iFile,
3901     _In_ ULONG iFace,
3902     _In_ ULONG iMode,
3903     _Out_ ULONG_PTR *pid);
3904 typedef FN_DrvQueryFontTree *PFN_DrvQueryFontTree;
3905 extern FN_DrvQueryFontTree DrvQueryFontTree;
3906 
3907 typedef PFD_GLYPHATTR
3908 (APIENTRY FN_DrvQueryGlyphAttrs)(
3909     _In_ FONTOBJ *pfo,
3910     _In_ ULONG iMode);
3911 typedef FN_DrvQueryGlyphAttrs *PFN_DrvQueryGlyphAttrs;
3912 extern FN_DrvQueryGlyphAttrs DrvQueryGlyphAttrs;
3913 
3914 typedef ULONG
3915 (APIENTRY FN_DrvQueryPerBandInfo)(
3916     _In_ SURFOBJ *pso,
3917     _Inout_ PERBANDINFO *pbi);
3918 typedef FN_DrvQueryPerBandInfo *PFN_DrvQueryPerBandInfo;
3919 extern FN_DrvQueryPerBandInfo DrvQueryPerBandInfo;
3920 
3921 /* DrvQueryTrueTypeOutline.bMetricsOnly constants */
3922 #define TTO_METRICS_ONLY                  0x00000001
3923 #define TTO_QUBICS                        0x00000002
3924 #define TTO_UNHINTED                      0x00000004
3925 
3926 typedef LONG
3927 (APIENTRY FN_DrvQueryTrueTypeOutline)(
3928     _In_ DHPDEV dhpdev,
3929     _In_ FONTOBJ *pfo,
3930     _In_ HGLYPH hglyph,
3931     _In_ BOOL bMetricsOnly,
3932     _Out_opt_ GLYPHDATA *pgldt,
3933     _In_ ULONG cjBuf,
3934     _Out_bytecap_(cjBuf) TTPOLYGONHEADER *ppoly);
3935 typedef FN_DrvQueryTrueTypeOutline *PFN_DrvQueryTrueTypeOutline;
3936 extern FN_DrvQueryTrueTypeOutline DrvQueryTrueTypeOutline;
3937 
3938 typedef LONG
3939 (APIENTRY FN_DrvQueryTrueTypeTable)(
3940     _In_ ULONG_PTR iFile,
3941     _In_ ULONG ulFont,
3942     _In_ ULONG ulTag,
3943     _In_ PTRDIFF dpStart,
3944     _In_ ULONG cjBuf,
3945     _Out_opt_bytecap_(cjBuf) BYTE *pjBuf,
3946     _Outptr_opt_result_bytebuffer_all_maybenull_(*pcjTable) PBYTE *ppjTable,
3947     _Out_opt_ ULONG *pcjTable);
3948 typedef FN_DrvQueryTrueTypeTable *PFN_DrvQueryTrueTypeTable;
3949 extern FN_DrvQueryTrueTypeTable DrvQueryTrueTypeTable;
3950 
3951 /* DrvRealizeBrush.iHatch constants */
3952 #define RB_DITHERCOLOR                    0x80000000L
3953 
3954 #define HS_DDI_MAX                        6
3955 
3956 typedef BOOL
3957 (APIENTRY FN_DrvRealizeBrush)(
3958     _In_ BRUSHOBJ *pbo,
3959     _Inout_ SURFOBJ *psoTarget, // CHECKME
3960     _In_opt_ SURFOBJ *psoPattern,
3961     _In_opt_ SURFOBJ *psoMask,
3962     _In_opt_ XLATEOBJ *pxlo,
3963     _In_ ULONG iHatch);
3964 typedef FN_DrvRealizeBrush *PFN_DrvRealizeBrush;
3965 extern FN_DrvRealizeBrush DrvRealizeBrush;
3966 
3967 /* DrvResetDevice return values */
3968 #define DRD_SUCCESS                       0
3969 #define DRD_ERROR                         1
3970 
3971 typedef ULONG
3972 (APIENTRY FN_DrvResetDevice)(
3973     _In_ DHPDEV dhpdev,
3974     _Reserved_ PVOID Reserved);
3975 typedef FN_DrvResetDevice *PFN_DrvResetDevice;
3976 extern FN_DrvResetDevice DrvResetDevice;
3977 
3978 typedef BOOL
3979 (APIENTRY FN_DrvResetPDEV)(
3980     _In_ DHPDEV dhpdevOld,
3981     _In_ DHPDEV dhpdevNew);
3982 typedef FN_DrvResetPDEV *PFN_DrvResetPDEV;
3983 extern FN_DrvResetPDEV DrvResetPDEV;
3984 
3985 /* DrvSaveScreenBits.iMode constants */
3986 #define SS_SAVE                           0x00000000
3987 #define SS_RESTORE                        0x00000001
3988 #define SS_FREE                           0x00000002
3989 
3990 typedef ULONG_PTR
3991 (APIENTRY FN_DrvSaveScreenBits)(
3992     _In_ SURFOBJ *pso,
3993     _In_ ULONG iMode,
3994     _In_ ULONG_PTR ident,
3995     _In_ RECTL *prcl);
3996 typedef FN_DrvSaveScreenBits *PFN_DrvSaveScreenBits;
3997 extern FN_DrvSaveScreenBits DrvSaveScreenBits;
3998 
3999 typedef BOOL
4000 (APIENTRY FN_DrvSendPage)(
4001     _In_ SURFOBJ *pso);
4002 typedef FN_DrvSendPage *PFN_DrvSendPage;
4003 extern FN_DrvSendPage DrvSendPage;
4004 
4005 /* DrvSetPalette range */
4006 #define WINDDI_MAXSETPALETTECOLORS     256
4007 #define WINDDI_MAXSETPALETTECOLORINDEX 255
4008 
4009 typedef BOOL
4010 (APIENTRY FN_DrvSetPalette)(
4011     _In_ DHPDEV dhpdev,
4012     _In_ PALOBJ *ppalo,
4013     _In_ FLONG fl,
4014     _In_range_(0, WINDDI_MAXSETPALETTECOLORINDEX) ULONG iStart,
4015     _In_range_(0, WINDDI_MAXSETPALETTECOLORS - iStart) ULONG cColors);
4016 typedef FN_DrvSetPalette *PFN_DrvSetPalette;
4017 extern FN_DrvSetPalette DrvSetPalette;
4018 
4019 typedef BOOL
4020 (APIENTRY FN_DrvSetPixelFormat)(
4021     _In_ SURFOBJ *pso,
4022     _In_ LONG iPixelFormat,
4023     _In_ HWND hwnd);
4024 typedef FN_DrvSetPixelFormat *PFN_DrvSetPixelFormat;
4025 extern FN_DrvSetPixelFormat DrvSetPixelFormat;
4026 
4027 /* DrvSetPointerShape return values */
4028 #define SPS_ERROR                         0x00000000
4029 #define SPS_DECLINE                       0x00000001
4030 #define SPS_ACCEPT_NOEXCLUDE              0x00000002
4031 #define SPS_ACCEPT_EXCLUDE                0x00000003
4032 #define SPS_ACCEPT_SYNCHRONOUS            0x00000004
4033 
4034 /* DrvSetPointerShape.fl constants */
4035 #define SPS_CHANGE                        0x00000001L
4036 #define SPS_ASYNCCHANGE                   0x00000002L
4037 #define SPS_ANIMATESTART                  0x00000004L
4038 #define SPS_ANIMATEUPDATE                 0x00000008L
4039 #define SPS_ALPHA                         0x00000010L
4040 #define SPS_RESERVED                      0x00000020L /* Force s/w cursor rendering */
4041 #define SPS_RESERVED1                     0x00000040L /* Force show/hide system cursor */
4042 #define SPS_FLAGSMASK                     0x000000FFL
4043 #define SPS_LENGTHMASK                    0x00000F00L
4044 #define SPS_FREQMASK                      0x000FF000L
4045 
4046 typedef ULONG
4047 (APIENTRY FN_DrvSetPointerShape)(
4048     _In_ SURFOBJ *pso,
4049     _In_opt_ SURFOBJ *psoMask,
4050     _In_opt_ SURFOBJ *psoColor,
4051     _In_ XLATEOBJ *pxlo,
4052     _In_ LONG xHot,
4053     _In_ LONG yHot,
4054     _In_ LONG x,
4055     _In_ LONG y,
4056     _In_ RECTL *prcl,
4057     _In_ FLONG fl);
4058 typedef FN_DrvSetPointerShape *PFN_DrvSetPointerShape;
4059 extern FN_DrvSetPointerShape DrvSetPointerShape;
4060 
4061 typedef BOOL
4062 (APIENTRY FN_DrvStartBanding)(
4063     _In_ SURFOBJ *pso,
4064     _In_ POINTL *pptl);
4065 typedef FN_DrvStartBanding *PFN_DrvStartBanding;
4066 extern FN_DrvStartBanding DrvStartBanding;
4067 
4068 typedef BOOL
4069 (APIENTRY FN_DrvStartDoc)(
4070     _In_ SURFOBJ *pso,
4071     _In_ LPWSTR pwszDocName,
4072     _In_ DWORD dwJobId);
4073 typedef FN_DrvStartDoc *PFN_DrvStartDoc;
4074 extern FN_DrvStartDoc DrvStartDoc;
4075 
4076 typedef BOOL
4077 (APIENTRY FN_DrvStartPage)(
4078     _In_ SURFOBJ *pso);
4079 typedef FN_DrvStartPage *PFN_DrvStartPage;
4080 extern FN_DrvStartPage DrvStartPage;
4081 
4082 typedef BOOL
4083 (APIENTRY FN_DrvStretchBlt)(
4084     _Inout_ SURFOBJ *psoDest,
4085     _Inout_ SURFOBJ *psoSrc,
4086     _In_opt_ SURFOBJ *psoMask,
4087     _In_ CLIPOBJ *pco,
4088     _In_opt_ XLATEOBJ *pxlo,
4089     _In_opt_ COLORADJUSTMENT *pca,
4090     _In_ POINTL *pptlHTOrg,
4091     _In_ RECTL *prclDest,
4092     _In_ RECTL *prclSrc,
4093     _When_(psoMask, _In_) POINTL *pptlMask,
4094     _In_ ULONG iMode);
4095 typedef FN_DrvStretchBlt *PFN_DrvStretchBlt;
4096 extern FN_DrvStretchBlt DrvStretchBlt;
4097 
4098 typedef BOOL
4099 (APIENTRY FN_DrvStretchBltROP)(
4100     _Inout_ SURFOBJ *psoDest,
4101     _Inout_ SURFOBJ *psoSrc,
4102     _In_opt_ SURFOBJ *psoMask,
4103     _In_ CLIPOBJ *pco,
4104     _In_opt_ XLATEOBJ *pxlo,
4105     _In_opt_ COLORADJUSTMENT *pca,
4106     _In_ POINTL *pptlHTOrg,
4107     _In_ RECTL *prclDest,
4108     _In_ RECTL *prclSrc,
4109     _When_(psoMask, _In_) POINTL *pptlMask,
4110     _In_ ULONG iMode,
4111     _In_ BRUSHOBJ *pbo,
4112     _In_ DWORD rop4);
4113 typedef FN_DrvStretchBltROP *PFN_DrvStretchBltROP;
4114 extern FN_DrvStretchBltROP DrvStretchBltROP;
4115 
4116 typedef BOOL
4117 (APIENTRY FN_DrvStrokeAndFillPath)(
4118     _Inout_ SURFOBJ *pso,
4119     _Inout_ PATHOBJ *ppo,
4120     _In_ CLIPOBJ *pco,
4121     _In_opt_ XFORMOBJ *pxo,
4122     _In_ BRUSHOBJ *pboStroke,
4123     _In_ LINEATTRS *plineattrs,
4124     _In_ BRUSHOBJ *pboFill,
4125     _In_ POINTL *pptlBrushOrg,
4126     _In_ MIX mixFill,
4127     _In_ FLONG flOptions);
4128 typedef FN_DrvStrokeAndFillPath *PFN_DrvStrokeAndFillPath;
4129 extern FN_DrvStrokeAndFillPath DrvStrokeAndFillPath;
4130 
4131 typedef BOOL
4132 (APIENTRY FN_DrvStrokePath)(
4133     _Inout_ SURFOBJ *pso,
4134     _In_ PATHOBJ *ppo,
4135     _In_ CLIPOBJ *pco,
4136     _In_opt_ XFORMOBJ *pxo,
4137     _In_ BRUSHOBJ *pbo,
4138     _In_ POINTL *pptlBrushOrg,
4139     _In_ LINEATTRS *plineattrs,
4140     _In_ MIX mix);
4141 typedef FN_DrvStrokePath *PFN_DrvStrokePath;
4142 extern FN_DrvStrokePath DrvStrokePath;
4143 
4144 typedef BOOL
4145 (APIENTRY FN_DrvSwapBuffers)(
4146     _In_ SURFOBJ *pso,
4147     _In_ WNDOBJ *pwo);
4148 typedef FN_DrvSwapBuffers *PFN_DrvSwapBuffers;
4149 extern FN_DrvSwapBuffers DrvSwapBuffers;
4150 
4151 typedef VOID
4152 (APIENTRY FN_DrvSynchronize)(
4153     _In_ DHPDEV dhpdev,
4154     _In_count_c_(0) RECTL *prcl); // should be ignored
4155 typedef FN_DrvSynchronize *PFN_DrvSynchronize;
4156 extern FN_DrvSynchronize DrvSynchronize;
4157 
4158 /* DrvSynchronizeSurface.fl constants */
4159 #define DSS_TIMER_EVENT                   0x00000001
4160 #define DSS_FLUSH_EVENT                   0x00000002
4161 #define DSS_RESERVED                      0x00000004
4162 #define DSS_RESERVED1                     0x00000008
4163 
4164 typedef VOID
4165 (APIENTRY FN_DrvSynchronizeSurface)(
4166     _In_ SURFOBJ *pso,
4167     _In_opt_ RECTL *prcl,
4168     _In_ FLONG fl);
4169 typedef FN_DrvSynchronizeSurface *PFN_DrvSynchronizeSurface;
4170 extern FN_DrvSynchronizeSurface DrvSynchronizeSurface;
4171 
4172 typedef BOOL
4173 (APIENTRY FN_DrvTextOut)(
4174     _In_ SURFOBJ *pso,
4175     _In_ STROBJ *pstro,
4176     _In_ FONTOBJ *pfo,
4177     _In_ CLIPOBJ *pco,
4178     _Null_ RECTL *prclExtra,
4179     _In_opt_ RECTL *prclOpaque,
4180     _In_ BRUSHOBJ *pboFore,
4181     _In_ BRUSHOBJ *pboOpaque,
4182     _In_ POINTL *pptlOrg,
4183     _In_ MIX mix);
4184 typedef FN_DrvTextOut *PFN_DrvTextOut;
4185 extern FN_DrvTextOut DrvTextOut;
4186 
4187 typedef BOOL
4188 (APIENTRY FN_DrvTransparentBlt)(
4189     _Inout_ SURFOBJ *psoDst,
4190     _In_ SURFOBJ *psoSrc,
4191     _In_ CLIPOBJ *pco,
4192     _In_opt_ XLATEOBJ *pxlo,
4193     _In_ RECTL *prclDst,
4194     _In_ RECTL *prclSrc,
4195     _In_ ULONG iTransColor,
4196     _In_ ULONG ulReserved);
4197 typedef FN_DrvTransparentBlt *PFN_DrvTransparentBlt;
4198 extern FN_DrvTransparentBlt DrvTransparentBlt;
4199 
4200 typedef BOOL
4201 (APIENTRY FN_DrvUnloadFontFile)(
4202     _In_ ULONG_PTR iFile);
4203 typedef FN_DrvUnloadFontFile *PFN_DrvUnloadFontFile;
4204 extern FN_DrvUnloadFontFile DrvUnloadFontFile;
4205 
4206 /* Direct draw */
4207 
4208 typedef VOID
4209 (APIENTRY FN_DrvDisableDirectDraw)(
4210     _In_ DHPDEV dhpdev);
4211 typedef FN_DrvDisableDirectDraw *PFN_DrvDisableDirectDraw;
4212 extern FN_DrvDisableDirectDraw DrvDisableDirectDraw;
4213 
4214 typedef BOOL
4215 (APIENTRY FN_DrvEnableDirectDraw)(
4216     _In_ DHPDEV dhpdev,
4217     _Out_ DD_CALLBACKS *pCallBacks,
4218     _Out_ DD_SURFACECALLBACKS *pSurfaceCallBacks,
4219     _Out_ DD_PALETTECALLBACKS *pPaletteCallBacks);
4220 typedef FN_DrvEnableDirectDraw *PFN_DrvEnableDirectDraw;
4221 extern FN_DrvEnableDirectDraw DrvEnableDirectDraw;
4222 
4223 typedef BOOL
4224 (APIENTRY FN_DrvGetDirectDrawInfo)(
4225     _In_ DHPDEV dhpdev,
4226     _Out_ DD_HALINFO *pHalInfo,
4227     _Out_ DWORD *pdwNumHeaps,
4228     _Out_ VIDEOMEMORY *pvmList,
4229     _Out_ DWORD *pdwNumFourCCCodes,
4230     _Out_ DWORD *pdwFourCC);
4231 typedef FN_DrvGetDirectDrawInfo *PFN_DrvGetDirectDrawInfo;
4232 extern FN_DrvGetDirectDrawInfo DrvGetDirectDrawInfo;
4233 
4234 typedef BOOL //DECLSPEC_DEPRECATED_DDK
4235 (APIENTRY FN_DrvQuerySpoolType)(
4236     _In_ DHPDEV dhpdev,
4237     _In_ LPWSTR pwchType);
4238 typedef FN_DrvQuerySpoolType *PFN_DrvQuerySpoolType;
4239 extern FN_DrvQuerySpoolType DrvQuerySpoolType;
4240 
4241 typedef LONG
4242 (APIENTRY FN_DrvQueryTrueTypeSection)(
4243     ULONG,
4244     ULONG,
4245     ULONG,
4246     HANDLE *,
4247     PTRDIFF *);
4248 typedef FN_DrvQueryTrueTypeSection *PFN_DrvQueryTrueTypeSection;
4249 extern FN_DrvQueryTrueTypeSection DrvQueryTrueTypeSection;
4250 
4251 DECLSPEC_DEPRECATED_DDK
4252 typedef VOID
4253 (APIENTRY FN_DrvMovePanning)(
4254     _In_ LONG x,
4255     _In_ LONG y,
4256     _In_ FLONG fl);
4257 typedef FN_DrvMovePanning *PFN_DrvMovePanning;
4258 extern FN_DrvMovePanning DrvMovePanning;
4259 
4260 #if (NTDDI_VERSION >= NTDDI_VISTA)
4261 
4262 typedef LONG
4263 (APIENTRY FN_DrvRenderHint)(
4264     _In_ DHPDEV dhpdev,
4265     _In_ ULONG NotifyCode,
4266     _In_ SIZE_T Length,
4267     _In_reads_bytes_opt_(Length) PVOID Data);
4268 typedef FN_DrvRenderHint *PFN_DrvRenderHint;
4269 extern FN_DrvRenderHint DrvRenderHint;
4270 
4271 typedef struct _DRH_APIBITMAPDATA
4272 {
4273     SURFOBJ *pso;
4274     BOOL b;
4275 } DRH_APIBITMAPDATA, *PDRH_APIBITMAPDATA;
4276 
4277 #define DRH_APIBITMAP 0x00000001
4278 
4279 typedef HANDLE
4280 (APIENTRY FN_EngCreateRectRgn)(
4281     _In_ INT left,
4282     _In_ INT top,
4283     _In_ INT right,
4284     _In_ INT bottom);
4285 typedef FN_EngCreateRectRgn *PFN_EngCreateRectRgn;
4286 
4287 typedef VOID
4288 (APIENTRY FN_EngDeleteRgn)(
4289     HANDLE hrgn);
4290 typedef FN_EngDeleteRgn *PFN_EngDeleteRgn;
4291 
4292 typedef INT
4293 (APIENTRY FN_EngCombineRgn)(
4294     _In_ HANDLE hrgnTrg,
4295     _In_ HANDLE hrgnSrc1,
4296     _In_ HANDLE hrgnSrc2,
4297     _In_ INT iMode);
4298 typedef FN_EngCombineRgn *PFN_EngCombineRgn;
4299 
4300 typedef INT
4301 (APIENTRY FN_EngCopyRgn)(
4302     _In_ HANDLE hrgnDst,
4303     _In_ HANDLE hrgnSrc);
4304 typedef FN_EngCopyRgn *PFN_EngCopyRgn;
4305 
4306 typedef INT
4307 (APIENTRY FN_EngIntersectRgn)(
4308     _In_ HANDLE hrgnResult,
4309     _In_ HANDLE hRgnA,
4310     _In_ HANDLE hRgnB);
4311 typedef FN_EngIntersectRgn *PFN_EngIntersectRgn;
4312 
4313 typedef INT
4314 (APIENTRY FN_EngSubtractRgn)(
4315     _In_ HANDLE hrgnResult,
4316     _In_ HANDLE hRgnA,
4317     _In_ HANDLE hRgnB);
4318 typedef FN_EngSubtractRgn *PFN_EngSubtractRgn;
4319 
4320 typedef INT
4321 (APIENTRY FN_EngUnionRgn)(
4322     _In_ HANDLE hrgnResult,
4323     _In_ HANDLE hRgnA,
4324     _In_ HANDLE hRgnB);
4325 typedef FN_EngUnionRgn *PFN_EngUnionRgn;
4326 
4327 typedef INT
4328 (APIENTRY FN_EngXorRgn)(
4329     _In_ HANDLE hrgnResult,
4330     _In_ HANDLE hRgnA,
4331     _In_ HANDLE hRgnB);
4332 typedef FN_EngXorRgn *PFN_EngXorRgn;
4333 
4334 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
4335 
4336 #if (NTDDI_VERSION >= NTDDI_WIN7)
4337 
4338 /* DrvCreateDeviceBitmapEx() flags */
4339 #define CDBEX_REDIRECTION  0x00000001
4340 #define CDBEX_DXINTEROP    0x00000002
4341 
4342 typedef HBITMAP
4343 (APIENTRY FN_DrvCreateDeviceBitmapEx)(
4344     _In_ DHPDEV dhpdev,
4345     _In_ SIZEL sizl,
4346     _In_ ULONG iFormat,
4347     _In_ DWORD Flags,
4348     _In_ DHSURF dhsurfGroup,
4349     _In_ DWORD DxFormat,
4350 #if (NTDDI_VERSION >= NTDDI_WIN8)
4351     _In_ DWORD SubresourceIndex,
4352 #endif /* (NTDDI_VERSION >= NTDDI_WIN8) */
4353     _Out_ HANDLE* phSharedSurface);
4354 typedef FN_DrvCreateDeviceBitmapEx *PFN_DrvCreateDeviceBitmapEx;
4355 extern FN_DrvCreateDeviceBitmapEx DrvCreateDeviceBitmapEx;
4356 
4357 typedef VOID
4358 (APIENTRY FN_DrvDeleteDeviceBitmapEx)(
4359     _Inout_ DHSURF);
4360 typedef FN_DrvDeleteDeviceBitmapEx *PFN_DrvDeleteDeviceBitmapEx;
4361 extern FN_DrvDeleteDeviceBitmapEx DrvDeleteDeviceBitmapEx;
4362 
4363 typedef BOOL
4364 (APIENTRY FN_DrvAssociateSharedSurface)(
4365     _In_ SURFOBJ* psoSurf,
4366     _In_ HANDLE   hPhysicalSurface,
4367     _In_ HANDLE   hLogicalSurface,
4368     _In_ SIZEL    sizl);
4369 typedef FN_DrvAssociateSharedSurface *PFN_DrvAssociateSharedSurface;
4370 extern FN_DrvAssociateSharedSurface DrvAssociateSharedSurface;
4371 
4372 typedef LONG
4373 (APIENTRY FN_DrvSynchronizeRedirectionBitmaps)(
4374     _In_ DHPDEV  dhpdev,
4375     _Out_ UINT64* puiFenceID);
4376 typedef FN_DrvSynchronizeRedirectionBitmaps *PFN_DrvSynchronizeRedirectionBitmaps;
4377 extern FN_DrvSynchronizeRedirectionBitmaps DrvSynchronizeRedirectionBitmaps;
4378 
4379 #define WINDDI_MAX_BROADCAST_CONTEXT 64
4380 typedef struct tagCDDDXGK_REDIRBITMAPPRESENTINFO
4381 {
4382     UINT NumDirtyRects;
4383     PRECT DirtyRect;
4384     UINT NumContexts;
4385     HANDLE hContext[WINDDI_MAX_BROADCAST_CONTEXT+1];
4386 } CDDDXGK_REDIRBITMAPPRESENTINFO;
4387 
4388 typedef BOOL
4389 (APIENTRY FN_DrvAccumulateD3DDirtyRect)(
4390     _In_ SURFOBJ* psoSurf,
4391     _In_ CDDDXGK_REDIRBITMAPPRESENTINFO* pDirty);
4392 typedef FN_DrvAccumulateD3DDirtyRect *PFN_DrvAccumulateD3DDirtyRect;
4393 extern FN_DrvAccumulateD3DDirtyRect DrvAccumulateD3DDirtyRect;
4394 
4395 typedef BOOL
4396 (APIENTRY FN_DrvStartDxInterop)(
4397     _In_ SURFOBJ* psoSurf,
4398     _In_ BOOL bDiscard,
4399     _In_ PVOID KernelModeDeviceHandle);
4400 typedef FN_DrvStartDxInterop *PFN_DrvStartDxInterop;
4401 extern FN_DrvStartDxInterop DrvStartDxInterop;
4402 
4403 typedef BOOL
4404 (APIENTRY FN_DrvEndDxInterop)(
4405     _In_ SURFOBJ* psoSurf,
4406     _In_ BOOL bDiscard,
4407     _Out_ BOOL* bDeviceLost,
4408     _In_ PVOID KernelModeDeviceHandle);
4409 typedef FN_DrvEndDxInterop *PFN_DrvEndDxInterop;
4410 extern FN_DrvEndDxInterop DrvEndDxInterop;
4411 
4412 typedef VOID
4413 (APIENTRY FN_DrvLockDisplayArea)(
4414     _In_ DHPDEV dhpdev,
4415     _In_opt_ RECTL  *prcl);
4416 typedef FN_DrvLockDisplayArea *PFN_DrvLockDisplayArea;
4417 extern FN_DrvLockDisplayArea DrvLockDisplayArea;
4418 
4419 typedef VOID
4420 (APIENTRY FN_DrvUnlockDisplayArea)(
4421     _In_ DHPDEV dhpdev,
4422     _In_opt_ RECTL *prcl);
4423 typedef FN_DrvUnlockDisplayArea *PFN_DrvUnlockDisplayArea;
4424 extern FN_DrvUnlockDisplayArea DrvUnlockDisplayArea;
4425 
4426 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
4427 
4428 #ifdef __cplusplus
4429 }
4430 #endif
4431 
4432 #endif /* defined __VIDEO_H__ */
4433 
4434 #endif /* _WINDDI_ */
4435