Bewerken

Delen via


WdfPdoRequestEject function (wdfpdo.h)

[Applies to KMDF only]

The WdfPdoRequestEject method informs the framework that a specified device is about to be ejected from its docking station.

Syntax

void WdfPdoRequestEject(
  [in] WDFDEVICE Device
);

Parameters

[in] Device

A handle to a framework device object that represents the device's physical device object (PDO).

Return value

None

Remarks

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

A bus driver can call WdfPdoRequestEject or WdfChildListRequestChildEject to report that the driver has detected an attempt to eject one of its enumerated child devices from the device's docking station. For example, the driver might detect that a user has pushed an eject button.

If the framework device object for the device's PDO is available, the driver can call WdfPdoRequestEject. If the driver is using dynamic bus enumeration and if the device's identification description is available, the driver can call WdfChildListRequestChildEject.

For more information about WdfPdoRequestEject and WdfChildListRequestChildEject, see Supporting Ejectable Devices.

Examples

The following code example searches a list of child devices to find one that matches a specified serial number. When the example finds the correct child, it calls WdfPdoRequestEject to indicate that the child is being ejected. This example was taken from the Toaster sample bus driver and simplified.

WDFDEVICE  hChild = NULL;
NTSTATUS  status = STATUS_INVALID_PARAMETER;
PPDO_DEVICE_DATA  pdoData;

WdfFdoLockStaticChildListForIteration(Device);

while ((hChild = WdfFdoRetrieveNextStaticChild(
                                               Device, 
                                               hChild,
                                               WdfRetrieveAddedChildren
                                               )) != NULL) {
    //
    // Obtain device object context space, and check the
    // stored serial number.
    //
    pdoData = PdoGetData(hChild);
    if (SerialNo == pdoData->SerialNo) {
        status = STATUS_SUCCESS;
        WdfPdoRequestEject(hChild);
    }
}
WdfFdoUnlockStaticChildListFromIteration(Device);

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfpdo.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

WdfFdoLockStaticChildListForIteration

WdfFdoRetrieveNextStaticChild

WdfFdoUnlockStaticChildListFromIteration