WdfCmResourceListAppendDescriptor function (wdfresource.h)

[Applies to KMDF only]

The WdfCmResourceListAppendDescriptor method adds a resource descriptor to the end of a specified resource list.

Syntax

NTSTATUS WdfCmResourceListAppendDescriptor(
  [in] WDFCMRESLIST                    List,
  [in] PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
);

Parameters

[in] List

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

[in] Descriptor

A pointer to a CM_PARTIAL_RESOURCE_DESCRIPTOR structure that describes a hardware resource.

Return value

WdfCmResourceListAppendDescriptor returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return one of the following values:

Return code Description
STATUS_INVALID_PARAMETER
An invalid parameter was specified.
STATUS_ACCESS_DENIED
The driver was not allowed to add descriptors to the logical configuration that the List parameter specified. For example, the driver could not modify the logical configuration that its EvtDevicePrepareHardware or EvtDeviceReleaseHardware callback function received.
STATUS_INSUFFICIENT_RESOURCES
The framework could not allocate space to store the descriptor that the Descriptor parameter specified.
 

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

Remarks

The framework copies the contents of the CM_PARTIAL_RESOURCE_DESCRIPTOR structure into internal storage, so the driver routine that calls WdfCmResourceListAppendDescriptor can allocate the structure locally. After the driver calls WdfCmResourceListAppendDescriptor it can reuse the CM_PARTIAL_RESOURCE_DESCRIPTOR structure.

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

Examples

The following code example adds a resource descriptor to the end of the resource list that an EvtDeviceResourcesQuery callback function receives.

NTSTATUS
PdoEvtDeviceResourcesQuery(
    IN WDFDEVICE  Device,
    IN WDFCMRESLIST  Resources
    )
{
    CM_PARTIAL_RESOURCE_DESCRIPTOR newDescriptor;
...
    newDescriptor.Type = CmResourceTypePort;
    newDescriptor.ShareDisposition = CmResourceShareDeviceExclusive;
    newDescriptor.Flags = CM_RESOURCE_PORT_IO|CM_RESOURCE_PORT_16_BIT_DECODE;
    newDescriptor.u.Port.Length = 1;
    newDescriptor.u.Port.Start = 0;

    status = WdfCmResourceListAppendDescriptor(
                                               Resources,
                                               &newDescriptor
                                               );
...

}

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

CM_PARTIAL_RESOURCE_DESCRIPTOR

EvtDevicePrepareHardware

EvtDeviceReleaseHardware

EvtDeviceResourcesQuery

WdfCmResourceListInsertDescriptor