SCardGetStatusChange fails with SCARD_E_NO_SERVICE error

Hi, welcome back,

 

Smart Card Redirection on Microsoft Remote Desktop Protocol (RDP) client 6.0 may cause SCardGetStatusChange to fail with error 0x8010001d - SCARD_E_NO_SERVICE - "The Smart card resource manager is not running." .

When a user connects from her machine A (i.e. Windows XP SP2) to a remote machine B (i.e. Windows Vista) using Microsoft RDP client, she can use her smart card inserted in a reader on machine A to perform operations on remote machine B. This is called smart card redirection and is enabled by default.

 

However, from RDP client 6.0 on, there appears to be a problem with applications on machine B which call SCardGetStatusChange() in order to monitor smart card status changes, such as smart card insertions and removals. SCardGetStatusChange API fails with the error shown above. Previous versions of the RDP client did not exhibit this problem.

Well, I've seen that this issue happens when some fields of the rgReaderStates structure being passed to SCardGetStatusChange are not being initialized, so they contain invalid values that SCardGetStatusChange tries to use unsuccessfully.

 

A piece of advice: clean up the fields of the rgReaderStates structure before calling SCardGetStatusChange, so all unused fields are set to 0.

 

I hope this helps.

Cheers,

 

Alex (Alejandro Campos Magencio)