WUDF_WORKITEM_FUNCTION - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wudfworkitem.h

WUDF_WORKITEM_FUNCTION WudfWorkitemFunction;

VOID WudfWorkitemFunction(
  [in] IWDFWorkItem *pWorkItem
)
{...}
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nc-wudfworkitem-wudf_workitem_function)

WUDF_WORKITEM_FUNCTION callback function

Description

[Warning: UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.]

A driver's OnWorkItem event callback function performs the work that is associated with a specified work item.

Parameters

pWorkItem [in]

A pointer to an IWDFWorkItem interface.

Remarks

To register an OnWorkItem callback function, your driver must place the callback function's address in a WUDF_WORKITEM_CONFIG structure before calling IWDFDevice3::CreateWorkItem.

Typically, a driver's OnWorkItem callback function performs tasks that are specified by information that the driver stored in the context memory of a work-item object.

The driver must not call IWDFObject::DeleteWdfObject from the OnWorkItem callback function.

For more information, see Using Work Items.

Examples

The function type is declared in Wudfworkitem.h, as follows.

typedef
VOID
WUDF_WORKITEM_FUNCTION(
    _In_
    IWDFWorkItem* pWorkItem
    );

typedef WUDF_WORKITEM_FUNCTION *PFN_WUDF_WORKITEM;

To define an OnWorkItem callback function that is named MyWorkItem, you must first provide a function declaration that SDV and other verification tools require, as follows:

WUDF_WORKITEM_FUNCTION  MyWorkItem;

Then, implement your callback function as follows:

VOID
  MyWorkItem (
   _In_
    IWDFWorkItem* pWorkItem
    )
  {…}

See also

IWDFDevice3::CreateWorkItem

IWDFObject::DeleteWdfObject

WUDF_WORKITEM_CONFIG