// wdfdevice.h
NTSTATUS WdfDeviceAddDependentUsageDeviceObject(
[in] WDFDEVICE Device,
[in] PDEVICE_OBJECT DependentDevice
);
View the official Windows Driver Kit DDI referenceNo description available.
[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.
Device [in]A handle to a framework device object.
DependentDevice [in]A pointer to a caller-supplied DEVICE_OBJECT structure that identifies a device that Device depends on.
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.
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.
The following code example adds a device (pDeviceObject) to the list of devices that another device (Device) depends on.
status = WdfDeviceAddDependentUsageDeviceObject(
device,
pDeviceObject
);
WdfDeviceRemoveDependentUsageDeviceObject