Subsections

SCardGetAttrib

Synopsis:

#include <winscard.h>

LONG SCardGetAttrib(SCARDHANDLE hCard,
    DWORD dwAttrId,
    LPBYTE pbAttr,
    LPDWORD pcbAttrLen);

Parameters:

hCard IN Connection made from SCardConnect
dwAttrId IN Identifier for the attribute to get
pbAttr OUT Pointer to a buffer that receives the attribute
pcbAttrLen IN/OUT Length of the pbAttr buffer in bytes

Description:

This function get an attribute from the IFD Handler. The list of possible attributes is available in the file pcsclite.h.

Not all the dwAttrId values listed above may be implemented in the IFD Handler you are using. And some dwAttrId values not listed here may be implemented.

Example:

LONG rv;
SCARDCONTEXT hContext;
SCARDHANDLE hCard;
DWORD dwActiveProtocol;
unsigned char pbAtr[MAX_ATR_SIZE];
DWORD dwAtrLen;

rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
rv = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED,
         SCARD_PROTOCOL_RAW &hCard, &dwActiveProtocol);
rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, pbAtr, &dwAtrLen);

Returns:

SCARD_S_SUCCESS Successful
SCARD_E_NOT_TRANSACTED Data exchange not successful
SCARD_E_INSUFFICIENT_BUFFER Reader buffer not large enough

2007-06-17