- Make brush structure definition C++ compatible
- Add delete callback for GDI objects and use if for brushes.
- Make IntGdiSetSolidBrushColor NTAPI instead of FASTCALL

svn path=/trunk/; revision=66891
This commit is contained in:
Timo Kreuzer 2015-03-25 22:32:48 +00:00
parent 20d7540340
commit 0f8766d749
4 changed files with 93 additions and 20 deletions

View file

@ -154,6 +154,16 @@ BRUSH_vCleanup(PVOID ObjectBody)
}
}
VOID
NTAPI
BRUSH_vDeleteObject(
PVOID pvObject)
{
BRUSH_vCleanup(pvObject);
ExFreePoolWithTag(pvObject, GDITAG_HMGR_BRUSH_TYPE);
}
INT
FASTCALL
BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush)
@ -385,7 +395,7 @@ IntGdiCreateNullBrush(VOID)
}
VOID
FASTCALL
NTAPI
IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color)
{
PBRUSH pbrush;

View file

@ -11,12 +11,8 @@
* DON'T MODIFY THIS STRUCTURE UNLESS REALLY NEEDED AND EVEN THEN ASK ON
* A MAILING LIST FIRST.
*/
typedef struct _BRUSH
typedef struct _BRUSHBODY
{
/* Header for all gdi objects in the handle table.
Do not (re)move this. */
BASEOBJECT BaseObject;
ULONG iHatch; // This is not the brush style, but the hatch style!
HBITMAP hbmPattern;
HBITMAP hbmClient;
@ -34,6 +30,8 @@ typedef struct _BRUSH
PVOID pvRBrush;
HDEV hdev;
//DWORD unk054;
/* The following members are for PENs only */
LONG lWidth;
FLOAT eWidth;
ULONG ulPenStyle;
@ -47,7 +45,21 @@ typedef struct _BRUSH
//DWORD unk078; // 0x078
DWORD unk07c; // 0x07c
LIST_ENTRY ListHead; // 0x080
} BRUSHBODY;
#ifndef __cplusplus
typedef struct _BRUSH
{
/* Header for all gdi objects in the handle table.
Do not (re)move this. */
BASEOBJECT BaseObject;
BRUSHBODY;
} BRUSH, *PBRUSH;
#else
class BRUSH;
typedef class BRUSH *PBRUSH;
#endif
typedef struct _EBRUSHOBJ
{
@ -68,7 +80,7 @@ typedef struct _EBRUSHOBJ
struct _PALETTE * ppalDC;
struct _PALETTE * ppalDIB;
// DWORD dwUnknown44;
BRUSH * pbrush;
PBRUSH pbrush;
FLONG flattrs;
DWORD ulUnique;
// DWORD dwUnknown54;
@ -109,8 +121,8 @@ BRUSH_GetObject(
VOID
NTAPI
BRUSH_vCleanup(
PVOID ObjectBody);
BRUSH_vDeleteObject(
PVOID pvObject);
extern HSURF gahsurfHatch[HS_DDI_MAX];
@ -188,5 +200,8 @@ IntGdiCreateSolidBrush(
HBRUSH APIENTRY
IntGdiCreateNullBrush(VOID);
VOID FASTCALL
IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color);
VOID
NTAPI
IntGdiSetSolidBrushColor(
_In_ HBRUSH hbr,
_In_ COLORREF crColor);

View file

@ -159,7 +159,7 @@ apfnCleanup[] =
NULL, /* 0d GDIObjType_PFT_TYPE, unused */
GDIOBJ_vCleanup, /* 0e GDIObjType_ICMCXF_TYPE */
NULL, /* 0f GDIObjType_SPRITE_TYPE, unused */
BRUSH_vCleanup, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */
NULL, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */
NULL, /* 11 GDIObjType_UMPD_TYPE, unused */
NULL, /* 12 GDIObjType_UNUSED4_TYPE */
NULL, /* 13 GDIObjType_SPACE_TYPE, unused */
@ -177,6 +177,44 @@ apfnCleanup[] =
NULL, /* 1f reserved entry */
};
static const
GDIOBJDELETEPROC
apfnDelete[] =
{
NULL, /* 00 GDIObjType_DEF_TYPE */
NULL, /* 01 GDIObjType_DC_TYPE */
NULL, /* 02 GDIObjType_UNUSED1_TYPE */
NULL, /* 03 GDIObjType_UNUSED2_TYPE */
NULL, /* 04 GDIObjType_RGN_TYPE */
NULL, /* 05 GDIObjType_SURF_TYPE */
NULL, /* 06 GDIObjType_CLIENTOBJ_TYPE */
NULL, /* 07 GDIObjType_PATH_TYPE */
NULL, /* 08 GDIObjType_PAL_TYPE */
NULL, /* 09 GDIObjType_ICMLCS_TYPE */
NULL, /* 0a GDIObjType_LFONT_TYPE */
NULL, /* 0b GDIObjType_RFONT_TYPE, unused */
NULL, /* 0c GDIObjType_PFE_TYPE, unused */
NULL, /* 0d GDIObjType_PFT_TYPE, unused */
NULL, /* 0e GDIObjType_ICMCXF_TYPE */
NULL, /* 0f GDIObjType_SPRITE_TYPE, unused */
BRUSH_vDeleteObject, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */
NULL, /* 11 GDIObjType_UMPD_TYPE, unused */
NULL, /* 12 GDIObjType_UNUSED4_TYPE */
NULL, /* 13 GDIObjType_SPACE_TYPE, unused */
NULL, /* 14 GDIObjType_UNUSED5_TYPE */
NULL, /* 15 GDIObjType_META_TYPE, unused */
NULL, /* 16 GDIObjType_EFSTATE_TYPE, unused */
NULL, /* 17 GDIObjType_BMFD_TYPE, unused */
NULL, /* 18 GDIObjType_VTFD_TYPE, unused */
NULL, /* 19 GDIObjType_TTFD_TYPE, unused */
NULL, /* 1a GDIObjType_RC_TYPE, unused */
NULL, /* 1b GDIObjType_TEMP_TYPE, unused */
NULL, /* 1c GDIObjType_DRVOBJ_TYPE */
NULL, /* 1d GDIObjType_DCIOBJ_TYPE, unused */
NULL, /* 1e GDIObjType_SPOOL_TYPE, unused */
NULL, /* 1f reserved entry */
};
/* INTERNAL FUNCTIONS ********************************************************/
static
@ -547,8 +585,16 @@ GDIOBJ_vFreeObject(POBJ pobj)
/* Get the object type */
objt = ((ULONG_PTR)pobj->hHmgr >> 16) & 0x1f;
/* Check if we have a delete procedure (for C++ based objects) */
if (apfnDelete[objt] != NULL)
{
/* Invoke the delete procedure */
apfnDelete[objt](pobj);
}
else
{
/* Call the cleanup procedure */
ASSERT(apfnCleanup[objt]);
NT_ASSERT(apfnCleanup[objt]);
apfnCleanup[objt](pobj);
/* Check if the object is allocated from a lookaside list */
@ -561,6 +607,7 @@ GDIOBJ_vFreeObject(POBJ pobj)
ExFreePoolWithTag(pobj, GDIOBJ_POOL_TAG(objt));
}
}
}
VOID
NTAPI

View file

@ -31,6 +31,7 @@ extern PGDI_HANDLE_TABLE GdiHandleTable;
typedef PVOID PGDIOBJ;
typedef VOID (NTAPI *GDICLEANUPPROC)(PVOID ObjectBody);
typedef VOID (NTAPI *GDIOBJDELETEPROC)(PVOID ObjectBody);
/* Every GDI Object must have this standard type of header.
* It's for thread locking. */