- Fix an uncovered bug. This should fix coolplayer and winamp type applications. Does not fix drawing issues.

svn path=/trunk/; revision=51008
This commit is contained in:
James Tabor 2011-03-10 13:09:56 +00:00
parent a2453433f1
commit 729ce068d8
3 changed files with 12 additions and 25 deletions

View file

@ -160,3 +160,7 @@ INT FASTCALL GreGetObjectOwner(HGDIOBJ, GDIOBJTYPE);
#define GDIOBJ_GetKernelObj(Handle) \
((PGDI_TABLE_ENTRY)&GdiHandleTable->Entries[GDI_HANDLE_GET_INDEX(Handle)])->KernelData
#define GDI_ENTRY_TO_INDEX(ht, e) \
(((ULONG_PTR)(e) - (ULONG_PTR)&((ht)->Entries[0])) / sizeof(GDI_TABLE_ENTRY))
#define GDI_HANDLE_GET_ENTRY(HandleTable, h) \
(&(HandleTable)->Entries[GDI_HANDLE_GET_INDEX((h))])

View file

@ -12,11 +12,6 @@
#define NDEBUG
#include <debug.h>
#define GDI_ENTRY_TO_INDEX(ht, e) \
(((ULONG_PTR)(e) - (ULONG_PTR)&((ht)->Entries[0])) / sizeof(GDI_TABLE_ENTRY))
#define GDI_HANDLE_GET_ENTRY(HandleTable, h) \
(&(HandleTable)->Entries[GDI_HANDLE_GET_INDEX((h))])
#define BASE_OBJTYPE_COUNT 32
#define DelayExecution() \

View file

@ -2073,14 +2073,12 @@ FASTCALL
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;
@ -2090,23 +2088,18 @@ PROSRGNDATA
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
{
@ -2151,20 +2144,15 @@ VOID
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
{