共用方式為


SCardIntroduceReaderA 函式 (winscard.h)

SCardIntroduceReader 函式會為現有 智慧卡讀取器引進新的名稱。

注意 智慧卡卡片閱讀機會自動引入系統:智慧卡閱讀機廠商的安裝程式也可以向系統引進智慧卡閱讀機。
 

語法

LONG SCardIntroduceReaderA(
  [in] SCARDCONTEXT hContext,
  [in] LPCSTR       szReaderName,
  [in] LPCSTR       szDeviceName
);

參數

[in] hContext

識別 資源管理員內容的句柄。 資源管理員內容是由先前呼叫 SCardEstablishContext所設定。 這個參數不能 NULL

[in] szReaderName

要指派給讀取器的顯示名稱。

[in] szDeviceName

智慧卡閱讀機的系統名稱,例如“MyReader 01”。

傳回值

此函式會根據它是否成功或失敗,傳回不同的值。

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

言論

系統上安裝的所有讀取器都會由系統名稱自動導入。 一般而言,SCardIntroduceReader 只會呼叫 來變更現有讀取器的名稱。

SCardIntroduceReader 函式是資料庫管理功能。 如需其他資料庫管理功能的詳細資訊,請參閱 智慧卡資料庫管理功能

若要移除讀取器,請使用 SCardForgetReader

例子

下列範例示範智慧卡卡片閱讀機簡介。

// This example renames the reader name.
// This is a two-step process (first add the new
// name, then forget the old name).
LPBYTE    pbAttr = NULL;
DWORD     cByte = SCARD_AUTOALLOCATE;
LONG      lReturn;

// Step 1: Add the new reader name.
// The device name attribute is a necessary value.
// hCardHandle was set by a previous call to SCardConnect.
lReturn = SCardGetAttrib(hCardHandle,
                         SCARD_ATTR_DEVICE_SYSTEM_NAME,
                         (LPBYTE)&pbAttr,
                         &cByte);
if ( SCARD_S_SUCCESS != lReturn )
{
    printf("Failed SCardGetAttrib\n");
    exit(1);  // Or other error action
}
// Add the reader name.
// hContext was set earlier by SCardEstablishContext.
lReturn = SCardIntroduceReader(hContext,
                               TEXT("My New Reader Name"),
                               (LPCTSTR)pbAttr );
if ( SCARD_S_SUCCESS != lReturn )
{
    printf("Failed SCardIntroduceReader\n");
    exit(1);  // Or other error action
}

// Step 2: Forget the old reader name.
lReturn = SCardForgetReader(hContext,
                            (LPCTSTR)pbAttr );
if ( SCARD_S_SUCCESS != lReturn )
{
    printf("Failed SCardForgetReader\n");
    exit(1);  // Or other error action
}

// Free the memory when done.
lReturn = SCardFreeMemory( hContext, pbAttr );

注意

winscard.h 標頭會將 SCardIntroduceReader 定義為別名,根據 UNICODE 預處理器常數的定義,自動選取此函式的 ANSI 或 Unicode 版本。 混合使用編碼中性別名與非編碼中性的程序代碼,可能會導致編譯或運行時間錯誤不符。 如需詳細資訊,請參閱函式原型的 慣例。

要求

要求 價值
最低支援的用戶端 Windows XP [僅限傳統型應用程式]
支援的最低伺服器 Windows Server 2003 [僅限傳統型應用程式]
目標平臺 窗戶
標頭 winscard.h
連結庫 Winscard.lib
DLL Winscard.dll

另請參閱

SCardEstablishContext

SCardForgetReader

SCardIntroduceCardType

SCardIntroduceReaderGroup