Skip to content

Latest commit

 

History

History
268 lines (218 loc) · 6.4 KB

nf-winscard-scardreconnect.md

File metadata and controls

268 lines (218 loc) · 6.4 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winscard.SCardReconnect
SCardReconnect function (winscard.h)
Reestablishes an existing connection between the calling application and a smart card.
SCARD_LEAVE_CARD
SCARD_PROTOCOL_T0
SCARD_PROTOCOL_T1
SCARD_RESET_CARD
SCARD_SHARE_EXCLUSIVE
SCARD_SHARE_SHARED
SCARD_UNPOWER_CARD
SCardReconnect
SCardReconnect function [Security]
_smart_scardreconnect
security.scardreconnect
winscard/SCardReconnect
security\scardreconnect.htm
security
c79e5810-c2be-4184-8ac7-c058ccb9308e
12/05/2018
SCARD_LEAVE_CARD, SCARD_PROTOCOL_T0, SCARD_PROTOCOL_T1, SCARD_RESET_CARD, SCARD_SHARE_EXCLUSIVE, SCARD_SHARE_SHARED, SCARD_UNPOWER_CARD, SCardReconnect, SCardReconnect function [Security], _smart_scardreconnect, security.scardreconnect, winscard/SCardReconnect
winscard.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
Winscard.lib
Winscard.dll
Windows
19H1
SCardReconnect
winscard/SCardReconnect
c++
APIRef
kbSyntax
DllExport
Winscard.dll
Ext-MS-Win-Security-WinSCard-L1-1-0.dll
SCardReconnect

SCardReconnect function

-description

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.

-parameters

-param hCard [in]

Reference value obtained from a previous call to SCardConnect.

-param dwShareMode [in]

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

Value Meaning
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.

-param 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.

Value Meaning
SCARD_PROTOCOL_T0
T=0 is an acceptable protocol.
SCARD_PROTOCOL_T1
T=1 is an acceptable protocol.

-param dwInitialization [in]

Type of initialization that should be performed on the card.

Value Meaning
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).

-param pdwActiveProtocol [out, optional]

Flag that indicates the established active protocol.

Value Meaning
SCARD_PROTOCOL_T0
T=0 is the active protocol.
SCARD_PROTOCOL_T1
T=1 is the active protocol.

-returns

This function returns different values depending on whether it succeeds or fails.

Return code Description
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");

-see-also

SCardConnect

SCardDisconnect