22 #include <winpr/config.h>
24 #include <winpr/crt.h>
25 #include <winpr/library.h>
26 #include <winpr/smartcard.h>
27 #include <winpr/synch.h>
28 #include <winpr/wlog.h>
29 #include <winpr/assert.h>
33 #include "smartcard.h"
35 #if defined(WITH_SMARTCARD_INSPECT)
36 #include "smartcard_inspect.h"
39 static INIT_ONCE g_Initialized = INIT_ONCE_STATIC_INIT;
42 #define TAG WINPR_TAG("smartcard")
44 #define xstr(s) str(s)
47 #define SCARDAPI_STUB_CALL_LONG(_name, ...) \
48 InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, NULL, NULL); \
49 if (!g_SCardApi || !g_SCardApi->pfn##_name) \
51 WLog_DBG(TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
52 g_SCardApi, g_SCardApi ? g_SCardApi->pfn##_name : NULL); \
53 return SCARD_E_NO_SERVICE; \
55 return g_SCardApi->pfn##_name(__VA_ARGS__)
57 #define SCARDAPI_STUB_CALL_HANDLE(_name) \
58 InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, NULL, NULL); \
59 if (!g_SCardApi || !g_SCardApi->pfn##_name) \
61 WLog_DBG(TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
62 g_SCardApi, g_SCardApi ? g_SCardApi->pfn##_name : NULL); \
65 return g_SCardApi->pfn##_name()
67 #define SCARDAPI_STUB_CALL_VOID(_name) \
68 InitOnceExecuteOnce(&g_Initialized, InitializeSCardApiStubs, NULL, NULL); \
69 if (!g_SCardApi || !g_SCardApi->pfn##_name) \
71 WLog_DBG(TAG, "Missing function pointer g_SCardApi=%p->" xstr(pfn##_name) "=%p", \
72 g_SCardApi, g_SCardApi ? g_SCardApi->pfn##_name : NULL); \
75 g_SCardApi->pfn##_name()
85 static BOOL CALLBACK InitializeSCardApiStubs(
PINIT_ONCE once, PVOID param, PVOID* context)
88 if (Windows_InitializeSCardApi() >= 0)
89 g_SCardApi = Windows_GetSCardApiFunctionTable();
91 #if defined(WITH_SMARTCARD_PCSC)
92 if (PCSC_InitializeSCardApi() >= 0)
93 g_SCardApi = PCSC_GetSCardApiFunctionTable();
97 #if defined(WITH_SMARTCARD_INSPECT)
98 g_SCardApi = Inspect_RegisterSCardApi(g_SCardApi);
103 WINSCARDAPI LONG WINAPI SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1,
104 LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
106 SCARDAPI_STUB_CALL_LONG(SCardEstablishContext, dwScope, pvReserved1, pvReserved2, phContext);
109 WINSCARDAPI LONG WINAPI SCardReleaseContext(SCARDCONTEXT hContext)
111 SCARDAPI_STUB_CALL_LONG(SCardReleaseContext, hContext);
114 WINSCARDAPI LONG WINAPI SCardIsValidContext(SCARDCONTEXT hContext)
116 SCARDAPI_STUB_CALL_LONG(SCardIsValidContext, hContext);
119 WINSCARDAPI LONG WINAPI SCardListReaderGroupsA(SCARDCONTEXT hContext, LPSTR mszGroups,
122 SCARDAPI_STUB_CALL_LONG(SCardListReaderGroupsA, hContext, mszGroups, pcchGroups);
125 WINSCARDAPI LONG WINAPI SCardListReaderGroupsW(SCARDCONTEXT hContext, LPWSTR mszGroups,
128 SCARDAPI_STUB_CALL_LONG(SCardListReaderGroupsW, hContext, mszGroups, pcchGroups);
131 WINSCARDAPI LONG WINAPI SCardListReadersA(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders,
134 SCARDAPI_STUB_CALL_LONG(SCardListReadersA, hContext, mszGroups, mszReaders, pcchReaders);
137 WINSCARDAPI LONG WINAPI SCardListReadersW(SCARDCONTEXT hContext, LPCWSTR mszGroups,
138 LPWSTR mszReaders, LPDWORD pcchReaders)
140 SCARDAPI_STUB_CALL_LONG(SCardListReadersW, hContext, mszGroups, mszReaders, pcchReaders);
143 WINSCARDAPI LONG WINAPI SCardListCardsA(SCARDCONTEXT hContext, LPCBYTE pbAtr,
144 LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
145 CHAR* mszCards, LPDWORD pcchCards)
147 SCARDAPI_STUB_CALL_LONG(SCardListCardsA, hContext, pbAtr, rgquidInterfaces, cguidInterfaceCount,
148 mszCards, pcchCards);
151 WINSCARDAPI LONG WINAPI SCardListCardsW(SCARDCONTEXT hContext, LPCBYTE pbAtr,
152 LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount,
153 WCHAR* mszCards, LPDWORD pcchCards)
155 SCARDAPI_STUB_CALL_LONG(SCardListCardsW, hContext, pbAtr, rgquidInterfaces, cguidInterfaceCount,
156 mszCards, pcchCards);
159 WINSCARDAPI LONG WINAPI SCardListInterfacesA(SCARDCONTEXT hContext, LPCSTR szCard,
160 LPGUID pguidInterfaces, LPDWORD pcguidInterfaces)
162 SCARDAPI_STUB_CALL_LONG(SCardListInterfacesA, hContext, szCard, pguidInterfaces,
166 WINSCARDAPI LONG WINAPI SCardListInterfacesW(SCARDCONTEXT hContext, LPCWSTR szCard,
167 LPGUID pguidInterfaces, LPDWORD pcguidInterfaces)
169 SCARDAPI_STUB_CALL_LONG(SCardListInterfacesW, hContext, szCard, pguidInterfaces,
173 WINSCARDAPI LONG WINAPI SCardGetProviderIdA(SCARDCONTEXT hContext, LPCSTR szCard,
174 LPGUID pguidProviderId)
176 SCARDAPI_STUB_CALL_LONG(SCardGetProviderIdA, hContext, szCard, pguidProviderId);
179 WINSCARDAPI LONG WINAPI SCardGetProviderIdW(SCARDCONTEXT hContext, LPCWSTR szCard,
180 LPGUID pguidProviderId)
182 SCARDAPI_STUB_CALL_LONG(SCardGetProviderIdW, hContext, szCard, pguidProviderId);
185 WINSCARDAPI LONG WINAPI SCardGetCardTypeProviderNameA(SCARDCONTEXT hContext, LPCSTR szCardName,
186 DWORD dwProviderId, CHAR* szProvider,
187 LPDWORD pcchProvider)
189 SCARDAPI_STUB_CALL_LONG(SCardGetCardTypeProviderNameA, hContext, szCardName, dwProviderId,
190 szProvider, pcchProvider);
193 WINSCARDAPI LONG WINAPI SCardGetCardTypeProviderNameW(SCARDCONTEXT hContext, LPCWSTR szCardName,
194 DWORD dwProviderId, WCHAR* szProvider,
195 LPDWORD pcchProvider)
197 SCARDAPI_STUB_CALL_LONG(SCardGetCardTypeProviderNameW, hContext, szCardName, dwProviderId,
198 szProvider, pcchProvider);
201 WINSCARDAPI LONG WINAPI SCardIntroduceReaderGroupA(SCARDCONTEXT hContext, LPCSTR szGroupName)
203 SCARDAPI_STUB_CALL_LONG(SCardIntroduceReaderGroupA, hContext, szGroupName);
206 WINSCARDAPI LONG WINAPI SCardIntroduceReaderGroupW(SCARDCONTEXT hContext, LPCWSTR szGroupName)
208 SCARDAPI_STUB_CALL_LONG(SCardIntroduceReaderGroupW, hContext, szGroupName);
211 WINSCARDAPI LONG WINAPI SCardForgetReaderGroupA(SCARDCONTEXT hContext, LPCSTR szGroupName)
213 SCARDAPI_STUB_CALL_LONG(SCardForgetReaderGroupA, hContext, szGroupName);
216 WINSCARDAPI LONG WINAPI SCardForgetReaderGroupW(SCARDCONTEXT hContext, LPCWSTR szGroupName)
218 SCARDAPI_STUB_CALL_LONG(SCardForgetReaderGroupW, hContext, szGroupName);
221 WINSCARDAPI LONG WINAPI SCardIntroduceReaderA(SCARDCONTEXT hContext, LPCSTR szReaderName,
224 SCARDAPI_STUB_CALL_LONG(SCardIntroduceReaderA, hContext, szReaderName, szDeviceName);
227 WINSCARDAPI LONG WINAPI SCardIntroduceReaderW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
228 LPCWSTR szDeviceName)
230 SCARDAPI_STUB_CALL_LONG(SCardIntroduceReaderW, hContext, szReaderName, szDeviceName);
233 WINSCARDAPI LONG WINAPI SCardForgetReaderA(SCARDCONTEXT hContext, LPCSTR szReaderName)
235 SCARDAPI_STUB_CALL_LONG(SCardForgetReaderA, hContext, szReaderName);
238 WINSCARDAPI LONG WINAPI SCardForgetReaderW(SCARDCONTEXT hContext, LPCWSTR szReaderName)
240 SCARDAPI_STUB_CALL_LONG(SCardForgetReaderW, hContext, szReaderName);
243 WINSCARDAPI LONG WINAPI SCardAddReaderToGroupA(SCARDCONTEXT hContext, LPCSTR szReaderName,
246 SCARDAPI_STUB_CALL_LONG(SCardAddReaderToGroupA, hContext, szReaderName, szGroupName);
249 WINSCARDAPI LONG WINAPI SCardAddReaderToGroupW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
252 SCARDAPI_STUB_CALL_LONG(SCardAddReaderToGroupW, hContext, szReaderName, szGroupName);
255 WINSCARDAPI LONG WINAPI SCardRemoveReaderFromGroupA(SCARDCONTEXT hContext, LPCSTR szReaderName,
258 SCARDAPI_STUB_CALL_LONG(SCardRemoveReaderFromGroupA, hContext, szReaderName, szGroupName);
261 WINSCARDAPI LONG WINAPI SCardRemoveReaderFromGroupW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
264 SCARDAPI_STUB_CALL_LONG(SCardRemoveReaderFromGroupW, hContext, szReaderName, szGroupName);
267 WINSCARDAPI LONG WINAPI SCardIntroduceCardTypeA(SCARDCONTEXT hContext, LPCSTR szCardName,
268 LPCGUID pguidPrimaryProvider,
269 LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
270 LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen)
272 SCARDAPI_STUB_CALL_LONG(SCardIntroduceCardTypeA, hContext, szCardName, pguidPrimaryProvider,
273 rgguidInterfaces, dwInterfaceCount, pbAtr, pbAtrMask, cbAtrLen);
276 WINSCARDAPI LONG WINAPI SCardIntroduceCardTypeW(SCARDCONTEXT hContext, LPCWSTR szCardName,
277 LPCGUID pguidPrimaryProvider,
278 LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
279 LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen)
281 SCARDAPI_STUB_CALL_LONG(SCardIntroduceCardTypeW, hContext, szCardName, pguidPrimaryProvider,
282 rgguidInterfaces, dwInterfaceCount, pbAtr, pbAtrMask, cbAtrLen);
285 WINSCARDAPI LONG WINAPI SCardSetCardTypeProviderNameA(SCARDCONTEXT hContext, LPCSTR szCardName,
286 DWORD dwProviderId, LPCSTR szProvider)
288 SCARDAPI_STUB_CALL_LONG(SCardSetCardTypeProviderNameA, hContext, szCardName, dwProviderId,
292 WINSCARDAPI LONG WINAPI SCardSetCardTypeProviderNameW(SCARDCONTEXT hContext, LPCWSTR szCardName,
293 DWORD dwProviderId, LPCWSTR szProvider)
295 SCARDAPI_STUB_CALL_LONG(SCardSetCardTypeProviderNameW, hContext, szCardName, dwProviderId,
299 WINSCARDAPI LONG WINAPI SCardForgetCardTypeA(SCARDCONTEXT hContext, LPCSTR szCardName)
301 SCARDAPI_STUB_CALL_LONG(SCardForgetCardTypeA, hContext, szCardName);
304 WINSCARDAPI LONG WINAPI SCardForgetCardTypeW(SCARDCONTEXT hContext, LPCWSTR szCardName)
306 SCARDAPI_STUB_CALL_LONG(SCardForgetCardTypeW, hContext, szCardName);
309 WINSCARDAPI LONG WINAPI SCardFreeMemory(SCARDCONTEXT hContext, LPVOID pvMem)
311 SCARDAPI_STUB_CALL_LONG(SCardFreeMemory, hContext, pvMem);
314 WINSCARDAPI HANDLE WINAPI SCardAccessStartedEvent(
void)
316 SCARDAPI_STUB_CALL_HANDLE(SCardAccessStartedEvent);
319 WINSCARDAPI
void WINAPI SCardReleaseStartedEvent(
void)
321 SCARDAPI_STUB_CALL_VOID(SCardReleaseStartedEvent);
324 WINSCARDAPI LONG WINAPI SCardLocateCardsA(SCARDCONTEXT hContext, LPCSTR mszCards,
327 SCARDAPI_STUB_CALL_LONG(SCardLocateCardsA, hContext, mszCards, rgReaderStates, cReaders);
330 WINSCARDAPI LONG WINAPI SCardLocateCardsW(SCARDCONTEXT hContext, LPCWSTR mszCards,
333 SCARDAPI_STUB_CALL_LONG(SCardLocateCardsW, hContext, mszCards, rgReaderStates, cReaders);
336 WINSCARDAPI LONG WINAPI SCardLocateCardsByATRA(SCARDCONTEXT hContext,
LPSCARD_ATRMASK rgAtrMasks,
340 SCARDAPI_STUB_CALL_LONG(SCardLocateCardsByATRA, hContext, rgAtrMasks, cAtrs, rgReaderStates,
344 WINSCARDAPI LONG WINAPI SCardLocateCardsByATRW(SCARDCONTEXT hContext,
LPSCARD_ATRMASK rgAtrMasks,
348 SCARDAPI_STUB_CALL_LONG(SCardLocateCardsByATRW, hContext, rgAtrMasks, cAtrs, rgReaderStates,
352 WINSCARDAPI LONG WINAPI SCardGetStatusChangeA(SCARDCONTEXT hContext, DWORD dwTimeout,
355 SCARDAPI_STUB_CALL_LONG(SCardGetStatusChangeA, hContext, dwTimeout, rgReaderStates, cReaders);
358 WINSCARDAPI LONG WINAPI SCardGetStatusChangeW(SCARDCONTEXT hContext, DWORD dwTimeout,
361 SCARDAPI_STUB_CALL_LONG(SCardGetStatusChangeW, hContext, dwTimeout, rgReaderStates, cReaders);
364 WINSCARDAPI LONG WINAPI SCardCancel(SCARDCONTEXT hContext)
366 SCARDAPI_STUB_CALL_LONG(SCardCancel, hContext);
369 WINSCARDAPI LONG WINAPI SCardConnectA(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode,
370 DWORD dwPreferredProtocols, LPSCARDHANDLE phCard,
371 LPDWORD pdwActiveProtocol)
373 SCARDAPI_STUB_CALL_LONG(SCardConnectA, hContext, szReader, dwShareMode, dwPreferredProtocols,
374 phCard, pdwActiveProtocol);
377 WINSCARDAPI LONG WINAPI SCardConnectW(SCARDCONTEXT hContext, LPCWSTR szReader, DWORD dwShareMode,
378 DWORD dwPreferredProtocols, LPSCARDHANDLE phCard,
379 LPDWORD pdwActiveProtocol)
381 SCARDAPI_STUB_CALL_LONG(SCardConnectW, hContext, szReader, dwShareMode, dwPreferredProtocols,
382 phCard, pdwActiveProtocol);
385 WINSCARDAPI LONG WINAPI SCardReconnect(SCARDHANDLE hCard, DWORD dwShareMode,
386 DWORD dwPreferredProtocols, DWORD dwInitialization,
387 LPDWORD pdwActiveProtocol)
389 SCARDAPI_STUB_CALL_LONG(SCardReconnect, hCard, dwShareMode, dwPreferredProtocols,
390 dwInitialization, pdwActiveProtocol);
393 WINSCARDAPI LONG WINAPI SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition)
395 SCARDAPI_STUB_CALL_LONG(SCardDisconnect, hCard, dwDisposition);
398 WINSCARDAPI LONG WINAPI SCardBeginTransaction(SCARDHANDLE hCard)
400 SCARDAPI_STUB_CALL_LONG(SCardBeginTransaction, hCard);
403 WINSCARDAPI LONG WINAPI SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition)
405 SCARDAPI_STUB_CALL_LONG(SCardEndTransaction, hCard, dwDisposition);
408 WINSCARDAPI LONG WINAPI SCardCancelTransaction(SCARDHANDLE hCard)
410 SCARDAPI_STUB_CALL_LONG(SCardCancelTransaction, hCard);
413 WINSCARDAPI LONG WINAPI SCardState(SCARDHANDLE hCard, LPDWORD pdwState, LPDWORD pdwProtocol,
414 LPBYTE pbAtr, LPDWORD pcbAtrLen)
416 SCARDAPI_STUB_CALL_LONG(SCardState, hCard, pdwState, pdwProtocol, pbAtr, pcbAtrLen);
419 WINSCARDAPI LONG WINAPI SCardStatusA(SCARDHANDLE hCard, LPSTR mszReaderNames, LPDWORD pcchReaderLen,
420 LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr,
423 SCARDAPI_STUB_CALL_LONG(SCardStatusA, hCard, mszReaderNames, pcchReaderLen, pdwState,
424 pdwProtocol, pbAtr, pcbAtrLen);
427 WINSCARDAPI LONG WINAPI SCardStatusW(SCARDHANDLE hCard, LPWSTR mszReaderNames,
428 LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol,
429 LPBYTE pbAtr, LPDWORD pcbAtrLen)
431 SCARDAPI_STUB_CALL_LONG(SCardStatusW, hCard, mszReaderNames, pcchReaderLen, pdwState,
432 pdwProtocol, pbAtr, pcbAtrLen);
436 LPCBYTE pbSendBuffer, DWORD cbSendLength,
438 LPDWORD pcbRecvLength)
440 SCARDAPI_STUB_CALL_LONG(SCardTransmit, hCard, pioSendPci, pbSendBuffer, cbSendLength,
441 pioRecvPci, pbRecvBuffer, pcbRecvLength);
444 WINSCARDAPI LONG WINAPI SCardGetTransmitCount(SCARDHANDLE hCard, LPDWORD pcTransmitCount)
446 SCARDAPI_STUB_CALL_LONG(SCardGetTransmitCount, hCard, pcTransmitCount);
449 WINSCARDAPI LONG WINAPI SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID lpInBuffer,
450 DWORD cbInBufferSize, LPVOID lpOutBuffer,
451 DWORD cbOutBufferSize, LPDWORD lpBytesReturned)
453 SCARDAPI_STUB_CALL_LONG(SCardControl, hCard, dwControlCode, lpInBuffer, cbInBufferSize,
454 lpOutBuffer, cbOutBufferSize, lpBytesReturned);
457 WINSCARDAPI LONG WINAPI SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
460 SCARDAPI_STUB_CALL_LONG(SCardGetAttrib, hCard, dwAttrId, pbAttr, pcbAttrLen);
463 WINSCARDAPI LONG WINAPI SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr,
466 SCARDAPI_STUB_CALL_LONG(SCardSetAttrib, hCard, dwAttrId, pbAttr, cbAttrLen);
469 WINSCARDAPI LONG WINAPI SCardUIDlgSelectCardA(LPOPENCARDNAMEA_EX pDlgStruc)
471 SCARDAPI_STUB_CALL_LONG(SCardUIDlgSelectCardA, pDlgStruc);
474 WINSCARDAPI LONG WINAPI SCardUIDlgSelectCardW(LPOPENCARDNAMEW_EX pDlgStruc)
476 SCARDAPI_STUB_CALL_LONG(SCardUIDlgSelectCardW, pDlgStruc);
481 SCARDAPI_STUB_CALL_LONG(GetOpenCardNameA, pDlgStruc);
486 SCARDAPI_STUB_CALL_LONG(GetOpenCardNameW, pDlgStruc);
489 WINSCARDAPI LONG WINAPI SCardDlgExtendedError(
void)
491 SCARDAPI_STUB_CALL_LONG(SCardDlgExtendedError);
494 WINSCARDAPI LONG WINAPI SCardReadCacheA(SCARDCONTEXT hContext, UUID* CardIdentifier,
495 DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
498 SCARDAPI_STUB_CALL_LONG(SCardReadCacheA, hContext, CardIdentifier, FreshnessCounter, LookupName,
502 WINSCARDAPI LONG WINAPI SCardReadCacheW(SCARDCONTEXT hContext, UUID* CardIdentifier,
503 DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
506 SCARDAPI_STUB_CALL_LONG(SCardReadCacheW, hContext, CardIdentifier, FreshnessCounter, LookupName,
510 WINSCARDAPI LONG WINAPI SCardWriteCacheA(SCARDCONTEXT hContext, UUID* CardIdentifier,
511 DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data,
514 SCARDAPI_STUB_CALL_LONG(SCardWriteCacheA, hContext, CardIdentifier, FreshnessCounter,
515 LookupName, Data, DataLen);
518 WINSCARDAPI LONG WINAPI SCardWriteCacheW(SCARDCONTEXT hContext, UUID* CardIdentifier,
519 DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data,
522 SCARDAPI_STUB_CALL_LONG(SCardWriteCacheW, hContext, CardIdentifier, FreshnessCounter,
523 LookupName, Data, DataLen);
526 WINSCARDAPI LONG WINAPI SCardGetReaderIconA(SCARDCONTEXT hContext, LPCSTR szReaderName,
527 LPBYTE pbIcon, LPDWORD pcbIcon)
529 SCARDAPI_STUB_CALL_LONG(SCardGetReaderIconA, hContext, szReaderName, pbIcon, pcbIcon);
532 WINSCARDAPI LONG WINAPI SCardGetReaderIconW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
533 LPBYTE pbIcon, LPDWORD pcbIcon)
535 SCARDAPI_STUB_CALL_LONG(SCardGetReaderIconW, hContext, szReaderName, pbIcon, pcbIcon);
538 WINSCARDAPI LONG WINAPI SCardGetDeviceTypeIdA(SCARDCONTEXT hContext, LPCSTR szReaderName,
539 LPDWORD pdwDeviceTypeId)
541 SCARDAPI_STUB_CALL_LONG(SCardGetDeviceTypeIdA, hContext, szReaderName, pdwDeviceTypeId);
544 WINSCARDAPI LONG WINAPI SCardGetDeviceTypeIdW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
545 LPDWORD pdwDeviceTypeId)
547 SCARDAPI_STUB_CALL_LONG(SCardGetDeviceTypeIdW, hContext, szReaderName, pdwDeviceTypeId);
550 WINSCARDAPI LONG WINAPI SCardGetReaderDeviceInstanceIdA(SCARDCONTEXT hContext, LPCSTR szReaderName,
551 LPSTR szDeviceInstanceId,
552 LPDWORD pcchDeviceInstanceId)
554 SCARDAPI_STUB_CALL_LONG(SCardGetReaderDeviceInstanceIdA, hContext, szReaderName,
555 szDeviceInstanceId, pcchDeviceInstanceId);
558 WINSCARDAPI LONG WINAPI SCardGetReaderDeviceInstanceIdW(SCARDCONTEXT hContext, LPCWSTR szReaderName,
559 LPWSTR szDeviceInstanceId,
560 LPDWORD pcchDeviceInstanceId)
562 SCARDAPI_STUB_CALL_LONG(SCardGetReaderDeviceInstanceIdW, hContext, szReaderName,
563 szDeviceInstanceId, pcchDeviceInstanceId);
566 WINSCARDAPI LONG WINAPI SCardListReadersWithDeviceInstanceIdA(SCARDCONTEXT hContext,
567 LPCSTR szDeviceInstanceId,
568 LPSTR mszReaders, LPDWORD pcchReaders)
570 SCARDAPI_STUB_CALL_LONG(SCardListReadersWithDeviceInstanceIdA, hContext, szDeviceInstanceId,
571 mszReaders, pcchReaders);
574 WINSCARDAPI LONG WINAPI SCardListReadersWithDeviceInstanceIdW(SCARDCONTEXT hContext,
575 LPCWSTR szDeviceInstanceId,
579 SCARDAPI_STUB_CALL_LONG(SCardListReadersWithDeviceInstanceIdW, hContext, szDeviceInstanceId,
580 mszReaders, pcchReaders);
583 WINSCARDAPI LONG WINAPI SCardAudit(SCARDCONTEXT hContext, DWORD dwEvent)
585 SCARDAPI_STUB_CALL_LONG(SCardAudit, hContext, dwEvent);
592 WINSCARDAPI
const char* WINAPI SCardGetErrorString(LONG errorCode)
596 case SCARD_S_SUCCESS:
597 return "SCARD_S_SUCCESS";
599 case SCARD_F_INTERNAL_ERROR:
600 return "SCARD_F_INTERNAL_ERROR";
602 case SCARD_E_CANCELLED:
603 return "SCARD_E_CANCELLED";
605 case SCARD_E_INVALID_HANDLE:
606 return "SCARD_E_INVALID_HANDLE";
608 case SCARD_E_INVALID_PARAMETER:
609 return "SCARD_E_INVALID_PARAMETER";
611 case SCARD_E_INVALID_TARGET:
612 return "SCARD_E_INVALID_TARGET";
614 case SCARD_E_NO_MEMORY:
615 return "SCARD_E_NO_MEMORY";
617 case SCARD_F_WAITED_TOO_LONG:
618 return "SCARD_F_WAITED_TOO_LONG";
620 case SCARD_E_INSUFFICIENT_BUFFER:
621 return "SCARD_E_INSUFFICIENT_BUFFER";
623 case SCARD_E_UNKNOWN_READER:
624 return "SCARD_E_UNKNOWN_READER";
626 case SCARD_E_TIMEOUT:
627 return "SCARD_E_TIMEOUT";
629 case SCARD_E_SHARING_VIOLATION:
630 return "SCARD_E_SHARING_VIOLATION";
632 case SCARD_E_NO_SMARTCARD:
633 return "SCARD_E_NO_SMARTCARD";
635 case SCARD_E_UNKNOWN_CARD:
636 return "SCARD_E_UNKNOWN_CARD";
638 case SCARD_E_CANT_DISPOSE:
639 return "SCARD_E_CANT_DISPOSE";
641 case SCARD_E_PROTO_MISMATCH:
642 return "SCARD_E_PROTO_MISMATCH";
644 case SCARD_E_NOT_READY:
645 return "SCARD_E_NOT_READY";
647 case SCARD_E_INVALID_VALUE:
648 return "SCARD_E_INVALID_VALUE";
650 case SCARD_E_SYSTEM_CANCELLED:
651 return "SCARD_E_SYSTEM_CANCELLED";
653 case SCARD_F_COMM_ERROR:
654 return "SCARD_F_COMM_ERROR";
656 case SCARD_F_UNKNOWN_ERROR:
657 return "SCARD_F_UNKNOWN_ERROR";
659 case SCARD_E_INVALID_ATR:
660 return "SCARD_E_INVALID_ATR";
662 case SCARD_E_NOT_TRANSACTED:
663 return "SCARD_E_NOT_TRANSACTED";
665 case SCARD_E_READER_UNAVAILABLE:
666 return "SCARD_E_READER_UNAVAILABLE";
668 case SCARD_P_SHUTDOWN:
669 return "SCARD_P_SHUTDOWN";
671 case SCARD_E_PCI_TOO_SMALL:
672 return "SCARD_E_PCI_TOO_SMALL";
674 case SCARD_E_READER_UNSUPPORTED:
675 return "SCARD_E_READER_UNSUPPORTED";
677 case SCARD_E_DUPLICATE_READER:
678 return "SCARD_E_DUPLICATE_READER";
680 case SCARD_E_CARD_UNSUPPORTED:
681 return "SCARD_E_CARD_UNSUPPORTED";
683 case SCARD_E_NO_SERVICE:
684 return "SCARD_E_NO_SERVICE";
686 case SCARD_E_SERVICE_STOPPED:
687 return "SCARD_E_SERVICE_STOPPED";
689 case SCARD_E_UNEXPECTED:
690 return "SCARD_E_UNEXPECTED";
692 case SCARD_E_ICC_INSTALLATION:
693 return "SCARD_E_ICC_INSTALLATION";
695 case SCARD_E_ICC_CREATEORDER:
696 return "SCARD_E_ICC_CREATEORDER";
698 case SCARD_E_UNSUPPORTED_FEATURE:
699 return "SCARD_E_UNSUPPORTED_FEATURE";
701 case SCARD_E_DIR_NOT_FOUND:
702 return "SCARD_E_DIR_NOT_FOUND";
704 case SCARD_E_FILE_NOT_FOUND:
705 return "SCARD_E_FILE_NOT_FOUND";
708 return "SCARD_E_NO_DIR";
710 case SCARD_E_NO_FILE:
711 return "SCARD_E_NO_FILE";
713 case SCARD_E_NO_ACCESS:
714 return "SCARD_E_NO_ACCESS";
716 case SCARD_E_WRITE_TOO_MANY:
717 return "SCARD_E_WRITE_TOO_MANY";
719 case SCARD_E_BAD_SEEK:
720 return "SCARD_E_BAD_SEEK";
722 case SCARD_E_INVALID_CHV:
723 return "SCARD_E_INVALID_CHV";
725 case SCARD_E_UNKNOWN_RES_MNG:
726 return "SCARD_E_UNKNOWN_RES_MNG";
728 case SCARD_E_NO_SUCH_CERTIFICATE:
729 return "SCARD_E_NO_SUCH_CERTIFICATE";
731 case SCARD_E_CERTIFICATE_UNAVAILABLE:
732 return "SCARD_E_CERTIFICATE_UNAVAILABLE";
734 case SCARD_E_NO_READERS_AVAILABLE:
735 return "SCARD_E_NO_READERS_AVAILABLE";
737 case SCARD_E_COMM_DATA_LOST:
738 return "SCARD_E_COMM_DATA_LOST";
740 case SCARD_E_NO_KEY_CONTAINER:
741 return "SCARD_E_NO_KEY_CONTAINER";
743 case SCARD_E_SERVER_TOO_BUSY:
744 return "SCARD_E_SERVER_TOO_BUSY";
746 case SCARD_E_PIN_CACHE_EXPIRED:
747 return "SCARD_E_PIN_CACHE_EXPIRED";
749 case SCARD_E_NO_PIN_CACHE:
750 return "SCARD_E_NO_PIN_CACHE";
752 case SCARD_E_READ_ONLY_CARD:
753 return "SCARD_E_READ_ONLY_CARD";
755 case SCARD_W_UNSUPPORTED_CARD:
756 return "SCARD_W_UNSUPPORTED_CARD";
758 case SCARD_W_UNRESPONSIVE_CARD:
759 return "SCARD_W_UNRESPONSIVE_CARD";
761 case SCARD_W_UNPOWERED_CARD:
762 return "SCARD_W_UNPOWERED_CARD";
764 case SCARD_W_RESET_CARD:
765 return "SCARD_W_RESET_CARD";
767 case SCARD_W_REMOVED_CARD:
768 return "SCARD_W_REMOVED_CARD";
770 case SCARD_W_SECURITY_VIOLATION:
771 return "SCARD_W_SECURITY_VIOLATION";
773 case SCARD_W_WRONG_CHV:
774 return "SCARD_W_WRONG_CHV";
776 case SCARD_W_CHV_BLOCKED:
777 return "SCARD_W_CHV_BLOCKED";
780 return "SCARD_W_EOF";
782 case SCARD_W_CANCELLED_BY_USER:
783 return "SCARD_W_CANCELLED_BY_USER";
785 case SCARD_W_CARD_NOT_AUTHENTICATED:
786 return "SCARD_W_CARD_NOT_AUTHENTICATED";
788 case SCARD_W_CACHE_ITEM_NOT_FOUND:
789 return "SCARD_W_CACHE_ITEM_NOT_FOUND";
791 case SCARD_W_CACHE_ITEM_STALE:
792 return "SCARD_W_CACHE_ITEM_STALE";
794 case SCARD_W_CACHE_ITEM_TOO_BIG:
795 return "SCARD_W_CACHE_ITEM_TOO_BIG";
798 return "SCARD_E_UNKNOWN";
802 WINSCARDAPI
const char* WINAPI SCardGetAttributeString(DWORD dwAttrId)
806 case SCARD_ATTR_VENDOR_NAME:
807 return "SCARD_ATTR_VENDOR_NAME";
809 case SCARD_ATTR_VENDOR_IFD_TYPE:
810 return "SCARD_ATTR_VENDOR_IFD_TYPE";
812 case SCARD_ATTR_VENDOR_IFD_VERSION:
813 return "SCARD_ATTR_VENDOR_IFD_VERSION";
815 case SCARD_ATTR_VENDOR_IFD_SERIAL_NO:
816 return "SCARD_ATTR_VENDOR_IFD_SERIAL_NO";
818 case SCARD_ATTR_CHANNEL_ID:
819 return "SCARD_ATTR_CHANNEL_ID";
821 case SCARD_ATTR_PROTOCOL_TYPES:
822 return "SCARD_ATTR_PROTOCOL_TYPES";
824 case SCARD_ATTR_DEFAULT_CLK:
825 return "SCARD_ATTR_DEFAULT_CLK";
827 case SCARD_ATTR_MAX_CLK:
828 return "SCARD_ATTR_MAX_CLK";
830 case SCARD_ATTR_DEFAULT_DATA_RATE:
831 return "SCARD_ATTR_DEFAULT_DATA_RATE";
833 case SCARD_ATTR_MAX_DATA_RATE:
834 return "SCARD_ATTR_MAX_DATA_RATE";
836 case SCARD_ATTR_MAX_IFSD:
837 return "SCARD_ATTR_MAX_IFSD";
839 case SCARD_ATTR_POWER_MGMT_SUPPORT:
840 return "SCARD_ATTR_POWER_MGMT_SUPPORT";
842 case SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE:
843 return "SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE";
845 case SCARD_ATTR_USER_AUTH_INPUT_DEVICE:
846 return "SCARD_ATTR_USER_AUTH_INPUT_DEVICE";
848 case SCARD_ATTR_CHARACTERISTICS:
849 return "SCARD_ATTR_CHARACTERISTICS";
851 case SCARD_ATTR_CURRENT_PROTOCOL_TYPE:
852 return "SCARD_ATTR_CURRENT_PROTOCOL_TYPE";
854 case SCARD_ATTR_CURRENT_CLK:
855 return "SCARD_ATTR_CURRENT_CLK";
857 case SCARD_ATTR_CURRENT_F:
858 return "SCARD_ATTR_CURRENT_F";
860 case SCARD_ATTR_CURRENT_D:
861 return "SCARD_ATTR_CURRENT_D";
863 case SCARD_ATTR_CURRENT_N:
864 return "SCARD_ATTR_CURRENT_N";
866 case SCARD_ATTR_CURRENT_W:
867 return "SCARD_ATTR_CURRENT_W";
869 case SCARD_ATTR_CURRENT_IFSC:
870 return "SCARD_ATTR_CURRENT_IFSC";
872 case SCARD_ATTR_CURRENT_IFSD:
873 return "SCARD_ATTR_CURRENT_IFSD";
875 case SCARD_ATTR_CURRENT_BWT:
876 return "SCARD_ATTR_CURRENT_BWT";
878 case SCARD_ATTR_CURRENT_CWT:
879 return "SCARD_ATTR_CURRENT_CWT";
881 case SCARD_ATTR_CURRENT_EBC_ENCODING:
882 return "SCARD_ATTR_CURRENT_EBC_ENCODING";
884 case SCARD_ATTR_EXTENDED_BWT:
885 return "SCARD_ATTR_EXTENDED_BWT";
887 case SCARD_ATTR_ICC_PRESENCE:
888 return "SCARD_ATTR_ICC_PRESENCE";
890 case SCARD_ATTR_ICC_INTERFACE_STATUS:
891 return "SCARD_ATTR_ICC_INTERFACE_STATUS";
893 case SCARD_ATTR_CURRENT_IO_STATE:
894 return "SCARD_ATTR_CURRENT_IO_STATE";
896 case SCARD_ATTR_ATR_STRING:
897 return "SCARD_ATTR_ATR_STRING";
899 case SCARD_ATTR_ICC_TYPE_PER_ATR:
900 return "SCARD_ATTR_ICC_TYPE_PER_ATR";
902 case SCARD_ATTR_ESC_RESET:
903 return "SCARD_ATTR_ESC_RESET";
905 case SCARD_ATTR_ESC_CANCEL:
906 return "SCARD_ATTR_ESC_CANCEL";
908 case SCARD_ATTR_ESC_AUTHREQUEST:
909 return "SCARD_ATTR_ESC_AUTHREQUEST";
911 case SCARD_ATTR_MAXINPUT:
912 return "SCARD_ATTR_MAXINPUT";
914 case SCARD_ATTR_DEVICE_UNIT:
915 return "SCARD_ATTR_DEVICE_UNIT";
917 case SCARD_ATTR_DEVICE_IN_USE:
918 return "SCARD_ATTR_DEVICE_IN_USE";
920 case SCARD_ATTR_DEVICE_FRIENDLY_NAME_A:
921 return "SCARD_ATTR_DEVICE_FRIENDLY_NAME_A";
923 case SCARD_ATTR_DEVICE_SYSTEM_NAME_A:
924 return "SCARD_ATTR_DEVICE_SYSTEM_NAME_A";
926 case SCARD_ATTR_DEVICE_FRIENDLY_NAME_W:
927 return "SCARD_ATTR_DEVICE_FRIENDLY_NAME_W";
929 case SCARD_ATTR_DEVICE_SYSTEM_NAME_W:
930 return "SCARD_ATTR_DEVICE_SYSTEM_NAME_W";
932 case SCARD_ATTR_SUPRESS_T1_IFS_REQUEST:
933 return "SCARD_ATTR_SUPRESS_T1_IFS_REQUEST";
936 return "SCARD_ATTR_UNKNOWN";
940 WINSCARDAPI
const char* WINAPI SCardGetProtocolString(DWORD dwProtocols)
942 if (dwProtocols == SCARD_PROTOCOL_UNDEFINED)
943 return "SCARD_PROTOCOL_UNDEFINED";
945 if (dwProtocols == SCARD_PROTOCOL_T0)
946 return "SCARD_PROTOCOL_T0";
948 if (dwProtocols == SCARD_PROTOCOL_T1)
949 return "SCARD_PROTOCOL_T1";
951 if (dwProtocols == SCARD_PROTOCOL_Tx)
952 return "SCARD_PROTOCOL_Tx";
954 if (dwProtocols == SCARD_PROTOCOL_RAW)
955 return "SCARD_PROTOCOL_RAW";
957 if (dwProtocols == SCARD_PROTOCOL_DEFAULT)
958 return "SCARD_PROTOCOL_DEFAULT";
960 if (dwProtocols == (SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_RAW))
961 return "SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_RAW";
963 if (dwProtocols == (SCARD_PROTOCOL_T1 | SCARD_PROTOCOL_RAW))
964 return "SCARD_PROTOCOL_T1 | SCARD_PROTOCOL_RAW";
966 if (dwProtocols == (SCARD_PROTOCOL_Tx | SCARD_PROTOCOL_RAW))
967 return "SCARD_PROTOCOL_Tx | SCARD_PROTOCOL_RAW";
969 return "SCARD_PROTOCOL_UNKNOWN";
972 WINSCARDAPI
const char* WINAPI SCardGetShareModeString(DWORD dwShareMode)
976 case SCARD_SHARE_EXCLUSIVE:
977 return "SCARD_SHARE_EXCLUSIVE";
979 case SCARD_SHARE_SHARED:
980 return "SCARD_SHARE_SHARED";
982 case SCARD_SHARE_DIRECT:
983 return "SCARD_SHARE_DIRECT";
986 return "SCARD_SHARE_UNKNOWN";
990 WINSCARDAPI
const char* WINAPI SCardGetDispositionString(DWORD dwDisposition)
992 switch (dwDisposition)
994 case SCARD_LEAVE_CARD:
995 return "SCARD_LEAVE_CARD";
997 case SCARD_RESET_CARD:
998 return "SCARD_RESET_CARD";
1000 case SCARD_UNPOWER_CARD:
1001 return "SCARD_UNPOWER_CARD";
1004 return "SCARD_UNKNOWN_CARD";
1008 WINSCARDAPI
const char* WINAPI SCardGetScopeString(DWORD dwScope)
1012 case SCARD_SCOPE_USER:
1013 return "SCARD_SCOPE_USER";
1015 case SCARD_SCOPE_TERMINAL:
1016 return "SCARD_SCOPE_TERMINAL";
1018 case SCARD_SCOPE_SYSTEM:
1019 return "SCARD_SCOPE_SYSTEM";
1022 return "SCARD_SCOPE_UNKNOWN";
1026 WINSCARDAPI
const char* WINAPI SCardGetCardStateString(DWORD dwCardState)
1028 switch (dwCardState)
1031 return "SCARD_UNKNOWN";
1034 return "SCARD_ABSENT";
1037 return "SCARD_PRESENT";
1039 case SCARD_SWALLOWED:
1040 return "SCARD_SWALLOWED";
1043 return "SCARD_POWERED";
1045 case SCARD_NEGOTIABLE:
1046 return "SCARD_NEGOTIABLE";
1048 case SCARD_SPECIFIC:
1049 return "SCARD_SPECIFIC";
1052 return "SCARD_UNKNOWN";
1056 WINSCARDAPI
char* WINAPI SCardGetReaderStateString(DWORD dwReaderState)
1058 const size_t size = 512;
1059 char* buffer = calloc(size,
sizeof(
char));
1064 if (dwReaderState & SCARD_STATE_IGNORE)
1065 winpr_str_append(
"SCARD_STATE_IGNORE", buffer, size,
"|");
1067 if (dwReaderState & SCARD_STATE_CHANGED)
1068 winpr_str_append(
"SCARD_STATE_CHANGED", buffer, size,
"|");
1070 if (dwReaderState & SCARD_STATE_UNKNOWN)
1071 winpr_str_append(
"SCARD_STATE_UNKNOWN", buffer, size,
"|");
1073 if (dwReaderState & SCARD_STATE_UNAVAILABLE)
1074 winpr_str_append(
"SCARD_STATE_UNAVAILABLE", buffer, size,
"|");
1076 if (dwReaderState & SCARD_STATE_EMPTY)
1077 winpr_str_append(
"SCARD_STATE_EMPTY", buffer, size,
"|");
1079 if (dwReaderState & SCARD_STATE_PRESENT)
1080 winpr_str_append(
"SCARD_STATE_PRESENT", buffer, size,
"|");
1082 if (dwReaderState & SCARD_STATE_ATRMATCH)
1083 winpr_str_append(
"SCARD_STATE_ATRMATCH", buffer, size,
"|");
1085 if (dwReaderState & SCARD_STATE_EXCLUSIVE)
1086 winpr_str_append(
"SCARD_STATE_EXCLUSIVE", buffer, size,
"|");
1088 if (dwReaderState & SCARD_STATE_INUSE)
1089 winpr_str_append(
"SCARD_STATE_INUSE", buffer, size,
"|");
1091 if (dwReaderState & SCARD_STATE_MUTE)
1092 winpr_str_append(
"SCARD_STATE_MUTE", buffer, size,
"|");
1094 if (dwReaderState & SCARD_STATE_UNPOWERED)
1095 winpr_str_append(
"SCARD_STATE_UNPOWERED", buffer, size,
"|");
1098 winpr_str_append(
"SCARD_STATE_UNAWARE", buffer, size,
"|");
1103 #define WINSCARD_LOAD_PROC(_name) \
1106 WINPR_PRAGMA_DIAG_PUSH \
1107 WINPR_PRAGMA_DIAG_IGNORED_PEDANTIC \
1108 pWinSCardApiTable->pfn##_name = GetProcAddressAs(hWinSCardLibrary, #_name, fn##_name); \
1109 WINPR_PRAGMA_DIAG_POP \
1113 HMODULE hWinSCardLibrary)
1115 WINPR_ASSERT(pWinSCardApiTable);
1116 WINPR_ASSERT(hWinSCardLibrary);
1118 WINSCARD_LOAD_PROC(SCardEstablishContext);
1119 WINSCARD_LOAD_PROC(SCardReleaseContext);
1120 WINSCARD_LOAD_PROC(SCardIsValidContext);
1121 WINSCARD_LOAD_PROC(SCardListReaderGroupsA);
1122 WINSCARD_LOAD_PROC(SCardListReaderGroupsW);
1123 WINSCARD_LOAD_PROC(SCardListReadersA);
1124 WINSCARD_LOAD_PROC(SCardListReadersW);
1125 WINSCARD_LOAD_PROC(SCardListCardsA);
1126 WINSCARD_LOAD_PROC(SCardListCardsW);
1127 WINSCARD_LOAD_PROC(SCardListInterfacesA);
1128 WINSCARD_LOAD_PROC(SCardListInterfacesW);
1129 WINSCARD_LOAD_PROC(SCardGetProviderIdA);
1130 WINSCARD_LOAD_PROC(SCardGetProviderIdW);
1131 WINSCARD_LOAD_PROC(SCardGetCardTypeProviderNameA);
1132 WINSCARD_LOAD_PROC(SCardGetCardTypeProviderNameW);
1133 WINSCARD_LOAD_PROC(SCardIntroduceReaderGroupA);
1134 WINSCARD_LOAD_PROC(SCardIntroduceReaderGroupW);
1135 WINSCARD_LOAD_PROC(SCardForgetReaderGroupA);
1136 WINSCARD_LOAD_PROC(SCardForgetReaderGroupW);
1137 WINSCARD_LOAD_PROC(SCardIntroduceReaderA);
1138 WINSCARD_LOAD_PROC(SCardIntroduceReaderW);
1139 WINSCARD_LOAD_PROC(SCardForgetReaderA);
1140 WINSCARD_LOAD_PROC(SCardForgetReaderW);
1141 WINSCARD_LOAD_PROC(SCardAddReaderToGroupA);
1142 WINSCARD_LOAD_PROC(SCardAddReaderToGroupW);
1143 WINSCARD_LOAD_PROC(SCardRemoveReaderFromGroupA);
1144 WINSCARD_LOAD_PROC(SCardRemoveReaderFromGroupW);
1145 WINSCARD_LOAD_PROC(SCardIntroduceCardTypeA);
1146 WINSCARD_LOAD_PROC(SCardIntroduceCardTypeW);
1147 WINSCARD_LOAD_PROC(SCardSetCardTypeProviderNameA);
1148 WINSCARD_LOAD_PROC(SCardSetCardTypeProviderNameW);
1149 WINSCARD_LOAD_PROC(SCardForgetCardTypeA);
1150 WINSCARD_LOAD_PROC(SCardForgetCardTypeW);
1151 WINSCARD_LOAD_PROC(SCardFreeMemory);
1152 WINSCARD_LOAD_PROC(SCardAccessStartedEvent);
1153 WINSCARD_LOAD_PROC(SCardReleaseStartedEvent);
1154 WINSCARD_LOAD_PROC(SCardLocateCardsA);
1155 WINSCARD_LOAD_PROC(SCardLocateCardsW);
1156 WINSCARD_LOAD_PROC(SCardLocateCardsByATRA);
1157 WINSCARD_LOAD_PROC(SCardLocateCardsByATRW);
1158 WINSCARD_LOAD_PROC(SCardGetStatusChangeA);
1159 WINSCARD_LOAD_PROC(SCardGetStatusChangeW);
1160 WINSCARD_LOAD_PROC(SCardCancel);
1161 WINSCARD_LOAD_PROC(SCardConnectA);
1162 WINSCARD_LOAD_PROC(SCardConnectW);
1163 WINSCARD_LOAD_PROC(SCardReconnect);
1164 WINSCARD_LOAD_PROC(SCardDisconnect);
1165 WINSCARD_LOAD_PROC(SCardBeginTransaction);
1166 WINSCARD_LOAD_PROC(SCardEndTransaction);
1167 WINSCARD_LOAD_PROC(SCardCancelTransaction);
1168 WINSCARD_LOAD_PROC(SCardState);
1169 WINSCARD_LOAD_PROC(SCardStatusA);
1170 WINSCARD_LOAD_PROC(SCardStatusW);
1171 WINSCARD_LOAD_PROC(SCardTransmit);
1172 WINSCARD_LOAD_PROC(SCardGetTransmitCount);
1173 WINSCARD_LOAD_PROC(SCardControl);
1174 WINSCARD_LOAD_PROC(SCardGetAttrib);
1175 WINSCARD_LOAD_PROC(SCardSetAttrib);
1176 WINSCARD_LOAD_PROC(SCardUIDlgSelectCardA);
1177 WINSCARD_LOAD_PROC(SCardUIDlgSelectCardW);
1178 WINSCARD_LOAD_PROC(GetOpenCardNameA);
1179 WINSCARD_LOAD_PROC(GetOpenCardNameW);
1180 WINSCARD_LOAD_PROC(SCardDlgExtendedError);
1181 WINSCARD_LOAD_PROC(SCardReadCacheA);
1182 WINSCARD_LOAD_PROC(SCardReadCacheW);
1183 WINSCARD_LOAD_PROC(SCardWriteCacheA);
1184 WINSCARD_LOAD_PROC(SCardWriteCacheW);
1185 WINSCARD_LOAD_PROC(SCardGetReaderIconA);
1186 WINSCARD_LOAD_PROC(SCardGetReaderIconW);
1187 WINSCARD_LOAD_PROC(SCardGetDeviceTypeIdA);
1188 WINSCARD_LOAD_PROC(SCardGetDeviceTypeIdW);
1189 WINSCARD_LOAD_PROC(SCardGetReaderDeviceInstanceIdA);
1190 WINSCARD_LOAD_PROC(SCardGetReaderDeviceInstanceIdW);
1191 WINSCARD_LOAD_PROC(SCardListReadersWithDeviceInstanceIdA);
1192 WINSCARD_LOAD_PROC(SCardListReadersWithDeviceInstanceIdW);
1193 WINSCARD_LOAD_PROC(SCardAudit);
1202 SCardEstablishContext,
1203 SCardReleaseContext,
1204 SCardIsValidContext,
1205 SCardListReaderGroupsA,
1206 SCardListReaderGroupsW,
1211 SCardListInterfacesA,
1212 SCardListInterfacesW,
1213 SCardGetProviderIdA,
1214 SCardGetProviderIdW,
1215 SCardGetCardTypeProviderNameA,
1216 SCardGetCardTypeProviderNameW,
1217 SCardIntroduceReaderGroupA,
1218 SCardIntroduceReaderGroupW,
1219 SCardForgetReaderGroupA,
1220 SCardForgetReaderGroupW,
1221 SCardIntroduceReaderA,
1222 SCardIntroduceReaderW,
1225 SCardAddReaderToGroupA,
1226 SCardAddReaderToGroupW,
1227 SCardRemoveReaderFromGroupA,
1228 SCardRemoveReaderFromGroupW,
1229 SCardIntroduceCardTypeA,
1230 SCardIntroduceCardTypeW,
1231 SCardSetCardTypeProviderNameA,
1232 SCardSetCardTypeProviderNameW,
1233 SCardForgetCardTypeA,
1234 SCardForgetCardTypeW,
1236 SCardAccessStartedEvent,
1237 SCardReleaseStartedEvent,
1240 SCardLocateCardsByATRA,
1241 SCardLocateCardsByATRW,
1242 SCardGetStatusChangeA,
1243 SCardGetStatusChangeW,
1249 SCardBeginTransaction,
1250 SCardEndTransaction,
1251 SCardCancelTransaction,
1256 SCardGetTransmitCount,
1260 SCardUIDlgSelectCardA,
1261 SCardUIDlgSelectCardW,
1264 SCardDlgExtendedError,
1269 SCardGetReaderIconA,
1270 SCardGetReaderIconW,
1271 SCardGetDeviceTypeIdA,
1272 SCardGetDeviceTypeIdW,
1273 SCardGetReaderDeviceInstanceIdA,
1274 SCardGetReaderDeviceInstanceIdW,
1275 SCardListReadersWithDeviceInstanceIdA,
1276 SCardListReadersWithDeviceInstanceIdW,
1282 return &WinPR_SCardApiFunctionTable;