[GDI32API]

add IsHandleValid and use it SelectObject test

svn path=/trunk/; revision=47549
This commit is contained in:
Timo Kreuzer 2010-06-03 19:35:05 +00:00
parent 10dc21e801
commit 4e381837a0
3 changed files with 19 additions and 0 deletions

View file

@ -18,6 +18,22 @@ MyGdiQueryTable()
return pPeb->GdiSharedHandleTable;
}
BOOL
IsHandleValid(HGDIOBJ hobj)
{
USHORT Index = (ULONG_PTR)hobj;
PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index];
if (pentry->KernelData == NULL ||
pentry->KernelData < (PVOID)0x80000000 ||
(USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
{
return FALSE;
}
return TRUE;
}
int APIENTRY
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,