pcsc-lite 2.3.0
winscard.c File Reference

This handles smart card 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"

Go to the source code of this file.

Macros

#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)
 
LONG SCardReleaseContext (SCARDCONTEXT hContext)
 
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 SCardStatus (SCARDHANDLE hCard, LPSTR szReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
 
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)
 

Variables

static pthread_mutex_t LockMutex = PTHREAD_MUTEX_INITIALIZER
 

Detailed Description

This handles smart card reader communications.

This is the heart of the smart card API.

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

Definition in file winscard.c.

Macro Definition Documentation

◆ PROFILE_END

#define PROFILE_END

Definition at line 182 of file winscard.c.

◆ PROFILE_START

#define PROFILE_START

Definition at line 181 of file winscard.c.

◆ SCARD_PROTOCOL_ANY_OLD

#define SCARD_PROTOCOL_ANY_OLD   0x1000

used for backward compatibility

Definition at line 186 of file winscard.c.

Function Documentation

◆ SCardBeginTransaction()

LONG SCardBeginTransaction ( SCARDHANDLE hCard)

Definition at line 1050 of file winscard.c.

◆ SCardConnect()

LONG SCardConnect ( SCARDCONTEXT hContext,
LPCSTR szReader,
DWORD dwShareMode,
DWORD dwPreferredProtocols,
LPSCARDHANDLE phCard,
LPDWORD pdwActiveProtocol )

Definition at line 229 of file winscard.c.

◆ SCardControl()

LONG SCardControl ( SCARDHANDLE hCard,
DWORD dwControlCode,
LPCVOID pbSendBuffer,
DWORD cbSendLength,
LPVOID pbRecvBuffer,
DWORD cbRecvLength,
LPDWORD lpBytesReturned )

Definition at line 1307 of file winscard.c.

◆ SCardDisconnect()

LONG SCardDisconnect ( SCARDHANDLE hCard,
DWORD dwDisposition )

Definition at line 828 of file winscard.c.

◆ SCardEndTransaction()

LONG SCardEndTransaction ( SCARDHANDLE hCard,
DWORD dwDisposition )

Definition at line 1092 of file winscard.c.

◆ SCardEstablishContext()

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

Definition at line 190 of file winscard.c.

◆ SCardGetAttrib()

LONG SCardGetAttrib ( SCARDHANDLE hCard,
DWORD dwAttrId,
LPBYTE pbAttr,
LPDWORD pcbAttrLen )

Definition at line 1366 of file winscard.c.

◆ SCardReconnect()

LONG SCardReconnect ( SCARDHANDLE hCard,
DWORD dwShareMode,
DWORD dwPreferredProtocols,
DWORD dwInitialization,
LPDWORD pdwActiveProtocol )

Definition at line 523 of file winscard.c.

◆ SCardReleaseContext()

LONG SCardReleaseContext ( SCARDCONTEXT hContext)

Definition at line 215 of file winscard.c.

◆ SCardSetAttrib()

LONG SCardSetAttrib ( SCARDHANDLE hCard,
DWORD dwAttrId,
LPCBYTE pbAttr,
DWORD cbAttrLen )

Definition at line 1441 of file winscard.c.

◆ SCardStatus()

LONG SCardStatus ( SCARDHANDLE hCard,
LPSTR szReaderNames,
LPDWORD pcchReaderLen,
LPDWORD pdwState,
LPDWORD pdwProtocol,
LPBYTE pbAtr,
LPDWORD pcbAtrLen )

Definition at line 1244 of file winscard.c.

◆ SCardTransmit()

LONG SCardTransmit ( SCARDHANDLE hCard,
const SCARD_IO_REQUEST * pioSendPci,
LPCBYTE pbSendBuffer,
DWORD cbSendLength,
SCARD_IO_REQUEST * pioRecvPci,
LPBYTE pbRecvBuffer,
LPDWORD pcbRecvLength )

Definition at line 1491 of file winscard.c.

Variable Documentation

◆ LockMutex

pthread_mutex_t LockMutex = PTHREAD_MUTEX_INITIALIZER
static

Definition at line 188 of file winscard.c.