Please bear in mind that our GDI object implementation uses a callback based deletion, and in my working copy I already modified DC cleanup to be fully done in the callback. This is much cleaner and safer than doing it in GreDeleteObject. Especially since objects might be subject to deferred deletion.
[email protected] schrieb: > Author: jimtabor > Date: Tue Dec 29 22:07:04 2009 > New Revision: 44806 > > URL: http://svn.reactos.org/svn/reactos?rev=44806&view=rev > Log: > [Win32k] > - Setting up for region attribute support. > - Removed old code and use GreDeleteObject for dc and region types. > > Modified: > trunk/reactos/subsystems/win32/win32k/eng/engwindow.c > trunk/reactos/subsystems/win32/win32k/include/dc.h > trunk/reactos/subsystems/win32/win32k/include/region.h > trunk/reactos/subsystems/win32/win32k/ntuser/painting.c > trunk/reactos/subsystems/win32/win32k/ntuser/window.c > trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c > trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c > trunk/reactos/subsystems/win32/win32k/objects/dclife.c > trunk/reactos/subsystems/win32/win32k/objects/dcstate.c > trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c > trunk/reactos/subsystems/win32/win32k/objects/region.c > > Modified: trunk/reactos/subsystems/win32/win32k/eng/engwindow.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/engwindow.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/eng/engwindow.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/eng/engwindow.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -89,7 +89,7 @@ > if (hVisRgn != NULL) > { > NtGdiOffsetRgn(hVisRgn, Window->Wnd->rcClient.left, > Window->Wnd->rcClient.top); > - visRgn = REGION_LockRgn(hVisRgn); > + visRgn = RGNOBJAPI_Lock(hVisRgn, NULL); > if (visRgn != NULL) > { > if (visRgn->rdh.nCount > 0) > @@ -110,7 +110,7 @@ > } > } > } > - REGION_UnlockRgn(visRgn); > + RGNOBJAPI_Unlock(visRgn); > } > else > { > > Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/dc.h?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) > +++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Tue Dec > 29 22:07:04 2009 > @@ -144,7 +144,6 @@ > HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver); > VOID FASTCALL DC_InitDC(HDC DCToInit); > HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver); > -VOID FASTCALL DC_FreeDC(HDC); > VOID FASTCALL DC_AllocateDcAttr(HDC); > VOID FASTCALL DC_FreeDcAttr(HDC); > BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody); > > Modified: trunk/reactos/subsystems/win32/win32k/include/region.h > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/region.h?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -48,6 +48,8 @@ > INT FASTCALL IntGdiCombineRgn(PROSRGNDATA, PROSRGNDATA, PROSRGNDATA, INT); > INT FASTCALL REGION_Complexity(PROSRGNDATA); > PROSRGNDATA FASTCALL IntGdiCreateRectRgn(INT, INT, INT, INT); > +PROSRGNDATA FASTCALL RGNOBJAPI_Lock(HRGN,PRGN_ATTR *); > +VOID FASTCALL RGNOBJAPI_Unlock(PROSRGNDATA); > > #define UnsafeIntCreateRectRgnIndirect(prc) \ > NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom) > > Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/painting.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -1006,10 +1006,10 @@ > } > else > { > - RgnData = REGION_LockRgn(Window->UpdateRegion); > + RgnData = RGNOBJAPI_Lock(Window->UpdateRegion, NULL); > ASSERT(RgnData != NULL); > RegionType = REGION_GetRgnBox(RgnData, &Rect); > - REGION_UnlockRgn(RgnData); > + RGNOBJAPI_Unlock(RgnData); > > if (RegionType != ERROR && RegionType != NULLREGION) > RECTL_bIntersectRect(&Rect, &Rect, &Window->Wnd->rcClient); > > Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/window.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -4557,10 +4557,10 @@ > /* Copy the region into hRgn */ > NtGdiCombineRgn(hRgn, VisRgn, NULL, RGN_COPY); > > - if((pRgn = REGION_LockRgn(hRgn))) > + if((pRgn = RGNOBJAPI_Lock(hRgn, NULL))) > { > Ret = pRgn->rdh.iType; > - REGION_UnlockRgn(pRgn); > + RGNOBJAPI_Unlock(pRgn); > } > else > Ret = ERROR; > @@ -4596,11 +4596,11 @@ > if(Window->WindowRegion && !(Wnd->style & WS_MINIMIZE)) > NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); > > - if((pRgn = REGION_LockRgn(VisRgn))) > + if((pRgn = RGNOBJAPI_Lock(VisRgn, NULL))) > { > Ret = pRgn->rdh.iType; > *Rect = pRgn->rdh.rcBound; > - REGION_UnlockRgn(pRgn); > + RGNOBJAPI_Unlock(pRgn); > } > else > Ret = ERROR; > > Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -953,16 +953,16 @@ > VisBefore = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE); > VisRgn = NULL; > > - if (VisBefore != NULL && (VisRgn = > (PROSRGNDATA)REGION_LockRgn(VisBefore)) && > + if (VisBefore != NULL && (VisRgn = > (PROSRGNDATA)RGNOBJAPI_Lock(VisBefore, NULL)) && > REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION) > { > - REGION_UnlockRgn(VisRgn); > + RGNOBJAPI_Unlock(VisRgn); > GreDeleteObject(VisBefore); > VisBefore = NULL; > } > else if(VisRgn) > { > - REGION_UnlockRgn(VisRgn); > + RGNOBJAPI_Unlock(VisRgn); > NtGdiOffsetRgn(VisBefore, -Window->Wnd->rcWindow.left, > -Window->Wnd->rcWindow.top); > } > } > @@ -1112,16 +1112,16 @@ > VisAfter = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE); > VisRgn = NULL; > > - if (VisAfter != NULL && (VisRgn = > (PROSRGNDATA)REGION_LockRgn(VisAfter)) && > + if (VisAfter != NULL && (VisRgn = > (PROSRGNDATA)RGNOBJAPI_Lock(VisAfter, NULL)) && > REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION) > { > - REGION_UnlockRgn(VisRgn); > + RGNOBJAPI_Unlock(VisRgn); > GreDeleteObject(VisAfter); > VisAfter = NULL; > } > else if(VisRgn) > { > - REGION_UnlockRgn(VisRgn); > + RGNOBJAPI_Unlock(VisRgn); > NtGdiOffsetRgn(VisAfter, -Window->Wnd->rcWindow.left, > -Window->Wnd->rcWindow.top); > } > > @@ -1156,9 +1156,9 @@ > RECTL_vOffsetRect(&ORect, - OldWindowRect.left, - > OldWindowRect.top); > RECTL_vOffsetRect(&NRect, - NewWindowRect.left, - > NewWindowRect.top); > RECTL_bIntersectRect(&CopyRect, &ORect, &NRect); > - pCopyRgn = REGION_LockRgn(CopyRgn); > + pCopyRgn = RGNOBJAPI_Lock(CopyRgn, NULL); > REGION_CropAndOffsetRegion(pCopyRgn, pCopyRgn, &CopyRect, NULL); > - REGION_UnlockRgn(pCopyRgn); > + RGNOBJAPI_Unlock(pCopyRgn); > } > > /* No use in copying bits which are in the update region. */ > @@ -1174,11 +1174,11 @@ > * there's nothing to copy. Also, it's no use copying bits onto > * themselves. > */ > - if ((VisRgn = (PROSRGNDATA)REGION_LockRgn(CopyRgn)) && > + if ((VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(CopyRgn, NULL)) && > REGION_GetRgnBox(VisRgn, &CopyRect) == NULLREGION) > { > /* Nothing to copy, clean up */ > - REGION_UnlockRgn(VisRgn); > + RGNOBJAPI_Unlock(VisRgn); > GreDeleteObject(CopyRgn); > CopyRgn = NULL; > } > @@ -1187,7 +1187,7 @@ > { > if(VisRgn) > { > - REGION_UnlockRgn(VisRgn); > + RGNOBJAPI_Unlock(VisRgn); > } > > /* > @@ -1214,7 +1214,7 @@ > } > else if(VisRgn) > { > - REGION_UnlockRgn(VisRgn); > + RGNOBJAPI_Unlock(VisRgn); > } > } > else > > Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -36,7 +36,7 @@ > NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hClipRgn, > Dc->rosdc.hVisRgn, RGN_AND); > NtGdiOffsetRgn(Dc->rosdc.hGCClipRgn, Dc->ptlDCOrig.x, Dc->ptlDCOrig.y); > > - if((CombinedRegion = REGION_LockRgn(Dc->rosdc.hGCClipRgn))) > + if((CombinedRegion = RGNOBJAPI_Lock(Dc->rosdc.hGCClipRgn, NULL))) > { > if (Dc->rosdc.CombinedClip != NULL) > IntEngDeleteClipRegion(Dc->rosdc.CombinedClip); > @@ -46,7 +46,7 @@ > CombinedRegion->Buffer, > &CombinedRegion->rdh.rcBound); > > - REGION_UnlockRgn(CombinedRegion); > + RGNOBJAPI_Unlock(CombinedRegion); > } > > if ( NULL == Dc->rosdc.CombinedClip ) > @@ -123,10 +123,10 @@ > { > PROSRGNDATA Rgn; > RECTL rect; > - if((Rgn = REGION_LockRgn(dc->rosdc.hVisRgn))) > + if((Rgn = RGNOBJAPI_Lock(dc->rosdc.hVisRgn, NULL))) > { > REGION_GetRgnBox(Rgn, &rect); > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > dc->rosdc.hClipRgn = UnsafeIntCreateRectRgnIndirect(&rect); > } > else > @@ -177,13 +177,13 @@ > return ERROR; > } > > - if (!(Rgn = REGION_LockRgn(dc->rosdc.hGCClipRgn))) > + if (!(Rgn = RGNOBJAPI_Lock(dc->rosdc.hGCClipRgn, NULL))) > { > DC_UnlockDc(dc); > return ERROR; > } > retval = REGION_GetRgnBox(Rgn, rc); > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > IntDPtoLP(dc, (LPPOINT)rc, 2); > DC_UnlockDc(dc); > > @@ -407,11 +407,11 @@ > > if (dc->rosdc.hGCClipRgn) > { > - if((Rgn = (PROSRGNDATA)REGION_LockRgn(dc->rosdc.hGCClipRgn))) > + if((Rgn = (PROSRGNDATA)RGNOBJAPI_Lock(dc->rosdc.hGCClipRgn, NULL))) > { > IntLPtoDP(dc, (LPPOINT)&Rect, 2); > Result = REGION_RectInRegion(Rgn, &Rect); > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > } > } > DC_UnlockDc(dc); > > Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dclife.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -133,23 +133,6 @@ > NewDC->dclevel.pSurface = SURFACE_ShareLockSurface(hsurf); > > return NewDC; > -} > - > -VOID FASTCALL > -DC_FreeDC(HDC DCToFree) > -{ > - DC_FreeDcAttr(DCToFree); > - if (!IsObjectDead(DCToFree)) > - { > - if (!GDIOBJ_FreeObjByHandle(DCToFree, GDI_OBJECT_TYPE_DC)) > - { > - DPRINT1("DC_FreeDC failed\n"); > - } > - } > - else > - { > - DPRINT1("Attempted to Delete 0x%x currently being > destroyed!!!\n",DCToFree); > - } > } > > BOOL INTERNAL_CALL > @@ -537,7 +520,7 @@ > PATH_Delete(DCToDelete->dclevel.hPath); > > DC_UnlockDc(DCToDelete); > - DC_FreeDC(hDC); > + GreDeleteObject(hDC); > return TRUE; > } > > > Modified: trunk/reactos/subsystems/win32/win32k/objects/dcstate.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dcstate.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -180,7 +180,7 @@ > } > > /* Delete the saved dc */ > - DC_FreeDC(hdcSave); > + GreDeleteObject(hdcSave); > } > > DC_UnlockDc(pdc); > > Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -663,11 +663,34 @@ > FASTCALL > GreDeleteObject(HGDIOBJ hObject) > { > + INT Index; > + PGDI_TABLE_ENTRY Entry; > + DWORD dwObjectType; > + PVOID pAttr = NULL; > + > DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject); > if (!IsObjectDead(hObject)) > { > - return NULL != hObject > - ? GDIOBJ_FreeObjByHandle(hObject, GDI_OBJECT_TYPE_DONTCARE) : > FALSE; > + dwObjectType = GDIOBJ_GetObjectType(hObject); > + > + Index = GDI_HANDLE_GET_INDEX(hObject); > + Entry = &GdiHandleTable->Entries[Index]; > + pAttr = Entry->UserData; > + > + switch (dwObjectType) > + { > +// case GDI_OBJECT_TYPE_BRUSH: > + case GDI_OBJECT_TYPE_REGION: > + if (pAttr) FreeObjectAttr(pAttr); > + break; > + > + case GDI_OBJECT_TYPE_DC: > + DC_FreeDcAttr(hObject); > + break; > + } > + > + return NULL != hObject > + ? GDIOBJ_FreeObjByHandle(hObject, dwObjectType) : FALSE; > } > else > { > > Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c > URL: > http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/region.c?rev=44806&r1=44805&r2=44806&view=diff > ============================================================================== > --- trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] > (original) > +++ trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] Tue > Dec 29 22:07:04 2009 > @@ -467,7 +467,7 @@ > { > ROSRGNDATA *Data; > > - Data = REGION_LockRgn(hRgn); > + Data = RGNOBJAPI_Lock(hRgn, NULL); > if (Data == NULL) > { > DbgPrint("IntDumpRegion called with invalid region!\n"); > @@ -482,7 +482,7 @@ > Data->rdh.rcBound.bottom, > Data->rdh.iType); > > - REGION_UnlockRgn(Data); > + RGNOBJAPI_Unlock(Data); > } > #endif /* not NDEBUG */ > > @@ -1739,7 +1739,7 @@ > trb = REGION_AllocRgnWithHandle(srb->rdh.nCount + 1); > if (!trb) > { > - REGION_UnlockRgn(tra); > + RGNOBJAPI_Unlock(tra); > GreDeleteObject(htra); > return; > } > @@ -1748,8 +1748,8 @@ > REGION_SubtractRegion(tra, sra, srb); > REGION_SubtractRegion(trb, srb, sra); > REGION_UnionRegion(dr, tra, trb); > - REGION_UnlockRgn(tra); > - REGION_UnlockRgn(trb); > + RGNOBJAPI_Unlock(tra); > + RGNOBJAPI_Unlock(trb); > > GreDeleteObject(htra); > GreDeleteObject(htrb); > @@ -1863,26 +1863,26 @@ > PRECTL rc; > ULONG i; > > - if (!(srcObj = REGION_LockRgn(hSrc))) > + if (!(srcObj = RGNOBJAPI_Lock(hSrc, NULL))) > { > return FALSE; > } > if (!REGION_NOT_EMPTY(srcObj)) > { > - REGION_UnlockRgn(srcObj); > + RGNOBJAPI_Unlock(srcObj); > return FALSE; > } > - if (!(destObj = REGION_LockRgn(hDest))) > - { > - REGION_UnlockRgn(srcObj); > + if (!(destObj = RGNOBJAPI_Lock(hDest, NULL))) > + { > + RGNOBJAPI_Unlock(srcObj); > return FALSE; > } > > EMPTY_REGION(destObj); > if (!REGION_CopyRegion(destObj, srcObj)) > { > - REGION_UnlockRgn(destObj); > - REGION_UnlockRgn(srcObj); > + RGNOBJAPI_Unlock(destObj); > + RGNOBJAPI_Unlock(srcObj); > return FALSE; > } > > @@ -1891,8 +1891,8 @@ > if (!REGION_CreateSimpleFrameRgn(destObj, x, y)) > { > EMPTY_REGION(destObj); > - REGION_UnlockRgn(destObj); > - REGION_UnlockRgn(srcObj); > + RGNOBJAPI_Unlock(destObj); > + RGNOBJAPI_Unlock(srcObj); > return FALSE; > } > } > @@ -1951,8 +1951,8 @@ > REGION_SubtractRegion(destObj, srcObj, destObj); > } > > - REGION_UnlockRgn(destObj); > - REGION_UnlockRgn(srcObj); > + RGNOBJAPI_Unlock(destObj); > + RGNOBJAPI_Unlock(srcObj); > return TRUE; > } > > @@ -1986,11 +1986,11 @@ > goto done; > } > > - if ( !(srcObj = REGION_LockRgn(hSrc)) ) > + if ( !(srcObj = RGNOBJAPI_Lock(hSrc, NULL)) ) > goto done; > - if ( !(destObj = REGION_LockRgn(hDest)) ) > - { > - REGION_UnlockRgn(srcObj); > + if ( !(destObj = RGNOBJAPI_Lock(hDest, NULL)) ) > + { > + RGNOBJAPI_Unlock(srcObj); > goto done; > } > EMPTY_REGION(destObj); > @@ -2021,8 +2021,8 @@ > } > ret = TRUE; > > - REGION_UnlockRgn(srcObj); > - REGION_UnlockRgn(destObj); > + RGNOBJAPI_Unlock(srcObj); > + RGNOBJAPI_Unlock(destObj); > > done: > return ret; > @@ -2054,7 +2054,7 @@ > pReg->Buffer = ExAllocatePoolWithTag(PagedPool, nReg * sizeof(RECT), > TAG_REGION); > if (!pReg->Buffer) > { > - REGION_UnlockRgn(pReg); > + RGNOBJAPI_Unlock(pReg); > GDIOBJ_FreeObjByHandle(hReg, GDI_OBJECT_TYPE_REGION); > return NULL; > } > @@ -2264,17 +2264,21 @@ > } > else if (src2Rgn == NULL) > { > - DPRINT1("IntGdiCombineRgn requires hSrc2 != NULL for combine > mode %d!\n", CombineMode); > - SetLastWin32Error(ERROR_INVALID_HANDLE); > + DPRINT1("IntGdiCombineRgn requires hSrc2 != NULL for combine > mode %d!\n", CombineMode); > + SetLastWin32Error(ERROR_INVALID_HANDLE); > } > } > + } > + else > + { > + DPRINT("IntGdiCombineRgn: hSrc1 unavailable\n"); > + SetLastWin32Error(ERROR_INVALID_HANDLE); > } > } > else > { > DPRINT("IntGdiCombineRgn: hDest unavailable\n"); > SetLastWin32Error(ERROR_INVALID_HANDLE); > - result = ERROR; > } > return result; > } > @@ -2297,30 +2301,30 @@ > return ERROR; > } > > - destRgn = REGION_LockRgn(hDest); > + destRgn = RGNOBJAPI_Lock(hDest, NULL); > if (!destRgn) > { > SetLastWin32Error(ERROR_INVALID_HANDLE); > return ERROR; > } > > - src1Rgn = REGION_LockRgn(hSrc1); > + src1Rgn = RGNOBJAPI_Lock(hSrc1, NULL); > if (!src1Rgn) > { > - REGION_UnlockRgn(destRgn); > + RGNOBJAPI_Unlock(destRgn); > SetLastWin32Error(ERROR_INVALID_HANDLE); > return ERROR; > } > > if (hSrc2) > - src2Rgn = REGION_LockRgn(hSrc2); > + src2Rgn = RGNOBJAPI_Lock(hSrc2, NULL); > > result = IntGdiCombineRgn( destRgn, src1Rgn, src2Rgn, CombineMode); > > if (src2Rgn) > - REGION_UnlockRgn(src2Rgn); > - REGION_UnlockRgn(src1Rgn); > - REGION_UnlockRgn(destRgn); > + RGNOBJAPI_Unlock(src2Rgn); > + RGNOBJAPI_Unlock(src1Rgn); > + RGNOBJAPI_Unlock(destRgn); > > return result; > } > @@ -2347,7 +2351,7 @@ > if (!(pRgn = REGION_AllocRgnWithHandle(1))) return NULL; > > REGION_SetRectRgn(pRgn, LeftRect, TopRect, RightRect, BottomRect); > - REGION_UnlockRgn(pRgn); > + RGNOBJAPI_Unlock(pRgn); > // Return pointer with Share locks. > pRgn = GDIOBJ_ShareLockObj(pRgn->BaseObject.hHmgr, GDI_OBJECT_TYPE_REGION); > > @@ -2370,7 +2374,7 @@ > hRgn = pRgn->BaseObject.hHmgr; > > REGION_SetRectRgn(pRgn, LeftRect, TopRect, RightRect, BottomRect); > - REGION_UnlockRgn(pRgn); > + RGNOBJAPI_Unlock(pRgn); > > return hRgn; > } > @@ -2490,7 +2494,7 @@ > REGION_UnionRectWithRgn(obj, &rect); > } > > - REGION_UnlockRgn(obj); > + RGNOBJAPI_Unlock(obj); > return hrgn; > } > > @@ -2506,12 +2510,12 @@ > ULONG i; > BOOL bRet = FALSE; > > - if ( !(rgn1 = REGION_LockRgn(hSrcRgn1)) ) > + if ( !(rgn1 = RGNOBJAPI_Lock(hSrcRgn1, NULL)) ) > return ERROR; > > - if ( !(rgn2 = REGION_LockRgn(hSrcRgn2)) ) > - { > - REGION_UnlockRgn(rgn1); > + if ( !(rgn2 = RGNOBJAPI_Lock(hSrcRgn2, NULL)) ) > + { > + RGNOBJAPI_Unlock(rgn1); > return ERROR; > } > > @@ -2540,8 +2544,8 @@ > bRet = TRUE; > > exit: > - REGION_UnlockRgn(rgn1); > - REGION_UnlockRgn(rgn2); > + RGNOBJAPI_Unlock(rgn1); > + RGNOBJAPI_Unlock(rgn2); > return bRet; > } > > @@ -2637,12 +2641,12 @@ > if (!NT_SUCCESS(Status)) > { > SetLastWin32Error(ERROR_INVALID_PARAMETER); > - REGION_UnlockRgn(Region); > + RGNOBJAPI_Unlock(Region); > GreDeleteObject(hRgn); > return NULL; > } > > - REGION_UnlockRgn(Region); > + RGNOBJAPI_Unlock(Region); > > return hRgn; > } > @@ -2659,14 +2663,14 @@ > PROSRGNDATA rgn; > PRECTL r; > > - if (NULL == (rgn = REGION_LockRgn(hRgn))) > + if (NULL == (rgn = RGNOBJAPI_Lock(hRgn, NULL))) > { > return FALSE; > } > > if (NULL == (oldhBrush = NtGdiSelectBrush(hDC, hBrush))) > { > - REGION_UnlockRgn(rgn); > + RGNOBJAPI_Unlock(rgn); > return FALSE; > } > > @@ -2675,7 +2679,7 @@ > NtGdiPatBlt(hDC, r->left, r->top, r->right - r->left, r->bottom - > r->top, PATCOPY); > } > > - REGION_UnlockRgn(rgn); > + RGNOBJAPI_Unlock(rgn); > NtGdiSelectBrush(hDC, oldhBrush); > > return TRUE; > @@ -2816,13 +2820,13 @@ > PROSRGNDATA Rgn; > DWORD ret; > > - if (!(Rgn = REGION_LockRgn(hRgn))) > + if (!(Rgn = RGNOBJAPI_Lock(hRgn, NULL))) > { > return ERROR; > } > > ret = REGION_GetRgnBox(Rgn, pRect); > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > > return ret; > } > @@ -2839,13 +2843,13 @@ > DWORD ret; > NTSTATUS Status = STATUS_SUCCESS; > > - if (!(Rgn = REGION_LockRgn(hRgn))) > + if (!(Rgn = RGNOBJAPI_Lock(hRgn, NULL))) > { > return ERROR; > } > > ret = REGION_GetRgnBox(Rgn, &SafeRect); > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > if (ERROR == ret) > { > return ret; > @@ -2880,7 +2884,7 @@ > ULONG i; > PRECTL rc; > > - if (!(RgnData = REGION_LockRgn(hRgn))) > + if (!(RgnData = RGNOBJAPI_Lock(hRgn, NULL))) > { > SetLastWin32Error(ERROR_INVALID_HANDLE); > return FALSE; > @@ -2892,13 +2896,13 @@ > > if (!NtGdiPatBlt(hDC, rc->left, rc->top, rc->right - rc->left, > rc->bottom - rc->top, DSTINVERT)) > { > - REGION_UnlockRgn(RgnData); > + RGNOBJAPI_Unlock(RgnData); > return FALSE; > } > rc++; > } > > - REGION_UnlockRgn(RgnData); > + RGNOBJAPI_Unlock(RgnData); > return TRUE; > } > > @@ -2910,7 +2914,7 @@ > INT YOffset > ) > { > - PROSRGNDATA rgn = REGION_LockRgn(hRgn); > + PROSRGNDATA rgn = RGNOBJAPI_Lock(hRgn, NULL); > INT ret; > > DPRINT("NtGdiOffsetRgn: hRgn %d Xoffs %d Yoffs %d rgn %x\n", hRgn, > XOffset, YOffset, rgn ); > @@ -2946,7 +2950,7 @@ > } > } > ret = REGION_Complexity(rgn); > - REGION_UnlockRgn(rgn); > + RGNOBJAPI_Unlock(rgn); > return ret; > } > > @@ -2982,7 +2986,7 @@ > > NtGdiCombineRgn(tmpVisRgn, tmpVisRgn, dc->rosdc.hGCClipRgn, RGN_AND); > > - visrgn = REGION_LockRgn(tmpVisRgn); > + visrgn = RGNOBJAPI_Lock(tmpVisRgn, NULL); > if (visrgn == NULL) > { > GreDeleteObject(tmpVisRgn); > @@ -3005,7 +3009,7 @@ > &BrushOrigin, > 0xFFFF);//FIXME:don't know what to put here > > - REGION_UnlockRgn(visrgn); > + RGNOBJAPI_Unlock(visrgn); > GreDeleteObject(tmpVisRgn); > > // Fill the region > @@ -3024,7 +3028,7 @@ > ULONG i; > PRECTL r; > > - if (!(rgn = REGION_LockRgn(hRgn) ) ) > + if (!(rgn = RGNOBJAPI_Lock(hRgn, NULL) ) ) > return FALSE; > > if (rgn->rdh.nCount > 0 && INRECT(rgn->rdh.rcBound, X, Y)) > @@ -3034,13 +3038,13 @@ > { > if (INRECT(*r, X, Y)) > { > - REGION_UnlockRgn(rgn); > + RGNOBJAPI_Unlock(rgn); > return TRUE; > } > r++; > } > } > - REGION_UnlockRgn(rgn); > + RGNOBJAPI_Unlock(rgn); > return FALSE; > } > > @@ -3108,7 +3112,7 @@ > BOOL Ret; > NTSTATUS Status = STATUS_SUCCESS; > > - if (!(Rgn = REGION_LockRgn(hRgn))) > + if (!(Rgn = RGNOBJAPI_Lock(hRgn, NULL))) > { > return ERROR; > } > @@ -3126,14 +3130,14 @@ > > if (!NT_SUCCESS(Status)) > { > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > SetLastNtError(Status); > DPRINT1("NtGdiRectInRegion: bogus rc\n"); > return ERROR; > } > > Ret = REGION_RectInRegion(Rgn, &rc); > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > return Ret; > } > > @@ -3189,14 +3193,14 @@ > { > PROSRGNDATA rgn; > > - if ( !(rgn = REGION_LockRgn(hRgn)) ) > + if ( !(rgn = RGNOBJAPI_Lock(hRgn, NULL)) ) > { > return 0; //per documentation > } > > REGION_SetRectRgn(rgn, LeftRect, TopRect, RightRect, BottomRect); > > - REGION_UnlockRgn(rgn); > + RGNOBJAPI_Unlock(rgn); > return TRUE; > } > > @@ -3210,7 +3214,7 @@ > PROSRGNDATA Rgn; > NTSTATUS Status = STATUS_SUCCESS; > > - if (!(Rgn = REGION_LockRgn(hDest))) > + if (!(Rgn = RGNOBJAPI_Lock(hDest, NULL))) > { > SetLastWin32Error(ERROR_INVALID_HANDLE); > return NULL; > @@ -3229,13 +3233,13 @@ > > if (! NT_SUCCESS(Status)) > { > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > SetLastNtError(Status); > return NULL; > } > > REGION_UnionRectWithRgn(Rgn, &SafeRect); > - REGION_UnlockRgn(Rgn); > + RGNOBJAPI_Unlock(Rgn); > return hDest; > } > > @@ -3257,7 +3261,7 @@ > ) > { > DWORD size; > - PROSRGNDATA obj = REGION_LockRgn(hrgn); > + PROSRGNDATA obj = RGNOBJAPI_Lock(hrgn, NULL); > NTSTATUS Status = STATUS_SUCCESS; > > if (!obj) > @@ -3266,7 +3270,7 @@ > size = obj->rdh.nCount * sizeof(RECT); > if (count < (size + sizeof(RGNDATAHEADER)) || rgndata == NULL) > { > - REGION_UnlockRgn(obj); > + RGNOBJAPI_Unlock(obj); > if (rgndata) /* buffer is too small, signal it by return 0 */ > return 0; > else /* user requested buffer size with rgndata NULL */ > @@ -3288,11 +3292,11 @@ > if (!NT_SUCCESS(Status)) > { > SetLastNtError(Status); > - REGION_UnlockRgn(obj); > + RGNOBJAPI_Unlock(obj); > return 0; > } > > - REGION_UnlockRgn(obj); > + RGNOBJAPI_Unlock(obj); > return size + sizeof(RGNDATAHEADER); > } > > @@ -3778,7 +3782,7 @@ > (Pts[2].x == Pts[3].x) && > (Pts[3].y == Pts[0].y)))) > { > - REGION_UnlockRgn(region); > + RGNOBJAPI_Unlock(region); > NtGdiSetRectRgn(hrgn, min(Pts[0].x, Pts[2].x), min(Pts[0].y, > Pts[2].y), > max(Pts[0].x, Pts[2].x), max(Pts[0].y, Pts[2].y)); > return hrgn; > @@ -3927,7 +3931,7 @@ > curPtBlock = tmpPtBlock; > } > ExFreePoolWithTag(pETEs, TAG_REGION); > - REGION_UnlockRgn(region); > + RGNOBJAPI_Unlock(region); > return hrgn; > } > > > > > _______________________________________________ Ros-dev mailing list [email protected] http://www.reactos.org/mailman/listinfo/ros-dev
