简体   繁体   中英

Event notification for ::SCardListReaders()

In the PC/SC (Personal Computer Smart Card) Appln, I have (MSCAPI USB CCID based)

1) Calling ::SCardListReaders() returns SCARD_E_NO_READERS_AVAILABLE (0x8010002E). This call is made after OS starts fresh after reboot, from a thread which is part of my custom windows service.

2) Adding delay before ::SCardListReaders() call solves the problem.

3) How can I solve this problem elegantly ? Not using delay & waiting for some event to notify me.

since a) Different machines may require different delay values b) Cannot loop since the error code is genuine c) Could not find this event as part of System Event Notification Service or similar COM interface d) platform is Windows 7

Any Help Appreciated.

Option1)

Using SCardGetStatusChange() by setting in its parameter readerstate.szReader to "\\\\?PnP?\\Notification"

Option2)

Polling after fixed interval with limit on maximum interval to poll

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM