2016-12-22 2 views
-1

指紋を読み取り、WBFを使用して保存しようとしています。WinBioCaptureSampleWithCallbackが失敗しました。 OperationStatus = 0x80004001

サンプルコードを試しましたが、エラーコードが戻ってきます。私はウィンドウにログインするために指紋リーダーを使用することができますが、そこからサンプルをキャプチャすることはできません。

私はLenovo YogaシステムとVS 2015 CommunityでWindows 10を実行しています。

これは私が自分のコードを実行したときに、私が得るものです:センサーWinBioCaptureSampleWithCallback スワイプを呼び出す

...処理し スワイプを実行

CaptureSampleCallback - ユニットID:0 WinBioCaptureSampleWithCallbackに失敗しました。 OperationStatus = 0x80004001

を押して終了するには、任意のキー...

ありがとうございました!

サンプルコード:

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 process 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; 
    } 
} 
+1

デバッグ時に何が起こったのですか? – John3136

+0

@ John3136私は機能に足を踏み入そうとしましたが、指紋を入力してもう一度足を入れると、エラーコードが返されます。 – Danny

答えて

0

あなたはグーグルやOperationStatusが= 0x80004001に変換するものSDKのマニュアルで確認しましたか? Visual Studio 2015で開発しているプロジェクトを試してみる前に、指紋用のWindowsサービスを停止する必要があると考えています。

+0

私はサービスを停止しようとしませんでした。私はWindows 10のビルド1600(または1600 +)として、それらのAPIが無効になることを読んでいた。わからない。私はUniversal App APIを使って指紋認証をしました。しかし、私はまだそれらのいくつかの分析を行うために指紋を抽出することができるようにしたい。サービスを停止しようとします(いずれかの方)。 – Danny

関連する問題