G
Guest
Hi guyz
I'm stuck up in this smart card SCardTransmit function. I still don't get how this function works . I'm currently trying to write some data to the smart card. Can anyone help me with some sample code written in VB6. I have a very tight dead line here without much documentation on hand.
I have the following code:-
Public Function updateSCard(ByVal lAddress As Byte, ByVal xStr As String) As Strin
''Dim abyGetChallenge(0 To 8) As Byt
Dim abyGetChallenge(0 To 4) As Byt
Dim pioSendPci As SCARD_IO_REQUES
Dim abyRecvBuffer(0 To intByteMax) As Byt
Dim byteData(0 To 3) As Byt
Dim rv As Lon
Dim xHex As Strin
Dim xFilledStr As Strin
pioSendPci.dwProtocol = SCARD_PROTOCOL_T
pioSendPci.dbPciLength = Len(pioSendPci
xFilledStr = xStr & Chr(0) & Chr(0) & Chr(0) & Chr(0
byteData(0) = Asc(Mid(xFilledStr, 1, 1)
byteData(1) = Asc(Mid(xFilledStr, 2, 1)
byteData(2) = Asc(Mid(xFilledStr, 3, 1)
byteData(3) = Asc(Mid(xFilledStr, 4, 1)
abyGetChallenge(0) = &H8
abyGetChallenge(1) = &HD
abyGetChallenge(2) = &H
abyGetChallenge(3) = lAddres
abyGetChallenge(4) = byteData(0
rv = SCardTransmit(m_hCard, pioSendPci, abyGetChallenge(0),
UBound(abyGetChallenge) - LBound(abyGetChallenge) + 5,
pioSendPci, abyRecvBuffer(0),
UBound(abyRecvBuffer) - LBound(abyRecvBuffer) + 1
If rv <> SCARD_S_SUCCESS The
MsgBox r
Call MsgBox("updateSCard failed", vbCritical
updateSCard = "
Exit Functio
End I
If Not (&H90 = abyRecvBuffer(0) And &H0 = abyRecvBuffer(1)) The
Call MsgBox("updateSCard - update smart card failed..", vbCritical, "PCSC"
End I
End Function
I'm stuck up in this smart card SCardTransmit function. I still don't get how this function works . I'm currently trying to write some data to the smart card. Can anyone help me with some sample code written in VB6. I have a very tight dead line here without much documentation on hand.
I have the following code:-
Public Function updateSCard(ByVal lAddress As Byte, ByVal xStr As String) As Strin
''Dim abyGetChallenge(0 To 8) As Byt
Dim abyGetChallenge(0 To 4) As Byt
Dim pioSendPci As SCARD_IO_REQUES
Dim abyRecvBuffer(0 To intByteMax) As Byt
Dim byteData(0 To 3) As Byt
Dim rv As Lon
Dim xHex As Strin
Dim xFilledStr As Strin
pioSendPci.dwProtocol = SCARD_PROTOCOL_T
pioSendPci.dbPciLength = Len(pioSendPci
xFilledStr = xStr & Chr(0) & Chr(0) & Chr(0) & Chr(0
byteData(0) = Asc(Mid(xFilledStr, 1, 1)
byteData(1) = Asc(Mid(xFilledStr, 2, 1)
byteData(2) = Asc(Mid(xFilledStr, 3, 1)
byteData(3) = Asc(Mid(xFilledStr, 4, 1)
abyGetChallenge(0) = &H8
abyGetChallenge(1) = &HD
abyGetChallenge(2) = &H
abyGetChallenge(3) = lAddres
abyGetChallenge(4) = byteData(0
rv = SCardTransmit(m_hCard, pioSendPci, abyGetChallenge(0),
UBound(abyGetChallenge) - LBound(abyGetChallenge) + 5,
pioSendPci, abyRecvBuffer(0),
UBound(abyRecvBuffer) - LBound(abyRecvBuffer) + 1
If rv <> SCARD_S_SUCCESS The
MsgBox r
Call MsgBox("updateSCard failed", vbCritical
updateSCard = "
Exit Functio
End I
If Not (&H90 = abyRecvBuffer(0) And &H0 = abyRecvBuffer(1)) The
Call MsgBox("updateSCard - update smart card failed..", vbCritical, "PCSC"
End I
End Function