PIBIO_ENGINE_CLEAR_CONTEXT_FN回调函数 (winbio_adapter.h)

由 Windows 生物识别框架调用,为新操作准备生物识别单元的处理管道。 此函数应从引擎上下文中刷新临时数据,并将引擎适配器置于定义完善的初始状态。

语法

PIBIO_ENGINE_CLEAR_CONTEXT_FN PibioEngineClearContextFn;

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

参数

[in, out] Pipeline

指向与执行操作的生物识别单元关联的 WINBIO_PIPELINE 结构的指针。

返回值

如果函数成功,则返回S_OK。 如果函数失败,它必须返回以下 HRESULT 值之一来指示错误。

返回代码 说明
E_POINTER
Pipeline 参数不能为 NULL

注解

此函数的此用途是将上下文重置为调用 EngineAdapterAttach 函数后立即处于的状态。 上下文是一个可重用结构。 EngineAdapterClearContext 函数重新初始化上下文,但不将其从管道中删除。

引擎适配器上下文区域中应清除的对象的典型示例包括以下内容。

Object 说明
特征集 包含生物识别示例的说明
注册 跟踪注册事务的当前状态。
模板 功能集或注册对象创建的生物识别模板。
比较 包含模板与功能集之间的比较结果。
索引向量 包含一组与模板关联的索引值。
 

示例

以下伪代码演示了此函数的一种可能实现。 该示例不编译。 必须根据自己的目的调整它。

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterClearContext
//
// Purpose:
//      Prepares the processing pipeline of the biometric unit for a 
//      new operation.
//
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//
static HRESULT
WINAPI
EngineAdapterClearContext(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    // Verify that the Pipeline parameter is not NULL.
    if (!ARGUMENT_PRESENT(Pipeline))
    {
        hr = E_POINTER;
        goto cleanup;
    }

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

    if (context == NULL)
    {
        goto cleanup;
    }

    // Change the engine adapter state and discard any partially completed
    // operations. Depending on the adapter, this can involve changes to state 
    // variables or actions implemented in hardware. The following example
    // assumes that your engine adapter context contains a ULONG data member 
    // and pointers to a feature set and an enrollment object.

    context->SomeField = 0L;

    if (context->FeatureSet != NULL)
    {
        // Zero the feature set if it contains unencrypted biometric data.
        SecureZeroMemory(
            context->FeatureSet,
            context->FeatureSetSize);

        // Release the feature set.
        _AdapterRelease(context->FeatureSet);
        context->FeatureSet = NULL;
        context->FeatureSetSize = 0;
    }

    if (context->Enrollment.Template != NULL)
    {
        // Zero the template if it contains unencrypted biometric data.
        SecureZeroMemory(
            context->Enrollment.Template,
            context->Enrollment.TemplateSize);

        // Release the template.
        _AdapterRelease(context->Enrollment.Template);
        context->Enrollment.Template = NULL;
        context->Enrollment.TemplateSize = 0;

        // Release other data members attached to the enrollment object.
        context->Enrollment.SampleCount = 0;
        context->Enrollment.InProgress = FALSE;
    }

cleanup:

    return S_OK;
}

要求

要求
最低受支持的客户端 Windows 7 [仅限桌面应用]
最低受支持的服务器 Windows Server 2008 R2 [仅限桌面应用]
目标平台 Windows
标头 winbio_adapter.h (包括 Winbio_adapter.h)

另请参阅

插件函数

SensorAdapterClearContext

StorageAdapterClearContext