mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
[GDI32API]
add IsHandleValid and use it SelectObject test svn path=/trunk/; revision=47549
This commit is contained in:
parent
10dc21e801
commit
4e381837a0
3 changed files with 19 additions and 0 deletions
|
@ -18,6 +18,22 @@ MyGdiQueryTable()
|
||||||
return pPeb->GdiSharedHandleTable;
|
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
|
int APIENTRY
|
||||||
WinMain(HINSTANCE hInstance,
|
WinMain(HINSTANCE hInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
extern HINSTANCE g_hInstance;
|
extern HINSTANCE g_hInstance;
|
||||||
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
extern PGDI_TABLE_ENTRY GdiHandleTable;
|
||||||
|
BOOL IsHandleValid(HGDIOBJ hobj);
|
||||||
|
|
||||||
#endif /* _GDITEST_H */
|
#endif /* _GDITEST_H */
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ Test_SelectObject(PTESTINFO pti)
|
||||||
DeleteObject(hOldObj);
|
DeleteObject(hOldObj);
|
||||||
RTEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION); // ??? Why this?
|
RTEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION); // ??? Why this?
|
||||||
DeleteObject(hNewObj);
|
DeleteObject(hNewObj);
|
||||||
|
TEST(IsHandleValid(hNewObj) == TRUE);
|
||||||
|
|
||||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||||
|
|
||||||
/* Test BITMAP */
|
/* Test BITMAP */
|
||||||
|
|
Loading…
Reference in a new issue