Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

LONG SCardStatus ( SCARDHANDLE  hCard,
LPTSTR  mszReaderNames,
LPDWORD  pcchReaderLen,
LPDWORD  pdwState,
LPDWORD  pdwProtocol,
LPBYTE  pbAtr,
LPDWORD  pcbAtrLen 

This function returns the current status of the reader connected to by hCard.

It's friendly name will be stored in szReaderName. pcchReaderLen will be the size of the allocated buffer for szReaderName, while pcbAtrLen will be the size of the allocated buffer for pbAtr. If either of these is too small, the function will return with SCARD_E_INSUFFICIENT_BUFFER and the necessary size in pcchReaderLen and pcbAtrLen. The current state, and protocol will be stored in pdwState and pdwProtocol respectively.

[in] hCard Connection made from SCardConnect.
mszReaderNames [inout] Friendly name of this reader.
pcchReaderLen [inout] Size of the szReaderName multistring.
[out] pdwState Current state of this reader. pdwState is a DWORD possibly OR'd with the following values:
  • SCARD_ABSENT - There is no card in the reader.
  • SCARD_PRESENT - There is a card in the reader, but it has not been moved into position for use.
  • SCARD_SWALLOWED - There is a card in the reader in position for use. The card is not powered.
  • SCARD_POWERED - Power is being provided to the card, but the reader driver is unaware of the mode of the card.
  • SCARD_NEGOTIABLE - The card has been reset and is awaiting PTS negotiation.
  • SCARD_SPECIFIC - The card has been reset and specific communication protocols have been established.
[out] pdwProtocol Current protocol of this reader.
  • SCARD_PROTOCOL_T0 Use the T=0 protocol.
  • SCARD_PROTOCOL_T1 Use the T=1 protocol.
[out] pbAtr Current ATR of a card in this reader.
[out] pcbAtrLen Length of ATR.
Error code.
Return values:
SCARD_E_INVALID_HANDLE Invalid hCard handle.
SCARD_E_INSUFFICIENT_BUFFER Not enough allocated memory for szReaderName or for pbAtr.
SCARD_E_READER_UNAVAILABLE The reader has been removed.
 DWORD dwActiveProtocol;
 DWORD dwState, dwProtocol, dwAtrLen, dwReaderLen;
 rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
 rv = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, &hCard, &dwActiveProtocol);
 dwAtrLen = sizeof(pbAtr);
 rv=SCardStatus(hCard, NULL, &dwReaderLen, &dwState, &dwProtocol, pbAtr, &dwAtrLen);

Definition at line 675 of file winscard_scf.c.

References SCardLockThread(), and SCardUnlockThread().

Referenced by MSGFunctionDemarshall().

      long rv;

      rv = SCardStatusTH(hCard, mszReaderNames, pcchReaderLen, pdwState,
            pdwProtocol, pbAtr, pcbAtrLen);
      return rv;

Generated by  Doxygen 1.6.0   Back to index