SCARD_READERSTATE

The SCARD_READERSTATE structure is used by functions for tracking smart cards within readers.

typedef struct {
    LPCTSTR szReader;       // reader name
    LPVOID  pvUserData;     // user defined data
    DWORD   dwCurrentState; // current state of reader at the
                            // time of the call
    DWORD   dwEventState;   // state of reader after a state change
    DWORD   cbAtr;          // Number of bytes in the returned ATR
    BYTE    rgbAtr[36];     // ATR of inserted card
                            // (with extra alignment bytes)
} SCARD_READERSTATE;typedef SCARD_READERSTATE
  *PSCARD_READERSTATE, *LPSCARD_READERSTATE;
 

Members

szReader
Points to the name of the reader being monitored.
pvUserData
Not used by the smart card subsystem. Used by the application.
dwCurrentState
Supplies the current state of the reader, as seen by the application. This field can take on any of the following values, in combination, as a bit mask:
Value Meaning
SCARD_STATE_UNAWARE The application is unaware of the current state, and would like to know. The use of this value results in an immediate return from state transition monitoring services. This is represented by all bits set to zero.
SCARD_STATE_IGNORE The application is not interested in this reader, and it should not be considered during monitoring operations. If this bit value is set, all other bits are ignored.
SCARD_STATE_UNAVAILABLE The application believes that this reader is not available for use. If this bit is set, then all the following bits are ignored.
SCARD_STATE_EMPTY The application believes that there is not card in the reader. If this bit is set, all the following bits are ignored.
SCARD_STATE_PRESENT The application believes that there is a card in the reader.
SCARD_STATE_ATRMATCH The application believes that there is a card in the reader with an ATR matching one of the target cards. If this bit is set, SCARD_STATE_PRESENT is assumed. This bit has no meaning to SCardGetStatusChange beyond SCARD_STATE_PRESENT.
SCARD_STATE_EXCLUSIVE The application believes that the card in the reader is allocated for exclusive use by another application. If this bit is set, SCARD_STATE_PRESENT is assumed.
SCARD_STATE_INUSE The application believes that the card in the reader is in use by one or more other applications, but may be connected to in shared mode. If this bit is set, SCARD_STATE_PRESENT is assumed.
SCARD_STATE_MUTE The application believes that there is an unresponsive card in the reader.

dwEventState
Receives the current state of the reader, as known by the smart card resource manager. This field can take on any of the following values, in combination, as a bit mask:
Value Meaning
SCARD_STATE_IGNORE This reader should be ignored.
SCARD_STATE_CHANGED There is a difference between the state believed by the application, and the state known by the resource manager. When this bit is set, the application may assume a significant state change has occurred on this reader.
SCARD_STATE_UNKNOWN The given reader name is not recognized by the resource manager. If this bit is set, then SCARD_STATE_CHANGED and SCARD_STATE_IGNORE will also be set.
SCARD_STATE_UNAVAILABLE The actual state of this reader is not available. If this bit is set, then all the following bits are clear.
SCARD_STATE_EMPTY There is no card in the reader. If this bit is set, all the following bits will be clear.
SCARD_STATE_PRESENT There is a card in the reader.
SCARD_STATE_ATRMATCH There is a card in the reader with an ATR matching one of the target cards. If this bit is set, SCARD_STATE_PRESENT will also be set. This bit is only returned on the SCardLocateCards function.
SCARD_STATE_EXCLUSIVE The card in the reader is allocated for exclusive use by another application. If this bit is set, SCARD_STATE_PRESENT will also be set.
SCARD_STATE_INUSE The card in the reader is in use by one or more other applications, but may be connected to in shared mode. If this bit is set, SCARD_STATE_PRESENT will also be set.
SCARD_STATE_MUTE There is an unresponsive card in the reader.

cbAtr
The number of bytes in the returned ATR.
rgbAtr
The ATR of the inserted card, with extra alignment bytes.

QuickInfo

  Windows NT: Use version 4.0 SP3 and later.
  Windows: Use Windows 95 OSR2.1.
  Windows CE: Unsupported.
  Header: Declared in winscard.h.
  Import Library: Link with winscard.lib.

See Also

SCardGetStatusChange, SCardLocateCards