我正试图在visual studio 2012中使用WBF(Windows生物识别框架)捕获生物识别样本
这是我的主要.cpp文件:
// FingerPrint.cpp:定义控制台应用程序的入口点。
#include "stdafx.h"
#include "Windows.h"
#include "Stdio.h"
#include "Conio.h"
#include "Winbio.h"
HRESULT CaptureSample();
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT CaptureSample();
return 0;
}
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.
hr = 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
);
if (FAILED(hr))
{
wprintf_s(L"\n WinBioOpenSession failed. hr = 0x%x\n", hr);
goto e_Exit;
}
// Capture a biometric sample.
wprintf_s(L"\n Calling WinBioCaptureSample - Swipe sensor...\n");
hr = WinBioCaptureSample(
sessionHandle,
WINBIO_NO_PURPOSE_AVAILABLE,
WINBIO_DATA_FLAG_RAW,
&unitId,
&sample,
&sampleSize,
&rejectDetail
);
if (FAILED(hr))
{
if (hr == WINBIO_E_BAD_CAPTURE)
{
wprintf_s(L"\n Bad capture; reason: %d\n", rejectDetail);
}
else
{
wprintf_s(L"\n WinBioCaptureSample failed. hr = 0x%x\n", hr);
}
goto e_Exit;
}
wprintf_s(L"\n Swipe processed - Unit ID: %d\n", unitId);
wprintf_s(L"\n Captured %d bytes.\n", sampleSize);
e_Exit:
if (sample != NULL)
{
WinBioFree(sample);
sample = NULL;
}
if (sessionHandle != NULL)
{
WinBioCloseSession(sessionHandle);
sessionHandle = NULL;
}
wprintf_s(L"\n Press any key to exit...");
_getch();
return hr;
}
这是我在构建项目时得到的结果:
1>------ Build started: Project: FingerPrint, Configuration: Debug Win32 ------
1> FingerPrint.cpp
1> FingerPrint.vcxproj -> C:\Users\hp\Documents\Visual Studio 2012\Projects\FingerPrint\Debug\FingerPrint.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
这是我在调试文件时得到的结果:
'FingerPrint.exe' (Win32): Loaded 'C:\Users\hp\Documents\Visual Studio 2012\Projects\FingerPrint\Debug\FingerPrint.exe'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winbio.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\credui.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ScDetour.Dll'. **Cannot find or open the PDB file.**
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\Detoured.dll'. **Cannot find or open the PDB file.**
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc\comctl32.dll'. Symbols loaded.
'FingerPrint.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
The program '[6216] FingerPrint.exe' has exited with code 0 (0x0).
当我开始没有调试时:一个控制台窗口打开说“按任意退出...”然后如果我这样做,窗口关闭..
答案 0 :(得分:0)
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT CaptureSample();
return 0;
}
替换
HRESULT CaptureSample();
与
CaptureSample();
在您的代码HRESULT CaptureSample();
中只是前向声明,而不是函数调用,因此main
函数不执行任何操作。调试你可以看到的程序,调试器不会停在这一行上。关于Cannot find or open the PDB file
消息,只需忽略它们,就不需要调试系统库。