Subsections

SCardListReaders

Synopsis:

#include <winscard.h>

LONG SCardListReaders(SCARDCONTEXT hContext,
    LPCSTR mszGroups,
    LPSTR mszReaders,
    LPDWORD pcchReaders);

Parameters:

hContext IN Connection context to the PC/SC Resource Manager
mszGroups IN List of groups to list readers (not used)
mszReaders OUT Multi-string with list of readers
pcchReaders INOUT Size of multi-string buffer including NULL's

Description:

This function returns a list of currently available readers on the system. mszReaders is a pointer to a character string that is allocated by the application. If the application sends mszGroups and mszReaders as NULL then this function will return the size of the buffer needed to allocate in pcchReaders.

The reader names is a multi-string and separated by a nul character ('\0') and ended by a double nul character. "Reader A\0Reader B\0\0".

Example:

SCARDCONTEXT hContext;
LPSTR mszReaders;
DWORD dwReaders;
LONG rv;

rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
rv = SCardListReaders(hContext, NULL, NULL, &dwReaders);
mszReaders = malloc(sizeof(char)*dwReaders);
rv = SCardListReaders(hContext, NULL, mszReaders, &dwReaders);

Returns:

SCARD_S_SUCCESS Successful
SCARD_E_INVALID_HANDLE Invalid Scope Handle
SCARD_E_INSUFFICIENT_BUFFER Reader buffer not large enough



2007-06-17