[Pcsclite-muscle] Windows PC/SC and SCARD_E_SERVICE_STOPPED

Michael StJohns mstjohns at comcast.net
Sun Dec 26 14:15:09 PST 2021


On 12/26/2021 1:58 PM, Diego de Felice wrote:
> Just some info from my experience, being a developer of a smart card middleware: I started facing a weird problem from Windows 8 installed as virtual machine, the Smart Card service suddendly stopped after some times. After some search, I discovered that a new "feature" has been added to Windows, where services, despite being set as Automatic Start, they could be stopped automatically if no work is needed, imagine the surprise to know that "Smart Card Service" is stopped when no REAL smart card reader are connected to the machine... This is a big problem on VMs because there are no physical screader connected and this same behaviour cause my middleware big problems on really slow PCs: when Windows starts, sometimes the screader is recognized after the SCService starts, so... the service stops, and my middleware doesn't work!!! Still figuring out how to solve this problem, because it's very difficult to debug in dev environment.
>
> Hope it helps.
>
> Here the reference:
>
> https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh849637(v=ws.11)#smart-card-service-start-and-stop-behavior
>
>
>
> _______________________________________________
> pcsclite-muscle mailing list
> pcsclite-muscle at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/pcsclite-muscle

It's possible that you can get around this by tracking the add/removal 
of the smart cards using the \\PnP?\Notification special card reader 
name in SCardGetStatusChange:

https://stackoverflow.com/questions/16370909/using-scardgetstatuschange-to-be-notified-of-card-insert-remove-without-polling

The MSDN documentation says this only tracks card reader additions, but 
its possible the documentation is wrong.

Mike





More information about the pcsclite-muscle mailing list