다음을 통해 공유


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 생체 인식 프레임워크는 특정 캐싱 정책을 의무화하지 않지만 데이터베이스가 메모리 내 레코드 캐시를 유지 관리하는 경우 이 함수는 기록되지 않은 레코드를 스토리지로 플러시해야 합니다.

이 함수는 이전 데이터베이스 쿼리 작업에서 생성된 결과 집합을 무효화해야 합니다.

예제

다음 의사 코드는 이 함수의 가능한 구현 중 하나를 보여 줍니다. 예제는 컴파일되지 않습니다. 목적에 맞게 조정해야 합니다.

/////////////////////////////////////////////////////////////////////////////////////////
//
// 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