情報
要求されたトピックは次のとおりです。しかし、このトピックはこのライブラリには含まれていません。

WdfCmResourceListInsertDescriptor メソッド

The WdfCmResourceListInsertDescriptor method inserts a resource descriptor into a specified resource list.

構文

NTSTATUS WdfCmResourceListInsertDescriptor(
  [in]  WDFCMRESLIST List,
  [in]  PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
  [in]  ULONG Index
);

パラメーター

List [in]

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

Descriptor [in]

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

Index [in]

A zero-based value that is used as an index into the logical configuration that List specifies. To add a resource descriptor to the end of the resource list, specify WDF_INSERT_AT_END or the return value from WdfCmResourceListGetCount.

戻り値

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

リターン コード説明
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 points to.

STATUS_ARRAY_BOUNDS_EXCEEDED

The value that the Index parameter specified was too large.

 

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

解説

The WdfCmResourceListInsertDescriptor method inserts the resource descriptor that Descriptor specifies into the resource list that List specifies, in front of the resource descriptor that Index value identifies.

To add a resource descriptor to the end of a resource list, specify WDF_INSERT_AT_END or the return value from WdfCmResourceListGetCount as the Index value. Alternatively, use the WdfCmResourceListAppendDescriptor method.

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

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

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 = WdfCmResourceListInsertDescriptor(
                                               Resources,
                                               &newDescriptor,
                                               WDF_INSERT_AT_END
                                               );
...

}

要件

バージョン

Available in version 1.0 and later versions of KMDF.

ヘッダー

Wdfresource.h (includeWdf.h)

ライブラリ

Wdf<MajorVersionNumber>000.sys (see Framework Library Versions.)

IRQL

<=DISPATCH_LEVEL

参照

CM_PARTIAL_RESOURCE_DESCRIPTOR
EvtDevicePrepareHardware
EvtDeviceReleaseHardware
EvtDeviceResourcesQuery
WdfCmResourceListAppendDescriptor

 

 

コミュニティの追加

表示:
© 2014 Microsoft