22 #ifndef WINPR_SMARTCARD_H
23 #define WINPR_SMARTCARD_H
25 #include <winpr/platform.h>
26 #include <winpr/winpr.h>
27 #include <winpr/wtypes.h>
30 #include <winpr/error.h>
32 WINPR_PRAGMA_DIAG_PUSH
33 WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
41 #ifndef SCARD_S_SUCCESS
43 #define SCARD_S_SUCCESS NO_ERROR
45 #define SCARD_F_INTERNAL_ERROR -2146435071l
46 #define SCARD_E_CANCELLED -2146435070l
47 #define SCARD_E_INVALID_HANDLE -2146435069l
48 #define SCARD_E_INVALID_PARAMETER -2146435068l
49 #define SCARD_E_INVALID_TARGET -2146435067l
50 #define SCARD_E_NO_MEMORY -2146435066l
51 #define SCARD_F_WAITED_TOO_LONG -2146435065l
52 #define SCARD_E_INSUFFICIENT_BUFFER -2146435064l
53 #define SCARD_E_UNKNOWN_READER -2146435063l
54 #define SCARD_E_TIMEOUT -2146435062l
55 #define SCARD_E_SHARING_VIOLATION -2146435061l
56 #define SCARD_E_NO_SMARTCARD -2146435060l
57 #define SCARD_E_UNKNOWN_CARD -2146435059l
58 #define SCARD_E_CANT_DISPOSE -2146435058l
59 #define SCARD_E_PROTO_MISMATCH -2146435057l
60 #define SCARD_E_NOT_READY -2146435056l
61 #define SCARD_E_INVALID_VALUE -2146435055l
62 #define SCARD_E_SYSTEM_CANCELLED -2146435054l
63 #define SCARD_F_COMM_ERROR -2146435053l
64 #define SCARD_F_UNKNOWN_ERROR -2146435052l
65 #define SCARD_E_INVALID_ATR -2146435051l
66 #define SCARD_E_NOT_TRANSACTED -2146435050l
67 #define SCARD_E_READER_UNAVAILABLE -2146435049l
68 #define SCARD_P_SHUTDOWN -2146435048l
69 #define SCARD_E_PCI_TOO_SMALL -2146435047l
70 #define SCARD_E_READER_UNSUPPORTED -2146435046l
71 #define SCARD_E_DUPLICATE_READER -2146435045l
72 #define SCARD_E_CARD_UNSUPPORTED -2146435044l
73 #define SCARD_E_NO_SERVICE -2146435043l
74 #define SCARD_E_SERVICE_STOPPED -2146435042l
75 #define SCARD_E_UNEXPECTED -2146435041l
76 #define SCARD_E_ICC_INSTALLATION -2146435040l
77 #define SCARD_E_ICC_CREATEORDER -2146435039l
78 #define SCARD_E_UNSUPPORTED_FEATURE -2146435038l
79 #define SCARD_E_DIR_NOT_FOUND -2146435037l
80 #define SCARD_E_FILE_NOT_FOUND -2146435036l
81 #define SCARD_E_NO_DIR -2146435035l
82 #define SCARD_E_NO_FILE -2146435034l
83 #define SCARD_E_NO_ACCESS -2146435033l
84 #define SCARD_E_WRITE_TOO_MANY -2146435032l
85 #define SCARD_E_BAD_SEEK -2146435031l
86 #define SCARD_E_INVALID_CHV -2146435030l
87 #define SCARD_E_UNKNOWN_RES_MNG -2146435029l
88 #define SCARD_E_NO_SUCH_CERTIFICATE -2146435028l
89 #define SCARD_E_CERTIFICATE_UNAVAILABLE -2146435027l
90 #define SCARD_E_NO_READERS_AVAILABLE -2146435026l
91 #define SCARD_E_COMM_DATA_LOST -2146435025l
92 #define SCARD_E_NO_KEY_CONTAINER -2146435024l
93 #define SCARD_E_SERVER_TOO_BUSY -2146435023l
94 #define SCARD_E_PIN_CACHE_EXPIRED -2146435022l
95 #define SCARD_E_NO_PIN_CACHE -2146435021l
96 #define SCARD_E_READ_ONLY_CARD -2146435020l
98 #define SCARD_W_UNSUPPORTED_CARD -2146434971l
99 #define SCARD_W_UNRESPONSIVE_CARD -2146434970l
100 #define SCARD_W_UNPOWERED_CARD -2146434969l
101 #define SCARD_W_RESET_CARD -2146434968l
102 #define SCARD_W_REMOVED_CARD -2146434967l
103 #define SCARD_W_SECURITY_VIOLATION -2146434966l
104 #define SCARD_W_WRONG_CHV -2146434965l
105 #define SCARD_W_CHV_BLOCKED -2146434964l
106 #define SCARD_W_EOF -2146434963l
107 #define SCARD_W_CANCELLED_BY_USER -2146434962l
108 #define SCARD_W_CARD_NOT_AUTHENTICATED -2146434961l
109 #define SCARD_W_CACHE_ITEM_NOT_FOUND -2146434960l
110 #define SCARD_W_CACHE_ITEM_STALE -2146434959l
111 #define SCARD_W_CACHE_ITEM_TOO_BIG -2146434958l
116 #ifndef SCARD_E_PIN_CACHE_EXPIRED
117 #define SCARD_E_PIN_CACHE_EXPIRED -2146435022l
120 #ifndef SCARD_E_NO_PIN_CACHE
121 #define SCARD_E_NO_PIN_CACHE -2146435021l
124 #ifndef SCARD_E_READ_ONLY_CARD
125 #define SCARD_E_READ_ONLY_CARD -2146435020l
128 #ifndef SCARD_W_CACHE_ITEM_TOO_BIG
129 #define SCARD_W_CACHE_ITEM_TOO_BIG -2146434958l
133 #define SCARD_ATR_LENGTH 33
135 #define SCARD_PROTOCOL_UNDEFINED 0x00000000u
136 #define SCARD_PROTOCOL_T0 0x00000001u
137 #define SCARD_PROTOCOL_T1 0x00000002u
138 #define SCARD_PROTOCOL_RAW 0x00010000u
140 #define SCARD_PROTOCOL_Tx (SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1)
141 #define SCARD_PROTOCOL_DEFAULT 0x80000000u
142 #define SCARD_PROTOCOL_OPTIMAL 0x00000000u
144 #define SCARD_POWER_DOWN 0
145 #define SCARD_COLD_RESET 1
146 #define SCARD_WARM_RESET 2
148 #define SCARD_CTL_CODE(code) \
149 CTL_CODE(FILE_DEVICE_SMARTCARD, (code), METHOD_BUFFERED, FILE_ANY_ACCESS)
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)
165 #define IOCTL_SMARTCARD_GET_FEATURE_REQUEST SCARD_CTL_CODE(3400)
167 #define MAXIMUM_ATTR_STRING_LENGTH 32
168 #define MAXIMUM_SMARTCARD_READERS 10
170 #define SCARD_ATTR_VALUE(Class, Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag)))
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
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)
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)
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)
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)
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)
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)
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
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
244 #define SCARD_T0_HEADER_LENGTH 7
245 #define SCARD_T0_CMD_LENGTH 5
247 #define SCARD_T1_PROLOGUE_LENGTH 3
248 #define SCARD_T1_EPILOGUE_LENGTH 2
249 #define SCARD_T1_MAX_IFS 254
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
259 #pragma pack(push, 1)
270 BYTE bCla, bIns, bP1, bP2, bP3;
292 #define SCARD_READER_SWALLOWS 0x00000001
293 #define SCARD_READER_EJECTS 0x00000002
294 #define SCARD_READER_CONFISCATES 0x00000004
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
309 #define WINSCARDAPI WINPR_API
312 typedef ULONG_PTR SCARDCONTEXT;
313 typedef SCARDCONTEXT *PSCARDCONTEXT, *LPSCARDCONTEXT;
315 typedef ULONG_PTR SCARDHANDLE;
316 typedef SCARDHANDLE *PSCARDHANDLE, *LPSCARDHANDLE;
318 #define SCARD_AUTOALLOCATE UINT32_MAX
320 #define SCARD_SCOPE_USER 0
321 #define SCARD_SCOPE_TERMINAL 1
322 #define SCARD_SCOPE_SYSTEM 2
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
337 #define SCARD_SHARE_EXCLUSIVE 1
338 #define SCARD_SHARE_SHARED 2
339 #define SCARD_SHARE_DIRECT 3
341 #define SCARD_LEAVE_CARD 0
342 #define SCARD_RESET_CARD 1
343 #define SCARD_UNPOWER_CARD 2
344 #define SCARD_EJECT_CARD 3
346 #define SC_DLG_MINIMAL_UI 0x01
347 #define SC_DLG_NO_UI 0x02
348 #define SC_DLG_FORCE_UI 0x04
350 #define SCERR_NOCARDNAME 0x4000
351 #define SCERR_NOGUIDS 0x8000
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);
358 typedef BOOL(WINAPI* LPOCNCHKPROC)(SCARDCONTEXT hSCardContext, SCARDHANDLE hCard, PVOID pvUserData);
359 typedef void(WINAPI* LPOCNDSCPROC)(SCARDCONTEXT hSCardContext, SCARDHANDLE hCard, PVOID pvUserData);
361 #define SCARD_READER_SEL_AUTH_PACKAGE ((DWORD)-629)
363 #define SCARD_AUDIT_CHV_FAILURE 0x0
364 #define SCARD_AUDIT_CHV_SUCCESS 0x1
366 #define SCardListCardTypes SCardListCards
368 #define PCSCardIntroduceCardType(hContext, szCardName, pbAtr, pbAtrMask, cbAtrLen, \
369 pguidPrimaryProvider, rgguidInterfaces, dwInterfaceCount) \
370 SCardIntroduceCardType(hContext, szCardName, pguidPrimaryProvider, rgguidInterfaces, \
371 dwInterfaceCount, pbAtr, pbAtrMask, cbAtrLen)
373 #define SCardGetReaderCapabilities SCardGetAttrib
374 #define SCardSetReaderCapabilities SCardSetAttrib
380 DWORD dwCurrentState;
390 DWORD dwCurrentState;
406 LPSTR lpstrGroupNames;
407 DWORD nMaxGroupNames;
408 LPCGUID rgguidInterfaces;
409 DWORD cguidInterfaces;
410 LPSTR lpstrCardNames;
412 LPOCNCHKPROC lpfnCheck;
413 LPOCNCONNPROCA lpfnConnect;
414 LPOCNDSCPROC lpfnDisconnect;
417 DWORD dwPreferredProtocols;
423 LPWSTR lpstrGroupNames;
424 DWORD nMaxGroupNames;
425 LPCGUID rgguidInterfaces;
426 DWORD cguidInterfaces;
427 LPWSTR lpstrCardNames;
429 LPOCNCHKPROC lpfnCheck;
430 LPOCNCONNPROCW lpfnConnect;
431 LPOCNDSCPROC lpfnDisconnect;
434 DWORD dwPreferredProtocols;
440 SCARDCONTEXT hSCardContext;
444 LPCSTR lpstrSearchDesc;
447 LPOCNCONNPROCA lpfnConnect;
450 DWORD dwPreferredProtocols;
455 DWORD dwActiveProtocol;
456 SCARDHANDLE hCardHandle;
462 SCARDCONTEXT hSCardContext;
466 LPCWSTR lpstrSearchDesc;
469 LPOCNCONNPROCW lpfnConnect;
472 DWORD dwPreferredProtocols;
477 DWORD dwActiveProtocol;
478 SCARDHANDLE hCardHandle;
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
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;
498 DWORD dwPreferredProtocols;
499 READER_SEL_REQUEST_MATCH_TYPE MatchType;
504 DWORD cbReaderNameOffset;
505 DWORD cchReaderNameLength;
506 DWORD cbContainerNameOffset;
507 DWORD cchContainerNameLength;
508 DWORD dwDesiredCardModuleVersion;
510 } ReaderAndContainerParameter;
513 DWORD cbSerialNumberOffset;
514 DWORD cbSerialNumberLength;
515 DWORD dwDesiredCardModuleVersion;
516 } SerialNumberParameter;
522 DWORD cbReaderNameOffset;
523 DWORD cchReaderNameLength;
524 DWORD cbCardNameOffset;
525 DWORD cchCardNameLength;
532 SCARDCONTEXT hSCardContext;
533 LPSTR lpstrGroupNames;
534 DWORD nMaxGroupNames;
535 LPSTR lpstrCardNames;
537 LPCGUID rgguidInterfaces;
538 DWORD cguidInterfaces;
547 DWORD dwPreferredProtocols;
548 DWORD dwActiveProtocol;
549 LPOCNCONNPROCA lpfnConnect;
550 LPOCNCHKPROC lpfnCheck;
551 LPOCNDSCPROC lpfnDisconnect;
552 SCARDHANDLE hCardHandle;
559 SCARDCONTEXT hSCardContext;
560 LPWSTR lpstrGroupNames;
561 DWORD nMaxGroupNames;
562 LPWSTR lpstrCardNames;
564 LPCGUID rgguidInterfaces;
565 DWORD cguidInterfaces;
574 DWORD dwPreferredProtocols;
575 DWORD dwActiveProtocol;
576 LPOCNCONNPROCW lpfnConnect;
577 LPOCNCHKPROC lpfnCheck;
578 LPOCNDSCPROC lpfnDisconnect;
579 SCARDHANDLE hCardHandle;
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
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
623 #define SCARD_PCI_T0 (&g_rgSCardT0Pci)
624 #define SCARD_PCI_T1 (&g_rgSCardT1Pci)
625 #define SCARD_PCI_RAW (&g_rgSCardRawPci)
627 WINSCARDAPI LONG WINAPI SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1,
628 LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
630 WINSCARDAPI LONG WINAPI SCardReleaseContext(SCARDCONTEXT hContext);
632 WINSCARDAPI LONG WINAPI SCardIsValidContext(SCARDCONTEXT hContext);
634 WINSCARDAPI LONG WINAPI SCardListReaderGroupsA(SCARDCONTEXT hContext, LPSTR mszGroups,
636 WINSCARDAPI LONG WINAPI SCardListReaderGroupsW(SCARDCONTEXT hContext, LPWSTR mszGroups,
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);
644 WINSCARDAPI LONG WINAPI SCardListCardsA(SCARDCONTEXT hContext, LPCBYTE pbAtr,
645 LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
646 CHAR* mszCards, LPDWORD pcchCards);
648 WINSCARDAPI LONG WINAPI SCardListCardsW(SCARDCONTEXT hContext, LPCBYTE pbAtr,
649 LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
650 WCHAR* mszCards, LPDWORD pcchCards);
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);
657 WINSCARDAPI LONG WINAPI SCardGetProviderIdA(SCARDCONTEXT hContext, LPCSTR szCard,
658 LPGUID pguidProviderId);
659 WINSCARDAPI LONG WINAPI SCardGetProviderIdW(SCARDCONTEXT hContext, LPCWSTR szCard,
660 LPGUID pguidProviderId);
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);
669 WINSCARDAPI LONG WINAPI SCardIntroduceReaderGroupA(SCARDCONTEXT hContext, LPCSTR szGroupName);
670 WINSCARDAPI LONG WINAPI SCardIntroduceReaderGroupW(SCARDCONTEXT hContext, LPCWSTR szGroupName);
672 WINSCARDAPI LONG WINAPI SCardForgetReaderGroupA(SCARDCONTEXT hContext, LPCSTR szGroupName);
673 WINSCARDAPI LONG WINAPI SCardForgetReaderGroupW(SCARDCONTEXT hContext, LPCWSTR szGroupName);
675 WINSCARDAPI LONG WINAPI SCardIntroduceReaderA(SCARDCONTEXT hContext, LPCSTR szReaderName,
676 LPCSTR szDeviceName);
677 WINSCARDAPI LONG WINAPI SCardIntroduceReaderW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
678 LPCWSTR szDeviceName);
680 WINSCARDAPI LONG WINAPI SCardForgetReaderA(SCARDCONTEXT hContext, LPCSTR szReaderName);
681 WINSCARDAPI LONG WINAPI SCardForgetReaderW(SCARDCONTEXT hContext, LPCWSTR szReaderName);
683 WINSCARDAPI LONG WINAPI SCardAddReaderToGroupA(SCARDCONTEXT hContext, LPCSTR szReaderName,
685 WINSCARDAPI LONG WINAPI SCardAddReaderToGroupW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
686 LPCWSTR szGroupName);
688 WINSCARDAPI LONG WINAPI SCardRemoveReaderFromGroupA(SCARDCONTEXT hContext, LPCSTR szReaderName,
690 WINSCARDAPI LONG WINAPI SCardRemoveReaderFromGroupW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
691 LPCWSTR szGroupName);
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);
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);
709 WINSCARDAPI LONG WINAPI SCardForgetCardTypeA(SCARDCONTEXT hContext, LPCSTR szCardName);
710 WINSCARDAPI LONG WINAPI SCardForgetCardTypeW(SCARDCONTEXT hContext, LPCWSTR szCardName);
712 WINSCARDAPI LONG WINAPI SCardFreeMemory(SCARDCONTEXT hContext, LPVOID pvMem);
714 WINSCARDAPI HANDLE WINAPI SCardAccessStartedEvent(
void);
716 WINSCARDAPI
void WINAPI SCardReleaseStartedEvent(
void);
718 WINSCARDAPI LONG WINAPI SCardLocateCardsA(SCARDCONTEXT hContext, LPCSTR mszCards,
720 WINSCARDAPI LONG WINAPI SCardLocateCardsW(SCARDCONTEXT hContext, LPCWSTR mszCards,
723 WINSCARDAPI LONG WINAPI SCardLocateCardsByATRA(SCARDCONTEXT hContext,
727 WINSCARDAPI LONG WINAPI SCardLocateCardsByATRW(SCARDCONTEXT hContext,
732 WINSCARDAPI LONG WINAPI SCardGetStatusChangeA(SCARDCONTEXT hContext, DWORD dwTimeout,
735 WINSCARDAPI LONG WINAPI SCardGetStatusChangeW(SCARDCONTEXT hContext, DWORD dwTimeout,
739 WINSCARDAPI LONG WINAPI SCardCancel(SCARDCONTEXT hContext);
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);
748 WINSCARDAPI LONG WINAPI SCardReconnect(SCARDHANDLE hCard, DWORD dwShareMode,
749 DWORD dwPreferredProtocols, DWORD dwInitialization,
750 LPDWORD pdwActiveProtocol);
752 WINSCARDAPI LONG WINAPI SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition);
754 WINSCARDAPI LONG WINAPI SCardBeginTransaction(SCARDHANDLE hCard);
756 WINSCARDAPI LONG WINAPI SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition);
758 WINSCARDAPI LONG WINAPI SCardCancelTransaction(SCARDHANDLE hCard);
760 WINSCARDAPI LONG WINAPI SCardState(SCARDHANDLE hCard, LPDWORD pdwState, LPDWORD pdwProtocol,
761 LPBYTE pbAtr, LPDWORD pcbAtrLen);
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);
771 LPCBYTE pbSendBuffer, DWORD cbSendLength,
773 LPDWORD pcbRecvLength);
775 WINSCARDAPI LONG WINAPI SCardGetTransmitCount(SCARDHANDLE hCard, LPDWORD pcTransmitCount);
777 WINSCARDAPI LONG WINAPI SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID lpInBuffer,
778 DWORD cbInBufferSize, LPVOID lpOutBuffer,
779 DWORD cbOutBufferSize, LPDWORD lpBytesReturned);
781 WINSCARDAPI LONG WINAPI SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
784 WINSCARDAPI LONG WINAPI SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr,
787 WINSCARDAPI LONG WINAPI SCardUIDlgSelectCardA(LPOPENCARDNAMEA_EX pDlgStruc);
788 WINSCARDAPI LONG WINAPI SCardUIDlgSelectCardW(LPOPENCARDNAMEW_EX pDlgStruc);
793 WINSCARDAPI LONG WINAPI SCardDlgExtendedError(
void);
795 WINSCARDAPI LONG WINAPI SCardReadCacheA(SCARDCONTEXT hContext,
UUID* CardIdentifier,
796 DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
798 WINSCARDAPI LONG WINAPI SCardReadCacheW(SCARDCONTEXT hContext,
UUID* CardIdentifier,
799 DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
802 WINSCARDAPI LONG WINAPI SCardWriteCacheA(SCARDCONTEXT hContext,
UUID* CardIdentifier,
803 DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
805 WINSCARDAPI LONG WINAPI SCardWriteCacheW(SCARDCONTEXT hContext,
UUID* CardIdentifier,
806 DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
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);
814 WINSCARDAPI LONG WINAPI SCardGetDeviceTypeIdA(SCARDCONTEXT hContext, LPCSTR szReaderName,
815 LPDWORD pdwDeviceTypeId);
816 WINSCARDAPI LONG WINAPI SCardGetDeviceTypeIdW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
817 LPDWORD pdwDeviceTypeId);
819 WINSCARDAPI LONG WINAPI SCardGetReaderDeviceInstanceIdA(SCARDCONTEXT hContext,
821 LPSTR szDeviceInstanceId,
822 LPDWORD pcchDeviceInstanceId);
823 WINSCARDAPI LONG WINAPI SCardGetReaderDeviceInstanceIdW(SCARDCONTEXT hContext,
824 LPCWSTR szReaderName,
825 LPWSTR szDeviceInstanceId,
826 LPDWORD pcchDeviceInstanceId);
828 WINSCARDAPI LONG WINAPI SCardListReadersWithDeviceInstanceIdA(SCARDCONTEXT hContext,
829 LPCSTR szDeviceInstanceId,
831 LPDWORD pcchReaders);
832 WINSCARDAPI LONG WINAPI SCardListReadersWithDeviceInstanceIdW(SCARDCONTEXT hContext,
833 LPCWSTR szDeviceInstanceId,
835 LPDWORD pcchReaders);
837 WINSCARDAPI LONG WINAPI SCardAudit(SCARDCONTEXT hContext, DWORD dwEvent);
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
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
907 typedef LONG(WINAPI* fnSCardEstablishContext)(DWORD dwScope, LPCVOID pvReserved1,
908 LPCVOID pvReserved2, LPSCARDCONTEXT phContext);
910 typedef LONG(WINAPI* fnSCardReleaseContext)(SCARDCONTEXT hContext);
912 typedef LONG(WINAPI* fnSCardIsValidContext)(SCARDCONTEXT hContext);
914 typedef LONG(WINAPI* fnSCardListReaderGroupsA)(SCARDCONTEXT hContext, LPSTR mszGroups,
916 typedef LONG(WINAPI* fnSCardListReaderGroupsW)(SCARDCONTEXT hContext, LPWSTR mszGroups,
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);
924 typedef LONG(WINAPI* fnSCardListCardsA)(SCARDCONTEXT hContext, LPCBYTE pbAtr,
925 LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
926 CHAR* mszCards, LPDWORD pcchCards);
928 typedef LONG(WINAPI* fnSCardListCardsW)(SCARDCONTEXT hContext, LPCBYTE pbAtr,
929 LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
930 WCHAR* mszCards, LPDWORD pcchCards);
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);
937 typedef LONG(WINAPI* fnSCardGetProviderIdA)(SCARDCONTEXT hContext, LPCSTR szCard,
938 LPGUID pguidProviderId);
939 typedef LONG(WINAPI* fnSCardGetProviderIdW)(SCARDCONTEXT hContext, LPCWSTR szCard,
940 LPGUID pguidProviderId);
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);
949 typedef LONG(WINAPI* fnSCardIntroduceReaderGroupA)(SCARDCONTEXT hContext, LPCSTR szGroupName);
950 typedef LONG(WINAPI* fnSCardIntroduceReaderGroupW)(SCARDCONTEXT hContext, LPCWSTR szGroupName);
952 typedef LONG(WINAPI* fnSCardForgetReaderGroupA)(SCARDCONTEXT hContext, LPCSTR szGroupName);
953 typedef LONG(WINAPI* fnSCardForgetReaderGroupW)(SCARDCONTEXT hContext, LPCWSTR szGroupName);
955 typedef LONG(WINAPI* fnSCardIntroduceReaderA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
956 LPCSTR szDeviceName);
957 typedef LONG(WINAPI* fnSCardIntroduceReaderW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
958 LPCWSTR szDeviceName);
960 typedef LONG(WINAPI* fnSCardForgetReaderA)(SCARDCONTEXT hContext, LPCSTR szReaderName);
961 typedef LONG(WINAPI* fnSCardForgetReaderW)(SCARDCONTEXT hContext, LPCWSTR szReaderName);
963 typedef LONG(WINAPI* fnSCardAddReaderToGroupA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
965 typedef LONG(WINAPI* fnSCardAddReaderToGroupW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
966 LPCWSTR szGroupName);
968 typedef LONG(WINAPI* fnSCardRemoveReaderFromGroupA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
970 typedef LONG(WINAPI* fnSCardRemoveReaderFromGroupW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
971 LPCWSTR szGroupName);
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);
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);
987 typedef LONG(WINAPI* fnSCardForgetCardTypeA)(SCARDCONTEXT hContext, LPCSTR szCardName);
988 typedef LONG(WINAPI* fnSCardForgetCardTypeW)(SCARDCONTEXT hContext, LPCWSTR szCardName);
990 typedef LONG(WINAPI* fnSCardFreeMemory)(SCARDCONTEXT hContext, LPVOID pvMem);
992 typedef HANDLE(WINAPI* fnSCardAccessStartedEvent)(void);
994 typedef void(WINAPI* fnSCardReleaseStartedEvent)(void);
996 typedef LONG(WINAPI* fnSCardLocateCardsA)(SCARDCONTEXT hContext, LPCSTR mszCards,
998 typedef LONG(WINAPI* fnSCardLocateCardsW)(SCARDCONTEXT hContext, LPCWSTR mszCards,
1001 typedef LONG(WINAPI* fnSCardLocateCardsByATRA)(SCARDCONTEXT hContext,
LPSCARD_ATRMASK rgAtrMasks,
1004 typedef LONG(WINAPI* fnSCardLocateCardsByATRW)(SCARDCONTEXT hContext,
LPSCARD_ATRMASK rgAtrMasks,
1008 typedef LONG(WINAPI* fnSCardGetStatusChangeA)(SCARDCONTEXT hContext, DWORD dwTimeout,
1010 typedef LONG(WINAPI* fnSCardGetStatusChangeW)(SCARDCONTEXT hContext, DWORD dwTimeout,
1013 typedef LONG(WINAPI* fnSCardCancel)(SCARDCONTEXT hContext);
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);
1022 typedef LONG(WINAPI* fnSCardReconnect)(SCARDHANDLE hCard, DWORD dwShareMode,
1023 DWORD dwPreferredProtocols, DWORD dwInitialization,
1024 LPDWORD pdwActiveProtocol);
1026 typedef LONG(WINAPI* fnSCardDisconnect)(SCARDHANDLE hCard, DWORD dwDisposition);
1028 typedef LONG(WINAPI* fnSCardBeginTransaction)(SCARDHANDLE hCard);
1030 typedef LONG(WINAPI* fnSCardEndTransaction)(SCARDHANDLE hCard, DWORD dwDisposition);
1032 typedef LONG(WINAPI* fnSCardCancelTransaction)(SCARDHANDLE hCard);
1034 typedef LONG(WINAPI* fnSCardState)(SCARDHANDLE hCard, LPDWORD pdwState, LPDWORD pdwProtocol,
1035 LPBYTE pbAtr, LPDWORD pcbAtrLen);
1037 typedef LONG(WINAPI* fnSCardStatusA)(SCARDHANDLE hCard, LPSTR mszReaderNames, LPDWORD pcchReaderLen,
1038 LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr,
1040 typedef LONG(WINAPI* fnSCardStatusW)(SCARDHANDLE hCard, LPWSTR mszReaderNames,
1041 LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol,
1042 LPBYTE pbAtr, LPDWORD pcbAtrLen);
1045 LPCBYTE pbSendBuffer, DWORD cbSendLength,
1047 LPDWORD pcbRecvLength);
1049 typedef LONG(WINAPI* fnSCardGetTransmitCount)(SCARDHANDLE hCard, LPDWORD pcTransmitCount);
1051 typedef LONG(WINAPI* fnSCardControl)(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID lpInBuffer,
1052 DWORD cbInBufferSize, LPVOID lpOutBuffer,
1053 DWORD cbOutBufferSize, LPDWORD lpBytesReturned);
1055 typedef LONG(WINAPI* fnSCardGetAttrib)(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
1056 LPDWORD pcbAttrLen);
1058 typedef LONG(WINAPI* fnSCardSetAttrib)(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr,
1061 typedef LONG(WINAPI* fnSCardUIDlgSelectCardA)(LPOPENCARDNAMEA_EX pDlgStruc);
1062 typedef LONG(WINAPI* fnSCardUIDlgSelectCardW)(LPOPENCARDNAMEW_EX pDlgStruc);
1067 typedef LONG(WINAPI* fnSCardDlgExtendedError)(void);
1069 typedef LONG(WINAPI* fnSCardReadCacheA)(SCARDCONTEXT hContext,
UUID* CardIdentifier,
1070 DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
1072 typedef LONG(WINAPI* fnSCardReadCacheW)(SCARDCONTEXT hContext,
UUID* CardIdentifier,
1073 DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
1076 typedef LONG(WINAPI* fnSCardWriteCacheA)(SCARDCONTEXT hContext,
UUID* CardIdentifier,
1077 DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
1079 typedef LONG(WINAPI* fnSCardWriteCacheW)(SCARDCONTEXT hContext,
UUID* CardIdentifier,
1080 DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
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);
1088 typedef LONG(WINAPI* fnSCardGetDeviceTypeIdA)(SCARDCONTEXT hContext, LPCSTR szReaderName,
1089 LPDWORD pdwDeviceTypeId);
1090 typedef LONG(WINAPI* fnSCardGetDeviceTypeIdW)(SCARDCONTEXT hContext, LPCWSTR szReaderName,
1091 LPDWORD pdwDeviceTypeId);
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);
1100 typedef LONG(WINAPI* fnSCardListReadersWithDeviceInstanceIdA)(SCARDCONTEXT hContext,
1101 LPCSTR szDeviceInstanceId,
1103 LPDWORD pcchReaders);
1104 typedef LONG(WINAPI* fnSCardListReadersWithDeviceInstanceIdW)(SCARDCONTEXT hContext,
1105 LPCWSTR szDeviceInstanceId,
1107 LPDWORD pcchReaders);
1109 typedef LONG(WINAPI* fnSCardAudit)(SCARDCONTEXT hContext, DWORD dwEvent);
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;
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);
1210 HMODULE hWinSCardLibrary);