forked from ChengUU/KernoManage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCard.h
30 lines (28 loc) · 1017 Bytes
/
SCard.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once
#include"WINSCARD.H"
#include<QMutex>
#pragma comment (lib, "winscard.lib")
class SCard
{
private:
SCARDCONTEXT hSC; //OK
LONG lReturn; //OK
char mszReaders[1024]; //OK
LPTSTR pReader, pReaderName; //pReader is OK
DWORD dwLen; //OK
int nReaders, nCurrentReader; //
SCARDHANDLE hCardHandle; //OK
DWORD dwAP;
QMutex mutex;
static SCard* reader;
SCard(); //建立上下文、取读卡器列表
~SCard(); //释放上下文
public:
static SCard* getReader();
//基本读卡功能
void SetReader();
int ConnectReader(); //与当前读卡器建立连接
int DisConnectReader(); //与当前读卡器断开连接
int SendCommand(BYTE command[], DWORD commandLength, BYTE result[], DWORD *resultLength); //向读卡器发送命令,并接收返回的数据。返回值为sw
int ReadTheCard(BYTE *recvBuffer, DWORD &recvlen);//新增读卡功能
};