TpAllocWait - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTTP_H

// winbase:CreateThreadpoolWait
/**
 * Allocates a wait object.
 *
 * \param[out] WaitReturn A pointer to a variable that receives the new wait object.
 * \param[in] Callback The callback function to execute when the wait is satisfied or times out.
 * \param[in,out] Context Optional application-defined data to pass to the callback function.
 * \param[in] CallbackEnviron Optional callback environment for the callback.
 * \return NTSTATUS Successful or errant status.
 * \sa https://learn.microsoft.com/en-us/windows/win32/api/threadpoolapiset/nf-threadpoolapiset-createthreadpoolwait
 * \remarks On success the caller receives an owned callback object; callback and context are borrowed. 
 * The optional environment chooses the pool/cleanup group. An absent environment uses runtime defaults.
 * Allocation does not post work, arm a timer or associate a wait.
 */
NTSYSAPI
NTSTATUS
NTAPI
TpAllocWait(
    _Out_ PTP_WAIT *WaitReturn,
    _In_ PTP_WAIT_CALLBACK Callback,
    _Inout_opt_ PVOID Context,
    _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
    );

#endif

View code on GitHub

NtDoc

Creates a new wait object.

Related Win32 API

CreateThreadpoolWait is a thin wrapper around this function.

See also