Create a digital personalized fingerprint template from serialized data

This is a very specific question that will probably bring me a crawl icon, but please answer if you can

I imported the digitalPersona dll dll as type libraries in Delphi and I am trying to validate the fingerprints that I have stored as serialized data in the database, it works very amazingly. Registration seems to work fine, but I can't seem to turn the binary data from the fingerprint back into DPFPTemplate objects. I get an OLEException all the time every time I try to use the defaultinterface property of the TDPFPTemplate object.

I'm wondering how Digital Persona expects you to use your SDK to recreate your fingerprints. Here's what their instructions say:

1. * Retrieve serialized fingerprint template data from a fingerprint data storage subsystem.
2. Deserialize a DPFPTemplate object by calling the Deserialize method (VB page 40, C ++
page 83).
3. Return a DPFPTemplate object.

All the ways to create the DPFPTemplate seem to involve using the fingerprint reader itself.

Here's one way that doesn't work

 Result := CreateOleObject('DPFPShrX.DPFPTemplate.1') as IDPFPTemplate;
 Result.Deserialize(string(AUserFinRecPtr.FingerBuffer));

      

and here is another

DPFPTemplate := TDPFPTemplate.Create(nil);
DPFPTemplate.DefaultInterface.Deserialize(String(AUserFinREcPtr.FingerBuffer));

      

+2


source to share


1 answer


I found a pdf document where the Deserialize method is committed with a byte. Your FingerBuffer is PAnsiChar, which is an array of bytes. But then you pass it to a string, which is automatically converted to OleString (Delphi converts the string to OleString when you assign it to OleVariant). So you no longer have a byte array.

What you can try (I won't guarantee it :)):



var
  lByteArray: Variant;
  lArrayPointer: Pointer;
  lStr: AnsiString;
  DPFPTemplate: TDPFPTemplate;
begin
  lStr := AUserFinREcPtr.FingerBuffer;
  lByteArray := VarArrayCreate([0, Length(lStr) - 1], varByte );
  lArrayPointer:= VarArrayLock(lByteArray);
  try
    Move( lStr[1], lArrayPointer^, Length(lStr) );
  finally
    VarArrayUnlock(lByteArray);
  end;
  DPFPTemplate := TDPFPTemplate.Create(nil);
  DPFPTemplate.DefaultInterface.Deserialize(lByteArray);

      

+2


source







All Articles