ホーム › Devices.BiometricFramework › PIBIO_STORAGE_DETACH_FN
PIBIO_STORAGE_DETACH_FN
コールバックシグネチャ
HRESULT PIBIO_STORAGE_DETACH_FN(
WINBIO_PIPELINE* Pipeline
);パラメーター
| フィールド | 型 | 説明 |
|---|---|---|
| Pipeline | WINBIO_PIPELINE* | 操作を実行するバイオメトリックユニットに関連付けられた WINBIO_PIPELINE 構造体へのポインターです。 |
公式ドキュメント
ストレージアダプターがバイオメトリックユニットの処理パイプラインから削除される直前に、Windows Biometric Framework によって呼び出されます。この関数の目的は、パイプラインにアタッチされたアダプター固有のリソースを解放することです。
戻り値
関数が成功した場合は S_OK を返します。関数が失敗した場合は、エラーを示すために次のいずれかの HRESULT 値を返す必要があります。
| 戻り値 | 説明 |
|---|---|
| Pipeline パラメーターを NULL にすることはできません。 | |
| WINBIO_PIPELINE 構造体の StorageContext フィールドを NULL にすることはできません。 |
解説(Remarks)
メモリリークを防ぐため、StorageAdapterDetach 関数の実装では、パイプラインの StorageContext メンバーが指すプライベートな WINBIO_STORAGE_CONTEXT 構造体と、ストレージコンテキストにアタッチされているその他のリソースを解放する必要があります。
この関数が呼び出された時点でパイプラインオブジェクトの StorageContext フィールドが NULL である場合、そのパイプラインは適切に初期化されていません。この場合は WINBIO_E_INVALID_DEVICE_STATE を返し、問題を Windows Biometric Framework に通知する必要があります。
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;
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)