#ifndef _NTPSAPI_H
//
// Threads
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)
#if (PHNT_VERSION >= PHNT_WINDOWS_8)
// rev
/**
* The NtWaitForAlertByThreadId routine blocks the calling thread until another thread calls NtAlertThreadByThreadId
* with a matching address, or until the timeout expires.
*
* \param Address A unique address used to identify this wait operation. Other threads call
* NtAlertThreadByThreadId with this same address to wake the waiting thread.
* Can be NULL to wait on the thread ID itself.
* \param Timeout Optional timeout value. If NULL, waits indefinitely. If present, specifies
* the absolute or relative time to wait before returning STATUS_TIMEOUT.
* \return STATUS_SUCCESS if alerted successfully.
* \return STATUS_TIMEOUT if the timeout expired before being alerted.
* \return STATUS_ALERTED if woken by NtAlertThreadByThreadId.
*/
NTSYSCALLAPI
NTSTATUS
NTAPI
NtWaitForAlertByThreadId(
_In_opt_ PVOID Address,
_In_opt_ PLARGE_INTEGER Timeout
);
View code on GitHub#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwWaitForAlertByThreadId(
_In_opt_ PVOID Address,
_In_opt_ PLARGE_INTEGER Timeout
);
View code on GitHubWaits on the specified address to be alerted-by-ID by another thread.
Address - the user-provided value that serves as a key.Timeout - an optional pointer to a timeout for the wait. A negative value indicates relative timeout for the specified number of 100-nanosecond intervals. To wait for a specific number of milliseconds, multiply them by -10,000. Positive values indicate an absolute time.STATUS_ALERTED - the thread woke due to a call to NtAlertThreadByThreadId.STATUS_TIMEOUT - the thread woke due to the timeout.Despite the name, the wait this function enters is not alertable and, thus, cannot be interrupted by APCs or NtAlertThread. Alertable waits via NtDelayExecution are unrelated to this functionality.
This function was introduced in Windows 8.