nfc-reader: Error SCardListReaders
Card.SCardListReaders(this.hContext, null, null, ref pcchReaders); is returning a 6 for me and I am not sure how to move forward with throubleshooting.
I am in a .NET 4.x environment and I am not getting any compile errors. I have an ACR122 reader that is working with other software.
The code that is generating the error is below: ` public NFCReader NFC;
void Start()
{
NFCReader NFC = new NFCReader();
NFC.CardInserted += new NFCReader.CardEventHandler(CardIn);
NFC.CardEjected += new NFCReader.CardEventHandler(CardOut);
NFC.Watch(); //public void Watch()
}
public void CardIn() {
try
{
if (NFC.Connect())
{
Debug.Log( NFC.ReadBlock("0"));
}
else
{
//Give error message about connection...
}
}
catch (Exception ex)
{
Debug.Log("Exception Should Not Have Ran: " + ex.Message);
}
}
public void CardOut()
{
NFC.Disconnect();
}`
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 20 (6 by maintainers)
Well, it works in that I no longer receive that particular error.
But I still am not able to read the cards Uid. The watch() function cycles, but there’s never a change in card status. Once I get that working I can make a PR for it.
Good evening to all, after 1 day of tests i tink to have found where is fired the problem. I tink is for how compiled 32bit or 64bit. ### In visual studio if set 32 bit, all its working fine.
Instead if i dont set “Prefer 32-bit” i have same issue of quindo.
My Pc is a 64bit window 10.
I need to work on 64 bit on my application. I can’t set “prefer 32-bit”
I did some research and I found that in 64bit environment I should use IntPtr instead of int in the declaration of some “winscard” dll variables.
h4kbas, quindo any suggestion ?
Thanks . My project worked with 32bit build.
I had the same issue that was being reported above. I came across this post (https://social.msdn.microsoft.com/Forums/ie/en-US/84faa51e-98ee-4289-8e0f-c1408580f30f/winscard-smart-card-dll-32-bit-64-bit-compatibility?forum=windowscompatibility) that mentioned they had to change the hContext from an Int to a Long. That fixed the issue.