Click here to Skip to main content
13,900,110 members
Click here to Skip to main content
Add your own
alternative version


25 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.


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.

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

Enumerating devices

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.

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:


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


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.


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


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


About the Author

Michael Chourdakis
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:

You may also be interested in...


Comments and Discussions

QuestionEverything faults on W10 Pin
danieldanieldaniel11-Jun-18 8:44
memberdanieldanieldaniel11-Jun-18 8:44 
AnswerRe: Everything faults on W10 Pin
Michael Chourdakis26-Nov-18 9:01
mvaMichael Chourdakis26-Nov-18 9:01 
GeneralMy vote of 5 Pin
Arthur V. Ratz1-Dec-16 20:01
mvaArthur 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
Web05 | 2.8.190306.1 | Last Updated 3 Jan 2018
Article Copyright 2016 by Michael Chourdakis
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid