Winscard forget reader not working RRS feed

  • Question

  • Assuming I am using Windows 10 , Windows server 2012 + and assuming I understand the implications of limiting the smart card manager to 10 Smart card readers.I need a method to forget completely any reader I state so that the device is no longer assailable after running code.


    1. Plug in smart card readers 1 -10

    2, List readers replies with readers x0 - x9.

    3. Send  SCardForgetReader x3

    4 List readers replies with readers x0 - x2 and x4 - x9. (Expected Behavior)

    5. Plug in another smart card 11

    6. List readers replies with readers x0 - x2 and x4 - x9. (Unexpected Behavior)

    7.Expected x0 - x2 and x4 - x10

    The eleventh reader is not being registered and the 4 reader (x3) is still being processed as present even though I sent the SCardForgetReader successfully.


    Thursday, August 18, 2016 2:53 PM

All replies

  • Assuming you have 11 readers all of the same type, you will get readers names appended with a index starting at 0.

    Dell Smart Card Reader Keyboard 0

    Dell Smart Card Reader Keyboard 1

    Dell Smart Card Reader Keyboard 2


    So it does not surprise me that calling SCardForgetReader for 3, and then inserting a new reader results in a new reader 3. I image that when a new readers is inserted, the system just looks for the first empty index, which would be 3 in your example.

    The definition of Assailable  is to attack vigorously or violently; assault.  Did you mean accessible?

    It sounds like you have an application which requires you to insert a reader, have something happen to it, and then have the finished reader removed from consideration when new readers are inserted.   Perhaps a token initialization project.   Can you be more precise in your overall goals? 

    Maybe you can use ScardGetStatusChange to observer when the readers arrive in the system: 

    "To be notified of the arrival of a new smart card reader, set the szReader member of a SCARD_READERSTATE structure to

    "\\\\?PnP?\\Notification", and set all of the other members of that structure to zero."

    Thursday, August 18, 2016 10:14 PM