Bagikan melalui


fungsi panggilan balik PIBIO_ENGINE_VERIFY_FEATURE_SET_FN (winbio_adapter.h)

Dipanggil oleh Windows Biometric Framework untuk membandingkan templat dalam kumpulan fitur saat ini dengan templat tertentu dalam database. Jika templat setara, adaptor mesin harus mengatur nilai Boolean yang ditunjukkan oleh parameter Cocokkan ke TRUE, mengembalikan templat yang cocok dalam parameter PayloadBlob , dan mengembalikan hash templat dalam parameter HashValue .

Sintaks

PIBIO_ENGINE_VERIFY_FEATURE_SET_FN PibioEngineVerifyFeatureSetFn;

HRESULT PibioEngineVerifyFeatureSetFn(
  [in, out] PWINBIO_PIPELINE Pipeline,
  [in]      PWINBIO_IDENTITY Identity,
  [in]      WINBIO_BIOMETRIC_SUBTYPE SubFactor,
  [out]     PBOOLEAN Match,
  [out]     PUCHAR *PayloadBlob,
  [out]     PSIZE_T PayloadBlobSize,
  [out]     PUCHAR *HashValue,
  [out]     PSIZE_T HashSize,
  [out]     PWINBIO_REJECT_DETAIL RejectDetail
)
{...}

Parameter

[in, out] Pipeline

Penunjuk ke struktur WINBIO_PIPELINE yang terkait dengan unit biometrik yang melakukan operasi.

[in] Identity

Penunjuk ke struktur WINBIO_IDENTITY yang berisi GUID atau SID yang diharapkan cocok dengan templat yang dipulihkan dari database.

[in] SubFactor

Nilai WINBIO_BIOMETRIC_SUBTYPE yang diharapkan cocok dengan templat yang dipulihkan dari database. Lihat bagian Keterangan untuk detail selengkapnya.

[out] Match

Penunjuk ke nilai Boolean yang menentukan apakah parameter Identitas dan SubFactor cocok dengan templat yang dipulihkan dari database. TRUE menentukan bahwa nilai-nilai ini cocok.

[out] PayloadBlob

Alamat variabel yang menerima penunjuk ke data payload yang disimpan dengan templat. Jika tidak ada data payload, atur nilai ini ke NULL.

[out] PayloadBlobSize

Penunjuk ke nilai yang menerima ukuran, dalam byte, dari buffer yang ditentukan dalam parameter PayloadBlob . Jika tidak ada data payload yang disimpan dengan templat, atur nilai ini ke nol.

[out] HashValue

Alamat variabel yang menerima penunjuk ke hash templat. Jika adaptor mesin tidak mendukung pembuatan hash, atur nilai ini ke NULL.

[out] HashSize

Penunjuk ke nilai yang berisi ukuran, dalam byte, dari hash yang ditentukan oleh parameter HashValue . Jika adaptor mesin tidak mendukung pembuatan hash, atur nilai ini ke nol.

[out] RejectDetail

Penunjuk ke nilai WINBIO_REJECT_DETAIL yang menerima informasi tambahan jika kegagalan penangkapan mencegah mesin melakukan operasi pencocokan. Jika pengambilan terbaru berhasil, atur parameter ini ke nol. Nilai berikut didefinisikan untuk pengambilan sidik jari

  • WINBIO_FP_TOO_HIGH
  • WINBIO_FP_TOO_LOW
  • WINBIO_FP_TOO_LEFT
  • WINBIO_FP_TOO_RIGHT
  • WINBIO_FP_TOO_FAST
  • WINBIO_FP_TOO_SLOW
  • WINBIO_FP_POOR_QUALITY
  • WINBIO_FP_TOO_SKEWED
  • WINBIO_FP_TOO_SHORT
  • WINBIO_FP_MERGE_FAILURE

Mengembalikan nilai

Jika fungsi berhasil, fungsi akan mengembalikan S_OK. Jika fungsi gagal, fungsi harus mengembalikan salah satu nilai HRESULT berikut untuk menunjukkan kesalahan.

Menampilkan kode Deskripsi
E_POINTER
Parameter pointer wajib adalah NULL.
E_INVALIDARG
Nilai yang ditentukan dalam parameter SubFactor tidak benar.
WINBIO_E_BAD_CAPTURE
Set fitur tidak memenuhi persyaratan internal adaptor mesin untuk operasi verifikasi. Informasi lebih lanjut tentang kegagalan ditentukan oleh parameter RejectDetail .
WINBIO_E_NO_MATCH
Set fitur dalam alur cocok dengan yang disimpan dalam database tetapi tidak sesuai dengan kombinasi nilai yang diteruskan dalam parameter Identitas dan SubFactor .

Keterangan

Parameter SubFactor menentukan subfaktor yang terkait dengan templat biometrik. Windows Biometric Framework hanya mendukung pengambilan sidik jari dan dapat menggunakan konstanta berikut untuk mewakili informasi subtipe.

  • WINBIO_ANSI_381_POS_RH_THUMB
  • WINBIO_ANSI_381_POS_RH_INDEX_FINGER
  • WINBIO_ANSI_381_POS_RH_MIDDLE_FINGER
  • WINBIO_ANSI_381_POS_RH_RING_FINGER
  • WINBIO_ANSI_381_POS_RH_LITTLE_FINGER
  • WINBIO_ANSI_381_POS_LH_THUMB
  • WINBIO_ANSI_381_POS_LH_INDEX_FINGER
  • WINBIO_ANSI_381_POS_LH_MIDDLE_FINGER
  • WINBIO_ANSI_381_POS_LH_RING_FINGER
  • WINBIO_ANSI_381_POS_LH_LITTLE_FINGER
  • WINBIO_SUBTYPE_ANY
Penting  

Jangan mencoba memvalidasi nilai yang disediakan untuk parameter SubFactor . Layanan Biometrik Windows akan memvalidasi nilai yang disediakan sebelum meneruskannya ke implementasi Anda. Jika nilainya WINBIO_SUBTYPE_NO_INFORMATION atau WINBIO_SUBTYPE_ANY, validasi jika sesuai.

 
Algoritma yang digunakan untuk menghasilkan hash templat adalah yang dipilih oleh panggilan terbaru, pada alur ini, ke fungsi EngineAdapterSetHashAlgorithm .

Nilai hash yang dikembalikan oleh fungsi ini, jika ada, adalah hash templat pendaftaran yang ditemukan dalam database, bukan templat yang cocok yang dilampirkan ke alur.

Buffer PayloadBlob dan HashValue dimiliki dan dikelola oleh adaptor mesin setelah fungsi EngineAdapterIdentifyFeatureSet berhasil dikembalikan. Adaptor mesin harus menjaga alamat buffer tetap valid, untuk alur ini, hingga panggilan berikutnya ke EngineAdapterClearContext.

Contoh

Pseudocode berikut menunjukkan satu kemungkinan implementasi fungsi ini. Contoh tidak dikompilasi. Anda harus menyesuaikannya agar sesuai dengan tujuan Anda.

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterVerifyFeatureSet
//
// Purpose:
//      Compares the template in the current feature set with a specific 
//      template in the database.
//      
// Parameters:
//      Pipeline        - Pointer to a WINBIO_PIPELINE structure associated 
//                        with the biometric unit performing the operation
//      Identity        - GUID or SID that is expected to match that of the 
//                        template recovered from the database
//      SubFactor       - A WINBIO_BIOMETRIC_SUBTYPE value that is expected 
//                        to match that of the template recovered from the 
//                        database
//      Match           - A Boolean value that specifies whether the Identity 
//                        and SubFactor parameters match those of the template
//                        recovered from the database
//      PayloadBlob     - Payload data saved with the template
//      PayloadBlobSize - Size, in bytes, of the buffer specified in the 
//                        PayloadBlob parameter
//      HashValue       - Hash of the template
//      HashSize        - Size, in bytes, of the hash specified by the 
//                        HashValue parameter
//      RejectDetail    - Receives additional information if a capture failure 
//                        prevents the engine from performing a matching operation
// 
static HRESULT
WINAPI
EngineAdapterVerifyFeatureSet(
    __inout PWINBIO_PIPELINE Pipeline,
    __in PWINBIO_IDENTITY Identity,
    __in WINBIO_BIOMETRIC_SUBTYPE SubFactor,
    __out PBOOLEAN Match,
    __out PUCHAR *PayloadBlob,
    __out PSIZE_T PayloadBlobSize,
    __out PUCHAR *HashValue,
    __out PSIZE_T HashSize,
    __out PWINBIO_REJECT_DETAIL RejectDetail
    )
{
    HRESULT hr = S_OK;
    WINBIO_STORAGE_RECORD thisRecord;
    BOOLEAN match = FALSE;
    WINBIO_REJECT_DETAIL rejectDetail = 0;

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

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

    // Initialize the return values.
    *Match              = FALSE;
    *PayloadBlob        = NULL;
    *PayloadBlobSize    = 0;
    *HashValue          = NULL;
    *HashSize           = 0;
    *RejectDetail       = 0;

    // The biometric unit cannot perform verification or identification
    // operations while it is performing an enrollment sequence.
    if (context->Enrollment.InProgress == TRUE)
    {
        hr = WINBIO_E_ENROLLMENT_IN_PROGRESS;
        goto cleanup;
    }

    // Query the storage adapter to determine whether the Identity and 
    // SubFactor combination specified on input are in the database. If
    // they are not, there can be no match. WbioStorageQueryBySubject
    // is a wrapper function defined in the Winbio_adapter.h header file.
    hr = WbioStorageQueryBySubject( Pipeline, Identity, SubFactor);
    if (FAILED(hr))
    {
        if (hr == WINBIO_E_DATABASE_NO_RESULTS)
        {
            hr = WINBIO_E_NO_MATCH;
        }
        goto cleanup;
    }

    // Position the cursor on the first record in the database. 
    // WbioStorageFirstRecord is a wrapper function defined in the 
    // Winbio_adapter.h header file.
    hr = WbioStorageFirstRecord( Pipeline );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Retrieve the current template record for the Identity and SubFactor 
    // combination specified on input. 
    hr = WbioStorageGetCurrentRecord( Pipeline, &thisRecord );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Call a custom function (_AdapterCompareTemplateToCurrentFeatureSet)
    // to compare the feature set attached to the pipeline with the template 
    // retrieved from the database.
    // If the template and feature set do not match, return WINBIO_E_NO_MATCH
    // and set the Match parameter to FALSE.
    // If your custom function cannot process the feature set, return 
    // WINBIO_E_BAD_CAPTURE and set extended error information in the 
    // RejectDetail parameter.
    hr = _AdapterCompareTemplateToCurrentFeatureSet( 
                context, 
                context->FeatureSet,
                context->FeatureSetSize,
                thisRecord.TemplateBlob, 
                thisRecord.TemplateBlobSize,
                &match,
                RejectDetail 
                );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // If there is a match and if your engine adapter supports template
    // hashing, call a custom function (_AdapterGenerateHashForTemplate)
    // to calculate the hash. Save the hash value in the context area of
    // the engine adapter.
    // Skip this step if your adapter does not support template hashing.
    hr = _AdapterGenerateHashForTemplate(
                context,
                thisRecord.TemplateBlob, 
                thisRecord.TemplateBlobSize,
                context->HashBuffer,
                &context->HashSize
                );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Set the return values.
    *Match              = TRUE;
    *PayloadBlob        = thisRecord.PayloadBlob;
    *PayloadBlobSize    = thisRecord.PayloadBlobSize;
    *HashValue          = &context->HashBuffer;
    *HashSize           = context->HashSize;

cleanup:

    if (hr == WINBIO_E_DATABASE_NO_RESULTS)
    {
        hr = WINBIO_E_NO_MATCH;
    }

    return hr;
}

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung Windows 7 [hanya aplikasi desktop]
Server minimum yang didukung Windows Server 2008 R2 [hanya aplikasi desktop]
Target Platform Windows
Header winbio_adapter.h (termasuk Winbio_adapter.h)

Lihat juga

EngineAdapterIdentifyFeatureSet

Fungsi Plug-in