[DllImport("winscard.dll", CharSet=CharSet.Auto)]
static extern int SCardGetStatusChange(int hContext, int dwTimeout, [In, Out] SCARD_READERSTATE[] rgReaderStates, int cReaders);
None.
None.
Please add some!
private const int SCARD_STATE_UNAWARE = 0x00000000;
// get ATR of card
// hContext - previously established context
// reader - ATR will be read from card in this reader
private static byte[] atr(int hContext, string reader)
{
int ret;
byte[] atr = null;
SCARD_READERSTATE[] rs = new SCARD_READERSTATE[1];
rs[0].szReader = reader;
rs[0].dwCurrentState = SCARD_STATE_UNAWARE;
ret = SCardGetStatusChange(hContext, 100, rs, 1);
if (ret == 0 && rs[0].cbAtr > 0 && rs[0].rgbAtr != null)
{
atr = new byte[rs[0].cbAtr];
Array.Copy(rs[0].rgbAtr, atr, rs[0].cbAtr);
}
return atr;
}
TODO