#ifndef _NTTP_H
// winbase:CreateThreadpoolTimer
/**
* Allocates a timer object.
*
* \param[out] Timer A pointer to a variable that receives the new timer object.
* \param[in] Callback The callback function to execute when the timer expires.
* \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-createthreadpooltimer
* \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
TpAllocTimer(
_Out_ PTP_TIMER *Timer,
_In_ PTP_TIMER_CALLBACK Callback,
_Inout_opt_ PVOID Context,
_In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
);
View code on GitHubCreates a new timer object.
CreateThreadpoolTimer is a thin wrapper around this function.