由 Windows 生物特徵框架呼叫,以關閉與管線相關的資料庫並釋放所有相關資源。
語法
PIBIO_STORAGE_CLOSE_DATABASE_FN PibioStorageCloseDatabaseFn;
HRESULT PibioStorageCloseDatabaseFn(
[in, out] PWINBIO_PIPELINE Pipeline
)
{...}
參數
[in, out] Pipeline
指向與執行作業的生物特徵辨識單元相關聯的 WINBIO_PIPELINE 結構的指標。
返回值
如果函式成功,則會傳回S_OK。 如果函式失敗,它必須傳回下列其中一個 HRESULT 值,以指出錯誤。
| 回傳碼 | Description |
|---|---|
|
管線參數不能是 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 [僅限傳統型應用程式] |
| 目標平臺 | 窗戶 |
| Header | winbio_adapter.h(包括Winbio_adapter.h) |