共用方式為


ISCard::get_Atr 方法

[ get_Atr 方法可用於需求一節中指定的作業系統。 智慧卡模組提供類似的功能。]

get_Atr方法會擷取智慧卡ATR 字串

語法

HRESULT get_Atr(
  [out] LPBYTEBUFFER *ppAtr
);

參數

ppAtr [out]

IStream 形式的位元組緩衝區指標,其會在傳回時包含 ATR 字串。

傳回值

方法會傳回下列其中一個可能的值。

傳回碼 描述
S_OK
作業順利完成。
E_INVALIDARG
ppAtr參數無效。
E_POINTER
在 ppAtr中傳遞不正確的指標。
E_OUTOFMEMORY
無法滿足要求的記憶體。

 

備註

除了上面所列的 COM 錯誤碼之外,如果呼叫智慧卡函式以完成要求,此介面可能會傳回智慧卡錯誤碼。 如需詳細資訊,請參閱 智慧卡傳回值

範例

下列範例顯示從智慧卡擷取 ATR 字串。

// Retrieve the ATR.
// pISCard is a pointer to a previously instantiated ISCard.
// pAtr is a pointer to a previously instantiated IByteBuffer.
hr = pISCard->get_Atr(&pAtr);
if (FAILED(hr))
{
    printf("Failed get_Atr\n");
    // Take other error handling action.
}
// Success, you can now use IByteBuffer::Read to access ATR bytes.
BYTE  byAtr[32];
   long  lBytesRead, i;
   // Read the ATR string into a byte array.
   hr = pAtr->Read(byAtr, 32, &lBytesRead);
   // Use the ATR value. (This example merely displays the bytes.)
   for ( i = 0; i < lBytesRead; i++)
       printf("%c", *(byAtr + i));
   printf("\n");

規格需求

需求
最低支援的用戶端
Windows XP [僅限傳統型應用程式]
最低支援的伺服器
Windows Server 2003 [僅限桌面應用程式]
用戶端支援結束
Windows XP
伺服器終止支援
Windows Server 2003
標頭
Scardmgr.h
類型程式庫
Scardmgr.tlb
DLL
Scardssp.dll
IID
IID_ISCard定義為 1461AAC3-6810-11D0-918F-00AA00C18068

另請參閱

get_CardHandle

get_CoNtext

get_Protocol

get_Status

ISCard

IByteBuffer::Read