mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
ntoskrnl.exe: Use ObOpenObjectByPointer to get handle for kernel object.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bfe3dfb535
commit
332035fb94
3 changed files with 10 additions and 21 deletions
|
@ -366,20 +366,6 @@ static void ObReferenceObject( void *obj )
|
|||
LeaveCriticalSection( &obref_cs );
|
||||
}
|
||||
|
||||
HANDLE kernel_object_handle( void *obj, unsigned int access )
|
||||
{
|
||||
HANDLE handle = NULL;
|
||||
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 (!wine_server_call( req )) handle = wine_server_ptr_handle( reply->handle );
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
return handle;
|
||||
}
|
||||
|
||||
static const POBJECT_TYPE *known_types[] =
|
||||
{
|
||||
&ExEventObjectType,
|
||||
|
@ -1870,9 +1856,12 @@ NTSTATUS WINAPI IoGetDeviceProperty( DEVICE_OBJECT *device, DEVICE_REGISTRY_PROP
|
|||
OBJECT_NAME_INFORMATION *name = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
HANDLE handle;
|
||||
|
||||
handle = kernel_object_handle( device, 0 );
|
||||
status = NtQueryObject( handle, ObjectNameInformation, name, len, &used_len );
|
||||
NtClose( handle );
|
||||
status = ObOpenObjectByPointer( device, OBJ_KERNEL_HANDLE, NULL, 0, NULL, KernelMode, &handle );
|
||||
if (!status)
|
||||
{
|
||||
status = NtQueryObject( handle, ObjectNameInformation, name, len, &used_len );
|
||||
NtClose( handle );
|
||||
}
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
/* Ensure room for NULL termination */
|
||||
|
|
|
@ -47,7 +47,6 @@ struct _ETHREAD
|
|||
};
|
||||
|
||||
void *alloc_kernel_object( POBJECT_TYPE type, HANDLE handle, SIZE_T size, LONG ref ) DECLSPEC_HIDDEN;
|
||||
HANDLE kernel_object_handle( void *obj, unsigned int access ) DECLSPEC_HIDDEN;
|
||||
NTSTATUS kernel_object_from_handle( HANDLE handle, POBJECT_TYPE type, void **ret ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern POBJECT_TYPE ExEventObjectType;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "winternl.h"
|
||||
#include "ddk/ntddk.h"
|
||||
#include "ddk/wdm.h"
|
||||
#include "ddk/ntifs.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
|
@ -80,7 +81,7 @@ NTSTATUS WINAPI KeWaitForMultipleObjects(ULONG count, void *pobjs[],
|
|||
{
|
||||
if (objs[i]->WaitListHead.Blink == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
handles[i] = kernel_object_handle( objs[i], SYNCHRONIZE );
|
||||
ObOpenObjectByPointer( objs[i], OBJ_KERNEL_HANDLE, NULL, SYNCHRONIZE, NULL, KernelMode, &handles[i] );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -266,7 +267,7 @@ LONG WINAPI KeSetEvent( PRKEVENT event, KPRIORITY increment, BOOLEAN wait )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((handle = kernel_object_handle( event, EVENT_MODIFY_STATE )))
|
||||
if (!ObOpenObjectByPointer( event, OBJ_KERNEL_HANDLE, NULL, EVENT_MODIFY_STATE, NULL, KernelMode, &handle ))
|
||||
{
|
||||
NtSetEvent( handle, &ret );
|
||||
NtClose( handle );
|
||||
|
@ -297,7 +298,7 @@ LONG WINAPI KeResetEvent( PRKEVENT event )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((handle = kernel_object_handle( event, EVENT_MODIFY_STATE )))
|
||||
if (!ObOpenObjectByPointer( event, OBJ_KERNEL_HANDLE, NULL, EVENT_MODIFY_STATE, NULL, KernelMode, &handle ))
|
||||
{
|
||||
NtResetEvent( handle, &ret );
|
||||
NtClose( handle );
|
||||
|
|
Loading…
Reference in a new issue