SCardIntroduceReaderA 関数 (winscard.h)

SCardIntroduceReader 関数では、既存のスマート カードreader の新しい名前が導入されます。

メモスマート カード リーダーはシステムに自動的に導入されます。スマート カード リーダー ベンダーのセットアップ プログラムでは、スマート カード リーダーをシステムに導入することもできます。
 

構文

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

パラメーター

[in] hContext

リソース マネージャー コンテキストを識別するハンドル。 リソース マネージャー コンテキストは、 SCardEstablishContext の以前の呼び出しによって設定されます。 このパラメーターを NULL にすることはできません。

[in] szReaderName

閲覧者に割り当てる表示名。

[in] szDeviceName

スマート カード リーダーのシステム名 ("MyReader 01" など)。

戻り値

この関数は、成功するか失敗したかに応じて異なる値を返します。

リターン コード 説明
Success
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 (デスクトップ アプリのみ)
対象プラットフォーム Windows
ヘッダー winscard.h
Library Winscard.lib
[DLL] Winscard.dll

こちらもご覧ください

SCardEstablishContext

SCardForgetReader

SCardIntroduceCardType

SCardIntroduceReaderGroup