#ifndef _NTEXAPI_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* The NtReleaseKeyedEvent routine pairs with one matching keyed-event wait, blocking if no matching waiter is
* present. Unlike NtSetEvent, this is a rendezvous operation, not a persistent signal: a release that times
* out does not leave a wake credit for a later wait.
*
* \param KeyedEventHandle Handle with KEYEDEVENT_WAKE (0x2), or NULL for the system's
* default keyed event (ExpCritSecOutOfMemoryEvent).
* \param KeyValue Opaque pointer-sized matching key, not an object handle (including a
* registry key handle). An address may be used as the key, but the kernel does not
* dereference it or inspect the memory contents, unlike the Address parameter of
* WaitOnAddress.
* Its low bit must be zero; NULL is a valid zero key, not a wildcard. The matching
* wait must use the same object and key and belong to the same process.
* \param Alertable Whether a blocking release can be interrupted by an alert or user APC.
* \param Timeout Optional timeout in 100-nanosecond units: negative for a relative
* interval, positive for an absolute deadline, zero for polling, or NULL for no deadline.
* \return STATUS_SUCCESS only when paired with a matching wait; STATUS_TIMEOUT,
* STATUS_ALERTED or STATUS_USER_APC can end an unmatched blocking release.
* On x64, an odd KeyValue returns STATUS_INVALID_PARAMETER_1
* (despite KeyValue being the second parameter), before handle validation.
* \remarks NT_SUCCESS alone does not establish a match: STATUS_TIMEOUT, STATUS_ALERTED
* and STATUS_USER_APC are nonnegative. A successful release pairs with one waiter,
* not all waiters for the key. If the match wins a timeout/APC race, the kernel
* completes the rendezvous and may return STATUS_SUCCESS instead of the interrupt.
*/
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtReleaseKeyedEvent(
_In_opt_ HANDLE KeyedEventHandle,
_In_opt_ PVOID KeyValue,
_In_ BOOLEAN Alertable,
_In_opt_ PLARGE_INTEGER Timeout
);
View code on GitHub#ifndef _NTZWAPI_H
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwReleaseKeyedEvent(
_In_opt_ HANDLE KeyedEventHandle,
_In_opt_ PVOID KeyValue,
_In_ BOOLEAN Alertable,
_In_opt_ PLARGE_INTEGER Timeout
);
View code on GitHubNo description available.
This function is used for signal KeyedEvent object with value specified as Key parameter. If there are no other thread (or threads) waiting for the same KeyedEvent with the same Key value, waiting is performed up to NtWaitForKeyedEvent called by any other thread.
HANDLE to KeyedEvent object.
Value used as KEY. Note that this value has to have lowest bit cleared (must divide by two).
If set, waiting can be broken by alerting thread.
Optional pointer for timeout value.