WdfWorkItemGetParentObject - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfworkitem.h

WDFOBJECT WdfWorkItemGetParentObject(
  [in] WDFWORKITEM WorkItem
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfworkitem-wdfworkitemgetparentobject)

WdfWorkItemGetParentObject function

Description

[Applies to KMDF and UMDF]

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

Parameters

WorkItem [in]

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);
}

See also

WDF_OBJECT_ATTRIBUTES

WdfWorkItemCreate