Techwiki:Win32k/DC ATTR

From ReactOS Wiki
Jump to: navigation, search

The attribute belonging to the corresponding DC structure. Except for system DCs, one instance is kept in usermode memory.

typedef struct _RGNATTR
    ULONG AttrFlags;
    ULONG Flags;
    RECTL Rect;
// Windows NT 4.0: 0x190 bytes
// Windows 2000  : 0x1C8 bytes
// Windows XP    : 0x1d0 bytes
//                                   Win2000   WinXP 
typedef struct
  PVOID       pvLDC;                 // 000     000
  ULONG       ulDirty;               // 004     004
  HBRUSH      hbrush;                // 008     008
  HPEN        hpen;                  // 00c     00c

  COLORREF    crBackgroundClr;       // 010     010
  ULONG       ulBackgroundClr;       // 014     014
  COLORREF    crForegroundClr;       // 018     018
  ULONG       ulForegroundClr;       // 01c     01c

#if (_WIN32_WINNT >= 0x0500)
  COLORREF    crBrushClr;            // 020     020  Orig, etc Set
  ULONG       ulBrushClr;            // 024     024  GetDCBrushColor
  COLORREF    crPenClr;              // 028     028  Orig, etc Set
  ULONG       ulPenClr;              // 02c     02c  GetDCPenColor

  DWORD       iCS_CP;                // 030     030
  INT         iGraphicsMode;
  BYTE        jROP2;                 // 038
  BYTE        jBkMode;
  BYTE        jFillMode;
  BYTE        jStretchBltMode;

  POINTL      ptlCurrent;            // 03C
  POINTFX     ptfxCurrent;           // 044
  LONG        lBkMode;               // 04C

  LONG        lFillMode;             // 050
  LONG        lStretchBltMode;

#if (_WIN32_WINNT >= 0x0500)
  LONG        flFontMapper;          // 058
  LONG        lIcmMode;
  HGDIOBJ     hcmXform;              // 060
  HCOLORSPACE hColorSpace;
  FLONG       flIcmFlags;            // 068
  INT         IcmBrushColor;
  INT         IcmPenColor;           // 070
  PVOID       pvLIcm;                // 074     074

  FLONG       flTextAlign;           // 078
  LONG        lTextAlign;
  LONG        lTextExtra;            // 080
  LONG        lRelAbs;
  LONG        lBreakExtra;
  LONG        cBreak;

  HFONT       hlfntNew;              // 090
  MATRIX      mxWorldToDevice;       // 094
  MATRIX      mxDeviceToWorld;       // 0D0
  MATRIX      mxWorldToPage;         // 10C

  EFLOAT      efM11PtoD;             // 148
  EFLOAT      efM22PtoD;             // 150
  EFLOAT      efDxPtoD;              // 158
  EFLOAT      efDyPtoD;              // 160

  INT         iMapMode;              // 168

#if (_WIN32_WINNT >= 0x0500)
  DWORD       dwLayout;              // 16c
  LONG        lWindowOrgx;           // 170     170
  POINTL      ptlWindowOrg;          // 174
  SIZEL       szlWindowExt;          // 17c
  POINTL      ptlViewportOrg;        // 184
  SIZEL       szlViewportExt;        // 18c

  FLONG       flXform;               // 194
  SIZEL       szlVirtualDevicePixel; // 198     198
  SIZEL       szlVirtualDeviceMm;    // 1a0     1a0
#if (_WIN32_WINNT >= 0x0501)
  SIZEL       szlVirtualDeviceSize;  // -       1a8
  POINT       ptlBrushOrigin;        // 1a8     1b0
  RGNATTR     VisRectRegion;         // 1b0     1b8



#define DIRTY_FILL 0x01
#define DIRTY_LINE 0x02
#define DIRTY_TEXT 0x04
#define DIRTY_CHARSET 0x10
#define SLOW_WIDTHS 0x20
#define DC_CACHED_TM_VALID  0x40
#define DISPLAY_DC 0x80
#define DIRTY_PTLCURRENT 0x100
#define DIRTY_STYLESTATE 0x400
#define DC_PLAYMETAFILE 0x800
#define DC_BRUSH_DIRTY 0x1000
#define DC_PEN_DIRTY 0x2000
#define DC_DIBSECTION 0x4000
#define DC_LAST_CLIPRGN_VALID 0x8000
#define DC_PRIMARY_DISPLAY  0x10000
#define DIRTY_????  0x20000 // Get's set when a saved dc state is restored


The handle to the currently selected brush. It is initialized with the BLACK_BRUSH stock object.


The handle to the currently selected pen. It is initialized with the BLACK_PEN stock object.


The color that is used for a (virtual) solid brush, if hpen is equal to GetstockObject(DC_PEN).
Todo: find out the difference to ulPenColor and what happens on a win32k call when they are different.


The text align mode, RtoL corrected and with invalid flags masked off by SetTextAlign()


This is the unmodified text align mode as it is passed to SetTextAlign() in gdi32.


Can be a combination of zhe following flags:
#define METAFILE_TO_WORLD_IDENTITY          0x00000001
#define WORLD_TO_PAGE_IDENTITY              0x00000002
#define DEVICE_TO_PAGE_INVALID              0x00000008
#define DEVICE_TO_WORLD_INVALID             0x00000010
#define WORLD_TRANSFORM_SET                 0x00000020
#define POSITIVE_Y_IS_UP                    0x00000040
#define INVALIDATE_ATTRIBUTES               0x00000080
#define PTOD_EFM11_NEGATIVE                 0x00000100
#define PTOD_EFM22_NEGATIVE                 0x00000200
#define ISO_OR_ANISO_MAP_MODE               0x00000400
#define PAGE_TO_DEVICE_IDENTITY             0x00000800
#define PAGE_TO_DEVICE_SCALE_IDENTITY       0x00001000
#define PAGE_XLATE_CHANGED                  0x00002000
#define PAGE_EXTENTS_CHANGED                0x00004000
#define WORLD_XFORM_CHANGED                 0x00008000


  • The fields in the kernel mode structure of the DC keep the initial value.


  • DC_ATTR from Yuan, updated info provided by xTeam
  • WinDbg's gdikdx + mem dumps