469,935 Members | 1,656 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

Scardlocatecards:smart Card Api

hi can anyone help me regarding the smart card API SCardLocateCardsW
here is the code i am sending which i have written
[DllImport("winscard.dll", SetLastError = true)]
internal static extern int SCardLocateCardsW(UInt32 hContext, [MarshalAs(UnmanagedType.LPTStr)] string mszCards, [In, Out] SCard_ReaderState[] rgReaderStates, int cReaders);
int nbReaders;
SCard_ReaderState[] readerState = new SCard_ReaderState[1];
// UInt32 eventState = readerState[0].m_dwEventState;
readerState[0].m_dwCurrentState = (UInt32)CARD_STATE.UNAWARE;
readerState[0].m_szReader = (string)reader;
nbReaders = readerState.Length;
string card1 = "Axalto Cryptoflex .NET";

//string[] card = { "Infineon SICRYPT CardModule Card", "Axalto Cryptoflex .NET" };
//card[0]= "Infineon SICRYPT CardModule Card";
//card[1]="Axalto Cryptoflex .NET";
//string card = "";
int nErrCode = SCardLocateCardsW(m_hContext,card1,readerState, nbReaders);

if (nErrCode != 0)
string msg = "Failed SCardLocateCardsA error: " + nErrCode;

throw new Exception(msg);
the code is throwing an error
i am not knowing wht to pass in the mszcards
can anyone help me
i need this
thanks in advance
Dec 26 '07 #1
0 1510

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.