title: Asymetry in PC/SC Windows and PC/SC-lite for card Status
body: <p>while I reacently code PC/SC on Windows and Linux, I noticed a slight asymetry between the APIs of <a href="https://pcsclite.alioth.debian.org/api/ifdhandler_8h.html" rel="nofollow noreferrer">pc/sc-lite</a> and the <a href="https://msdn.microsoft.com/de-de/library/windows/hardware/ff548988(v=vs.85).aspx" rel="nofollow noreferrer">IOCTL</a> of winscard. Except for the fact, that you have to switch the ICTLs for yourself, Windows is able to pend a requests.</p>
  
  <p>And here is where it gehts tricky:</p>
  
  <ul>
  <li>For pc/sc-lite there is <a href="https://pcsclite.alioth.debian.org/api/group__IFDHandler.html#gac0ef46f09df179c44a82259468bea174" rel="nofollow noreferrer"><code>IFDHICCPresence</code></a> to return the current card state.</li>
  <li>On winscard there are 3 of them
  
  <ul>
  <li><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff548905(v=vs.85).aspx" rel="nofollow noreferrer"><code>IOCTL_SMARTCARD_IS_ABSENT</code></a> and <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff548906%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396" rel="nofollow noreferrer"><code>IOCTL_SMARTCARD_PRESENT</code></a> have that wierd callback-semantic. </li>
  <li><a href="https://msdn.microsoft.com/de-de/library/windows/hardware/ff548904(v=vs.85).aspx" rel="nofollow noreferrer"><code>IOCTL_SMARTCARD_GET_STATE</code></a> on the other hand, is kind of the same as <code>IFDHICCPresence</code>. Beside the fact that Windows also supports swallowing and ejecting cards which pc/sc-lite don't.</li>
  </ul></li>
  </ul>
  
  <p>I want to implement a platform independent IFD handler so a similar behavior would be much easier to handler. Of course I could add yet another layer to compensate for the windows specific part, but I want to save that as a last resort.</p>
  
  <p>Isn't PC/SC and the IFD handlers supposed to be a standart with defined functions and behavior?</p>
  
  <p>Is it possible to disable the callback behavior on Windows?</p>
  
  <p>So far I tryed to define <code>IOCTL_SMARTCARD_IS_ABSENT/PRESENT</code> as unsupported, but Windows insists of calling them even though the information could retrieved with <code>IOCTL_SMARTCARD_GET_STATE</code>.</p>