As said NtQueryObject. But It is probably better to use some OO concepts:
struct HandleVtable
{
/* function pointer to appropriate implementation */
};
struct HandleWrapper
{
struct HandleVtable *vptr;
HANDLE handle;
};
For each type of handle, create a static const HandleVtable and fill it with function pointers. When creating HandleWrappers, set vptr so it points the corresponding vtable, and let all function calls go through that vtable. For this it is best to write a wrapper function that takes a pointer to a HandleWrapper.
Now you will have OOP in C.