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

Chamado pela Estrutura Biométrica do Windows para recuperar o hash do modelo de registro concluído no pipeline.

Sintaxe

PIBIO_ENGINE_GET_ENROLLMENT_HASH_FN PibioEngineGetEnrollmentHashFn;

HRESULT PibioEngineGetEnrollmentHashFn(
  [in, out] PWINBIO_PIPELINE Pipeline,
  [out]     PUCHAR *HashValue,
  [out]     PSIZE_T HashSize
)
{...}

Parâmetros

[in, out] Pipeline

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

[out] HashValue

Endereço da variável que recebe um ponteiro para uma matriz de bytes que contém o hash do modelo.

[out] HashSize

Um ponteiro para uma variável que recebe o tamanho, em bytes, do hash apontado pelo parâmetro HashValue .

Valor retornado

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
Um parâmetro de ponteiro obrigatório é NULL.
E_NOTIMPL
O adaptador do mecanismo não dá suporte à geração de hash de modelo.
WINBIO_E_INVALID_DEVICE_STATE
O pipeline não contém um modelo de registro concluído.

Comentários

O modelo hash dessa função deve ser o modelo de registro concluído que será armazenado no banco de dados quando EngineAdapterCommitEnrollment for chamado. Você não deve hash de uma das amostras capturadas intermediárias.

O algoritmo usado para gerar o hash de modelo é aquele que foi selecionado pela chamada mais recente, neste pipeline, para EngineAdapterSetHashAlgorithm.

A memória que contém o hash pertence e é gerenciada pelo adaptador do mecanismo depois que a função EngineAdapterGetEnrollmentHash retorna com êxito. O adaptador do mecanismo deve manter o endereço buffer válido até que a Estrutura chame qualquer uma das seguintes funções:

O adaptador do mecanismo também deve manter um buffer de hash separado para cada pipeline.

Exemplos

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

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterGetEnrollmentHash
//
// Purpose:
//      Retrieves the hash of the completed enrollment template in the pipeline.
//
// Parameters:
//      Pipeline        - Pointer to a WINBIO_PIPELINE structure associated 
//                        with the biometric unit performing the operation
//      HashValue       - Contains the hash of the template
//      HashSize        - Size, in bytes, of the hash pointed to by the 
//                        HashValue parameter
//
static HRESULT
WINAPI
EngineAdapterGetEnrollmentHash(
    __inout PWINBIO_PIPELINE Pipeline,
    __out PUCHAR *HashValue,
    __out PSIZE_T HashSize
    )
{
    ////////////////////////////////////////////////////////////////////////////
    // Return E_NOTIMPL here if your adapter does not support template hashing.
    ////////////////////////////////////////////////////////////////////////////

    HRESULT hr = S_OK;

    // Verify that pointer arguments are not NULL.
    if (!ARGUMENT_PRESENT(Pipeline) ||
        !ARGUMENT_PRESENT(HashValue) ||
        !ARGUMENT_PRESENT(HashSize))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline.
    PWINBIO_ENGINE_CONTEXT context = 
           (PWINBIO_ENGINE_CONTEXT)Pipeline->EngineContext;

    // Return if an enrollment is not in progress. This example assumes that 
    // an enrollment object is part of your engine context structure.
    if (context->Enrollment.InProgress != TRUE)
    {
        hr = WINBIO_E_INVALID_DEVICE_STATE;
        goto cleanup;
    }

    // Initialize the hash.
    *HashValue = NULL;
    *HashSize = 0;

    // If your engine adapter supports template hashing, call a custom function
    // (_AdapterGenerateHashForTemplate) to calculate the hash of the new
    // enrollment template. The hash value should be saved in the adapter
    // context.
    hr = _AdapterGenerateHashForTemplate(
                context,
                context->Enrollment.Template, 
                context->Enrollment.TemplateSize,
                context->HashBuffer,
                &context->HashSize
                );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Return the hash to the caller.
    *HashValue = context->HashBuffer;
    *HashSize = context->HashSize;

cleanup:

    return hr;
}

Requisitos

   
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

Funções de plug-in