Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/sync.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 34fde20f8a4..b2d7d8b9640 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -599,7 +599,7 @@ @ stdcall KeQueryTickCount(ptr) @ stdcall KeQueryTimeIncrement() @ stub KeRaiseUserException -@ stub KeReadStateEvent +@ stdcall KeReadStateEvent(ptr) @ stub KeReadStateMutant @ stub KeReadStateMutex @ stub KeReadStateQueue diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 5e06ab2f2b6..7f19ce7571b 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -311,6 +311,28 @@ void WINAPI KeClearEvent( PRKEVENT event ) KeResetEvent( 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.@) */