SCardSetAttrib 函式 (winscard.h)

SCardSetAttrib 函式會設定指定句柄的指定讀取器屬性。 它不會影響讀取器讀取器驅動程式智慧卡的狀態。 並非所有讀取器都支援所有屬性 (,也無法隨時設定這些屬性,) 許多屬性都直接控制傳輸通訊協定。

語法

LONG SCardSetAttrib(
  [in] SCARDHANDLE hCard,
  [in] DWORD       dwAttrId,
  [in] LPCBYTE     pbAttr,
  [in] DWORD       cbAttrLen
);

參數

[in] hCard

SCardConnect 傳回的參考值。

[in] dwAttrId

要設定之屬性的標識碼。 這些值是唯寫的。 請注意,廠商可能不支援所有屬性。

意義
SCARD_ATTR_SUPRESS_T1_IFS_REQUEST
隱藏從讀取器傳送 T=1 IFSD 封包到卡片。 如果目前插入的卡片不支援 IFSD 要求,可以使用 (。)

[in] pbAttr

緩衝區的指標,提供其標識碼在 dwAttrId 中提供的屬性。

[in] cbAttrLen

pbAttr 緩衝區中屬性值) 以位元組為單位的長度 (。

傳回值

此函式會傳回不同的值,視其成功或失敗而定。

傳回碼 Description
「成功」
SCARD_S_SUCCESS。
失敗
錯誤碼。 如需詳細資訊,請參閱 智慧卡傳回值

備註

SCardSetAttrib 函式是直接卡片存取函式。 如需其他直接存取函式的相關信息,請參閱 直接卡片存取函式

範例

下列範例示範如何設定屬性。

// 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");

規格需求

需求
最低支援的用戶端 Windows XP [僅限傳統型應用程式]
最低支援的伺服器 Windows Server 2003 [僅限桌面應用程式]
目標平台 Windows
標頭 winscard.h
程式庫 Winscard.lib
Dll Winscard.dll

另請參閱

SCardConnect

SCardGetAttrib