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