SLE4432/4442函数库
来源:互联网 发布:沙迪克火花机镜面编程 编辑:程序博客网 时间:2024/06/11 18:49
Declare Function srd_4442()Function srd_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function srd_4442_hex()Function srd_4442_hex Lib "mwic_32.dll" Alias "srd_4442" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByRef data_buff As Byte) As Integer
Declare Function swr_4442()Function swr_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function swr_4442_hex()Function swr_4442_hex Lib "mwic_32.dll" Alias "swr_4442" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function prd_4442()Function prd_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function pwr_4442()Function pwr_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function chk_4442()Function chk_4442 Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function csc_4442()Function csc_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function wsc_4442()Function wsc_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function rsc_4442()Function rsc_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function rsct_4442()Function rsct_4442 Lib "mwic_32.dll" (ByVal icdev As Long, counter As Integer) As Integer
Declare Function asc_hex()Function asc_hex Lib "mwic_32.dll" (ByVal asc$, ByRef hex As Byte, ByVal le&) As Integer
Declare Function hex_asc()Function hex_asc Lib "mwic_32.dll" (ByRef hex As Byte, ByVal asc$, ByVal le&) As Integer
Declare Function asc_asc()Function asc_asc% Lib "mwic_32.dll" (ByVal sorc$, ByRef des As Byte, ByVal le&)
Declare Function ic_encrypt()Function ic_encrypt Lib "mwic_32.dll" (ByVal key As String, ByVal ptrsource As String, ByVal le As Integer, ByRef ptrdest As Byte) As Integer
Declare Function ic_decrypt()Function ic_decrypt Lib "mwic_32.dll" (ByVal key As String, ByRef ptrdest As Byte, ByVal le As Integer, ByVal ptrsource As String) As Integer
Declare Function srd_4442_hex()Function srd_4442_hex Lib "mwic_32.dll" Alias "srd_4442" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByRef data_buff As Byte) As Integer
Declare Function swr_4442()Function swr_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function swr_4442_hex()Function swr_4442_hex Lib "mwic_32.dll" Alias "swr_4442" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function prd_4442()Function prd_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function pwr_4442()Function pwr_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal offset As Integer, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function chk_4442()Function chk_4442 Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function csc_4442()Function csc_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function wsc_4442()Function wsc_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function rsc_4442()Function rsc_4442 Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByRef data_buffer As Byte) As Integer
Declare Function rsct_4442()Function rsct_4442 Lib "mwic_32.dll" (ByVal icdev As Long, counter As Integer) As Integer
Declare Function asc_hex()Function asc_hex Lib "mwic_32.dll" (ByVal asc$, ByRef hex As Byte, ByVal le&) As Integer
Declare Function hex_asc()Function hex_asc Lib "mwic_32.dll" (ByRef hex As Byte, ByVal asc$, ByVal le&) As Integer
Declare Function asc_asc()Function asc_asc% Lib "mwic_32.dll" (ByVal sorc$, ByRef des As Byte, ByVal le&)
Declare Function ic_encrypt()Function ic_encrypt Lib "mwic_32.dll" (ByVal key As String, ByVal ptrsource As String, ByVal le As Integer, ByRef ptrdest As Byte) As Integer
Declare Function ic_decrypt()Function ic_decrypt Lib "mwic_32.dll" (ByVal key As String, ByRef ptrdest As Byte, ByVal le As Integer, ByVal ptrsource As String) As Integer
Declare Function usb_auto_init()Function usb_auto_init Lib "mwic_32.dll" () As Long
Declare Function usb_ic_init()Function usb_ic_init Lib "mwic_32.dll" () As Long
Declare Function get_status()Function get_status Lib "mwic_32.dll" (ByVal icdev As Long, ByRef status As Integer) As Integer
Declare Function cmp_dvsc()Function cmp_dvsc Lib "mwic_32.dll" (ByVal icdev As Long, ByVal length As Integer, ByVal data_buffer$) As Integer
Declare Function srd_dvsc()Function srd_dvsc Lib "mwic_32.dll" (ByVal icdev As Long, ByVal length As Long, ByVal data_buffer$) As Integer
Declare Function swr_dvsc()Function swr_dvsc Lib "mwic_32.dll" (ByVal icdev As Long, ByVal length As Integer, ByVal data_buffer$) As Integer
Declare Function setsc_md()Function setsc_md Lib "mwic_32.dll" (ByVal icdev As Long, ByVal mode As Integer) As Integer
Declare Function turn_on()Function turn_on Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function turn_off()Function turn_off Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function srd_ver()Function srd_ver Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function auto_pull()Function auto_pull Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function dv_beep()Function dv_beep Lib "mwic_32.dll" (ByVal icdev As Long, ByVal time As Integer) As Integer
Declare Function usb_ic_exit()Function usb_ic_exit% Lib "mwic_32.dll" (ByVal icdev As Long)
Declare Function usb_ic_init()Function usb_ic_init Lib "mwic_32.dll" () As Long
Declare Function get_status()Function get_status Lib "mwic_32.dll" (ByVal icdev As Long, ByRef status As Integer) As Integer
Declare Function cmp_dvsc()Function cmp_dvsc Lib "mwic_32.dll" (ByVal icdev As Long, ByVal length As Integer, ByVal data_buffer$) As Integer
Declare Function srd_dvsc()Function srd_dvsc Lib "mwic_32.dll" (ByVal icdev As Long, ByVal length As Long, ByVal data_buffer$) As Integer
Declare Function swr_dvsc()Function swr_dvsc Lib "mwic_32.dll" (ByVal icdev As Long, ByVal length As Integer, ByVal data_buffer$) As Integer
Declare Function setsc_md()Function setsc_md Lib "mwic_32.dll" (ByVal icdev As Long, ByVal mode As Integer) As Integer
Declare Function turn_on()Function turn_on Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function turn_off()Function turn_off Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function srd_ver()Function srd_ver Lib "mwic_32.dll" (ByVal icdev As Long, ByVal le As Integer, ByVal data_buffer$) As Integer
Declare Function auto_pull()Function auto_pull Lib "mwic_32.dll" (ByVal icdev As Long) As Integer
Declare Function dv_beep()Function dv_beep Lib "mwic_32.dll" (ByVal icdev As Long, ByVal time As Integer) As Integer
Declare Function usb_ic_exit()Function usb_ic_exit% Lib "mwic_32.dll" (ByVal icdev As Long)
Dim Data1 As String * 16
Dim Data2 As String * 16
Dim databuff1(7) As Byte
Dim databuff2(7) As Byte
Dim offset As Integer
Dim length As Integer
Dim status As Integer
Dim password(2) As Byte
Dim proval As String * 8
Dim counter As Integer
Dim oldpass As String
Dim ptrdest(16) As Byte
Dim ptrsource As String * 16
Private Sub Command6_Click()
'****************************测4442卡****************************
st = chk_4442(icdev)
If st < 0 Then
List1.AddItem ("chk card error")
Exit Sub
Else
List1.AddItem ("chk card ok")
End If
'******************************校验密码****************************
'password(0) = &HB6
'password(1) = &H23
'password(2) = &H7
'oldpass = "ffffff"
'st = asc_hex(oldpass, password(0), 3)
'If st < 0 Then
' List1.AddItem ("asc_hex error")
' Exit Sub
'Else
' List1.AddItem ("asc_hex ok")
'End If
'
'
'st = csc_4442(icdev, 3, password(0))
'If st < 0 Then
' List1.AddItem ("csc error")
' Exit Sub
'Else
' List1.AddItem ("csc ok")
'End If
'***********************读出卡密码***************************
st = rsc_4442(icdev, 3, password(0))
If st < 0 Then
List1.AddItem ("rsc error")
Exit Sub
Else
List1.AddItem ("rsc ok")
For i = 0 To 2
MsgBox password(i)
Next
End If
'**********************改写密码******************************
password(0) = &HB6
password(1) = &H23
password(2) = &H7
st = wsc_4442(icdev, 3, password(0))
If st < 0 Then
List1.AddItem ("wsc error")
Else
List1.AddItem ("wsc ok")
End If
'*********************读出密码错误计数器**********************
st = rsct_4442(icdev, counter)
If st < 0 Then
List1.AddItem ("rsct error")
Exit Sub
Else
List1.AddItem ("rsct Ok")
List1.AddItem (Str(counter))
End If
'**********************读写卡 *******************************
offset = 40
length = 10
Data1 = "1234567890"
st = swr_4442(icdev, offset, length, Data1)
If st < 0 Then
List1.AddItem ("write error")
Exit Sub
Else
List1.AddItem ("write OK")
End If
st = srd_4442(icdev, offset, length, Data2)
If st < 0 Then
List1.AddItem ("read error")
Exit Sub
Else
List1.AddItem ("read OK")
List1.AddItem (Data2)
End If
'**********************读写保护区******************************
proval = "6"
'st = pwr_4442(icdev, 30, 1, proval)
If st < 0 Then
List1.AddItem ("pwr error")
Exit Sub
Else
List1.AddItem ("pwr OK")
List1.AddItem (proval)
End If
st = prd_4442(icdev, 4, proval)
If st < 0 Then
List1.AddItem ("prd error")
Exit Sub
Else
List1.AddItem ("prd OK")
End If
'*******************十六进制读写******************************
offset = 56
length = 8
Data1 = "abcdef0123456789"
st = asc_hex(Data1, databuff1(0), 8)
If st < 0 Then
List1.AddItem ("asc_hex error")
Else
List1.AddItem ("asc_hex ok")
End If
st = swr_4442_hex(icdev, offset, length, databuff1(0))
If st < 0 Then
List1.AddItem ("write error")
Exit Sub
Else
List1.AddItem ("write ok")
End If
st = srd_4442_hex(icdev, offset, length, databuff2(0))
If st < 0 Then
List1.AddItem ("read error")
Exit Sub
Else
st = hex_asc(databuff2(0), Data2, 8)
List1.AddItem ("read OK")
List1.AddItem (Data2)
End If
'****************************DES算法********************
st = ic_encrypt("12345678", "明华技术开发中心", 16, ptrdest(0))
If st < 0 Then
List1.AddItem ("ic_encrypt error")
Exit Sub
Else
List1.AddItem ("ic_encrypt ok")
End If
st = ic_decrypt("12345678", ptrdest(0), 16, ptrsource)
If st < 0 Then
List1.AddItem ("ic_decrypt error")
Exit Sub
Else
List1.AddItem ("ic_decrypt ok")
List1.AddItem (ptrsource)
End If
'**********************************************************
End Sub
Private Sub Form_Load()
icdev = usb_auto_init()
If icdev < 0 Then
List1.AddItem ("Init error!")
Exit Sub
Else
List1.AddItem ("Init OK")
End If
st = get_status(icdev, status)
If st < 0 Then
List1.AddItem ("Status error")
Exit Sub
Else
List1.AddItem ("Status ok")
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
st = usb_ic_exit(icdev)
End Sub
Dim Data2 As String * 16
Dim databuff1(7) As Byte
Dim databuff2(7) As Byte
Dim offset As Integer
Dim length As Integer
Dim status As Integer
Dim password(2) As Byte
Dim proval As String * 8
Dim counter As Integer
Dim oldpass As String
Dim ptrdest(16) As Byte
Dim ptrsource As String * 16
Private Sub Command6_Click()
'****************************测4442卡****************************
st = chk_4442(icdev)
If st < 0 Then
List1.AddItem ("chk card error")
Exit Sub
Else
List1.AddItem ("chk card ok")
End If
'******************************校验密码****************************
'password(0) = &HB6
'password(1) = &H23
'password(2) = &H7
'oldpass = "ffffff"
'st = asc_hex(oldpass, password(0), 3)
'If st < 0 Then
' List1.AddItem ("asc_hex error")
' Exit Sub
'Else
' List1.AddItem ("asc_hex ok")
'End If
'
'
'st = csc_4442(icdev, 3, password(0))
'If st < 0 Then
' List1.AddItem ("csc error")
' Exit Sub
'Else
' List1.AddItem ("csc ok")
'End If
'***********************读出卡密码***************************
st = rsc_4442(icdev, 3, password(0))
If st < 0 Then
List1.AddItem ("rsc error")
Exit Sub
Else
List1.AddItem ("rsc ok")
For i = 0 To 2
MsgBox password(i)
Next
End If
'**********************改写密码******************************
password(0) = &HB6
password(1) = &H23
password(2) = &H7
st = wsc_4442(icdev, 3, password(0))
If st < 0 Then
List1.AddItem ("wsc error")
Else
List1.AddItem ("wsc ok")
End If
'*********************读出密码错误计数器**********************
st = rsct_4442(icdev, counter)
If st < 0 Then
List1.AddItem ("rsct error")
Exit Sub
Else
List1.AddItem ("rsct Ok")
List1.AddItem (Str(counter))
End If
'**********************读写卡 *******************************
offset = 40
length = 10
Data1 = "1234567890"
st = swr_4442(icdev, offset, length, Data1)
If st < 0 Then
List1.AddItem ("write error")
Exit Sub
Else
List1.AddItem ("write OK")
End If
st = srd_4442(icdev, offset, length, Data2)
If st < 0 Then
List1.AddItem ("read error")
Exit Sub
Else
List1.AddItem ("read OK")
List1.AddItem (Data2)
End If
'**********************读写保护区******************************
proval = "6"
'st = pwr_4442(icdev, 30, 1, proval)
If st < 0 Then
List1.AddItem ("pwr error")
Exit Sub
Else
List1.AddItem ("pwr OK")
List1.AddItem (proval)
End If
st = prd_4442(icdev, 4, proval)
If st < 0 Then
List1.AddItem ("prd error")
Exit Sub
Else
List1.AddItem ("prd OK")
End If
'*******************十六进制读写******************************
offset = 56
length = 8
Data1 = "abcdef0123456789"
st = asc_hex(Data1, databuff1(0), 8)
If st < 0 Then
List1.AddItem ("asc_hex error")
Else
List1.AddItem ("asc_hex ok")
End If
st = swr_4442_hex(icdev, offset, length, databuff1(0))
If st < 0 Then
List1.AddItem ("write error")
Exit Sub
Else
List1.AddItem ("write ok")
End If
st = srd_4442_hex(icdev, offset, length, databuff2(0))
If st < 0 Then
List1.AddItem ("read error")
Exit Sub
Else
st = hex_asc(databuff2(0), Data2, 8)
List1.AddItem ("read OK")
List1.AddItem (Data2)
End If
'****************************DES算法********************
st = ic_encrypt("12345678", "明华技术开发中心", 16, ptrdest(0))
If st < 0 Then
List1.AddItem ("ic_encrypt error")
Exit Sub
Else
List1.AddItem ("ic_encrypt ok")
End If
st = ic_decrypt("12345678", ptrdest(0), 16, ptrsource)
If st < 0 Then
List1.AddItem ("ic_decrypt error")
Exit Sub
Else
List1.AddItem ("ic_decrypt ok")
List1.AddItem (ptrsource)
End If
'**********************************************************
End Sub
Private Sub Form_Load()
icdev = usb_auto_init()
If icdev < 0 Then
List1.AddItem ("Init error!")
Exit Sub
Else
List1.AddItem ("Init OK")
End If
st = get_status(icdev, status)
If st < 0 Then
List1.AddItem ("Status error")
Exit Sub
Else
List1.AddItem ("Status ok")
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
st = usb_ic_exit(icdev)
End Sub
- SLE4432/4442函数库
- 函数库
- 函数库
- 函数库
- 函数库
- 函数库
- 函数库
- 公用函数库
- javascript函数库
- 网络函数库
- 网络函数库
- 网络函数库
- javascript函数库
- javascript函数库
- javascript函数库
- javascript函数库
- javascript函数库
- 文件系统函数库
- 透过汇编另眼看世界之函数调用
- 网站常用英文对照
- IT蓝领编程员再就业的三条出路
- asp.net中时间差的问题
- dataGrid分组
- SLE4432/4442函数库
- Oracle DML封锁机制研究
- C#款额存储过程
- Effective C++之30
- sql的视图到底有什么用处?
- String,StringBuffer与StringBuilder的区别??
- Installed software
- 一个有经验借鉴的小店铺经营之道
- 一起来抗议“注册用户才能发表评论”