AndrejaKo
AndrejaKo

Reputation: 1749

How to get smartcard reader name in Windows 7 using C# or C/C++?

I'm trying to make a C# program which will use a C .dll (unfortunately, the .dll doesn't have good documentation) to access a smart card. One of the functions of the .dll uses name of the reader as argument. My problem is that I don't know how to get the name.

After looking for answers I found something similar to what I need in an example here: http://msdn.microsoft.com/en-us/library/aa379803%28VS.85%29.aspx I'm looking for a way to get szReader value as described in the aforementioned example using C#. Can anyone help me or at least point me in the right direction?

EDIT: Looks like nobody knows the answer so I'll expand the question: How do I get smartcard reader name using C/C++ and Windows API? I've read through MSDN site for smartcard API, but I couldn't find the function which will list readers. My idea is now to make a C/C++ .dll which will get in-between the smartcard .dll and C# program. It will produce list of readers, let user chose one and call the smartcard .dll using chosen name as argument.

Upvotes: 0

Views: 6988

Answers (2)

JJS
JJS

Reputation: 6658

Try looking up the WinSCard api usage on Pinvoke.net. Specifically SCardListReaders. Also, this is possibly a duplicate question 268899 which has a great example of ScardListReaders. Good luck!

Upvotes: 1

AndrejaKo
AndrejaKo

Reputation: 1749

Here's some info on the subject that seems useful, namely the name of SCardListReaders: http://pcsclite.alioth.debian.org/api/winscard_8h.html I'll try it out and report results.

Upvotes: 0

Related Questions