pcsc-lite 1.6.4
Defines | Functions
winscard.c File Reference

This handles smartcard reader communications. More...

#include "config.h"
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>
#include <pthread.h>
#include "pcscd.h"
#include "winscard.h"
#include "ifdhandler.h"
#include "debuglog.h"
#include "readerfactory.h"
#include "prothandler.h"
#include "ifdwrapper.h"
#include "atrhandler.h"
#include "sys_generic.h"
#include "eventhandler.h"
#include "utils.h"
#include "reader.h"
#include "strlcpycat.h"
Include dependency graph for winscard.c:

Go to the source code of this file.

Defines

#define PROFILE_START
#define PROFILE_END
#define SCARD_PROTOCOL_ANY_OLD   0x1000
 used for backward compatibility

Functions

LONG SCardEstablishContext (DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
 Creates an Application Context for a client.
LONG SCardReleaseContext (SCARDCONTEXT hContext)
LONG SCardSetTimeout (SCARDCONTEXT hContext, DWORD dwTimeout)
LONG SCardConnect (SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
LONG SCardReconnect (SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol)
LONG SCardDisconnect (SCARDHANDLE hCard, DWORD dwDisposition)
LONG SCardBeginTransaction (SCARDHANDLE hCard)
LONG SCardEndTransaction (SCARDHANDLE hCard, DWORD dwDisposition)
LONG SCardCancelTransaction (SCARDHANDLE hCard)
LONG SCardStatus (SCARDHANDLE hCard, LPSTR mszReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
LONG SCardGetStatusChange (SCARDCONTEXT hContext, DWORD dwTimeout, SCARD_READERSTATE *rgReaderStates, DWORD cReaders)
LONG SCardControl (SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned)
LONG SCardGetAttrib (SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)
LONG SCardSetAttrib (SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr, DWORD cbAttrLen)
LONG SCardTransmit (SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, SCARD_IO_REQUEST *pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)
LONG SCardListReaders (SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
LONG SCardCancel (SCARDCONTEXT hContext)

Detailed Description

This handles smartcard reader communications.

This is the heart of the M$ smartcard API.

Here are the main server-side functions which execute the requests from the clients.

Definition in file winscard.c.


Function Documentation

LONG SCardEstablishContext ( DWORD  dwScope,
LPCVOID  pvReserved1,
LPCVOID  pvReserved2,
LPSCARDCONTEXT  phContext 
)

Creates an Application Context for a client.

This must be the first function called in a PC/SC application.

Parameters:
[in]dwScopeScope of the establishment. This can either be a local or remote connection.
  • SCARD_SCOPE_USER - Not used.
  • SCARD_SCOPE_TERMINAL - Not used.
  • SCARD_SCOPE_GLOBAL - Not used.
  • SCARD_SCOPE_SYSTEM - Services on the local machine.
[in]pvReserved1Reserved for future use. Can be used for remote connection.
[in]pvReserved2Reserved for future use.
[out]phContextReturned Application Context.
Returns:
Connection status.
Return values:
SCARD_S_SUCCESSSuccessful (SCARD_S_SUCCESS)
SCARD_E_INVALID_VALUEInvalid scope type passed (SCARD_E_INVALID_VALUE)
SCARD_E_INVALID_PARAMETERphContext is null (SCARD_E_INVALID_PARAMETER)

Definition at line 193 of file winscard.c.

References PCSCLITE_SVC_IDENTITY, SCARD_E_INVALID_PARAMETER, SCARD_E_INVALID_VALUE, SCARD_S_SUCCESS, SCARD_SCOPE_GLOBAL, SCARD_SCOPE_SYSTEM, SCARD_SCOPE_TERMINAL, and SCARD_SCOPE_USER.