WdfIoResourceRequirementsListRemoveByIoResList 函式 (wdfresource.h)

[僅適用於 KMDF]

WdfIoResourceRequirementsListRemoveByIoResList 方法會從資源需求清單中移除邏輯設定

語法

void WdfIoResourceRequirementsListRemoveByIoResList(
  [in] WDFIORESREQLIST RequirementsList,
  [in] WDFIORESLIST    IoResList
);

參數

[in] RequirementsList

架構 resource-requirements-list 物件的句柄,代表裝置的資源需求清單。

[in] IoResList

架構資源範圍清單物件的句柄,代表要從 RequirementsList 所指定的資源需求清單中移除的邏輯組態。

傳回值

備註

如果驅動程式提供無效的物件句柄,就會發生錯誤檢查。

WdfIoResourceRequirementsListRemoveByIoResList 方法會移除與 IoResList 參數所指定句柄相關聯的邏輯組態。

WdfIoResourceRequirementsListRemoveByIoResList 移除具有索引值 n 的邏輯組態時,下一個邏輯組態的索引值會從 n+1 變更為 n

如需資源需求清單的詳細資訊,請參閱 Framework-Based 驅動程式的硬體資源

範例

下列程式代碼範例會搜尋裝置資源需求清單中的邏輯設定,以尋找包含特定埠位址的組態。 如果範例找到該組態,則會移除組態。

NTSTATUS
Example_EvtDeviceFilterRemoveResourceRequirements(
    IN WDFDEVICE Device,
    IN WDFIORESREQLIST RequirementsList
    )
{
    ULONG i, j, reqCount, resCount;
    BOOLEAN descriptorFound = FALSE;

    //
    // Obtain the number of logical configurations.
    //
    reqCount = WdfIoResourceRequirementsListGetCount(RequirementsList);

    //
    // Search each logical configuration.
    //
    for (i = 0; i < reqCount; i++) {
        WDFIORESLIST reslist;

        if (descriptorFound) {
            break;
        }
        reslist = WdfIoResourceRequirementsListGetIoResList(RequirementsList, i);

        //
        // 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.
            //
            if (descriptor->Type == CmResourceTypePort) {
                if ((descriptor->u.Port.MinimumAddress) == PORT_RANGE_A) {
                    WdfIoResourceRequirementsListRemoveByIoResList(
                                 RequirementsList,
                                 reslist
                                 );
                    descriptorFound = TRUE;
                    break;
            }
        }
    }
...
}

規格需求

需求
目標平台 Universal
最小 KMDF 版本 1.0
標頭 wdfresource.h (包含 Wdf.h)
程式庫 Wdf01000.sys (請參閱 Framework Library Versioning.)
IRQL <=DISPATCH_LEVEL
DDI 合規性規則 DriverCreate (kmdf) KmdfIrql (kmdf) KmdfIrql2 (kmdf) 、 KmdfIrqlExplicit (kmdf)

另請參閱

IO_RESOURCE_DESCRIPTOR

WdfIoResourceListGetCount

WdfIoResourceListGetDescriptor

WdfIoResourceRequirementsListGetCount

WdfIoResourceRequirementsListGetIoResList

WdfIoResourceRequirementsListRemove