Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

SCardGetStatusChange (winscard)
 
.
Summary
The SCardGetStatusChange function blocks execution until the current availability of the cards in a specific set of readers changes.

C# Signature:

[DllImport("winscard.dll", CharSet=CharSet.Auto)]
static extern int SCardGetStatusChange(int hContext, int dwTimeout, [In, Out] SCARD_READERSTATE[] rgReaderStates, int cReaders);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

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;
}

Alternative Managed API:

TODO

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions