Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function gets the current reader attributes for the specified handle. It does not affect the state of the reader, driver, or card.

Syntax

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

Parameters

hCard

[in] Handle to the reference value returned from SCardConnect.

dwAttrId

[in] Supplies the identifier for the attribute to get. The following table shows possible values for dwAttrId. These values are read-only. Note that vendors may not support all attributes.

Value Description

SCARD_ATTR_ATR_STRING

Answer to reset (ATR) string.

SCARD_ATTR_CHANNEL_ID

DWORDencoded as 0xDDDDCCCC, where DDDD= data channel type and CCCC= channel number. The following encodings are defined for DDDD:

  • 0x01 serial I/O; CCCCis a port number.

  • 0x02 parallel I/O; CCCCis a port number.

  • 0x04 PS/2 keyboard port; CCCCis zero.

  • 0x08 SCSI; C CCC is SCSI ID number.

  • 0x10 IDE; CCCCis device number.

  • 0x20 USB; CCCCis device number.

  • 0xFy vendor-defined interface with y in the range 0 through 15; CCCCis vendor defined.

SCARD_ATTR_CHARACTERISTICS

DWORDindicating which mechanical characteristics are supported. If zero, no special characteristics are supported. Note that multiple bits can be set:

  • 0x00000001 Card swallowing mechanism

  • 0x00000002 Card ejection mechanism

  • 0x00000004 Card capture mechanism

All other values are reserved for future use (RFU).

SCARD_ATTR_CURRENT_BWT

Current block waiting time.

SCARD_ATTR_CURRENT_CLK

Current clock rate, in kHz.

SCARD_ATTR_CURRENT_CWT

Current character waiting time.

SCARD_ATTR_CURRENT_D

Bit rate conversion factor.

SCARD_ATTR_CURRENT_EBC_ENCODING

Current error block control encoding.

0 = longitudinal redundancy check (LRC)

1 = cyclical redundancy check (CRC)

SCARD_ATTR_CURRENT_F

Clock conversion factor.

SCARD_ATTR_CURRENT_IFSC

Current byte size for information field size card.

SCARD_ATTR_CURRENT_IFSD

Current byte size for information field size device.

SCARD_ATTR_CURRENT_N

Current guard time.

SCARD_ATTR_CURRENT_PROTOCOL_TYPE

DWORDencoded as 0x0 rrrppppwhere rrris RFU and should be 0x000. ppppencodes the current protocol type. Whichever bit has been set indicates which ISO protocol is currently in use. (For example, if bit 0 is set, T=0 protocol is in effect.)

SCARD_ATTR_CURRENT_W

Current work waiting time.

SCARD_ATTR_DEFAULT_CLK

Default clock rate, in kHz.

SCARD_ATTR_DEFAULT_DATA_RATE

Default data rate, in bps.

SCARD_ATTR_DEVICE_FRIENDLY_NAME

Reader's friendly name.

SCARD_ATTR_DEVICE_IN_USE

Reserved for future use.

SCARD_ATTR_DEVICE_SYSTEM_NAME

Reader's system name.

SCARD_ATTR_DEVICE_UNIT

Instance of this vendor's reader attached to the computer. The first instance will be device unit 0, the next will be unit 1 (if it is the same brand of reader) and so on. Two different brands of readers will both have 0 for this value.

SCARD_ATTR_ICC_INTERFACE_STATUS

Single byte. 0 if smart card electrical contact is not active; non-zero if contact is active.

SCARD_ATTR_ICC_PRESENCE

Single byte indicating smart card presence:

0 = not present

1 = card present but not swallowed (applies only if reader supports smart card swallowing)

2 = card present (and swallowed if reader supports smart card swallowing)

4 = card confiscated

SCARD_ATTR_ICC_TYPE_PER_ATR

Single byte indicating smart card type:

0 = unknown type

1 = 7816 Asynchronous

2 = 7816 Synchronous

Other values RFU.

SCARD_ATTR_MAX_CLK

Maximum clock rate, in kHz.

SCARD_ATTR_MAX_DATA_RATE

Maximum data rate, in bps.

SCARD_ATTR_MAX_IFSD

Maximum bytes for information file size device.

SCARD_ATTR_POWER_MGMT_SUPPORT

0 if device does not support power down while smart card is inserted. Non-zero otherwise.

SCARD_ATTR_PROTOCOL_TYPES

DWORDencoded as 0x0 rrrppppwhere rrris RFU and should be 0x000. ppppencodes the supported protocol types. A 1 in a given bit position indicates support for the associated ISO protocol, so if bits 0 and 1 are set, both T=0 and T=1 protocols are supported.

SCARD_ATTR_VENDOR_IFD_SERIAL_NO

Vendor-supplied interface device serial number.

SCARD_ATTR_VENDOR_IFD_TYPE

Vendor-supplied interface device type (model designation of reader).

SCARD_ATTR_VENDOR_IFD_VERSION

Vendor-supplied interface device version ( DWORDin the form 0xMM mmbbbbwhere MM = major version, mm= minor version, and bbbb= build number).

SCARD_ATTR_VENDOR_NAME

Vendor name.

pbAttr

[out] Pointer to a buffer that receives the attribute whose identifier is supplied in dwAttrId. If this value is NULL, SCardGetAttribignores the buffer length supplied in pcbAttrLen, writes the length of the buffer that would have been returned if this parameter had not been NULL to pcbAttrLen, and returns a success code.

pcbAttrLen

[in, out] Pointer to the length of the pbAttrbuffer in bytes, and receives the actual length of the received attribute. If the buffer length is specified as SCARD_AUTOALLOCATE, pbAttris converted to a pointer to a byte pointer, and receives the address of a block of memory containing the attribute. This block of memory must be deallocated with SCardFreeMemory.

Return Value

The following table shows the possible return values.

Value Description

SCARD_S_SUCCESS

Succeeds

An error value (see Smart Card Error Valuesfor a list of all error values).

Fails

Remarks

SCardGetAttribis a direct card access function.

Requirements

Header winscard.h
Library winscard.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also