Click here to Skip to main content
13,705,065 members
Click here to Skip to main content
Add your own
alternative version

Stats

11.3K views
420 downloads
24 bookmarked
Posted 20 Nov 2016
Licenced CPOL

FingerPrintf: A small library for quick usage of the Biometric API

, 3 Jan 2018
Rate this:
Please Sign up or sign in to vote.
Private fingerprint databases using a simple library, along with system database support.

Introduction

The biometric API is a bit confusing. Why not have a single class that manipulates your fingerprints?
This demo allows an application to have a private collection of fingerprints for its own use.

In order to use, you must have a fingerprint device compatible with the Windows Biometrics Framework.

The zip contains:

  • Solution C1, a command line tool taken from Microsoft code after joining all stuff together) that allows you to practise.
  • Solution FingerPrintf, which contains the library and a demo-app in a single-threaded mode with notifications and menu.
  • Ready-To-Test executables.
  • fingerprintf.hpp is all you need to include in your own projects.

Loading the library

You need to create a unique GUID for your private app's database, or you can use the system database.

FINGERPRINTF fp;
fp.SetDB(GUID_DB); // Use this for a private database, else omit it

Enumerating devices

fp.Enum();
auto allunits = fp.GetUnits(); // returns a vector<WINBIO_UNIT_SCHEMA>

Registering the database

Register your private database with the system. Must be run as administrator. Only needed if you are registering your own private database.

auto hr = fp.Register(0); // accepts index of the hardware device to use, returns a HRESULT 

Use fp.Unregister() to unregister (also run as administrator).

Open the device

auto hr = fp.Open(); // returns a HRESULT 

Use fp.Close() to close the device.

Locating the device

Make sure the user can touch the device.

WINBIO_UNIT_ID u = 0;
auto hr = fp.Locate(u); // Accepts a WINBIO_UNIT_ID& and, on success, returns the ID of the device touched.

Enroll a fingerprint

auto enr = fp.Enroll(false,s,0,cb);

The first parameter is false to commit the enrollment if successfull. (use true and the enrollment is discarded, for testing purposes).

The second parameter is the finger you want to enroll. You can pass one of the following:

WINBIO_ANSI_381_POS_RH_THUMB;
WINBIO_ANSI_381_POS_RH_INDEX_FINGER;
WINBIO_ANSI_381_POS_RH_MIDDLE_FINGER;
WINBIO_ANSI_381_POS_RH_RING_FINGER;
WINBIO_ANSI_381_POS_RH_LITTLE_FINGER;
WINBIO_ANSI_381_POS_LH_THUMB;
WINBIO_ANSI_381_POS_LH_INDEX_FINGER;
WINBIO_ANSI_381_POS_LH_MIDDLE_FINGER;
WINBIO_ANSI_381_POS_LH_RING_FINGER;
WINBIO_ANSI_381_POS_LH_LITTLE_FINGER;

The third parameter is the index of the device to be used.

The fourh parameter is a callback function:

auto cb = [](SIZE_T count, HRESULT hrt, WINBIO_REJECT_DETAIL rj) -> HRESULT;

This user-defined function is called from the library many times. Enrollment might take more than one call. While the hrt value is WINBIO_I_MORE_DATA you must return the same value so enrollment continues. When the hrt is S_OK, then enrollment has finished.

fp.Enroll() will return a std::tuple<HRESULT, WINBIO_REJECT_DETAIL, BOOLEAN, WINBIO_IDENTITY>, containing the final HRESULT, any reject reason, true if this enrollment is a new addition to the database, and a WINBIO_IDENTITY structure that defines the enrollment.

Delete a fingerprint

fp.Delete(0,LastID,LastSub);

Deletes the enrollement with the specified WINBIO_IDENTITY and finger subtype.

Identify a fingerprint

auto ide = fp.Identify(0);

It takes the index of the device and returns a std::tuple<HRESULT,WINBIO_REJECT_DETAIL, WINBIO_BIOMETRIC_SUBTYPE, WINBIO_IDENTITY>, containing the HRESULT message, any rejection reason and, in case of success, the finger recognized and the WINBIO_IDENTITY structure that defines the enrollment.

Verify a fingerprint

auto ide = fp.Verify(id,sub);

It takes the fingerprint WINBIO_IDENTITY and the subtype if known (else WINBIO_SUBTYPE_ANY) and returns a std::tuple<HRESULT, WINBIO_UNIT_ID,WINBIO_REJECT_DETAIL,BOOL> with the HRESULT, the unit used to scan, any reject reason, and a boolean value set to true if the fingerprint matches.

Points of Interest

Perhaps Windows needs some time, after database registration, to open the session successfully. I have to wait about 2-3 minutes sometimes, or it works after a reboot. Weird.

History

03 - 01 - 2018: Added option to use system database
21 - 11 - 2016: First release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Michael Chourdakis
Engineer
Greece Greece
I'm working in C++, PHP , Java, Windows, iOS and Android.

I 've a PhD in Digital Signal Processing and Artificial Intelligence and I specialize in Pro Audio and AI applications.

My home page: http://www.michaelchourdakis.com

You may also be interested in...

Pro

Comments and Discussions

 
QuestionEverything faults on W10 Pin
danieldanieldaniel11-Jun-18 8:44
memberdanieldanieldaniel11-Jun-18 8:44 
GeneralMy vote of 5 Pin
Arthur V. Ratz1-Dec-16 20:01
professionalArthur V. Ratz1-Dec-16 20:01 
GeneralShare Pin
sosserrurierorleans21-Nov-16 6:53
membersosserrurierorleans21-Nov-16 6:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01-2016 | 2.8.180920.1 | Last Updated 3 Jan 2018
Article Copyright 2016 by Michael Chourdakis
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid