[Pcsclite-muscle] Asynchronous PCSC API

Ludovic Rousseau ludovic.rousseau at gmail.com
Sun Jan 30 10:08:01 PST 2022


Le dim. 30 janv. 2022 à 18:02, Ludovic Rousseau
<ludovic.rousseau at gmail.com> a écrit :
> I tried again in a VM using Windows 10 20H2 19042.1466.
> This time the SCardCancel() works as expected by Ievgenii.
> Very strange.
>
> The card and card reader should not be important.
>
> Anybody else can confirm (or not) the behaviour of SCardCancel() on Windows?

I tried again on the first Windows system and now it works as expected.
Maybe I made a mistake trying to make the code work on Windows.

So it looks like SCardCancel() can be used to cancel a call to
SCardConnect() on Windows.
Of course this is NOT documented in MSDN. At least not very clearly:
https://docs.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel
" The SCardCancel function terminates all outstanding actions within a
specific resource manager context.

The only requests that you can cancel are those that require waiting
for external action by the smart card or user. Any such outstanding
action requests will terminate with a status indication that the
action was canceled. This is especially useful to force outstanding
SCardGetStatusChange calls to terminate. "


Ievgenii, would you also need to be able to cancel other PC/SC calls?
Some of them can be blocked by a transaction or an exclusive reader access.
- SCardReconnect()
- SCardStatus()
- SCardTransmit()

SCardTransmit() or SCardControl() can have a very long execution time.
What do you plan for these?

Regards,

-- 
 Dr. Ludovic Rousseau



More information about the pcsclite-muscle mailing list