Subsections

SCardEndTransaction

Synopsis:

#include <winscard.h>

LONG SCardEndTransaction(SCARDHANDLE hCard,
    DWORD dwDisposition);

Parameters:

hCard IN Connection made from SCardConnect
dwDisposition IN Action to be taken on the reader

Description:

This function ends a previously begun transaction. The calling application must be the owner of the previously begun transaction or an error will occur. dwDisposition can have the following values: The disposition action is not currently used in this release.

Value of dwDisposition Meaning
SCARD_LEAVE_CARD Do nothing
SCARD_RESET_CARD Reset the card
SCARD_UNPOWER_CARD Unpower the card
SCARD_EJECT_CARD Eject the card

Example:

SCARDCONTEXT hContext;
SCARDHANDLE hCard;
DWORD dwActiveProtocol;
LONG rv;

rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
rv = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED,
         SCARD_PROTOCOL_T0, &hCard, &dwActiveProtocol);
rv = SCardBeginTransaction(hCard);

/* Do some transmit commands */

rv = SCardEndTransaction(hCard, SCARD_LEAVE_CARD);

Returns:

SCARD_S_SUCCESS Successful
SCARD_E_INVALID_HANDLE Invalid hCard handle
SCARD_E_SHARING_VIOLATION Someone else has exclusive rights
SCARD_E_READER_UNAVAILABLE The reader has been removed



2007-06-17