Commit 595bc6dd authored by Zebediah Figura's avatar Zebediah Figura Committed by Vitaly Lipatov

ntdll: Implement NtQuerySemaphore().

parent e8520b74
......@@ -418,6 +418,25 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
return STATUS_SUCCESS;
}
NTSTATUS esync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len )
{
struct esync *obj;
struct semaphore *semaphore;
SEMAPHORE_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;
semaphore = obj->shm;
out->CurrentCount = semaphore->count;
out->MaximumCount = semaphore->max;
if (ret_len) *ret_len = sizeof(*out);
return STATUS_SUCCESS;
}
NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, EVENT_TYPE event_type, BOOLEAN initial )
{
......
......@@ -26,6 +26,7 @@ extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max) DECLSPEC_HIDDEN;
extern NTSTATUS esync_open_semaphore( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_query_semaphore( HANDLE handle, void *info, ULONG *ret_len ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev ) DECLSPEC_HIDDEN;
extern NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access,
......
......@@ -341,6 +341,9 @@ NTSTATUS WINAPI NtQuerySemaphore( HANDLE handle, SEMAPHORE_INFORMATION_CLASS cla
if (len != sizeof(SEMAPHORE_BASIC_INFORMATION)) return STATUS_INFO_LENGTH_MISMATCH;
if (do_esync())
return esync_query_semaphore( handle, info, ret_len );
SERVER_START_REQ( query_semaphore )
{
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