WUDF_WORKITEM_FUNCTION callback function

[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 OnWorkItem;

void OnWorkItem(
  _In_ IWDFWorkItem *pWorkItem
)
{ ... }

typedef void WUDF_WORKITEM_FUNCTION;

Parameters

pWorkItem [in]

A pointer to an IWDFWorkItem interface.

Return value

This callback function does not return a value.

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

Target platform

Desktop

End of support

Unavailable in UMDF 2.0 and later.

Minimum UMDF version

1.11

Header

Wudfworkitem.h

See also

IWDFDevice3::CreateWorkItem
WUDF_WORKITEM_CONFIG
IWDFObject::DeleteWdfObject

 

 

Send comments about this topic to Microsoft

Show: