WdfDeviceAddDependentUsageDeviceObject function (wdfdevice.h)

[Applies to KMDF only]

The WdfDeviceAddDependentUsageDeviceObject method indicates that a specified device depends on another device when the specified device is used to store special files.

Syntax

NTSTATUS WdfDeviceAddDependentUsageDeviceObject(
  [in] WDFDEVICE      Device,
  [in] PDEVICE_OBJECT DependentDevice
);

Parameters

[in] Device

A handle to a framework device object.

[in] DependentDevice

A pointer to a caller-supplied DEVICE_OBJECT structure that identifies a device that Device depends on.

Return value

If the operation succeeds, WdfDeviceAddDependentUsageDeviceObject method returns STATUS_SUCCESS. Additional return values include:

Return code Description
STATUS_INVALID_PARAMETER
DependentDevice is NULL.
STATUS_INSUFFICIENT_RESOURCES
A memory allocation failed.
 

The method might return other NTSTATUS values.

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

Remarks

Your driver can call WdfDeviceAddDependentUsageDeviceObject to indicate that the device identified by Device depends on the device identified by DependentDevice, when Device supports special files. If your driver calls WdfDeviceAddDependentUsageDeviceObject, the framework calls the EvtDeviceUsageNotification callback functions in DependentDevice's drivers before it calls the EvtDeviceUsageNotification callback functions in Device's drivers.

Your driver can call WdfDeviceAddDependentUsageDeviceObject multiple times to identify multiple devices that Device depends on to support special files.

After a driver has called WdfDeviceAddDependentUsageDeviceObject, it can call WdfDeviceRemoveDependentUsageDeviceObject to remove the device identified by DependentDevice from the list of devices that Device depends on.

For more information about special files, see Supporting Special Files.

Examples

The following code example adds a device (pDeviceObject) to the list of devices that another device (Device) depends on.

status = WdfDeviceAddDependentUsageDeviceObject(
                                                device,
                                                pDeviceObject
                                                );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL <= DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

EvtDeviceUsageNotification

WdfDeviceRemoveDependentUsageDeviceObject