21 #ifndef WINPR_SMARTCARD_EMULATE_PRIVATE_H
22 #define WINPR_SMARTCARD_EMULATE_PRIVATE_H
24 #include <winpr/platform.h>
25 #include <winpr/smartcard.h>
27 #include <freerdp/api.h>
28 #include <freerdp/settings.h>
35 typedef struct smartcard_emulation_context SmartcardEmulationContext;
37 FREERDP_API
void Emulate_Free(SmartcardEmulationContext* context);
39 WINPR_ATTR_MALLOC(Emulate_Free, 1)
40 FREERDP_API SmartcardEmulationContext* Emulate_New(const rdpSettings* settings);
42 FREERDP_API BOOL Emulate_IsConfigured(SmartcardEmulationContext* context);
44 FREERDP_API LONG WINAPI Emulate_SCardEstablishContext(SmartcardEmulationContext* smartcard,
45 DWORD dwScope, LPCVOID pvReserved1,
47 LPSCARDCONTEXT phContext);
49 FREERDP_API LONG WINAPI Emulate_SCardReleaseContext(SmartcardEmulationContext* smartcard,
50 SCARDCONTEXT hContext);
52 FREERDP_API LONG WINAPI Emulate_SCardIsValidContext(SmartcardEmulationContext* smartcard,
53 SCARDCONTEXT hContext);
55 FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsA(SmartcardEmulationContext* smartcard,
56 SCARDCONTEXT hContext, LPSTR mszGroups,
59 FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsW(SmartcardEmulationContext* smartcard,
60 SCARDCONTEXT hContext, LPWSTR mszGroups,
63 FREERDP_API LONG WINAPI Emulate_SCardListReadersA(SmartcardEmulationContext* smartcard,
64 SCARDCONTEXT hContext, LPCSTR mszGroups,
65 LPSTR mszReaders, LPDWORD pcchReaders);
67 FREERDP_API LONG WINAPI Emulate_SCardListReadersW(SmartcardEmulationContext* smartcard,
68 SCARDCONTEXT hContext, LPCWSTR mszGroups,
69 LPWSTR mszReaders, LPDWORD pcchReaders);
71 FREERDP_API LONG WINAPI Emulate_SCardListCardsA(SmartcardEmulationContext* smartcard,
72 SCARDCONTEXT hContext, LPCBYTE pbAtr,
73 LPCGUID rgquidInterfaces,
74 DWORD cguidInterfaceCount, CHAR* mszCards,
77 FREERDP_API LONG WINAPI Emulate_SCardListCardsW(SmartcardEmulationContext* smartcard,
78 SCARDCONTEXT hContext, LPCBYTE pbAtr,
79 LPCGUID rgquidInterfaces,
80 DWORD cguidInterfaceCount, WCHAR* mszCards,
83 FREERDP_API LONG WINAPI Emulate_SCardListInterfacesA(SmartcardEmulationContext* smartcard,
84 SCARDCONTEXT hContext, LPCSTR szCard,
85 LPGUID pguidInterfaces,
86 LPDWORD pcguidInterfaces);
88 FREERDP_API LONG WINAPI Emulate_SCardListInterfacesW(SmartcardEmulationContext* smartcard,
89 SCARDCONTEXT hContext, LPCWSTR szCard,
90 LPGUID pguidInterfaces,
91 LPDWORD pcguidInterfaces);
93 FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdA(SmartcardEmulationContext* smartcard,
94 SCARDCONTEXT hContext, LPCSTR szCard,
95 LPGUID pguidProviderId);
97 FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdW(SmartcardEmulationContext* smartcard,
98 SCARDCONTEXT hContext, LPCWSTR szCard,
99 LPGUID pguidProviderId);
101 FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameA(
102 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
103 DWORD dwProviderId, CHAR* szProvider, LPDWORD pcchProvider);
105 FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameW(
106 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
107 DWORD dwProviderId, WCHAR* szProvider, LPDWORD pcchProvider);
109 FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupA(SmartcardEmulationContext* smartcard,
110 SCARDCONTEXT hContext,
113 FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupW(SmartcardEmulationContext* smartcard,
114 SCARDCONTEXT hContext,
115 LPCWSTR szGroupName);
117 FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupA(SmartcardEmulationContext* smartcard,
118 SCARDCONTEXT hContext,
121 FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupW(SmartcardEmulationContext* smartcard,
122 SCARDCONTEXT hContext,
123 LPCWSTR szGroupName);
125 FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderA(SmartcardEmulationContext* smartcard,
126 SCARDCONTEXT hContext,
127 LPCSTR szReaderName, LPCSTR szDeviceName);
129 FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderW(SmartcardEmulationContext* smartcard,
130 SCARDCONTEXT hContext,
131 LPCWSTR szReaderName,
132 LPCWSTR szDeviceName);
134 FREERDP_API LONG WINAPI Emulate_SCardForgetReaderA(SmartcardEmulationContext* smartcard,
135 SCARDCONTEXT hContext, LPCSTR szReaderName);
137 FREERDP_API LONG WINAPI Emulate_SCardForgetReaderW(SmartcardEmulationContext* smartcard,
138 SCARDCONTEXT hContext, LPCWSTR szReaderName);
140 FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupA(SmartcardEmulationContext* smartcard,
141 SCARDCONTEXT hContext,
142 LPCSTR szReaderName, LPCSTR szGroupName);
144 FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupW(SmartcardEmulationContext* smartcard,
145 SCARDCONTEXT hContext,
146 LPCWSTR szReaderName,
147 LPCWSTR szGroupName);
149 FREERDP_API LONG WINAPI
150 Emulate_SCardRemoveReaderFromGroupA(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
151 LPCSTR szReaderName, LPCSTR szGroupName);
153 FREERDP_API LONG WINAPI
154 Emulate_SCardRemoveReaderFromGroupW(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
155 LPCWSTR szReaderName, LPCWSTR szGroupName);
157 FREERDP_API LONG WINAPI Emulate_SCardIntroduceCardTypeA(
158 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
159 LPCGUID pguidPrimaryProvider, LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
160 LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen);
162 FREERDP_API LONG WINAPI Emulate_SCardIntroduceCardTypeW(
163 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
164 LPCGUID pguidPrimaryProvider, LPCGUID rgguidInterfaces, DWORD dwInterfaceCount,
165 LPCBYTE pbAtr, LPCBYTE pbAtrMask, DWORD cbAtrLen);
167 FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameA(
168 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
169 DWORD dwProviderId, LPCSTR szProvider);
171 FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameW(
172 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
173 DWORD dwProviderId, LPCWSTR szProvider);
175 FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeA(SmartcardEmulationContext* smartcard,
176 SCARDCONTEXT hContext, LPCSTR szCardName);
178 FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeW(SmartcardEmulationContext* smartcard,
179 SCARDCONTEXT hContext, LPCWSTR szCardName);
181 FREERDP_API LONG WINAPI Emulate_SCardFreeMemory(SmartcardEmulationContext* smartcard,
182 SCARDCONTEXT hContext, LPVOID pvMem);
184 FREERDP_API HANDLE WINAPI Emulate_SCardAccessStartedEvent(SmartcardEmulationContext* smartcard);
186 FREERDP_API
void WINAPI Emulate_SCardReleaseStartedEvent(SmartcardEmulationContext* smartcard);
188 FREERDP_API LONG WINAPI Emulate_SCardLocateCardsA(SmartcardEmulationContext* smartcard,
189 SCARDCONTEXT hContext, LPCSTR mszCards,
193 FREERDP_API LONG WINAPI Emulate_SCardLocateCardsW(SmartcardEmulationContext* smartcard,
194 SCARDCONTEXT hContext, LPCWSTR mszCards,
198 FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRA(SmartcardEmulationContext* smartcard,
199 SCARDCONTEXT hContext,
204 FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRW(SmartcardEmulationContext* smartcard,
205 SCARDCONTEXT hContext,
210 FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
211 SCARDCONTEXT hContext, DWORD dwTimeout,
215 FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
216 SCARDCONTEXT hContext, DWORD dwTimeout,
220 FREERDP_API LONG WINAPI Emulate_SCardCancel(SmartcardEmulationContext* smartcard,
221 SCARDCONTEXT hContext);
223 FREERDP_API LONG WINAPI Emulate_SCardConnectA(SmartcardEmulationContext* smartcard,
224 SCARDCONTEXT hContext, LPCSTR szReader,
225 DWORD dwShareMode, DWORD dwPreferredProtocols,
226 LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
228 FREERDP_API LONG WINAPI Emulate_SCardConnectW(SmartcardEmulationContext* smartcard,
229 SCARDCONTEXT hContext, LPCWSTR szReader,
230 DWORD dwShareMode, DWORD dwPreferredProtocols,
231 LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
233 FREERDP_API LONG WINAPI Emulate_SCardReconnect(SmartcardEmulationContext* smartcard,
234 SCARDHANDLE hCard, DWORD dwShareMode,
235 DWORD dwPreferredProtocols,
236 DWORD dwInitialization,
237 LPDWORD pdwActiveProtocol);
239 FREERDP_API LONG WINAPI Emulate_SCardDisconnect(SmartcardEmulationContext* smartcard,
240 SCARDHANDLE hCard, DWORD dwDisposition);
242 FREERDP_API LONG WINAPI Emulate_SCardBeginTransaction(SmartcardEmulationContext* smartcard,
245 FREERDP_API LONG WINAPI Emulate_SCardEndTransaction(SmartcardEmulationContext* smartcard,
246 SCARDHANDLE hCard, DWORD dwDisposition);
248 FREERDP_API LONG WINAPI Emulate_SCardCancelTransaction(SmartcardEmulationContext* smartcard,
251 FREERDP_API LONG WINAPI Emulate_SCardState(SmartcardEmulationContext* smartcard,
252 SCARDHANDLE hCard, LPDWORD pdwState,
253 LPDWORD pdwProtocol, LPBYTE pbAtr,
256 FREERDP_API LONG WINAPI Emulate_SCardStatusA(SmartcardEmulationContext* smartcard,
257 SCARDHANDLE hCard, LPSTR mszReaderNames,
258 LPDWORD pcchReaderLen, LPDWORD pdwState,
259 LPDWORD pdwProtocol, LPBYTE pbAtr,
262 FREERDP_API LONG WINAPI Emulate_SCardStatusW(SmartcardEmulationContext* smartcard,
263 SCARDHANDLE hCard, LPWSTR mszReaderNames,
264 LPDWORD pcchReaderLen, LPDWORD pdwState,
265 LPDWORD pdwProtocol, LPBYTE pbAtr,
268 FREERDP_API LONG WINAPI Emulate_SCardTransmit(SmartcardEmulationContext* smartcard,
270 LPCBYTE pbSendBuffer, DWORD cbSendLength,
272 LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
274 FREERDP_API LONG WINAPI Emulate_SCardGetTransmitCount(SmartcardEmulationContext* smartcard,
276 LPDWORD pcTransmitCount);
278 FREERDP_API LONG WINAPI Emulate_SCardControl(SmartcardEmulationContext* smartcard,
279 SCARDHANDLE hCard, DWORD dwControlCode,
280 LPCVOID lpInBuffer, DWORD cbInBufferSize,
281 LPVOID lpOutBuffer, DWORD cbOutBufferSize,
282 LPDWORD lpBytesReturned);
284 FREERDP_API LONG WINAPI Emulate_SCardGetAttrib(SmartcardEmulationContext* smartcard,
285 SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
288 FREERDP_API LONG WINAPI Emulate_SCardSetAttrib(SmartcardEmulationContext* smartcard,
289 SCARDHANDLE hCard, DWORD dwAttrId,
290 LPCBYTE pbAttr, DWORD cbAttrLen);
292 FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardA(SmartcardEmulationContext* smartcard,
293 LPOPENCARDNAMEA_EX pDlgStruc);
295 FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardW(SmartcardEmulationContext* smartcard,
296 LPOPENCARDNAMEW_EX pDlgStruc);
298 FREERDP_API LONG WINAPI Emulate_GetOpenCardNameA(SmartcardEmulationContext* smartcard,
301 FREERDP_API LONG WINAPI Emulate_GetOpenCardNameW(SmartcardEmulationContext* smartcard,
304 FREERDP_API LONG WINAPI Emulate_SCardDlgExtendedError(SmartcardEmulationContext* smartcard);
306 FREERDP_API LONG WINAPI Emulate_SCardReadCacheA(SmartcardEmulationContext* smartcard,
307 SCARDCONTEXT hContext, UUID* CardIdentifier,
308 DWORD FreshnessCounter, LPSTR LookupName,
309 PBYTE Data, DWORD* DataLen);
311 FREERDP_API LONG WINAPI Emulate_SCardReadCacheW(SmartcardEmulationContext* smartcard,
312 SCARDCONTEXT hContext, UUID* CardIdentifier,
313 DWORD FreshnessCounter, LPWSTR LookupName,
314 PBYTE Data, DWORD* DataLen);
316 FREERDP_API LONG WINAPI Emulate_SCardWriteCacheA(SmartcardEmulationContext* smartcard,
317 SCARDCONTEXT hContext, UUID* CardIdentifier,
318 DWORD FreshnessCounter, LPSTR LookupName,
319 PBYTE Data, DWORD DataLen);
321 FREERDP_API LONG WINAPI Emulate_SCardWriteCacheW(SmartcardEmulationContext* smartcard,
322 SCARDCONTEXT hContext, UUID* CardIdentifier,
323 DWORD FreshnessCounter, LPWSTR LookupName,
324 PBYTE Data, DWORD DataLen);
326 FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconA(SmartcardEmulationContext* smartcard,
327 SCARDCONTEXT hContext, LPCSTR szReaderName,
328 LPBYTE pbIcon, LPDWORD pcbIcon);
330 FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconW(SmartcardEmulationContext* smartcard,
331 SCARDCONTEXT hContext, LPCWSTR szReaderName,
332 LPBYTE pbIcon, LPDWORD pcbIcon);
334 FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdA(SmartcardEmulationContext* smartcard,
335 SCARDCONTEXT hContext,
337 LPDWORD pdwDeviceTypeId);
338 FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdW(SmartcardEmulationContext* smartcard,
339 SCARDCONTEXT hContext,
340 LPCWSTR szReaderName,
341 LPDWORD pdwDeviceTypeId);
343 FREERDP_API LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA(
344 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szReaderName,
345 LPSTR szDeviceInstanceId, LPDWORD pcchDeviceInstanceId);
347 FREERDP_API LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdW(
348 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szReaderName,
349 LPWSTR szDeviceInstanceId, LPDWORD pcchDeviceInstanceId);
350 FREERDP_API LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdA(
351 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szDeviceInstanceId,
352 LPSTR mszReaders, LPDWORD pcchReaders);
353 FREERDP_API LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdW(
354 SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szDeviceInstanceId,
355 LPWSTR mszReaders, LPDWORD pcchReaders);
356 FREERDP_API LONG WINAPI Emulate_SCardAudit(SmartcardEmulationContext* smartcard,
357 SCARDCONTEXT hContext, DWORD dwEvent);