views:

492

answers:

0

TLDR Version:

The SCardListReaders function from winscard.dll may return the reader name like "SCM Microsystems Inc. SCR331-DI USB ContactlessReader 0". The WMI Win32_PnPEntity may have a name like "USB Contactless Reader". Is there a way to identify programmatically that this is the same device?

Long Version:

The SCardListReaders function from winscard.dll provides the list of smart card readers available. Unfortunately, this list of names is quite different from the list of smart card readers that I can get with the help of WMI.

Example:

The SCardListReaders returns something like this

SCM Microsystems Inc. SCR331-DI Smart Card Reader 0
SCM Microsystems Inc. SCR331-DI USB ContactlessReader 0
SCM Microsystems Inc. SCR331-DI Smart Card Reader 1
SCM Microsystems Inc. SCR331-DI USB ContactlessReader 1

The WMI returns something like this

USB SmartCard Reader
USB Contactless Reader
USB SmartCard Reader 1
USB Contactless Reader 1

Question:

How can my application properly identify that "SCM Microsystems Inc. SCR331-DI USB ContactlessReader 0" is actually a USB device "USB Contactless Reader" (short of using "Magic Numbers")?

Why I need that:

A computer can have more than one card printer connected. Each card printer has a smart card reader installed. Each printer and each card reader are listed as USB devices. To print and encode a smart card I have to call the proper smart card reader - the one that is installed on the printer where the card is printed.

I'm providing a small user interface where a printer and card reader are manually tied together and this configuration is saved. Ideally I would like to get a list of printers and readers through WMI, match them to the config file and then call functions from winscard.dll, providing the correct smart card reader name.