PIBIO_SENSOR_EXPORT_SENSOR_DATA_FN función de devolución de llamada (winbio_adapter.h)
Llamado por Windows Biometric Framework para recuperar una copia de la muestra biométrica capturada más recientemente con formato de estructura estándar WINBIO_BIR .
Sintaxis
PIBIO_SENSOR_EXPORT_SENSOR_DATA_FN PibioSensorExportSensorDataFn;
HRESULT PibioSensorExportSensorDataFn(
[in, out] PWINBIO_PIPELINE Pipeline,
[out] PWINBIO_BIR *SampleBuffer,
[out] PSIZE_T SampleSize
)
{...}
Parámetros
[in, out] Pipeline
Puntero a la estructura de WINBIO_PIPELINE asociada a la unidad biométrica que realiza la operación.
[out] SampleBuffer
Dirección de una variable que recibe un puntero a una estructura de WINBIO_BIR que contiene el ejemplo.
[out] SampleSize
Puntero a una variable que recibe el tamaño, en bytes, del búfer especificado por el parámetro SampleBuffer .
Valor devuelto
Si la función se ejecuta 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 |
---|---|
|
No hay suficiente memoria disponible para crear la estructura WINBIO_BIR . |
|
Un parámetro de puntero obligatorio es NULL. |
|
El miembro SensorContext de la estructura WINBIO_PIPELINE a la que apunta el argumento Pipeline es NULL. |
|
No existe ningún dato de captura. |
|
Este método no se encuentra implementado actualmente. |
Comentarios
Debe asignar el búfer que se va a devolver en el parámetro SampleBuffer desde el montón de procesos mediante la función HeapAlloc . Una vez creado, este búfer se convierte en la propiedad del marco biométrico de Windows. Dado que Framework desasigna esta memoria cuando termine de usarla, 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 siguiente pseudocódigo muestra una posible implementación de esta función. El ejemplo no se compila. Debes adaptarlo para que se adapte a tu propósito.
//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterExportSensorData
//
// Purpose:
// Retrieves a copy of the most recently captured biometric sample.
//
// Parameters:
// Pipeline - Pointer to a WINBIO_PIPELINE structure associated with
// the biometric unit.
// SampleBuffer - Address of a variable that receives a pointer to a
// WINBIO_BIR structure that contains the sample.
// SampleSize - Pointer to a variable that receives the size, in bytes,
// of the buffer specified by the SampleBuffer parameter.
//
static HRESULT
WINAPI
SensorAdapterExportSensorData(
__inout PWINBIO_PIPELINE Pipeline,
__out PWINBIO_BIR *SampleBuffer,
__out SIZE_T *SampleSize
)
{
PWINBIO_BIR sampleBuffer = NULL;
// 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_SENSOR_CONTEXT sensorContext =
(PWINBIO_SENSOR_CONTEXT)Pipeline->SensorContext;
// Verify the state of the pipeline.
if (sensorContext == NULL)
{
return WINBIO_E_INVALID_DEVICE_STATE;
}
// Determine whether there is capture data to return.
if (sensorContext->CaptureBuffer == NULL ||
sensorContext->CaptureBuffer->CaptureData.Size == 0)
{
return WINBIO_E_NO_CAPTURE_DATA;
}
// Allocate a buffer, copy the data into it, and return
// the buffer and buffer size to the caller.
sampleBuffer = _AdapterAlloc(sensorContext->CaptureBuffer->CaptureData.Size);
if (sampleBuffer == NULL)
{
return E_OUTOFMEMORY;
}
RtlCopyMemory(
sampleBuffer,
sensorContext->CaptureBuffer->CaptureData.Data,
sensorContext->CaptureBuffer->CaptureData.Size
);
*SampleBuffer = sampleBuffer;
sampleBuffer = NULL;
*SampleSize = Pipeline->SensorContext->CaptureBuffer->CaptureData.Size;
return S_OK;
}
Requisitos
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
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente GitHub Issues como mecanismo de comentarios sobre el contenido y lo sustituiremos por un nuevo sistema de comentarios. Para más información, vea:Enviar y ver comentarios de