PC/SC Guide
Prox–DU & Prox–SU
www.gemalto.com
DOC119811A Public Use Page 50/129
SCardConnect Function
The SCardConnect function establishes a connection (using a specific resource manager
context) between the calling application and a smart card contained by a specific reader. If
no card exists in the specified reader, an error is returned.
Syntax:
LONG WINAPI SCardConnect(
__in SCARDCONTEXT hContext,
__in LPCTSTR szReader,
__in DWORD dwShareMode,
__in DWORD dwPreferredProtocols,
__out LPSCARDHANDLE phCard,
__out LPDWORD pdwActiveProtocol
);
Parameters:
hContext [in]
A handle that identifies the resource manager context. The resource manager
context is set by a previous call to SCardEstablishContext.
szReader [in]
The name of the reader that contains the target card.
dwShareMode [in]
A flag that indicates whether other applications may form connections to the card.
SCARD_SHARE_SHARED: This application is willing to share the card with other
applications.
SCARD_SHARE_EXCLUSIVE: This application is not willing to share the card with
other applications.
SCARD_SHARE_DIRECT: This application is allocating the reader for its private
use, and will be controlling it directly. No other applications are allowed access to it.
dwPreferredProtocols [in]
A bitmask of acceptable protocols for the connection. Possible values may be
combined with the OR operation.
SCARD_PROTOCOL_T0: T=0 is an acceptable protocol.
SCARD_PROTOCOL_T1: T=1 is an acceptable protocol.
0: This parameter may be zero only if dwShareMode is set to
SCARD_SHARE_DIRECT. In this case, no protocol negotiation will be performed
by the drivers until an IOCTL_SMARTCARD_SET_PROTOCOL control directive is
sent with SCardControl.
phCard [out]
A handle that identifies the connection to the smart card in the designated reader.
pdwActiveProtocol [out]
A flag that indicates the established active protocol.
SCARD_PROTOCOL_T0: T=0 is the active protocol.