Expand Minimize

WdfDeviceAddRemovalRelationsPhysicalDevice method

[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

Device [in]

A handle to a framework device object.

PhysicalDevice [in]

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 codeDescription
STATUS_INVALID_PARAMETER

PhysicalDevice 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

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

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, KmdfIrql, KmdfIrql2

See also

WdfDeviceRemoveRemovalRelationsPhysicalDevice
WdfDeviceClearRemovalRelationsDevices

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.