WdfWorkItemGetParentObject function (wdfworkitem.h)

[Applies to KMDF and UMDF]

The WdfWorkItemGetParentObject method returns the framework object that a specified work item is associated with.

Syntax

WDFOBJECT WdfWorkItemGetParentObject(
  [in] WDFWORKITEM WorkItem
);

Parameters

[in] WorkItem

A handle to a framework work-item object that is obtained from a previous call to WdfWorkItemCreate.

Return value

WdfWorkItemGetParentObject returns a handle to the framework object that the driver specified as the ParentObject member of the driver's WDF_OBJECT_ATTRIBUTES structure when the driver previously called WdfWorkItemCreate.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

For more information about work items, see Using Framework Work Items.

Examples

The following code example is an EvtWorkItem callback function from the 1394 sample driver. The example obtains a work item's parent device object, calls a driver-defined routine to process the work item, and then deletes the work item object.

VOID
t1394_BusResetRoutineWorkItem(
    IN WDFWORKITEM  WorkItem
)
{
    WDFDEVICE  Device = WdfWorkItemGetParentObject(WorkItem);

    t1394_UpdateGenerationCount(Device);

    WdfObjectDelete(WorkItem);
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfworkitem.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <= DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WDF_OBJECT_ATTRIBUTES

WdfWorkItemCreate