title: OpenSC Program Crash with c0000005 on Windows
body: <p>All, I am trying to access <code>opensc dll</code>(latest version) on windows 7 64 bit. I am trying to access a <code>ePass2003</code> token. The <code>opensc-tool</code> is able to detect the token and can get name and other information. So the token is found by <code>OpenSC</code>. Then I am loading the <code>opensc dll</code> from another program and call <code>standard PKCS#11 functions</code>. <code>C_GetSlotList</code> is returning slot 0 ID as -1 and slot 1 ID as 1. The <code>C_GetFunctionList</code> is returning me pointers to functions. The problem is when I call <code>C_GetMechanismList</code> I am getting a crash with <code>c0000005 error</code>.</p>
  
  <p>I also have accessed the token through the <code>ePass dll</code> provided with the token, it works perfectly.</p>
  
  <p>I am unable to track this problem as it is looking like through the <code>opensc dll</code>, <code>opensc</code> is unable to interface with the card but then opensc-tool also should have the same problem but it does not.</p>
  
  <p>If someone can help it would be great.</p>
  
  <hr>
  
  <h2>TRACE : pkcs11-tool</h2>
  
  <p>Trace #1:</p>
  
  <pre><code>C:\Program Files\OpenSC Project\OpenSC\tools&gt;pkcs11-tool.exe --module opensc-pkcs11.dll -I
  Cryptoki version 2.20
  Manufacturer     OpenSC (www.opensc-project.org)
  Library          Smart card PKCS#11 API (ver 0.0)
  Using slot 1 with a present token (0x1)
  </code></pre>
  
  <p>Trace #2:</p>
  
  <pre><code>C:\Program Files\OpenSC Project\OpenSC\tools&gt;pkcs11-tool.exe --module opensc-pkcs11.dll -L
  Available slots:
  Slot 0 (0xffffffff): Virtual hotplug slot
    (empty)
  Slot 1 (0x1): FS USB Token 0
    token state:   uninitialized
  </code></pre>
  
  <p>Trace #3:</p>
  
  <pre><code>C:\Program Files\OpenSC Project\OpenSC\tools&gt;pkcs11-tool.exe --module opensc-pkcs11.dll -T
  Available slots:
  No slots.
  </code></pre>
  
  <p>Trace #4:</p>
  
  <pre><code>C:\Program Files\OpenSC Project\OpenSC\tools&gt;pkcs11-tool.exe --module opensc-pkcs11.dll -M
  Using slot 1 with a present token (0x1)
  </code></pre>
  
  <p>Same result crash with c0000005</p>