TpAllocWork - NtDoc

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

// winbase:CreateThreadpoolWork
/**
 * Allocates a work object.
 *
 * \param[out] WorkReturn A pointer to a variable that receives the new work object.
 * \param[in] Callback The callback function to execute.
 * \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-createthreadpoolwork
 */
NTSYSAPI
NTSTATUS
NTAPI
TpAllocWork(
    _Out_ PTP_WORK *WorkReturn,
    _In_ PTP_WORK_CALLBACK Callback,
    _Inout_opt_ PVOID Context,
    _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
    );

#endif

View code on GitHub

NtDoc

Creates a new work object.

Related Win32 API

CreateThreadpoolWork is a thin wrapper around this function.

See also