設定 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方法要求會呼叫 minidriver 的 CFilter::CreateTopology 方法。 這個方法會呼叫 BDA 支援程式庫函式 BdaMethodCreateTopology ,以在篩選針腳之間建立拓撲。 此函式實際上會在 Ring 3 中建立拓撲結構,以反映其他屬性集的已知篩選連線。 BDA 迷你驅動程式應該攔截KSMETHOD_BDA_CREATE_TOPOLOGY方法要求,如上述程式碼片段中所示,如果 Minidriver 必須在連接特定針腳類型時將特殊指示傳送至硬體,例如,如果 BDA 裝置執行硬體解譯,並建立從單一輸入針腳展開的任意數目輸出針腳。