IWDFDevice3::CreateWorkItem method

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

The CreateWorkItem method creates a framework work-item object, which can subsequently be added to the framework’s work-item queue.

Syntax

HRESULT CreateWorkItem(
  PWUDF_WORKITEM_CONFIG pConfig,
  IWDFObject            *pParentObject,
  IWDFWorkItem          **ppWorkItem
);

Parameters

pConfig

A pointer to a caller-allocated WUDF_WORKITEM_CONFIG structure that the driver must have already initialized by calling WUDF_WORKITEM_CONFIG_INIT.

pParentObject

A pointer to the parent object interface or NULL.

ppWorkItem

A pointer to a buffer that receives a pointer to the IWDFWorkItem interface for the new WorkItem object.

Return Value

The method returns S_OK if the operation succeeds. Otherwise, this method returns one of the error codes that are defined in Winerror.h.

Remarks

If you specify a parent object, the framework automatically deletes the work-item when the parent object is deleted. Alternatively, the driver can call IWDFObject::DeleteWdfObject to delete a work-item. The driver must not delete a work-item in its OnWorkItem callback function.

For more information, see Using Work Items.

Examples

WUDF_WORKITEM_CONFIG config;

WUDF_WORKITEM_CONFIG_INIT(&config, OnWorkItem); 
hr = m_IWdfDevice3->CreateWorkItem(&config,
                                   m_IWdfDevice3,   
                                   &m_WorkItem);

Requirements

   
End of support Unavailable in UMDF 2.0 and later.
Target Platform Desktop
Minimum UMDF version 1.11
Header wudfddi.h
DLL WUDFx.dll

See Also

IWDFDevice3

IWDFWorkItem

OnWorkItem

WUDF_WORKITEM_CONFIG

WUDF_WORKITEM_CONFIG_INIT