다음을 통해 공유


WinBioEnrollCapture 함수(winbio.h)

생체 인식 샘플을 캡처하고 템플릿에 추가합니다. Windows 10 빌드 1607부터 이 함수를 모바일 이미지와 함께 사용할 수 있습니다.

구문

HRESULT WinBioEnrollCapture(
  [in]            WINBIO_SESSION_HANDLE SessionHandle,
  [out, optional] WINBIO_REJECT_DETAIL  *RejectDetail
);

매개 변수

[in] SessionHandle

열린 생체 인식 세션을 식별하는 WINBIO_SESSION_HANDLE 값입니다. WinBioOpenSession을 호출하여 동기 세션 핸들을 엽니다. WinBioAsyncOpenSession을 호출하여 비동기 세션 핸들을 엽니다.

[out, optional] RejectDetail

생체 인식 샘플을 캡처하지 못한 추가 정보가 포함된 ULONG 값에 대한 포인터입니다. 캡처에 성공하면 이 매개 변수가 0으로 설정됩니다. 지문 캡처에 대해 정의된 값은 다음과 같습니다.

  • 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

반환 값

함수가 성공하면 S_OK를 반환합니다. 함수가 실패하면 오류를 나타내는 HRESULT 값을 반환합니다. 가능한 값에는 다음 표에 있는 값이 포함되지만, 이에 국한되는 것은 아닙니다. 일반적인 오류 코드 목록은 일반 HRESULT 값을 참조하세요.

반환 코드 설명
E_ACCESSDENIED
호출 계정은 등록을 수행할 수 없습니다.
E_HANDLE
세션 핸들이 잘못되었습니다.
E_POINTER
RejectDetail 매개 변수로 지정된 포인터는 NULL일 수 없습니다.
WINBIO_E_BAD_CAPTURE
샘플을 캡처할 수 없습니다. 자세한 내용은 RejectDetail 값을 사용합니다.
WINBIO_E_LOCK_VIOLATION
생체 인식 단위가 사용 중이며 잠겨 있습니다.
WINBIO_I_MORE_DATA
일치하는 엔진은 신뢰할 수 있는 템플릿을 생성하기 위해 하나 이상의 추가 샘플이 필요합니다. 사용자에게 더 많은 샘플을 제출하고 WinBioEnrollCapture 를 다시 호출하도록 지침을 업데이트해야 합니다.

설명

시스템 풀에서 생체 인식 단위를 사용하여 등록하는 모든 애플리케이션은 WinBioEnrollBegin을 호출할 때 창 포커스가 있어야 합니다. 그렇지 않으면 애플리케이션이 창 포커스를 획득하고 사용자가 생체 인식 샘플을 제공할 때까지 호출이 차단됩니다. 따라서 애플리케이션이 포커스를 획득할 때까지 WinBioEnrollBegin 을 호출하지 않는 것이 좋습니다. 포커스를 얻는 방법은 작성 중인 애플리케이션의 유형에 따라 달라집니다. 예를 들어 GUI 애플리케이션을 만드는 경우 WM_ACTIVATE, WM_SETFOCUS 또는 기타 적절한 메시지를 캡처하는 메시지 처리기를 구현할 수 있습니다. CUI 애플리케이션을 작성하는 경우 GetConsoleWindow 를 호출하여 콘솔 창에 대한 핸들을 검색하고 해당 핸들을 SetForegroundWindow 함수에 전달하여 콘솔 창을 포그라운드로 강제 적용하고 포커스를 할당합니다. 애플리케이션이 분리된 프로세스에서 실행 중이고 창이 없거나 Windows 서비스인 경우 WinBioAcquireFocusWinBioReleaseFocus 를 사용하여 수동으로 포커스를 제어합니다.

WinBioEnrollCapture를 동기적으로 사용하려면 WinBioOpenSession을 호출하여 만든 세션 핸들을 사용하여 함수를 호출합니다. 함수는 작업이 완료되거나 오류가 발생할 때까지 차단됩니다.

WinBioEnrollCapture를 비동기적으로 사용하려면 WinBioAsyncOpenSession을 호출하여 만든 세션 핸들을 사용하여 함수를 호출합니다. 프레임워크는 WINBIO_ASYNC_RESULT 구조를 할당하고 이를 사용하여 작업 성공 또는 실패에 대한 정보를 반환합니다. 작업이 실패하면 프레임워크는 중첩된 EnrollCapture 구조에 WINBIO_REJECT_DETAIL 정보를 반환합니다. WINBIO_ASYNC_RESULT 구조체는 WinBioAsyncOpenSession 함수의 NotificationMethod 매개 변수에 설정한 값에 따라 애플리케이션 콜백 또는 애플리케이션 메시지 큐에 반환됩니다.

  • 콜백을 사용하여 완료 알림을 수신하도록 선택하는 경우 PWINBIO_ASYNC_COMPLETION_CALLBACK 함수를 구현하고 NotificationMethod 매개 변수를 WINBIO_ASYNC_NOTIFY_CALLBACK 설정해야 합니다.
  • 애플리케이션 메시지 큐를 사용하여 완료 알림을 수신하도록 선택하는 경우 NotificationMethod 매개 변수를 WINBIO_ASYNC_NOTIFY_MESSAGE 설정해야 합니다. 프레임워크는 창 메시지의 LPARAM 필드에 대한 WINBIO_ASYNC_RESULT 포인터를 반환합니다.
메모리 누수 방지를 위해 콜백 구현에서 WinBioFree 를 호출하여 사용을 완료한 후 WINBIO_ASYNC_RESULT 구조를 해제해야 합니다.

Windows 7: WinBioEnrollCaptureWithCallback 함수를 사용하여 이 작업을 비동기적으로 수행할 수 있습니다. 함수는 입력 인수를 확인하고 즉시 를 반환합니다. 입력 인수가 유효하지 않으면 함수는 오류 코드를 반환합니다. 그렇지 않으면 프레임워크가 다른 스레드에서 작업을 시작합니다. 비동기 작업이 완료되거나 오류가 발생하면 프레임워크는 애플리케이션에서 구현한 PWINBIO_ENROLL_CAPTURE_CALLBACK 함수로 결과를 보냅니다.

예제

다음 함수는 WinBioEnrollCapture를 호출하여 시스템 풀에 생체 인식 템플릿을 등록합니다. Winbio.lib 정적 라이브러리에 연결하고 다음 헤더 파일을 포함합니다.

  • Windows.h
  • Stdio.h
  • Conio.h
  • Winbio.h
HRESULT EnrollSysPool(
                      BOOL discardEnrollment, 
                      WINBIO_BIOMETRIC_SUBTYPE subFactor)
{
    HRESULT hr = S_OK;
    WINBIO_IDENTITY identity = {0};
    WINBIO_SESSION_HANDLE sessionHandle = NULL;
    WINBIO_UNIT_ID unitId = 0;
    WINBIO_REJECT_DETAIL rejectDetail = 0;
    BOOLEAN isNewTemplate = TRUE;

    // Connect to the system pool. 
    hr = WinBioOpenSession( 
            WINBIO_TYPE_FINGERPRINT,    // Service provider
            WINBIO_POOL_SYSTEM,         // Pool type
            WINBIO_FLAG_DEFAULT,        // Configuration and access
            NULL,                       // Array of biometric unit IDs
            0,                          // Count of biometric unit IDs
            NULL,                       // Database ID
            &sessionHandle              // [out] Session handle
            );
    if (FAILED(hr))
    {
        wprintf_s(L"\n WinBioOpenSession failed. ");
        wprintf_s(L"hr = 0x%x\n", hr);
        goto e_Exit;
    }

    // Locate a sensor.
    wprintf_s(L"\n Swipe your finger on the sensor...\n");
    hr = WinBioLocateSensor( sessionHandle, &unitId);
    if (FAILED(hr))
    {
        wprintf_s(L"\n WinBioLocateSensor failed. hr = 0x%x\n", hr);
        goto e_Exit;
    }

    // Begin the enrollment sequence. 
    wprintf_s(L"\n Starting enrollment sequence...\n");
    hr = WinBioEnrollBegin(
            sessionHandle,      // Handle to open biometric session
            subFactor,          // Finger to create template for
            unitId              // Biometric unit ID
            );
    if (FAILED(hr))
    {
        wprintf_s(L"\n WinBioEnrollBegin failed. hr = 0x%x\n", hr);
        goto e_Exit;
    }

    // Capture enrollment information by swiping the sensor with
    // the finger identified by the subFactor argument in the 
    // WinBioEnrollBegin function.
    for (int swipeCount = 1;; ++swipeCount)
    {
        wprintf_s(L"\n Swipe the sensor to capture %s sample.",
                 (swipeCount == 1)?L"the first":L"another");

        hr = WinBioEnrollCapture(
                sessionHandle,  // Handle to open biometric session
                &rejectDetail   // [out] Failure information
                );

        wprintf_s(L"\n Sample %d captured from unit number %d.", 
                  swipeCount, 
                  unitId);

        if (hr == WINBIO_I_MORE_DATA)
        {
            wprintf_s(L"\n    More data required.\n");
            continue;
        }
        if (FAILED(hr))
        {
            if (hr == WINBIO_E_BAD_CAPTURE)
            {
                wprintf_s(L"\n  Error: Bad capture; reason: %d", 
                          rejectDetail);
                continue;
            }
            else
            {
                wprintf_s(L"\n WinBioEnrollCapture failed. hr = 0x%x", hr);
                goto e_Exit;
            }
        }
        else
        {
            wprintf_s(L"\n    Template completed.\n");
            break;
        }
    }

    // Discard the enrollment if the appropriate flag is set.
    // Commit the enrollment if it is not discarded.
    if (discardEnrollment == TRUE)
    {
        wprintf_s(L"\n Discarding enrollment...\n\n");
        hr = WinBioEnrollDiscard( sessionHandle );
        if (FAILED(hr))
        {
            wprintf_s(L"\n WinBioLocateSensor failed. hr = 0x%x\n", hr);
        }
        goto e_Exit;    
    }
    else
    {
        wprintf_s(L"\n Committing enrollment...\n");
        hr = WinBioEnrollCommit( 
                sessionHandle,      // Handle to open biometric session
                &identity,          // WINBIO_IDENTITY object for the user
                &isNewTemplate);    // Is this a new template

        if (FAILED(hr))
        {
            wprintf_s(L"\n WinBioEnrollCommit failed. hr = 0x%x\n", hr);
            goto e_Exit;
        }
    }


e_Exit:
    if (sessionHandle != NULL)
    {
        WinBioCloseSession(sessionHandle);
        sessionHandle = NULL;
    }

    wprintf_s(L" Press any key to continue...");
    _getch();

    return hr;
}


요구 사항

요구 사항
지원되는 최소 클라이언트 Windows 7 [데스크톱 앱만 해당]
지원되는 최소 서버 Windows Server 2008 R2 [데스크톱 앱만 해당]
대상 플랫폼 Windows
헤더 winbio.h(Winbio.h 포함)
라이브러리 Winbio.lib
DLL Winbio.dll

추가 정보

WinBioAcquireFocus

WinBioEnrollBegin

WinBioEnrollCaptureWithCallback

WinBioEnrollCommit

WinBioEnrollDiscard

WinBioReleaseFocus