IWDFDevice3::CreateWorkItem method (wudfddi.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.]

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

Syntax

HRESULT CreateWorkItem(
  [in]           PWUDF_WORKITEM_CONFIG pConfig,
  [in, optional] IWDFObject            *pParentObject,
  [out]          IWDFWorkItem          **ppWorkItem
);

Parameters

[in] pConfig

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

[in, optional] pParentObject

A pointer to the parent object interface or NULL.

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

Requirement Value
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