Bewerken

Delen via


WdfIoResourceListRemoveByDescriptor function (wdfresource.h)

[Applies to KMDF only]

The WdfIoResourceListRemoveByDescriptor method removes a resource descriptor from a resource requirement list's logical configuration.

Syntax

void WdfIoResourceListRemoveByDescriptor(
  [in] WDFIORESLIST            ResourceList,
  [in] PIO_RESOURCE_DESCRIPTOR Descriptor
);

Parameters

[in] ResourceList

A handle to a framework resource-range-list object that represents a logical configuration of hardware resources for a device.

[in] Descriptor

A pointer to an IO_RESOURCE_DESCRIPTOR structure that describes a hardware resource.

Return value

None

Remarks

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

The WdfIoResourceListRemoveByDescriptor method removes the resource descriptor that matches the Descriptor parameter. To find a match, the method compares the specified resource descriptor with the resource descriptors in the logical configuration, byte for byte.

When WdfIoResourceListRemoveByDescriptor removes the resource descriptor that has the index value n, the index value of the next resource descriptor changes from n+1 to n.

For more information about resource requirements lists and logical configurations, see Hardware Resources for Framework-Based Drivers.

Examples

The following code example searches a logical configuration for a resource descriptor that contains a specified port address, and it removes that resource descriptor.

IO_RESOURCE_DESCRIPTOR descriptor;
ULONG resCount, j;

//
// Get the number of resource descriptors that
// are in this logical configuration.
//
resCount = WdfIoResourceListGetCount(reslist);

for (j = 0; j < resCount; j++) {
    PIO_RESOURCE_DESCRIPTOR descriptor;

    //
    // Get the next resource descriptor.
    //
    descriptor = WdfIoResourceListGetDescriptor(
                                                reslist,
                                                j
                                                );

    //
    // Stop if this descriptor is the port descriptor that
    // we're looking for, and remove the descriptor.
    //
    if (descriptor->Type == CmResourceTypePort) {
        if ((descriptor->u.port.MinimumAddress) == PORT_RANGE_A) {
               WdfIoResourceListRemoveByDescriptor(
                                                   Reslist,
                                                   descriptor
                                                   );
               break;
        }
    }
}

Requirements

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

IO_RESOURCE_DESCRIPTOR

WdfIoResourceListRemove