16,748
社区成员
发帖
与我相关
我的任务
分享
type
stAPDU = record
cla :array[0..3-1] of AnsiChar;
ins:array[0..3-1] of AnsiChar;
p1:array[0..3-1] of AnsiChar;
p2:array[0..3-1] of AnsiChar;
p3:array[0..3-1] of AnsiChar;
data:array[0..256-1] of AnsiChar;
end;
LPAPDU = ^stAPDU;
function gCPUCommand(APDU :LPAPDU; SW, Data, pchErrMsg: AnsiChar): smallint;stdcall;
var
APDU:stAPDU;
chErrMsg:array[0..256-1] of AnsiChar;
SW:array[0..10-1] of AnsiChar
Data: array[0..128-1] of AnsiChar;
ret: SmallInt;
begin
fillchar(chErrMsg,256,0);
fillchar(Data,128,0);
fillchar(SW,10,0);
fillchar(State,3,0);
strpcpy( APDU.cla, '00'); strpcpy( APDU.ins ,'00');
strpcpy( APDU.p1 , '00'); strpcpy( APDU.p2 , '00');
strpcpy( APDU.p3 , '00'); strpcpy( APDU.data , '00');
ret := gCPUCommand( @APDU,SW,Data,chErrMsg);
typedef struct
{
char cla[3];
char ins[3];
char p1[3];
char p2[3];
char p3[3];
char data[256];
}stAPDU;
//搞個對齊做什麼??
type sApdu =record
cla: array[0..2] of char;
ins : array[0..2] of char;
p1: array[0..2] of char ;
p2 : array[0..2] of char ;
p3 : arraya[0..2] of char ;
data : array[0..255] of char;
end;
PsendComm=^sapdu;
sendComm:PsendComm;
sendComm^.cla:=pchar(Copy(pbSendBuf,1,2));
sendComm^.ins :=pchar(Copy(pbSendBuf,3,2));
sendComm^.p1 :=pchar(Copy(pbSendBuf,5,2));
sendComm^.p2 :=pchar(Copy(pbSendBuf,7,2));
sendComm^.p3 :=pchar(Copy(pbSendBuf,9,2));
sendComm^.data :=pchar(Copy(pbSendBuf,11,length(pbSendBuf)));
ulRet := gCPUCommand(sendComm,SW,pbReData,pchErrMsg);//返回Command BCC Verify Error