共用方式為


PIBIO_ENGINE_COMMIT_ENROLLMENT_FN 回調函式(winbio_adapter.h)

由 Windows 生物特徵框架呼叫,用來完成註冊物件、轉換成範本,並將範本儲存在資料庫中。

語法

PIBIO_ENGINE_COMMIT_ENROLLMENT_FN PibioEngineCommitEnrollmentFn;

HRESULT PibioEngineCommitEnrollmentFn(
  [in, out]      PWINBIO_PIPELINE Pipeline,
  [in]           PWINBIO_IDENTITY Identity,
  [in]           WINBIO_BIOMETRIC_SUBTYPE SubFactor,
  [in, optional] PUCHAR PayloadBlob,
  [in]           SIZE_T PayloadBlobSize
)
{...}

參數

[in, out] Pipeline

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

[in] Identity

指標指向包含要儲存在資料庫中範本的 GUID 或 SID 的 WINBIO_IDENTITY 結構。

[in] SubFactor

一個 WINBIO_BIOMETRIC_SUBTYPE 值,指定與模板相關的子因子,該子因子要儲存在資料庫中。

[in, optional] PayloadBlob

一個可選的指標指向包含由 Windows 生物特徵框架產生的驗證簽章的位元組陣列。

[in] PayloadBlobSize

PayloadBlob 參數所指向的字元陣列大小(以位元組為單位)。 若 PayloadBlob 參數為 NULL,則此值必須為零。

返回值

如果函式成功,則會傳回S_OK。 若函式失敗,必須回傳以下 HRESULT 值之一或儲存介面卡回傳的任何值。

回傳碼 Description
E_POINTER
必要指標引數為 NULL。
E_INVALIDARG
身份 參數或 子因子 參數所指定的值並不有效。
WINBIO_E_DUPLICATE_ENROLLMENT
身份子因子 參數指定的範本已儲存在資料庫中。
WINBIO_E_INVALID_DEVICE_STATE
管線沒有附帶任何範本。

備註

如果這個函式成功,應該會從管線中清除註冊範本。 此動作的結果應等同於呼叫 EngineAdapterClearContext

如果這個函式失敗,不應該改變引擎上下文的狀態。 特別地,若管線已附帶完成的範本,應能在處理失敗原因後再次呼叫此函式,將範本提交資料庫。

支援開機前認證的引擎介面卡,必須將登錄資料提交至連接管線的儲存卡,還必須提交至開機前儲存區域。 具體如何完成這件事由供應商決定。

Important  

請勿嘗試驗證子 因子 參數所提供的值。 Windows 生物識別服務會在將其交給您的實作前驗證所提供的數值。 如果價值是 WINBIO_SUBTYPE_NO_INFORMATIONWINBIO_SUBTYPE_ANY,則在適當時進行驗證。

 

範例

下列虛擬程式碼顯示此函式的一種可能實作。 此範例不會編譯。 您必須調整它以適應您的目的。

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterCommitEnrollment
//
// Purpose:
//      Finalizes the enrollment object, converts it to a template, and saves 
//      the template in the database.
//
// Parameters:
//      Pipeline        - Pointer to a WINBIO_PIPELINE structure associated 
//                        with the biometric unit performing the operation
//      Identity        - GUID or SID of the template to be stored in the 
//                        database
//      SubFactor       - Sub-factor associated with the template to be stored
//                        in the database
//      PayloadBlob     - Optional pointer to an array of bytes that contain a 
//                        verification signature generated by the Windows Biometric
//                        Framework
//      PayloadBlobSize - Size, in bytes, of the character array pointed to by 
//                        the PayloadBlob parameter
//

static HRESULT
WINAPI
EngineAdapterCommitEnrollment(
    __inout PWINBIO_PIPELINE Pipeline,
    __in PWINBIO_IDENTITY Identity,
    __in WINBIO_BIOMETRIC_SUBTYPE SubFactor,
    __in PUCHAR PayloadBlob,
    __in SIZE_T PayloadBlobSize
    )
{
    HRESULT hr = S_OK;
    DWORD indexVector[NUMBER_OF_TEMPLATE_BINS] = {0};
    WINBIO_REJECT_DETAIL rejectDetail = 0;
    WINBIO_STORAGE_RECORD newTemplate = {0};

    // Verify that pointer arguments are not NULL.
    if (!ARGUMENT_PRESENT(Pipeline) ||
        !ARGUMENT_PRESENT(Identity))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    if (ARGUMENT_PRESENT(PayloadBlob) && PayloadBlobSize == 0)
    {
        hr = E_INVALIDARG;
        goto cleanup;
    }
    
    if (!ARGUMENT_PRESENT(PayloadBlob) && PayloadBlobSize > 0)
    {
        hr = E_INVALIDARG;
        goto cleanup;
    }

    // TODO: Verify that the SubFactor and Identity arguments are valid.

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

    // Return if an enrollment is not in progress. This example assumes that 
    // an enrollment object is part of your engine context structure.
    if (context->Enrollment.InProgress != TRUE)
    {
        hr = WINBIO_E_INVALID_DEVICE_STATE;
        goto cleanup;
    }

    // If your adapter supports index vectors to place templates into buckets,
    // call a custom function (_AdapterCreateIndexVector) to create an index 
    // vector from the template data in the enrollment object.
    hr = _AdapterCreateIndexVector(
                context, 
                context->Enrollment.Template, 
                context->Enrollment.TemplateSize,
                indexVector, 
                NUMBER_OF_TEMPLATE_BINS, 
                &rejectDetail
                );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    newTemplate.Identity = Identity;
    newTemplate.SubFactor = SubFactor;
    newTemplate.IndexVector = indexVector;
    newTemplate.IndexElementCount = NUMBER_OF_TEMPLATE_BINS;
    newTemplate.TemplateBlob = context->Enrollment.Template;
    newTemplate.TemplateBlobSize = context->Enrollment.TemplateSize;
    newTemplate.PayloadBlob = PayloadBlob;
    newTemplate.PayloadBlobSize = PayloadBlobSize;

    hr = WbioStorageAddRecord(
                Pipeline,
                &newTemplate
                );

    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Call a custom function (_AdapterDestroyEnrollmentTemplate) to release
    // any resources held by the enrollment object.
    _AdapterDestroyEnrollmentTemplate(
        context,
        &context->Enrollment
        );

    // Specify that the enrollment process has been completed.
    context->Enrollment.InProgress = FALSE;

cleanup:

    return hr;
}

需求

Requirement 價值觀
最低支援的用戶端 Windows 7 [僅限桌面應用程式]
支援的最低伺服器 Windows Server 2008 R2 [僅限傳統型應用程式]
目標平臺 窗戶
Header winbio_adapter.h(包括Winbio_adapter.h)

另請參閱

引擎轉接器清晰上下文

插件功能