diff --git a/reactos/subsystems/win32/win32k/include/brush.h b/reactos/subsystems/win32/win32k/include/brush.h index db7c5fbf082..2c114d04fb1 100644 --- a/reactos/subsystems/win32/win32k/include/brush.h +++ b/reactos/subsystems/win32/win32k/include/brush.h @@ -132,4 +132,6 @@ PVOID FASTCALL AllocateObjectAttr(VOID); VOID FASTCALL FreeObjectAttr(PVOID); +BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD); + #endif diff --git a/reactos/subsystems/win32/win32k/include/gdiobj.h b/reactos/subsystems/win32/win32k/include/gdiobj.h index f54e87aa445..654849de0b1 100644 --- a/reactos/subsystems/win32/win32k/include/gdiobj.h +++ b/reactos/subsystems/win32/win32k/include/gdiobj.h @@ -82,9 +82,10 @@ PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCES #define GDIOBJFLAG_IGNOREPID (0x1) #define GDIOBJFLAG_IGNORELOCK (0x2) -BOOL FASTCALL GreDeleteObject(HGDIOBJ hObject); -BOOL FASTCALL IsObjectDead(HGDIOBJ); -BOOL FASTCALL IntGdiSetDCOwnerEx( HDC, DWORD, BOOL); +BOOL FASTCALL GreDeleteObject(HGDIOBJ hObject); +BOOL FASTCALL IsObjectDead(HGDIOBJ); +BOOL FASTCALL IntGdiSetDCOwnerEx( HDC, DWORD, BOOL); +BOOL FASTCALL IntGdiSetRegeionOwner(HRGN,DWORD); /*! * Release GDI object. Every object locked by GDIOBJ_LockObj() must be unlocked. diff --git a/reactos/subsystems/win32/win32k/ntuser/monitor.c b/reactos/subsystems/win32/win32k/ntuser/monitor.c index 39e08599ec8..1b077ddb766 100644 --- a/reactos/subsystems/win32/win32k/ntuser/monitor.c +++ b/reactos/subsystems/win32/win32k/ntuser/monitor.c @@ -195,8 +195,7 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice, Monitor->rcMonitor.right, Monitor->rcMonitor.bottom ); - // Replace with IntGdiSetRegeionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC); - GDIOBJ_SetOwnership(Monitor->hrgnMonitor, NULL); + IntGdiSetRegeionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC); if (gMonitorList == NULL) { diff --git a/reactos/subsystems/win32/win32k/objects/gdiobj.c b/reactos/subsystems/win32/win32k/objects/gdiobj.c index fca67fa6cff..42edcff6d7e 100644 --- a/reactos/subsystems/win32/win32k/objects/gdiobj.c +++ b/reactos/subsystems/win32/win32k/objects/gdiobj.c @@ -1560,6 +1560,36 @@ GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process) /** PUBLIC FUNCTIONS **********************************************************/ +BOOL +FASTCALL +IntGdiSetRegeionOwner(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! + KeEnterCriticalRegion(); + Index = GDI_HANDLE_GET_INDEX(hRgn); + Entry = &GdiHandleTable->Entries[Index]; + if (Entry->UserData) FreeObjectAttr(Entry->UserData); + Entry->UserData = NULL; + KeLeaveCriticalRegion(); + // + 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) @@ -1609,7 +1639,6 @@ IntGdiSetBrushOwner(PBRUSH pbr, DWORD OwnerMask) return TRUE; } - BOOL FASTCALL IntGdiSetDCOwnerEx( HDC hDC, DWORD OwnerMask, BOOL NoSetBrush) @@ -1673,7 +1702,6 @@ GreGetObjectOwner(HGDIOBJ Handle, GDIOBJTYPE ObjType) return Ret; } - W32KAPI HANDLE APIENTRY