Share via


WinBioEnumServiceProviders 函式 (winbio.h)

擷取已安裝生物特徵辨識服務提供者的相關信息。 從 Windows 10 組建 1607 開始,此函式可用來搭配行動映射使用。

語法

HRESULT WinBioEnumServiceProviders(
  [in]  WINBIO_BIOMETRIC_TYPE Factor,
  [out] WINBIO_BSP_SCHEMA     **BspSchemaArray,
  [out] SIZE_T                *BspCount
);

參數

[in] Factor

WINBIO_BIOMETRIC_TYPE旗標的位掩碼,指定要列舉的生物特徵辨識單位類型。 目前僅支援 WINBIO_TYPE_FINGERPRINT

[out] BspSchemaArray

可接收 WINBIO_BSP_SCHEMA結構數位 指標的變數位址,其中包含每個可用服務提供者的相關信息。 如果函式不成功,指標會設定為 NULL。 如果函式成功,您必須將指標傳遞至 WinBioFree ,以釋放內部配置給數位的記憶體。

[out] BspCount

值的指標,指定 BspSchemaArray 參數所指向的結構數目。

傳回值

如果函式成功,它會傳回S_OK。 如果函式失敗,它會傳回 HRESULT 值,指出錯誤。 可能的值包括 (但不限於) 下表中的這些值。 如需常見錯誤碼的清單,請參閱 一般 HRESULT 值

傳回碼 Description
E_INVALIDARG
Factor 參數中包含的位掩碼包含一或多個無效的類型位。
E_OUTOFMEMORY
記憶體不足,無法完成要求。
E_POINTER
BspSchemaArrayBspCount 參數不能是 NULL

備註

Factor 參數目前僅支援WINBIO_TYPE_FINGERPRINT

使用傳回至 BspSchemaArray 參數的結構之後,您必須呼叫 WinBioFree ,以釋放內部配置給數位的記憶體。

如果 Factor 位掩碼中的所有因素位都參考不支援的生物特徵辨識類型,則函式會傳回S_OK但 BspSchemaArray 參數所指向的值會是 NULL而 BspCount 參數將包含零。 雖然查詢不支援生物特徵辨識因素並無錯誤,但查詢的結果將會是空的集合。

範例

下列程式代碼範例會呼叫 WinBioEnumServiceProviders 來列舉已安裝的服務提供者。 此範例也包含顯示提供者標識碼的函式 DisplayGuid。 連結到Winbio.lib 靜態庫,並包含下列頭檔:

  • Windows.h
  • Stdio.h
  • Conio.h
  • Winbio.h
HRESULT EnumSvcProviders( )
{
    // Declare variables.
    HRESULT hr = S_OK;
    PWINBIO_BSP_SCHEMA bspSchemaArray = NULL;
    SIZE_T bspCount = 0;
    SIZE_T index = 0;

    // Enumerate the service providers.
    hr = WinBioEnumServiceProviders( 
            WINBIO_TYPE_FINGERPRINT,    // Provider to enumerate
            &bspSchemaArray,            // Provider schema array
            &bspCount );                // Number of schemas returned
    if (FAILED(hr))
    {
        wprintf_s(L"\n WinBioEnumServiceProviders failed. hr = 0x%x\n", hr);
        goto e_Exit;
    }

    // Display the schema information.
    wprintf_s(L"\nService providers: \n");
    for (index = 0; index < bspCount; ++index)
    {
        wprintf_s(L"\n[%d]: \tBiometric factor: 0x%08x\n", 
                 index, 
                 bspSchemaArray[index].BiometricFactor );
        
        wprintf_s(L"\tBspId: ");
        DisplayGuid(&bspSchemaArray[index].BspId);
        wprintf_s(L"\n");

        wprintf_s(L"\tDescription: %ws\n", 
                 bspSchemaArray[index].Description);
        wprintf_s(L"\tVendor: %ws\n", 
                 bspSchemaArray[index].Vendor );
        wprintf_s(L"\tVersion: %d.%d\n", 
                 bspSchemaArray[index].Version.MajorVersion, 
                 bspSchemaArray[index].Version.MinorVersion);

        wprintf_s(L"\n");
    } 

e_Exit:
    if (bspSchemaArray != NULL)
    {
        WinBioFree(bspSchemaArray);
        bspSchemaArray = NULL;
    }

    wprintf_s(L"\nPress any key to exit...");
    _getch();

    return hr;
}

//------------------------------------------------------------------------
// The following function displays a GUID to the console window.
//
VOID DisplayGuid( __in PWINBIO_UUID Guid )
{
    wprintf_s(
        L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
        Guid->Data1,
        Guid->Data2,
        Guid->Data3,
        Guid->Data4[0],
        Guid->Data4[1],
        Guid->Data4[2],
        Guid->Data4[3],
        Guid->Data4[4],
        Guid->Data4[5],
        Guid->Data4[6],
        Guid->Data4[7]
        );
}


規格需求

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

另請參閱

WinBioEnumBiometricUnits

WinBioEnumDatabases

WinBioEnumEnrollments