谁有IC卡开发的例子( 卡型是SLE4442) (0分)

  • 主题发起人 主题发起人 linxia
  • 开始时间 开始时间
L

linxia

Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是西门子SlE4442的卡,
我只在IC卡中存储一个索引号,其它的信息根据索引号去中央数据库中查找。稳定性和保密性都有了一定的保证.

我买的读卡器它的源程序是 For delphi3, 我在delphi6里头打开不能运行,少IC32.dll文件,
我找遍了所有文件都没有找着.

谁有这方面的经验 谢谢指点一下
 
为什么我用
st:=IC_InitType(icdev,42);
if st>=0 then
begin
stringtemp:=edit1.text;
strpcopy(s,stringtemp);
len:=strlen(s);
if len=0 then
begin
showmessage('you should write some data...');
exit;
end;
st:=IC_Write(icdev,32,len,s);
if st=0 then
begin
showmessage('write is error.');
exit;
end;

我用ic_write(icdev,32,len,s)为什么不能写入数据, 怎样才能写入数据
 
如能解决卡的读写操作,我愿意出50元请您吃饭. 重谢
 
ic32.dll应是厂方提供的,并应应有相应的申明,你贴出来看看
 
好的.

unit At24;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons;

type
TForm1 = class(TForm)
Button1: TButton;
readdata1: TEdit;
Label1: TLabel;
writedata: TEdit;
Label2: TLabel;
readdata2: TEdit;
Label3: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
icdev: longint;
Form1: TForm1;
{a example for your to try using .dll. add_s return i+1}
function add_s(i: smallint): smallint; stdcall;
far;external 'ic32.DLL' name 'add_s';
{comm function.}
function IC_InitComm(port: smallint): longint; stdcall;
far;external 'ic32.DLL' name 'IC_InitComm';
function IC_ExitComm(icdev: longint):smallint;stdcall;
far;external 'ic32.dll'name 'IC_ExitComm';
function IC_Status(icdev: longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Status';
function IC_InitType(icdev: longint; cardtype: smallint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_InitType';
function IC_Write(icdev: longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Write';
function IC_Read(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Read';
function IC_Erase(icdev:longint;offset:smallint;len:smallint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Erase';
function IC_Read_Float(icdev:longint;offset:smallint;fdata:pointer):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Read_Float';
function IC_Write_Float(icdev:longint;offset:smallint;fdata:single):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Write_Float';
function IC_Down(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Down';
function IC_Pushout(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Down';
{4442 function.}
function IC_ReadProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadProtection';
function IC_WriteProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_WriteProtection';
function IC_ReadCount_SLE4442(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_SLE4442';
function IC_CheckPass_SLE4442(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_SLE4442';
function IC_ChangePass_SLE4442(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_SLE4442';
{4428 function.}
function IC_ReadWithProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadWithProtection';
function IC_WriteWithProtection(icdev:longint;offset:smallint;len:smallint;databuff:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_WriteWithProtection';
function IC_ReadCount_SLE4428(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_SLE4428';
function IC_CheckPass_SLE4428(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_SLE4428';
function IC_ChangePass_SLE4428(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_SLE4428';
{102 function}
function IC_CheckPass_102(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_102';
function IC_ChangePass_102(icdev:longint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_102';
function IC_ReadCount_102(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_102';
function IC_Erase_102(icdev:longint;offset:smallint;len:smallint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Erase_102';
function IC_CheckAZPass_102(icdev:longint;zone:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckAZPass_102';
function IC_ChangeAZPass_102(icdev:longint;zone:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangeAZPass_102';
function IC_Fuse_102(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Fuse_102';
{4406 function.}
function IC_RValue(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_RValue';
function IC_DEValue(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_DEValue';
{1604 function.}
function IC_ChangePass_1604(icdev:longint;area:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ChangePass_1604';
function IC_CheckPass_1604(icdev:longint;area:smallint;password:pchar):smallint;stdcall;
far;external 'ic32.dll' name 'IC_CheckPass_1604';
function IC_ReadCount_1604(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_ReadCount_1604';
function IC_Fuse_1604(icdev:longint):smallint;stdcall;
far;external 'ic32.dll' name 'IC_Fuse_1604';
implementation

{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
st: smallint;
len: smallint;
s: pchar;
stringtemp: string[128];
wdata: single;
rdata: single;
begin
{this pro must can use in you system. the 2 is the result in the screen.}
{len:=add_s(1);
str(len,s);
showmessage(s);
exit;}
{next,you should to use com1,else you must change 0 to other.}
s:=stralloc(100);
if icdev>=0 then
begin
st:=IC_Status(icdev);
if st<>0 then
begin
showmessage('system error. you must exit the program and retry again...');
exit;
end;
if st=1 then
begin
showmessage('Please insert card.');
exit;
end
else
begin
st:=IC_InitType(icdev,64);
if st=0 then
begin
stringtemp:=writedata.text;
strpcopy(s,stringtemp);
len:=strlen(s);
if len=0 then
begin
showmessage('you should write some data...');
exit;
end;
st:=IC_Write(icdev,42,len,s);
if st<0 then
begin
showmessage('write is error.');
exit;
end;
st:=IC_Read(icdev,32,len,s);
if st=0 then
begin
s[len]:=#0;
readdata2.text:=strpas(s);
end
else
showmessage('read is bad...');
st:=IC_Read(icdev,0,12,s);
if st=0 then
begin
s[12]:=#0;
readdata1.text:=strpas(s);
end
else
showmessage('read is bad...');
wdata:=1.2345678;
st:=IC_Write_Float(icdev,0,wdata);
if st<0 then
begin
showmessage('read_flaot unsuccseccful');
exit;
end;
st:=IC_Read_Float(icdev,0,addr(rdata));
if st<0 then
begin
showmessage('write_float is unsuccseccful');
exit;
end;
{FloatToStrF(rdata,ffGenera,7,1)}
stringtemp:=FloatToStr(rdata);
showmessage(stringtemp);
end
else
showmessage('initcard error.');
end;
end;
StrDispose(s);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
password102: pchar;
st: smallint;
begin
password102:=stralloc(4);
password102:=chr(240)+chr(240);
st:=IC_InitType(icdev,32);
if st>=0 then
begin
st:=IC_CheckPass_102(icdev,password102);
if st<0 then
showmessage('the password is not 0xf0f0.')
else
showmessage('the password ok!');
end
else
showmessage('inittype 102 is error.');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
icdev:=IC_InitComm(0);
if icdev<0 then
begin
showmessage('error to initcomm.');
exit;
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
var
st:integer;
begin
st:=IC_ExitComm(icdev);
if st<0 then
begin
showmessage('error on exitcomm.');
exit;
end;
end;
end.
 
LKIC32.DLL提供的函数:
1.IC_Status() 返回读写器状态
2.IC_Down() 对卡下电
3.IC_InitComm() 打开串口
4.IC_ExitComm() 关闭串口
5.IC_InitType () 设置要读卡的类型
6.IC_Read () 读IC卡的内容
7.IC_Write () 写内容到IC卡
8.IC_Erase () 对IC卡擦除操作(写FF)
9.IC_Read_Float() 读IC卡存储的浮点数
10.IC_Write_Float() 写浮点数到IC卡
11.IC_Encrypt() DES算法加密函数
12.IC_Decrypt() DES算法解密函数
13.IC_Read_Hex() 16进制读
14.IC_Write_Hex() 16进制写
15.IC_Read_Int() 读整型函数
16.IC_Write_Int() 写整型函数

这是它的函数
 
上面的这段代码里头有好几种卡的函数,我用的卡是SlE4442
 
上面全都是厂商提供的源程序, 但是我用它的源程序运行,不能写,也不能读.程序也不出错不知为什么
 
怎么没人理我
 
不是不理你,是我真的没玩过那东东。呵呵[:D]
 
解决了吗?可与我联系。我作过。
主要技术是,搞清除如何在delphi中调用DLL程序。
 
哈哈哈哈,凡是要在IC卡中写数据,就必须先用IC_CheckPass_SLE4442校验密码,校验密码
正确后才能写入数据。IC卡的初始密码是FFFFFF。你试试看。
记住,给分!我已经搞了一个IC卡的局域网管理系统。还有什么尽可问!但是我要分!哈哈!
 
你用的是什么公司的读卡器,我用深圳明华奥汉有限公司的读卡器
不能识别4442卡类型,只能识别4428卡,如果不行可以改用4428卡
此卡的容量比4442卡大
 
^_^,不用说了,我也是用的深圳明华的西门子4442的卡。没问题。
如果只能识别4428的卡,可能是你调用的函数不对。应该没问题。
再试试看!!!!!
 
同意wanxu的说,读写需要密码,不过不一定是FFFFFF,可能给的linxia IC卡已经被初始化过,
密码给改了,要问厂家(不一定给你哟),另一种办法(破解,我就是这样做的)
 
厂家出来的IC卡,一般都要初始化,这个初始化密码根据厂家提供的为准。你再试试看。
 
本人对ic卡一无所知,想学因条件限制,听了你们的讨论和看了linxia的程序,
对ic卡程序有深厚的兴趣,特向各位大虾讨教讨教,ic卡读写机制,以及流程,
以及应用前景,呵呵,希望各位大虾不吝赐教,发个ic32.dll给小弟,让我也接触以下
greatwu0318@163.com
 
给分哟!!!!
 
各路高手
我用的SLE4442卡
如果有相关开发资料和开发事例烦请Copy发给我一份
lgq4@0451.com
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
943
DelphiTeacher的专栏
D
后退
顶部