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

Lo llama Windows Biometric Framework inmediatamente antes de que se quite un adaptador de motor de la canalización de procesamiento de la unidad biométrica. El propósito de esta función es liberar recursos específicos del adaptador conectados a la canalización.

Sintaxis

PIBIO_ENGINE_DETACH_FN PibioEngineDetachFn;

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

Parámetros

[in, out] Pipeline

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

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_POINTER
El parámetro Pipeline no puede ser NULL.
WINBIO_E_INVALID_DEVICE_STATE
El campo EngineContext de la estructura WINBIO_PIPELINE no puede ser NULL.

Comentarios

Para evitar pérdidas de memoria, la implementación de la función EngineAdapterDetach debe liberar la estructura de WINBIO_ENGINE_CONTEXT privada a la que apunta el miembro EngineContext de la canalización junto con cualquier otro recurso asociado al contexto del motor.

Si el campo EngineContext del objeto de canalización es NULL cuando se llama a esta función, la canalización no se inicializó correctamente y debe devolver WINBIO_E_INVALID_DEVICE_STATE para notificar al marco biométrico de Windows el problema.

Antes de devolver S_OK, la función EngineAdapterDetach debe establecer el campo EngineContext de la estructura de WINBIO_PIPELINE en NULL y el campo EngineHandle en INVALID_HANDLE_VALUE.

Se llama a esta función después de quitar el adaptador de almacenamiento de la canalización. Por lo tanto, esta función no debe llamar a ninguna función a la que hace referencia la estructura WINBIO_STORAGE_INTERFACE a la que apunta el miembro StorageInterface del objeto de canalización.

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.

//////////////////////////////////////////////////////////////////////////////////////////
//
// 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 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

EngineAdapterAttach

Funciones de complemento

SensorAdapterDetach