views:

327

answers:

2

Hi! 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.

A: 

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.

AndrejaKo
+1  A: 

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!

JJS