SCardGetAttrib (winscard)
Last changed: mrprgrmr-12.11.145.74

.
Summary
"The SCardGetAttrib function gets the current reader attributes for the specified handle. It does not affect the state of the reader, driver, or card." [http://msdn.microsoft.com/en-us/library/aa379559(VS.85).aspx]

C# Signature:

[DllImport("winscard.dll", SetLastError=true)]
static extern Int32 SCardGetAttrib(
    IntPtr hCard,         // Reference value returned from SCardConnect
    UInt32 dwAttrId,         // Identifier for the attribute to get
    byte[] pbAttr,         // Pointer to a buffer that receives the attribute
    ref IntPtr pcbAttrLen    // Length of pbAttr in bytes
    );

VB Signature:

Declare Function SCardGetAttrib Lib "winscard.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

const UInt32 SCARD_ATTR_ATR_STRING = 0x00090303; // = SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0303) in WinSCard.h

IntPtr hCard; // Handle to the card

Int32 ret;

// Copy code to establish context here

// Copy code to connect to the card here

// Get the Answer to Rest

byte[] pbAttr = new byte[255];

IntPtr pcbAttrLen = new IntPtr(pbAttr.Length);

ret = SCardGetAttribe(hCard, SCARD_ATTR_ATR_STRING, pbAttr, ref pcbAttrLen);

Documentation