由 Windows 生物识别框架调用以关闭与管道关联的数据库,并释放所有相关资源。
Syntax
PIBIO_STORAGE_CLOSE_DATABASE_FN PibioStorageCloseDatabaseFn;
HRESULT PibioStorageCloseDatabaseFn(
[in, out] PWINBIO_PIPELINE Pipeline
)
{...}
参数
[in, out] Pipeline
指向与执行作的生物识别单元关联的 WINBIO_PIPELINE 结构的指针。
返回值
如果函数成功,它将返回S_OK。 如果函数失败,则它必须返回以下 HRESULT 值之一来指示错误。
| 返回代码 | Description |
|---|---|
|
Pipeline 参数不能为 NULL。 |
|
未指定的问题导致请求失败。 |
注解
Windows 生物识别框架不强制使用特定的缓存策略,但如果数据库维护记录的内存中缓存,则此函数应将未写入的记录刷新到存储。
此函数必须使以前的数据库查询作生成的任何结果集失效。
例子
以下伪代码显示了此函数的一个可能实现。 该示例未编译。 你必须适应你的目的。
/////////////////////////////////////////////////////////////////////////////////////////
//
// 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;
}
要求
| Requirement | 价值 |
|---|---|
| 最低支持的客户端 | Windows 7 [仅限桌面应用] |
| 支持的最低服务器 | Windows Server 2008 R2 [仅限桌面应用] |
| 目标平台 | Windows操作系统 |
| Header | winbio_adapter.h (包括 Winbio_adapter.h) |