-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCard.pas
202 lines (135 loc) · 8.78 KB
/
SCard.pas
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
unit SCard;
interface
type
HCkJsonObject = Pointer;
HCkSCard = Pointer;
HCkString = Pointer;
HCkTask = Pointer;
HCkStringTable = Pointer;
HCkBinData = Pointer;
// Note: The callback functions use the cdecl calling convention, while all other functions use stdcall.
TSCardAbortCheck = function(): Integer; cdecl;
TSCardProgressInfo = procedure(name: PWideChar; value: PWideChar); cdecl;
TSCardPercentDone = function(pctDone: Integer): Integer; cdecl;
TSCardTaskCompleted = procedure(task: HCkTask); cdecl;
function CkSCard_Create: HCkSCard; stdcall;
procedure CkSCard_Dispose(handle: HCkSCard); stdcall;
procedure CkSCard_SetAbortCheck(objHandle: HCkSCard; fn: TSCardAbortCheck) stdcall;
procedure CkSCard_SetProgressInfo(objHandle: HCkSCard; fn: TSCardProgressInfo) stdcall;
procedure CkSCard_SetPercentDone(objHandle: HCkSCard; fn: TSCardPercentDone) stdcall;
procedure CkSCard_SetTaskCompleted(objHandle: HCkSCard; fn: TSCardTaskCompleted) stdcall;
procedure CkSCard_getActiveProtocol(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__activeProtocol(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getCardAtr(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__cardAtr(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getConnectedReader(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__connectedReader(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getContext(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__context(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getDebugLogFilePath(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
procedure CkSCard_putDebugLogFilePath(objHandle: HCkSCard; newPropVal: PWideChar); stdcall;
function CkSCard__debugLogFilePath(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getLastErrorHtml(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__lastErrorHtml(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getLastErrorText(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__lastErrorText(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getLastErrorXml(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__lastErrorXml(objHandle: HCkSCard): PWideChar; stdcall;
function CkSCard_getLastMethodSuccess(objHandle: HCkSCard): wordbool; stdcall;
procedure CkSCard_putLastMethodSuccess(objHandle: HCkSCard; newPropVal: wordbool); stdcall;
procedure CkSCard_getPcscLibPath(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
procedure CkSCard_putPcscLibPath(objHandle: HCkSCard; newPropVal: PWideChar); stdcall;
function CkSCard__pcscLibPath(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getReaderStatus(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__readerStatus(objHandle: HCkSCard): PWideChar; stdcall;
procedure CkSCard_getScardError(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__scardError(objHandle: HCkSCard): PWideChar; stdcall;
function CkSCard_getVerboseLogging(objHandle: HCkSCard): wordbool; stdcall;
procedure CkSCard_putVerboseLogging(objHandle: HCkSCard; newPropVal: wordbool); stdcall;
procedure CkSCard_getVersion(objHandle: HCkSCard; outPropVal: HCkString); stdcall;
function CkSCard__version(objHandle: HCkSCard): PWideChar; stdcall;
function CkSCard_BeginTransaction(objHandle: HCkSCard): wordbool; stdcall;
function CkSCard_CheckStatus(objHandle: HCkSCard): wordbool; stdcall;
function CkSCard_Connect(objHandle: HCkSCard; reader: PWideChar; shareMode: PWideChar; preferredProtocol: PWideChar): wordbool; stdcall;
function CkSCard_Disconnect(objHandle: HCkSCard; disposition: PWideChar): wordbool; stdcall;
function CkSCard_EndTransaction(objHandle: HCkSCard; disposition: PWideChar): wordbool; stdcall;
function CkSCard_EstablishContext(objHandle: HCkSCard; scope: PWideChar): wordbool; stdcall;
function CkSCard_FindSmartcards(objHandle: HCkSCard; json: HCkJsonObject): wordbool; stdcall;
function CkSCard_GetAttrib(objHandle: HCkSCard; attr: PWideChar; bd: HCkBinData): wordbool; stdcall;
function CkSCard_GetAttribStr(objHandle: HCkSCard; attr: PWideChar; outStr: HCkString): wordbool; stdcall;
function CkSCard__getAttribStr(objHandle: HCkSCard; attr: PWideChar): PWideChar; stdcall;
function CkSCard_GetAttribUint(objHandle: HCkSCard; attr: PWideChar): LongWord; stdcall;
function CkSCard_GetStatusChange(objHandle: HCkSCard; maxWaitMs: Integer; stReaderNames: HCkStringTable; json: HCkJsonObject): wordbool; stdcall;
function CkSCard_GetStatusChangeAsync(objHandle: HCkSCard; maxWaitMs: Integer; stReaderNames: HCkStringTable; json: HCkJsonObject): HCkTask; stdcall;
function CkSCard_GetStatusChangeCancel(objHandle: HCkSCard): wordbool; stdcall;
function CkSCard_ListReaderGroups(objHandle: HCkSCard; readerGroups: HCkStringTable): wordbool; stdcall;
function CkSCard_ListReaders(objHandle: HCkSCard; st: HCkStringTable): wordbool; stdcall;
function CkSCard_Reconnect(objHandle: HCkSCard; shareMode: PWideChar; preferredProtocol: PWideChar; action: PWideChar): wordbool; stdcall;
function CkSCard_ReleaseContext(objHandle: HCkSCard): wordbool; stdcall;
function CkSCard_SaveLastError(objHandle: HCkSCard; path: PWideChar): wordbool; stdcall;
function CkSCard_SendControl(objHandle: HCkSCard; controlCode: LongWord; bdSend: HCkBinData; bdRecv: HCkBinData): wordbool; stdcall;
function CkSCard_SendControlHex(objHandle: HCkSCard; controlCode: LongWord; sendData: PWideChar; bdRecv: HCkBinData): wordbool; stdcall;
function CkSCard_Transmit(objHandle: HCkSCard; protocol: PWideChar; bdSend: HCkBinData; bdRecv: HCkBinData; maxRecvLen: Integer): wordbool; stdcall;
function CkSCard_TransmitHex(objHandle: HCkSCard; protocol: PWideChar; apduHex: PWideChar; bdRecv: HCkBinData; maxRecvLen: Integer): wordbool; stdcall;
implementation
{$Include chilkatDllPath.inc}
function CkSCard_Create; external DLLName;
procedure CkSCard_Dispose; external DLLName;
procedure CkSCard_SetAbortCheck; external DLLName;
procedure CkSCard_SetProgressInfo; external DLLName;
procedure CkSCard_SetPercentDone; external DLLName;
procedure CkSCard_SetTaskCompleted; external DLLName;
procedure CkSCard_getActiveProtocol; external DLLName;
function CkSCard__activeProtocol; external DLLName;
procedure CkSCard_getCardAtr; external DLLName;
function CkSCard__cardAtr; external DLLName;
procedure CkSCard_getConnectedReader; external DLLName;
function CkSCard__connectedReader; external DLLName;
procedure CkSCard_getContext; external DLLName;
function CkSCard__context; external DLLName;
procedure CkSCard_getDebugLogFilePath; external DLLName;
procedure CkSCard_putDebugLogFilePath; external DLLName;
function CkSCard__debugLogFilePath; external DLLName;
procedure CkSCard_getLastErrorHtml; external DLLName;
function CkSCard__lastErrorHtml; external DLLName;
procedure CkSCard_getLastErrorText; external DLLName;
function CkSCard__lastErrorText; external DLLName;
procedure CkSCard_getLastErrorXml; external DLLName;
function CkSCard__lastErrorXml; external DLLName;
function CkSCard_getLastMethodSuccess; external DLLName;
procedure CkSCard_putLastMethodSuccess; external DLLName;
procedure CkSCard_getPcscLibPath; external DLLName;
procedure CkSCard_putPcscLibPath; external DLLName;
function CkSCard__pcscLibPath; external DLLName;
procedure CkSCard_getReaderStatus; external DLLName;
function CkSCard__readerStatus; external DLLName;
procedure CkSCard_getScardError; external DLLName;
function CkSCard__scardError; external DLLName;
function CkSCard_getVerboseLogging; external DLLName;
procedure CkSCard_putVerboseLogging; external DLLName;
procedure CkSCard_getVersion; external DLLName;
function CkSCard__version; external DLLName;
function CkSCard_BeginTransaction; external DLLName;
function CkSCard_CheckStatus; external DLLName;
function CkSCard_Connect; external DLLName;
function CkSCard_Disconnect; external DLLName;
function CkSCard_EndTransaction; external DLLName;
function CkSCard_EstablishContext; external DLLName;
function CkSCard_FindSmartcards; external DLLName;
function CkSCard_GetAttrib; external DLLName;
function CkSCard_GetAttribStr; external DLLName;
function CkSCard__getAttribStr; external DLLName;
function CkSCard_GetAttribUint; external DLLName;
function CkSCard_GetStatusChange; external DLLName;
function CkSCard_GetStatusChangeAsync; external DLLName;
function CkSCard_GetStatusChangeCancel; external DLLName;
function CkSCard_ListReaderGroups; external DLLName;
function CkSCard_ListReaders; external DLLName;
function CkSCard_Reconnect; external DLLName;
function CkSCard_ReleaseContext; external DLLName;
function CkSCard_SaveLastError; external DLLName;
function CkSCard_SendControl; external DLLName;
function CkSCard_SendControlHex; external DLLName;
function CkSCard_Transmit; external DLLName;
function CkSCard_TransmitHex; external DLLName;
end.