mirror of
https://github.com/reactos/reactos.git
synced 2025-05-20 01:24:11 +00:00
[WIN32K]
- Move IntGdiSetBrushOwner to brush.c - Move IntGdiSetDCOwnerEx to dclife.c - Move IntGdiSetRegionOwner to region.c svn path=/trunk/; revision=51191
This commit is contained in:
parent
e78589d99a
commit
d7e597d60e
4 changed files with 120 additions and 121 deletions
|
@ -573,4 +573,53 @@ NtGdiSetBrushOrg(HDC hDC, INT XOrg, INT YOrg, LPPOINT Point)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
FASTCALL
|
||||||
|
IntGdiSetBrushOwner(PBRUSH pbr, DWORD OwnerMask)
|
||||||
|
{
|
||||||
|
HBRUSH hBR;
|
||||||
|
PEPROCESS Owner = NULL;
|
||||||
|
PGDI_TABLE_ENTRY pEntry = NULL;
|
||||||
|
|
||||||
|
if (!pbr) return FALSE;
|
||||||
|
|
||||||
|
hBR = pbr->BaseObject.hHmgr;
|
||||||
|
|
||||||
|
if (!hBR || (GDI_HANDLE_GET_TYPE(hBR) != GDI_OBJECT_TYPE_BRUSH))
|
||||||
|
return FALSE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INT Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)hBR);
|
||||||
|
pEntry = &GdiHandleTable->Entries[Index];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pbr->flAttrs & GDIBRUSH_IS_GLOBAL)
|
||||||
|
{
|
||||||
|
GDIOBJ_ShareUnlockObjByPtr((POBJ)pbr);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE)
|
||||||
|
{
|
||||||
|
// Set this Brush to inaccessible mode and to an Owner of NONE.
|
||||||
|
// if (OwnerMask == GDI_OBJ_HMGR_NONE) Owner = OwnerMask;
|
||||||
|
|
||||||
|
if (!GDIOBJ_SetOwnership((HGDIOBJ) hBR, Owner))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// Deny user access to User Data.
|
||||||
|
pEntry->UserData = NULL; // This hBR is inaccessible!
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OwnerMask == GDI_OBJ_HMGR_POWNED)
|
||||||
|
{
|
||||||
|
if (!GDIOBJ_SetOwnership((HGDIOBJ) hBR, PsGetCurrentProcess() ))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
// Allow user access to User Data.
|
||||||
|
pEntry->UserData = pbr->pBrushAttr;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -973,3 +973,45 @@ IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC)
|
||||||
return hDC;
|
return hDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
FASTCALL
|
||||||
|
IntGdiSetDCOwnerEx( HDC hDC, DWORD OwnerMask, BOOL NoSetBrush)
|
||||||
|
{
|
||||||
|
PDC pDC;
|
||||||
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
|
if (!hDC || (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)) return FALSE;
|
||||||
|
|
||||||
|
if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE)
|
||||||
|
{
|
||||||
|
pDC = DC_LockDc ( hDC );
|
||||||
|
MmCopyFromCaller(&pDC->dcattr, pDC->pdcattr, sizeof(DC_ATTR));
|
||||||
|
DC_vFreeDcAttr(pDC);
|
||||||
|
DC_UnlockDc( pDC );
|
||||||
|
|
||||||
|
if (!DC_SetOwnership( hDC, NULL )) // This hDC is inaccessible!
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OwnerMask == GDI_OBJ_HMGR_POWNED)
|
||||||
|
{
|
||||||
|
pDC = DC_LockDc ( hDC );
|
||||||
|
ASSERT(pDC->pdcattr == &pDC->dcattr);
|
||||||
|
DC_UnlockDc( pDC );
|
||||||
|
|
||||||
|
if (!DC_SetOwnership( hDC, PsGetCurrentProcess() )) return Ret;
|
||||||
|
|
||||||
|
DC_AllocateDcAttr( hDC ); // Allocate new dcattr
|
||||||
|
|
||||||
|
DCU_SynchDcAttrtoUser( hDC ); // Copy data from dc to dcattr
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((OwnerMask != GDI_OBJ_HMGR_NONE) && !NoSetBrush)
|
||||||
|
{
|
||||||
|
pDC = DC_LockDc ( hDC );
|
||||||
|
if (IntGdiSetBrushOwner((PBRUSH)pDC->dclevel.pbrFill, OwnerMask))
|
||||||
|
IntGdiSetBrushOwner((PBRUSH)pDC->dclevel.pbrLine, OwnerMask);
|
||||||
|
DC_UnlockDc( pDC );
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -1726,126 +1726,6 @@ GDIOBJ_LockMultipleObjs(ULONG ulCount,
|
||||||
|
|
||||||
/** PUBLIC FUNCTIONS **********************************************************/
|
/** PUBLIC FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
BOOL
|
|
||||||
FASTCALL
|
|
||||||
IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
|
|
||||||
{
|
|
||||||
INT Index;
|
|
||||||
PGDI_TABLE_ENTRY Entry;
|
|
||||||
/*
|
|
||||||
System Regions:
|
|
||||||
These regions do not use attribute sections and when allocated, use gdiobj
|
|
||||||
level functions.
|
|
||||||
*/
|
|
||||||
// FIXME! HAX!!! Remove this once we get everything right!
|
|
||||||
Index = GDI_HANDLE_GET_INDEX(hRgn);
|
|
||||||
Entry = &GdiHandleTable->Entries[Index];
|
|
||||||
if (Entry->UserData) FreeObjectAttr(Entry->UserData);
|
|
||||||
Entry->UserData = NULL;
|
|
||||||
//
|
|
||||||
if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE)
|
|
||||||
{
|
|
||||||
return GDIOBJ_SetOwnership(hRgn, NULL);
|
|
||||||
}
|
|
||||||
if (OwnerMask == GDI_OBJ_HMGR_POWNED)
|
|
||||||
{
|
|
||||||
return GDIOBJ_SetOwnership((HGDIOBJ) hRgn, PsGetCurrentProcess() );
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
FASTCALL
|
|
||||||
IntGdiSetBrushOwner(PBRUSH pbr, DWORD OwnerMask)
|
|
||||||
{
|
|
||||||
HBRUSH hBR;
|
|
||||||
PEPROCESS Owner = NULL;
|
|
||||||
PGDI_TABLE_ENTRY pEntry = NULL;
|
|
||||||
|
|
||||||
if (!pbr) return FALSE;
|
|
||||||
|
|
||||||
hBR = pbr->BaseObject.hHmgr;
|
|
||||||
|
|
||||||
if (!hBR || (GDI_HANDLE_GET_TYPE(hBR) != GDI_OBJECT_TYPE_BRUSH))
|
|
||||||
return FALSE;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
INT Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)hBR);
|
|
||||||
pEntry = &GdiHandleTable->Entries[Index];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pbr->flAttrs & GDIBRUSH_IS_GLOBAL)
|
|
||||||
{
|
|
||||||
GDIOBJ_ShareUnlockObjByPtr((POBJ)pbr);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE)
|
|
||||||
{
|
|
||||||
// Set this Brush to inaccessible mode and to an Owner of NONE.
|
|
||||||
// if (OwnerMask == GDI_OBJ_HMGR_NONE) Owner = OwnerMask;
|
|
||||||
|
|
||||||
if (!GDIOBJ_SetOwnership((HGDIOBJ) hBR, Owner))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
// Deny user access to User Data.
|
|
||||||
pEntry->UserData = NULL; // This hBR is inaccessible!
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OwnerMask == GDI_OBJ_HMGR_POWNED)
|
|
||||||
{
|
|
||||||
if (!GDIOBJ_SetOwnership((HGDIOBJ) hBR, PsGetCurrentProcess() ))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
// Allow user access to User Data.
|
|
||||||
pEntry->UserData = pbr->pBrushAttr;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
FASTCALL
|
|
||||||
IntGdiSetDCOwnerEx( HDC hDC, DWORD OwnerMask, BOOL NoSetBrush)
|
|
||||||
{
|
|
||||||
PDC pDC;
|
|
||||||
BOOL Ret = FALSE;
|
|
||||||
|
|
||||||
if (!hDC || (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)) return FALSE;
|
|
||||||
|
|
||||||
if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE)
|
|
||||||
{
|
|
||||||
pDC = DC_LockDc ( hDC );
|
|
||||||
MmCopyFromCaller(&pDC->dcattr, pDC->pdcattr, sizeof(DC_ATTR));
|
|
||||||
DC_vFreeDcAttr(pDC);
|
|
||||||
DC_UnlockDc( pDC );
|
|
||||||
|
|
||||||
if (!DC_SetOwnership( hDC, NULL )) // This hDC is inaccessible!
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OwnerMask == GDI_OBJ_HMGR_POWNED)
|
|
||||||
{
|
|
||||||
pDC = DC_LockDc ( hDC );
|
|
||||||
ASSERT(pDC->pdcattr == &pDC->dcattr);
|
|
||||||
DC_UnlockDc( pDC );
|
|
||||||
|
|
||||||
if (!DC_SetOwnership( hDC, PsGetCurrentProcess() )) return Ret;
|
|
||||||
|
|
||||||
DC_AllocateDcAttr( hDC ); // Allocate new dcattr
|
|
||||||
|
|
||||||
DCU_SynchDcAttrtoUser( hDC ); // Copy data from dc to dcattr
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((OwnerMask != GDI_OBJ_HMGR_NONE) && !NoSetBrush)
|
|
||||||
{
|
|
||||||
pDC = DC_LockDc ( hDC );
|
|
||||||
if (IntGdiSetBrushOwner((PBRUSH)pDC->dclevel.pbrFill, OwnerMask))
|
|
||||||
IntGdiSetBrushOwner((PBRUSH)pDC->dclevel.pbrLine, OwnerMask);
|
|
||||||
DC_UnlockDc( pDC );
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
INT
|
INT
|
||||||
FASTCALL
|
FASTCALL
|
||||||
GreGetObjectOwner(HGDIOBJ Handle, GDIOBJTYPE ObjType)
|
GreGetObjectOwner(HGDIOBJ Handle, GDIOBJTYPE ObjType)
|
||||||
|
|
|
@ -3942,4 +3942,32 @@ NtGdiGetRegionData(
|
||||||
return size + sizeof(RGNDATAHEADER);
|
return size + sizeof(RGNDATAHEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
FASTCALL
|
||||||
|
IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
|
||||||
|
{
|
||||||
|
INT Index;
|
||||||
|
PGDI_TABLE_ENTRY Entry;
|
||||||
|
/*
|
||||||
|
System Regions:
|
||||||
|
These regions do not use attribute sections and when allocated, use gdiobj
|
||||||
|
level functions.
|
||||||
|
*/
|
||||||
|
// FIXME! HAX!!! Remove this once we get everything right!
|
||||||
|
Index = GDI_HANDLE_GET_INDEX(hRgn);
|
||||||
|
Entry = &GdiHandleTable->Entries[Index];
|
||||||
|
if (Entry->UserData) FreeObjectAttr(Entry->UserData);
|
||||||
|
Entry->UserData = NULL;
|
||||||
|
//
|
||||||
|
if ((OwnerMask == GDI_OBJ_HMGR_PUBLIC) || OwnerMask == GDI_OBJ_HMGR_NONE)
|
||||||
|
{
|
||||||
|
return GDIOBJ_SetOwnership(hRgn, NULL);
|
||||||
|
}
|
||||||
|
if (OwnerMask == GDI_OBJ_HMGR_POWNED)
|
||||||
|
{
|
||||||
|
return GDIOBJ_SetOwnership((HGDIOBJ) hRgn, PsGetCurrentProcess() );
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue