Bagikan melalui


fungsi panggilan balik PIBIO_ENGINE_GET_ENROLLMENT_HASH_FN (winbio_adapter.h)

Dipanggil oleh Windows Biometric Framework untuk mengambil hash templat pendaftaran yang telah selesai di alur.

Sintaks

PIBIO_ENGINE_GET_ENROLLMENT_HASH_FN PibioEngineGetEnrollmentHashFn;

HRESULT PibioEngineGetEnrollmentHashFn(
  [in, out] PWINBIO_PIPELINE Pipeline,
  [out]     PUCHAR *HashValue,
  [out]     PSIZE_T HashSize
)
{...}

Parameter

[in, out] Pipeline

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

[out] HashValue

Alamat variabel yang menerima pointer ke array byte yang berisi hash templat.

[out] HashSize

Penunjuk ke variabel yang menerima ukuran, dalam byte, dari hash yang diacu oleh parameter HashValue .

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_NOTIMPL
Adaptor mesin tidak mendukung pembuatan hash templat.
WINBIO_E_INVALID_DEVICE_STATE
Alur tidak berisi templat pendaftaran yang telah selesai.

Keterangan

Templat yang di-hash oleh fungsi ini harus menjadi templat pendaftaran lengkap yang akan disimpan dalam database ketika EngineAdapterCommitEnrollment dipanggil. Anda tidak boleh hash salah satu sampel perantara yang diambil.

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

Memori yang berisi hash dimiliki dan dikelola oleh adaptor mesin setelah fungsi EngineAdapterGetEnrollmentHash berhasil dikembalikan. Adaptor mesin harus menjaga alamat buffer tetap valid hingga Framework memanggil salah satu fungsi berikut:

Adaptor mesin juga harus mempertahankan buffer hash terpisah untuk setiap alur.

Contoh

Pseudocode berikut menunjukkan salah satu kemungkinan implementasi fungsi ini. Contoh tidak dikompilasi. Kau harus menyesuaikannya sesuai dengan tujuanmu.

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterGetEnrollmentHash
//
// Purpose:
//      Retrieves the hash of the completed enrollment template in the pipeline.
//
// Parameters:
//      Pipeline        - Pointer to a WINBIO_PIPELINE structure associated 
//                        with the biometric unit performing the operation
//      HashValue       - Contains the hash of the template
//      HashSize        - Size, in bytes, of the hash pointed to by the 
//                        HashValue parameter
//
static HRESULT
WINAPI
EngineAdapterGetEnrollmentHash(
    __inout PWINBIO_PIPELINE Pipeline,
    __out PUCHAR *HashValue,
    __out PSIZE_T HashSize
    )
{
    ////////////////////////////////////////////////////////////////////////////
    // Return E_NOTIMPL here if your adapter does not support template hashing.
    ////////////////////////////////////////////////////////////////////////////

    HRESULT hr = S_OK;

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

    // Retrieve the context from the pipeline.
    PWINBIO_ENGINE_CONTEXT context = 
           (PWINBIO_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;
    }

    // Initialize the hash.
    *HashValue = NULL;
    *HashSize = 0;

    // If your engine adapter supports template hashing, call a custom function
    // (_AdapterGenerateHashForTemplate) to calculate the hash of the new
    // enrollment template. The hash value should be saved in the adapter
    // context.
    hr = _AdapterGenerateHashForTemplate(
                context,
                context->Enrollment.Template, 
                context->Enrollment.TemplateSize,
                context->HashBuffer,
                &context->HashSize
                );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Return the hash to the caller.
    *HashValue = context->HashBuffer;
    *HashSize = context->HashSize;

cleanup:

    return hr;
}

Persyaratan

   
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

Fungsi Plug-in