Commit da060af2 authored by Derek Lesho's avatar Derek Lesho Committed by Alexandre Julliard

ntoskrnl.exe: Implement ObGetObjectType.

parent 9a121f51
......@@ -397,6 +397,15 @@ NTSTATUS WINAPI ObReferenceObjectByHandle( HANDLE handle, ACCESS_MASK access,
return status;
}
/***********************************************************************
* ObGetObjectType (NTOSKRNL.EXE.@)
*/
POBJECT_TYPE WINAPI ObGetObjectType( void *object )
{
struct object_header *header = (struct object_header *)object - 1;
return header->type;
}
static void *create_file_object( HANDLE handle );
......@@ -2793,16 +2802,6 @@ USHORT WINAPI ObGetFilterVersion(void)
}
/***********************************************************************
* ObGetObjectType (NTOSKRNL.EXE.@)
*/
POBJECT_TYPE WINAPI ObGetObjectType(void *object)
{
FIXME("stub: %p\n", object);
return NULL;
}
/***********************************************************************
* IoGetAttachedDeviceReference (NTOSKRNL.EXE.@)
*/
DEVICE_OBJECT* WINAPI IoGetAttachedDeviceReference( DEVICE_OBJECT *device )
......
......@@ -662,10 +662,12 @@ static void WINAPI thread_proc(void *arg)
static void test_ob_reference(const WCHAR *test_path)
{
POBJECT_TYPE (WINAPI *pObGetObjectType)(void*);
OBJECT_ATTRIBUTES attr = { sizeof(attr) };
HANDLE event_handle, file_handle, file_handle2, thread_handle;
FILE_OBJECT *file;
void *obj1, *obj2;
POBJECT_TYPE obj1_type;
UNICODE_STRING pathU;
IO_STATUS_BLOCK io;
WCHAR *tmp_path;
......@@ -674,6 +676,10 @@ static void test_ob_reference(const WCHAR *test_path)
static const WCHAR tmpW[] = {'.','t','m','p',0};
pObGetObjectType = get_proc_address("ObGetObjectType");
if (!pObGetObjectType)
win_skip("ObGetObjectType not found\n");
InitializeObjectAttributes(&attr, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
status = ZwCreateEvent(&event_handle, SYNCHRONIZE, &attr, NotificationEvent, TRUE);
ok(!status, "ZwCreateEvent failed: %#x\n", status);
......@@ -708,6 +714,12 @@ static void test_ob_reference(const WCHAR *test_path)
status = ObReferenceObjectByHandle(event_handle, SYNCHRONIZE, NULL, KernelMode, &obj1, NULL);
ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
if (pObGetObjectType)
{
obj1_type = pObGetObjectType(obj1);
ok(obj1_type == *pExEventObjectType, "ObGetObjectType returned %p\n", obj1_type);
}
if (sizeof(void *) != 4) /* avoid dealing with fastcall */
{
ObfReferenceObject(obj1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment