Subsections

SCardBeginTransaction

Synopsis:

#include <winscard.h>

LONG SCardBeginTransaction(SCARDHANDLE hCard);

Parameters:

hCard IN Connection made from SCardConnect

Description:

This function establishes a temporary exclusive access mode for doing a series of commands or transaction. You might want to use this when you are selecting a few files and then writing a large file so you can make sure that another application will not change the current file. If another application has a lock on this reader or this application is in SCARD_SHARE_EXCLUSIVE there will be no action taken.

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 */

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