Win32 API 日本語リファレンス
ホーム › Devices.BiometricFramework › PIBIO_ENGINE_CLEAR_CONTEXT_FN

PIBIO_ENGINE_CLEAR_CONTEXT_FN

コールバック

シグネチャ

HRESULT PIBIO_ENGINE_CLEAR_CONTEXT_FN(
    WINBIO_PIPELINE* Pipeline
);

パラメーター

フィールド型説明
PipelineWINBIO_PIPELINE*操作を実行するバイオメトリックユニットに関連付けられた WINBIO_PIPELINE 構造体へのポインターです。

公式ドキュメント

Windows Biometric Framework によって呼び出され、バイオメトリックユニットの処理パイプラインを新しい操作のために準備します。この関数は、エンジンコンテキストから一時データをフラッシュし、エンジンアダプターを明確に定義された初期状態にする必要があります。

戻り値

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

戻り値 説明
E_POINTER
Pipeline 引数を NULL にすることはできません。

解説(Remarks)

この関数の目的は、EngineAdapterAttach 関数を呼び出した直後の状態にコンテキストをリセットすることです。コンテキストは再利用可能な構造体です。EngineAdapterClearContext 関数はコンテキストを再初期化しますが、パイプラインから削除することはありません。

エンジンアダプターのコンテキスト領域内でクリアすべきオブジェクトの代表的な例を次に示します。

オブジェクト 説明
特徴セット バイオメトリックサンプルの記述を保持します
登録 (Enrollment) 登録トランザクションの現在の状態を追跡します。
テンプレート 特徴セットまたは登録オブジェクトによって作成されたバイオメトリックテンプレートです。
比較 テンプレートと特徴セットの比較結果を保持します。
インデックスベクター テンプレートに関連付けられた一連のインデックス値を保持します。

例

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

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterClearContext
//
// Purpose:
//      Prepares the processing pipeline of the biometric unit for a 
//      new operation.
//
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//
static HRESULT
WINAPI
EngineAdapterClearContext(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    // Verify that the Pipeline parameter is not NULL.
    if (!ARGUMENT_PRESENT(Pipeline))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline.
    PWINBIO_ENGINE_CONTEXT context = 
           (PWINBIO_ENGINE_CONTEXT)Pipeline->EngineContext;

    if (context == NULL)
    {
        goto cleanup;
    }

    // Change the engine adapter state and discard any partially completed
    // operations. Depending on the adapter, this can involve changes to state 
    // variables or actions implemented in hardware. The following example
    // assumes that your engine adapter context contains a ULONG data member 
    // and pointers to a feature set and an enrollment object.

    context->SomeField = 0L;

    if (context->FeatureSet != NULL)
    {
        // Zero the feature set if it contains unencrypted biometric data.
        SecureZeroMemory(
            context->FeatureSet,
            context->FeatureSetSize);

        // Release the feature set.
        _AdapterRelease(context->FeatureSet);
        context->FeatureSet = NULL;
        context->FeatureSetSize = 0;
    }

    if (context->Enrollment.Template != NULL)
    {
        // Zero the template if it contains unencrypted biometric data.
        SecureZeroMemory(
            context->Enrollment.Template,
            context->Enrollment.TemplateSize);

        // Release the template.
        _AdapterRelease(context->Enrollment.Template);
        context->Enrollment.Template = NULL;
        context->Enrollment.TemplateSize = 0;

        // Release other data members attached to the enrollment object.
        context->Enrollment.SampleCount = 0;
        context->Enrollment.InProgress = FALSE;
    }

cleanup:

    return S_OK;
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)