PIBIO_STORAGE_DETACH_FN 콜백 함수(winbio_adapter.h)
스토리지 어댑터가 생체 인식 단위의 처리 파이프라인에서 제거되기 직전에 Windows 생체 인식 프레임워크에서 호출됩니다. 이 함수의 목적은 파이프라인에 연결된 어댑터 특정 리소스를 해제하는 것입니다.
구문
PIBIO_STORAGE_DETACH_FN PibioStorageDetachFn;
HRESULT PibioStorageDetachFn(
[in, out] PWINBIO_PIPELINE Pipeline
)
{...}
매개 변수
[in, out] Pipeline
작업을 수행하는 생체 인식 단위와 연결된 WINBIO_PIPELINE 구조체에 대한 포인터입니다.
반환 값
함수가 성공하면 S_OK를 반환합니다. 함수가 실패하면 다음 HRESULT 값 중 하나를 반환하여 오류를 나타내야 합니다.
반환 코드 | 설명 |
---|---|
|
Pipeline 매개 변수는 NULL일 수 없습니다. |
|
WINBIO_PIPELINE 구조체의 StorageContext 필드는 NULL일 수 없습니다. |
설명
메모리 누수 방지를 위해 StorageAdapterDetach 함수의 구현은 스토리지 컨텍스트에 연결된 다른 리소스와 함께 파이프라인의 StorageContext 멤버가 가리키는 프라이빗 WINBIO_STORAGE_CONTEXT 구조를 해제해야 합니다.
이 함수가 호출될 때 파이프라인 개체의 StorageContext 필드가 NULL 이면 파이프라인이 제대로 초기화되지 않았으며 WINBIO_E_INVALID_DEVICE_STATE 반환하여 Windows 생체 인식 프레임워크에 문제를 알려야 합니다.
S_OK 반환하기 전에 이 함수는 WINBIO_PIPELINE 구조체의 StorageContext 필드를 NULL로 설정하고 StorageHandle 필드를 INVALID_HANDLE_VALUE.
예제
다음 의사 코드는 이 함수의 가능한 구현 중 하나를 보여 줍니다. 예제는 컴파일되지 않습니다. 목적에 맞게 조정해야 합니다.
/////////////////////////////////////////////////////////////////////////////////////////
//
// 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;
}
요구 사항
요구 사항 | 값 |
---|---|
지원되는 최소 클라이언트 | Windows 7 [데스크톱 앱만 해당] |
지원되는 최소 서버 | Windows Server 2008 R2 [데스크톱 앱만 해당] |
대상 플랫폼 | Windows |
헤더 | winbio_adapter.h(Winbio_adapter.h 포함) |