Techwiki:Win32k/SURFACE

From ReactOS Wiki
Jump to: navigation, search

SURFOBJ

typedef struct _SURFOBJ
{
    DHSURF dhsurf;           // 0x000 
    HSURF  hsurf;            // 0x004 
    DHPDEV dhpdev;           // 0x008 
    HDEV   hdev;             // 0x00c
    SIZEL  sizlBitmap;       // 0x010 
    ULONG  cjBits;           // 0x018 
    PVOID  pvBits;           // 0x01c 
    PVOID  pvScan0;          // 0x020 
    LONG   lDelta;           // 0x024 
    ULONG  iUniq;            // 0x028 
    ULONG  iBitmapFormat;    // 0x02c 
    USHORT iType;            // 0x030 
    USHORT fjBitmap;         // 0x032 
  // size                       0x034
} SURFOBJ, *PSURFOBJ;

dhsurf

Driver specific handle to the surface.

hsurf

GDI handle to the surface.

dhpdev

Driver specific handle to the physical device, that this surface belongs to.

hdev

GDI's handle to the device, this surface belongs to. In reality a pointer to GDI's PDEVOBJ.

iBitmapFormat

Format of the surface. One of BMF_1BPP, BMF_4BPP, BMF_8BPP, BMF_16BPP, BMF_24BPP, BMF_32BPP, BMF_4RLE 4, BMF_8RLE,

BMF_JPEG, BMF_PNG

iType

#define STYPE_BITMAP     0 /* DIBSECTION */
#define STYPE_DEVICE     1
#define STYPE_DEVBITMAP  3

fjBitmap

#define BMF_TOPDOWN    0x01
#define BMF_NOZEROINIT 0x02
#define BMF_DONTCACHE  0x04
#define BMF_USERMEM    0x08
#define BMF_KMSECTION  0x10
#define BMF_NOTSYSMEM  0x20
#define BMF_WINDOW_BLT 0x40

SURFACE

typedef struct _SURFACE
{                            // Win XP
    BASEOBJECT BaseObject;   // 0x000
    SURFOBJ    surfobj;      // 0x010
    XDCOBJ *   pdcoAA;       // 0x044
    FLONG      flags;        // 0x048
    PPALETTE   ppal;         // 0x04c verified, palette with kernel handle, index 13
    WNDOBJ     *pWinObj;     // 0x050 NtGdiEndPage->GreDeleteWnd
    union                    // 0x054
    {
        HANDLE hSecureUMPD;  // if UMPD_SURFACE set
        HANDLE hMirrorParent;// if MIRROR_SURFACE set
        HANDLE hDDSurface;   // if DIRECTDRAW_SURFACE set
    };
    SIZEL      sizlDim;      // 0x058
    HDC        hdc;          // 0x060 verified
    ULONG      cRef;         // 0x064
    HPALETTE   hpalHint;     // 0x068 
    HANDLE     hDIBSection;  // 0x06c for DIB sections
    HANDLE     hSecure;      // 0x070
    DWORD      dwOffset;     // 0x074
    UINT       unk_078;      // 0x078
 // ... ?
} SURFACE, *PSURFACE; // static unsigned long SURFACE::tSize == 0x7C, sometimes 0xBC


flags

#define HOOK_BITBLT               0x00000001
#define HOOK_STRETCHBLT           0x00000002
#define HOOK_PLGBLT               0x00000004
#define HOOK_TEXTOUT              0x00000008
#define HOOK_PAINT                0x00000010
#define HOOK_STROKEPATH           0x00000020
#define HOOK_FILLPATH             0x00000040
#define HOOK_STROKEANDFILLPATH    0x00000080
#define HOOK_LINETO               0x00000100
#define SHAREACCESS_SURFACE       0x00000200
#define HOOK_COPYBITS             0x00000400
#define REDIRECTION_SURFACE       0x00000800 // ?
#define HOOK_MOVEPANNING          0x00000800
#define HOOK_SYNCHRONIZE          0x00001000
#define HOOK_STRETCHBLTROP        0x00002000
#define HOOK_SYNCHRONIZEACCESS    0x00004000
#define USE_DEVLOCK_SURFACE       0x00004000
#define HOOK_TRANSPARENTBLT       0x00008000
#define HOOK_ALPHABLEND           0x00010000
#define HOOK_GRADIENTFILL         0x00020000
#if (NTDDI_VERSION < 0x06000000)
 #define HOOK_FLAGS               0x0003B5FF
#else
 #define HOOK_FLAGS               0x0003B5EF
#endif

#define UMPD_SURFACE              0x00040000
#define MIRROR_SURFACE            0x00080000
#define DIRECTDRAW_SURFACE        0x00100000
#define DRIVER_CREATED_SURFACE    0x00200000
#define ENG_CREATE_DEVICE_SURFACE 0x00400000
#define DDB_SURFACE               0x00800000
#define LAZY_DELETE_SURFACE       0x01000000
#define BANDING_SURFACE           0x02000000
#define API_BITMAP                0x04000000
#define PALETTE_SELECT_SET        0x08000000
#define UNREADABLE_SURFACE        0x10000000
#define DYNAMIC_MODE_PALETTE      0x20000000
#define ABORT_SURFACE             0x40000000
#define PDEV_SURFACE              0x80000000

ppal

Pointer to a PALETTE structure. This is NULL for normal bitmaps, but set for DIB sections.

hdc

If the surface is an api bitmap, this is the DC it was selected into. Otherwise screen DC (verify me).

hpalHint

Directly after SelectPalette this is hPalette

hDIBSection

If the surface is a DIB section that was created using a section, this is a handle to the section containing the bits.

hSecure

DIB sections: Handle from Mm/EngSecureVirtualMemory.

References