Share via


PIBIO_ENGINE_EXPORT_ENGINE_DATA_FN función de devolución de llamada (winbio_adapter.h)

Lo llama Windows Biometric Framework para recuperar una copia del conjunto de características o la plantilla procesados más recientemente del motor con formato de estructura de WINBIO_BIR estándar.

Sintaxis

PIBIO_ENGINE_EXPORT_ENGINE_DATA_FN PibioEngineExportEngineDataFn;

HRESULT PibioEngineExportEngineDataFn(
  [in, out] PWINBIO_PIPELINE Pipeline,
  [in]      WINBIO_BIR_DATA_FLAGS Flags,
  [out]     PWINBIO_BIR *SampleBuffer,
  [out]     PSIZE_T SampleSize
)
{...}

Parámetros

[in, out] Pipeline

Puntero a una estructura de WINBIO_PIPELINE asociada a la unidad biométrica que realiza la operación.

[in] Flags

Valor que especifica las propiedades de la estructura WINBIO_BIR devuelta por el motor. Puede ser un OR bit a bit de las siguientes marcas de nivel de seguridad y procesamiento:

WINBIO_DATA_FLAG_PRIVACY

Los datos se cifran.

  • WINBIO_DATA_FLAG_INTEGRITY Los datos están firmados digitalmente o protegidos por un código de autenticación de mensajes (MAC).

  • WINBIO_DATA_FLAG_SIGNED Si se establece esta marca y la marca WINBIO_DATA_FLAG_INTEGRITY , se firman los datos. Si no se establece esta marca, pero se establece la marca WINBIO_DATA_FLAG_INTEGRITY , se calcula un MAC.

  • WINBIO_DATA_FLAG_RAW Los datos están en el formato con el que se capturó.

  • WINBIO_DATA_FLAG_INTERMEDIATE Los datos no son sin procesar, pero no se han procesado por completo.

  • WINBIO_DATA_FLAG_PROCESSED Los datos se han procesado.

[out] SampleBuffer

Dirección de una variable que recibe un puntero a una estructura de WINBIO_BIR que contiene el conjunto de características o la plantilla.

[out] SampleSize

Puntero a una variable que contiene el tamaño, en bytes, de la estructura WINBIO_BIR devuelta en el parámetro SampleBuffer .

Valor devuelto

Si la función se realiza correctamente, devuelve S_OK. Si se produce un error en la función, debe devolver uno de los siguientes valores HRESULT para indicar el error.

Código devuelto Descripción
E_INVALIDARG
El adaptador del motor no admite la combinación de marcas especificadas por el parámetro Flags .
E_OUTOFMEMORY
No hay suficiente memoria disponible para crear la estructura de WINBIO_BIR .
E_POINTER
Un parámetro de puntero obligatorio es NULL.
WINBIO_E_INVALID_DEVICE_STATE
La canalización no contiene el tipo de datos requeridos por el parámetro Flags .
E_NOTIMPL
Este método no se encuentra implementado actualmente.

Comentarios

Debe asignar el búfer que se va a devolver en el parámetro SampleBuffer del montón de procesos mediante la función HeapAlloc . Una vez creado el búfer, se convierte en la propiedad del marco biométrico de Windows. Dado que Framework desasigna esta memoria cuando termine de usarlo, la implementación de esta función no debe intentar desasignar el búfer ni guardarle un puntero. Al no guardar el puntero, se impide que otras partes del adaptador del motor intenten usar el búfer después de que esta función devuelva.

Ejemplos

El pseudocódigo siguiente muestra una posible implementación de esta función. El ejemplo no se compila. Debes adaptarlo para adaptarlo a tu propósito.

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterExportEngineData
//
// Purpose:
//      Retrieves a copy of the most recently processed feature set or template.
//
// Parameters:
//      Pipeline        - Pointer to a WINBIO_PIPELINE structure associated 
//                        with the biometric unit performing the operation
//      Flags           - Security and processing level flags
//      SampleBuffer    - Contains the feature set or template
//      SampleSize      - Size, in bytes, of the structure returned in the 
//                        SampleBuffer parameter.
//
static HRESULT
WINAPI
EngineAdapterExportEngineData(
    __inout PWINBIO_PIPELINE Pipeline,
    __in WINBIO_BIR_DATA_FLAGS Flags,
    __out PWINBIO_BIR *SampleBuffer,
    __out PSIZE_T SampleSize
    )
{
    HRESULT hr = S_OK;
    PWINBIO_BIR birAddress = NULL;
    SIZE_T birSize = 0;

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

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

    // At least one processing level flag must be set. Your adapter can also
    // place additional restrictions on supported export formats.
    if (Flags & (WINBIO_DATA_FLAG_RAW | 
                 WINBIO_DATA_FLAG_INTERMEDIATE | 
                 WINBIO_DATA_FLAG_PROCESSED) == 0)
    {
        hr = E_INVALIDARG;
        goto cleanup;
    }

    // You must implement the _CreateBirFromAdapterData function to extract
    // data from the engine context and create a new WINBIO_BIR structure. The
    // function passes ownership of the new biometric information record (BIR)
    // to the EngineAdapterExportEngineData routine which then passes the BIR
    // to the caller.
    hr = _CreateBirFromAdapterData( context, Flags, &birAddress, &birSize);
    if (SUCCEEDED(hr))
    {
        *SampleBuffer = birAddress;
        *SampleSize = birSize;
    }

cleanup:

    return hr;
}

Requisitos

Requisito Value
Cliente mínimo compatible Windows 7 [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows Server 2008 R2 [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado winbio_adapter.h (incluya Winbio_adapter.h)

Consulte también

EngineAdapterAcceptSampleData

Funciones de complemento