微软指纹 SDK C++ winbio.lib 不工作 [关闭]
Posted
技术标签:
【中文标题】微软指纹 SDK C++ winbio.lib 不工作 [关闭]【英文标题】:Microsoft Fingerprint SDK C++ winbio.lib not working [closed] 【发布时间】:2013-12-30 09:46:23 【问题描述】:我目前正在进行指纹验证项目,并且我已经正确配置了所有驱动程序。我正在使用 Microsoft Fingerprint Reader,当我在登录期间使用软件 DigitalPersona 对其进行测试时,它可以工作。我目前有 windows sdk 7.0A,我正在使用 Microsoft Visual Studio 2010。
我为此代码创建了一个“空项目”,并将其他库依赖项链接到 windows sdk 并在“输入”下键入 winbio.lib 以获取其他依赖项。我收到了这个错误。
错误 C2065:“CaptureSampleCallback”:未声明的标识符
这是代码,我完全按照微软的示例进行操作,但它无法工作 =( http://msdn.microsoft.com/en-us/library/windows/desktop/dd401603(v=vs.85).aspx
#include <Windows.h>
#include <Conio.h>
#include <Stdio.h>
#include <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 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;
【问题讨论】:
尝试将CaptureSampleCallback
声明放在CaptureSampleWithCallback
之前
【参考方案1】:
您有两种解决方案:
A.调用CaptureSampleCallback
之前的函数原型
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 );
B.将函数CaptureSampleCallback
的定义移到CaptureSampleWithCallback
之前
【讨论】:
非常感谢!这解决了我的问题。但是我还要问 1 个菜鸟问题。似乎无法解决它=(“1>LINK:致命错误LNK1561:必须定义入口点”我应该将“子系统”更改为指向CaptureSampleWithCallBack对吗??但它似乎无法工作。我没有知道要填什么。当我选择“windows”选项时,它也不能工作。知道如何解决这个问题吗?谢谢你的帮助!=D 我想知道你是否在你的项目中定义了 main() (或等效的)函数。 不,我没有。抱歉,我刚开始尝试这种捕获样本的功能。我需要一个主要功能来做到这一点吗?我指的是来自微软的示例代码link 我完全遵循了这段代码。 CaptureSample() 已经是等效的 main 函数了吧? 我认为另一个问题是合适的,因为代码不同。我会再发一个,希望你能指导我=D谢谢以上是关于微软指纹 SDK C++ winbio.lib 不工作 [关闭]的主要内容,如果未能解决你的问题,请参考以下文章
DigitalPersona U.are.U 4500 指纹读取器 SDK 不适用于 Windows 10
异常'指纹不匹配'。启动 Android Xamarin.UITest 时