Commit 72540c93 authored by Derek Lesho's avatar Derek Lesho Committed by Alexandre Julliard

ntoskrnl.exe: Implement KeReadStateEvent.

parent 65df36c1
......@@ -599,7 +599,7 @@
@ stdcall KeQueryTickCount(ptr)
@ stdcall KeQueryTimeIncrement()
@ stub KeRaiseUserException
@ stub KeReadStateEvent
@ stdcall KeReadStateEvent(ptr)
@ stub KeReadStateMutant
@ stub KeReadStateMutex
@ stub KeReadStateQueue
......
......@@ -312,6 +312,28 @@ void WINAPI KeClearEvent( PRKEVENT event )
}
/***********************************************************************
* KeReadStateEvent (NTOSKRNL.EXE.@)
*/
LONG WINAPI KeReadStateEvent( PRKEVENT event )
{
HANDLE handle;
TRACE("event %p.\n", event);
if (event->Header.WaitListHead.Blink == INVALID_HANDLE_VALUE)
{
if (!(ObOpenObjectByPointer( event, OBJ_KERNEL_HANDLE, NULL, EVENT_QUERY_STATE, NULL, KernelMode, &handle )))
{
EVENT_BASIC_INFORMATION event_info;
if (!(NtQueryEvent( handle, EventBasicInformation, &event_info, sizeof(event_info), NULL)))
event->Header.SignalState = event_info.EventState;
NtClose( handle );
}
}
return event->Header.SignalState;
}
/***********************************************************************
* KeInitializeSemaphore (NTOSKRNL.EXE.@)
*/
void WINAPI KeInitializeSemaphore( PRKSEMAPHORE semaphore, LONG count, LONG limit )
......
......@@ -467,8 +467,14 @@ static void test_sync(void)
ret = wait_single(&manual_event, 0);
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
ret = KeReadStateEvent(&manual_event);
ok(ret == 0, "got %d\n", ret);
KeSetEvent(&manual_event, 0, FALSE);
ret = KeReadStateEvent(&manual_event);
ok(ret == 1, "got %d\n", ret);
ret = wait_single(&manual_event, 0);
ok(ret == 0, "got %#x\n", ret);
......@@ -561,9 +567,14 @@ static void test_sync(void)
ret = ObReferenceObjectByHandle(handle, SYNCHRONIZE, *pExEventObjectType, KernelMode, (void **)&event, NULL);
ok(!ret, "ObReferenceObjectByHandle failed: %#x\n", ret);
ret = wait_single(event, 0);
ok(ret == 0, "got %#x\n", ret);
ret = KeReadStateEvent(event);
ok(ret == 1, "got %d\n", ret);
KeResetEvent(event);
ret = KeReadStateEvent(event);
ok(ret == 0, "got %d\n", ret);
ret = wait_single(event, 0);
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
ret = wait_single_handle(handle, 0);
......
......@@ -1759,6 +1759,7 @@ KAFFINITY WINAPI KeQueryActiveProcessors(void);
void WINAPI KeQuerySystemTime(LARGE_INTEGER*);
void WINAPI KeQueryTickCount(LARGE_INTEGER*);
ULONG WINAPI KeQueryTimeIncrement(void);
LONG WINAPI KeReadStateEvent(PRKEVENT);
void FASTCALL KeReleaseInStackQueuedSpinLockFromDpcLevel(KLOCK_QUEUE_HANDLE*);
LONG WINAPI KeReleaseMutex(PRKMUTEX,BOOLEAN);
LONG WINAPI KeReleaseSemaphore(PRKSEMAPHORE,KPRIORITY,LONG,BOOLEAN);
......
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