我一直在尝试制作用扫描仪捕获指纹的 FireBreath 插件。此代码仅作为控制台应用程序运行良好(减去增强线程)。
bool GopripFPrintAPI::winCaptureFPrint(const FB::JSObjectPtr& callback)
{
boost::thread t(boost::bind(&GopripFPrintAPI::WBFCapture_thread, this, callback));
return true;
}
int GopripFPrintAPI::WBFCapture_thread(const FB::JSObjectPtr& callback)
{
unsigned long resultHandle = 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.
resultHandle = WinBioOpenSession(
WINBIO_TYPE_FINGERPRINT, // Service provider
WINBIO_POOL_SYSTEM, // Pool type
WINBIO_FLAG_RAW, // Access: Capture raw data
NULL, // Array of biometric unit IDs
0, // Count of biometric unit IDs
WINBIO_DB_DEFAULT, // Default database
&sessionHandle // [out] Session handle
);
// Capture a biometric sample.
wprintf_s(L"\n Calling WinBioCaptureSample - Swipe sensor...\n");
resultHandle = WinBioCaptureSample(
sessionHandle,
WINBIO_NO_PURPOSE_AVAILABLE,
WINBIO_DATA_FLAG_RAW,
&unitId,
&sample,
&sampleSize,
&rejectDetail
);
...
}
调用 winCaptureFPrint() 正确启动 WBFCapture_thread() 并在 WinBioCaptureSample() 处停止等待,但使用指纹扫描仪没有任何作用,方法 winBioCaptureSample() 似乎没有从扫描仪获得信号。我一直认为这可能是一个焦点问题,所以我尝试了
resultHandle = WinBioAcquireFocus()
但它总是失败。它给出了一般访问被拒绝错误 E_ACCESSDENIED。FireBreath focuswise 中是否有我不知道的东西,或者我做错了什么?