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

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

構文

PIBIO_STORAGE_DETACH_FN PibioStorageDetachFn;

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

パラメーター

[in, out] Pipeline

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

戻り値

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

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

注釈

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

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

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

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

/////////////////////////////////////////////////////////////////////////////////////////
//
// StorageAdapterDetach
//
// Purpose:
//      Release adapter specific resources attached to the pipeline.
//
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit performing the operation.
//
static HRESULT
WINAPI
StorageAdapterDetach(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    HRESULT hr = S_OK;

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

    // Retrieve the context from the pipeline.
    PWINBIO_STORAGE_CONTEXT storageContext = 
           (PWINBIO_STORAGE_CONTEXT)Pipeline->StorageContext;

    // Verify the pipeline state.
    if (storageContext == NULL)
    {
        // The pipeline state is not valid. This function should never
        // be called if the storage context in the pipeline is already
        // closed.
        hr = WINBIO_E_INVALID_DEVICE_STATE;
        goto cleanup;
    }

    // Release any structures attached to the context block.
    StorageAdapterClearContext(Pipeline);

    // Close the database.
    StorageAdapterCloseDatabase(Pipeline);

    // Remove the context from the pipeline.
    Pipeline->StorageContext = NULL;
    Pipeline->StorageHandle = INVALID_HANDLE_VALUE;

    // Clear the result set. Depending on your implementation, this action
    // can be performed by the StorageAdapterClearContext function called
    // earlier.
    ResultSetCleanup(&storageContext->ResultSet);

    // Release the adapter context.
    _AdapterRelease( storageContext );
    storageContext = NULL;

cleanup:

    return hr;
}

要件

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

こちらもご覧ください

プラグイン関数

StorageAdapterAttach