配置 BDA 筛选器

BDA 微型驱动程序处理 KSMETHODSETID_BdaDeviceConfiguration 方法集的方法请求,以便为当前筛选器图中的微型驱动程序配置筛选器实例。

在以下代码片段中,KSMETHODSETID_BdaDeviceConfiguration方法集的两个方法直接调度到 BDA 支持库,其余方法首先被 BDA 微型驱动程序截获,然后再调度到 BDA 支持库。

//
//  BDA Device Configuration Method Set
//
//  Defines the dispatch routines for the filter level
//  topology configuration methods
//
DEFINE_KSMETHOD_TABLE(BdaDeviceConfigurationMethods)
{
    DEFINE_KSMETHOD_ITEM_BDA_CREATE_PIN_FACTORY(
        BdaMethodCreatePin,
        NULL
        ),
    DEFINE_KSMETHOD_ITEM_BDA_DELETE_PIN_FACTORY(
        BdaMethodDeletePin,
        NULL
        ),
    DEFINE_KSMETHOD_ITEM_BDA_CREATE_TOPOLOGY(
        CFilter::CreateTopology,
        NULL
        )
};
/*
** CreateTopology()
**
** Keeps track of topology association between input and output pins
**
*/
NTSTATUS
CFilter::
CreateTopology(
    IN PIRP         pIrp,
    IN PKSMETHOD    pKSMethod,
    PVOID           pvIgnored
    )
{
    NTSTATUS            Status = STATUS_SUCCESS;
    CFilter *           pFilter;
    ULONG               ulPinType;
    PKSFILTER           pKSFilter;

    ASSERT( pIrp);
    ASSERT( pKSMethod);

    //  Obtain a "this" pointer for the method.
    //
    //  Because this function is called directly from the property 
    //  dispatch table, get pointer to the underlying object.
    //
    pFilter = FilterFromIRP( pIrp);
    ASSERT( pFilter);
    if (!pFilter)
    {
        Status = STATUS_INVALID_PARAMETER;
        goto errExit;
    }

    //  Let the BDA support library create the standard topology.
    //  It will also validate the method, instance count, etc.
    //
    Status = BdaMethodCreateTopology( pIrp, pKSMethod, pvIgnored);
    if (Status != STATUS_SUCCESS)
    {
        goto errExit;
    }

    //  This is where the filter can keep track of associated pins.
    //
errExit:
    return Status;
}

KSMETHOD_BDA_CREATE_TOPOLOGY 方法请求调用微型驱动程序的 CFilter::CreateTopology 方法。 此方法调用 BDA 支持库函数 BdaMethodCreateTopology 以在筛选器引脚之间创建拓扑。 此函数实际上在环 3 中创建一个拓扑结构,该结构反映筛选器的其他属性集的已知连接。 如果微型驱动程序在连接特定引脚类型时必须向硬件发送特殊指令(例如,如果 BDA 设备执行硬件解复复用并创建任意数量的从单个输入引脚扇出)时,BDA 微型驱动程序应截获上述代码片段中所示的KSMETHOD_BDA_CREATE_TOPOLOGY方法请求。