ReactOS  0.4.14-dev-114-gc8cbd56
dc.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for dc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

HDC FASTCALL IntCreateDICW (LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, PDEVMODEW lpInitData, ULONG iType)
 
HDC WINAPI CreateCompatibleDC (_In_ HDC hdc)
 
HDC WINAPI CreateDCA (LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
 
HDC WINAPI CreateDCW (LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, CONST DEVMODEW *lpInitData)
 
HDC WINAPI CreateICW (LPCWSTR lpszDriver, LPCWSTR lpszDevice, LPCWSTR lpszOutput, CONST DEVMODEW *lpdvmInit)
 
HDC WINAPI CreateICA (LPCSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszOutput, CONST DEVMODEA *lpdvmInit)
 
BOOL WINAPI DeleteDC (HDC hdc)
 
INT WINAPI SaveDC (IN HDC hdc)
 
BOOL WINAPI RestoreDC (IN HDC hdc, IN INT iLevel)
 
BOOL WINAPI CancelDC (HDC hDC)
 
INT WINAPI GetArcDirection (_In_ HDC hdc)
 
INT WINAPI SetArcDirection (_In_ HDC hdc, _In_ INT nDirection)
 
BOOL WINAPI GdiReleaseDC (HDC hdc)
 
BOOL WINAPI GdiCleanCacheDC (HDC hdc)
 
HDC WINAPI GdiConvertAndCheckDC (HDC hdc)
 
HGDIOBJ WINAPI GetCurrentObject (_In_ HDC hdc, _In_ UINT uObjectType)
 
int WINAPI EnumObjects (HDC hdc, int nObjectType, GOBJENUMPROC lpObjectFunc, LPARAM lParam)
 
int WINAPI GetDeviceCaps (_In_ HDC hdc, _In_ int nIndex)
 
DWORD WINAPI GetRelAbs (_In_ HDC hdc, _In_ DWORD dwIgnore)
 
INT WINAPI SetRelAbs (HDC hdc, INT Mode)
 
DWORD WINAPI GetAndSetDCDWord (_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwIn, _In_ ULONG ulMFId, _In_ USHORT usMF16Id, _In_ DWORD dwError)
 
DWORD WINAPI GetDCDWord (_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
 
BOOL WINAPI GetAspectRatioFilterEx (HDC hdc, LPSIZE lpAspectRatio)
 
UINT WINAPI GetBoundsRect (HDC hdc, LPRECT lprcBounds, UINT flags)
 
UINT WINAPI SetBoundsRect (HDC hdc, CONST RECT *prc, UINT flags)
 
int WINAPI GetClipBox (HDC hdc, LPRECT lprc)
 
COLORREF WINAPI GetDCBrushColor (_In_ HDC hdc)
 
COLORREF WINAPI GetDCPenColor (_In_ HDC hdc)
 
COLORREF WINAPI SetDCBrushColor (_In_ HDC hdc, _In_ COLORREF crColor)
 
COLORREF WINAPI SetDCPenColor (_In_ HDC hdc, _In_ COLORREF crColor)
 
COLORREF WINAPI GetBkColor (_In_ HDC hdc)
 
COLORREF WINAPI SetBkColor (_In_ HDC hdc, _In_ COLORREF crColor)
 
int WINAPI GetBkMode (HDC hdc)
 
int WINAPI SetBkMode (_In_ HDC hdc, _In_ int iBkMode)
 
int WINAPI GetROP2 (_In_ HDC hdc)
 
int WINAPI SetROP2 (_In_ HDC hdc, _In_ int rop2)
 
int WINAPI GetPolyFillMode (HDC hdc)
 
int WINAPI SetPolyFillMode (_In_ HDC hdc, _In_ int iPolyFillMode)
 
int WINAPI GetGraphicsMode (HDC hdc)
 
int WINAPI SetGraphicsMode (_In_ HDC hdc, _In_ int iMode)
 
HDC WINAPI ResetDCW (_In_ HDC hdc, _In_ CONST DEVMODEW *lpInitData)
 
HDC WINAPI ResetDCA (_In_ HDC hdc, _In_ CONST DEVMODEA *lpInitData)
 
HPALETTE WINAPI NtUserSelectPalette (HDC hDC, HPALETTE hpal, BOOL ForceBackground)
 
HPALETTE WINAPI SelectPalette (HDC hdc, HPALETTE hpal, BOOL bForceBackground)
 
int WINAPI GetStretchBltMode (HDC hdc)
 
int WINAPI SetStretchBltMode (_In_ HDC hdc, _In_ int iStretchMode)
 
HFONT WINAPI GetHFONT (HDC hdc)
 
HBITMAP WINAPI GdiSelectBitmap (_In_ HDC hdc, _In_ HBITMAP hbmp)
 
HBRUSH WINAPI GdiSelectBrush (_In_ HDC hdc, _In_ HBRUSH hbr)
 
HPEN WINAPI GdiSelectPen (_In_ HDC hdc, _In_ HPEN hpen)
 
HFONT WINAPI GdiSelectFont (_In_ HDC hdc, _In_ HFONT hfont)
 
HGDIOBJ WINAPI SelectObject (_In_ HDC hdc, _In_ HGDIOBJ hobj)
 
DWORD WINAPI D3DKMTCreateDCFromMemory (D3DKMT_CREATEDCFROMMEMORY *desc)
 
DWORD WINAPI D3DKMTDestroyDCFromMemory (const D3DKMT_DESTROYDCFROMMEMORY *desc)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 3 of file dc.c.

Function Documentation

◆ CancelDC()

BOOL WINAPI CancelDC ( HDC  hDC)

Definition at line 339 of file dc.c.

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 
359  {
360  pDc_Attr->ulDirty_ &= ~DC_PLAYMETAFILE;
361  return TRUE;
362  }
363 
364  return FALSE;
365 }
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
__kernel_entry W32KAPI BOOL APIENTRY NtGdiCancelDC(_In_ HDC hdc)
ULONG Flags
Definition: ntgdihdl.h:278
#define LDC_KILL_DOCUMENT
Definition: ntgdihdl.h:178
#define LDC_INIT_DOCUMENT
Definition: ntgdihdl.h:173
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define DC_PLAYMETAFILE
Definition: ntgdihdl.h:156
#define SetLastError(x)
Definition: compat.h:409
#define GDI_OBJECT_TYPE_METADC
Definition: gdi.h:57
Definition: ntgdihdl.h:275
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
static HDC hDC
Definition: 3dtext.c:33
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68

◆ CreateCompatibleDC()

HDC WINAPI CreateCompatibleDC ( _In_ HDC  hdc)

Definition at line 95 of file dc.c.

97 {
98  HDC hdcNew;
99 // PDC_ATTR pdcattr;
100 
101  hdcNew = NtGdiCreateCompatibleDC(hdc);
102 #if 0
103  if ( hdc && hdcNew)
104  {
106  {
107  if (pdcattr->pvLIcm) IcmCompatibleDC(hdcNew, hdc, pdcattr);
108  }
109  }
110 #endif
111 
112  return hdcNew;
113 }
static HDC
Definition: imagelist.c:92
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI HDC APIENTRY NtGdiCreateCompatibleDC(_In_opt_ HDC hdc)
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68

Referenced by test_boundsrect(), test_CreateCompatibleDC(), test_DC_bitmap(), and test_printer_dc().

◆ CreateDCA()

HDC WINAPI CreateDCA ( LPCSTR  lpszDriver,
LPCSTR  lpszDevice,
LPCSTR  lpszOutput,
CONST DEVMODEA lpdvmInit 
)

Definition at line 120 of file dc.c.

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 }
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
char * LPSTR
Definition: xmlstorage.h:182
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:968
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
HDC hdc
Definition: main.c:9
HDC FASTCALL IntCreateDICW(LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, PDEVMODEW lpInitData, ULONG iType)
Definition: dc.c:8
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)

Referenced by create_printer_dc(), test_CreateCompatibleDC(), test_dc_values(), and test_savedc().

◆ CreateDCW()

HDC WINAPI CreateDCW ( LPCWSTR  lpwszDriver,
LPCWSTR  lpwszDevice,
LPCWSTR  lpwszOutput,
CONST DEVMODEW lpInitData 
)

Definition at line 191 of file dc.c.

196 {
197  return IntCreateDICW(lpwszDriver,
198  lpwszDevice,
199  lpwszOutput,
200  (PDEVMODEW)lpInitData,
201  0);
202 }
HDC FASTCALL IntCreateDICW(LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, PDEVMODEW lpInitData, ULONG iType)
Definition: dc.c:8

◆ CreateICA()

HDC WINAPI CreateICA ( LPCSTR  lpszDriver,
LPCSTR  lpszDevice,
LPCSTR  lpszOutput,
CONST DEVMODEA lpdvmInit 
)

Definition at line 229 of file dc.c.

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 }
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
LONG NTSTATUS
Definition: precomp.h:26
static HDC
Definition: imagelist.c:92
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:968
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS HEAP_strdupA2W(LPWSTR *ppszW, LPCSTR lpszA)
Definition: heap.c:43
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
HDC FASTCALL IntCreateDICW(LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, PDEVMODEW lpInitData, ULONG iType)
Definition: dc.c:8
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ CreateICW()

HDC WINAPI CreateICW ( LPCWSTR  lpszDriver,
LPCWSTR  lpszDevice,
LPCWSTR  lpszOutput,
CONST DEVMODEW lpdvmInit 
)

Definition at line 210 of file dc.c.

215 {
216  return IntCreateDICW(lpszDriver,
217  lpszDevice,
218  lpszOutput,
219  (PDEVMODEW)lpdvmInit,
220  1);
221 }
HDC FASTCALL IntCreateDICW(LPCWSTR lpwszDriver, LPCWSTR lpwszDevice, LPCWSTR lpwszOutput, PDEVMODEW lpInitData, ULONG iType)
Definition: dc.c:8

◆ D3DKMTCreateDCFromMemory()

DWORD WINAPI D3DKMTCreateDCFromMemory ( D3DKMT_CREATEDCFROMMEMORY desc)

Definition at line 1544 of file dc.c.

1545 {
1547 }
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
__kernel_entry W32KAPI DWORD APIENTRY NtGdiDdDDICreateDCFromMemory(_Inout_ D3DKMT_CREATEDCFROMMEMORY *desc)

◆ D3DKMTDestroyDCFromMemory()

DWORD WINAPI D3DKMTDestroyDCFromMemory ( const D3DKMT_DESTROYDCFROMMEMORY desc)

Definition at line 1549 of file dc.c.

1550 {
1552 }
__kernel_entry W32KAPI DWORD APIENTRY NtGdiDdDDIDestroyDCFromMemory(_In_ CONST D3DKMT_DESTROYDCFROMMEMORY *desc)
const struct builtin_class_descr * desc
Definition: regcontrol.c:48

◆ DeleteDC()

BOOL WINAPI DeleteDC ( HDC  hdc)

Definition at line 280 of file dc.c.

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 }
#define TRUE
Definition: types.h:120
BOOL WINAPI METADC_DeleteDC(_In_ HDC hdc)
Definition: rosglue.c:1270
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
Definition: ntgdihdl.h:275
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI BOOL APIENTRY NtGdiDeleteObjectApp(_In_ HANDLE hobj)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
CLOSEPRINTER fpClosePrinter
Definition: printdrv.c:43

Referenced by test_boundsrect(), test_CreateCompatibleDC(), test_dc_values(), test_DeleteDC(), test_printer_dc(), test_pscript_printer_dc(), and test_savedc().

◆ EnumObjects()

int WINAPI EnumObjects ( HDC  hdc,
int  nObjectType,
GOBJENUMPROC  lpObjectFunc,
LPARAM  lParam 
)

Definition at line 500 of file dc.c.

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  {
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 
551  return Result;
552 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define DWORD_PTR
Definition: treelist.c:76
__kernel_entry W32KAPI ULONG APIENTRY NtGdiEnumObjects(_In_ HDC hdc, _In_ INT iObjectType, _In_ ULONG cjBuf, _Out_writes_bytes_opt_(cjBuf) PVOID pvBuf)
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define OBJ_PEN
Definition: objidl.idl:1409
smooth NULL
Definition: ftsmooth.c:416
_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
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
uint32_t DWORD_PTR
Definition: typedefs.h:63
struct tagLOGPEN LOGPEN
#define OBJ_BRUSH
Definition: objidl.idl:1410
unsigned int ULONG
Definition: retypes.h:1
struct tagLOGBRUSH LOGBRUSH
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ GdiCleanCacheDC()

BOOL WINAPI GdiCleanCacheDC ( HDC  hdc)

Definition at line 401 of file dc.c.

402 {
404  return TRUE;
406  return FALSE;
407 }
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9

◆ GdiConvertAndCheckDC()

HDC WINAPI GdiConvertAndCheckDC ( HDC  hdc)

Definition at line 414 of file dc.c.

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 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
ULONG Flags
Definition: ntgdihdl.h:278
int WINAPI StartPage(_In_ HDC)
#define LDC_KILL_DOCUMENT
Definition: ntgdihdl.h:178
smooth NULL
Definition: ftsmooth.c:416
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define LDC_STARTPAGE
Definition: ntgdihdl.h:175
VOID GdiSAPCallback(PLDC pldc)
Definition: misc.c:819
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define SetLastError(x)
Definition: compat.h:409
Definition: ntgdihdl.h:275
HDC hdc
Definition: main.c:9
#define LDC_SAPCALLBACK
Definition: ntgdihdl.h:172
unsigned int ULONG
Definition: retypes.h:1

Referenced by AngleArc(), Arc(), ArcTo(), BitBlt(), Chord(), Ellipse(), ExtFloodFill(), ExtTextOutW(), FillRgn(), FrameRgn(), GdiAlphaBlend(), GdiGradientFill(), GdiTransparentBlt(), InvertRgn(), LineTo(), MaskBlt(), PatBlt(), Pie(), PlgBlt(), PolyBezier(), PolyBezierTo(), PolyDraw(), Polygon(), Polyline(), PolylineTo(), PolyPolygon(), PolyPolyline(), Rectangle(), RoundRect(), SetPixel(), StretchBlt(), and StretchDIBits().

◆ GdiReleaseDC()

BOOL WINAPI GdiReleaseDC ( HDC  hdc)

Definition at line 390 of file dc.c.

391 {
392  return 0;
393 }

Referenced by ReleaseDC().

◆ GdiSelectBitmap()

HBITMAP WINAPI GdiSelectBitmap ( _In_ HDC  hdc,
_In_ HBITMAP  hbmp 
)

Definition at line 1377 of file dc.c.

1380 {
1381  return NtGdiSelectBitmap(hdc, hbmp);
1382 }
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiSelectBitmap(_In_ HDC hdc, _In_ HBITMAP hbm)
HBITMAP hbmp
HDC hdc
Definition: main.c:9

Referenced by SelectObject().

◆ GdiSelectBrush()

HBRUSH WINAPI GdiSelectBrush ( _In_ HDC  hdc,
_In_ HBRUSH  hbr 
)

Definition at line 1386 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HANDLE hbrush
Definition: ntgdihdl.h:299
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
#define SelectBrush(hdc, hbr)
Definition: windowsx.h:490

Referenced by SelectObject().

◆ GdiSelectFont()

HFONT WINAPI GdiSelectFont ( _In_ HDC  hdc,
_In_ HFONT  hfont 
)

Definition at line 1446 of file dc.c.

1449 {
1450  PDC_ATTR pdcattr;
1451  HFONT hfontOld;
1452 
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 
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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define DIRTY_CHARSET
Definition: ntgdihdl.h:149
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define DC_DIBSECTION
Definition: ntgdihdl.h:159
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
HANDLE hlfntNew
Definition: ntgdihdl.h:334
smooth NULL
Definition: ftsmooth.c:416
static HFONT hfont
ULONG ulDirty_
Definition: ntgdihdl.h:298
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition: dcobjs.c:597
HGDIOBJ hgdiobj
Definition: ntgdityp.h:559
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
#define SLOW_WIDTHS
Definition: ntgdihdl.h:150
#define SelectFont(hdc, hfont)
Definition: windowsx.h:491
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
FORCEINLINE PVOID GdiAllocBatchCommand(HDC hdc, USHORT Cmd)
Definition: gdi32p.h:381

Referenced by SelectObject().

◆ GdiSelectPen()

HPEN WINAPI GdiSelectPen ( _In_ HDC  hdc,
_In_ HPEN  hpen 
)

Definition at line 1416 of file dc.c.

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 }
HANDLE hpen
Definition: ntgdihdl.h:300
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static HPEN hpen
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
#define SelectPen(hdc, hpen)
Definition: windowsx.h:492
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9

Referenced by SelectObject().

◆ GetAndSetDCDWord()

DWORD WINAPI GetAndSetDCDWord ( _In_ HDC  hdc,
_In_ UINT  u,
_In_ DWORD  dwIn,
_In_ ULONG  ulMFId,
_In_ USHORT  usMF16Id,
_In_ DWORD  dwError 
)

Definition at line 735 of file dc.c.

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 }
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
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
_In_ UINT _In_ DWORD dwIn
Definition: ntgdi.h:248
#define HANDLE_METADC2(_RetType, _Func, hdc,...)
Definition: gdi32p.h:722

Referenced by SetArcDirection(), SetMapMode(), and SetRelAbs().

◆ GetArcDirection()

INT WINAPI GetArcDirection ( _In_ HDC  hdc)

Definition at line 369 of file dc.c.

371 {
372  return GetDCDWord( hdc, GdiGetArcDirection, 0);
373 }
DWORD WINAPI GetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
Definition: dc.c:763
HDC hdc
Definition: main.c:9

Referenced by eto_emf_enum_proc(), and test_ExtTextOut().

◆ GetAspectRatioFilterEx()

BOOL WINAPI GetAspectRatioFilterEx ( HDC  hdc,
LPSIZE  lpAspectRatio 
)

Definition at line 784 of file dc.c.

787 {
788  return NtGdiGetDCPoint(hdc, GdiGetAspectRatioFilter, (PPOINTL)lpAspectRatio );
789 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY NtGdiGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1421

◆ GetBkColor()

COLORREF WINAPI GetBkColor ( _In_ HDC  hdc)

Definition at line 954 of file dc.c.

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 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
ULONG ulBackgroundClr
Definition: ntgdihdl.h:302
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9

Referenced by cd_wndproc(), draw_graphics(), EDIT_PaintText(), EMFDRV_StretchBlt(), eto_emf_enum_proc(), HEADER_FillItemFrame(), ImageList_DrawIndirect(), LISTVIEW_Refresh(), MaskBlt(), MONTHCAL_Refresh(), parent_wnd_proc(), PlgBlt(), REBAR_EraseBkGnd(), SS_ItemOut(), test_dc_values(), test_ExtTextOut(), test_mf_SaveDC(), test_SaveDC(), and Test_SrcMono1().

◆ GetBkMode()

int WINAPI GetBkMode ( HDC  hdc)

Definition at line 1011 of file dc.c.

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 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
LONG lBkMode
Definition: ntgdihdl.h:317

◆ GetBoundsRect()

UINT WINAPI GetBoundsRect ( HDC  hdc,
LPRECT  lprcBounds,
UINT  flags 
)

Definition at line 797 of file dc.c.

802 {
803  return NtGdiGetBoundsRect(hdc,lprcBounds,flags & ~DCB_WINDOWMGR);
804 }
#define DCB_WINDOWMGR
Definition: ntgdityp.h:243
GLbitfield flags
Definition: glext.h:7161
HDC hdc
Definition: main.c:9
DWORD APIENTRY NtGdiGetBoundsRect(IN HDC hdc, OUT LPRECT prc, IN DWORD flags)
Definition: dcutil.c:703

Referenced by test_boundsrect(), and test_device_caps().

◆ GetClipBox()

int WINAPI GetClipBox ( HDC  hdc,
LPRECT  lprc 
)

Definition at line 827 of file dc.c.

829 {
830  return NtGdiGetAppClipBox(hdc, lprc);
831 }
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4366
HDC hdc
Definition: main.c:9

Referenced by test_device_caps(), and test_savedc_2().

◆ GetCurrentObject()

HGDIOBJ WINAPI GetCurrentObject ( _In_ HDC  hdc,
_In_ UINT  uObjectType 
)

Definition at line 439 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
HANDLE hbrush
Definition: ntgdihdl.h:299
HANDLE hpen
Definition: ntgdihdl.h:300
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
HCOLORSPACE hColorSpace
Definition: ntgdihdl.h:323
#define OBJ_PEN
Definition: objidl.idl:1409
#define OBJ_COLORSPACE
Definition: wingdi.h:703
smooth NULL
Definition: ftsmooth.c:416
#define GDI_OBJECT_TYPE_PALETTE
Definition: gdi.h:49
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetDCObject(_In_ HDC hdc, _In_ INT itype)
#define SetLastError(x)
Definition: compat.h:409
#define OBJ_PAL
Definition: objidl.idl:1413
#define OBJ_FONT
Definition: objidl.idl:1414
HDC hdc
Definition: main.c:9
#define GDI_OBJECT_TYPE_BITMAP
Definition: gdi.h:48
#define OBJ_EXTPEN
Definition: objidl.idl:1419
#define OBJ_BRUSH
Definition: objidl.idl:1410
#define GDI_OBJECT_TYPE_FONT
Definition: gdi.h:50
#define OBJ_BITMAP
Definition: objidl.idl:1415

Referenced by ANIMATE_EraseBackground(), ANIMATE_PaintFrame(), buffer_size(), check_item_height(), close_preview(), D3DXCreateTextW(), DrawClock(), DrawShadowText(), EDIT_PaintText(), EMFDRV_SetDCBrushColor(), EMFDRV_SetDCPenColor(), EMFDRV_StretchBlt(), EnumEnhMetaFile(), EnumMetaFile(), eto_emf_enum_proc(), fnIMLangFontLink2_MapFont(), GdipCreateFontFromDC(), GdipCreateFromHDC2(), get_graphics_device_bounds(), GuiReleaseScreenBuffer(), init_script_cache(), IntDrawState(), IntGrayString(), MFDRV_StretchBlt(), MONTHCAL_Refresh(), OLEPictureImpl_SetBitmap(), PaintRgn(), parent_wnd_proc(), PlayEnhMetaFileRecord(), PlayMetaFile(), ScriptStringAnalyse(), SetDIBits(), START_TEST(), sw_SetContext(), test_bitmap_colors(), test_button_messages(), test_CreateBitmap(), test_D3DKMTCreateDCFromMemory(), test_font_metrics(), test_gdi_objects(), Test_GetCurrentObject(), test_GetCurrentObject(), test_item_height(), test_MapFont(), test_mono_bitmap(), test_ScriptShape(), and wglUseFontOutlines_common().

◆ GetDCBrushColor()

COLORREF WINAPI GetDCBrushColor ( _In_ HDC  hdc)

Definition at line 839 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
ULONG ulBrushClr
Definition: ntgdihdl.h:306

Referenced by Test_IsSpecialState().

◆ GetDCDWord()

DWORD WINAPI GetDCDWord ( _In_ HDC  hdc,
_In_ UINT  u,
_In_ DWORD  dwError 
)

Definition at line 763 of file dc.c.

767 {
768  DWORD dwResult;
769 
770  if (!NtGdiGetDCDword(hdc, u, &dwResult))
771  {
772  return dwError;
773  }
774 
775  return dwResult;
776 }
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetDCDword(_In_ HDC hdc, _In_ UINT u, _Out_ DWORD *Result)
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9

Referenced by DRIVER_RestoreDC(), GetArcDirection(), GetFontLanguageInfo(), GetObjectType(), and GetRelAbs().

◆ GetDCPenColor()

COLORREF WINAPI GetDCPenColor ( _In_ HDC  hdc)

Definition at line 860 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
ULONG ulPenClr
Definition: ntgdihdl.h:308

Referenced by Test_IsSpecialState().

◆ GetDeviceCaps()

int WINAPI GetDeviceCaps ( _In_ HDC  hdc,
_In_ int  nIndex 
)

Definition at line 561 of file dc.c.

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 }
#define CP_RECTANGLE
Definition: wingdi.h:825
#define DESKTOPHORZRES
Definition: wingdi.h:741
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define CC_PIE
Definition: wingdi.h:761
_Out_ PDEVCAPS pDevCaps
Definition: ntgdi.h:2664
#define DESKTOPVERTRES
Definition: wingdi.h:742
#define NUMBRUSHES
Definition: wingdi.h:721
#define CC_CHORD
Definition: wingdi.h:762
#define BITSPIXEL
Definition: wingdi.h:719
#define HORZRES
Definition: wingdi.h:715
#define LOGPIXELSX
Definition: wingdi.h:717
ULONG ulBltAlignment
Definition: ntgdityp.h:326
#define NUMRESERVED
Definition: wingdi.h:732
#define LC_WIDE
Definition: wingdi.h:774
ULONG ulHorzRes
Definition: ntgdityp.h:303
#define PC_INTERIORS
Definition: wingdi.h:803
#define ASPECTX
Definition: wingdi.h:726
ULONG ulRasterCaps
Definition: ntgdityp.h:310
#define LC_POLYLINE
Definition: wingdi.h:771
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CC_STYLED
Definition: wingdi.h:765
ULONG ulNumFonts
Definition: ntgdityp.h:308
PDEVCAPS GdiDevCaps
Definition: dllmain.c:9
#define COLORRES
Definition: wingdi.h:733
#define DRIVERVERSION
Definition: wingdi.h:704
#define PDEVICESIZE
Definition: wingdi.h:729
#define BLTALIGNMENT
Definition: wingdi.h:743
ULONG ulHorzSize
Definition: ntgdityp.h:301
#define SCALINGFACTORX
Definition: wingdi.h:738
#define LC_POLYMARKER
Definition: wingdi.h:773
#define POLYGONALCAPS
Definition: wingdi.h:778
ULONG ulBitsPixel
Definition: ntgdityp.h:305
#define PC_WINDPOLYGON
Definition: wingdi.h:797
ULONG ulPhysicalHeight
Definition: ntgdityp.h:319
#define RASTERCAPS
Definition: wingdi.h:744
int32_t INT
Definition: typedefs.h:56
#define TECHNOLOGY
Definition: wingdi.h:705
ULONG ulVRefresh
Definition: ntgdityp.h:323
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
#define TEXTCAPS
Definition: wingdi.h:805
#define PHYSICALHEIGHT
Definition: wingdi.h:735
ULONG ulShadeBlend
Definition: ntgdityp.h:331
#define DC_PRIMARY_DISPLAY
Definition: ntgdihdl.h:161
#define PC_WIDESTYLED
Definition: wingdi.h:802
#define NUMCOLORS
Definition: wingdi.h:724
ULONG ulNumPens
Definition: ntgdityp.h:307
ULONG ulVertRes
Definition: ntgdityp.h:304
#define VREFRESH
Definition: wingdi.h:740
int WINAPI GetDeviceCaps(_In_ HDC hdc, _In_ int nIndex)
Definition: dc.c:561
#define CC_INTERIORS
Definition: wingdi.h:767
ULONG ulVertSize
Definition: ntgdityp.h:302
smooth NULL
Definition: ftsmooth.c:416
ULONG ulAspectXY
Definition: ntgdityp.h:313
#define LC_MARKER
Definition: wingdi.h:772
void DPRINT(...)
Definition: polytest.cpp:61
ULONG ulDirty_
Definition: ntgdihdl.h:298
#define SCALINGFACTORY
Definition: wingdi.h:739
#define PC_STYLED
Definition: wingdi.h:801
#define CC_WIDE
Definition: wingdi.h:764
ULONG ulColorRes
Definition: ntgdityp.h:317
ULONG ulPhysicalOffsetY
Definition: ntgdityp.h:321
#define LC_STYLED
Definition: wingdi.h:775
ULONG ulAspectY
Definition: ntgdityp.h:312
#define PC_WIDE
Definition: wingdi.h:800
ULONG ulPlanes
Definition: ntgdityp.h:306
#define ASPECTXY
Definition: wingdi.h:728
ULONG ulVersion
Definition: ntgdityp.h:297
#define PHYSICALOFFSETY
Definition: wingdi.h:737
#define CC_ROUNDRECT
Definition: wingdi.h:768
#define ASPECTY
Definition: wingdi.h:727
#define CLIPCAPS
Definition: wingdi.h:730
#define SetLastError(x)
Definition: compat.h:409
#define LC_WIDESTYLED
Definition: wingdi.h:776
#define SIZEPALETTE
Definition: wingdi.h:731
ULONG ulLogPixelsY
Definition: ntgdityp.h:315
HDC hdc
Definition: main.c:9
#define CC_ELLIPSES
Definition: wingdi.h:763
ULONG ulPhysicalOffsetX
Definition: ntgdityp.h:320
#define HORZSIZE
Definition: wingdi.h:713
#define PHYSICALOFFSETX
Definition: wingdi.h:736
#define PHYSICALWIDTH
Definition: wingdi.h:734
#define PC_RECTANGLE
Definition: wingdi.h:796
#define VERTSIZE
Definition: wingdi.h:714
#define NUMPENS
Definition: wingdi.h:722
#define LINECAPS
Definition: wingdi.h:769
ULONG ulTextCaps
Definition: ntgdityp.h:322
ULONG ulPhysicalWidth
Definition: ntgdityp.h:318
#define VERTRES
Definition: wingdi.h:716
#define PC_POLYGON
Definition: wingdi.h:793
#define PC_SCANLINE
Definition: wingdi.h:798
ULONG ulAspectX
Definition: ntgdityp.h:311
ULONG ulColorMgmtCaps
Definition: ntgdityp.h:332
#define LOGPIXELSY
Definition: wingdi.h:718
ULONG ulNumColors
Definition: ntgdityp.h:309
#define CC_WIDESTYLED
Definition: wingdi.h:766
__kernel_entry W32KAPI INT APIENTRY NtGdiGetDeviceCaps(_In_ HDC hdc, _In_ INT i)
ULONG ulSizePalette
Definition: ntgdityp.h:316
#define CC_CIRCLES
Definition: wingdi.h:760
ULONG ulLogPixelsX
Definition: ntgdityp.h:314
#define LC_INTERIORS
Definition: wingdi.h:777
#define CURVECAPS
Definition: wingdi.h:758
#define NUMFONTS
Definition: wingdi.h:723
ULONG ulTechnology
Definition: ntgdityp.h:298
#define PLANES
Definition: wingdi.h:720

Referenced by EMFDRV_GetDeviceCaps(), test_CreateCompatibleDC(), test_DC_bitmap(), test_desktop_colorres(), test_device_caps(), and test_printer_dc().

◆ GetGraphicsMode()

int WINAPI GetGraphicsMode ( HDC  hdc)

Definition at line 1181 of file dc.c.

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 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
INT iGraphicsMode
Definition: ntgdihdl.h:310

◆ GetHFONT()

HFONT WINAPI GetHFONT ( HDC  hdc)

Definition at line 1357 of file dc.c.

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 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
HANDLE hlfntNew
Definition: ntgdihdl.h:334
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9

◆ GetPolyFillMode()

int WINAPI GetPolyFillMode ( HDC  hdc)

Definition at line 1122 of file dc.c.

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 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
LONG lFillMode
Definition: ntgdihdl.h:318
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9

◆ GetRelAbs()

DWORD WINAPI GetRelAbs ( _In_ HDC  hdc,
_In_ DWORD  dwIgnore 
)

Definition at line 709 of file dc.c.

712 {
713  return GetDCDWord(hdc, GdiGetRelAbs, 0);
714 }
DWORD WINAPI GetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
Definition: dc.c:763
HDC hdc
Definition: main.c:9

Referenced by init_function_pointers().

◆ GetROP2()

int WINAPI GetROP2 ( _In_ HDC  hdc)

Definition at line 1062 of file dc.c.

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 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
smooth NULL
Definition: ftsmooth.c:416
BYTE jROP2
Definition: ntgdihdl.h:311
HDC hdc
Definition: main.c:9

Referenced by eto_emf_enum_proc(), Poly(), RectSel(), test_dc_attributes(), test_destroyed_window(), and test_ExtTextOut().

◆ GetStretchBltMode()

int WINAPI GetStretchBltMode ( HDC  hdc)

Definition at line 1304 of file dc.c.

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 }
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
LONG lStretchBltMode
Definition: ntgdihdl.h:319

◆ IntCreateDICW()

HDC FASTCALL IntCreateDICW ( LPCWSTR  lpwszDriver,
LPCWSTR  lpwszDevice,
LPCWSTR  lpwszOutput,
PDEVMODEW  lpInitData,
ULONG  iType 
)

Definition at line 8 of file dc.c.

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 
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 }
#define TRUE
Definition: types.h:120
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
PVOID pvLDC
Definition: ntgdihdl.h:297
#define LDC_LDC
Definition: gdi_private.h:56
#define DbgPrint
Definition: loader.c:25
_In_ ULONG iType
Definition: winddi.h:3748
__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:694
static HDC
Definition: imagelist.c:92
_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)
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
HANDLE ghSpooler
Definition: printdrv.c:40
void DPRINT(...)
Definition: polytest.cpp:61
HDC hDC
Definition: ntgdihdl.h:277
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define LMEM_ZEROINIT
Definition: winbase.h:356
Definition: ntgdihdl.h:275
INT iType
Definition: ntgdihdl.h:279
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
Definition: arc.h:85
PVOID GdiGetHandleUserData(_In_ HGDIOBJ hobj)
Definition: gditools.c:68
#define DPRINT1
Definition: precomp.h:8
int Display
Definition: x11stubs.h:25
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
BOOL FASTCALL LoadTheSpoolerDrv(VOID)
Definition: printdrv.c:188
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by CreateDCA(), CreateDCW(), CreateICA(), and CreateICW().

◆ NtUserSelectPalette()

HPALETTE WINAPI NtUserSelectPalette ( HDC  hDC,
HPALETTE  hpal,
BOOL  ForceBackground 
)

Select logical palette into device context.

Parameters
hDChandle to the device context
hpalhandle to the palette
ForceBackgroundIf this value is FALSE the logical palette will be copied to the device palette only when the applicatioon is in the foreground. If this value is TRUE then map the colors in the logical palette to the device palette colors in the best way.
Returns
old palette
Todo:
implement ForceBackground == TRUE

Definition at line 1033 of file windc.c.

1036 {
1037  HPALETTE oldPal;
1039  // Implement window checks
1040  oldPal = GdiSelectPalette( hDC, hpal, ForceBackground);
1041  UserLeave();
1042  return oldPal;
1043 }
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
static HDC hDC
Definition: 3dtext.c:33
HPALETTE NTAPI GdiSelectPalette(_In_ HDC hDC, _In_ HPALETTE hpal, _In_ BOOL ForceBackground)

Referenced by SelectPalette(), and START_TEST().

◆ ResetDCA()

HDC WINAPI ResetDCA ( _In_ HDC  hdc,
_In_ CONST DEVMODEA lpInitData 
)

Definition at line 1267 of file dc.c.

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 }
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
DEVMODEW *WINAPI GdiConvertToDevmodeW(const DEVMODEA *)
Definition: misc.c:968
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
__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:122

Referenced by create_printer_dc(), and test_CreateCompatibleDC().

◆ ResetDCW()

HDC WINAPI ResetDCW ( _In_ HDC  hdc,
_In_ CONST DEVMODEW lpInitData 
)

Definition at line 1253 of file dc.c.

1256 {
1257  NtGdiResetDC ( hdc, (PDEVMODEW)lpInitData, NULL, NULL, NULL);
1258  return hdc;
1259 }
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
__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:122

◆ RestoreDC()

BOOL WINAPI RestoreDC ( IN HDC  hdc,
IN INT  iLevel 
)

Definition at line 326 of file dc.c.

328 {
329  HANDLE_METADC(BOOL, RestoreDC, FALSE, hdc, iLevel);
330  return NtGdiRestoreDC(hdc, iLevel);
331 }
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRestoreDC(_In_ HDC hdc, _In_ INT iLevel)
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
unsigned int BOOL
Definition: ntddk_ex.h:94
HDC hdc
Definition: main.c:9
BOOL WINAPI RestoreDC(IN HDC hdc, IN INT iLevel)
Definition: dc.c:326

Referenced by test_boundsrect(), test_savedc(), and test_savedc_2().

◆ SaveDC()

INT WINAPI SaveDC ( IN HDC  hdc)

Definition at line 314 of file dc.c.

315 {
317  return NtGdiSaveDC(hdc);
318 }
#define HANDLE_METADC0P(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:606
int32_t INT
Definition: typedefs.h:56
__kernel_entry W32KAPI INT APIENTRY NtGdiSaveDC(_In_ HDC hdc)
INT WINAPI SaveDC(IN HDC hdc)
Definition: dc.c:314
HDC hdc
Definition: main.c:9

Referenced by test_boundsrect(), test_savedc(), and test_savedc_2().

◆ SelectObject()

HGDIOBJ WINAPI SelectObject ( _In_ HDC  hdc,
_In_ HGDIOBJ  hobj 
)

Definition at line 1497 of file dc.c.

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  {
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 }
HCOLORSPACE WINAPI SetColorSpace(_In_ HDC, _In_ HCOLORSPACE)
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
HBITMAP WINAPI GdiSelectBitmap(_In_ HDC hdc, _In_ HBITMAP hbmp)
Definition: dc.c:1377
smooth NULL
Definition: ftsmooth.c:416
HGDIOBJ WINAPI GdiFixUpHandle(HGDIOBJ hGO)
Definition: misc.c:734
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define UlongToHandle(ul)
Definition: basetsd.h:97
HFONT WINAPI GdiSelectFont(_In_ HDC hdc, _In_ HFONT hfont)
Definition: dc.c:1446
HBRUSH WINAPI GdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbr)
Definition: dc.c:1386
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
#define RGN_COPY
Definition: wingdi.h:356
HPEN WINAPI GdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
Definition: dc.c:1416
BOOL WINAPI GdiValidateHandle(HGDIOBJ)
Definition: misc.c:712

Referenced by _find_font_for_range(), CMenuDeskBar::_OnPaint(), AboutDlgProc(), add_ruler_units(), add_with_alpha(), AddDlg_OnInitDialog(), alpha_blend_hdc_pixels(), alpha_blend_image(), AlphaBlendInit(), ANIMATE_PaintFrame(), ANIMATE_TransparentBlt(), AppearancePage_OnInit(), Bezier(), BitBltFromClipboard(), BITMAP_CopyImage(), BITMAP_LoadImageW(), BitmapFromIcon(), Bri_OnDrawItem(), Brush(), brush_fill_path(), BuildFont(), BUTTON_CalcLabelRect(), Pane::calc_single_width(), calc_single_width(), Pane::calc_widths(), calc_widths(), SelectionModel::CalculateBoundingBoxAndContents(), SelectionModel::CalculateContents(), CDimmedWindow::Capture(), CaptureScreen(), CardImageWndProc(), CB_Paint(), CB_ThemedPaint(), CBGetTextAreaHeight(), CBPaintText(), CC_PaintCross(), CC_PaintTriangle(), CC_PrepareColorGraph(), cdtDrawExt(), CFn_WMDrawItem(), CFn_WMMeasureItem(), CFn_WMPaint(), check_height_font_enumproc(), check_vertical_font(), check_vertical_metrics(), Child_OnPaint(), ChildWndProc(), choose_font(), clear_frontbuffer(), ClockWndProc(), ColorKeyedMaskBlt(), COMBO_Init(), COMBO_Paint(), COMBOEX_GetComboFontSize(), COMCTL32_DrawInsertMark(), COMCTL32_EnsureBitmapSize(), COMCTL32_GetFontMetrics(), ConfigDlgProc(), ConfirmMsgBox_Init(), ConfirmMsgBox_Paint(), Cont_OnDrawItem(), ConvertBitmapTo32Bpp(), ConWndProc(), ImageModel::CopyPrevious(), create_alpha_bitmap(), create_bitmap(), create_render_dc(), create_taskdialog_template(), CreateCheckImage(), CreateCheckMask(), CreateDragImage(), CreateLayoutIcon(), CreateMappedBitmap(), CreateMatrix(), CreateMDIMenuBitmap(), CreateRadioImage(), CreateRadioMask(), CShellLink::CreateShortcutIcon(), CreateSinkBmp(), CreateStarBitmap(), CreateStateImageList(), CreateTrayIcon(), ImageModel::Crop(), ctrl_resize(), CURSORICON_GetCursorDataFromBMI(), CURSORICON_GetCursorDataFromIconInfo(), D3DXCreateFontIndirectW(), D3DXCreateTextW(), DATETIME_Refresh(), default_page_paint_hook(), delete_render_dc(), device_load_logo(), DIALOG_CreateIndirect(), DIALOG_FilePrint(), RdpClientUI::Display_DestBlt(), Display_DrawText(), RdpClientUI::Display_Line(), RdpClientUI::Display_MemBlt(), RdpClientUI::Display_PatBlt(), RdpClientUI::Display_Polygon(), RdpClientUI::Display_Rect(), Display_SetTypeFace(), RdpClientUI::Display_TriBlt(), DisplayDlgProc(), DlgProc(), DoBlt(), DoEntry(), DoTestEntry(), CardButton::Draw(), Draw(), draw_cap(), draw_diag_edge(), draw_graphics(), draw_margin_lines(), draw_maze_border(), draw_rect_edge(), draw_splitbar(), draw_text_2(), draw_underline(), draw_wall(), DrawBackgroundPreview(), DrawCheckedRect(), DrawClassicFrame(), DrawClock(), DrawDibBegin(), DrawDibEnd(), DrawFace(), DrawFocusRect(), CGridView::DrawGrid(), DrawHands(), DrawLeds(), DrawLines(), DrawMines(), DrawProc(), CardButton::DrawRect(), DrawShadowText(), DrawThemeText(), DrawTileBitmap(), CImgAreaWindow::drawZoomFrame(), dup_bitmap(), EDIT_EM_SetMargins(), EDIT_PaintText(), EDIT_UpdateUniscribeData(), EDIT_UpdateUniscribeData_linedef(), EDIT_WM_Paint(), EDIT_WM_SetFont(), EditDlg_OnInitDialog(), EditGlyphEditWndProc(), EditTypeDlg_OnDrawItem(), Ellp(), EnumEnhMetaFile(), EnumMetaFile(), Erase(), ExtractOneBitmap(), FILEDLG95_LOOKIN_Init(), Fill(), FillGrid(), FillRect(), find_installed_font(), FlatComboProc(), SelectionModel::FlipHorizontally(), SelectionModel::FlipVertically(), fnIMLangFontLink2_GetFontCodePages(), font_height(), FrameRect(), GB_Paint(), GB_ThemedPaint(), GDI32_GdipDrawDriverString(), gdi_get_font_metrics(), GdipAddPathString(), GdipCreateFont(), GdipCreateFontFromLogfontW(), GdipDrawImagePointsRect(), GdipDrawString(), GdipGetDC(), GdipGetImageGraphicsContext(), GdipMeasureCharacterRanges(), GdipMeasureDriverString(), GdipMeasureString(), GeneralPageProc(), get_color_format(), get_current_font_height(), get_font_dpi(), get_font_fsselection(), get_font_hfont(), get_glyph_indices(), get_text_metr_size(), get_tmheight(), GetButtonHeight(), ATL::CImage::GetDC(), GetDiaogTextureBrush(), GetFontCellSize(), GetFontMetrics(), GetIdealItemHeight(), GetThemeTextExtent(), GetThemeTextMetrics(), Ghost_OnDraw(), Graph_DrawCpuUsageGraph(), Graph_DrawMemUsageGraph(), GraphCtrl_Dispose(), GraphCtrl_DrawPoint(), GraphCtrl_InvalidateCtrl(), GraphCtrl_Paint(), GuiConsoleHandleNcCreate(), GuiCopyFromGraphicsBuffer(), GuiPaintTextModeBuffer(), CTaskSwitchWnd::HandleItemPaint(), HandlePrintPasswdChar(), HEADER_Create(), HEADER_CreateDragImage(), HEADER_DrawItem(), HEADER_Refresh(), HEADER_SetFont(), HelDdSurfLock(), HelDdSurfUnlock(), HEXEDIT_WM_PAINT(), HEXEDIT_WM_SETFONT(), HLPFILE_RtfAddTransparentBitmap(), HOTKEY_DrawHotKey(), HOTKEY_SetFont(), ICONTITLE_Paint(), ICONTITLE_SetTitlePos(), COpenWithMenu::IconToBitmap(), ID3DXFontImpl_DrawTextW(), ImageEditWndProc(), ImageEditWndRepaint(), ImageList_Add(), ImageList_AddMasked(), ImageList_Copy(), ImageList_Create(), ImageList_DragMove(), ImageList_DragShowNolock(), ImageList_DrawIndirect(), ImageList_GetIcon(), IMAGELIST_InternalExpandBitmaps(), ImageList_Remove(), ImageList_Replace(), ImageList_ReplaceIcon(), ImageList_SetIconSize(), ImageList_SetImageCount(), ImageModel::ImageModel(), ImageView_DrawImage(), init(), init_output(), InitColorButtons(), InitLogo(), InitPerBitDepth(), InitResources(), ImageModel::Insert(), SelectionModel::InsertFromHBITMAP(), IntDrawDiagEdge(), IntDrawScrollInterior(), IntDrawState(), IntGetWindowBitmap(), IntGrayString(), is_font_available(), Line(), LISTBOX_DrawFocusRect(), LISTBOX_Paint(), LISTBOX_RepaintItem(), LISTBOX_SetFont(), LISTVIEW_Command(), LISTVIEW_CreateCheckBoxIL(), LISTVIEW_CreateDragImage(), LISTVIEW_EditLabelT(), LISTVIEW_GetItemMetrics(), LISTVIEW_GetStringWidthT(), LISTVIEW_Refresh(), LISTVIEW_RefreshList(), LISTVIEW_RefreshReport(), LISTVIEW_RefreshReportGrid(), LISTVIEW_SaveTextMetrics(), LISTVIEW_SetColumnWidth(), LISTVIEW_ShowFocusRect(), LoadCardBitmapsFromLibrary(), LoadDialog(), LoadIniFile(), LPK_DrawUnderscore(), LrgCellWndProc(), MainWndProc(), map_font(), MDI_AugmentFrameMenu(), ME_DebugWrite(), ME_DrawOLE(), ME_DrawParaDecoration(), ME_DrawTableBorders(), ME_SelectStyleFont(), ME_UnselectStyleFont(), CTrayClockWnd::MeasureLines(), menu_ownerdraw_wnd_proc(), mi_line(), mi_paint_rect(), MonSelGetMonitorFont(), MonSelPaint(), MonSelPaintMonitor(), MONTHCAL_Circle(), MONTHCAL_DrawDay(), MONTHCAL_PaintCalendar(), MONTHCAL_PaintTitle(), MONTHCAL_PaintTodayTitle(), MONTHCAL_PaintWeeknumbers(), MONTHCAL_Refresh(), MONTHCAL_UpdateSize(), MonthCalPaint(), msi_dialog_get_sans_serif_height(), msi_load_picture(), mstsc_ProtocolIOThread(), MyDrawCaptionTemp(), MyDrawFrameCaption(), MyDrawFrameScroll(), MyDrawMenuBarTemp(), MyIntDrawRectEdge(), NT5_DrawBaseBackground(), NT5_DrawLogoffCaptionText(), NT5_DrawLogoffIcon(), OB_Paint(), OleCreatePropertyFrameIndirect(), OLEFontImpl_QueryTextMetrics(), OleMetafilePictFromIconAndLabel(), OLEPictureImpl_LoadWICSource(), OLEPictureImpl_SelectPicture(), on_wm_initdialog(), CMenuToolbarBase::OnCustomDraw(), CBaseBarSite::OnCustomDraw(), OnDrawItem(), CPaletteWindow::OnPaint(), CToolSettingsWindow::OnPaint(), CImgAreaWindow::OnPaint(), CTrayClockWnd::OnPaint(), CBrandBand::OnPaint(), CDownloaderProgress::OnPaint(), OnPaint(), paint_ruler(), PaintBanner(), PaintCells(), PaintControl(), PAINTING_DrawStateJam(), CDrvDefExt::PaintStaticControls(), PaintText(), parent_wnd_proc(), PathSetDlgItemPathW(), PB_Paint(), PB_ThemedPaint(), PlayEnhMetaFileRecord(), PlayMetaFile(), PlayMetaFileRecord(), PlotCharacter(), plugin_proc(), Poly(), PolygonTest(), PolyPatBlt(), prepare_dc(), CardRegion::PrepareDragBitmaps(), CardRegion::PrepareDragBitmapsThreed(), PressBox(), print_preview(), PRINTDLG_PagePaintProc(), PrintTextXY(), PROPSHEET_Paint(), realize_font(), REBAR_DrawBand(), REBAR_DrawChevron(), REBAR_ValidateBand(), Rect(), RectSel(), ImageModel::Redo(), ATL::CImage::ReleaseDC(), render_masked_bitmap(), ImageModel::ResetToPrevious(), restore_dc(), RosImageProc(), SelectionModel::RotateNTimes90Degrees(), RRect(), SB_OnPaint(), SelectionModel::ScaleContentsToFit(), ScreenSaverProc(), ScriptStringAnalyse(), SelectionFrame(), CardWindow::SetBackImage(), SetDIBits(), CGridView::SetFont(), SetFont(), SetFontStylesToCombo2(), SetMatrixMessage(), SetSpecialDCState(), SetSpecialDCState2(), SetupControls(), ShowColorSpectrum(), SIC_OverlayShortcutImage(), SoftModalMessageBox(), SOFTWARE_GdipDrawDriverString(), solid_patblt(), SS_ItemOut(), START_TEST(), STATIC_PaintBitmapfn(), STATIC_PaintOwnerDrawfn(), STATIC_PaintTextfn(), STATUSBAR_Refresh(), StatusDialogProc(), stretch_blt_icon(), SYSLINK_Draw(), SYSLINK_GetIdealHeight(), SYSLINK_GetIdealSize(), SYSLINK_Render(), TAB_Create(), TAB_DrawItemInterior(), TAB_Refresh(), TAB_SetItemBounds(), taskdialog_get_text_extent(), test_32bit_ddb(), test_alpha_hdc(), test_bcm_get_ideal_size(), test_BitBlt(), Test_Bitmap(), test_bitmap(), test_bitmap_colors(), test_bitmap_font(), test_bitmap_font_glyph_index(), test_bitmap_font_metrics(), test_bitmap_formats(), test_bitmap_rendering(), test_boundsrect(), Test_BrushOrigin(), test_buffered_paint(), Test_bug3481(), test_button_messages(), test_clipping(), test_CreateBitmap(), Test_CreateCompatibleDC(), test_CreateCompatibleDC(), test_createdibitmap(), Test_CreateDIBitmap_CBM_CREATDIB(), Test_CreateDIBitmap_DIB_PAL_COLORS(), Test_CreateDIBPatternBrushPt(), test_createhbitmap(), test_D3DKMTCreateDCFromMemory(), test_DC_bitmap(), test_dc_layout(), test_device_caps(), test_DIB_PAL_COLORS(), test_dibsections(), test_DrawDib_sizeimage(), test_DrawIcon(), test_DrawIconEx(), test_DrawState(), test_DrawTextCalcRect(), test_east_asian_font_selection(), test_emf_BitBlt(), test_emf_DCBrush(), test_emf_ExtTextOut_on_path(), test_emfonly(), test_ExtTextOut(), test_fake_bold_font(), test_FillRect(), test_font_caps(), Test_FontSelectionEntry(), test_fstype_fixup(), test_fullname(), test_fullname2_helper(), test_gdi_objects(), test_GdiAlphaBlend(), Test_GdiGetCharDimensions(), test_GdiGetCodePage(), test_GdiGradientFill(), test_GdipDrawImagePointsRectOnMemoryDC(), test_GdipFillRectanglesOnMemoryDCSolidBrush(), test_GdipFillRectanglesOnMemoryDCTextureBrush(), test_GdipGetVisibleClipBounds_memoryDC(), test_gditransform(), test_GetCharABCWidths(), test_GetCharWidth32(), test_GetCharWidthI(), Test_GetCurrentObject(), test_GetCurrentObject(), test_GetCursorFrameInfo(), test_getdc(), test_getdc_scaled(), Test_GetDIBColorTable(), test_GetDIBits_selected_DDB(), test_GetDIBits_selected_DIB(), test_GetFontUnicodeRanges(), test_GetGlyphIndices(), test_GetGlyphOutline(), test_GetGlyphOutline_empty_contour(), test_GetGlyphOutline_metric_clipping(), Test_GetIdealSizeNoThemes(), test_GetKerningPairs(), test_GetOutlineTextMetrics(), Test_GetPixel_1bpp(), Test_GetRandomRgn_RGN5(), Test_GetRandomRgn_SYSRGN(), test_GetSetDIBits_rtl(), test_GetTextFace(), Test_GetTextFaceAliasW(), test_GetTextMetrics2(), test_hdc_caching(), test_height(), test_ImageList_DrawIndirect(), Test_IsSpecialState(), test_item_count(), test_layered_window(), test_margins_usefontinfo(), Test_MaskBlt_16bpp(), Test_MaskBlt_1bpp(), Test_MaskBlt_32bpp(), Test_MaskBlt_Brush(), test_max_height(), test_memory_dc_clipping(), test_mf_DCBrush(), test_mf_PatternBrush(), test_mf_SaveDC(), test_mono_bitmap(), test_mono_dibsection(), test_negative_width(), test_nonexistent_font(), Test_NtGdiDoPalette_SetDIBColorTable(), test_nullframerect(), test_oemcharset(), test_orientation(), test_outline_font(), Test_PaintRgn(), test_palette_brush(), test_path_state(), Test_Pen(), test_printer_dc(), test_ps_alternate(), test_RealizationInfo(), Test_Rectangle(), Test_Region(), test_SaveDC(), test_script_cache_reuse(), test_ScriptCacheGetHeight(), test_ScriptGetFontProperties(), test_ScriptGetGlyphABCWidth(), test_ScriptShape(), test_ScriptShapeOpenType(), test_select_object(), Test_SelectObject(), Test_SetDCPenColor(), Test_SetDIBits_1bpp(), test_SetDIBitsToDevice(), test_SetDIBitsToDevice_RLE8(), Test_SetPixel_PAL(), test_SetTextJustification(), test_simple_graphics(), Test_SrcMono(), Test_SrcMono1(), test_StretchBlt(), test_StretchDIBits(), test_tab(), test_text_extents(), test_text_metrics(), test_text_position_style(), test_widenpath(), Text(), TEXT_DrawUnderscore(), TextProc(), ThemeDrawCaptionText(), ThemeEndBufferedPaint(), ThemeStartBufferedPaint(), TimeZonePageProc(), TOOLBAR_CalcStrings(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DrawArrow(), TOOLBAR_DrawMasked(), TOOLBAR_DrawPattern(), TOOLBAR_DrawString(), TOOLBAR_LayoutToolbar(), ToolTipProc(), TOOLTIPS_CalcTipSize(), TOOLTIPS_Refresh(), TRACKBAR_DrawTics(), TRACKBAR_FillThumb(), TRACKBAR_Refresh(), TrayIcon_GetProcessorUsageIcon(), TreeListDraw(), TreeListEditLabel(), TREEVIEW_Command(), TREEVIEW_ComputeTextWidth(), TREEVIEW_CreateDragImage(), TREEVIEW_DrawItem(), TREEVIEW_DrawItemLines(), TREEVIEW_EditLabel(), TREEVIEW_InitCheckboxes(), TREEVIEW_NaturalHeight(), TREEVIEW_UpdateSubTree(), UB_Paint(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), UITOOLS95_DrawFrameScroll(), UITOOLS_DrawCheckedRect(), ImageModel::Undo(), UnpressBox(), update_preview(), UpdateButtonColor(), UpdateCaretPos(), UpdateFont(), UserLpkPSMTextOut(), UXTHEME_DrawBorderRectangle(), UXTHEME_DrawImageBackground(), UXTHEME_DrawThemePartToDib(), UXTHEME_SizedBlt(), VfdToolTip(), VolumeDlgProc(), wglUseFontOutlines_common(), WinMain(), WndProc(), SDIMainFrame::WndProc(), ChildWindow::WndProc(), WndProc_wave(), write_monocolor_span_frontbuffer(), wWinMain(), and CDimmedWindow::~CDimmedWindow().

◆ SelectPalette()

HPALETTE WINAPI SelectPalette ( HDC  hdc,
HPALETTE  hpal,
BOOL  bForceBackground 
)

Definition at line 1288 of file dc.c.

1292 {
1293  HANDLE_METADC(HPALETTE, SelectPalette, NULL, hdc, hpal, bForceBackground);
1294 
1295  return NtUserSelectPalette(hdc, hpal, bForceBackground);
1296 }
HPALETTE WINAPI SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground)
Definition: dc.c:1288
HPALETTE WINAPI NtUserSelectPalette(HDC hDC, HPALETTE hpal, BOOL ForceBackground)
Definition: windc.c:1033
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9

◆ SetArcDirection()

INT WINAPI SetArcDirection ( _In_ HDC  hdc,
_In_ INT  nDirection 
)

Definition at line 378 of file dc.c.

381 {
382  return GetAndSetDCDWord(hdc, GdiGetSetArcDirection, nDirection, 0, 0, 0);
383 }
HDC hdc
Definition: main.c:9
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

◆ SetBkColor()

COLORREF WINAPI SetBkColor ( _In_ HDC  hdc,
_In_ COLORREF  crColor 
)

Definition at line 975 of file dc.c.

978 {
979  PDC_ATTR pdcattr;
980  COLORREF crOldColor;
981 
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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
ULONG ulBackgroundClr
Definition: ntgdihdl.h:302
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
COLORREF crBackgroundClr
Definition: ntgdihdl.h:301
DWORD COLORREF
Definition: windef.h:285
#define SetLastError(x)
Definition: compat.h:409
#define DIRTY_FILL
Definition: ntgdihdl.h:145
HDC hdc
Definition: main.c:9
#define DIRTY_LINE
Definition: ntgdihdl.h:146
COLORREF WINAPI SetBkColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:975

Referenced by AboutProc(), ANIMATE_TransparentBlt(), CBPaintText(), cd_wndproc(), cdtDrawExt(), CFn_WMDrawItem(), COMBOEX_ComboWndProc(), COMBOEX_DrawItem(), COMBOEX_EditWndProc(), ConfigDlgProc(), CreateDragImage(), CreateLayoutIcon(), CreateStateImageList(), CreateTrayIcon(), D3DXCreateFontIndirectW(), DefWndControlColor(), RdpClientUI::Display_PatBlt(), RdpClientUI::Display_Polygon(), CardButton::Draw(), draw_graphics(), draw_space(), draw_text(), DrawCheckedRect(), DrawShadowText(), EDIT_PaintText(), EditTypeDlg_OnDrawItem(), EnumEnhMetaFile(), FD31_FileOpenDlgProc(), FD31_WMDrawItem(), FILEDLG95_LOOKIN_DrawItem(), FileMenu_DrawItem(), FillSolidRect(), FillSolidRect2(), GraphCtrl_InvalidateCtrl(), GuiPaintTextModeBuffer(), HEADER_DrawItem(), HLPFILE_RtfAddTransparentBitmap(), HOTKEY_DrawHotKey(), ImageList_AddMasked(), ImageList_DrawIndirect(), IntDrawState(), IntGrayString(), IPADDRESS_Draw(), LISTBOX_PaintItem(), LISTVIEW_DrawFocusRect(), LISTVIEW_Refresh(), MONTHCAL_DrawDay(), MONTHCAL_PaintCalendar(), MONTHCAL_PaintTitle(), MONTHCAL_Refresh(), MonthCalPaint(), MouseOnCtrlColorStatic(), MyDrawMenuBarTemp(), OLEPictureImpl_LoadWICSource(), OnDrawItem(), CBrandBand::OnPaint(), OnPaint(), PaintControl(), PaintRect(), PaintText(), parent_wnd_proc(), PlayEnhMetaFileRecord(), PlayMetaFileRecord(), PlotCharacter(), prepaint_setup(), PROPSHEET_WizardSubclassProc(), REBAR_EraseBkGnd(), render_masked_bitmap(), SHFillRectClr(), SS_ItemOut(), STATIC_PaintBitmapfn(), SYSLINK_Draw(), TAB_DrawItem(), TAB_EraseTabInterior(), test_bitmap_colors(), test_dc_values(), test_ExtTextOut(), Test_GetPixel_1bpp(), test_mf_SaveDC(), test_mono_bitmap(), test_SaveDC(), Test_SrcMono1(), test_StretchBlt(), Text(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DrawButton(), TOOLBAR_DrawFlatHorizontalSeparator(), TOOLBAR_DrawFlatSeparator(), TOOLBAR_DrawMasked(), TOOLBAR_DrawPattern(), TOOLBAR_DrawString(), TRACKBAR_DrawThumb(), TreeListDraw(), TREEVIEW_DrawItem(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS_DrawCheckedRect(), and WndProc().

◆ SetBkMode()

int WINAPI SetBkMode ( _In_ HDC  hdc,
_In_ int  iBkMode 
)

Definition at line 1032 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
int32_t INT
Definition: typedefs.h:56
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
smooth NULL
Definition: ftsmooth.c:416
int WINAPI SetBkMode(_In_ HDC hdc, _In_ int iBkMode)
Definition: dc.c:1032
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
BYTE jBkMode
Definition: ntgdihdl.h:312
LONG lBkMode
Definition: ntgdihdl.h:317

Referenced by add_ruler_units(), BUTTON_WindowProc(), ButtonWndProc_common(), CaptWndProc(), ConfirmMsgBox_Paint(), CreateStateImageList(), DATETIME_Refresh(), default_page_paint_hook(), DlgProc(), draw_graphics(), Pane::draw_item(), draw_item(), draw_text_2(), DrawProc(), DrawShadowText(), DrawStatusTextW(), DrawThemeText(), EDIT_PaintText(), GDI32_GdipDrawDriverString(), HackFillStaticBg(), HEADER_DrawItem(), HEXEDIT_PaintLines(), ICONTITLE_Paint(), LISTVIEW_Refresh(), MainWnd_OnDrawItem(), MainWndProc(), ME_PaintContent(), MonSelPaint(), MONTHCAL_DrawDay(), MonthCalPaint(), MSIText_WndProc(), MyDrawCaptionTemp(), MyDrawFrameCaption(), MyDrawFrameScroll(), MyDrawMenuBarTemp(), NT5_DrawLogoffCaptionText(), CTrayWindow::OnCtlColorBtn(), OnCtlColorStatic(), CMenuToolbarBase::OnCustomDraw(), OnDrawItem(), CTrayClockWnd::OnPaint(), OnPaint(), PB_Paint(), PlayEnhMetaFileRecord(), PlayMetaFileRecord(), prepaint_setup(), PROPSHEET_Paint(), REBAR_DrawBand(), RosImageProc(), SetupControls(), SS_ItemOut(), START_TEST(), SubclassButtonProc(), SYSLINK_Draw(), TAB_DrawItemInterior(), TabDlgProc(), test_ExtTextOut(), test_ps_alternate(), Test_SrcMono1(), Text(), ThemeDlgPostWindowProc(), TOOLBAR_DrawButton(), TOOLBAR_DrawString(), ToolTipProc(), TOOLTIPS_Refresh(), TreeListDraw(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), UITOOLS95_DrawFrameScroll(), WndProc(), ColorStatic::WndProc(), and HyperlinkCtrl::WndProc().

◆ SetBoundsRect()

UINT WINAPI SetBoundsRect ( HDC  hdc,
CONST RECT prc,
UINT  flags 
)

Definition at line 812 of file dc.c.

815 {
816  /* FIXME add check for validate the flags */
818 }
#define DCB_WINDOWMGR
Definition: ntgdityp.h:243
__kernel_entry W32KAPI DWORD APIENTRY NtGdiSetBoundsRect(_In_ HDC hdc, _In_ LPRECT prc, _In_ DWORD f)
GLbitfield flags
Definition: glext.h:7161
HDC hdc
Definition: main.c:9
_Out_ LPRECT prc
Definition: ntgdi.h:1658

Referenced by test_boundsrect(), and test_device_caps().

◆ SetDCBrushColor()

COLORREF WINAPI SetDCBrushColor ( _In_ HDC  hdc,
_In_ COLORREF  crColor 
)

Definition at line 881 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
COLORREF WINAPI SetDCBrushColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:881
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
DWORD COLORREF
Definition: windef.h:285
COLORREF crBrushClr
Definition: ntgdihdl.h:305
#define SetLastError(x)
Definition: compat.h:409
#define DIRTY_FILL
Definition: ntgdihdl.h:145
HDC hdc
Definition: main.c:9
ULONG ulBrushClr
Definition: ntgdihdl.h:306

Referenced by init_function_pointers(), IntDrawDiagEdge(), SetSpecialDCState(), SetSpecialDCState2(), and Test_NtGdiDoPalette_SetDIBColorTable().

◆ SetDCPenColor()

COLORREF WINAPI SetDCPenColor ( _In_ HDC  hdc,
_In_ COLORREF  crColor 
)

Definition at line 917 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define CLR_INVALID
Definition: wingdi.h:882
COLORREF crPenClr
Definition: ntgdihdl.h:307
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
DWORD COLORREF
Definition: windef.h:285
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
ULONG ulPenClr
Definition: ntgdihdl.h:308
unsigned int ULONG
Definition: retypes.h:1
#define DIRTY_LINE
Definition: ntgdihdl.h:146
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:917

Referenced by Child_OnPaint(), init_function_pointers(), IntDrawDiagEdge(), MyIntDrawRectEdge(), PB_Paint(), SetSpecialDCState(), SetSpecialDCState2(), Test_CreateCompatibleDC(), Test_NtGdiDoPalette_SetDIBColorTable(), and Test_SetDCPenColor().

◆ SetGraphicsMode()

int WINAPI SetGraphicsMode ( _In_ HDC  hdc,
_In_ int  iMode 
)

Definition at line 1202 of file dc.c.

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;
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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
_In_ ULONG iMode
Definition: winddi.h:3520
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:471
#define SetLastError(x)
Definition: compat.h:409
#define GM_COMPATIBLE
Definition: wingdi.h:863
HDC hdc
Definition: main.c:9
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:166
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define GM_ADVANCED
Definition: wingdi.h:864
INT iGraphicsMode
Definition: ntgdihdl.h:310

Referenced by DoTestEntry(), EnumEnhMetaFile(), gdi_transform_acquire(), METAFILE_PlaybackUpdateGdiTransform(), PlayEnhMetaFileRecord(), SetSpecialDCState(), SetSpecialDCState2(), START_TEST(), test_ellipse(), test_emf_BitBlt(), test_emf_WorldTransform(), test_ExtTextOutScale(), test_GetCharABCWidths(), test_GetCharWidth32(), test_gettransform(), test_modify_world_transform(), test_outline_font(), Test_PaintRgn(), Test_Rectangle(), test_rectangle(), test_roundrect(), Test_SetWorldTransform(), and test_world_transform().

◆ SetPolyFillMode()

int WINAPI SetPolyFillMode ( _In_ HDC  hdc,
_In_ int  iPolyFillMode 
)

Definition at line 1143 of file dc.c.

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;
1166  }
1167  }
1168 
1169  iOldPolyFillMode = pdcattr->lFillMode;
1170  pdcattr->lFillMode = iPolyFillMode;
1171 
1172  return iOldPolyFillMode;
1173 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
LONG lFillMode
Definition: ntgdihdl.h:318
int32_t INT
Definition: typedefs.h:56
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:471
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:166
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
int WINAPI SetPolyFillMode(_In_ HDC hdc, _In_ int iPolyFillMode)
Definition: dc.c:1143

Referenced by RdpClientUI::Display_Polygon(), EnumEnhMetaFile(), GDI32_GdipFillPath(), get_path_hrgn(), InitColorButtons(), PlayEnhMetaFileRecord(), PlayMetaFileRecord(), PolygonTest(), test_ExtTextOut(), test_mf_SaveDC(), test_SaveDC(), and TRACKBAR_FillThumb().

◆ SetRelAbs()

INT WINAPI SetRelAbs ( HDC  hdc,
INT  Mode 
)

Definition at line 722 of file dc.c.

725 {
726  return GetAndSetDCDWord(hdc, GdiGetSetRelAbs, Mode, 0, 0, 0);
727 }
_In_ ULONG Mode
Definition: hubbusif.h:303
HDC hdc
Definition: main.c:9
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

Referenced by init_function_pointers(), and PlayMetaFileRecord().

◆ SetROP2()

int WINAPI SetROP2 ( _In_ HDC  hdc,
_In_ int  rop2 
)

Definition at line 1083 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
int32_t INT
Definition: typedefs.h:56
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
smooth NULL
Definition: ftsmooth.c:416
ULONG ulDirty_
Definition: ntgdihdl.h:298
__kernel_entry W32KAPI NTSTATUS APIENTRY NtGdiFlush(VOID)
Definition: gdibatch.c:471
BYTE jROP2
Definition: ntgdihdl.h:311
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
#define DC_MODE_DIRTY
Definition: ntgdihdl.h:166
unsigned char BYTE
Definition: mem.h:68
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
int WINAPI SetROP2(_In_ HDC hdc, _In_ int rop2)
Definition: dc.c:1083

Referenced by RdpClientUI::Display_Line(), draw_graphics(), CImgAreaWindow::drawZoomFrame(), EnumEnhMetaFile(), PlayEnhMetaFileRecord(), PlayMetaFileRecord(), Poly(), RectSel(), test_dc_attributes(), test_destroyed_window(), and test_ExtTextOut().

◆ SetStretchBltMode()

int WINAPI SetStretchBltMode ( _In_ HDC  hdc,
_In_ int  iStretchMode 
)

Definition at line 1324 of file dc.c.

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 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BYTE jStretchBltMode
Definition: ntgdihdl.h:314
FORCEINLINE PDC_ATTR GdiGetDcAttr(HDC hdc)
Definition: gdi32p.h:451
#define MAXSTRETCHBLTMODE
Definition: wingdi.h:955
int WINAPI SetStretchBltMode(_In_ HDC hdc, _In_ int iStretchMode)
Definition: dc.c:1324
int32_t INT
Definition: typedefs.h:56
#define HANDLE_METADC(_RetType, _Func, dwError, hdc,...)
Definition: gdi32p.h:616
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:409
HDC hdc
Definition: main.c:9
LONG lStretchBltMode
Definition: ntgdihdl.h:319
#define WHITEONBLACK
Definition: wingdi.h:952

Referenced by DrawBackgroundPreview(), EnumEnhMetaFile(), MainWndProc(), PlayEnhMetaFileRecord(), PlayMetaFileRecord(), test_ExtTextOut(), UXTHEME_StretchBlt(), and WinGStretchBlt().