2016-10-31 2 views
0

저는 C++ 초보자이며 이미지 captured by Biometric fingerprint sensor을 bmp 이미지 파일로 저장해야합니다. 내가 this 예를 들어 내 요구 사항에 적합 할 수 있음을 발견했습니다,하지만 응용 프로그램을 (관리자 권한으로) 실행 해요 동안 포인터 &sample을 얻기 위해 시도하는 동안, 나는 오류를 가지고 'Unable to read from memory'WinBio 캡처 샘플을 이미지로 저장 - 메모리에서 읽을 수 없습니다.

HRESULT CaptureSample() 
    { 
     HRESULT hr = S_OK; 
     WINBIO_SESSION_HANDLE sessionHandle = NULL; 
     WINBIO_UNIT_ID unitId = 0; 
     WINBIO_REJECT_DETAIL rejectDetail = 0; 
     PWINBIO_BIR sample = NULL; 
     SIZE_T sampleSize = 0; 
     // Connect to the system pool & opening session code done successfully. 
     // Capture a biometric sample. 
     std::cout << "Calling WinBioCaptureSample - Swipe sensor...\n"; 

     hr = WinBioCaptureSample(
     sessionHandle, 
     WINBIO_NO_PURPOSE_AVAILABLE, 
     WINBIO_DATA_FLAG_RAW, 
     &unitId, 
     &sample, // Here Application crashes and error is 'Unable to read from memory' 
     &sampleSize, 
     &rejectDetail 
     ); 

     std::cout << "Swipe processed - Unit ID: " << unitId << "\n"; 


     if(FAILED(hr)) 
     { 
     if(hr == WINBIO_E_BAD_CAPTURE) 
      std:: cout << "Bad capture; reason: " << rejectDetail << "\n"; 
     else 
      std::cout << "WinBioCaptureSample failed.hr = 0x" << std::hex << hr << std::dec << "\n"; 

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

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

     return hr; 
     } 
    } 
+0

WinBioOpenSession을 사용하여 세션을 열지 못했습니다. – alangab

+0

이미 열었지만 코드를 더 짧게하기 위해 추가하지 않았습니다. –

+0

이 샘플에서 동일한 코드를 사용하고 있습니다. https://github.com/djbozkosz/Windows-Biometric-Framework-FingerPrint-Example –

답변

0

이 코드는 것 말한다 괜찮아요, 왜냐하면 만약 당신이 아무 것도 수정하지 않았다면, 내 추측은 다음과 같을 것입니다 : a) 뭔가가 이미 장치를 사용하고 있습니다 (이것은 우리가 비슷한 문제가있는 경우입니다). b) 드라이버 또는 연결 오류