C结构体
struct ICCCommand
{
unsigned int function; /* Function (see function table ) */
unsigned int efIdent; /* short EF-Identifier */
unsigned int dataPointer; /* file- offset / record number */
unsigned int lc; /* length send data */
unsigned char * data; /* send datablock */
unsigned int le; /* max length response */
};
struct ICCResponse
{
unsigned char sw1; /* Status bytes */
unsigned char sw2; /* */
unsigned int ldata; /* length response */
unsigned char * data; /* respons datablock */
};
struct ICCSecurity
{
unsigned char macDown; /* signature algorithm */
unsigned char macUp; /* */
unsigned char * macKey; /* signature key */ unsigned char encDown; /* encryption algorithm */
unsigned char encUp; /* */
unsigned char * encKey; /* encryption key */
};
C动态库int ICCCreateFile (struct ICCCommand * com,
struct ICCResponse * res,
struct ICCSecurity * sec,
int ch,int mode
)
delphi结构体
PICCCommand=^ICCCommand1;
PICCResponse=^ICCResponse1;
PICCSecurity=^ICCSecurity1;
ICCResponse1 = packed record
sw1:byte;
sw2:byte;
ldata:LongWord;
data:PChar;
end; ICCCommand1 = packed record
func:LongWord;
efident:LongWord;
datapointer:LongWord;
lc:LongWord;
data:PChar;
le:LongWord;
end ; ICCSecurity1 = packed record
macdown:byte;
macup:byte;
mackey:pchar;
encdown:byte;
encup:byte;
enckey:pchar;
end ;
delphi调用
function ICCCreateFile1(var command:PICCcommand; var response:PICCresponse;var security:PICCSecurity;handle_IC,t:LongInt):LongInt;external 'cardos32.dll' name 'ICCCreateFile'; New(ic_command1);
New(ic_reutrn1);
New(ic_security1);
try ic_command1.func := 63 ;
ic_command1.efIdent := 0 ;
ic_command1.datapointer := 0 ; s1 := '0000000038ffffff0000';
ic_command1.data := StrNew(PChar(S1)); //ic_command1.data := P2;//'0000000038ffffff0000' ;
ic_command1.lc := 10 ;
ic_command1.le := 300 ;
s := space(300);
ic_reutrn1.data := StrNew(PChar(S));
// StrCopy(ic_reutrn1.data,@s);
// ic_reutrn1.data := space(300) ;
ic_security1.encDown := 0 ;
ic_security1.encUp := 0 ;
ic_security1.macDown := 0 ;
ic_security1.macUp := 0 ; if ICCCreateFile1(ic_command1,ic_reutrn1,ic_security1,handle_ic,1) = 0 then
这一句一调用就报地址错误,各位帮忙看一下什么原因呢,谢谢
struct ICCCommand
{
unsigned int function; /* Function (see function table ) */
unsigned int efIdent; /* short EF-Identifier */
unsigned int dataPointer; /* file- offset / record number */
unsigned int lc; /* length send data */
unsigned char * data; /* send datablock */
unsigned int le; /* max length response */
};
struct ICCResponse
{
unsigned char sw1; /* Status bytes */
unsigned char sw2; /* */
unsigned int ldata; /* length response */
unsigned char * data; /* respons datablock */
};
struct ICCSecurity
{
unsigned char macDown; /* signature algorithm */
unsigned char macUp; /* */
unsigned char * macKey; /* signature key */ unsigned char encDown; /* encryption algorithm */
unsigned char encUp; /* */
unsigned char * encKey; /* encryption key */
};
C动态库int ICCCreateFile (struct ICCCommand * com,
struct ICCResponse * res,
struct ICCSecurity * sec,
int ch,int mode
)
delphi结构体
PICCCommand=^ICCCommand1;
PICCResponse=^ICCResponse1;
PICCSecurity=^ICCSecurity1;
ICCResponse1 = packed record
sw1:byte;
sw2:byte;
ldata:LongWord;
data:PChar;
end; ICCCommand1 = packed record
func:LongWord;
efident:LongWord;
datapointer:LongWord;
lc:LongWord;
data:PChar;
le:LongWord;
end ; ICCSecurity1 = packed record
macdown:byte;
macup:byte;
mackey:pchar;
encdown:byte;
encup:byte;
enckey:pchar;
end ;
delphi调用
function ICCCreateFile1(var command:PICCcommand; var response:PICCresponse;var security:PICCSecurity;handle_IC,t:LongInt):LongInt;external 'cardos32.dll' name 'ICCCreateFile'; New(ic_command1);
New(ic_reutrn1);
New(ic_security1);
try ic_command1.func := 63 ;
ic_command1.efIdent := 0 ;
ic_command1.datapointer := 0 ; s1 := '0000000038ffffff0000';
ic_command1.data := StrNew(PChar(S1)); //ic_command1.data := P2;//'0000000038ffffff0000' ;
ic_command1.lc := 10 ;
ic_command1.le := 300 ;
s := space(300);
ic_reutrn1.data := StrNew(PChar(S));
// StrCopy(ic_reutrn1.data,@s);
// ic_reutrn1.data := space(300) ;
ic_security1.encDown := 0 ;
ic_security1.encUp := 0 ;
ic_security1.macDown := 0 ;
ic_security1.macUp := 0 ; if ICCCreateFile1(ic_command1,ic_reutrn1,ic_security1,handle_ic,1) = 0 then
这一句一调用就报地址错误,各位帮忙看一下什么原因呢,谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货