Export (0) Print
Expand All
Expand Minimize

SCardReconnect function

The SCardReconnect function reestablishes an existing connection between the calling application and a smart card. This function moves a card handle from direct access to general access, or acknowledges and clears an error condition that is preventing further access to the card.

Syntax


LONG WINAPI SCardReconnect(
  _In_       SCARDHANDLE hCard,
  _In_       DWORD dwShareMode,
  _In_       DWORD dwPreferredProtocols,
  _In_       DWORD dwInitialization,
  _Out_opt_  LPDWORD pdwActiveProtocol
);

Parameters

hCard [in]

Reference value obtained from a previous call to SCardConnect.

dwShareMode [in]

Flag that indicates whether other applications may form connections to this card.

ValueMeaning
SCARD_SHARE_SHARED

This application will share this card with other applications.

SCARD_SHARE_EXCLUSIVE

This application will not share this card with other applications.

 

dwPreferredProtocols [in]

Bitmask of acceptable protocols for this connection. Possible values may be combined with the OR operation. The value of this parameter should include the current protocol. Attempting to reconnect with a protocol other than the current protocol will result in an error.

ValueMeaning
SCARD_PROTOCOL_T0

T=0 is an acceptable protocol.

SCARD_PROTOCOL_T1

T=1 is an acceptable protocol.

 

dwInitialization [in]

Type of initialization that should be performed on the card.

ValueMeaning
SCARD_LEAVE_CARD

Do not do anything special on reconnect.

SCARD_RESET_CARD

Reset the card (Warm Reset).

SCARD_UNPOWER_CARD

Power down the card and reset it (Cold Reset).

 

pdwActiveProtocol [out, optional]

Flag that indicates the established active protocol.

ValueMeaning
SCARD_PROTOCOL_T0

T=0 is the active protocol.

SCARD_PROTOCOL_T1

T=1 is the active protocol.

 

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

SCardReconnect is a smart card and reader access function. For information about other access functions, see Smart Card and Reader Access Functions.

Examples

The following example shows reestablishing a connection.


DWORD     dwAP;
LONG      lReturn;

// Reconnect.
// hCardHandle was set by a previous call to SCardConnect.
lReturn = SCardReconnect(hCardHandle,
                         SCARD_SHARE_SHARED,
                         SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1,
                         SCARD_LEAVE_CARD,
                         &dwAP );
if ( SCARD_S_SUCCESS != lReturn )
    printf("Failed SCardReconnect\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

See also

SCardConnect
SCardDisconnect

 

 

Community Additions

ADD
Show:
© 2014 Microsoft