PIBIO_ENGINE_EXPORT_ENGINE_DATA_FN回呼函式 (winbio_adapter.h)

由 Windows 生物特徵辨識架構呼叫,從格式化為標準 WINBIO_BIR 結構的引擎擷取最近處理功能集或範本的複本。

語法

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
)
{...}

參數

[in, out] Pipeline

與執行作業之生物特徵辨識單位相關聯的 WINBIO_PIPELINE 結構的指標。

[in] Flags

值,指定引擎所傳回 之WINBIO_BIR 結構的屬性。 這可以是下列安全性和處理層級旗標的位 OR

WINBIO_DATA_FLAG_PRIVACY

資料會經過加密。

  • WINBIO_DATA_FLAG_INTEGRITY 數據會以數位方式簽署或受到 MAC) (訊息驗證碼保護。

  • WINBIO_DATA_FLAG_SIGNED 如果已設定此旗標和WINBIO_DATA_FLAG_INTEGRITY 旗標,則會簽署數據。 如果未設定此旗標,但已設定WINBIO_DATA_FLAG_INTEGRITY 旗標,則會計算 MAC。

  • WINBIO_DATA_FLAG_RAW 數據的格式是擷取的數據。

  • WINBIO_DATA_FLAG_INTERMEDIATE 數據不是未經處理,但尚未完全處理。

  • WINBIO_DATA_FLAG_PROCESSED 數據已處理。

[out] SampleBuffer

接收包含功能集或範本 之WINBIO_BIR 結構的指標的變數位址。

[out] SampleSize

變數的指標,其中包含 SampleBuffer 參數中傳回之WINBIO_BIR結構的大小,以位元組為單位。

傳回值

如果函式成功,它會傳回S_OK。 如果函式失敗,它必須傳回下列其中一個 HRESULT 值,以指出錯誤。

傳回碼 Description
E_INVALIDARG
引擎配接器不支援 Flags 參數所指定的旗標組合。
E_OUTOFMEMORY
記憶體不足,無法建立 WINBIO_BIR 結構。
E_POINTER
強制指標參數為 NULL
WINBIO_E_INVALID_DEVICE_STATE
管線不包含 Flags 參數所需的數據類型。
E_NOTIMPL
這個方法目前尚未實作。

備註

您必須使用 HeapAlloc 函式,從進程堆積配置要在 SampleBuffer 參數中傳回的緩衝區。 建立緩衝區之後,它會成為 Windows 生物特徵辨識架構的屬性。 因為 Framework 會在使用完記憶體時解除分配此記憶體,所以此函式的實作不得嘗試解除分配緩衝區,或儲存其指標。 藉由不儲存指標,您會防止引擎配接器的其他部分在傳回此函式之後嘗試使用緩衝區。

範例

下列虛擬程式代碼顯示此函式的一個可能實作。 此範例不會編譯。 您必須調整它以符合您的用途。

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

規格需求

需求
最低支援的用戶端 Windows 7 [僅限傳統型應用程式]
最低支援的伺服器 Windows Server 2008 R2 [僅限傳統型應用程式]
目標平台 Windows
標頭 winbio_adapter.h (包含 Winbio_adapter.h)

另請參閱

EngineAdapterAcceptSampleData

外掛程式函式