WdfCmResourceListGetCount method

[Applies to KMDF and UMDF]

The WdfCmResourceListGetCount method returns the number of resource descriptors that are contained in a specified resource list.

Syntax


ULONG WdfCmResourceListGetCount(
  [in]  WDFCMRESLIST List
);

Parameters

List [in]

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

Return value

WdfCmResourceListGetCount returns the number of resource descriptors that are contained in the resource list that the List parameter specifies.

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

Remarks

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

Examples

The following code example shows how an EvtDevicePrepareHardware callback function might locate the memory, port, and interrupt resources in the list of translated hardware resources that the Plug and Play (PnP) manager has assigned to a device.


NTSTATUS
MyEvtDevicePrepareHardware (
    WDFDEVICE  Device,
    WDFCMRESLIST  Resources,
    WDFCMRESLIST  ResourcesTranslated
    )
{
    ULONG  i;
    PCM_PARTIAL_RESOURCE_DESCRIPTOR  desc;

    for (i = 0; i < WdfCmResourceListGetCount(ResourcesTranslated); i++) {

        desc = WdfCmResourceListGetDescriptor(
                                              ResourcesTranslated,
                                              i
                                              );

        switch (desc->Type) {

            case CmResourceTypeMemory:
                //
                // Handle memory resources here.
                //
                break;

            case CmResourceTypePort:
                //
                // Handle port resources here.
                //
                break;

            case CmResourceTypeInterrupt:
                //
                // Handle interrupt resources here.
                //
                break;
            default:
                //
                // Ignore all other descriptors.
                //
                break;
        }
    }
}

Requirements

Minimum KMDF version

1.0

Minimum UMDF version

2.0

Header

Wdfresource.h (include Wdf.h)

Library

Wdf01000.sys (KMDF);
WUDFx02000.dll (UMDF)

IRQL

<=DISPATCH_LEVEL

DDI compliance rules

DriverCreate, KmdfIrql, KmdfIrql2

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft