FreeRDP
include/winpr/smartcard.h
1 
22 #ifndef WINPR_SMARTCARD_H
23 #define WINPR_SMARTCARD_H
24 
25 #include <winpr/platform.h>
26 #include <winpr/winpr.h>
27 #include <winpr/wtypes.h>
28 
29 #include <winpr/io.h>
30 #include <winpr/error.h>
31 
32 WINPR_PRAGMA_DIAG_PUSH
33 WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
34 
35 #ifndef _WINSCARD_H_
36 #define _WINSCARD_H_ /* do not include winscard.h */
37 #endif
38 
39 WINPR_PRAGMA_DIAG_POP
40 
41 #ifndef SCARD_S_SUCCESS
42 
43 #define SCARD_S_SUCCESS NO_ERROR
44 
45 #define SCARD_F_INTERNAL_ERROR -2146435071l // (0x80100001L)
46 #define SCARD_E_CANCELLED -2146435070l // (0x80100002L)
47 #define SCARD_E_INVALID_HANDLE -2146435069l // (0x80100003L)
48 #define SCARD_E_INVALID_PARAMETER -2146435068l // (0x80100004L)
49 #define SCARD_E_INVALID_TARGET -2146435067l // (0x80100005L)
50 #define SCARD_E_NO_MEMORY -2146435066l // (0x80100006L)
51 #define SCARD_F_WAITED_TOO_LONG -2146435065l // (0x80100007L)
52 #define SCARD_E_INSUFFICIENT_BUFFER -2146435064l // (0x80100008L)
53 #define SCARD_E_UNKNOWN_READER -2146435063l // (0x80100009L)
54 #define SCARD_E_TIMEOUT -2146435062l // (0x8010000AL)
55 #define SCARD_E_SHARING_VIOLATION -2146435061l // (0x8010000BL)
56 #define SCARD_E_NO_SMARTCARD -2146435060l // (0x8010000CL)
57 #define SCARD_E_UNKNOWN_CARD -2146435059l // (0x8010000DL)
58 #define SCARD_E_CANT_DISPOSE -2146435058l // (0x8010000EL)
59 #define SCARD_E_PROTO_MISMATCH -2146435057l // (0x8010000FL)
60 #define SCARD_E_NOT_READY -2146435056l // (0x80100010L)
61 #define SCARD_E_INVALID_VALUE -2146435055l // (0x80100011L)
62 #define SCARD_E_SYSTEM_CANCELLED -2146435054l // (0x80100012L)
63 #define SCARD_F_COMM_ERROR -2146435053l // (0x80100013L)
64 #define SCARD_F_UNKNOWN_ERROR -2146435052l // (0x80100014L)
65 #define SCARD_E_INVALID_ATR -2146435051l // (0x80100015L)
66 #define SCARD_E_NOT_TRANSACTED -2146435050l // (0x80100016L)
67 #define SCARD_E_READER_UNAVAILABLE -2146435049l // (0x80100017L)
68 #define SCARD_P_SHUTDOWN -2146435048l // (0x80100018L)
69 #define SCARD_E_PCI_TOO_SMALL -2146435047l // (0x80100019L)
70 #define SCARD_E_READER_UNSUPPORTED -2146435046l // (0x8010001AL)
71 #define SCARD_E_DUPLICATE_READER -2146435045l // (0x8010001BL)
72 #define SCARD_E_CARD_UNSUPPORTED -2146435044l // (0x8010001CL)
73 #define SCARD_E_NO_SERVICE -2146435043l // (0x8010001DL)
74 #define SCARD_E_SERVICE_STOPPED -2146435042l // (0x8010001EL)
75 #define SCARD_E_UNEXPECTED -2146435041l // (0x8010001FL)
76 #define SCARD_E_ICC_INSTALLATION -2146435040l // (0x80100020L)
77 #define SCARD_E_ICC_CREATEORDER -2146435039l // (0x80100021L)
78 #define SCARD_E_UNSUPPORTED_FEATURE -2146435038l // (0x80100022L)
79 #define SCARD_E_DIR_NOT_FOUND -2146435037l // (0x80100023L)
80 #define SCARD_E_FILE_NOT_FOUND -2146435036l // (0x80100024L)
81 #define SCARD_E_NO_DIR -2146435035l // (0x80100025L)
82 #define SCARD_E_NO_FILE -2146435034l // (0x80100026L)
83 #define SCARD_E_NO_ACCESS -2146435033l // (0x80100027L)
84 #define SCARD_E_WRITE_TOO_MANY -2146435032l // (0x80100028L)
85 #define SCARD_E_BAD_SEEK -2146435031l // (0x80100029L)
86 #define SCARD_E_INVALID_CHV -2146435030l // (0x8010002AL)
87 #define SCARD_E_UNKNOWN_RES_MNG -2146435029l // (0x8010002BL)
88 #define SCARD_E_NO_SUCH_CERTIFICATE -2146435028l // (0x8010002CL)
89 #define SCARD_E_CERTIFICATE_UNAVAILABLE -2146435027l // (0x8010002DL)
90 #define SCARD_E_NO_READERS_AVAILABLE -2146435026l // (0x8010002EL)
91 #define SCARD_E_COMM_DATA_LOST -2146435025l // (0x8010002FL)
92 #define SCARD_E_NO_KEY_CONTAINER -2146435024l // (0x80100030L)
93 #define SCARD_E_SERVER_TOO_BUSY -2146435023l // (0x80100031L)
94 #define SCARD_E_PIN_CACHE_EXPIRED -2146435022l // (0x80100032L)
95 #define SCARD_E_NO_PIN_CACHE -2146435021l // (0x80100033L)
96 #define SCARD_E_READ_ONLY_CARD -2146435020l // (0x80100034L)
97 
98 #define SCARD_W_UNSUPPORTED_CARD -2146434971l // (0x80100065L)
99 #define SCARD_W_UNRESPONSIVE_CARD -2146434970l // (0x80100066L)
100 #define SCARD_W_UNPOWERED_CARD -2146434969l // (0x80100067L)
101 #define SCARD_W_RESET_CARD -2146434968l // (0x80100068L)
102 #define SCARD_W_REMOVED_CARD -2146434967l // (0x80100069L)
103 #define SCARD_W_SECURITY_VIOLATION -2146434966l // (0x8010006AL)
104 #define SCARD_W_WRONG_CHV -2146434965l // (0x8010006BL)
105 #define SCARD_W_CHV_BLOCKED -2146434964l // (0x8010006CL)
106 #define SCARD_W_EOF -2146434963l // (0x8010006DL)
107 #define SCARD_W_CANCELLED_BY_USER -2146434962l // (0x8010006EL)
108 #define SCARD_W_CARD_NOT_AUTHENTICATED -2146434961l // (0x8010006FL)
109 #define SCARD_W_CACHE_ITEM_NOT_FOUND -2146434960l // (0x80100070L)
110 #define SCARD_W_CACHE_ITEM_STALE -2146434959l // (0x80100071L)
111 #define SCARD_W_CACHE_ITEM_TOO_BIG -2146434958l // (0x80100072L)
112 
113 #endif
114 
115 /* ------------------------ missing definition with mingw --------------------*/
116 #ifndef SCARD_E_PIN_CACHE_EXPIRED
117 #define SCARD_E_PIN_CACHE_EXPIRED -2146435022l // (0x80100032L)
118 #endif
119 
120 #ifndef SCARD_E_NO_PIN_CACHE
121 #define SCARD_E_NO_PIN_CACHE -2146435021l // (0x80100033L)
122 #endif
123 
124 #ifndef SCARD_E_READ_ONLY_CARD
125 #define SCARD_E_READ_ONLY_CARD -2146435020l // (0x80100034L)
126 #endif
127 
128 #ifndef SCARD_W_CACHE_ITEM_TOO_BIG
129 #define SCARD_W_CACHE_ITEM_TOO_BIG -2146434958l // (0x80100072L)
130 #endif
131 /* -------------------------------------------------------------------------- */
132 
133 #define SCARD_ATR_LENGTH 33
134 
135 #define SCARD_PROTOCOL_UNDEFINED 0x00000000u
136 #define SCARD_PROTOCOL_T0 0x00000001u
137 #define SCARD_PROTOCOL_T1 0x00000002u
138 #define SCARD_PROTOCOL_RAW 0x00010000u
139 
140 #define SCARD_PROTOCOL_Tx (SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1)
141 #define SCARD_PROTOCOL_DEFAULT 0x80000000u
142 #define SCARD_PROTOCOL_OPTIMAL 0x00000000u
143 
144 #define SCARD_POWER_DOWN 0
145 #define SCARD_COLD_RESET 1
146 #define SCARD_WARM_RESET 2
147 
148 #define SCARD_CTL_CODE(code) \
149  CTL_CODE(FILE_DEVICE_SMARTCARD, (code), METHOD_BUFFERED, FILE_ANY_ACCESS)
150 
151 #define IOCTL_SMARTCARD_POWER SCARD_CTL_CODE(1)
152 #define IOCTL_SMARTCARD_GET_ATTRIBUTE SCARD_CTL_CODE(2)
153 #define IOCTL_SMARTCARD_SET_ATTRIBUTE SCARD_CTL_CODE(3)
154 #define IOCTL_SMARTCARD_CONFISCATE SCARD_CTL_CODE(4)
155 #define IOCTL_SMARTCARD_TRANSMIT SCARD_CTL_CODE(5)
156 #define IOCTL_SMARTCARD_EJECT SCARD_CTL_CODE(6)
157 #define IOCTL_SMARTCARD_SWALLOW SCARD_CTL_CODE(7)
158 #define IOCTL_SMARTCARD_IS_PRESENT SCARD_CTL_CODE(10)
159 #define IOCTL_SMARTCARD_IS_ABSENT SCARD_CTL_CODE(11)
160 #define IOCTL_SMARTCARD_SET_PROTOCOL SCARD_CTL_CODE(12)
161 #define IOCTL_SMARTCARD_GET_STATE SCARD_CTL_CODE(14)
162 #define IOCTL_SMARTCARD_GET_LAST_ERROR SCARD_CTL_CODE(15)
163 #define IOCTL_SMARTCARD_GET_PERF_CNTR SCARD_CTL_CODE(16)
164 
165 #define IOCTL_SMARTCARD_GET_FEATURE_REQUEST SCARD_CTL_CODE(3400)
166 
167 #define MAXIMUM_ATTR_STRING_LENGTH 32
168 #define MAXIMUM_SMARTCARD_READERS 10
169 
170 #define SCARD_ATTR_VALUE(Class, Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag)))
171 
172 #define SCARD_CLASS_VENDOR_INFO 1
173 #define SCARD_CLASS_COMMUNICATIONS 2
174 #define SCARD_CLASS_PROTOCOL 3
175 #define SCARD_CLASS_POWER_MGMT 4
176 #define SCARD_CLASS_SECURITY 5
177 #define SCARD_CLASS_MECHANICAL 6
178 #define SCARD_CLASS_VENDOR_DEFINED 7
179 #define SCARD_CLASS_IFD_PROTOCOL 8
180 #define SCARD_CLASS_ICC_STATE 9
181 #define SCARD_CLASS_PERF 0x7FFE
182 #define SCARD_CLASS_SYSTEM 0x7FFF
183 
184 #define SCARD_ATTR_VENDOR_NAME SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0100)
185 #define SCARD_ATTR_VENDOR_IFD_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0101)
186 #define SCARD_ATTR_VENDOR_IFD_VERSION SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0102)
187 #define SCARD_ATTR_VENDOR_IFD_SERIAL_NO SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0103)
188 #define SCARD_ATTR_CHANNEL_ID SCARD_ATTR_VALUE(SCARD_CLASS_COMMUNICATIONS, 0x0110)
189 #define SCARD_ATTR_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0120)
190 #define SCARD_ATTR_DEFAULT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0121)
191 #define SCARD_ATTR_MAX_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0122)
192 #define SCARD_ATTR_DEFAULT_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0123)
193 #define SCARD_ATTR_MAX_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0124)
194 #define SCARD_ATTR_MAX_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0125)
195 #define SCARD_ATTR_POWER_MGMT_SUPPORT SCARD_ATTR_VALUE(SCARD_CLASS_POWER_MGMT, 0x0131)
196 #define SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0140)
197 #define SCARD_ATTR_USER_AUTH_INPUT_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0142)
198 #define SCARD_ATTR_CHARACTERISTICS SCARD_ATTR_VALUE(SCARD_CLASS_MECHANICAL, 0x0150)
199 
200 #define SCARD_ATTR_CURRENT_PROTOCOL_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0201)
201 #define SCARD_ATTR_CURRENT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0202)
202 #define SCARD_ATTR_CURRENT_F SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0203)
203 #define SCARD_ATTR_CURRENT_D SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0204)
204 #define SCARD_ATTR_CURRENT_N SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0205)
205 #define SCARD_ATTR_CURRENT_W SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0206)
206 #define SCARD_ATTR_CURRENT_IFSC SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0207)
207 #define SCARD_ATTR_CURRENT_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0208)
208 #define SCARD_ATTR_CURRENT_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0209)
209 #define SCARD_ATTR_CURRENT_CWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020a)
210 #define SCARD_ATTR_CURRENT_EBC_ENCODING SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020b)
211 #define SCARD_ATTR_EXTENDED_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020c)
212 
213 #define SCARD_ATTR_ICC_PRESENCE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0300)
214 #define SCARD_ATTR_ICC_INTERFACE_STATUS SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0301)
215 #define SCARD_ATTR_CURRENT_IO_STATE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0302)
216 #define SCARD_ATTR_ATR_STRING SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0303)
217 #define SCARD_ATTR_ICC_TYPE_PER_ATR SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0304)
218 
219 #define SCARD_ATTR_ESC_RESET SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA000)
220 #define SCARD_ATTR_ESC_CANCEL SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA003)
221 #define SCARD_ATTR_ESC_AUTHREQUEST SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA005)
222 #define SCARD_ATTR_MAXINPUT SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA007)
223 
224 #define SCARD_ATTR_DEVICE_UNIT SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0001)
225 #define SCARD_ATTR_DEVICE_IN_USE SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0002)
226 #define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0003)
227 #define SCARD_ATTR_DEVICE_SYSTEM_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0004)
228 #define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0005)
229 #define SCARD_ATTR_DEVICE_SYSTEM_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0006)
230 #define SCARD_ATTR_SUPRESS_T1_IFS_REQUEST SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0007)
231 
232 #define SCARD_PERF_NUM_TRANSMISSIONS SCARD_ATTR_VALUE(SCARD_CLASS_PERF, 0x0001)
233 #define SCARD_PERF_BYTES_TRANSMITTED SCARD_ATTR_VALUE(SCARD_CLASS_PERF, 0x0002)
234 #define SCARD_PERF_TRANSMISSION_TIME SCARD_ATTR_VALUE(SCARD_CLASS_PERF, 0x0003)
235 
236 #ifdef UNICODE
237 #define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_W
238 #define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_W
239 #else
240 #define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_A
241 #define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_A
242 #endif
243 
244 #define SCARD_T0_HEADER_LENGTH 7
245 #define SCARD_T0_CMD_LENGTH 5
246 
247 #define SCARD_T1_PROLOGUE_LENGTH 3
248 #define SCARD_T1_EPILOGUE_LENGTH 2
249 #define SCARD_T1_MAX_IFS 254
250 
251 #define SCARD_UNKNOWN 0
252 #define SCARD_ABSENT 1
253 #define SCARD_PRESENT 2
254 #define SCARD_SWALLOWED 3
255 #define SCARD_POWERED 4
256 #define SCARD_NEGOTIABLE 5
257 #define SCARD_SPECIFIC 6
258 
259 #pragma pack(push, 1)
260 
261 typedef struct
262 {
263  DWORD dwProtocol;
264  DWORD cbPciLength;
267 
268 typedef struct
269 {
270  BYTE bCla, bIns, bP1, bP2, bP3;
272 
273 typedef struct
274 {
275  SCARD_IO_REQUEST ioRequest;
276  BYTE bSw1, bSw2;
277  union
278  {
279  SCARD_T0_COMMAND CmdBytes;
280  BYTE rgbHeader[5];
281  } DUMMYUNIONNAME;
283 
285 
286 typedef struct
287 {
288  SCARD_IO_REQUEST ioRequest;
291 
292 #define SCARD_READER_SWALLOWS 0x00000001
293 #define SCARD_READER_EJECTS 0x00000002
294 #define SCARD_READER_CONFISCATES 0x00000004
295 
296 #define SCARD_READER_TYPE_SERIAL 0x01
297 #define SCARD_READER_TYPE_PARALELL 0x02
298 #define SCARD_READER_TYPE_KEYBOARD 0x04
299 #define SCARD_READER_TYPE_SCSI 0x08
300 #define SCARD_READER_TYPE_IDE 0x10
301 #define SCARD_READER_TYPE_USB 0x20
302 #define SCARD_READER_TYPE_PCMCIA 0x40
303 #define SCARD_READER_TYPE_TPM 0x80
304 #define SCARD_READER_TYPE_NFC 0x100
305 #define SCARD_READER_TYPE_UICC 0x200
306 #define SCARD_READER_TYPE_VENDOR 0xF0
307 
308 #ifndef WINSCARDAPI
309 #define WINSCARDAPI WINPR_API
310 #endif
311 
312 typedef ULONG_PTR SCARDCONTEXT;
313 typedef SCARDCONTEXT *PSCARDCONTEXT, *LPSCARDCONTEXT;
314 
315 typedef ULONG_PTR SCARDHANDLE;
316 typedef SCARDHANDLE *PSCARDHANDLE, *LPSCARDHANDLE;
317 
318 #define SCARD_AUTOALLOCATE UINT32_MAX
319 
320 #define SCARD_SCOPE_USER 0
321 #define SCARD_SCOPE_TERMINAL 1
322 #define SCARD_SCOPE_SYSTEM 2
323 
324 #define SCARD_STATE_UNAWARE 0x00000000
325 #define SCARD_STATE_IGNORE 0x00000001
326 #define SCARD_STATE_CHANGED 0x00000002
327 #define SCARD_STATE_UNKNOWN 0x00000004
328 #define SCARD_STATE_UNAVAILABLE 0x00000008
329 #define SCARD_STATE_EMPTY 0x00000010
330 #define SCARD_STATE_PRESENT 0x00000020
331 #define SCARD_STATE_ATRMATCH 0x00000040
332 #define SCARD_STATE_EXCLUSIVE 0x00000080
333 #define SCARD_STATE_INUSE 0x00000100
334 #define SCARD_STATE_MUTE 0x00000200
335 #define SCARD_STATE_UNPOWERED 0x00000400
336 
337 #define SCARD_SHARE_EXCLUSIVE 1
338 #define SCARD_SHARE_SHARED 2
339 #define SCARD_SHARE_DIRECT 3
340 
341 #define SCARD_LEAVE_CARD 0
342 #define SCARD_RESET_CARD 1
343 #define SCARD_UNPOWER_CARD 2
344 #define SCARD_EJECT_CARD 3
345 
346 #define SC_DLG_MINIMAL_UI 0x01
347 #define SC_DLG_NO_UI 0x02
348 #define SC_DLG_FORCE_UI 0x04
349 
350 #define SCERR_NOCARDNAME 0x4000
351 #define SCERR_NOGUIDS 0x8000
352 
353 typedef SCARDHANDLE(WINAPI* LPOCNCONNPROCA)(SCARDCONTEXT hSCardContext, LPSTR szReader,
354  LPSTR mszCards, PVOID pvUserData);
355 typedef SCARDHANDLE(WINAPI* LPOCNCONNPROCW)(SCARDCONTEXT hSCardContext, LPWSTR szReader,
356  LPWSTR mszCards, PVOID pvUserData);
357 
358 typedef BOOL(WINAPI* LPOCNCHKPROC)(SCARDCONTEXT hSCardContext, SCARDHANDLE hCard, PVOID pvUserData);
359 typedef void(WINAPI* LPOCNDSCPROC)(SCARDCONTEXT hSCardContext, SCARDHANDLE hCard, PVOID pvUserData);
360 
361 #define SCARD_READER_SEL_AUTH_PACKAGE ((DWORD)-629)
362 
363 #define SCARD_AUDIT_CHV_FAILURE 0x0
364 #define SCARD_AUDIT_CHV_SUCCESS 0x1
365 
366 #define SCardListCardTypes SCardListCards
367 
368 #define PCSCardIntroduceCardType(hContext, szCardName, pbAtr, pbAtrMask, cbAtrLen, \
369  pguidPrimaryProvider, rgguidInterfaces, dwInterfaceCount) \
370  SCardIntroduceCardType(hContext, szCardName, pguidPrimaryProvider, rgguidInterfaces, \
371  dwInterfaceCount, pbAtr, pbAtrMask, cbAtrLen)
372 
373 #define SCardGetReaderCapabilities SCardGetAttrib
374 #define SCardSetReaderCapabilities SCardSetAttrib
375 
376 typedef struct
377 {
378  LPSTR szReader;
379  LPVOID pvUserData;
380  DWORD dwCurrentState;
381  DWORD dwEventState;
382  DWORD cbAtr;
383  BYTE rgbAtr[36];
385 
386 typedef struct
387 {
388  LPWSTR szReader;
389  LPVOID pvUserData;
390  DWORD dwCurrentState;
391  DWORD dwEventState;
392  DWORD cbAtr;
393  BYTE rgbAtr[36];
395 
396 typedef struct
397 {
398  DWORD cbAtr;
399  BYTE rgbAtr[36];
400  BYTE rgbMask[36];
402 
403 typedef struct
404 {
405  DWORD dwStructSize;
406  LPSTR lpstrGroupNames;
407  DWORD nMaxGroupNames;
408  LPCGUID rgguidInterfaces;
409  DWORD cguidInterfaces;
410  LPSTR lpstrCardNames;
411  DWORD nMaxCardNames;
412  LPOCNCHKPROC lpfnCheck;
413  LPOCNCONNPROCA lpfnConnect;
414  LPOCNDSCPROC lpfnDisconnect;
415  LPVOID pvUserData;
416  DWORD dwShareMode;
417  DWORD dwPreferredProtocols;
419 
420 typedef struct
421 {
422  DWORD dwStructSize;
423  LPWSTR lpstrGroupNames;
424  DWORD nMaxGroupNames;
425  LPCGUID rgguidInterfaces;
426  DWORD cguidInterfaces;
427  LPWSTR lpstrCardNames;
428  DWORD nMaxCardNames;
429  LPOCNCHKPROC lpfnCheck;
430  LPOCNCONNPROCW lpfnConnect;
431  LPOCNDSCPROC lpfnDisconnect;
432  LPVOID pvUserData;
433  DWORD dwShareMode;
434  DWORD dwPreferredProtocols;
436 
437 typedef struct
438 {
439  DWORD dwStructSize;
440  SCARDCONTEXT hSCardContext;
441  HWND hwndOwner;
442  DWORD dwFlags;
443  LPCSTR lpstrTitle;
444  LPCSTR lpstrSearchDesc;
445  HICON hIcon;
446  POPENCARD_SEARCH_CRITERIAA pOpenCardSearchCriteria;
447  LPOCNCONNPROCA lpfnConnect;
448  LPVOID pvUserData;
449  DWORD dwShareMode;
450  DWORD dwPreferredProtocols;
451  LPSTR lpstrRdr;
452  DWORD nMaxRdr;
453  LPSTR lpstrCard;
454  DWORD nMaxCard;
455  DWORD dwActiveProtocol;
456  SCARDHANDLE hCardHandle;
458 
459 typedef struct
460 {
461  DWORD dwStructSize;
462  SCARDCONTEXT hSCardContext;
463  HWND hwndOwner;
464  DWORD dwFlags;
465  LPCWSTR lpstrTitle;
466  LPCWSTR lpstrSearchDesc;
467  HICON hIcon;
468  POPENCARD_SEARCH_CRITERIAW pOpenCardSearchCriteria;
469  LPOCNCONNPROCW lpfnConnect;
470  LPVOID pvUserData;
471  DWORD dwShareMode;
472  DWORD dwPreferredProtocols;
473  LPWSTR lpstrRdr;
474  DWORD nMaxRdr;
475  LPWSTR lpstrCard;
476  DWORD nMaxCard;
477  DWORD dwActiveProtocol;
478  SCARDHANDLE hCardHandle;
480 
481 #define OPENCARDNAMEA_EX OPENCARDNAME_EXA
482 #define OPENCARDNAMEW_EX OPENCARDNAME_EXW
483 #define POPENCARDNAMEA_EX POPENCARDNAME_EXA
484 #define POPENCARDNAMEW_EX POPENCARDNAME_EXW
485 #define LPOPENCARDNAMEA_EX LPOPENCARDNAME_EXA
486 #define LPOPENCARDNAMEW_EX LPOPENCARDNAME_EXW
487 
488 typedef enum
489 {
490  RSR_MATCH_TYPE_READER_AND_CONTAINER = 1,
491  RSR_MATCH_TYPE_SERIAL_NUMBER,
492  RSR_MATCH_TYPE_ALL_CARDS
493 } READER_SEL_REQUEST_MATCH_TYPE;
494 
495 typedef struct
496 {
497  DWORD dwShareMode;
498  DWORD dwPreferredProtocols;
499  READER_SEL_REQUEST_MATCH_TYPE MatchType;
500  union
501  {
502  struct
503  {
504  DWORD cbReaderNameOffset;
505  DWORD cchReaderNameLength;
506  DWORD cbContainerNameOffset;
507  DWORD cchContainerNameLength;
508  DWORD dwDesiredCardModuleVersion;
509  DWORD dwCspFlags;
510  } ReaderAndContainerParameter;
511  struct
512  {
513  DWORD cbSerialNumberOffset;
514  DWORD cbSerialNumberLength;
515  DWORD dwDesiredCardModuleVersion;
516  } SerialNumberParameter;
517  };
519 
520 typedef struct
521 {
522  DWORD cbReaderNameOffset;
523  DWORD cchReaderNameLength;
524  DWORD cbCardNameOffset;
525  DWORD cchCardNameLength;
527 
528 typedef struct
529 {
530  DWORD dwStructSize;
531  HWND hwndOwner;
532  SCARDCONTEXT hSCardContext;
533  LPSTR lpstrGroupNames;
534  DWORD nMaxGroupNames;
535  LPSTR lpstrCardNames;
536  DWORD nMaxCardNames;
537  LPCGUID rgguidInterfaces;
538  DWORD cguidInterfaces;
539  LPSTR lpstrRdr;
540  DWORD nMaxRdr;
541  LPSTR lpstrCard;
542  DWORD nMaxCard;
543  LPCSTR lpstrTitle;
544  DWORD dwFlags;
545  LPVOID pvUserData;
546  DWORD dwShareMode;
547  DWORD dwPreferredProtocols;
548  DWORD dwActiveProtocol;
549  LPOCNCONNPROCA lpfnConnect;
550  LPOCNCHKPROC lpfnCheck;
551  LPOCNDSCPROC lpfnDisconnect;
552  SCARDHANDLE hCardHandle;
554 
555 typedef struct
556 {
557  DWORD dwStructSize;
558  HWND hwndOwner;
559  SCARDCONTEXT hSCardContext;
560  LPWSTR lpstrGroupNames;
561  DWORD nMaxGroupNames;
562  LPWSTR lpstrCardNames;
563  DWORD nMaxCardNames;
564  LPCGUID rgguidInterfaces;
565  DWORD cguidInterfaces;
566  LPWSTR lpstrRdr;
567  DWORD nMaxRdr;
568  LPWSTR lpstrCard;
569  DWORD nMaxCard;
570  LPCWSTR lpstrTitle;
571  DWORD dwFlags;
572  LPVOID pvUserData;
573  DWORD dwShareMode;
574  DWORD dwPreferredProtocols;
575  DWORD dwActiveProtocol;
576  LPOCNCONNPROCW lpfnConnect;
577  LPOCNCHKPROC lpfnCheck;
578  LPOCNDSCPROC lpfnDisconnect;
579  SCARDHANDLE hCardHandle;
581 
582 #pragma pack(pop)
583 
584 #ifdef UNICODE
585 #define LPOCNCONNPROC LPOCNCONNPROCW
586 #define SCARD_READERSTATE SCARD_READERSTATEW
587 #define PSCARD_READERSTATE PSCARD_READERSTATEW
588 #define LPSCARD_READERSTATE LPSCARD_READERSTATEW
589 #define OPENCARD_SEARCH_CRITERIA OPENCARD_SEARCH_CRITERIAW
590 #define LOPENCARD_SEARCH_CRITERIA LOPENCARD_SEARCH_CRITERIAW
591 #define LPOPENCARD_SEARCH_CRITERIA LPOPENCARD_SEARCH_CRITERIAW
592 #define OPENCARDNAME_EX OPENCARDNAME_EXW
593 #define LOPENCARDNAME_EX LOPENCARDNAME_EXW
594 #define LPOPENCARDNAME_EX LPOPENCARDNAME_EXW
595 #define OPENCARDNAME OPENCARDNAMEW
596 #define LOPENCARDNAME LOPENCARDNAMEW
597 #define LPOPENCARDNAME LPOPENCARDNAMEW
598 #else
599 #define LPOCNCONNPROC LPOCNCONNPROCA
600 #define SCARD_READERSTATE SCARD_READERSTATEA
601 #define PSCARD_READERSTATE PSCARD_READERSTATEA
602 #define LPSCARD_READERSTATE LPSCARD_READERSTATEA
603 #define OPENCARD_SEARCH_CRITERIA OPENCARD_SEARCH_CRITERIAA
604 #define LOPENCARD_SEARCH_CRITERIA LOPENCARD_SEARCH_CRITERIAA
605 #define LPOPENCARD_SEARCH_CRITERIA LPOPENCARD_SEARCH_CRITERIAA
606 #define OPENCARDNAME_EX OPENCARDNAME_EXA
607 #define LOPENCARDNAME_EX LOPENCARDNAME_EXA
608 #define LPOPENCARDNAME_EX LPOPENCARDNAME_EXA
609 #define OPENCARDNAME OPENCARDNAMEA
610 #define LOPENCARDNAME LOPENCARDNAMEA
611 #define LPOPENCARDNAME LPOPENCARDNAMEA
612 #endif
613 
614 #ifdef __cplusplus
615 extern "C"
616 {
617 #endif
618 
619  WINPR_API extern const SCARD_IO_REQUEST g_rgSCardT0Pci;
620  WINPR_API extern const SCARD_IO_REQUEST g_rgSCardT1Pci;
621  WINPR_API extern const SCARD_IO_REQUEST g_rgSCardRawPci;
622 
623 #define SCARD_PCI_T0 (&g_rgSCardT0Pci)
624 #define SCARD_PCI_T1 (&g_rgSCardT1Pci)
625 #define SCARD_PCI_RAW (&g_rgSCardRawPci)
626 
627  WINSCARDAPI LONG WINAPI SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1,
628  LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
629 
630  WINSCARDAPI LONG WINAPI SCardReleaseContext(SCARDCONTEXT hContext);
631 
632  WINSCARDAPI LONG WINAPI SCardIsValidContext(SCARDCONTEXT hContext);
633 
634  WINSCARDAPI LONG WINAPI SCardListReaderGroupsA(SCARDCONTEXT hContext, LPSTR mszGroups,
635  LPDWORD pcchGroups);
636  WINSCARDAPI LONG WINAPI SCardListReaderGroupsW(SCARDCONTEXT hContext, LPWSTR mszGroups,
637  LPDWORD pcchGroups);
638 
639  WINSCARDAPI LONG WINAPI SCardListReadersA(SCARDCONTEXT hContext, LPCSTR mszGroups,
640  LPSTR mszReaders, LPDWORD pcchReaders);
641  WINSCARDAPI LONG WINAPI SCardListReadersW(SCARDCONTEXT hContext, LPCWSTR mszGroups,
642  LPWSTR mszReaders, LPDWORD pcchReaders);
643 
644  WINSCARDAPI LONG WINAPI SCardListCardsA(SCARDCONTEXT hContext, LPCBYTE pbAtr,
645  LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
646  CHAR* mszCards, LPDWORD pcchCards);
647 
648  WINSCARDAPI LONG WINAPI SCardListCardsW(SCARDCONTEXT hContext, LPCBYTE pbAtr,
649  LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
650  WCHAR* mszCards, LPDWORD pcchCards);
651 
652  WINSCARDAPI LONG WINAPI SCardListInterfacesA(SCARDCONTEXT hContext, LPCSTR szCard,
653  LPGUID pguidInterfaces, LPDWORD pcguidInterfaces);
654  WINSCARDAPI LONG WINAPI SCardListInterfacesW(SCARDCONTEXT hContext, LPCWSTR szCard,
655  LPGUID pguidInterfaces, LPDWORD pcguidInterfaces);
656 
657  WINSCARDAPI LONG WINAPI SCardGetProviderIdA(SCARDCONTEXT hContext, LPCSTR szCard,
658  LPGUID pguidProviderId);
659  WINSCARDAPI LONG WINAPI SCardGetProviderIdW(SCARDCONTEXT hContext, LPCWSTR szCard,
660  LPGUID pguidProviderId);
661 
662  WINSCARDAPI LONG WINAPI SCardGetCardTypeProviderNameA(SCARDCONTEXT hContext, LPCSTR szCardName,
663  DWORD dwProviderId, CHAR* szProvider,
664  LPDWORD pcchProvider);
665  WINSCARDAPI LONG WINAPI SCardGetCardTypeProviderNameW(SCARDCONTEXT hContext, LPCWSTR szCardName,
666  DWORD dwProviderId, WCHAR* szProvider,
667  LPDWORD pcchProvider);
668 
669  WINSCARDAPI LONG WINAPI SCardIntroduceReaderGroupA(SCARDCONTEXT hContext, LPCSTR szGroupName);
670  WINSCARDAPI LONG WINAPI SCardIntroduceReaderGroupW(SCARDCONTEXT hContext, LPCWSTR szGroupName);
671 
672  WINSCARDAPI LONG WINAPI SCardForgetReaderGroupA(SCARDCONTEXT hContext, LPCSTR szGroupName);
673  WINSCARDAPI LONG WINAPI SCardForgetReaderGroupW(SCARDCONTEXT hContext, LPCWSTR szGroupName);
674 
675  WINSCARDAPI LONG WINAPI SCardIntroduceReaderA(SCARDCONTEXT hContext, LPCSTR szReaderName,
676  LPCSTR szDeviceName);
677  WINSCARDAPI LONG WINAPI SCardIntroduceReaderW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
678  LPCWSTR szDeviceName);
679 
680  WINSCARDAPI LONG WINAPI SCardForgetReaderA(SCARDCONTEXT hContext, LPCSTR szReaderName);
681  WINSCARDAPI LONG WINAPI SCardForgetReaderW(SCARDCONTEXT hContext, LPCWSTR szReaderName);
682 
683  WINSCARDAPI LONG WINAPI SCardAddReaderToGroupA(SCARDCONTEXT hContext, LPCSTR szReaderName,
684  LPCSTR szGroupName);
685  WINSCARDAPI LONG WINAPI SCardAddReaderToGroupW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
686  LPCWSTR szGroupName);
687 
688  WINSCARDAPI LONG WINAPI SCardRemoveReaderFromGroupA(SCARDCONTEXT hContext, LPCSTR szReaderName,
689  LPCSTR szGroupName);
690  WINSCARDAPI LONG WINAPI SCardRemoveReaderFromGroupW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
691  LPCWSTR szGroupName);
692 
693  WINSCARDAPI LONG WINAPI SCardIntroduceCardTypeA(SCARDCONTEXT hContext, LPCSTR szCardName,
694  LPCGUID pguidPrimaryProvider,
695  LPCGUID rgguidInterfaces,
696  DWORD dwInterfaceCount, LPCBYTE pbAtr,
697  LPCBYTE pbAtrMask, DWORD cbAtrLen);
698  WINSCARDAPI LONG WINAPI SCardIntroduceCardTypeW(SCARDCONTEXT hContext, LPCWSTR szCardName,
699  LPCGUID pguidPrimaryProvider,
700  LPCGUID rgguidInterfaces,
701  DWORD dwInterfaceCount, LPCBYTE pbAtr,
702  LPCBYTE pbAtrMask, DWORD cbAtrLen);
703 
704  WINSCARDAPI LONG WINAPI SCardSetCardTypeProviderNameA(SCARDCONTEXT hContext, LPCSTR szCardName,
705  DWORD dwProviderId, LPCSTR szProvider);
706  WINSCARDAPI LONG WINAPI SCardSetCardTypeProviderNameW(SCARDCONTEXT hContext, LPCWSTR szCardName,
707  DWORD dwProviderId, LPCWSTR szProvider);
708 
709  WINSCARDAPI LONG WINAPI SCardForgetCardTypeA(SCARDCONTEXT hContext, LPCSTR szCardName);
710  WINSCARDAPI LONG WINAPI SCardForgetCardTypeW(SCARDCONTEXT hContext, LPCWSTR szCardName);
711 
712  WINSCARDAPI LONG WINAPI SCardFreeMemory(SCARDCONTEXT hContext, LPVOID pvMem);
713 
714  WINSCARDAPI HANDLE WINAPI SCardAccessStartedEvent(void);
715 
716  WINSCARDAPI void WINAPI SCardReleaseStartedEvent(void);
717 
718  WINSCARDAPI LONG WINAPI SCardLocateCardsA(SCARDCONTEXT hContext, LPCSTR mszCards,
719  LPSCARD_READERSTATEA rgReaderStates, DWORD cReaders);
720  WINSCARDAPI LONG WINAPI SCardLocateCardsW(SCARDCONTEXT hContext, LPCWSTR mszCards,
721  LPSCARD_READERSTATEW rgReaderStates, DWORD cReaders);
722 
723  WINSCARDAPI LONG WINAPI SCardLocateCardsByATRA(SCARDCONTEXT hContext,
724  LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs,
725  LPSCARD_READERSTATEA rgReaderStates,
726  DWORD cReaders);
727  WINSCARDAPI LONG WINAPI SCardLocateCardsByATRW(SCARDCONTEXT hContext,
728  LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs,
729  LPSCARD_READERSTATEW rgReaderStates,
730  DWORD cReaders);
731 
732  WINSCARDAPI LONG WINAPI SCardGetStatusChangeA(SCARDCONTEXT hContext, DWORD dwTimeout,
733  LPSCARD_READERSTATEA rgReaderStates,
734  DWORD cReaders);
735  WINSCARDAPI LONG WINAPI SCardGetStatusChangeW(SCARDCONTEXT hContext, DWORD dwTimeout,
736  LPSCARD_READERSTATEW rgReaderStates,
737  DWORD cReaders);
738 
739  WINSCARDAPI LONG WINAPI SCardCancel(SCARDCONTEXT hContext);
740 
741  WINSCARDAPI LONG WINAPI SCardConnectA(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode,
742  DWORD dwPreferredProtocols, LPSCARDHANDLE phCard,
743  LPDWORD pdwActiveProtocol);
744  WINSCARDAPI LONG WINAPI SCardConnectW(SCARDCONTEXT hContext, LPCWSTR szReader,
745  DWORD dwShareMode, DWORD dwPreferredProtocols,
746  LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
747 
748  WINSCARDAPI LONG WINAPI SCardReconnect(SCARDHANDLE hCard, DWORD dwShareMode,
749  DWORD dwPreferredProtocols, DWORD dwInitialization,
750  LPDWORD pdwActiveProtocol);
751 
752  WINSCARDAPI LONG WINAPI SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition);
753 
754  WINSCARDAPI LONG WINAPI SCardBeginTransaction(SCARDHANDLE hCard);
755 
756  WINSCARDAPI LONG WINAPI SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition);
757 
758  WINSCARDAPI LONG WINAPI SCardCancelTransaction(SCARDHANDLE hCard);
759 
760  WINSCARDAPI LONG WINAPI SCardState(SCARDHANDLE hCard, LPDWORD pdwState, LPDWORD pdwProtocol,
761  LPBYTE pbAtr, LPDWORD pcbAtrLen);
762 
763  WINSCARDAPI LONG WINAPI SCardStatusA(SCARDHANDLE hCard, LPSTR mszReaderNames,
764  LPDWORD pcchReaderLen, LPDWORD pdwState,
765  LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen);
766  WINSCARDAPI LONG WINAPI SCardStatusW(SCARDHANDLE hCard, LPWSTR mszReaderNames,
767  LPDWORD pcchReaderLen, LPDWORD pdwState,
768  LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen);
769 
770  WINSCARDAPI LONG WINAPI SCardTransmit(SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci,
771  LPCBYTE pbSendBuffer, DWORD cbSendLength,
772  LPSCARD_IO_REQUEST pioRecvPci, LPBYTE pbRecvBuffer,
773  LPDWORD pcbRecvLength);
774 
775  WINSCARDAPI LONG WINAPI SCardGetTransmitCount(SCARDHANDLE hCard, LPDWORD pcTransmitCount);
776 
777  WINSCARDAPI LONG WINAPI SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID lpInBuffer,
778  DWORD cbInBufferSize, LPVOID lpOutBuffer,
779  DWORD cbOutBufferSize, LPDWORD lpBytesReturned);
780 
781  WINSCARDAPI LONG WINAPI SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
782  LPDWORD pcbAttrLen);
783 
784  WINSCARDAPI LONG WINAPI SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr,
785  DWORD cbAttrLen);
786 
787  WINSCARDAPI LONG WINAPI SCardUIDlgSelectCardA(LPOPENCARDNAMEA_EX pDlgStruc);
788  WINSCARDAPI LONG WINAPI SCardUIDlgSelectCardW(LPOPENCARDNAMEW_EX pDlgStruc);
789 
790  WINSCARDAPI LONG WINAPI GetOpenCardNameA(LPOPENCARDNAMEA pDlgStruc);
791  WINSCARDAPI LONG WINAPI GetOpenCardNameW(LPOPENCARDNAMEW pDlgStruc);
792 
793  WINSCARDAPI LONG WINAPI SCardDlgExtendedError(void);
794 
795  WINSCARDAPI LONG WINAPI SCardReadCacheA(SCARDCONTEXT hContext, UUID* CardIdentifier,
796  DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
797  DWORD* DataLen);
798  WINSCARDAPI LONG WINAPI SCardReadCacheW(SCARDCONTEXT hContext, UUID* CardIdentifier,
799  DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
800  DWORD* DataLen);
801 
802  WINSCARDAPI LONG WINAPI SCardWriteCacheA(SCARDCONTEXT hContext, UUID* CardIdentifier,
803  DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
804  DWORD DataLen);
805  WINSCARDAPI LONG WINAPI SCardWriteCacheW(SCARDCONTEXT hContext, UUID* CardIdentifier,
806  DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
807  DWORD DataLen);
808 
809  WINSCARDAPI LONG WINAPI SCardGetReaderIconA(SCARDCONTEXT hContext, LPCSTR szReaderName,
810  LPBYTE pbIcon, LPDWORD pcbIcon);
811  WINSCARDAPI LONG WINAPI SCardGetReaderIconW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
812  LPBYTE pbIcon, LPDWORD pcbIcon);
813 
814  WINSCARDAPI LONG WINAPI SCardGetDeviceTypeIdA(SCARDCONTEXT hContext, LPCSTR szReaderName,
815  LPDWORD pdwDeviceTypeId);
816  WINSCARDAPI LONG WINAPI SCardGetDeviceTypeIdW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
817  LPDWORD pdwDeviceTypeId);
818 
819  WINSCARDAPI LONG WINAPI SCardGetReaderDeviceInstanceIdA(SCARDCONTEXT hContext,
820  LPCSTR szReaderName,
821  LPSTR szDeviceInstanceId,
822  LPDWORD pcchDeviceInstanceId);
823  WINSCARDAPI LONG WINAPI SCardGetReaderDeviceInstanceIdW(SCARDCONTEXT hContext,
824  LPCWSTR szReaderName,
825  LPWSTR szDeviceInstanceId,
826  LPDWORD pcchDeviceInstanceId);
827 
828  WINSCARDAPI LONG WINAPI SCardListReadersWithDeviceInstanceIdA(SCARDCONTEXT hContext,
829  LPCSTR szDeviceInstanceId,
830  LPSTR mszReaders,
831  LPDWORD pcchReaders);
832  WINSCARDAPI LONG WINAPI SCardListReadersWithDeviceInstanceIdW(SCARDCONTEXT hContext,
833  LPCWSTR szDeviceInstanceId,
834  LPWSTR mszReaders,
835  LPDWORD pcchReaders);
836 
837  WINSCARDAPI LONG WINAPI SCardAudit(SCARDCONTEXT hContext, DWORD dwEvent);
838 
839 #ifdef UNICODE
840 #define SCardListReaderGroups SCardListReaderGroupsW
841 #define SCardListReaders SCardListReadersW
842 #define SCardListCards SCardListCardsW
843 #define SCardListInterfaces SCardListInterfacesW
844 #define SCardGetProviderId SCardGetProviderIdW
845 #define SCardGetCardTypeProviderName SCardGetCardTypeProviderNameW
846 #define SCardIntroduceReaderGroup SCardIntroduceReaderGroupW
847 #define SCardForgetReaderGroup SCardForgetReaderGroupW
848 #define SCardIntroduceReader SCardIntroduceReaderW
849 #define SCardForgetReader SCardForgetReaderW
850 #define SCardAddReaderToGroup SCardAddReaderToGroupW
851 #define SCardRemoveReaderFromGroup SCardRemoveReaderFromGroupW
852 #define SCardIntroduceCardType SCardIntroduceCardTypeW
853 #define SCardSetCardTypeProviderName SCardSetCardTypeProviderNameW
854 #define SCardForgetCardType SCardForgetCardTypeW
855 #define SCardLocateCards SCardLocateCardsW
856 #define SCardLocateCardsByATR SCardLocateCardsByATRW
857 #define SCardGetStatusChange SCardGetStatusChangeW
858 #define SCardConnect SCardConnectW
859 #define SCardStatus SCardStatusW
860 #define SCardUIDlgSelectCard SCardUIDlgSelectCardW
861 #define GetOpenCardName GetOpenCardNameW
862 #define SCardReadCache SCardReadCacheW
863 #define SCardWriteCache SCardWriteCacheW
864 #define SCardGetReaderIcon SCardGetReaderIconW
865 #define SCardGetDeviceTypeId SCardGetDeviceTypeIdW
866 #define SCardGetReaderDeviceInstanceId SCardGetReaderDeviceInstanceIdW
867 #define SCardListReadersWithDeviceInstanceId SCardListReadersWithDeviceInstanceIdW
868 #else
869 #define SCardListReaderGroups SCardListReaderGroupsA
870 #define SCardListReaders SCardListReadersA
871 #define SCardListCards SCardListCardsA
872 #define SCardListInterfaces SCardListInterfacesA
873 #define SCardGetProviderId SCardGetProviderIdA
874 #define SCardGetCardTypeProviderName SCardGetCardTypeProviderNameA
875 #define SCardIntroduceReaderGroup SCardIntroduceReaderGroupA
876 #define SCardForgetReaderGroup SCardForgetReaderGroupA
877 #define SCardIntroduceReader SCardIntroduceReaderA
878 #define SCardForgetReader SCardForgetReaderA
879 #define SCardAddReaderToGroup SCardAddReaderToGroupA
880 #define SCardRemoveReaderFromGroup SCardRemoveReaderFromGroupA
881 #define SCardIntroduceCardType SCardIntroduceCardTypeA
882 #define SCardSetCardTypeProviderName SCardSetCardTypeProviderNameA
883 #define SCardForgetCardType SCardForgetCardTypeA
884 #define SCardLocateCards SCardLocateCardsA
885 #define SCardLocateCardsByATR SCardLocateCardsByATRA
886 #define SCardGetStatusChange SCardGetStatusChangeA
887 #define SCardConnect SCardConnectA
888 #define SCardStatus SCardStatusA
889 #define SCardUIDlgSelectCard SCardUIDlgSelectCardA
890 #define GetOpenCardName GetOpenCardNameA
891 #define SCardReadCache SCardReadCacheA
892 #define SCardWriteCache SCardWriteCacheA
893 #define SCardGetReaderIcon SCardGetReaderIconA
894 #define SCardGetDeviceTypeId SCardGetDeviceTypeIdA
895 #define SCardGetReaderDeviceInstanceId SCardGetReaderDeviceInstanceIdA
896 #define SCardListReadersWithDeviceInstanceId SCardListReadersWithDeviceInstanceIdA
897 #endif
898 
899 #ifdef __cplusplus
900 }
901 #endif
902 
907 typedef LONG(WINAPI* fnSCardEstablishContext)(DWORD dwScope, LPCVOID pvReserved1,
908  LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
909 
910 typedef LONG(WINAPI* fnSCardReleaseContext)(SCARDCONTEXT hContext);
911 
912 typedef LONG(WINAPI* fnSCardIsValidContext)(SCARDCONTEXT hContext);
913 
914 typedef LONG(WINAPI* fnSCardListReaderGroupsA)(SCARDCONTEXT hContext, LPSTR mszGroups,
915  LPDWORD pcchGroups);
916 typedef LONG(WINAPI* fnSCardListReaderGroupsW)(SCARDCONTEXT hContext, LPWSTR mszGroups,
917  LPDWORD pcchGroups);
918 
919 typedef LONG(WINAPI* fnSCardListReadersA)(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders,
920  LPDWORD pcchReaders);
921 typedef LONG(WINAPI* fnSCardListReadersW)(SCARDCONTEXT hContext, LPCWSTR mszGroups,
922  LPWSTR mszReaders, LPDWORD pcchReaders);
923 
924 typedef LONG(WINAPI* fnSCardListCardsA)(SCARDCONTEXT hContext, LPCBYTE pbAtr,
925  LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
926  CHAR* mszCards, LPDWORD pcchCards);
927 
928 typedef LONG(WINAPI* fnSCardListCardsW)(SCARDCONTEXT hContext, LPCBYTE pbAtr,
929  LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
930  WCHAR* mszCards, LPDWORD pcchCards);
931 
932 typedef LONG(WINAPI* fnSCardListInterfacesA)(SCARDCONTEXT hContext, LPCSTR szCard,
933  LPGUID pguidInterfaces, LPDWORD pcguidInterfaces);
934 typedef LONG(WINAPI* fnSCardListInterfacesW)(SCARDCONTEXT hContext, LPCWSTR szCard,
935  LPGUID pguidInterfaces, LPDWORD pcguidInterfaces);
936 
937 typedef LONG(WINAPI* fnSCardGetProviderIdA)(SCARDCONTEXT hContext, LPCSTR szCard,
938  LPGUID pguidProviderId);
939 typedef LONG(WINAPI* fnSCardGetProviderIdW)(SCARDCONTEXT hContext, LPCWSTR szCard,
940  LPGUID pguidProviderId);
941 
942 typedef LONG(WINAPI* fnSCardGetCardTypeProviderNameA)(SCARDCONTEXT hContext, LPCSTR szCardName,
943  DWORD dwProviderId, CHAR* szProvider,
944  LPDWORD pcchProvider);
945 typedef LONG(WINAPI* fnSCardGetCardTypeProviderNameW)(SCARDCONTEXT hContext, LPCWSTR szCardName,
946  DWORD dwProviderId, WCHAR* szProvider,
947  LPDWORD pcchProvider);
948 
949 typedef LONG(WINAPI* fnSCardIntroduceReaderGroupA)(SCARDCONTEXT hContext, LPCSTR szGroupName);
950 typedef LONG(WINAPI* fnSCardIntroduceReaderGroupW)(SCARDCONTEXT hContext, LPCWSTR szGroupName);
951 
952 typedef LONG(WINAPI* fnSCardForgetReaderGroupA)(SCARDCONTEXT hContext, LPCSTR szGroupName);
953 typedef LONG(WINAPI* fnSCardForgetReaderGroupW)(SCARDCONTEXT hContext, LPCWSTR szGroupName);
954 
955 typedef LONG(WINAPI* fnSCardIntroduceReaderA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
956  LPCSTR szDeviceName);
957 typedef LONG(WINAPI* fnSCardIntroduceReaderW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
958  LPCWSTR szDeviceName);
959 
960 typedef LONG(WINAPI* fnSCardForgetReaderA)(SCARDCONTEXT hContext, LPCSTR szReaderName);
961 typedef LONG(WINAPI* fnSCardForgetReaderW)(SCARDCONTEXT hContext, LPCWSTR szReaderName);
962 
963 typedef LONG(WINAPI* fnSCardAddReaderToGroupA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
964  LPCSTR szGroupName);
965 typedef LONG(WINAPI* fnSCardAddReaderToGroupW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
966  LPCWSTR szGroupName);
967 
968 typedef LONG(WINAPI* fnSCardRemoveReaderFromGroupA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
969  LPCSTR szGroupName);
970 typedef LONG(WINAPI* fnSCardRemoveReaderFromGroupW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
971  LPCWSTR szGroupName);
972 
973 typedef LONG(WINAPI* fnSCardIntroduceCardTypeA)(SCARDCONTEXT hContext, LPCSTR szCardName,
974  LPCGUID pguidPrimaryProvider,
975  LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
976  LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen);
977 typedef LONG(WINAPI* fnSCardIntroduceCardTypeW)(SCARDCONTEXT hContext, LPCWSTR szCardName,
978  LPCGUID pguidPrimaryProvider,
979  LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
980  LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen);
981 
982 typedef LONG(WINAPI* fnSCardSetCardTypeProviderNameA)(SCARDCONTEXT hContext, LPCSTR szCardName,
983  DWORD dwProviderId, LPCSTR szProvider);
984 typedef LONG(WINAPI* fnSCardSetCardTypeProviderNameW)(SCARDCONTEXT hContext, LPCWSTR szCardName,
985  DWORD dwProviderId, LPCWSTR szProvider);
986 
987 typedef LONG(WINAPI* fnSCardForgetCardTypeA)(SCARDCONTEXT hContext, LPCSTR szCardName);
988 typedef LONG(WINAPI* fnSCardForgetCardTypeW)(SCARDCONTEXT hContext, LPCWSTR szCardName);
989 
990 typedef LONG(WINAPI* fnSCardFreeMemory)(SCARDCONTEXT hContext, LPVOID pvMem);
991 
992 typedef HANDLE(WINAPI* fnSCardAccessStartedEvent)(void);
993 
994 typedef void(WINAPI* fnSCardReleaseStartedEvent)(void);
995 
996 typedef LONG(WINAPI* fnSCardLocateCardsA)(SCARDCONTEXT hContext, LPCSTR mszCards,
997  LPSCARD_READERSTATEA rgReaderStates, DWORD cReaders);
998 typedef LONG(WINAPI* fnSCardLocateCardsW)(SCARDCONTEXT hContext, LPCWSTR mszCards,
999  LPSCARD_READERSTATEW rgReaderStates, DWORD cReaders);
1000 
1001 typedef LONG(WINAPI* fnSCardLocateCardsByATRA)(SCARDCONTEXT hContext, LPSCARD_ATRMASK rgAtrMasks,
1002  DWORD cAtrs, LPSCARD_READERSTATEA rgReaderStates,
1003  DWORD cReaders);
1004 typedef LONG(WINAPI* fnSCardLocateCardsByATRW)(SCARDCONTEXT hContext, LPSCARD_ATRMASK rgAtrMasks,
1005  DWORD cAtrs, LPSCARD_READERSTATEW rgReaderStates,
1006  DWORD cReaders);
1007 
1008 typedef LONG(WINAPI* fnSCardGetStatusChangeA)(SCARDCONTEXT hContext, DWORD dwTimeout,
1009  LPSCARD_READERSTATEA rgReaderStates, DWORD cReaders);
1010 typedef LONG(WINAPI* fnSCardGetStatusChangeW)(SCARDCONTEXT hContext, DWORD dwTimeout,
1011  LPSCARD_READERSTATEW rgReaderStates, DWORD cReaders);
1012 
1013 typedef LONG(WINAPI* fnSCardCancel)(SCARDCONTEXT hContext);
1014 
1015 typedef LONG(WINAPI* fnSCardConnectA)(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode,
1016  DWORD dwPreferredProtocols, LPSCARDHANDLE phCard,
1017  LPDWORD pdwActiveProtocol);
1018 typedef LONG(WINAPI* fnSCardConnectW)(SCARDCONTEXT hContext, LPCWSTR szReader, DWORD dwShareMode,
1019  DWORD dwPreferredProtocols, LPSCARDHANDLE phCard,
1020  LPDWORD pdwActiveProtocol);
1021 
1022 typedef LONG(WINAPI* fnSCardReconnect)(SCARDHANDLE hCard, DWORD dwShareMode,
1023  DWORD dwPreferredProtocols, DWORD dwInitialization,
1024  LPDWORD pdwActiveProtocol);
1025 
1026 typedef LONG(WINAPI* fnSCardDisconnect)(SCARDHANDLE hCard, DWORD dwDisposition);
1027 
1028 typedef LONG(WINAPI* fnSCardBeginTransaction)(SCARDHANDLE hCard);
1029 
1030 typedef LONG(WINAPI* fnSCardEndTransaction)(SCARDHANDLE hCard, DWORD dwDisposition);
1031 
1032 typedef LONG(WINAPI* fnSCardCancelTransaction)(SCARDHANDLE hCard);
1033 
1034 typedef LONG(WINAPI* fnSCardState)(SCARDHANDLE hCard, LPDWORD pdwState, LPDWORD pdwProtocol,
1035  LPBYTE pbAtr, LPDWORD pcbAtrLen);
1036 
1037 typedef LONG(WINAPI* fnSCardStatusA)(SCARDHANDLE hCard, LPSTR mszReaderNames, LPDWORD pcchReaderLen,
1038  LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr,
1039  LPDWORD pcbAtrLen);
1040 typedef LONG(WINAPI* fnSCardStatusW)(SCARDHANDLE hCard, LPWSTR mszReaderNames,
1041  LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol,
1042  LPBYTE pbAtr, LPDWORD pcbAtrLen);
1043 
1044 typedef LONG(WINAPI* fnSCardTransmit)(SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci,
1045  LPCBYTE pbSendBuffer, DWORD cbSendLength,
1046  LPSCARD_IO_REQUEST pioRecvPci, LPBYTE pbRecvBuffer,
1047  LPDWORD pcbRecvLength);
1048 
1049 typedef LONG(WINAPI* fnSCardGetTransmitCount)(SCARDHANDLE hCard, LPDWORD pcTransmitCount);
1050 
1051 typedef LONG(WINAPI* fnSCardControl)(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID lpInBuffer,
1052  DWORD cbInBufferSize, LPVOID lpOutBuffer,
1053  DWORD cbOutBufferSize, LPDWORD lpBytesReturned);
1054 
1055 typedef LONG(WINAPI* fnSCardGetAttrib)(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
1056  LPDWORD pcbAttrLen);
1057 
1058 typedef LONG(WINAPI* fnSCardSetAttrib)(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr,
1059  DWORD cbAttrLen);
1060 
1061 typedef LONG(WINAPI* fnSCardUIDlgSelectCardA)(LPOPENCARDNAMEA_EX pDlgStruc);
1062 typedef LONG(WINAPI* fnSCardUIDlgSelectCardW)(LPOPENCARDNAMEW_EX pDlgStruc);
1063 
1064 typedef LONG(WINAPI* fnGetOpenCardNameA)(LPOPENCARDNAMEA pDlgStruc);
1065 typedef LONG(WINAPI* fnGetOpenCardNameW)(LPOPENCARDNAMEW pDlgStruc);
1066 
1067 typedef LONG(WINAPI* fnSCardDlgExtendedError)(void);
1068 
1069 typedef LONG(WINAPI* fnSCardReadCacheA)(SCARDCONTEXT hContext, UUID* CardIdentifier,
1070  DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
1071  DWORD* DataLen);
1072 typedef LONG(WINAPI* fnSCardReadCacheW)(SCARDCONTEXT hContext, UUID* CardIdentifier,
1073  DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
1074  DWORD* DataLen);
1075 
1076 typedef LONG(WINAPI* fnSCardWriteCacheA)(SCARDCONTEXT hContext, UUID* CardIdentifier,
1077  DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
1078  DWORD DataLen);
1079 typedef LONG(WINAPI* fnSCardWriteCacheW)(SCARDCONTEXT hContext, UUID* CardIdentifier,
1080  DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
1081  DWORD DataLen);
1082 
1083 typedef LONG(WINAPI* fnSCardGetReaderIconA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
1084  LPBYTE pbIcon, LPDWORD pcbIcon);
1085 typedef LONG(WINAPI* fnSCardGetReaderIconW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
1086  LPBYTE pbIcon, LPDWORD pcbIcon);
1087 
1088 typedef LONG(WINAPI* fnSCardGetDeviceTypeIdA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
1089  LPDWORD pdwDeviceTypeId);
1090 typedef LONG(WINAPI* fnSCardGetDeviceTypeIdW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
1091  LPDWORD pdwDeviceTypeId);
1092 
1093 typedef LONG(WINAPI* fnSCardGetReaderDeviceInstanceIdA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
1094  LPSTR szDeviceInstanceId,
1095  LPDWORD pcchDeviceInstanceId);
1096 typedef LONG(WINAPI* fnSCardGetReaderDeviceInstanceIdW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
1097  LPWSTR szDeviceInstanceId,
1098  LPDWORD pcchDeviceInstanceId);
1099 
1100 typedef LONG(WINAPI* fnSCardListReadersWithDeviceInstanceIdA)(SCARDCONTEXT hContext,
1101  LPCSTR szDeviceInstanceId,
1102  LPSTR mszReaders,
1103  LPDWORD pcchReaders);
1104 typedef LONG(WINAPI* fnSCardListReadersWithDeviceInstanceIdW)(SCARDCONTEXT hContext,
1105  LPCWSTR szDeviceInstanceId,
1106  LPWSTR mszReaders,
1107  LPDWORD pcchReaders);
1108 
1109 typedef LONG(WINAPI* fnSCardAudit)(SCARDCONTEXT hContext, DWORD dwEvent);
1110 
1111 typedef struct
1112 {
1113  DWORD dwVersion;
1114  DWORD dwFlags;
1115 
1116  fnSCardEstablishContext pfnSCardEstablishContext;
1117  fnSCardReleaseContext pfnSCardReleaseContext;
1118  fnSCardIsValidContext pfnSCardIsValidContext;
1119  fnSCardListReaderGroupsA pfnSCardListReaderGroupsA;
1120  fnSCardListReaderGroupsW pfnSCardListReaderGroupsW;
1121  fnSCardListReadersA pfnSCardListReadersA;
1122  fnSCardListReadersW pfnSCardListReadersW;
1123  fnSCardListCardsA pfnSCardListCardsA;
1124  fnSCardListCardsW pfnSCardListCardsW;
1125  fnSCardListInterfacesA pfnSCardListInterfacesA;
1126  fnSCardListInterfacesW pfnSCardListInterfacesW;
1127  fnSCardGetProviderIdA pfnSCardGetProviderIdA;
1128  fnSCardGetProviderIdW pfnSCardGetProviderIdW;
1129  fnSCardGetCardTypeProviderNameA pfnSCardGetCardTypeProviderNameA;
1130  fnSCardGetCardTypeProviderNameW pfnSCardGetCardTypeProviderNameW;
1131  fnSCardIntroduceReaderGroupA pfnSCardIntroduceReaderGroupA;
1132  fnSCardIntroduceReaderGroupW pfnSCardIntroduceReaderGroupW;
1133  fnSCardForgetReaderGroupA pfnSCardForgetReaderGroupA;
1134  fnSCardForgetReaderGroupW pfnSCardForgetReaderGroupW;
1135  fnSCardIntroduceReaderA pfnSCardIntroduceReaderA;
1136  fnSCardIntroduceReaderW pfnSCardIntroduceReaderW;
1137  fnSCardForgetReaderA pfnSCardForgetReaderA;
1138  fnSCardForgetReaderW pfnSCardForgetReaderW;
1139  fnSCardAddReaderToGroupA pfnSCardAddReaderToGroupA;
1140  fnSCardAddReaderToGroupW pfnSCardAddReaderToGroupW;
1141  fnSCardRemoveReaderFromGroupA pfnSCardRemoveReaderFromGroupA;
1142  fnSCardRemoveReaderFromGroupW pfnSCardRemoveReaderFromGroupW;
1143  fnSCardIntroduceCardTypeA pfnSCardIntroduceCardTypeA;
1144  fnSCardIntroduceCardTypeW pfnSCardIntroduceCardTypeW;
1145  fnSCardSetCardTypeProviderNameA pfnSCardSetCardTypeProviderNameA;
1146  fnSCardSetCardTypeProviderNameW pfnSCardSetCardTypeProviderNameW;
1147  fnSCardForgetCardTypeA pfnSCardForgetCardTypeA;
1148  fnSCardForgetCardTypeW pfnSCardForgetCardTypeW;
1149  fnSCardFreeMemory pfnSCardFreeMemory;
1150  fnSCardAccessStartedEvent pfnSCardAccessStartedEvent;
1151  fnSCardReleaseStartedEvent pfnSCardReleaseStartedEvent;
1152  fnSCardLocateCardsA pfnSCardLocateCardsA;
1153  fnSCardLocateCardsW pfnSCardLocateCardsW;
1154  fnSCardLocateCardsByATRA pfnSCardLocateCardsByATRA;
1155  fnSCardLocateCardsByATRW pfnSCardLocateCardsByATRW;
1156  fnSCardGetStatusChangeA pfnSCardGetStatusChangeA;
1157  fnSCardGetStatusChangeW pfnSCardGetStatusChangeW;
1158  fnSCardCancel pfnSCardCancel;
1159  fnSCardConnectA pfnSCardConnectA;
1160  fnSCardConnectW pfnSCardConnectW;
1161  fnSCardReconnect pfnSCardReconnect;
1162  fnSCardDisconnect pfnSCardDisconnect;
1163  fnSCardBeginTransaction pfnSCardBeginTransaction;
1164  fnSCardEndTransaction pfnSCardEndTransaction;
1165  fnSCardCancelTransaction pfnSCardCancelTransaction;
1166  fnSCardState pfnSCardState;
1167  fnSCardStatusA pfnSCardStatusA;
1168  fnSCardStatusW pfnSCardStatusW;
1169  fnSCardTransmit pfnSCardTransmit;
1170  fnSCardGetTransmitCount pfnSCardGetTransmitCount;
1171  fnSCardControl pfnSCardControl;
1172  fnSCardGetAttrib pfnSCardGetAttrib;
1173  fnSCardSetAttrib pfnSCardSetAttrib;
1174  fnSCardUIDlgSelectCardA pfnSCardUIDlgSelectCardA;
1175  fnSCardUIDlgSelectCardW pfnSCardUIDlgSelectCardW;
1176  fnGetOpenCardNameA pfnGetOpenCardNameA;
1177  fnGetOpenCardNameW pfnGetOpenCardNameW;
1178  fnSCardDlgExtendedError pfnSCardDlgExtendedError;
1179  fnSCardReadCacheA pfnSCardReadCacheA;
1180  fnSCardReadCacheW pfnSCardReadCacheW;
1181  fnSCardWriteCacheA pfnSCardWriteCacheA;
1182  fnSCardWriteCacheW pfnSCardWriteCacheW;
1183  fnSCardGetReaderIconA pfnSCardGetReaderIconA;
1184  fnSCardGetReaderIconW pfnSCardGetReaderIconW;
1185  fnSCardGetDeviceTypeIdA pfnSCardGetDeviceTypeIdA;
1186  fnSCardGetDeviceTypeIdW pfnSCardGetDeviceTypeIdW;
1187  fnSCardGetReaderDeviceInstanceIdA pfnSCardGetReaderDeviceInstanceIdA;
1188  fnSCardGetReaderDeviceInstanceIdW pfnSCardGetReaderDeviceInstanceIdW;
1189  fnSCardListReadersWithDeviceInstanceIdA pfnSCardListReadersWithDeviceInstanceIdA;
1190  fnSCardListReadersWithDeviceInstanceIdW pfnSCardListReadersWithDeviceInstanceIdW;
1191  fnSCardAudit pfnSCardAudit;
1194 
1195 #ifdef __cplusplus
1196 extern "C"
1197 {
1198 #endif
1199 
1200  WINSCARDAPI const char* WINAPI SCardGetErrorString(LONG errorCode);
1201  WINSCARDAPI const char* WINAPI SCardGetAttributeString(DWORD dwAttrId);
1202  WINSCARDAPI const char* WINAPI SCardGetProtocolString(DWORD dwProtocols);
1203  WINSCARDAPI const char* WINAPI SCardGetShareModeString(DWORD dwShareMode);
1204  WINSCARDAPI const char* WINAPI SCardGetDispositionString(DWORD dwDisposition);
1205  WINSCARDAPI const char* WINAPI SCardGetScopeString(DWORD dwScope);
1206  WINSCARDAPI const char* WINAPI SCardGetCardStateString(DWORD dwCardState);
1207  WINSCARDAPI char* WINAPI SCardGetReaderStateString(DWORD dwReaderState);
1208 
1209  WINPR_API BOOL WinSCard_LoadApiTableFunctions(PSCardApiFunctionTable pWinSCardApiTable,
1210  HMODULE hWinSCardLibrary);
1211  WINPR_API const SCardApiFunctionTable* WinPR_GetSCardApiFunctionTable(void);
1212 
1213 #ifdef __cplusplus
1214 }
1215 #endif
1216 
1217 #endif /* WINPR_SMARTCARD_H */