Commit 26148c41 authored by Zebediah Figura's avatar Zebediah Figura Committed by Vitaly Lipatov

ntdll: Implement NtQueryMutant().

parent f7072c8b
......@@ -560,6 +560,26 @@ NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev )
return STATUS_SUCCESS;
}
NTSTATUS esync_query_mutex( HANDLE handle, void *info, ULONG *ret_len )
{
struct esync *obj;
struct mutex *mutex;
MUTANT_BASIC_INFORMATION *out = info;
NTSTATUS ret;
TRACE("handle %p, info %p, ret_len %p.\n", handle, info, ret_len);
if ((ret = get_object( handle, &obj ))) return ret;
mutex = obj->shm;
out->CurrentCount = 1 - mutex->count;
out->OwnedByCaller = (mutex->tid == GetCurrentThreadId());
out->AbandonedState = FALSE;
if (ret_len) *ret_len = sizeof(*out);
return STATUS_SUCCESS;
}
#define TICKSPERSEC 10000000
#define TICKSPERMSEC 10000
......
......@@ -41,6 +41,7 @@ extern NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, BOOLEAN initial ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_open_mutex( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_query_mutex( HANDLE handle, void *info, ULONG *ret_len ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_release_mutex( HANDLE *handle, LONG *prev ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_any,
......
......@@ -658,6 +658,9 @@ NTSTATUS WINAPI NtQueryMutant( HANDLE handle, MUTANT_INFORMATION_CLASS class,
if (len != sizeof(MUTANT_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH;
if (do_esync())
return esync_query_mutex( handle, info, ret_len );
SERVER_START_REQ( query_mutex )
{
req->handle = wine_server_obj_handle( handle );
......
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