Eccoti qui qualcosa, ma forse sarebbe meglio che mostri il codice dove ti va in errore
<DllImport("winscard.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function SCardEstablishContext(ByVal dwScope As Integer, ByVal pvReserved1 As IntPtr, ByVal pvReserved2 As IntPtr, ByRef phContext As IntPtr) As Integer
End Function
<DllImport("winscard.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function SCardReleaseContext(ByVal hContext As IntPtr) As Integer
End Function
<DllImport("winscard.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function SCardConnect(ByVal hContext As IntPtr, _
ByVal szReaderName As String, _
ByVal dwShareMode As Integer, _
ByVal dwPreferredProtocols As Integer, _
ByRef phCard As IntPtr, _
ByRef pdwActiveProtocol As Integer) As Integer
End Function
<DllImport("winscard.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function SCardListReaders(ByVal hContext As IntPtr, ByVal mszGroups As String, _
ByVal mszReaders As String, ByRef pcchReaders As UInteger) As Integer
End Function
<DllImport("winscard.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function SCardDisconnect(ByVal phCard As IntPtr, _
ByVal dwDisposition As Integer) As Integer
End Function
<DllImport("winscard.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function SCardTransmit(ByVal phCard As IntPtr, _
ByRef pioSendPci As SCARD_IO_REQUEST, _
ByVal pbSendBuffer As Byte(), _
ByVal cbSendLength As Int32, _
ByRef pioRecvPci As SCARD_IO_REQUEST, _
ByVal pbRecvBuffer As Byte(), _
ByRef RecvBuffLen As Int32) As Integer
End Function
<StructLayout(LayoutKind.Sequential)> _
Private Structure SCARD_IO_REQUEST
Dim dwProtocol As Int32
Dim dbPciLength As Int32
End Structure