根据序列化数据创建数字角色指纹模板 [英] Creating digital persona fingerprint template from serialized data
问题描述
这是一个非常具体的问题,可能会使我获得风滚草徽章,但请回答
我已经导入了DigitalPersona sdk dll作为Delphi中的类型库,正在尝试验证作为序列化数据存储在数据库中的指纹,它的工作非常出色。注册似乎工作正常,但是我无法将指纹中的二进制数据转换回DPFPTemplate对象。每次尝试使用TDPFPTemplate对象的defaultinterface属性时,我都会不断收到OLEException。
I've imported DigitalPersona sdk dll's as type libraries into Delphi and am trying to verify fingerprints which I've stored as serialized data in a database, it's working very awesomely. Enrollment seems to work fine, but I can't turn the binary data from the finger prints back into DPFPTemplate objects. I keep getting an OLEException every time I try to used the defaultinterface property of a TDPFPTemplate object.
我想知道的是Digital Persona希望您如何使用他们的SDK重新创建指纹。他们的指示是这样的:
What I'm wondering is how Digital Persona expects you to use their SDK to recreate fingerprints. This is 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.
制作DPFPTemplate的所有方法似乎仅包括使用指纹读取器本身。
All the ways of making a DPFPTemplate seem to only include 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));
这是另一个
DPFPTemplate := TDPFPTemplate.Create(nil);
DPFPTemplate.DefaultInterface.Deserialize(String(AUserFinREcPtr.FingerBuffer));
推荐答案
我找到了一个PDF文档,其中使用了Deserialize方法字节数组。 FingerBuffer是一个PAnsiChar,它是一个字节数组。但是随后您将其转换为字符串,该字符串会自动转换为OleString(当您将字符串分配给OleVariant时,Delphi会将字符串转换为OleString)。因此,您不再需要字节数组。
I found a pdf document where the Deserialize method is feaded a byte array. Your FingerBuffer is a PAnsiChar, which is an array of bytes. But then you cast it to a string which is automatically converted to an OleString (Delphi converts a string to an OleString when you assign it to an OleVariant). So you don't have an array of bytes anymore.
您可以尝试做些什么(我不会保证:)):
What you can try to do (I won't garantee 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);
这篇关于根据序列化数据创建数字角色指纹模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!