ntoskrnl.exe: Implement ObGetObjectType.

Signed-off-by: Derek Lesho <dereklesho52@Gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Derek Lesho 2019-03-21 18:51:44 +01:00 committed by Alexandre Julliard
parent 9a121f5115
commit da060af242
2 changed files with 21 additions and 10 deletions

View File

@ -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 );
@ -2792,16 +2801,6 @@ USHORT WINAPI ObGetFilterVersion(void)
return OB_FLT_REGISTRATION_VERSION;
}
/***********************************************************************
* ObGetObjectType (NTOSKRNL.EXE.@)
*/
POBJECT_TYPE WINAPI ObGetObjectType(void *object)
{
FIXME("stub: %p\n", object);
return NULL;
}
/***********************************************************************
* IoGetAttachedDeviceReference (NTOSKRNL.EXE.@)
*/

View File

@ -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);