共用方式為


CardAcquireContext function

This topic is not current. For the most current information about the Smart Card API, see Smart Card Minidriver Specification.

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
2148532237 (0x8010000D)
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
2148532228 (0x80100004)
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 [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Cardmod.h

See also

Smart Card Modules

CARD_DATA