PIBIO_ENGINE_DETACH_FN コールバック関数 (winbio_adapter.h)

エンジン アダプターが生体認証ユニットの処理パイプラインから削除される直前に、Windows 生体認証フレームワークによって呼び出されます。 この関数の目的は、パイプラインにアタッチされているアダプター固有のリソースを解放することです。

構文

PIBIO_ENGINE_DETACH_FN PibioEngineDetachFn;

HRESULT PibioEngineDetachFn(
  [in, out] PWINBIO_PIPELINE Pipeline
)
{...}

パラメーター

[in, out] Pipeline

操作を実行する生体認証ユニットに関連付けられている WINBIO_PIPELINE 構造体へのポインター。

戻り値

関数が成功した場合は、S_OK を返します。 関数が失敗した場合は、エラーを示すために次のいずれかの HRESULT 値を返す必要があります。

リターン コード 説明
E_POINTER
Pipeline パラメーターを NULL にすることはできません。
WINBIO_E_INVALID_DEVICE_STATE
WINBIO_PIPELINE構造体の EngineContext フィールドを NULL にすることはできません。

注釈

メモリ リークを防ぐために、EngineAdapterDetach 関数の実装では、パイプラインの EngineContext メンバーが指すプライベート WINBIO_ENGINE_CONTEXT構造体と、エンジン コンテキストにアタッチされている他のリソースを解放する必要があります。

この関数が呼び出されたときにパイプライン オブジェクトの EngineContext フィールドが NULL の場合、パイプラインは正しく初期化されていないため、Windows 生体認証フレームワークに問題を通知するために WINBIO_E_INVALID_DEVICE_STATE を返す必要があります。

S_OKを返す前に、EngineAdapterDetach 関数で、WINBIO_PIPELINE構造体の EngineContext フィールドを NULL に設定し、EngineHandle フィールドをINVALID_HANDLE_VALUEする必要があります。

この関数は、ストレージ アダプターがパイプラインから削除された後に呼び出されます。 したがって、この関数は、パイプライン オブジェクトの StorageInterface メンバーが指すWINBIO_STORAGE_INTERFACE構造体によって参照される関数を呼び出してはなりません。

次の擬似コードは、この関数の 1 つの可能な実装を示しています。 この例はコンパイルされません。 目的に合わせて調整する必要があります。

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterDetach
//
// Purpose:
//      Releases adapter specific resources attached to the pipeline.
//      
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//
static HRESULT
WINAPI
EngineAdapterDetach(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    PWINBIO_ENGINE_CONTEXT context = NULL;

    // Verify that the Pipeline parameter is not NULL.
    if (!ARGUMENT_PRESENT(Pipeline))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline and assign it to a local
    // variable.
    context = (PWINBIO_ENGINE_CONTEXT)Pipeline->EngineContext;
    if (context == NULL)
    {
        goto cleanup;
    }

    // Set the context on the pipeline to NULL.
    Pipeline->EngineContext = NULL;

    // If your adapter supports software-based template hashing and you
    // opened a Cryptography Next Generation (CNG) hash object handle
    // during initialization, implement the following custom function to 
    // release the CNG resources.
    _AdapterCleanupCrypto(context);

    // Implement one or more custom routines to release any structures 
    // that remain attached to the context block. These structures can 
    // include the most recent feature set, the current enrollment template, 
    // and other custom defined objects.
    if (context->FeatureSet != NULL)
    {
        _AdapterRelease(context->FeatureSet);
        context->FeatureSet = NULL;
        context->FeatureSetSize = 0;
    }

    if (context->Enrollment.Template != NULL)
    {
        _AdapterRelease(context->Enrollment.Template);
        context->Enrollment.Template = NULL;
        context->Enrollment.TemplateSize = 0;
        context->Enrollment.SampleCount = 0;
    }

    if (context->SomePointerField != NULL)
    {
        _AdapterRelease(context->SomePointerField);
        context->SomePointerField = NULL;
    }

    // Release the context block.
    _AdapterRelease(context);

cleanup:

    return S_OK;
}

要件

要件
サポートされている最小のクライアント Windows 7 [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows Server 2008 R2 [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー winbio_adapter.h (Winbio_adapter.h を含む)

こちらもご覧ください

EngineAdapterAttach

プラグイン関数

SensorAdapterDetach