CardAcquireContext Function

The CardAcquireContext function, defined by a smart card module, initializes communication between the smart card module and either the Microsoft Base Smart Card Cryptographic Service Provider (CSP) or smart card key storage provider (KSP).

Syntax

DWORD WINAPI CardAcquireContext(
  __in  PCARD_DATA pCardData,
  __in  DWORD dwFlags
);

Parameters

  • pCardData [in]
    A pointer to a CARD_DATA structure. The dwVersion member of the CARD_DATA structure must be initialized to the requested version of the structure to be returned by the smart card module.

    On output, the structure contains a table of card module functions and information about the state of the smart card module. On successful output, the dwVersion member of the CARD_DATA structure must be set to the actual version of the structure returned by the smart card module.

  • dwFlags [in]
    Reserved. This parameter must be set to zero.

Return Value

If the function succeeds, it returns zero.

If the function fails, it returns a nonzero error value or one of the following possible error values.

Return code/value Description
SCARD_E_UNKNOWN_CARD 21485322370x8010000D

The pbAtr member of the CARD_DATA structure passed as the pCardData parameter does not refer to a valid smart card, or the smart card module does not recognize the specified smart card.

SCARD_E_INVALID_PARAMETER 21485322280x80100004

The pbAtr, cbAtr, or pwszCardName member of the CARD_DATA structure passed as the pCardData parameter contains a NULL or a value that is not valid, or the pCardData parameter contains a NULL value.

Remarks

This function must be able to return multiple CARD_DATA structures upon multiple calls.

Requirements

Minimum supported client Windows XP, Windows 2000 Professional with SP4
Minimum supported server Windows Server 2003, Windows 2000 Server with SP4
Header Cardmod.h

See Also

Smart Card Modules

CARD_DATA

Send comments about this topic to Microsoft

Build date: 3/5/2009