Export (0) Print
Expand All
Expand Minimize

SCardEndTransaction function

The SCardEndTransaction function completes a previously declared transaction, allowing other applications to resume interactions with the card.

Syntax


LONG WINAPI SCardEndTransaction(
  _In_  SCARDHANDLE hCard,
  _In_  DWORD dwDisposition
);

Parameters

hCard [in]

Reference value obtained from a previous call to SCardConnect. This value would also have been used in an earlier call to SCardBeginTransaction.

dwDisposition [in]

Action to take on the card in the connected reader on close.

ValueMeaning
SCARD_EJECT_CARD

Eject the card.

SCARD_LEAVE_CARD

Do not do anything special.

SCARD_RESET_CARD

Reset the card.

SCARD_UNPOWER_CARD

Power down the card.

 

Return value

If the function succeeds, the function returns SCARD_S_SUCCESS.

If the function fails, it returns an error code. For more information, see Smart Card Return Values. Possible error codes follow.

Return code/valueDescription
SCARD_W_RESET_CARD
0x80100068L

The transaction was released. Any future communication with the card requires a call to the SCardReconnect function.

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP:  The transaction was not released. The application must immediately call the SCardDisconnect, SCardReconnect, or SCardReleaseContext function to avoid an existing transaction blocking other threads and processes from communicating with the smart card.

 

Remarks

The SCardEndTransaction function is a smart card and reader access function. For more information on other access functions, see Smart Card and Reader Access Functions.

Examples

The following example ends a smart card transaction. The example assumes that lReturn is a valid variable of type LONG, that hCard is a valid handle received from a previous call to the SCardConnect function, and that hCard was passed to a previous call to the SCardBeginTransaction function.



lReturn = SCardEndTransaction(hCard, 
                              SCARD_LEAVE_CARD);
if ( SCARD_S_SUCCESS != lReturn )
    printf("Failed SCardEndTransaction\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
SCardBeginTransaction

 

 

Community Additions

ADD
Show:
© 2014 Microsoft