Hi, I'm trying to use an API under Delphi. Here's the API documentation
OKERR ENTRY SCardCLMifareStdAuthent
(IN SCARDHANDLE ulHandleCard,IN ULONG ulMifareBlockNr,
IN UCHAR ucMifareAuthMode,IN UCHAR ucMifareAccessType,IN UCHAR ucMifareKeyNr,
IN PUCHAR pucMifareKey,IN ULONG ulMifareKeyLen);
Whereas pucMifareKey: A pointer to the six byte Mifare key
.
The code i've been trying so far;
function Auth():Integer;
type
TSCardCLMifareStdAuthent = function(SCARDHANDLE: cardinal; ulMifareBlockNr: ULONG;
ucMifareAuthMode, ucMifareAccessType, ucMifareKeyNr: byte; pucMifareKey: puchar;
ulMifareKeyLen: cardinal):LONG;
var
SCardCLMifareStdAuthent: TSCardCLMifareStdAuthent;
hDLL: Integer;
CardHandle: cardinal;
i: integer;
Key: array of UCHAR;
begin
Result:=1;
//CardHandle is defined here
SetLength(Key, 6);
for i := low(key) to high(key) do
Key[i] := $FF;
hDLL := LoadLibrary('scardsyn.dll');
@SCardCLMifareStdAuthent := GetProcAddress(hDLL, 'SCardCLMifareStdAuthent');
if @SCardCLMifareStdAuthent <> nil then
Result:=SCardCLMifareStdAuthent(CardHandle, $00, 96, 0, 0, ^Key, 6);
FreeLibrary(hDLL);
end;
The error i'm getting is Incompatible types: 'Byte' and 'Char'
at the line of Result:=SCardCL....
due ^Key pointer. Any ideas?