SCardSetAttrib
TOC
Collapse the table of content
Expand the table of content

SCardSetAttrib function

The SCardSetAttrib function sets the given reader attribute for the given handle. It does not affect the state of the reader, reader driver, or smart card. Not all attributes are supported by all readers (nor can they be set at all times) as many of the attributes are under direct control of the transport protocol.

Syntax


LONG WINAPI SCardSetAttrib(
  _In_ SCARDHANDLE hCard,
  _In_ DWORD       dwAttrId,
  _In_ LPCBYTE     pbAttr,
  _In_ DWORD       cbAttrLen
);

Parameters

hCard [in]

Reference value returned from SCardConnect.

dwAttrId [in]

Identifier for the attribute to set. The values are write-only. Note that vendors may not support all attributes.

ValueMeaning
SCARD_ATTR_SUPRESS_T1_IFS_REQUEST

Suppress sending of T=1 IFSD packet from the reader to the card. (Can be used if the currently inserted card does not support an IFSD request.)

 

pbAttr [in]

Pointer to a buffer that supplies the attribute whose ID is supplied in dwAttrId.

cbAttrLen [in]

Length (in bytes) of the attribute value in the pbAttr buffer.

Return value

This function returns different values depending on whether it succeeds or fails.

Return codeDescription
Success

SCARD_S_SUCCESS.

Failure

An error code. For more information, see Smart Card Return Values.

 

Remarks

The SCardSetAttrib function is a direct card access function. For information about other direct access functions, see Direct Card Access Functions.

Examples

The following example shows how to set an attribute.


// Set the attribute.
// hCardHandle was set by a previous call to SCardConnect.
// dwAttrID is a DWORD value, specifying the attribute ID.
// pbAttr points to the buffer of the new value.
// cByte is the count of bytes in the buffer.
lReturn = SCardSetAttrib(hCardHandle,
                         dwAttrID,
                         (LPBYTE)pbAttr,
                         cByte);
if ( SCARD_S_SUCCESS != lReturn )
    printf("Failed SCardSetAttrib\n");


Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winscard.h

Library

Winscard.lib

DLL

Winscard.dll

See also

SCardConnect
SCardGetAttrib

 

 

Community Additions

ADD
Show:
© 2016 Microsoft