Bewerken

Delen via


WUDF_WORKITEM_FUNCTION callback function (wudfworkitem.h)

[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.

Syntax

WUDF_WORKITEM_FUNCTION WudfWorkitemFunction;

void WudfWorkitemFunction(
  [in] IWDFWorkItem *pWorkItem
)
{...}

Parameters

[in] pWorkItem

A pointer to an IWDFWorkItem interface.

Return value

None

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
    )
  {…}

Requirements

Requirement Value
End of support Unavailable in UMDF 2.0 and later.
Target Platform Desktop
Minimum UMDF version 1.11
Header wudfworkitem.h

See also

IWDFDevice3::CreateWorkItem

IWDFObject::DeleteWdfObject

WUDF_WORKITEM_CONFIG