PIBIO_ENGINE_DETACH_FN função de retorno de chamada (winbio_adapter.h)

Chamado pela Estrutura Biométrica do Windows imediatamente antes de um adaptador de mecanismo ser removido do pipeline de processamento da unidade biométrica. A finalidade dessa função é liberar recursos específicos do adaptador anexados ao pipeline.

Sintaxe

PIBIO_ENGINE_DETACH_FN PibioEngineDetachFn;

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

Parâmetros

[in, out] Pipeline

Ponteiro para uma estrutura WINBIO_PIPELINE associada à unidade biométrica que executa a operação.

Retornar valor

Se a função for bem-sucedida, ela retornará S_OK. Se a função falhar, ela deverá retornar um dos seguintes valores HRESULT para indicar o erro.

Código de retorno Descrição
E_POINTER
O parâmetro Pipeline não pode ser NULL.
WINBIO_E_INVALID_DEVICE_STATE
O campo EngineContext da estrutura WINBIO_PIPELINE não pode ser NULL.

Comentários

Para evitar vazamentos de memória, a implementação da função EngineAdapterDetach deve liberar a estrutura de WINBIO_ENGINE_CONTEXT privada apontada pelo membro EngineContext do pipeline, juntamente com outros recursos anexados ao contexto do mecanismo.

Se o campo EngineContext no objeto de pipeline for NULL quando essa função for chamada, o pipeline não foi inicializado corretamente e você deverá retornar WINBIO_E_INVALID_DEVICE_STATE para notificar a Estrutura Biométrica do Windows sobre o problema.

Antes de retornar S_OK, a função EngineAdapterDetach deve definir o campo EngineContext da estrutura WINBIO_PIPELINE como NULL e o campo EngineHandle como INVALID_HANDLE_VALUE.

Essa função é chamada depois que o adaptador de armazenamento é removido do pipeline. Portanto, essa função não deve chamar nenhuma função referenciada pela estrutura WINBIO_STORAGE_INTERFACE apontada pelo membro StorageInterface do objeto de pipeline.

Exemplos

O pseudocódigo a seguir mostra uma implementação possível dessa função. O exemplo não é compilado. Você deve adaptá-lo para se adequar ao seu propósito.

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterDetach
//
// Purpose:
//      Releases adapter specific resources attached to the pipeline.
//      
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//
static HRESULT
WINAPI
EngineAdapterDetach(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    PWINBIO_ENGINE_CONTEXT context = NULL;

    // Verify that the Pipeline parameter is not NULL.
    if (!ARGUMENT_PRESENT(Pipeline))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline and assign it to a local
    // variable.
    context = (PWINBIO_ENGINE_CONTEXT)Pipeline->EngineContext;
    if (context == NULL)
    {
        goto cleanup;
    }

    // Set the context on the pipeline to NULL.
    Pipeline->EngineContext = NULL;

    // If your adapter supports software-based template hashing and you
    // opened a Cryptography Next Generation (CNG) hash object handle
    // during initialization, implement the following custom function to 
    // release the CNG resources.
    _AdapterCleanupCrypto(context);

    // Implement one or more custom routines to release any structures 
    // that remain attached to the context block. These structures can 
    // include the most recent feature set, the current enrollment template, 
    // and other custom defined objects.
    if (context->FeatureSet != NULL)
    {
        _AdapterRelease(context->FeatureSet);
        context->FeatureSet = NULL;
        context->FeatureSetSize = 0;
    }

    if (context->Enrollment.Template != NULL)
    {
        _AdapterRelease(context->Enrollment.Template);
        context->Enrollment.Template = NULL;
        context->Enrollment.TemplateSize = 0;
        context->Enrollment.SampleCount = 0;
    }

    if (context->SomePointerField != NULL)
    {
        _AdapterRelease(context->SomePointerField);
        context->SomePointerField = NULL;
    }

    // Release the context block.
    _AdapterRelease(context);

cleanup:

    return S_OK;
}

Requisitos

Requisito Valor
Cliente mínimo com suporte Windows 7 [somente aplicativos da área de trabalho]
Servidor mínimo com suporte Windows Server 2008 R2 [somente aplicativos da área de trabalho]
Plataforma de Destino Windows
Cabeçalho winbio_adapter.h (inclua Winbio_adapter.h)

Confira também

EngineAdapterAttach

Funções de plug-in

SensorAdapterDetach