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

Windows 生体認証フレームワークによって呼び出され、パイプラインに関連付けられているデータベースを閉じ、関連するすべてのリソースを解放します。

構文

PIBIO_STORAGE_CLOSE_DATABASE_FN PibioStorageCloseDatabaseFn;

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

パラメーター

[in, out] Pipeline

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

戻り値

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

リターン コード 説明
E_POINTER
Pipeline 引数を NULL にすることはできません。
WINBIO_E_DATABASE_CANT_CLOSE
未指定の問題により、要求が失敗しました。

注釈

Windows 生体認証フレームワークでは、特定のキャッシュ ポリシーは必須ではありませんが、データベースがレコードのメモリ内キャッシュを維持している場合、この関数は書き込まれていないレコードをストレージにフラッシュする必要があります。

この関数は、以前のデータベース クエリ操作によって生成されたすべての結果セットを無効にする必要があります。

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

/////////////////////////////////////////////////////////////////////////////////////////
//
// StorageAdapterCloseDatabase
//
// Purpose:
//      Close the database associated with the pipeline and free all 
//      related resources.
//
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit performing the operation.
//
static HRESULT
WINAPI
StorageAdapterCloseDatabase(
    __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 ||
        Pipeline->StorageHandle == INVALID_HANDLE_VALUE)
    {
        hr = WINBIO_E_INVALID_DEVICE_STATE;
        goto cleanup;
    }

    // Remove any data structures attached to the context and remove the
    // context from the pipeline.
    _CleanupCryptoContext(&storageContext->CryptoContext);
    StorageAdapterClearContext(Pipeline);

    // Close the database file handle.
    CloseHandle( Pipeline->StorageHandle );
    Pipeline->StorageHandle = INVALID_HANDLE_VALUE;

    // Call a custom function (_PurgeDeletedRecords) to remove deleted records
    // from the database file.
    _PurgeDeletedRecords( 
        &storageContext->DatabaseId, 
        (LPCWSTR)&storageContext->FilePath
        );

    // Overwrite the database ID and path.
    SecureZeroMemory(&storageContext->DatabaseId, sizeof(WINBIO_UUID));
    SecureZeroMemory(storageContext->FilePath, (MAX_PATH+1)*sizeof(WCHAR));

cleanup:

    return hr;
}

要件

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

こちらもご覧ください

プラグイン関数

StorageAdapterCreateDatabase

StorageAdapterEraseDatabase

StorageAdapterOpenDatabase