title: Scard32.dll and similar
body: <p>i wrote this post for asking you to help me.
  My requiremente is to read and write to a smart card (sle4428) using a scard32.dll in c# context. The reader is SCR 3310 of SCM Microsystem</p>
  
  <p>First of all I have a vb.net code which run correctlty and i'm able to read and write data.
  The problem is whern i try to do the same thing using c#.
  My first attemps was to translate the native call "SCardComand" in c# but fail.
  The second attemps was to build a dll from the VB.net code and use it in a c# context but still fail.</p>
  
  <p>And if im writing this post is because i ve no more ideas.</p>
  
  <p>follow i 'm provide to you the native call in VB.net</p>
  
  <pre><code>    &lt;DllImport("SCARD32", EntryPoint:="SCardComand", SetLastError:=True, CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Ansi, ExactSpelling:=True)&gt; _
  Public Shared Function SCardComand(ByRef handle As Integer, 
  &lt;MarshalAs(UnmanagedType.VBByRefStr)&gt; ByRef cmd As String, 
  ByRef cmdLen As Integer, 
  &lt;MarshalAs(UnmanagedType.VBByRefStr)&gt; ByRef dataIn As String, 
  ByRef dataInLen As Integer, 
  &lt;MarshalAs(UnmanagedType.VBByRefStr)&gt; ByRef dataOut As String, 
  ByRef dataOutLen As Integer) As Integer
  End Function
  </code></pre>
  
  <p>and here my translation to c#.</p>
  
  <pre><code>      [DllImport("SCARD32.DLL")]
    static extern UInt32 SCardComand(IntPtr handle,
    [MarshalAs(UnmanagedType.LPTStr)] ref String cmd,
    IntPtr cmdLen,
    [MarshalAs(UnmanagedType.LPTStr)] ref String dataIn,
    IntPtr dataInLen,
    [MarshalAs(UnmanagedType.LPTStr)] out String dataOut,
    IntPtr dataOutLen);
  </code></pre>
  
  <p>And for istance if i run this command in c# <code>int Ret = SCardComand(0, "Card,MemVerifyPin,FFFFF", 0,"",0, "", 0);</code> Obtain 16384 which means nothing for me.</p>
  
  <p>Please if someone have an idea of how proceed...</p>