Reputation: 765
I'm having problem on how to correctly use ftrScanAPI.dll. I got no errors when calling the function "ftrScanOpenDevice" inside the DLL but I get errors "access violation" when calling the procedure "ftrScanCloseDevice". I'm stuck and don't know if I'm on the right track. Am I doing it correctly?
TProcedure = procedure; stdcall;
TProcedure_int = procedure(A_Int : Integer); stdcall;
TFutronicFingerPrint = class
fHandle : THandle;
public
constructor Create;
destructor Destroy; override;
procedure Open;
procedure Close;
end;
constructor TFutronicFingerPrint.Create;
begin
inherited;
fHandle := LoadLibrary('ftrScanAPI.dll');
end;
destructor TFutronicFingerPrint.Destroy;
begin
FreeLibrary(fHandle);
inherited;
end;
procedure TFutronicFingerPrint.Open;
var
procOpenDevice : TProcedure;
begin
@procOpenDevice := GetProcAddress(fHandle, 'ftrScanOpenDevice');
if @procOpenDevice <> nil then
begin
procOpenDevice;
end;
end;
procedure TFutronicFingerPrint.Close;
var
proc : TProcedure_int;
begin
@proc := GetProcAddress(fHandle, 'ftrScanCloseDevice');
if @proc <> nil then
begin
proc(fHandle);
end;
end;
Upvotes: 0
Views: 1785
Reputation: 59
I'm still working on the code. Implemented dynamic load of dll:
unit UClinicAllFtrScanAPI;
interface
uses
Classes, Windows, SysUtils;
type
// API Futronic
FTRHANDLE = Pointer;
_FTRSCAN_FAKE_REPLICA_PARAMETERS = packed record
bCalculated: BOOL;
nCalculatedSum1: Integer;
nCalculatedSumFuzzy: Integer;
nCalculatedSumEmpty: Integer;
nCalculatedSum2: Integer;
dblCalculatedTremor: Double;
dblCalculatedValue: Double;
end;
FTRSCAN_FAKE_REPLICA_PARAMETERS = _FTRSCAN_FAKE_REPLICA_PARAMETERS;
PFTRSCAN_FAKE_REPLICA_PARAMETERS = ^_FTRSCAN_FAKE_REPLICA_PARAMETERS;
_FTRSCAN_FRAME_PARAMETERS = packed record
nContrastOnDose2: Integer;
nContrastOnDose4: Integer;
nDose: Integer;
nBrightnessOnDose1: Integer;
nBrightnessOnDose2: Integer;
nBrightnessOnDose3: Integer;
nBrightnessOnDose4: Integer;
FakeReplicaParams: FTRSCAN_FAKE_REPLICA_PARAMETERS;
Reserved: array[0..64-SizeOf(FTRSCAN_FAKE_REPLICA_PARAMETERS)-1] of Byte;
end;
FTRSCAN_FRAME_PARAMETERS = _FTRSCAN_FRAME_PARAMETERS;
PFTRSCAN_FRAME_PARAMETERS = ^_FTRSCAN_FRAME_PARAMETERS;
_FTRSCAN_IMAGE_SIZE = packed record
nWidth: Integer;
nHeight: Integer;
nImageSize: Integer;
end;
FTRSCAN_IMAGE_SIZE = _FTRSCAN_IMAGE_SIZE;
PFTRSCAN_IMAGE_SIZE = ^_FTRSCAN_IMAGE_SIZE;
// Methods from dll
TFutronicSDKIsFingerPresent = function (ftrHandle: FTRHANDLE; pFrameParameters: PFTRSCAN_FRAME_PARAMETERS): BOOL; stdcall;
TFutronicSDKOpenDevice = function: FTRHANDLE; stdcall;
TFutronicSDKCloseDevice = procedure (ftrHandle: FTRHANDLE); stdcall;
TFutronicSDKSetDiodesStatus = function (ftrHandle: FTRHANDLE; byGreenDiodeStatus, byRedDiodeStatus: Byte): BOOL; stdcall;
TFutronicSDKGetDiodesStatus = function(ftrHandle: FTRHANDLE; pbIsGreenDiodeOn, pbIsRedDiodeOn: PBOOL): BOOL; stdcall;
TFutronicSDKGetImageSize = function(ftrHandle: FTRHANDLE; pImageSize: PFTRSCAN_IMAGE_SIZE): BOOL; stdcall;
TFutronicSDKGetImage = function(ftrHandle: FTRHANDLE; nDose: Integer; pBuffer: Pointer): BOOL; stdcall;
TClinicAllFutronicScanAPI = class(TComponent)
private
FDLLHandle: THandle; // dll Handle
FDevice: FTRHANDLE;
FConnected: boolean;
FLastReturn: integer;
FIsFingerPresent: TFutronicSDKIsFingerPresent;
FOpenDevice: TFutronicSDKOpenDevice;
FCloseDevice: TFutronicSDKCloseDevice;
FSetDiodesStatus: TFutronicSDKSetDiodesStatus;
FGetDiodesStatus: TFutronicSDKGetDiodesStatus;
FGetImageSize: TFutronicSDKGetImageSize;
FGetImage: TFutronicSDKGetImage;
function GetConnected: boolean;
public
constructor Create(AOwner: TComponent); reintroduce;
destructor Destroy; reintroduce;
procedure Free; overload;
function Open: Boolean;
procedure Close;
published
property Connected: boolean read GetConnected default false;
property LastReturn: integer read FLastReturn default -1;
end;
implementation
const
DLL_FtrScanAPI = 'ftrScanAPI.dll';
{ TClinicAllFutronicScanAPI }
constructor TClinicAllFutronicScanAPI.Create(AOwner: TComponent);
begin
FDLLHandle := LoadLibrary(DLL_FtrScanAPI);
if FDLLHandle <> 0 then
begin
@FIsFingerPresent := GetProcAddress(FDLLHandle, 'ftrScanIsFingerPresent');
@FOpenDevice := GetProcAddress(FDLLHandle, 'ftrScanOpenDevice');
@FCloseDevice := GetProcAddress(FDLLHandle, 'ftrScanCloseDevice');
@FSetDiodesStatus := GetProcAddress(FDLLHandle, 'ftrScanSetDiodesStatus');
@FGetDiodesStatus := GetProcAddress(FDLLHandle, 'ftrScanGetDiodesStatus');
@FGetImageSize := GetProcAddress(FDLLHandle, 'ftrScanGetImageSize');
@FGetImage := GetProcAddress(FDLLHandle, 'ftrScanGetImage');
end
else
raise Exception.CreateFmt('Biblioteca dinâmica não encontrada %s!', [DLL_FtrScanAPI]);
inherited Create(AOwner);
end;
destructor TClinicAllFutronicScanAPI.Destroy;
begin
inherited Destroy;
end;
procedure TClinicAllFutronicScanAPI.Free;
begin
if Assigned(self.FDevice) then
self.FCloseDevice(self.FDevice);
FreeLibrary(FDLLHandle);
inherited Free;
end;
function TClinicAllFutronicScanAPI.GetConnected: boolean;
begin
result := FConnected;
end;
function TClinicAllFutronicScanAPI.Open: Boolean;
begin
Close;
fDevice := self.FOpenDevice;
FConnected := fDevice <> nil;
Result := FConnected;
end;
procedure TClinicAllFutronicScanAPI.Close;
begin
if fDevice <> nil then
begin
FCloseDevice(fDevice);
fDevice := nil;
end;
end;
end.
Upvotes: 0
Reputation: 596582
The problem is that you are declaring and using the DLL functions wrong.
ftpScanOpenevice()
is not a procedure, it is a function that returns an FTRHANDLE
as output.
ftrScanCloseDevice()
then takes that FTRHANDLE
as input, NOT the THandle
that points at the loaded DLL itself.
Try this instead:
type
FTRHANDLE = Pointer;
ftrScanOpenDeviceFunc = function: FTRHANDLE; stdcall;
ftrScanCloseDeviceFunc = procedure(ftrHandle: FTRHANDLE); stdcall;
...
TFutronicFingerPrint = class
private
fHandle : THandle;
fDevice : FTRHANDLE;
procOpenDevice : ftrScanOpenDeviceFunc;
procCloseDevice : ftrScanCloseDeviceFunc;
public
constructor Create;
destructor Destroy; override;
function Open: Boolean;
procedure Close;
end;
constructor TFutronicFingerPrint.Create;
begin
inherited;
fHandle := LoadLibrary('ftrScanAPI.dll');
if fHandle = 0 then RaiseLastOSError;
@procOpenDevice := GetProcAddress(fHandle, 'ftrScanOpenDevice');
if not Assigned(procOpenDevice) then RaiseLastOSError;
@procCloseDevice := GetProcAddress(fHandle, 'ftrScanCloseDevice');
if not Assigned(procCloseDevice) then RaiseLastOSError;
end;
destructor TFutronicFingerPrint.Destroy;
begin
Close;
if fHandle <> 0 then
FreeLibrary(fHandle);
inherited;
end;
function TFutronicFingerPrint.Open: Boolean;
begin
Close;
fDevice := procOpenDevice();
Result := fDevice <> nil;
end;
procedure TFutronicFingerPrint.Close;
begin
if fDevice <> nil then
begin
procCloseDevice(fDevice);
fDevice = nil;
end;
end;
Alternatively:
type
FTRHANDLE = Pointer;
TFutronicFingerPrint = class
private
fDevice : FTRHANDLE;
public
constructor Create;
destructor Destroy; override;
function Open: Boolean;
procedure Close;
end;
...
function ftrScanOpenDevice: FTRHANDLE; stdcall; external 'ftrScanAPI.dll';
procedure ftrScanCloseDevice(ftrHandle: FTRHANDLE); stdcall; external 'ftrScanAPI.dll';
...
constructor TFutronicFingerPrint.Create;
begin
inherited;
end;
destructor TFutronicFingerPrint.Destroy;
begin
Close;
inherited;
end;
function TFutronicFingerPrint.Open: Boolean;
begin
Close;
fDevice := ftrScanOpenDevice();
Result := fDevice <> nil;
end;
procedure TFutronicFingerPrint.Close;
begin
if fDevice <> nil then
begin
ftrScanCloseDevice(fDevice);
fDevice = nil;
end;
end;
If you get a copy of ftrScanAPI.h
, it contains the actual C declarations, which can be translated to Delphi, eg:
unit ftrScanAPI;
interface
uses
Windows;
type
FTRHANDLE = Pointer;
const
FTR_MAX_INTERFACE_NUMBER = 128;
FTR_OPTIONS_CHECK_FAKE_REPLICA = $00000001;
FTR_OPTIONS_FAST_FINGER_DETECT_METHOD = $00000002;
FTR_ERROR_BASE = $20000000;
FTR_ERROR_EMPTY_FRAME = 4306 { ERROR_EMPTY };
FTR_ERROR_MOVABLE_FINGER = FTR_ERROR_BASE or $0001;
FTR_ERROR_NO_FRAME = FTR_ERROR_BASE or $0002;
FTR_ERROR_USER_CANCELED = FTR_ERROR_BASE or $0003;
FTR_ERROR_HARDWARE_INCOMPATIBLE = FTR_ERROR_BASE or $0004;
FTR_ERROR_FIRMWARE_INCOMPATIBLE = FTR_ERROR_BASE or $0005;
FTR_ERROR_INVALID_AUTHORIZATION_CODE = FTR_ERROR_BASE or $0006;
FTR_CONST_COLOR_SMALL_IMAGE_WIDTH = 256;
FTR_CONST_COLOR_SMALL_IMAGE_HEIGHT = 150;
FTR_CONST_COLOR_SMALL_IMAGE_SIZE = FTR_CONST_COLOR_SMALL_IMAGE_WIDTH * FTR_CONST_COLOR_SMALL_IMAGE_HEIGHT;
FTR_CONST_CALIBRATION_SKIP_IR = $00000001;
FTR_CONST_CALIBRATION_SKIP_FUZZY = $00000002;
FTR_CONST_DIODE_OFF: Byte = 0;
FTR_CONST_DIODE_ON: Byte = 255;
_FTRSCAN_IMAGE_SIZE = packed record
nWidth: Integer;
nHeight: Integer;
nImageSize: Integer;
end;
FTRSCAN_IMAGE_SIZE = _FTRSCAN_IMAGE_SIZE;
PFTRSCAN_IMAGE_SIZE = ^_FTRSCAN_IMAGE_SIZE;
_FTRSCAN_FAKE_REPLICA_PARAMETERS = packed record
bCalculated: BOOL;
nCalculatedSum1: Integer;
nCalculatedSumFuzzy: Integer;
nCalculatedSumEmpty: Integer;
nCalculatedSum2: Integer;
dblCalculatedTremor: Double;
dblCalculatedValue: Double;
end;
FTRSCAN_FAKE_REPLICA_PARAMETERS = _FTRSCAN_FAKE_REPLICA_PARAMETERS;
PFTRSCAN_FAKE_REPLICA_PARAMETERS = ^_FTRSCAN_FAKE_REPLICA_PARAMETERS;
_FTRSCAN_FRAME_PARAMETERS = packed record
nContrastOnDose2: Integer;
nContrastOnDose4: Integer;
nDose: Integer;
nBrightnessOnDose1: Integer;
nBrightnessOnDose2: Integer;
nBrightnessOnDose3: Integer;
nBrightnessOnDose4: Integer;
FakeReplicaParams: FTRSCAN_FAKE_REPLICA_PARAMETERS;
Reserved: array[0..64-SizeOf(FTRSCAN_FAKE_REPLICA_PARAMETERS)-1] of Byte;
end;
FTRSCAN_FRAME_PARAMETERS = _FTRSCAN_FRAME_PARAMETERS;
PFTRSCAN_FRAME_PARAMETERS = ^_FTRSCAN_FRAME_PARAMETERS;
__FTRSCAN_INTERFACE_STATUS = (
FTRSCAN_INTERFACE_STATUS_CONNECTED,
FTRSCAN_INTERFACE_STATUS_DISCONNECTED
);
FTRSCAN_INTERFACE_STATUS = __FTRSCAN_INTERFACE_STATUS;
PFTRSCAN_INTERFACE_STATUS = ^__FTRSCAN_INTERFACE_STATUS;
__FTRSCAN_INTERFACES_LIST = packed record
InterfaceStatus: array[0..FTR_MAX_INTERFACE_NUMBER-1] of FTRSCAN_INTERFACE_STATUS;
end;
FTRSCAN_INTERFACES_LIST = __FTRSCAN_INTERFACES_LIST;
PFTRSCAN_INTERFACES_LIST = ^__FTRSCAN_INTERFACES_LIST;
function ftrScanOpenDevice: FTRHANDLE; stdcall;
function ftrScanOpenDeviceOnInterface(nInterface: Integer): FTRHANDLE; stdcall;
procedure ftrScanCloseDevice(ftrHandle: FTRHANDLE); stdcall;
function ftrScanSetOptions(ftrHandle: FTRHANDLE; dwMask, dwFlags: DWORD): BOOL; stdcall;
function ftrScanGetOptions(ftrHandle: FTRHANDLE; lpdwFlags: LPDWORD): BOOL; stdcall;
function ftrScanGetInterfaces(pInterfaceList: PFTRSCAN_INTERFACES_LIST): BOOL; stdcall;
function ftrSetBaseInterface(nBaseInterface: Integer): BOOL; stdcall;
function ftrGetBaseInterfaceNumber: Integer; stdcall;
function ftrScanGetFakeReplicaInterval(pdblMinFakeReplicaValue, pdblMaxFakeReplicaValue: PDouble): BOOL; stdcall;
procedure ftrScanSetFakeReplicaInterval(dblMinFakeReplicaValue, dblMaxFakeReplicaValue: Double); stdcall;
function ftrScanGetImageSize(ftrHandle: FTRHANDLE; pImageSize: PFTRSCAN_IMAGE_SIZE): BOOL; stdcall;
function ftrScanGetImage(ftrHandle: FTRHANDLE; nDose: Integer; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetFuzzyImage(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetBacklightImage(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetDarkImage(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetColourImage(ftrHandle: FTRHANDLE; pDoubleSizeBuffer: Pointer): BOOL; stdcall;
function ftrScanGetSmallColourImage(ftrHandle: FTRHANDLE; pSmallBuffer: Pointer): BOOL; stdcall;
function ftrScanGetColorDarkImage(ftrHandle: FTRHANDLE; pDoubleSizeBuffer: Pointer): BOOL; stdcall;
function ftrScanIsFingerPresent(ftrHandle: FTRHANDLE; pFrameParameters: PFTRSCAN_FRAME_PARAMETERS): BOOL; stdcall;
function ftrScanGetFrame(ftrHandle: FTRHANDLE; pBuffer: Pointer; pFrameParameters: PFTRSCAN_FRAME_PARAMETERS): BOOL; stdcall;
function ftrScanSave7Bytes(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanRestore7Bytes(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
type
PFTRCALIBRATEFNCB = function(pContext, pParams: Pointer): BOOL; cdecl;
function ftrScanZeroCalibration(pfnCallbackProc: PFTRCALIBRATEFNCB; pContext: Pointer): BOOL; stdcall;
function ftrScanZeroCalibration2(dwOptions: DWORD; pfnCallbackProc: PFTRCALIBRATEFNCB; pContext: Pointer): BOOL; stdcall;
function ftrScanGetCalibrationConstants(ftrHandle: FTRHANDLE; pbyIRConst, pbyFuzzyConst: PByte): BOOL; stdcall;
function ftrScanStoreCalibrationConstants(ftrHandle: FTRHANDLE; byIRConst, byFuzzyConst: Byte; bBurnInFlash: BOOL): BOOL; stdcall;
function ftrScanGetFakeReplicaParameters(ftrHandle: FTRHANDLE; pFakeReplicaParams: PFTRSCAN_FAKE_REPLICA_PARAMETERS): BOOL; stdcall;
function ftrScanSetNewAuthorizationCode(ftrHandle: FTRHANDLE; pSevenBytesAuthorizationCode: Pointer): BOOL; stdcall;
function ftrScanSaveSecret7Bytes(ftrHandle: FTRHANDLE; pSevenBytesAuthorizationCode, pBuffer: Pointer): BOOL; stdcall;
function ftrScanRestoreSecret7Bytes(ftrHandle: FTRHANDLE; pSevenBytesAuthorizationCode, pBuffer: Pointer): BOOL; stdcall;
function ftrScanSetDiodesStatus(ftrHandle: FTRHANDLE; byGreenDiodeStatus, byRedDiodeStatus: Byte): BOOL; stdcall;
function ftrScanGetDiodesStatus(ftrHandle: FTRHANDLE; pbIsGreenDiodeOn, pbIsRedDiodeOn: PBOOL): BOOL; stdcall;
implementation
const
ftrScanAPI = 'ftrScanAPI.dll';
function ftrScanOpenDevice; external ftrScanAPI;
function ftrScanOpenDeviceOnInterface; external ftrScanAPI;
procedure ftrScanCloseDevice; external ftrScanAPI;
function ftrScanSetOptions; external ftrScanAPI;
function ftrScanGetOptions; external ftrScanAPI;
function ftrScanGetInterfaces; external ftrScanAPI;
function ftrSetBaseInterface; external ftrScanAPI;
function ftrGetBaseInterfaceNumber; external ftrScanAPI;
function ftrScanGetFakeReplicaInterval; external ftrScanAPI;
procedure ftrScanSetFakeReplicaInterval; external ftrScanAPI;
function ftrScanGetImageSize; external ftrScanAPI;
function ftrScanGetImage; external ftrScanAPI;
function ftrScanGetFuzzyImage; external ftrScanAPI;
function ftrScanGetBacklightImage; external ftrScanAPI;
function ftrScanGetDarkImage; external ftrScanAPI;
function ftrScanGetColourImage; external ftrScanAPI;
function ftrScanGetSmallColourImage; external ftrScanAPI;
function ftrScanGetColorDarkImage; external ftrScanAPI;
function ftrScanIsFingerPresent; external ftrScanAPI;
function ftrScanGetFrame; external ftrScanAPI;
function ftrScanSave7Bytes; external ftrScanAPI;
function ftrScanRestore7Bytes; external ftrScanAPI;
function ftrScanZeroCalibration; external ftrScanAPI;
function ftrScanZeroCalibration2; external ftrScanAPI;
function ftrScanGetCalibrationConstants; external ftrScanAPI;
function ftrScanStoreCalibrationConstants; external ftrScanAPI;
function ftrScanGetFakeReplicaParameters; external ftrScanAPI;
function ftrScanSetNewAuthorizationCode; external ftrScanAPI;
function ftrScanSaveSecret7Bytes; external ftrScanAPI;
function ftrScanRestoreSecret7Bytes; external ftrScanAPI;
function ftrScanSetDiodesStatus; external ftrScanAPI;
function ftrScanGetDiodesStatus; external ftrScanAPI;
end.
uses
..., ftrScanAPI;
TFutronicFingerPrint = class
private
fDevice : FTRHANDLE;
public
constructor Create;
destructor Destroy; override;
function Open: Boolean;
procedure Close;
end;
...
constructor TFutronicFingerPrint.Create;
begin
inherited;
end;
destructor TFutronicFingerPrint.Destroy;
begin
Close;
inherited;
end;
function TFutronicFingerPrint.Open: Boolean;
begin
Close;
fDevice := ftrScanOpenDevice();
Result := fDevice <> nil;
end;
procedure TFutronicFingerPrint.Close;
begin
if fDevice <> nil then
begin
ftrScanCloseDevice(fDevice);
fDevice = nil;
end;
end;
Upvotes: 4
Reputation: 59
Follow changes:
unit UftrScanAPI;
interface
uses
Windows;
type
FTRHANDLE = Pointer;
const
FTR_MAX_INTERFACE_NUMBER = 128;
FTR_OPTIONS_CHECK_FAKE_REPLICA = $00000001;
FTR_OPTIONS_FAST_FINGER_DETECT_METHOD = $00000002;
FTR_ERROR_BASE = $20000000;
ERROR_EMPTY = FTR_ERROR_BASE;
FTR_ERROR_EMPTY_FRAME = ERROR_EMPTY;
FTR_ERROR_MOVABLE_FINGER = FTR_ERROR_BASE or $0001;
FTR_ERROR_NO_FRAME = FTR_ERROR_BASE or $0002;
FTR_ERROR_USER_CANCELED = FTR_ERROR_BASE or $0003;
FTR_ERROR_HARDWARE_INCOMPATIBLE = FTR_ERROR_BASE or $0004;
FTR_ERROR_FIRMWARE_INCOMPATIBLE = FTR_ERROR_BASE or $0005;
FTR_ERROR_INVALID_AUTHORIZATION_CODE = FTR_ERROR_BASE or $0006;
FTR_CONST_COLOR_SMALL_IMAGE_WIDTH = 256;
FTR_CONST_COLOR_SMALL_IMAGE_HEIGHT = 150;
FTR_CONST_COLOR_SMALL_IMAGE_SIZE = FTR_CONST_COLOR_SMALL_IMAGE_WIDTH * FTR_CONST_COLOR_SMALL_IMAGE_HEIGHT;
FTR_CONST_CALIBRATION_SKIP_IR = $00000001;
FTR_CONST_CALIBRATION_SKIP_FUZZY = $00000002;
FTR_CONST_DIODE_OFF: Byte = 0;
FTR_CONST_DIODE_ON: Byte = 255;
type
_FTRSCAN_IMAGE_SIZE = packed record
nWidth: Integer;
nHeight: Integer;
nImageSize: Integer;
end;
FTRSCAN_IMAGE_SIZE = _FTRSCAN_IMAGE_SIZE;
PFTRSCAN_IMAGE_SIZE = ^_FTRSCAN_IMAGE_SIZE;
_FTRSCAN_FAKE_REPLICA_PARAMETERS = packed record
bCalculated: BOOL;
nCalculatedSum1: Integer;
nCalculatedSumFuzzy: Integer;
nCalculatedSumEmpty: Integer;
nCalculatedSum2: Integer;
dblCalculatedTremor: Double;
dblCalculatedValue: Double;
end;
FTRSCAN_FAKE_REPLICA_PARAMETERS = _FTRSCAN_FAKE_REPLICA_PARAMETERS;
PFTRSCAN_FAKE_REPLICA_PARAMETERS = ^_FTRSCAN_FAKE_REPLICA_PARAMETERS;
_FTRSCAN_FRAME_PARAMETERS = packed record
nContrastOnDose2: Integer;
nContrastOnDose4: Integer;
nDose: Integer;
nBrightnessOnDose1: Integer;
nBrightnessOnDose2: Integer;
nBrightnessOnDose3: Integer;
nBrightnessOnDose4: Integer;
FakeReplicaParams: FTRSCAN_FAKE_REPLICA_PARAMETERS;
Reserved: array[0..64-SizeOf(FTRSCAN_FAKE_REPLICA_PARAMETERS)-1] of Byte;
end;
FTRSCAN_FRAME_PARAMETERS = _FTRSCAN_FRAME_PARAMETERS;
PFTRSCAN_FRAME_PARAMETERS = ^_FTRSCAN_FRAME_PARAMETERS;
__FTRSCAN_INTERFACE_STATUS = (
FTRSCAN_INTERFACE_STATUS_CONNECTED,
FTRSCAN_INTERFACE_STATUS_DISCONNECTED
);
FTRSCAN_INTERFACE_STATUS = __FTRSCAN_INTERFACE_STATUS;
PFTRSCAN_INTERFACE_STATUS = ^__FTRSCAN_INTERFACE_STATUS;
__FTRSCAN_INTERFACES_LIST = packed record
InterfaceStatus: array[0..FTR_MAX_INTERFACE_NUMBER-1] of FTRSCAN_INTERFACE_STATUS;
end;
FTRSCAN_INTERFACES_LIST = __FTRSCAN_INTERFACES_LIST;
PFTRSCAN_INTERFACES_LIST = ^__FTRSCAN_INTERFACES_LIST;
function ftrScanOpenDevice: FTRHANDLE; stdcall;
function ftrScanOpenDeviceOnInterface(nInterface: Integer): FTRHANDLE; stdcall;
procedure ftrScanCloseDevice(ftrHandle: FTRHANDLE); stdcall;
function ftrScanSetOptions(ftrHandle: FTRHANDLE; dwMask, dwFlags: DWORD): BOOL; stdcall;
function ftrScanGetOptions(ftrHandle: FTRHANDLE; lpdwFlags: LPDWORD): BOOL; stdcall;
function ftrScanGetInterfaces(pInterfaceList: PFTRSCAN_INTERFACES_LIST): BOOL; stdcall;
function ftrSetBaseInterface(nBaseInterface: Integer): BOOL; stdcall;
function ftrGetBaseInterfaceNumber: Integer; stdcall;
function ftrScanGetFakeReplicaInterval(pdblMinFakeReplicaValue, pdblMaxFakeReplicaValue: PDouble): BOOL; stdcall;
procedure ftrScanSetFakeReplicaInterval(dblMinFakeReplicaValue, dblMaxFakeReplicaValue: Double); stdcall;
function ftrScanGetImageSize(ftrHandle: FTRHANDLE; pImageSize: PFTRSCAN_IMAGE_SIZE): BOOL; stdcall;
function ftrScanGetImage(ftrHandle: FTRHANDLE; nDose: Integer; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetFuzzyImage(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetBacklightImage(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetDarkImage(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanGetColourImage(ftrHandle: FTRHANDLE; pDoubleSizeBuffer: Pointer): BOOL; stdcall;
function ftrScanGetSmallColourImage(ftrHandle: FTRHANDLE; pSmallBuffer: Pointer): BOOL; stdcall;
function ftrScanGetColorDarkImage(ftrHandle: FTRHANDLE; pDoubleSizeBuffer: Pointer): BOOL; stdcall;
function ftrScanIsFingerPresent(ftrHandle: FTRHANDLE; pFrameParameters: PFTRSCAN_FRAME_PARAMETERS): BOOL; stdcall;
function ftrScanGetFrame(ftrHandle: FTRHANDLE; pBuffer: Pointer; pFrameParameters: PFTRSCAN_FRAME_PARAMETERS): BOOL; stdcall;
function ftrScanSave7Bytes(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
function ftrScanRestore7Bytes(ftrHandle: FTRHANDLE; pBuffer: Pointer): BOOL; stdcall;
type
PFTRCALIBRATEFNCB = function(pContext, pParams: Pointer): BOOL; cdecl;
function ftrScanZeroCalibration(pfnCallbackProc: PFTRCALIBRATEFNCB; pContext: Pointer): BOOL; stdcall;
function ftrScanZeroCalibration2(dwOptions: DWORD; pfnCallbackProc: PFTRCALIBRATEFNCB; pContext: Pointer): BOOL; stdcall;
function ftrScanGetCalibrationConstants(ftrHandle: FTRHANDLE; pbyIRConst, pbyFuzzyConst: PByte): BOOL; stdcall;
function ftrScanStoreCalibrationConstants(ftrHandle: FTRHANDLE; byIRConst, byFuzzyConst: Byte; bBurnInFlash: BOOL): BOOL; stdcall;
function ftrScanGetFakeReplicaParameters(ftrHandle: FTRHANDLE; pFakeReplicaParams: PFTRSCAN_FAKE_REPLICA_PARAMETERS): BOOL; stdcall;
function ftrScanSetNewAuthorizationCode(ftrHandle: FTRHANDLE; pSevenBytesAuthorizationCode: Pointer): BOOL; stdcall;
function ftrScanSaveSecret7Bytes(ftrHandle: FTRHANDLE; pSevenBytesAuthorizationCode, pBuffer: Pointer): BOOL; stdcall;
function ftrScanRestoreSecret7Bytes(ftrHandle: FTRHANDLE; pSevenBytesAuthorizationCode, pBuffer: Pointer): BOOL; stdcall;
function ftrScanSetDiodesStatus(ftrHandle: FTRHANDLE; byGreenDiodeStatus, byRedDiodeStatus: Byte): BOOL; stdcall;
function ftrScanGetDiodesStatus(ftrHandle: FTRHANDLE; pbIsGreenDiodeOn, pbIsRedDiodeOn: PBOOL): BOOL; stdcall;
implementation
const
ftrScanAPI = 'ftrScanAPI.dll';
function ftrScanOpenDevice; external ftrScanAPI;
function ftrScanOpenDeviceOnInterface; external ftrScanAPI;
procedure ftrScanCloseDevice; external ftrScanAPI;
function ftrScanSetOptions; external ftrScanAPI;
function ftrScanGetOptions; external ftrScanAPI;
function ftrScanGetInterfaces; external ftrScanAPI;
function ftrSetBaseInterface; external ftrScanAPI;
function ftrGetBaseInterfaceNumber; external ftrScanAPI;
function ftrScanGetFakeReplicaInterval; external ftrScanAPI;
procedure ftrScanSetFakeReplicaInterval; external ftrScanAPI;
function ftrScanGetImageSize; external ftrScanAPI;
function ftrScanGetImage; external ftrScanAPI;
function ftrScanGetFuzzyImage; external ftrScanAPI;
function ftrScanGetBacklightImage; external ftrScanAPI;
function ftrScanGetDarkImage; external ftrScanAPI;
function ftrScanGetColourImage; external ftrScanAPI;
function ftrScanGetSmallColourImage; external ftrScanAPI;
function ftrScanGetColorDarkImage; external ftrScanAPI;
function ftrScanIsFingerPresent; external ftrScanAPI;
function ftrScanGetFrame; external ftrScanAPI;
function ftrScanSave7Bytes; external ftrScanAPI;
function ftrScanRestore7Bytes; external ftrScanAPI;
function ftrScanZeroCalibration; external ftrScanAPI;
function ftrScanZeroCalibration2; external ftrScanAPI;
function ftrScanGetCalibrationConstants; external ftrScanAPI;
function ftrScanStoreCalibrationConstants; external ftrScanAPI;
function ftrScanGetFakeReplicaParameters; external ftrScanAPI;
function ftrScanSetNewAuthorizationCode; external ftrScanAPI;
function ftrScanSaveSecret7Bytes; external ftrScanAPI;
function ftrScanRestoreSecret7Bytes; external ftrScanAPI;
function ftrScanSetDiodesStatus; external ftrScanAPI;
function ftrScanGetDiodesStatus; external ftrScanAPI;
end.
Upvotes: 0