Secondary development of fingerprint instruments in Delphi
I. Introduction of fingerprint instrument fingerprint has the reputation of "the head of the subject matter". The scientific community's argument is: assuming 5 billion people on the earth, there will be two identical fingerprints in 300 years. It can be seen that the uniqueness of the fingerprint is an unconfilled position.
The fingerprint instrument changes the digital security system we are well known for the first time. Previously, everything rely on the password. You must use your own username and configure your system. You have to cover your keyboard to avoid others to see your password. However, if you have negligent, anyone can easily steal your password. Experts predict: "Through fingerprint recognition systems, we extend the needs of family and business computers in security, soon, in the future, whether in the LAN or in Internet, whether or not, register logins or access security data, will not Need a password, all of which only needs you to touch your finger. "
II. The secondary development of fingerprint instruments is currently a lot of fingerprint manufacturers in the world. The influence is large, and more than the U.Are.u series of DigitalPersona, DigitalPersona is the world's largest computer keyboard manufacturer. The biological engineering security system used by this company has been included in the agreement by Chicony Electronics. This protocol is about integrated DigitalPersona U.Are.u fingerprint induction safety system in the keyboard, which is manufactured for manufacturers such as HP, Compaq and IBM. .
The secondary development of the fingerprint instrument introduced in this article is to prototype with DigitalPersona's u.are.u 2000, u.are.u is the abbreviation of you are you, (you are you). U.Are.u 2000 Mini Fingerprint Collection The device can automatically read the fingerprint image and transmit the digitized fingerprint image to the computer via the USB interface. It is the most ideal accessory for laptops, desktop computers, or other personal computer that requires authentication.
U.Are.u 2000 is a low-cost compact fingerprint collector. Integrated precision optical system, LED light source, and CMOS camera work together, voltage control, automatic correction, automatically correct, and use plug-and-play USB interface .u.are.u 2000 fingerprint scan collection design to DigitalPersona U.Are.u Fingerprint recognition algorithm, application, and DigitalPersona Universal Authentication Manager -UAM interface - These fingerprint-related applications include Windows login, screen lock, password replacement, and their encrypted disk drives.
While purchasing fingerprint hardware products, merchants generally come with hardware drivers, product manuals, secondary development kits and development programs. With the Software Development Pack (SDK), the functionality of the fingerprint recognition can be added to the application.
Third. Key technologies in the secondary development of fingerprint instruments
1.DLL call first introduces the method of calling the DLL in the fingerprint system development package in DELPI. Place the Urushell.dll in the development kit in the program directory or in the system directory. In order to clearly, the DLL's call declaration is concentrated in a program unit shelluru.PAS, exporting the function of Urushell.dll and the reference declaration, the specific source code is as follows:
Unit shelluru;
Interface
Uses Windows, Messages;
const FT_OK = 0; FT_ERR_NO_INIT = -1 // successful; // not initialized FT_ERR_UNKNOWN_DEVICE = -10; // unknown device FT_ERR_DEVICE_CONNECTED = -18; // device is connected FT_ERR_NO_DEVICE_CONNECTED = -19; // No equipment may be connected MAX_REGISTER_COUNT = 8 ; // Maximum registration ERR_REGISTER_FAIL = -110; // Registration failed err_verify_fail = -111; // Verification failed err_register_count = -112; // Register = -112 is a custom message, msg_finger_captured fingerprint acquisition message;} msg_waiting_for_image fingerprint Waiting for the message. Msg_finger_captured = wm_user 80; msg_waiting_for_image = WM_USER 81; Type pregisterpixels = ^ Tregisterpixels; Tregisterpixels = array [1..max_register_count] of pointer;
/// URU_INIT initializes the fingerprint instrument, parameter: NumofDev Returns the number of fingerprint instruments connected to the computer; featurelen returns the length of the fingerprint data. Function URU_INIT (VAR Numofdev, Featurelen: Integer): Integer; stdcall;
/// URU_Connect Connect a specific fingerprint device. Parameters: DeviceNo fingerprint meter number. Function URU_CONNECT (DeviceNo: Integer): Integer; stdcall;
/// URU_TERMINATE Disconnects to the fingerprint instrument. Parameters: DeviceNo fingerprint meter number. Procedure URU_TERMINATE (DeviceNo: Integer); stdcall;
/// URU_allocfeature assigns the fingerprint data address. Parameters: The address pointer returned by Feature. Procedure uru_allocfeature (var feature: Pointer); stdcall;
/// URU_FreeFeature Releases the assigned address. Parameters: The address pointer returned by Feature. Procedure Uru_Freefeature (VAR Feature: Pointer; stdcall;
//// URU_GETIMAGEWIDTH Gets the fingerprint image width. Function URU_GETIMAGEWIDTH: Integer; stdcall;
/// URU_GETIMAGEHEHT Gets the height of the fingerprint image. Function URU_GETIMAGEHEHT: Integer; stdcall;
/// URU_REGISTER Fingerprint Registration Function. Parameters: HWND window handle, used for message transfer; Devieceno fingerprint meter number; /// fngcount fingerprint registration; Pixels fingerprint image connection pointer; features fingerprint registration data pointer .function uru_register (hwnd: hwnd; deficeno, fngcount: integer; pixels : PREGISTERPIXELS; FEATURES: POINTER: Integer; stdcall;
//// URU_ACquirefeatures Fingerprint Verification Function. Parameters: HWND window handle, used for message transfer; Devieceno fingerprint meter number .function uru_acquirefeatures (hwnd: hwnd; deficeno: integer; pixels, features: Pointer): integer; stdcall; /// uru_verifyfeatures fingerprint comparison function. Parameters: Srcfeatures requires comparison of fingerprint data; Dstfeatures contrast fingerprint data. Function URU_VERIFEATURES (SRCFEATURES, DSTFEATURES: POINTER): Boolean; stdcall;
/// DLL registration function procedure uru_dllregister; stdcall;
// / Interrupt the specific fingerprint image function. Parameters: DeviceNo fingerprint meter number. Procedure uru_stopgetimage (DeviceNo: Integer); stdcall;
IMPLEMENTATION
Const dllname = 'urushell.dll';
{The following statement is a call to a function derived uruShell.dll} function uru_Init; external DLLNAME; function uru_Connect; external DLLNAME; procedure uru_Terminate; external DLLNAME; procedure uru_AllocFeature; external DLLNAME; procedure uru_FreeFeature; external DLLNAME; function uru_GetImageWidth; external DLLNAME; function uru_GetImageHeight ; external DLLNAME; function uru_Register; external DLLNAME; function uru_AcquireFeatures; external DLLNAME; function uru_verifyFeatures; external DLLNAME; procedure uru_DllRegister; external DLLNAME; Procedure uru_StopGetImage; external DLLNAME;
End. After completing the above work, you can reference the shellu.PAS file in the main project file, and then call the function defined in the shelluru.pas file.
2. Save the verified fingerprint data in the file or in the database by calling the above-defined functions, we can implement a fingerprint registration, verification, fingerprint data save, fingerprint re-authentication (identification) fingerprint recognition system. The following focuses on the programming implementation of the fingerprint registration and verification recognition process:
Procedure tform1.btnregisterclick (sender: TOBJECT); file: // Register Fingerprint Var i: integer; begin if userlist.selected = nil dam messagebox (Application.Handle, 'first select user!', nil, mb_ok); Exit End; if UserList.selected.data <> nil kil thrarture: = userlist.selected.data file: // This time feature is empty ELSE URU_ALLOCFEATURE (Feature); if feature = nil dam: // If the fingerprint feature is empty Begin Status.SIMpletext: = 'Can't assign Feature Memory'; exit; end; for i: = 1 to 4 do begchar (Pixels [i] ^, URU_GETIMAGEWIDTH * URU_GETIMAGEHEIGHT, $ FF); Images [i] .refresh; Status.simpletext: = 'Start registration' userlist.selected.caption 'fingerprint ...'; if Uru_Register (Handle, DeviceNo, 4, @pixels, feature) = ft_ok dam status.simpletext: = UserList. Selected.Caption ': registered successfully!'; if UserList.Selected.Data = nil then UserList.Selected.Data: = Feature; end else begin if UserList.Selected.Data = nil then uru_FreeFeature (Feature); Status.SimpleText: = UserList.selected.caption ': Registration failed!' ; End; end; This function mainly calls the URU_register function in the DLL to register the fingerprint for the user. The registration fingerprint is to extract the features of the fingerprint, assign one end memory for the feature value, used to store fingerprint feature value data, and use one The pointer points to this memory so that you can find it back in the future. After the registration is complete, verify it immediately, make sure the data is correct, the verification process is as follows:
Procedure tForm1.btnverifyclick (sender: TOBJECT); File: // Verify fingerprint var Afeature: Pointer; I: integer; fingerPath: string; begin fingerpath: = 'c: /finger' EDit9.text EDit10.Text; // Fingerprint Data Storage Path If UserList.Selected = Nil Then Begin MessageBox (Application.Handle, 'First select User!', NIL, MB_OK); EXIT; End; if UserList.Selected.Data = NIL THEN BEGIN MessageBox (Application.Handle PCHAR (Format ('user% S has not registered fingerprints, please register first!', [Userlist.selected.caption])), NIL, MB_OK; exit; end; fillchar (pixels [5] ^, uru_getimagewidth * Uru_GetimageHeight $ Ff); Images [5] .refresh; status.simpletext: = 'Start Verify' UserList.Selected.caption '' '' '' '' '' '; Feature: = UserList.Selected.Data; File: // Need Contrast fingerprint data Move (Feature ^, byt, len); file: // Put a length of memory in memory, move from Feature to the URU_allocfeature (Afeature) in the BYTE array; // Assign Fingerprint Data Address IF (URU_Acquirefeatures) (Handle, DeviceNo, Pixels [5], Afeature) = ft_ok) And Uru_VerifyFeatures THEN FILE: // URU_ACQUIREFEATURES Fingerprint Verification File: // URU_VERIFEAS Fingerprint Contrast Begin Status.SIMpletext: = UserList.Selected.caption ': Verification success!'; Assignfile (f, fingerpath); // Assign file REWRITE (F); // Overwritten file for i: = 0 to Len do Write (f BYT [I]); // Write the fingerprint data into the file closefile (f); // Close the file end else status.simpletext: = userlist.selected.caption ': Verification failed!'; uru_freefeature (Afeature); File: // Release the memory END; the key process key lies after the fingerprint verification is successful, in time, the data file name is used to save the fingerprint data, and the data file name is preferably the user name plus the number, so that it can be easily found in the future. User fingerprint data. Finally, I have to remember the release of the temporary memory release. Store fingerprint data to the file, and then you can adjust the data file by opening the file, with a matching process with the current user to verify the correct identity of the user, the specific process is as follows:
procedure TForm1.BitBtn2Click (Sender: TObject); file: // old user authentication fingerprint var aFeature1: pointer; i: integer; begin if OpenDialog1.Execute then begin AssignFile (G, OpenDialog1.FileName); // the specified file Reset (G ); // Reset file for i: = 0 to len do read (g, byt2 [i]); // Move the fingerprint device data in the file to the ByTE2 array closefile (g); // turn off the file end; FillChar (Pixels [5] ^, uru_GetImageWidth * uru_GetImageHeight, $ FF); Images [5] .Refresh; Status.SimpleText: = 'start verification' UserList.Selected.Caption 'fingerprints ...'; uru_AllocFeature (aFeature1 ); // allocate fingerprint data address if (uru_AcquireFeatures (handle, DeviceNo, Pixels [5], aFeature1) = FT_OK) and uru_verifyFeatures (@ byt2, aFeature1) then Status.SimpleText: = UserList.Selected.Caption ': verification success ! 'Else status.simpletext: = userlist.selected.caption ': Verification failed! '; Uru_freefeature (Afeature1); file: // Release memory END; It is actually that fingerprint data can also be stored in the database so that multilayer structure can be implemented. The system, the database is accessed in the database, and the client is uploaded by the server as needed, or the data is read from the server when you need to verify the old user, and ensure security.
IV. Small junction This article introduces the development of U.Are.u 2000 fingerprint instrument for secondary development, implementing a process of fingerprint data registration, verification, data storage, and old fingerprint re-authentication, this process can be used in some need to fingerprint recognition In the system of personal identity, the author has developed a prototype of the provisional license management system as a public security agency or residential community, mainly to achieve the provision of the residence permit management function of the residents. This article only introduces the call to the DLL in the fingerprint system. The method and the registration and verification of the secondary development, as for the connection, initialization of the fingerprint device, the display of the fingerprint image, etc., because it is simple, there is no in-depth discussion, the reader can develop according to the functions provided by the DLL. Welcome to believe and discuss, my email is Allencnj@163.com