ReactOS  0.4.12-dev-90-g2e2e63e
dc.c
Go to the documentation of this file.
1 #include <precomp.h>
2 
3 #define NDEBUG
4 #include <debug.h>
5 
6 HDC
9  LPCWSTR lpwszDriver,
10  LPCWSTR lpwszDevice,
11  LPCWSTR lpwszOutput,
12  PDEVMODEW lpInitData,
13  ULONG iType)
14 {
16  HDC hdc = NULL;
18  ULONG UMdhpdev = 0;
19 
20  HANDLE hspool = NULL;
21 
22  if ( !ghSpooler && !LoadTheSpoolerDrv())
23  {
24  DPRINT1("WinSpooler.Drv Did not load!\n");
25  }
26  else
27  {
28  DPRINT("WinSpooler.Drv Loaded! hMod -> 0x%p\n", ghSpooler);
29  }
30 
31  if ((!lpwszDevice) && (!lpwszDriver))
32  {
33  Default = TRUE; // Ask Win32k to set Default device.
34  Display = TRUE; // Most likely to be DISPLAY.
35  }
36  else
37  {
38  if ((lpwszDevice) && (wcslen(lpwszDevice) != 0)) // First
39  {
40  if (!_wcsnicmp(lpwszDevice, L"\\\\.\\DISPLAY",11)) Display = TRUE;
41  RtlInitUnicodeString(&Device, lpwszDevice);
42  }
43  else
44  {
45  if (lpwszDriver) // Second
46  {
47  if ((!_wcsnicmp(lpwszDriver, L"DISPLAY",7)) ||
48  (!_wcsnicmp(lpwszDriver, L"\\\\.\\DISPLAY",11))) Display = TRUE;
49  RtlInitUnicodeString(&Device, lpwszDriver);
50  }
51  }
52  }
53 
54  if (lpwszOutput) RtlInitUnicodeString(&Output, lpwszOutput);
55 
56  if (!Display)
57  {
58  //Handle Print device or something else.
59  DPRINT1("Not a DISPLAY device! %wZ\n", &Device);
60  }
61 
62  hdc = NtGdiOpenDCW((Default ? NULL : &Device),
63  (PDEVMODEW) lpInitData,
64  (lpwszOutput ? &Output : NULL),
65  iType, // DCW 0 and ICW 1.
66  Display,
67  hspool,
68  (PVOID) &UMdhpdev );
69 #if 0
70 // Handle something other than a normal dc object.
72  {
73  PDC_ATTR Dc_Attr;
74  PLDC pLDC;
75 
77 
78  pLDC = LocalAlloc(LMEM_ZEROINIT, sizeof(LDC));
79 
80  Dc_Attr->pvLDC = pLDC;
81  pLDC->hDC = hdc;
82  pLDC->iType = LDC_LDC; // 1 (init) local DC, 2 EMF LDC
83  DbgPrint("DC_ATTR Allocated -> 0x%x\n",Dc_Attr);
84  }
85 #endif
86  return hdc;
87 }
88 
89 
90 /*
91  * @implemented
92  */
93 HDC
94 WINAPI
96  _In_ HDC hdc)
97 {
98  HDC hdcNew;
99 // PDC_ATTR pdcattr;
100 
101  hdcNew = NtGdiCreateCompatibleDC(hdc);
102 #if 0
103  if ( hdc && hdcNew)
104  {
105  if (GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr))
106  {
107  if (pdcattr->pvLIcm) IcmCompatibleDC(hdcNew, hdc, pdcattr);
108  }
109  }
110 #endif
111 
112  return hdcNew;
113 }
114 
115 /*
116  * @implemented
117  */
118 HDC
119 WINAPI
121  LPCSTR lpszDriver,
122  LPCSTR lpszDevice,
123  LPCSTR lpszOutput,
124  CONST DEVMODEA * lpdvmInit)
125 {
126  ANSI_STRING DriverA, DeviceA, OutputA;
127  UNICODE_STRING DriverU, DeviceU, OutputU;
128  LPDEVMODEW dvmInitW = NULL;
129  HDC hdc;
130 
131  /*
132  * If needed, convert to Unicode
133  * any string parameter.
134  */
135 
136  if (lpszDriver != NULL)
137  {
138  RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver);
139  RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE);
140  }
141  else
142  {
143  DriverU.Buffer = NULL;
144  }
145 
146  if (lpszDevice != NULL)
147  {
148  RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice);
149  RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE);
150  }
151  else
152  {
153  DeviceU.Buffer = NULL;
154  }
155 
156  if (lpszOutput != NULL)
157  {
158  RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput);
159  RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE);
160  }
161  else
162  {
163  OutputU.Buffer = NULL;
164  }
165 
166  if (lpdvmInit != NULL)
167  dvmInitW = GdiConvertToDevmodeW((LPDEVMODEA)lpdvmInit);
168 
169  hdc = IntCreateDICW(DriverU.Buffer,
170  DeviceU.Buffer,
171  OutputU.Buffer,
172  lpdvmInit ? dvmInitW : NULL,
173  0);
174  HEAP_free(dvmInitW);
175 
176  /* Free Unicode parameters. */
177  RtlFreeUnicodeString(&DriverU);
178  RtlFreeUnicodeString(&DeviceU);
179  RtlFreeUnicodeString(&OutputU);
180 
181  /* Return the DC handle. */
182  return hdc;
183 }
184 
185 
186 /*
187  * @implemented
188  */
189 HDC
190 WINAPI
192  LPCWSTR lpwszDriver,
193  LPCWSTR lpwszDevice,
194  LPCWSTR lpwszOutput,
195  CONST DEVMODEW *lpInitData)
196 {
197  return IntCreateDICW(lpwszDriver,
198  lpwszDevice,
199  lpwszOutput,
200  (PDEVMODEW)lpInitData,
201  0);
202 }
203 
204 
205 /*
206  * @implemented
207  */
208 HDC
209 WINAPI
211  LPCWSTR lpszDriver,
212  LPCWSTR lpszDevice,
213  LPCWSTR lpszOutput,
214  CONST DEVMODEW *lpdvmInit)
215 {
216  return IntCreateDICW(lpszDriver,
217  lpszDevice,
218  lpszOutput,
219  (PDEVMODEW)lpdvmInit,
220  1);
221 }
222 
223 
224 /*
225  * @implemented
226  */
227 HDC
228 WINAPI
230  LPCSTR lpszDriver,
231  LPCSTR lpszDevice,
232  LPCSTR lpszOutput,
233  CONST DEVMODEA *lpdvmInit)
234 {
236  LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
237  LPDEVMODEW dvmInitW = NULL;
238  HDC hdc = 0;
239 
240  Status = HEAP_strdupA2W(&lpszDriverW, lpszDriver);
241  if (!NT_SUCCESS(Status))
243  else
244  {
245  Status = HEAP_strdupA2W(&lpszDeviceW, lpszDevice);
246  if (!NT_SUCCESS(Status))
248  else
249  {
250  Status = HEAP_strdupA2W(&lpszOutputW, lpszOutput);
251  if (!NT_SUCCESS(Status))
253  else
254  {
255  if (lpdvmInit)
256  dvmInitW = GdiConvertToDevmodeW((LPDEVMODEA)lpdvmInit);
257 
258  hdc = IntCreateDICW(lpszDriverW,
259  lpszDeviceW,
260  lpszOutputW,
261  lpdvmInit ? dvmInitW : NULL,
262  1 );
263  HEAP_free(dvmInitW);
264  HEAP_free(lpszOutputW);
265  }
266  HEAP_free(lpszDeviceW);
267  }
268  HEAP_free(lpszDriverW);
269  }
270 
271  return hdc;
272 }
273 
274 
275 /*
276  * @implemented
277  */
278 BOOL
279 WINAPI
281 {
282  BOOL bResult = TRUE;
283  PLDC pLDC = NULL;
284  HANDLE hPrinter = NULL;
285  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
286 
287  pLDC = GdiGetLDC(hdc);
288 
289  if (hType != GDILoObjType_LO_DC_TYPE)
290  {
291  return METADC_DeleteDC(hdc);
292  }
293 
294  bResult = NtGdiDeleteObjectApp(hdc);
295 
296  if (bResult && pLDC)
297  {
298  DPRINT1("Delete the Local DC structure\n");
299  LocalFree( pLDC );
300  }
301 
302  if (hPrinter)
303  fpClosePrinter(hPrinter);
304 
305  return bResult;
306 }
307 
308 
309 /*
310  * @unimplemented
311  */
312 INT
313 WINAPI
315 {
316  HANDLE_METADC0P(INT, SaveDC, 0, hdc);
317  return NtGdiSaveDC(hdc);
318 }
319 
320 
321 /*
322  * @unimplemented
323  */
324 BOOL
325 WINAPI
327  IN INT iLevel)
328 {
329  HANDLE_METADC(BOOL, RestoreDC, FALSE, hdc, iLevel);
330  return NtGdiRestoreDC(hdc, iLevel);
331 }
332 
333 
334 /*
335  * @implemented
336  */
337 BOOL
338 WINAPI
340 {
341  PDC_ATTR pDc_Attr;
342 
345  {
346  PLDC pLDC = GdiGetLDC(hDC);
347  if ( !pLDC )
348  {
350  return FALSE;
351  }
352  /* If a document has started set it to die. */
353  if (pLDC->Flags & LDC_INIT_DOCUMENT) pLDC->Flags |= LDC_KILL_DOCUMENT;
354 
355  return NtGdiCancelDC(hDC);
356  }
357 
358  if (GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &pDc_Attr))
359  {
360  pDc_Attr->ulDirty_ &= ~DC_PLAYMETAFILE;
361  return TRUE;
362  }
363 
364  return FALSE;
365 }
366 
367 INT
368 WINAPI
370  _In_ HDC hdc)
371 {
372  return GetDCDWord( hdc, GdiGetArcDirection, 0);
373 }
374 
375 
376 INT
377 WINAPI
379  _In_ HDC hdc,
380  _In_ INT nDirection)
381 {
382  return GetAndSetDCDWord(hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0);
383 }
384 
385 /*
386  * @unimplemented
387  */
388 BOOL
389 WINAPI
391 {
392  return 0;
393 }
394 
395 
396 /*
397  * @implemented
398  */
399 BOOL
400 WINAPI
402 {
404  return TRUE;
406  return FALSE;
407 }
408 
409 /*
410  * @implemented
411  */
412 HDC
413 WINAPI
415 {
416  PLDC pldc;
417  ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
419  return hdc;
420  pldc = GdiGetLDC(hdc);
421  if (pldc)
422  {
423  if (pldc->Flags & LDC_SAPCALLBACK) GdiSAPCallback(pldc);
424  if (pldc->Flags & LDC_KILL_DOCUMENT) return NULL;
425  if (pldc->Flags & LDC_STARTPAGE) StartPage(hdc);
426  return hdc;
427  }
429  return NULL;
430 }
431 
432 
433 /*
434  * @implemented
435  *
436  */
437 HGDIOBJ
438 WINAPI
440  _In_ HDC hdc,
441  _In_ UINT uObjectType)
442 {
443  PDC_ATTR pdcattr = NULL;
444 
445  /* Check if this is a user mode object */
446  if ((uObjectType == OBJ_PEN) ||
447  (uObjectType == OBJ_EXTPEN) ||
448  (uObjectType == OBJ_BRUSH) ||
449  (uObjectType == OBJ_COLORSPACE))
450  {
451  /* Get the DC attribute */
452  pdcattr = GdiGetDcAttr(hdc);
453  if (pdcattr == NULL)
454  {
455  return NULL;
456  }
457  }
458 
459  /* Check what object was requested */
460  switch (uObjectType)
461  {
462  case OBJ_EXTPEN:
463  case OBJ_PEN:
464  return pdcattr->hpen;
465 
466  case OBJ_BRUSH:
467  return pdcattr->hbrush;
468 
469  case OBJ_COLORSPACE:
470  return pdcattr->hColorSpace;
471 
472  case OBJ_PAL:
473  uObjectType = GDI_OBJECT_TYPE_PALETTE;
474  break;
475 
476  case OBJ_FONT:
477  uObjectType = GDI_OBJECT_TYPE_FONT;
478  break;
479 
480  case OBJ_BITMAP:
481  uObjectType = GDI_OBJECT_TYPE_BITMAP;
482  break;
483 
484  /* All others are invalid */
485  default:
487  return NULL;
488  }
489 
490  /* Pass the request to win32k */
491  return NtGdiGetDCObject(hdc, uObjectType);
492 }
493 
494 
495 /*
496  * @implemented
497  */
498 int
499 WINAPI
501  int nObjectType,
502  GOBJENUMPROC lpObjectFunc,
503  LPARAM lParam)
504 {
505  ULONG ObjectsCount;
506  ULONG Size;
507  PVOID Buffer = NULL;
508  DWORD_PTR EndOfBuffer;
509  int Result = 0;
510 
511  switch (nObjectType)
512  {
513  case OBJ_BRUSH:
514  Size = sizeof(LOGBRUSH);
515  break;
516 
517  case OBJ_PEN:
518  Size = sizeof(LOGPEN);
519  break;
520 
521  default:
523  return 0;
524  }
525 
526  ObjectsCount = NtGdiEnumObjects(hdc, nObjectType, 0, NULL);
527  if (!ObjectsCount) return 0;
528 
529  Buffer = HeapAlloc(GetProcessHeap(), 0, ObjectsCount * Size);
530  if (!Buffer)
531  {
533  return 0;
534  }
535 
536  if (!NtGdiEnumObjects(hdc, nObjectType, ObjectsCount * Size, Buffer))
537  {
538  HeapFree(GetProcessHeap(), 0, Buffer);
539  return 0;
540  }
541 
542  EndOfBuffer = (DWORD_PTR)Buffer + (ObjectsCount * Size);
543  while ((DWORD_PTR)Buffer < EndOfBuffer)
544  {
545  Result = lpObjectFunc(Buffer, lParam);
546  if (!Result) break;
547  Buffer = (PVOID)((DWORD_PTR)Buffer + Size);
548  }
549 
550  HeapFree(GetProcessHeap(), 0, Buffer);
551  return Result;
552 }
553 
554 
555 /*
556  * @implemented
557  *
558  */
559 int
560 WINAPI
562  _In_ HDC hdc,
563  _In_ int nIndex)
564 {
565  PDC_ATTR pdcattr;
566  PDEVCAPS pDevCaps = GdiDevCaps; // Primary display device capabilities.
567  DPRINT("Device CAPS1\n");
568 
569  HANDLE_METADC(INT, GetDeviceCaps, 0, hdc, nIndex);
570 
571  /* Get the DC attribute */
572  pdcattr = GdiGetDcAttr(hdc);
573  if (pdcattr == NULL)
574  {
576  return 0;
577  }
578 
579  if (!(pdcattr->ulDirty_ & DC_PRIMARY_DISPLAY))
580  return NtGdiGetDeviceCaps(hdc, nIndex);
581 
582  switch (nIndex)
583  {
584  case DRIVERVERSION:
585  return pDevCaps->ulVersion;
586 
587  case TECHNOLOGY:
588  return pDevCaps->ulTechnology;
589 
590  case HORZSIZE:
591  return pDevCaps->ulHorzSize;
592 
593  case VERTSIZE:
594  return pDevCaps->ulVertSize;
595 
596  case HORZRES:
597  return pDevCaps->ulHorzRes;
598 
599  case VERTRES:
600  return pDevCaps->ulVertRes;
601 
602  case LOGPIXELSX:
603  return pDevCaps->ulLogPixelsX;
604 
605  case LOGPIXELSY:
606  return pDevCaps->ulLogPixelsY;
607 
608  case BITSPIXEL:
609  return pDevCaps->ulBitsPixel;
610 
611  case PLANES:
612  return pDevCaps->ulPlanes;
613 
614  case NUMBRUSHES:
615  return -1;
616 
617  case NUMPENS:
618  return pDevCaps->ulNumPens;
619 
620  case NUMFONTS:
621  return pDevCaps->ulNumFonts;
622 
623  case NUMCOLORS:
624  return pDevCaps->ulNumColors;
625 
626  case ASPECTX:
627  return pDevCaps->ulAspectX;
628 
629  case ASPECTY:
630  return pDevCaps->ulAspectY;
631 
632  case ASPECTXY:
633  return pDevCaps->ulAspectXY;
634 
635  case CLIPCAPS:
636  return CP_RECTANGLE;
637 
638  case SIZEPALETTE:
639  return pDevCaps->ulSizePalette;
640 
641  case NUMRESERVED:
642  return 20;
643 
644  case COLORRES:
645  return pDevCaps->ulColorRes;
646 
647  case DESKTOPVERTRES:
648  return pDevCaps->ulVertRes;
649 
650  case DESKTOPHORZRES:
651  return pDevCaps->ulHorzRes;
652 
653  case BLTALIGNMENT:
654  return pDevCaps->ulBltAlignment;
655 
656  case SHADEBLENDCAPS:
657  return pDevCaps->ulShadeBlend;
658 
659  case COLORMGMTCAPS:
660  return pDevCaps->ulColorMgmtCaps;
661 
662  case PHYSICALWIDTH:
663  return pDevCaps->ulPhysicalWidth;
664 
665  case PHYSICALHEIGHT:
666  return pDevCaps->ulPhysicalHeight;
667 
668  case PHYSICALOFFSETX:
669  return pDevCaps->ulPhysicalOffsetX;
670 
671  case PHYSICALOFFSETY:
672  return pDevCaps->ulPhysicalOffsetY;
673 
674  case VREFRESH:
675  return pDevCaps->ulVRefresh;
676 
677  case RASTERCAPS:
678  return pDevCaps->ulRasterCaps;
679 
680  case CURVECAPS:
681  return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
683 
684  case LINECAPS:
687 
688  case POLYGONALCAPS:
691 
692  case TEXTCAPS:
693  return pDevCaps->ulTextCaps;
694 
695  case PDEVICESIZE:
696  case SCALINGFACTORX:
697  case SCALINGFACTORY:
698  default:
699  return 0;
700  }
701  return 0;
702 }
703 
704 /*
705  * @implemented
706  */
707 DWORD
708 WINAPI
710  _In_ HDC hdc,
711  _In_ DWORD dwIgnore)
712 {
713  return GetDCDWord(hdc, GdiGetRelAbs, 0);
714 }
715 
716 
717 /*
718  * @implemented
719  */
720 INT
721 WINAPI
723  HDC hdc,
724  INT Mode)
725 {
726  return GetAndSetDCDWord(hdc, GdiGetSetRelAbs, Mode, 0, 0, 0);
727 }
728 
729 
730 /*
731  * @implemented
732  */
733 DWORD
734 WINAPI
736  _In_ HDC hdc,
737  _In_ UINT u,
738  _In_ DWORD dwIn,
739  _In_ ULONG ulMFId,
740  _In_ USHORT usMF16Id,
741  _In_ DWORD dwError)
742 {
743  DWORD dwResult;
744 
745  /* This is a special API, handle it appropriately */
746  HANDLE_METADC2(DWORD, GetAndSetDCDWord, hdc, u, dwIn, ulMFId, usMF16Id, dwError);
747 
748  /* Call win32k to do the real work */
749  if (!NtGdiGetAndSetDCDword(hdc, u, dwIn, &dwResult))
750  {
751  return dwError;
752  }
753 
754  return dwResult;
755 }
756 
757 
758 /*
759  * @implemented
760  */
761 DWORD
762 WINAPI
764  _In_ HDC hdc,
765  _In_ UINT u,
766  _In_ DWORD dwError)
767 {
768  DWORD dwResult;
769 
770  if (!NtGdiGetDCDword(hdc, u, &dwResult))
771  {
772  return dwError;
773  }
774 
775  return dwResult;
776 }
777 
778 
779 /*
780  * @implemented
781  */
782 BOOL
783 WINAPI
785  HDC hdc,
786  LPSIZE lpAspectRatio)
787 {
788  return NtGdiGetDCPoint(hdc, GdiGetAspectRatioFilter, (PPOINTL)lpAspectRatio );
789 }
790 
791 
792 /*
793  * @implemented
794  */
795 UINT
796 WINAPI
798  HDC hdc,
800  UINT flags
801 )
802 {
803  return NtGdiGetBoundsRect(hdc,lprcBounds,flags & ~DCB_WINDOWMGR);
804 }
805 
806 
807 /*
808  * @implemented
809  */
810 UINT
811 WINAPI
813  CONST RECT *prc,
814  UINT flags)
815 {
816  /* FIXME add check for validate the flags */
817  return NtGdiSetBoundsRect(hdc, (LPRECT)prc, flags & ~DCB_WINDOWMGR);
818 }
819 
820 
821 /*
822  * @implemented
823  *
824  */
825 int
826 WINAPI
828  LPRECT lprc)
829 {
830  return NtGdiGetAppClipBox(hdc, lprc);
831 }
832 
833 
834 /*
835  * @implemented
836  */
837 COLORREF
838 WINAPI
840  _In_ HDC hdc)
841 {
842  PDC_ATTR pdcattr;
843 
844  /* Get the DC attribute */
845  pdcattr = GdiGetDcAttr(hdc);
846  if (pdcattr == NULL)
847  {
849  return CLR_INVALID;
850  }
851 
852  return pdcattr->ulBrushClr;
853 }
854 
855 /*
856  * @implemented
857  */
858 COLORREF
859 WINAPI
861  _In_ HDC hdc)
862 {
863  PDC_ATTR pdcattr;
864 
865  /* Get the DC attribute */
866  pdcattr = GdiGetDcAttr(hdc);
867  if (pdcattr == NULL)
868  {
870  return CLR_INVALID;
871  }
872 
873  return pdcattr->ulPenClr;
874 }
875 
876 /*
877  * @implemented
878  */
879 COLORREF
880 WINAPI
882  _In_ HDC hdc,
883  _In_ COLORREF crColor)
884 {
885  PDC_ATTR pdcattr;
886  COLORREF crOldColor;
887 
888  /* Get the DC attribute */
889  pdcattr = GdiGetDcAttr(hdc);
890  if (pdcattr == NULL)
891  {
893  return CLR_INVALID;
894  }
895 
896  /* We handle only enhanced meta DCs here */
898 
899  /* Get old color and store the new */
900  crOldColor = pdcattr->ulBrushClr;
901  pdcattr->ulBrushClr = crColor;
902 
903  if (pdcattr->crBrushClr != crColor)
904  {
905  pdcattr->ulDirty_ |= DIRTY_FILL;
906  pdcattr->crBrushClr = crColor;
907  }
908 
909  return crOldColor;
910 }
911 
912 /*
913  * @implemented
914  */
915 COLORREF
916 WINAPI
918  _In_ HDC hdc,
919  _In_ COLORREF crColor)
920 {
921  PDC_ATTR pdcattr;
922  COLORREF crOldColor;
923 
924  /* Get the DC attribute */
925  pdcattr = GdiGetDcAttr(hdc);
926  if (pdcattr == NULL)
927  {
929  return CLR_INVALID;
930  }
931 
932  /* We handle only enhanced meta DCs here */
934 
935  /* Get old color and store the new */
936  crOldColor = pdcattr->ulPenClr;
937  pdcattr->ulPenClr = (ULONG)crColor;
938 
939  if (pdcattr->crPenClr != crColor)
940  {
941  pdcattr->ulDirty_ |= DIRTY_LINE;
942  pdcattr->crPenClr = crColor;
943  }
944 
945  return crOldColor;
946 }
947 
948 /*
949  * @implemented
950  *
951  */
952 COLORREF
953 WINAPI
955  _In_ HDC hdc)
956 {
957  PDC_ATTR pdcattr;
958 
959  /* Get the DC attribute */
960  pdcattr = GdiGetDcAttr(hdc);
961  if (pdcattr == NULL)
962  {
963  /* Don't set LastError here! */
964  return CLR_INVALID;
965  }
966 
967  return pdcattr->ulBackgroundClr;
968 }
969 
970 /*
971  * @implemented
972  */
973 COLORREF
974 WINAPI
976  _In_ HDC hdc,
977  _In_ COLORREF crColor)
978 {
979  PDC_ATTR pdcattr;
980  COLORREF crOldColor;
981 
982  HANDLE_METADC(COLORREF, SetBkColor, CLR_INVALID, hdc, crColor);
983 
984  /* Get the DC attribute */
985  pdcattr = GdiGetDcAttr(hdc);
986  if (pdcattr == NULL)
987  {
989  return CLR_INVALID;
990  }
991 
992  /* Get old color and store the new */
993  crOldColor = pdcattr->ulBackgroundClr;
994  pdcattr->ulBackgroundClr = crColor;
995 
996  if (pdcattr->crBackgroundClr != crColor)
997  {
999  pdcattr->crBackgroundClr = crColor;
1000  }
1001 
1002  return crOldColor;
1003 }
1004 
1005 /*
1006  * @implemented
1007  *
1008  */
1009 int
1010 WINAPI
1012 {
1013  PDC_ATTR pdcattr;
1014 
1015  /* Get the DC attribute */
1016  pdcattr = GdiGetDcAttr(hdc);
1017  if (pdcattr == NULL)
1018  {
1019  /* Don't set LastError here! */
1020  return 0;
1021  }
1022 
1023  return pdcattr->lBkMode;
1024 }
1025 
1026 /*
1027  * @implemented
1028  *
1029  */
1030 int
1031 WINAPI
1033  _In_ HDC hdc,
1034  _In_ int iBkMode)
1035 {
1036  PDC_ATTR pdcattr;
1037  INT iOldMode;
1038 
1039  HANDLE_METADC(INT, SetBkMode, 0, hdc, iBkMode);
1040 
1041  /* Get the DC attribute */
1042  pdcattr = GdiGetDcAttr(hdc);
1043  if (pdcattr == NULL)
1044  {
1046  return 0;
1047  }
1048 
1049  iOldMode = pdcattr->lBkMode;
1050  pdcattr->jBkMode = iBkMode; // Processed
1051  pdcattr->lBkMode = iBkMode; // Raw
1052 
1053  return iOldMode;
1054 }
1055 
1056 /*
1057  * @implemented
1058  *
1059  */
1060 int
1061 WINAPI
1063  _In_ HDC hdc)
1064 {
1065  PDC_ATTR pdcattr;
1066 
1067  /* Get the DC attribute */
1068  pdcattr = GdiGetDcAttr(hdc);
1069  if (pdcattr == NULL)
1070  {
1071  /* Do not set LastError here! */
1072  return 0;
1073  }
1074 
1075  return pdcattr->jROP2;
1076 }
1077 
1078 /*
1079  * @implemented
1080  */
1081 int
1082 WINAPI
1084  _In_ HDC hdc,
1085  _In_ int rop2)
1086 {
1087  PDC_ATTR pdcattr;
1088  INT rop2Old;
1089 
1090  HANDLE_METADC(INT, SetROP2, 0, hdc, rop2);
1091 
1092  /* Get the DC attribute */
1093  pdcattr = GdiGetDcAttr(hdc);
1094  if (pdcattr == NULL)
1095  {
1097  return 0;
1098  }
1099 
1100  if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
1101  {
1102  if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
1103  {
1104  NtGdiFlush();
1105  pdcattr->ulDirty_ &= ~DC_MODE_DIRTY;
1106  }
1107  }
1108 
1109  rop2Old = pdcattr->jROP2;
1110  pdcattr->jROP2 = (BYTE)rop2;
1111 
1112  return rop2Old;
1113 }
1114 
1115 
1116 /*
1117  * @implemented
1118  *
1119  */
1120 int
1121 WINAPI
1123 {
1124  PDC_ATTR pdcattr;
1125 
1126  /* Get DC attribute */
1127  pdcattr = GdiGetDcAttr(hdc);
1128  if (pdcattr == NULL)
1129  {
1130  /* Don't set LastError here! */
1131  return 0;
1132  }
1133 
1134  /* Return current fill mode */
1135  return pdcattr->lFillMode;
1136 }
1137 
1138 /*
1139  * @unimplemented
1140  */
1141 int
1142 WINAPI
1144  _In_ HDC hdc,
1145  _In_ int iPolyFillMode)
1146 {
1147  INT iOldPolyFillMode;
1148  PDC_ATTR pdcattr;
1149 
1150  HANDLE_METADC(INT, SetPolyFillMode, 0, hdc, iPolyFillMode);
1151 
1152  /* Get the DC attribute */
1153  pdcattr = GdiGetDcAttr(hdc);
1154  if (pdcattr == NULL)
1155  {
1157  return 0;
1158  }
1159 
1160  if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
1161  {
1162  if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
1163  {
1164  NtGdiFlush(); // Sync up pdcattr from Kernel space.
1165  pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
1166  }
1167  }
1168 
1169  iOldPolyFillMode = pdcattr->lFillMode;
1170  pdcattr->lFillMode = iPolyFillMode;
1171 
1172  return iOldPolyFillMode;
1173 }
1174 
1175 /*
1176  * @implemented
1177  *
1178  */
1179 int
1180 WINAPI
1182 {
1183  PDC_ATTR pdcattr;
1184 
1185  /* Get the DC attribute */
1186  pdcattr = GdiGetDcAttr(hdc);
1187  if (pdcattr == NULL)
1188  {
1189  /* Don't set LastError here! */
1190  return 0;
1191  }
1192 
1193  /* Return current graphics mode */
1194  return pdcattr->iGraphicsMode;
1195 }
1196 
1197 /*
1198  * @unimplemented
1199  */
1200 int
1201 WINAPI
1203  _In_ HDC hdc,
1204  _In_ int iMode)
1205 {
1206  INT iOldMode;
1207  PDC_ATTR pdcattr;
1208 
1209  /* Check parameters */
1210  if ((iMode < GM_COMPATIBLE) || (iMode > GM_ADVANCED))
1211  {
1213  return 0;
1214  }
1215 
1216  /* Get the DC attribute */
1217  pdcattr = GdiGetDcAttr(hdc);
1218  if (pdcattr == NULL)
1219  {
1221  return 0;
1222  }
1223 
1224  /* Check for trivial case */
1225  if (iMode == pdcattr->iGraphicsMode)
1226  return iMode;
1227 
1228  if (NtCurrentTeb()->GdiTebBatch.HDC == hdc)
1229  {
1230  if (pdcattr->ulDirty_ & DC_MODE_DIRTY)
1231  {
1232  NtGdiFlush(); // Sync up pdcattr from Kernel space.
1233  pdcattr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY);
1234  }
1235  }
1236 
1237  /* One would think that setting the graphics mode to GM_COMPATIBLE
1238  * would also reset the world transformation matrix to the unity
1239  * matrix. However, in Windows, this is not the case. This doesn't
1240  * make a lot of sense to me, but that's the way it is.
1241  */
1242  iOldMode = pdcattr->iGraphicsMode;
1243  pdcattr->iGraphicsMode = iMode;
1244 
1245  return iOldMode;
1246 }
1247 
1248 /*
1249  * @implemented
1250  */
1251 HDC
1252 WINAPI
1254  _In_ HDC hdc,
1255  _In_ CONST DEVMODEW *lpInitData)
1256 {
1257  NtGdiResetDC ( hdc, (PDEVMODEW)lpInitData, NULL, NULL, NULL);
1258  return hdc;
1259 }
1260 
1261 
1262 /*
1263  * @implemented
1264  */
1265 HDC
1266 WINAPI
1268  _In_ HDC hdc,
1269  _In_ CONST DEVMODEA *lpInitData)
1270 {
1271  LPDEVMODEW InitDataW;
1272 
1273  InitDataW = GdiConvertToDevmodeW((LPDEVMODEA)lpInitData);
1274 
1275  NtGdiResetDC ( hdc, InitDataW, NULL, NULL, NULL);
1276  HEAP_free(InitDataW);
1277  return hdc;
1278 }
1279 
1280 
1281 /* FIXME: include correct header */
1283  HPALETTE hpal,
1284  BOOL ForceBackground);
1285 
1286 HPALETTE
1287 WINAPI
1289  HDC hdc,
1290  HPALETTE hpal,
1291  BOOL bForceBackground)
1292 {
1293  HANDLE_METADC(HPALETTE, SelectPalette, NULL, hdc, hpal, bForceBackground);
1294 
1295  return NtUserSelectPalette(hdc, hpal, bForceBackground);
1296 }
1297 
1298 /*
1299  * @implemented
1300  *
1301  */
1302 int
1303 WINAPI
1305 {
1306  PDC_ATTR pdcattr;
1307 
1308  /* Get the DC attribute */
1309  pdcattr = GdiGetDcAttr(hdc);
1310  if (pdcattr == NULL)
1311  {
1312  /* Don't set LastError here! */
1313  return 0;
1314  }
1315 
1316  return pdcattr->lStretchBltMode;
1317 }
1318 
1319 /*
1320  * @implemented
1321  */
1322 int
1323 WINAPI
1325  _In_ HDC hdc,
1326  _In_ int iStretchMode)
1327 {
1328  INT iOldMode;
1329  PDC_ATTR pdcattr;
1330 
1331  HANDLE_METADC(INT, SetStretchBltMode, 0, hdc, iStretchMode);
1332 
1333  /* Get the DC attribute */
1334  pdcattr = GdiGetDcAttr(hdc);
1335  if (pdcattr == NULL)
1336  {
1338  return 0;
1339  }
1340 
1341  iOldMode = pdcattr->lStretchBltMode;
1342  pdcattr->lStretchBltMode = iStretchMode;
1343 
1344  // Wine returns an error here. We set the default.
1345  if ((iStretchMode <= 0) || (iStretchMode > MAXSTRETCHBLTMODE)) iStretchMode = WHITEONBLACK;
1346 
1347  pdcattr->jStretchBltMode = iStretchMode;
1348 
1349  return iOldMode;
1350 }
1351 
1352 /*
1353  * @implemented
1354  */
1355 HFONT
1356 WINAPI
1358 {
1359  PDC_ATTR pdcattr;
1360 
1361  /* Get the DC attribute */
1362  pdcattr = GdiGetDcAttr(hdc);
1363  if (pdcattr == NULL)
1364  {
1365  /* Don't set LastError here! */
1366  return NULL;
1367  }
1368 
1369  /* Return the current font */
1370  return pdcattr->hlfntNew;
1371 }
1372 
1373 
1374 
1375 HBITMAP
1376 WINAPI
1378  _In_ HDC hdc,
1379  _In_ HBITMAP hbmp)
1380 {
1381  return NtGdiSelectBitmap(hdc, hbmp);
1382 }
1383 
1384 HBRUSH
1385 WINAPI
1387  _In_ HDC hdc,
1388  _In_ HBRUSH hbr)
1389 {
1390  PDC_ATTR pdcattr;
1391  HBRUSH hbrOld;
1392 
1393  HANDLE_METADC(HBRUSH, SelectBrush, NULL, hdc, hbr);
1394 
1395  /* Get the DC attribute */
1396  pdcattr = GdiGetDcAttr(hdc);
1397  if (pdcattr == NULL)
1398  {
1400  return NULL;
1401  }
1402 
1403  /* Get the current brush. If it matches the new brush, we're done */
1404  hbrOld = pdcattr->hbrush;
1405  if (hbrOld == hbr)
1406  return hbrOld;
1407 
1408  /* Set the new brush and update dirty flags */
1409  pdcattr->hbrush = hbr;
1410  pdcattr->ulDirty_ |= DC_BRUSH_DIRTY;
1411  return hbrOld;
1412 }
1413 
1414 HPEN
1415 WINAPI
1417  _In_ HDC hdc,
1418  _In_ HPEN hpen)
1419 {
1420  PDC_ATTR pdcattr;
1421  HPEN hpenOld;
1422 
1423  HANDLE_METADC(HPEN, SelectPen, NULL, hdc, hpen);
1424 
1425  /* Get the DC attribute */
1426  pdcattr = GdiGetDcAttr(hdc);
1427  if (pdcattr == NULL)
1428  {
1430  return NULL;
1431  }
1432 
1433  /* Get the current pen. If it matches the new pen, we're done */
1434  hpenOld = pdcattr->hpen;
1435  if (hpenOld == hpen)
1436  return hpenOld;
1437 
1438  /* Set the new pen and update dirty flags */
1439  pdcattr->ulDirty_ |= DC_PEN_DIRTY;
1440  pdcattr->hpen = hpen;
1441  return hpenOld;
1442 }
1443 
1444 HFONT
1445 WINAPI
1447  _In_ HDC hdc,
1448  _In_ HFONT hfont)
1449 {
1450  PDC_ATTR pdcattr;
1451  HFONT hfontOld;
1452 
1453  HANDLE_METADC(HFONT, SelectFont, NULL, hdc, hfont);
1454 
1455  /* Get the DC attribute */
1456  pdcattr = GdiGetDcAttr(hdc);
1457  if (pdcattr == NULL)
1458  {
1460  return NULL;
1461  }
1462 
1463  /* Get the current font. If it matches the new font, we're done */
1464  hfontOld = pdcattr->hlfntNew;
1465  if (hfontOld == hfont)
1466  return hfontOld;
1467 
1468  /* Set the new font and update dirty flags */
1469  pdcattr->hlfntNew = hfont;
1470  pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
1471  pdcattr->ulDirty_ |= DIRTY_CHARSET;
1472 
1473  /* If the DC does not have a DIB section selected, try a batch command */
1474  if (!(pdcattr->ulDirty_ & DC_DIBSECTION))
1475  {
1476  PGDIBSOBJECT pgO;
1477 
1478  pgO = GdiAllocBatchCommand(hdc, GdiBCSelObj);
1479  if (pgO)
1480  {
1481  pgO->hgdiobj = hfont;
1482  return hfontOld;
1483  }
1484  }
1485 
1486  /* We could not use the batch command, call win32k */
1487  return NtGdiSelectFont(hdc, hfont);
1488 }
1489 
1490 
1491 /*
1492  * @implemented
1493  *
1494  */
1495 HGDIOBJ
1496 WINAPI
1498  _In_ HDC hdc,
1499  _In_ HGDIOBJ hobj)
1500 {
1501  /* Fix up 16 bit handles */
1502  hobj = GdiFixUpHandle(hobj);
1503  if (!GdiValidateHandle(hobj))
1504  {
1505  return NULL;
1506  }
1507 
1508  /* Call the appropriate select function */
1509  switch (GDI_HANDLE_GET_TYPE(hobj))
1510  {
1512  return (HGDIOBJ)UlongToHandle(ExtSelectClipRgn(hdc, hobj, RGN_COPY));
1513 
1516  return GdiSelectBitmap(hdc, hobj);
1517 
1519  return GdiSelectBrush(hdc, hobj);
1520 
1523  return GdiSelectPen(hdc, hobj);
1524 
1526  return GdiSelectFont(hdc, hobj);
1527 
1529  return SetColorSpace(hdc, hobj);
1530 
1533 
1534  default:
1535  return NULL;
1536  }
1537 
1538  return NULL;
1539 }
1540 
1541 /***********************************************************************
1542  * D3DKMTCreateDCFromMemory (GDI32.@)
1543  */
1545 {
1546  return NtGdiDdDDICreateDCFromMemory( desc );
1547 }
1548 
1550 {
1551  return NtGdiDdDDIDestroyDCFromMemory( desc );
1552 }
HDC WINAPI CreateICA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
Definition: dc.c:229
#define CP_RECTANGLE
Definition: wingdi.h:824
__kernel_entry W32KAPI DWORD APIENTRY NtGdiDdDDIDestroyDCFromMemory(_In_ CONST D3DKMT_DESTROYDCFROMMEMORY *desc)
#define DESKTOPHORZRES
Definition: wingdi.h:740
int WINAPI GetStretchBltMode(HDC hdc)
Definition: dc.c:1304
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CC_PIE
Definition: wingdi.h:760
_Out_ PDEVCAPS pDevCaps
Definition: ntgdi.h:2664
#define DESKTOPVERTRES
Definition: wingdi.h:741
#define NUMBRUSHES
Definition: wingdi.h:720
#define HDC
Definition: msvc.h:22
#define HANDLE_METADC0P(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:585
#define CC_CHORD
Definition: wingdi.h:761
#define BITSPIXEL
Definition: wingdi.h:718
#define IN
Definition: typedefs.h:38
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetDCDword(_In_ HDC hdc, _In_ UINT u, _Out_ DWORD *Result)
#define HORZRES
Definition: wingdi.h:714
#define LOGPIXELSX
Definition: wingdi.h:716
ULONG ulBltAlignment
Definition: ntgdityp.h:321
#define TRUE
Definition: types.h:120
#define NUMRESERVED
Definition: wingdi.h:731
#define LC_WIDE
Definition: wingdi.h:773
HDC WINAPI ResetDCA(_In_ HDC hdc, _In_ CONST DEVMODEA *lpInitData)
Definition: dc.c:1267
ULONG ulHorzRes
Definition: ntgdityp.h:298
HPALETTE WINAPI SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground)
Definition: dc.c:1288
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4334
#define HBITMAP
Definition: msvc.h:28
HCOLORSPACE WINAPI SetColorSpace(_In_ HDC, _In_ HCOLORSPACE)
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
#define DWORD_PTR
Definition: treelist.c:76
DWORD WINAPI GetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
Definition: dc.c:763
_In_ ULONG iMode
Definition: winddi.h:3520
#define PC_INTERIORS
Definition: wingdi.h:802
_In_ ULONG Mode
Definition: hubbusif.h:303
BOOL WINAPI METADC_DeleteDC(_In_ HDC hdc)
Definition: rosglue.c:1256
#define DbgPrint
Definition: loader.c:25
#define ASPECTX
Definition: wingdi.h:725
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
ULONG ulRasterCaps
Definition: ntgdityp.h:305
HANDLE hbrush
Definition: ntgdihdl.h:292
BYTE jStretchBltMode
Definition: ntgdihdl.h:307
HANDLE hpen
Definition: ntgdihdl.h:293
_In_ ULONG iType
Definition: winddi.h:3748
#define LC_POLYLINE
Definition: wingdi.h:770
#define DIRTY_CHARSET
Definition: ntgdihdl.h:149
INT WINAPI SetArcDirection(_In_ HDC hdc, _In_ INT nDirection)
Definition: dc.c:378
HPALETTE WINAPI NtUserSelectPalette(HDC hDC, HPALETTE hpal, BOOL ForceBackground)
Definition: windc.c:1033
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:430
#define CC_STYLED
Definition: wingdi.h:764
ULONG ulNumFonts
Definition: ntgdityp.h:303
__kernel_entry W32KAPI ULONG APIENTRY NtGdiEnumObjects(_In_ HDC hdc, _In_ INT iObjectType, _In_ ULONG cjBuf, _Out_writes_bytes_opt_(cjBuf) PVOID pvBuf)
#define MAXSTRETCHBLTMODE
Definition: wingdi.h:954
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
PDEVCAPS GdiDevCaps
Definition: dllmain.c:9
HDC WINAPI ResetDCW(_In_ HDC hdc, _In_ CONST DEVMODEW *lpInitData)
Definition: dc.c:1253
HFONT WINAPI GetHFONT(HDC hdc)
Definition: dc.c:1357
#define COLORRES
Definition: wingdi.h:732
__kernel_entry W32KAPI HDC APIENTRY NtGdiOpenDCW(_In_opt_ PUNICODE_STRING pustrDevice, _In_ DEVMODEW *pdm, _In_ PUNICODE_STRING pustrLogAddr, _In_ ULONG iType, _In_ BOOL bDisplay, _In_opt_ HANDLE hspool, _At_((PUMDHPDEV *) pUMdhpdev, _Out_) PVOID pUMdhpdev)
Definition: dclife.c:685
#define DRIVERVERSION
Definition: wingdi.h:703
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define CLR_INVALID
Definition: wingdi.h:881
HCOLORSPACE hColorSpace
Definition: ntgdihdl.h:316
#define PDEVICESIZE
Definition: wingdi.h:728
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRestoreDC(_In_ HDC hdc, _In_ INT iLevel)
#define DC_DIBSECTION
Definition: ntgdihdl.h:159
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiSelectBitmap(_In_ HDC hdc, _In_ HBITMAP hbm)
#define BLTALIGNMENT
Definition: wingdi.h:742
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ULONG ulHorzSize
Definition: ntgdityp.h:296
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
int WINAPI SetStretchBltMode(_In_ HDC hdc, _In_ int iStretchMode)
Definition: dc.c:1324
#define SCALINGFACTORX
Definition: wingdi.h:737
LONG lFillMode
Definition: ntgdihdl.h:311
int WINAPI GetClipBox(HDC hdc, LPRECT lprc)
Definition: dc.c:827
__kernel_entry W32KAPI BOOL APIENTRY NtGdiCancelDC(_In_ HDC hdc)
BOOL WINAPI CancelDC(HDC hDC)
Definition: dc.c:339
#define LC_POLYMARKER
Definition: wingdi.h:772
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble * u
Definition: glfuncs.h:88
#define DCB_WINDOWMGR
Definition: ntgdityp.h:241
#define POLYGONALCAPS
Definition: wingdi.h:777
COLORREF crPenClr
Definition: ntgdihdl.h:300
static HPEN hpen
ULONG ulBitsPixel
Definition: ntgdityp.h:300
#define PC_WINDPOLYGON
Definition: wingdi.h:796
char * LPSTR
Definition: xmlstorage.h:182
ULONG ulPhysicalHeight
Definition: ntgdityp.h:314
#define RASTERCAPS
Definition: wingdi.h:743
DWORD WINAPI D3DKMTDestroyDCFromMemory(const D3DKMT_DESTROYDCFROMMEMORY *desc)
Definition: dc.c:1549
#define FASTCALL
Definition: nt_native.h:50
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:968
int32_t INT
Definition: typedefs.h:56
#define TECHNOLOGY
Definition: wingdi.h:704
ULONG ulVRefresh
Definition: ntgdityp.h:318
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:595
ULONG Flags
Definition: ntgdihdl.h:274
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
int WINAPI GetROP2(_In_ HDC hdc)
Definition: dc.c:1062
ULONG ulBackgroundClr
Definition: ntgdihdl.h:295
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
DWORD WINAPI GetRelAbs(_In_ HDC hdc, _In_ DWORD dwIgnore)
Definition: dc.c:709
#define OBJ_PEN
Definition: objidl.idl:1409
int WINAPI StartPage(_In_ HDC)
#define TEXTCAPS
Definition: wingdi.h:804
__kernel_entry W32KAPI DWORD APIENTRY NtGdiSetBoundsRect(_In_ HDC hdc, _In_ LPRECT prc, _In_ DWORD f)
#define PHYSICALHEIGHT
Definition: wingdi.h:734
ULONG ulShadeBlend
Definition: ntgdityp.h:326
#define DC_PRIMARY_DISPLAY
Definition: ntgdihdl.h:161
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
#define PC_WIDESTYLED
Definition: wingdi.h:801
__kernel_entry W32KAPI INT APIENTRY NtGdiSaveDC(_In_ HDC hdc)
#define LDC_KILL_DOCUMENT
Definition: ntgdihdl.h:178
BOOL WINAPI GdiCleanCacheDC(HDC hdc)
Definition: dc.c:401
#define SelectPen(hdc, hpen)
Definition: windowsx.h:487
UINT WINAPI SetBoundsRect(HDC hdc, CONST RECT *prc, UINT flags)
Definition: dc.c:812
COLORREF WINAPI SetDCBrushColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:881
#define NUMCOLORS
Definition: wingdi.h:723
#define LDC_LDC
Definition: ntgdihdl.h:170
INT WINAPI GetArcDirection(_In_ HDC hdc)
Definition: dc.c:369
LONG_PTR LPARAM
Definition: windef.h:208
ULONG ulNumPens
Definition: ntgdityp.h:302
ULONG ulVertRes
Definition: ntgdityp.h:299
HANDLE hlfntNew
Definition: ntgdihdl.h:327
#define OBJ_COLORSPACE
Definition: wingdi.h:702
#define VREFRESH
Definition: wingdi.h:739
int WINAPI GetDeviceCaps(_In_ HDC hdc, _In_ int nIndex)
Definition: dc.c:561
#define CC_INTERIORS
Definition: wingdi.h:766
ULONG ulVertSize
Definition: ntgdityp.h:297
HDC hdc
Definition: msvc.h:53
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
int WINAPI EnumObjects(HDC hdc, int nObjectType, GOBJENUMPROC lpObjectFunc, LPARAM lParam)
Definition: dc.c:500
HBITMAP WINAPI GdiSelectBitmap(_In_ HDC hdc, _In_ HBITMAP hbmp)
Definition: dc.c:1377
smooth NULL
Definition: ftsmooth.c:416
HANDLE ghSpooler
Definition: printdrv.c:40
ULONG ulAspectXY
Definition: ntgdityp.h:308
NTSTATUS HEAP_strdupA2W(LPWSTR *ppszW, LPCSTR lpszA)
Definition: heap.c:43
#define LC_MARKER
Definition: wingdi.h:771
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
void DPRINT(...)
Definition: polytest.cpp:61
int WINAPI GetBkMode(HDC hdc)
Definition: dc.c:1011
HDC hDC
Definition: ntgdihdl.h:273
#define LDC_INIT_DOCUMENT
Definition: ntgdihdl.h:173
Definition: bufpool.h:45
BOOL WINAPI DeleteDC(HDC hdc)
Definition: dc.c:280
const char * LPCSTR
Definition: xmlstorage.h:183
void * PVOID
Definition: retypes.h:9
INT WINAPI SaveDC(IN HDC hdc)
Definition: dc.c:314
HGDIOBJ WINAPI GdiFixUpHandle(HGDIOBJ hGO)
Definition: misc.c:734
#define GDI_OBJECT_TYPE_PALETTE
Definition: gdi.h:49
static HFONT hfont
#define CONST
Definition: compiler.h:170
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetDCObject(_In_ HDC hdc, _In_ INT itype)
ULONG ulDirty_
Definition: ntgdihdl.h:291
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define SCALINGFACTORY
Definition: wingdi.h:738
#define PC_STYLED
Definition: wingdi.h:800
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:152
#define CC_WIDE
Definition: wingdi.h:763
ULONG ulColorRes
Definition: ntgdityp.h:312
ULONG ulPhysicalOffsetY
Definition: ntgdityp.h:316
#define LC_STYLED
Definition: wingdi.h:774
#define LDC_STARTPAGE
Definition: ntgdihdl.h:175
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition: dcobjs.c:597
ULONG ulAspectY
Definition: ntgdityp.h:307
VOID GdiSAPCallback(PLDC pldc)
Definition: misc.c:819
#define PC_WIDE
Definition: wingdi.h:799
COLORREF crBackgroundClr
Definition: ntgdihdl.h:294
ULONG ulPlanes
Definition: ntgdityp.h:301
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define ASPECTXY
Definition: wingdi.h:727
int WINAPI SetBkMode(_In_ HDC hdc, _In_ int iBkMode)
Definition: dc.c:1032
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG ulVersion
Definition: ntgdityp.h:292
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define LMEM_ZEROINIT
Definition: winbase.h:356
#define PHYSICALOFFSETY
Definition: wingdi.h:736
int WINAPI GetPolyFillMode(HDC hdc)
Definition: dc.c:1122
BOOL WINAPI GetAspectRatioFilterEx(HDC hdc, LPSIZE lpAspectRatio)
Definition: dc.c:784
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
HGDIOBJ hgdiobj
Definition: ntgdityp.h:546
#define UlongToHandle(ul)
Definition: basetsd.h:97
BYTE jROP2
Definition: ntgdihdl.h:304
#define CC_ROUNDRECT
Definition: wingdi.h:767
#define ASPECTY
Definition: wingdi.h:726
unsigned int UINT
Definition: ndis.h:50
COLORREF crBrushClr
Definition: ntgdihdl.h:298
#define DC_PLAYMETAFILE
Definition: ntgdihdl.h:156
HFONT WINAPI GdiSelectFont(_In_ HDC hdc, _In_ HFONT hfont)
Definition: dc.c:1446
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CLIPCAPS
Definition: wingdi.h:729
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
HBRUSH WINAPI GdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbr)
Definition: dc.c:1386
#define SetLastError(x)
Definition: compat.h:409
#define OBJ_PAL
Definition: objidl.idl:1413
#define GDI_OBJECT_TYPE_METADC
Definition: gdi.h:57
#define OBJ_FONT
Definition: objidl.idl:1414
GLbitfield flags
Definition: glext.h:7161
#define LC_WIDESTYLED
Definition: wingdi.h:775
#define GM_COMPATIBLE
Definition: wingdi.h:862
FARPROC GOBJENUMPROC
Definition: wingdi.h:2882
Definition: ntgdihdl.h:271
#define SIZEPALETTE
Definition: wingdi.h:730
INT iType
Definition: ntgdihdl.h:275
COLORREF WINAPI GetBkColor(_In_ HDC hdc)
Definition: dc.c:954
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
static const WCHAR L[]
Definition: oid.c:1087
ULONG ulLogPixelsY
Definition: ntgdityp.h:310
#define SLOW_WIDTHS
Definition: ntgdihdl.h:150
Definition: arc.h:85
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:166
#define CC_ELLIPSES
Definition: wingdi.h:762
#define GDI_OBJECT_TYPE_BITMAP
Definition: gdi.h:48
unsigned char BYTE
Definition: mem.h:68
ULONG ulPhysicalOffsetX
Definition: ntgdityp.h:315
BOOL APIENTRY NtGdiGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1407
#define DC_FONTTEXT_DIRTY
Definition: ntgdihdl.h:167
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC hdc, _In_ UINT uObjectType)
Definition: dc.c:439
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define OBJ_EXTPEN
Definition: objidl.idl:1419
ULONG ulPenClr
Definition: ntgdihdl.h:301
#define WINAPI
Definition: msvc.h:20
BYTE jBkMode
Definition: ntgdihdl.h:305
INT WINAPI SetRelAbs(HDC hdc, INT Mode)
Definition: dc.c:722
__kernel_entry W32KAPI HDC APIENTRY NtGdiCreateCompatibleDC(_In_opt_ HDC hdc)
#define SelectFont(hdc, hfont)
Definition: windowsx.h:486
Status
Definition: gdiplustypes.h:24
#define HORZSIZE
Definition: wingdi.h:712
#define RGN_COPY
Definition: wingdi.h:355
int nIndex
Definition: msvc.h:77
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define LDC_SAPCALLBACK
Definition: ntgdihdl.h:172
#define _In_
Definition: no_sal2.h:204
#define PHYSICALOFFSETX
Definition: wingdi.h:735
DWORD LONG void DVTARGETDEVICE HDC HDC LPCRECTL lprcBounds
Definition: msvc.h:93
static HDC hDC
Definition: 3dtext.c:33
HDC WINAPI CreateICW(LPCWSTR lpszDriver, LPCWSTR lpszDevice, LPCWSTR lpszOutput, CONST DEVMODEW *lpdvmInit)
Definition: dc.c:210
struct tagLOGPEN LOGPEN
DWORD WINAPI GetAndSetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwIn, _In_ ULONG ulMFId, _In_ USHORT usMF16Id, _In_ DWORD dwError)
Definition: dc.c:735
#define PHYSICALWIDTH
Definition: wingdi.h:733
#define PC_RECTANGLE
Definition: wingdi.h:795
#define VERTSIZE
Definition: wingdi.h:713
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
__kernel_entry W32KAPI BOOL APIENTRY NtGdiDeleteObjectApp(_In_ HANDLE hobj)
int WINAPI SetPolyFillMode(_In_ HDC hdc, _In_ int iPolyFillMode)
Definition: dc.c:1143
HDC FASTCALL IntCreateDICW(LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, PDEVMODEW lpInitData, ULONG iType)
Definition: dc.c:8
LONG lStretchBltMode
Definition: ntgdihdl.h:312
#define OBJ_BRUSH
Definition: objidl.idl:1410
#define NUMPENS
Definition: wingdi.h:721
unsigned short USHORT
Definition: pedump.c:61
#define LINECAPS
Definition: wingdi.h:768
int WINAPI SetROP2(_In_ HDC hdc, _In_ int rop2)
Definition: dc.c:1083
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
ULONG ulBrushClr
Definition: ntgdihdl.h:299
COLORREF WINAPI GetDCBrushColor(_In_ HDC hdc)
Definition: dc.c:839
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
ULONG ulTextCaps
Definition: ntgdityp.h:317
__kernel_entry W32KAPI DWORD APIENTRY NtGdiDdDDICreateDCFromMemory(_Inout_ D3DKMT_CREATEDCFROMMEMORY *desc)
HDC WINAPI CreateDCA(LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
Definition: dc.c:120
DWORD WINAPI D3DKMTCreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY *desc)
Definition: dc.c:1544
__kernel_entry W32KAPI BOOL APIENTRY NtGdiResetDC(_In_ HDC hdc, _In_ LPDEVMODEW pdm, _Out_ PBOOL pbBanding, _In_opt_ DRIVER_INFO_2W *pDriverInfo2, _At_((PUMDHPDEV *) ppUMdhpdev, _Out_) PVOID ppUMdhpdev)
Definition: dcstate.c:121
ULONG ulPhysicalWidth
Definition: ntgdityp.h:313
#define VERTRES
Definition: wingdi.h:715
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
HGDIOBJ WINAPI SelectObject(_In_ HDC hdc, _In_ HGDIOBJ hobj)
Definition: dc.c:1497
_In_ UINT _In_ DWORD dwIn
Definition: ntgdi.h:248
#define PC_POLYGON
Definition: wingdi.h:792
#define DPRINT1
Definition: precomp.h:8
LONG lBkMode
Definition: ntgdihdl.h:310
#define PC_SCANLINE
Definition: wingdi.h:797
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL WINAPI GdiReleaseDC(HDC hdc)
Definition: dc.c:390
ULONG ulAspectX
Definition: ntgdityp.h:306
COLORREF WINAPI GetDCPenColor(_In_ HDC hdc)
Definition: dc.c:860
DWORD APIENTRY NtGdiGetBoundsRect(IN HDC hdc, OUT LPRECT prc, IN DWORD flags)
Definition: dcutil.c:699
int Display
Definition: x11stubs.h:25
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define DIRTY_LINE
Definition: ntgdihdl.h:146
ULONG ulColorMgmtCaps
Definition: ntgdityp.h:327
#define SelectBrush(hdc, hbr)
Definition: windowsx.h:485
#define LOGPIXELSY
Definition: wingdi.h:717
ULONG ulNumColors
Definition: ntgdityp.h:304
#define CC_WIDESTYLED
Definition: wingdi.h:765
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:917
BOOL WINAPI RestoreDC(IN HDC hdc, IN INT iLevel)
Definition: dc.c:326
__kernel_entry W32KAPI INT APIENTRY NtGdiGetDeviceCaps(_In_ HDC hdc, _In_ INT i)
UINT WINAPI GetBoundsRect(HDC hdc, LPRECT lprcBounds, UINT flags)
Definition: dc.c:797
COLORREF WINAPI SetBkColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:975
FORCEINLINE PVOID GdiAllocBatchCommand(HDC hdc, USHORT Cmd)
Definition: gdi32p.h:366
BOOL FASTCALL LoadTheSpoolerDrv(VOID)
Definition: printdrv.c:188
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HDC WINAPI CreateCompatibleDC(_In_ HDC hdc)
Definition: dc.c:95
CLOSEPRINTER fpClosePrinter
Definition: printdrv.c:43
ULONG ulSizePalette
Definition: ntgdityp.h:311
#define CC_CIRCLES
Definition: wingdi.h:759
ULONG ulLogPixelsX
Definition: ntgdityp.h:309
DWORD COLORREF
Definition: windef.h:290
struct tagLOGBRUSH LOGBRUSH
#define LC_INTERIORS
Definition: wingdi.h:776
HBITMAP hbmp
Definition: msvc.h:60
#define HANDLE_METADC2(_RetType, _Func, hdc,...)
Definition: gdi32p.h:701
#define CURVECAPS
Definition: wingdi.h:757
#define NUMFONTS
Definition: wingdi.h:722
#define GDI_OBJECT_TYPE_FONT
Definition: gdi.h:50
LPARAM lParam
Definition: combotst.c:139
#define OBJ_BITMAP
Definition: objidl.idl:1415
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
int WINAPI GetGraphicsMode(HDC hdc)
Definition: dc.c:1181
HPEN WINAPI GdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
Definition: dc.c:1416
ULONG ulTechnology
Definition: ntgdityp.h:293
#define WHITEONBLACK
Definition: wingdi.h:951
BOOL WINAPI GdiValidateHandle(HGDIOBJ)
Definition: misc.c:712
int WINAPI SetGraphicsMode(_In_ HDC hdc, _In_ int iMode)
Definition: dc.c:1202
HDC WINAPI GdiConvertAndCheckDC(HDC hdc)
Definition: dc.c:414
#define PLANES
Definition: wingdi.h:719
HDC WINAPI CreateDCW(LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, CONST DEVMODEW *lpInitData)
Definition: dc.c:191
#define GM_ADVANCED
Definition: wingdi.h:863
INT iGraphicsMode
Definition: ntgdihdl.h:303