PIBIO_STORAGE_CLEAR_CONTEXT_FN回调函数 (winbio_adapter.h)

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

语法

PIBIO_STORAGE_CLEAR_CONTEXT_FN PibioStorageClearContextFn;

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

参数

[in, out] Pipeline

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

返回值

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

返回代码 说明
E_POINTER
Pipeline 参数不能为 NULL
WINBIO_E_INVALID_DEVICE_STATE
Pipeline 参数指向的 WINBIO_PIPELINE 结构的 StorageContext 成员为 NULL

注解

应清除以下存储适配器上下文项:

  • 结果集 - 由最新数据库查询操作生成的记录集合。
  • 结果集光标 - 结果集中当前位置的指示器。 这用于循环访问结果集并使单个记录可用。

示例

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

/////////////////////////////////////////////////////////////////////////////////////////
//
// StorageAdapterClearContext
//
// Purpose:
//      Prepare the processing pipeline of the biometric unit for a 
//      new operation.
//
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit performing the operation.
//
static HRESULT
WINAPI
StorageAdapterClearContext(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    HRESULT hr = S_OK;

    // Verify that the Pipeline parameter is not NULL.
    if (!ARGUMENT_PRESENT(Pipeline))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline.
    PWINBIO_STORAGE_CONTEXT storageContext = 
           (PWINBIO_STORAGE_CONTEXT)Pipeline->StorageContext;

    // Verify the pipeline state.
    if (storageContext == NULL)
    {
        hr = WINBIO_E_INVALID_DEVICE_STATE;
        goto cleanup;
    }

    // Release data structures attached to the context. The following
    // example code shows how to release structures that will likely 
    // be associated with your adapter context.
    _ResultSetClearContents(&storageContext->ResultSet);
    if (storageContext->RawRecordData != NULL)
    {
        _AdapterRelease(storageContext->RawRecordData);
        storageContext->RawRecordData = NULL;
        storageContext->PayloadBlob = NULL;
    }
    if (storageContext->DecryptedTemplate != NULL)
    {
        SecureZeroMemory(
            storageContext->DecryptedTemplate, 
            storageContext->DecryptedTemplateSize
            );
        _AdapterRelease(storageContext->DecryptedTemplate);
        storageContext->DecryptedTemplate = NULL;
        storageContext->DecryptedTemplateSize = 0;
    }

    // TODO: Release any other allocated data structures attached
    // to the context (not shown).

cleanup:

    return hr;
}

要求

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

另请参阅

插件函数