Commit bfe3dfb5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntoskrnl.exe: Implement ObOpenObjectByPointer.

parent 136312e2
......@@ -511,6 +511,40 @@ POBJECT_TYPE WINAPI ObGetObjectType( void *object )
return header->type;
}
/***********************************************************************
* ObOpenObjectByPointer (NTOSKRNL.EXE.@)
*/
NTSTATUS WINAPI ObOpenObjectByPointer( void *obj, ULONG attr, ACCESS_STATE *access_state,
ACCESS_MASK access, POBJECT_TYPE type,
KPROCESSOR_MODE mode, HANDLE *handle )
{
NTSTATUS status;
TRACE( "%p %x %p %x %p %d %p\n", obj, attr, access_state, access, type, mode, handle );
if (mode != KernelMode)
{
FIXME( "UserMode access not implemented\n" );
return STATUS_NOT_IMPLEMENTED;
}
if (attr & ~OBJ_KERNEL_HANDLE) FIXME( "access %x not supported\n", access );
if (access_state) FIXME( "access_state not implemented\n" );
if (type && ObGetObjectType( obj ) != type) return STATUS_OBJECT_TYPE_MISMATCH;
SERVER_START_REQ( get_kernel_object_handle )
{
req->manager = wine_server_obj_handle( get_device_manager() );
req->user_ptr = wine_server_client_ptr( obj );
req->access = access;
if (!(status = wine_server_call( req )))
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
}
static void *create_file_object( HANDLE handle );
......
......@@ -822,7 +822,7 @@
@ stub ObLogSecurityDescriptor
@ stub ObMakeTemporaryObject
@ stub ObOpenObjectByName
@ stub ObOpenObjectByPointer
@ stdcall ObOpenObjectByPointer(ptr long ptr long ptr long ptr)
@ stdcall ObQueryNameString(ptr ptr long ptr)
@ stub ObQueryObjectAuditingByHandle
@ stdcall ObReferenceObjectByHandle(long long ptr long ptr ptr)
......
......@@ -773,7 +773,7 @@ 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;
HANDLE event_handle, file_handle, file_handle2, thread_handle, handle;
DISPATCHER_HEADER *header;
FILE_OBJECT *file;
void *obj1, *obj2;
......@@ -878,9 +878,24 @@ static void test_ob_reference(const WCHAR *test_path)
status = wait_single(header, 0);
ok(status == 0 || status == STATUS_TIMEOUT, "got %#x\n", status);
ObDereferenceObject(obj1);
ObDereferenceObject(obj2);
status = ObOpenObjectByPointer(obj1, OBJ_KERNEL_HANDLE, NULL, 0, NULL, KernelMode, &handle);
ok(status == STATUS_SUCCESS, "ObOpenObjectByPointer failed: %#x\n", status);
status = ZwClose(handle);
ok(!status, "ZwClose failed: %#x\n", status);
status = ObReferenceObjectByHandle(thread_handle, SYNCHRONIZE, *pPsThreadType, KernelMode, &obj2, NULL);
ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
ok(obj1 == obj2, "obj1 != obj2\n");
ObDereferenceObject(obj2);
status = ObOpenObjectByPointer(obj1, OBJ_KERNEL_HANDLE, NULL, 0, *pIoFileObjectType, KernelMode, &handle);
ok(status == STATUS_OBJECT_TYPE_MISMATCH, "ObOpenObjectByPointer returned: %#x\n", status);
ObDereferenceObject(obj1);
status = ZwClose(thread_handle);
ok(!status, "ZwClose failed: %#x\n", status);
......
......@@ -130,6 +130,7 @@ typedef struct _FS_FILTER_CALLBACKS
} FS_FILTER_CALLBACKS, *PFS_FILTER_CALLBACKS;
BOOLEAN WINAPI FsRtlIsNameInExpression(PUNICODE_STRING, PUNICODE_STRING, BOOLEAN, PWCH);
NTSTATUS WINAPI ObOpenObjectByPointer(void*,ULONG,PACCESS_STATE,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,HANDLE*);
NTSTATUS WINAPI ObQueryNameString(PVOID,POBJECT_NAME_INFORMATION,ULONG,PULONG);
BOOLEAN WINAPI PsIsSystemThread(PETHREAD);
NTSTATUS WINAPI PsLookupProcessByProcessId(HANDLE,PEPROCESS*);
......
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