ACM1252U-Y3
– Reference Manual
Version 1.03
www.acs.com.hk
Page 10 of 92
www.acs.com
.hk
#define
SCARD_SCOPE_USER 0
SCARDCONTEXT hContext;
// Resource manager context
int
retCode;
char
readerName [256];
// List reader name
void main ()
{
// To establish the resource manager context and assign to “hContext”
retCode = SCardEstablishContext(SCARD_SCOPE_USER,
NULL,
NULL,
&hContext);
if
(retCode != SCARD_S_SUCCESS)
{
// Establishing resource manager context failed
}
else
{
// Establishing resource manager context successful
// List the available reader which can be used in the system
retCode = SCardListReaders (hContext,
NULL,
readerName,
&size);
if
(retCode != SCARD_S_SUCCESS)
{
// Listing reader fail
}
if
(readerName == NULL)
{
// No reader available
}
else
{
// Reader listed
}
}
}
5.1.2.
SCardListReaders
The SCardListReaders function provides the list of readers within a set of named reader groups,
eliminating duplicates.
The caller supplies a list of reader groups and receives the list of readers within the named groups.
Unrecognized group names are ignored. This function only returns readers within the named groups
that are currently attached to the system and available for use.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa379793%28v=vs.85%29.aspx
Example: