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

LONG SCardSetAttrib ( SCARDHANDLE  hCard,
DWORD  dwAttrId,
LPCBYTE  pbAttr,
DWORD  cbAttrLen 

This function set an attribute of the IFD Handler.

The list of attributes you can set is dependent on the IFD Handler you are using.

[in] hCard Connection made from SCardConnect.
[in] dwAttrId Identifier for the attribute to set.
[in] pbAttr Pointer to a buffer that receives the attribute.
[in] cbAttrLen Length of the pbAttr buffer in bytes.
Error code
Return values:
SCARD_E_NOT_TRANSACTED Data exchange not successful.
 LONG rv;
 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 = SCardSetAttrib(hCard, 0x42000001, "\x12\x34\x56", 3);

Definition at line 1298 of file winscard.c.

Referenced by MSGFunctionDemarshall().

      LONG rv;
      PREADER_CONTEXT rContext = NULL;

      if (0 == hCard)
            return SCARD_E_INVALID_HANDLE;

       * Make sure no one has a lock on this reader
      if ((rv = RFCheckSharing(hCard)) != SCARD_S_SUCCESS)
            return rv;

      rv = RFReaderInfoById(hCard, &rContext);
      if (rv != SCARD_S_SUCCESS)
            return rv;

       * Make sure the reader is working properly
      rv = RFCheckReaderStatus(rContext);
      if (rv != SCARD_S_SUCCESS)
            return rv;

      rv = RFFindReaderHandle(hCard);
      if (rv != SCARD_S_SUCCESS)
            return rv;

       * Make sure some event has not occurred
      if ((rv = RFCheckReaderEventState(rContext, hCard)) != SCARD_S_SUCCESS)
            return rv;

      rv = IFDSetCapabilities(rContext, dwAttrId, cbAttrLen, (PUCHAR)pbAttr);
      if (rv == IFD_SUCCESS)
            return SCARD_S_SUCCESS;
            return SCARD_E_NOT_TRANSACTED;

Generated by  Doxygen 1.6.0   Back to index