[Win32SS|GDI] Implement seldom used API and update types for local DC's.

Two working in house application require these API. Known as FolCOL and Reach.
This commit is contained in:
James Tabor 2021-09-25 11:57:26 -05:00
parent a602bc3550
commit 970344bd16
8 changed files with 150 additions and 98 deletions

View file

@ -543,7 +543,13 @@ NtGdiSetBrushAttributes(
_In_ HBRUSH hbr,
_In_ DWORD dwFlags)
{
FIXME("NtGdiSetBrushAttributes is unimplemented\n");
if ( dwFlags & SC_BB_STOCKOBJ )
{
if (GDIOBJ_ConvertToStockObj((HGDIOBJ*)&hbr))
{
return hbr;
}
}
return NULL;
}
@ -554,7 +560,13 @@ NtGdiClearBrushAttributes(
_In_ HBRUSH hbr,
_In_ DWORD dwFlags)
{
FIXME("NtGdiClearBrushAttributes is unimplemented\n");
if ( dwFlags & SC_BB_STOCKOBJ )
{
if (GDIOBJ_ConvertFromStockObj((HGDIOBJ*)&hbr))
{
return hbr;
}
}
return NULL;
}

View file

@ -1484,6 +1484,40 @@ GDIOBJ_ConvertToStockObj(HGDIOBJ *phObj)
return TRUE;
}
BOOL
NTAPI
GDIOBJ_ConvertFromStockObj(HGDIOBJ *phObj)
{
PENTRY pentry;
POBJ pobj;
/* Reference the handle entry */
pentry = ENTRY_ReferenceEntryByHandle(*phObj, 0);
if (!pentry)
{
DPRINT1("GDIOBJ: Requested handle 0x%p is not valid.\n", *phObj);
return FALSE;
}
/* Update the entry */
pentry->FullUnique &= ~GDI_ENTRY_STOCK_MASK;
pentry->ObjectOwner.ulObj = 0;
/* Get the pointer to the BASEOBJECT */
pobj = pentry->einfo.pobj;
/* Calculate the new handle */
pobj->hHmgr = (HGDIOBJ)((ULONG_PTR)pobj->hHmgr & ~GDI_HANDLE_STOCK_MASK);
/* Return the new handle */
*phObj = pobj->hHmgr;
/* Dereference the handle */
GDIOBJ_vDereferenceObject(pobj);
return TRUE;
}
POBJ NTAPI
GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
{

View file

@ -195,6 +195,7 @@ GDIOBJ_pvGetObjectAttr(
POBJ pobj);
BOOL NTAPI GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj);
BOOL NTAPI GDIOBJ_ConvertFromStockObj(HGDIOBJ *phObj);
POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize);
PGDIOBJ NTAPI GDIOBJ_ShareLockObj(HGDIOBJ hObj, DWORD ObjectType);
PVOID NTAPI GDI_MapHandleTable(PEPROCESS Process);