REGION_AllocUserRgnWithHandle(INT nRgn)
{
PROSRGNDATA pRgn;
- INT Index;
PGDI_TABLE_ENTRY Entry;
pRgn = REGION_AllocRgnWithHandle(nRgn);
if (pRgn)
{
- Index = GDI_HANDLE_GET_INDEX(pRgn->BaseObject.hHmgr);
- Entry = &GdiHandleTable->Entries[Index];
+ Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, pRgn->BaseObject.hHmgr);
Entry->UserData = AllocateObjectAttr();
}
return pRgn;
FASTCALL
RGNOBJAPI_Lock(HRGN hRgn, PRGN_ATTR *ppRgn_Attr)
{
- INT Index;
PGDI_TABLE_ENTRY Entry;
- PROSRGNDATA pRgn;
PRGN_ATTR pRgn_Attr;
- HANDLE pid;
+ PROSRGNDATA pRgn = NULL;
pRgn = REGION_LockRgn(hRgn);
- if (pRgn)
+ if (pRgn && GDIOBJ_OwnedByCurrentProcess(hRgn))
{
- Index = GDI_HANDLE_GET_INDEX(hRgn);
- Entry = &GdiHandleTable->Entries[Index];
+ Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, hRgn);
pRgn_Attr = Entry->UserData;
- pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
- if ( pid == NtCurrentTeb()->ClientId.UniqueProcess &&
- pRgn_Attr )
+ if ( pRgn_Attr )
{
_SEH2_TRY
{
FASTCALL
RGNOBJAPI_Unlock(PROSRGNDATA pRgn)
{
- INT Index;
PGDI_TABLE_ENTRY Entry;
PRGN_ATTR pRgn_Attr;
- HANDLE pid;
- if (pRgn)
+ if (pRgn && GDIOBJ_OwnedByCurrentProcess(pRgn->BaseObject.hHmgr))
{
- Index = GDI_HANDLE_GET_INDEX(pRgn->BaseObject.hHmgr);
- Entry = &GdiHandleTable->Entries[Index];
+ Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, pRgn->BaseObject.hHmgr);
pRgn_Attr = Entry->UserData;
- pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
- if ( pid == NtCurrentTeb()->ClientId.UniqueProcess &&
- pRgn_Attr )
+ if ( pRgn_Attr )
{
_SEH2_TRY
{
return hrgn;
}
+BOOL
+FASTCALL
+IntRectInRegion(
+ HRGN hRgn,
+ LPRECTL rc
+)
+{
+ PROSRGNDATA Rgn;
+ BOOL Ret;
+
+ if (!(Rgn = RGNOBJAPI_Lock(hRgn, NULL)))
+ {
+ return ERROR;
+ }
+
+ Ret = REGION_RectInRegion(Rgn, rc);
+ RGNOBJAPI_Unlock(Rgn);
+ return Ret;
+}
+
+
//
// NtGdi Exported Functions
//
LPRECTL unsaferc
)
{
- PROSRGNDATA Rgn;
RECTL rc = {0};
- BOOL Ret;
NTSTATUS Status = STATUS_SUCCESS;
- if (!(Rgn = RGNOBJAPI_Lock(hRgn, NULL)))
- {
- return ERROR;
- }
-
_SEH2_TRY
{
ProbeForRead(unsaferc, sizeof(RECT), 1);
if (!NT_SUCCESS(Status))
{
- RGNOBJAPI_Unlock(Rgn);
SetLastNtError(Status);
DPRINT1("NtGdiRectInRegion: bogus rc\n");
return ERROR;
}
- Ret = REGION_RectInRegion(Rgn, &rc);
- RGNOBJAPI_Unlock(Rgn);
- return Ret;
+ return IntRectInRegion(hRgn, &rc);
}
BOOL