Export (0) Print
Expand All
Expand Minimize

SCardIntroduceCardType function

The SCardIntroduceCardType function introduces a smart card to the smart card subsystem (for the active user) by adding it to the smart card database.

Syntax


LONG WINAPI SCardIntroduceCardType(
  _In_      SCARDCONTEXT hContext,
  _In_      LPCTSTR szCardName,
  _In_opt_  LPCGUID pguidPrimaryProvider,
  _In_opt_  LPCGUID rgguidInterfaces,
  _In_      DWORD dwInterfaceCount,
  _In_      LPCBYTE pbAtr,
  _In_      LPCBYTE pbAtrMask,
  _In_      DWORD cbAtrLen
);

Parameters

hContext [in]

Handle that identifies the resource manager context. The resource manager context is set by a previous call to SCardEstablishContext. This parameter cannot be NULL.

szCardName [in]

Name by which the user can recognize the card.

pguidPrimaryProvider [in, optional]

Pointer to the identifier (GUID) for the smart card's primary service provider.

rgguidInterfaces [in, optional]

Array of identifiers (GUIDs) that identify the interfaces supported by the smart card.

dwInterfaceCount [in]

Number of identifiers in the rgguidInterfaces array.

pbAtr [in]

ATR string that can be used for matching purposes when querying the smart card database (for more information, see SCardListCards). The length of this string is determined by normal ATR parsing.

pbAtrMask [in]

Optional bitmask to use when comparing the ATRs of smart cards to the ATR supplied in pbAtr. If this value is non-NULL, it must point to a string of bytes the same length as the ATR string supplied in pbAtr. When a given ATR string A is compared to the ATR supplied in pbAtr, it matches if and only if A & M = pbAtr, where M is the supplied mask, and & represents bitwise AND.

cbAtrLen [in]

Length of the ATR and optional ATR mask. If this value is zero, then the length of the ATR is determined by normal ATR parsing. This value cannot be zero if a pbAtr value is supplied.

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

This function is not redirected, but calling the function when inside a Remote Desktop session will not result in an error. It only means that the result will be from the remote computer instead of the local computer.

The SCardIntroduceCardType function is a database management function. For more information on other database management functions, see Smart Card Database Management Functions.

To remove a smart card, use SCardForgetCardType.

Examples

The following example shows how to introduce a card type. The example assumes that hContext is a valid handle obtained from a previous call to the SCardEstablishContext function.


GUID  MyGuid = { 0xABCDEF00,
                 0xABCD,
                 0xABCD,
                 0xAA, 0xBB, 0xCC, 0xDD,
                 0xAA, 0xBB, 0xCC, 0xDD };

static const BYTE MyATR[] =     { 0xaa, 0xbb, 0xcc, 0x00, 0xdd };
static const BYTE MyATRMask[] = { 0xff, 0xff, 0xff, 0x00, 0xff};

LONG            lReturn;

lReturn = SCardIntroduceCardType(hContext, 
                                 L"MyCardName",
                                 &MyGuid,
                                 NULL,    // No interface array
                                 0,       // Interface count = 0
                                 MyATR,
                                 MyATRMask,
                                 sizeof(MyATR));
if ( SCARD_S_SUCCESS != lReturn )
    printf("Failed SCardIntroduceCardType\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

Unicode and ANSI names

SCardIntroduceCardTypeW (Unicode) and SCardIntroduceCardTypeA (ANSI)

See also

SCardEstablishContext
SCardForgetCardType
SCardIntroduceReader
SCardIntroduceReaderGroup
SCardListCards

 

 

Community Additions

ADD
Show:
© 2014 Microsoft