WdfDeviceAddRemovalRelationsPhysicalDevice function (wdfdevice.h)
[Applies to KMDF only]
The WdfDeviceAddRemovalRelationsPhysicalDevice method indicates that a specified device must be removed when another specified device is removed.
Syntax
NTSTATUS WdfDeviceAddRemovalRelationsPhysicalDevice(
[in] WDFDEVICE Device,
[in] PDEVICE_OBJECT PhysicalDevice
);
Parameters
[in] Device
A handle to a framework device object.
[in] PhysicalDevice
A pointer to a caller-supplied DEVICE_OBJECT structure that represents a physical device object (PDO).
Return value
If the operation succeeds, WdfDeviceAddRemovalRelationsPhysicalDevice returns STATUS_SUCCESS. Additional return values include:
Return code | Description |
---|---|
|
PhysicalDevice is NULL. |
|
A memory allocation failed. |
The method might return other NTSTATUS values.
A bug check occurs if the driver supplies an invalid object handle.
Remarks
The PhysicalDevice parameter points to a PDO of a device whose drivers must be removed when the drivers for Device are removed. Typically, both devices are controlled by the calling driver. Do not report the child devices of the device object specified in Device because when the Plug and Play manager removes a parent device, it also removes the device's children.
Your driver can call WdfDeviceAddRemovalRelationsPhysicalDevice multiple times to add multiple devices to the list of devices that must be removed when Device is removed. The order in which the specified devices are removed is not defined.
Examples
The following code example adds the device that pPdo identifies to the list of devices that must be removed when the device that device specifies is removed.
status = WdfDeviceAddRemovalRelationsPhysicalDevice(
device,
pPdo
);
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) |