ホーム › Devices.BiometricFramework › PIBIO_STORAGE_CLOSE_DATABASE_FN
PIBIO_STORAGE_CLOSE_DATABASE_FN
コールバックシグネチャ
HRESULT PIBIO_STORAGE_CLOSE_DATABASE_FN(
WINBIO_PIPELINE* Pipeline
);パラメーター
| フィールド | 型 | 説明 |
|---|---|---|
| Pipeline | WINBIO_PIPELINE* | 操作を実行するバイオメトリック ユニットに関連付けられた WINBIO_PIPELINE 構造体へのポインター。 |
公式ドキュメント
パイプラインに関連付けられたデータベースを閉じ、関連するすべてのリソースを解放するために、Windows Biometric Framework から呼び出されます。
戻り値
関数が成功した場合は S_OK を返します。関数が失敗した場合は、エラーを示すために次の HRESULT 値のいずれかを返す必要があります。
| 戻り値 | 説明 |
|---|---|
| Pipeline 引数を NULL にすることはできません。 | |
| 原因が特定できない問題によって要求が失敗しました。 |
解説(Remarks)
Windows Biometric Framework は特定のキャッシュ ポリシーを強制しませんが、データベースがレコードのメモリ内キャッシュを保持している場合、この関数は書き込まれていないレコードをストレージにフラッシュする必要があります。
この関数は、以前のデータベース クエリ操作によって生成された結果セットをすべて無効にする必要があります。
例
次の擬似コードは、この関数の実装例の 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;
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)