hellowahab
hellowahab

Reputation: 2485

SCardConnect (winscard.dll) is always returning error

I am trying to connect a smart card reader using following code

retCode = ModWinsCard.SCardConnect(hContext, cbReader.SelectedItem.ToString(), ModWinsCard.SCARD_SHARE_SHARED, ModWinsCard.SCARD_PROTOCOL_T0 | ModWinsCard.SCARD_PROTOCOL_T1, ref hCard, ref Protocol);

But it is always returning some error code. First it was returning 6 after changing the target platform to x86 now it is returning -2146434967.

Any idea why its behaving so?

Upvotes: 4

Views: 9358

Answers (2)

boj4n
boj4n

Reputation: 31

Same code, returning 6 instead of 0.

Setting card on reader did not help until I did not change build option to x86.

Thank You for posting that changing target platform returned -2146434967 (0x80100069 - SCARD_W_REMOVED_CARD).

Upvotes: 3

hellowahab
hellowahab

Reputation: 2485

Just for other to benefit:- This was due to the removal of tag from the reader.

You can keep you tag placed on the reader this error will get removed.

Upvotes: 2

Related Questions