|
#pragma once
#include <Winsock2.h>
class CMyDevice;
class Reader {
public:
CMyDevice *device;
CComPtr<IWDFIoRequest> waitRemoveIpr;
CComPtr<IWDFIoRequest> waitInsertIpr;
HANDLE serverThread;
char vendorName[300];
char vendorIfdType[300];
int deviceUnit;
int powered;
int instance;
int rpcType;
int state;
DWORD protocol; // T0 or T1 - protocol in use
DWORD availableProtocol; // T0, T1 or Both - protocols available
void IoSmartCardGetAttribute(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
void IoSmartCardIsPresent(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
void IoSmartCardGetState(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
void IoSmartCardIsAbsent(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
void IoSmartCardPower(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
void IoSmartCardSetAttribute(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
void IoSmartCardSetProtocol(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
void IoSmartCardTransmit(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize);
bool initProtocols();
virtual bool QueryTransmit(BYTE *APDU,int APDUlen,BYTE *Resp,int *Resplen);
virtual bool QueryATR(BYTE *ATR,DWORD *ATRsize,bool reset=false);
virtual bool CheckATR();
virtual DWORD startServer();
virtual void shutdown();
virtual void init(wchar_t *section);
};
class PipeReader : public Reader {
public:
wchar_t pipeName[300];
wchar_t pipeEventName[300];
HANDLE pipe;
HANDLE eventpipe;
PipeReader();
bool QueryTransmit(BYTE *APDU,int APDUlen,BYTE *Resp,int *Resplen);
bool QueryATR(BYTE *ATR,DWORD *ATRsize,bool reset=false);
bool CheckATR();
DWORD startServer();
void shutdown();
void init(wchar_t *section);
CRITICAL_SECTION eventSection;
CRITICAL_SECTION dataSection;
};
class TcpIpReader : public Reader {
public:
static int portBase;
int port;
int eventPort;
SOCKET socket;
SOCKET AcceptSocket;
SOCKET eventsocket;
bool breakSocket;
TcpIpReader();
bool QueryTransmit(BYTE *APDU,int APDUlen,BYTE *Resp,int *Resplen);
bool QueryATR(BYTE *ATR,DWORD *ATRsize,bool reset=false);
bool CheckATR();
DWORD startServer();
void shutdown();
void init(wchar_t *section);
CRITICAL_SECTION eventSection;
CRITICAL_SECTION dataSection;
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.