#ifndef _NTTP_H
#if (PHNT_VERSION >= PHNT_WINDOWS_8)
// winbase:SetThreadpoolWaitEx
/**
* Sets the object to wait on and optional timeout for a wait object and returns status.
*
* \param[in,out] Wait A pointer to a TP_WAIT structure that defines the wait object.
* \param[in] Handle A handle to the object to wait on.
* \param[in] Timeout A pointer to a FILETIME-based timeout value.
* \param[in] Reserved Reserved for future use.
* \return NTSTATUS Successful or errant status.
* \sa https://learn.microsoft.com/en-us/windows/win32/api/threadpoolapiset/nf-threadpoolapiset-setthreadpoolwaitex
*/
NTSYSAPI
NTSTATUS
NTAPI
TpSetWaitEx(
_Inout_ PTP_WAIT Wait,
_In_opt_ HANDLE Handle,
_In_opt_ PLARGE_INTEGER Timeout,
_In_opt_ PVOID Reserved
);
View code on GitHubSets the wait object, replacing the previous wait object, if any. A worker thread calls the wait object's callback function after the handle becomes signaled or after the specified timeout expires.
SetThreadpoolWaitEx maps directly to this function.