PC/SC Guide
Prox–DU & Prox–SU
www.gemalto.com
DOC119811A Public Use Page 57/129
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:
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:
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, Windows XP, and
Windows 2000: 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 )