다음을 통해 공유


PIBIO_SENSOR_CLEAR_CONTEXT_FN 콜백 함수(winbio_adapter.h)

새 작업을 위해 생체 인식 단위의 처리 파이프라인을 준비하기 위해 Windows 생체 인식 프레임워크에서 호출됩니다. 이 함수는 센서 컨텍스트에서 임시 데이터를 플러시하고 센서 어댑터를 잘 정의된 초기 상태로 배치해야 합니다.

구문

PIBIO_SENSOR_CLEAR_CONTEXT_FN PibioSensorClearContextFn;

HRESULT PibioSensorClearContextFn(
  [in, out] PWINBIO_PIPELINE Pipeline
)
{...}

매개 변수

[in, out] Pipeline

작업을 수행하는 생체 인식 단위와 연결된 WINBIO_PIPELINE 구조체에 대한 포인터입니다.

반환 값

함수가 성공하면 S_OK를 반환합니다. 함수가 실패하면 다음 HRESULT 값 중 하나를 반환하여 오류를 나타내야 합니다.

반환 코드 설명
E_POINTER
Pipeline 인수는 NULL일 수 없습니다.

설명

SensorAdapterClearContext 함수를 구현하면 샘플 버퍼가 지워져야 합니다.

예제

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

//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterClearContext
//
// Purpose:
//      Prepare the processing pipeline for a new operation. This function 
//      should flush temporary data from the sensor context and place the 
//      sensor adapter into a well-defined initial state.
//      
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//
static HRESULT
WINAPI
SensorAdapterClearContext(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    // Verify that the Pipeline parameter is not NULL.
    if (!ARGUMENT_PRESENT(Pipeline))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline.
    PWINBIO_SENSOR_CONTEXT sensorContext = 
        (PWINBIO_SENSOR_CONTEXT)Pipeline->SensorContext;

    // Validate the current state of the sensor.
    if (sensorContext == NULL)
    {
        return WINBIO_E_INVALID_DEVICE_STATE;
    }

    // Change the sensor adapter state and discard any partially completed
    // operations. Depending on the adapter, this can involve changes to state 
    // variables or actions implemented in hardware. The following example
    // assumes that your sensor adapter context contains a ULONG data member 
    // and pointers to a capture buffer and an attributes buffer.

    sensorContext->SomeField = 0L;

    if (sensorContext->CaptureBuffer != NULL)
    {
        // Zero the capture buffer.
        SecureZeroMemory(
            sensorContext->CaptureBuffer,
            sensorContext->CaptureBufferSize);

        // Release the capture buffer.
        _AdapterRelease(sensorContext->CaptureBuffer);
        sensorContext->CaptureBuffer = NULL;
        sensorContext->CaptureBufferSize = 0;
    }

    if (sensorContext->AttributesBuffer != NULL)
    {
        // Zero the attributes buffer.
        SecureZeroMemory(
            sensorContext->AttributesBuffer,
            sensorContext->AttributesBufferSize);

        // Release the attributes buffer.
        _AdapterRelease(sensorContext->AttributesBuffer);
        sensorContext->AttributesBuffer = NULL;
        sensorContext->AttributesBufferSize = 0;
    }

    // TODO: Perform any other work required to clear the sensor context.

    return S_OK;
}

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows 7 [데스크톱 앱만 해당]
지원되는 최소 서버 Windows Server 2008 R2 [데스크톱 앱만 해당]
대상 플랫폼 Windows
헤더 winbio_adapter.h(Winbio_adapter.h 포함)

추가 정보

EngineAdapterClearContext

플러그 인 함수

StorageAdapterClearContext