다음을 통해 공유


WinBioCancel 함수(winbio.h)

지정된 세션에 대해 보류 중인 모든 생체 인식 작업을 취소합니다. Windows 10 빌드 1607부터 이 함수를 모바일 이미지와 함께 사용할 수 있습니다.

문법

HRESULT WinBioCancel(
  [in] WINBIO_SESSION_HANDLE SessionHandle
);

매개 변수

[in] SessionHandle

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

반환 값

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

반환 코드 Description
E_HANDLE
세션 핸들이 잘못되었습니다.

비고

WinBioCancel을 동기적으로 사용하려면 WinBioOpenSession을 호출하여 만든 세션 핸들을 사용하여 함수를 호출합니다. 동기 세션 핸들을 사용하여 함수를 호출하는 경우:

  • 보류 중인 작업이 없으면 함수는 S_OK 반환하고 다른 작업을 수행하지 않습니다.
  • 보류 중인 비동기 작업은 OperationStatus 매개 변수가 WINBIO_E_CANCELED 설정되는 콜백 알림을 받습니다.
  • 프로세스의 다른 스레드에서 시작된 차단된 비동기 작업은 WINBIO_E_CANCELED 반환합니다.
WinBioCancel을 비동기적으로 사용하려면 WinBioAsyncOpenSession을 호출하여 만든 세션 핸들을 사용하여 함수를 호출합니다. 비동기 세션 핸들을 사용하여 함수를 호출하는 경우:
  • 함수는 입력 매개 변수를 확인하고 S_OK 또는 오류 코드를 사용하여 즉시 반환합니다.
  • 보류 중인 비동기 작업은 해당 WINBIO_ASYNC_RESULT 구조체의 ApiStatus 멤버를 WINBIO_E_CANCELED 설정하는 완료 알림을 받습니다.
또한 프레임워크는 WinBioCancel대한 WINBIO_ASYNC_RESULT 구조를 할당하고 이를 사용하여 취소 성공 또는 실패에 대한 정보를 반환합니다. 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 구조를 해제해야 합니다.

예시

다음 코드 예제에서는 WinBioCaptureSampleWithCallback을 호출하여 샘플을 비동기적으로 캡처합니다. TRUE로 설정된 경우 캡처 작업을 취소할 함수에 부울 값을 전달할 수 있습니다. Winbio.lib 정적 라이브러리에 연결하고 다음 헤더 파일을 포함합니다.

  • Windows.h
  • Stdio.h
  • Conio.h
  • Winbio.h
HRESULT CaptureSampleWithCallback(BOOL bCancel)
{
    HRESULT hr = S_OK;
    WINBIO_SESSION_HANDLE sessionHandle = NULL;

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

    // Capture a biometric sample asynchronously.
    wprintf_s(L"\n Calling WinBioCaptureSampleWithCallback ");
    hr = WinBioCaptureSampleWithCallback(
            sessionHandle,                  // Open session handle
            WINBIO_NO_PURPOSE_AVAILABLE,    // Intended use of the sample
            WINBIO_DATA_FLAG_RAW,           // Sample format
            CaptureSampleCallback,          // Callback function
            NULL                            // Optional context
            );
    if (FAILED(hr))
    {
        wprintf_s(L"\n WinBioCaptureSampleWithCallback failed. ");
        wprintf_s(L"hr = 0x%x\n", hr);
        goto e_Exit;
    }
    wprintf_s(L"\n Swipe the sensor ...\n");

    // Cancel the capture operation if the bCancel flag is set.
    if (bCancel)
    {
        wprintf_s(L"\n Starting CANCEL timer...");
        Sleep( 7000 );

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

    // Wait for the asynchronous capture process to complete 
    // or be canceled.
    hr = WinBioWait( sessionHandle );
    if (FAILED(hr))
    {
        wprintf_s(L"\n WinBioWait failed. hr = 0x%x\n", hr);
    }

e_Exit:

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

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

    return hr;
}

//------------------------------------------------------------------------
// The following function is the callback for WinBioCaptureSampleWithCallback.
// The function filters the response from the biometric subsystem and 
// writes a result to the console window.
//
VOID CALLBACK CaptureSampleCallback(
    __in_opt PVOID CaptureCallbackContext,
    __in HRESULT OperationStatus,
    __in WINBIO_UNIT_ID UnitId,
    __in_bcount(SampleSize) PWINBIO_BIR Sample,
    __in SIZE_T SampleSize,
    __in WINBIO_REJECT_DETAIL RejectDetail
    )
{
    UNREFERENCED_PARAMETER(CaptureCallbackContext);

    wprintf_s(L"\n CaptureSampleCallback executing");
    wprintf_s(L"\n Swipe processed - Unit ID: %d", UnitId);

    if (FAILED(OperationStatus))
    {
        if (OperationStatus == WINBIO_E_BAD_CAPTURE)
        {
            wprintf_s(L"\n Bad capture; reason: %d\n", RejectDetail);
         }
        else
        {
            wprintf_s(L"\n WinBioCaptureSampleWithCallback failed. ");
            wprintf_s(L" OperationStatus = 0x%x\n", OperationStatus);
        }
        goto e_Exit;
    }

    wprintf_s(L"\n Captured %d bytes.\n", SampleSize);

e_Exit:

    if (Sample != NULL)
    {
        WinBioFree(Sample);
        Sample = NULL;
    }
}


요구 사항

요구 사항 가치
지원되는 최소 클라이언트 Windows 7 [데스크톱 앱만 해당]
지원되는 최소 서버 Windows Server 2008 R2 [데스크톱 앱만 해당]
대상 플랫폼 윈도우즈
Header winbio.h(Winbio.h 포함)
Library Winbio.lib
DLL Winbio.dll