FreeRDP
smartcard_emulate.h
1 
21 #ifndef WINPR_SMARTCARD_EMULATE_PRIVATE_H
22 #define WINPR_SMARTCARD_EMULATE_PRIVATE_H
23 
24 #include <winpr/platform.h>
25 #include <winpr/smartcard.h>
26 
27 #include <freerdp/api.h>
28 #include <freerdp/settings.h>
29 
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif
34 
35  typedef struct smartcard_emulation_context SmartcardEmulationContext;
36 
37  FREERDP_API void Emulate_Free(SmartcardEmulationContext* context);
38 
39  WINPR_ATTR_MALLOC(Emulate_Free, 1)
40  FREERDP_API SmartcardEmulationContext* Emulate_New(const rdpSettings* settings);
41 
42  FREERDP_API BOOL Emulate_IsConfigured(SmartcardEmulationContext* context);
43 
44  FREERDP_API LONG WINAPI Emulate_SCardEstablishContext(SmartcardEmulationContext* smartcard,
45  DWORD dwScope, LPCVOID pvReserved1,
46  LPCVOID pvReserved2,
47  LPSCARDCONTEXT phContext);
48 
49  FREERDP_API LONG WINAPI Emulate_SCardReleaseContext(SmartcardEmulationContext* smartcard,
50  SCARDCONTEXT hContext);
51 
52  FREERDP_API LONG WINAPI Emulate_SCardIsValidContext(SmartcardEmulationContext* smartcard,
53  SCARDCONTEXT hContext);
54 
55  FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsA(SmartcardEmulationContext* smartcard,
56  SCARDCONTEXT hContext, LPSTR mszGroups,
57  LPDWORD pcchGroups);
58 
59  FREERDP_API LONG WINAPI Emulate_SCardListReaderGroupsW(SmartcardEmulationContext* smartcard,
60  SCARDCONTEXT hContext, LPWSTR mszGroups,
61  LPDWORD pcchGroups);
62 
63  FREERDP_API LONG WINAPI Emulate_SCardListReadersA(SmartcardEmulationContext* smartcard,
64  SCARDCONTEXT hContext, LPCSTR mszGroups,
65  LPSTR mszReaders, LPDWORD pcchReaders);
66 
67  FREERDP_API LONG WINAPI Emulate_SCardListReadersW(SmartcardEmulationContext* smartcard,
68  SCARDCONTEXT hContext, LPCWSTR mszGroups,
69  LPWSTR mszReaders, LPDWORD pcchReaders);
70 
71  FREERDP_API LONG WINAPI Emulate_SCardListCardsA(SmartcardEmulationContext* smartcard,
72  SCARDCONTEXT hContext, LPCBYTE pbAtr,
73  LPCGUID rgquidInterfaces,
74  DWORD cguidInterfaceCount, CHAR* mszCards,
75  LPDWORD pcchCards);
76 
77  FREERDP_API LONG WINAPI Emulate_SCardListCardsW(SmartcardEmulationContext* smartcard,
78  SCARDCONTEXT hContext, LPCBYTE pbAtr,
79  LPCGUID rgquidInterfaces,
80  DWORD cguidInterfaceCount, WCHAR* mszCards,
81  LPDWORD pcchCards);
82 
83  FREERDP_API LONG WINAPI Emulate_SCardListInterfacesA(SmartcardEmulationContext* smartcard,
84  SCARDCONTEXT hContext, LPCSTR szCard,
85  LPGUID pguidInterfaces,
86  LPDWORD pcguidInterfaces);
87 
88  FREERDP_API LONG WINAPI Emulate_SCardListInterfacesW(SmartcardEmulationContext* smartcard,
89  SCARDCONTEXT hContext, LPCWSTR szCard,
90  LPGUID pguidInterfaces,
91  LPDWORD pcguidInterfaces);
92 
93  FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdA(SmartcardEmulationContext* smartcard,
94  SCARDCONTEXT hContext, LPCSTR szCard,
95  LPGUID pguidProviderId);
96 
97  FREERDP_API LONG WINAPI Emulate_SCardGetProviderIdW(SmartcardEmulationContext* smartcard,
98  SCARDCONTEXT hContext, LPCWSTR szCard,
99  LPGUID pguidProviderId);
100 
101  FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameA(
102  SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
103  DWORD dwProviderId, CHAR* szProvider, LPDWORD pcchProvider);
104 
105  FREERDP_API LONG WINAPI Emulate_SCardGetCardTypeProviderNameW(
106  SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
107  DWORD dwProviderId, WCHAR* szProvider, LPDWORD pcchProvider);
108 
109  FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupA(SmartcardEmulationContext* smartcard,
110  SCARDCONTEXT hContext,
111  LPCSTR szGroupName);
112 
113  FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderGroupW(SmartcardEmulationContext* smartcard,
114  SCARDCONTEXT hContext,
115  LPCWSTR szGroupName);
116 
117  FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupA(SmartcardEmulationContext* smartcard,
118  SCARDCONTEXT hContext,
119  LPCSTR szGroupName);
120 
121  FREERDP_API LONG WINAPI Emulate_SCardForgetReaderGroupW(SmartcardEmulationContext* smartcard,
122  SCARDCONTEXT hContext,
123  LPCWSTR szGroupName);
124 
125  FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderA(SmartcardEmulationContext* smartcard,
126  SCARDCONTEXT hContext,
127  LPCSTR szReaderName, LPCSTR szDeviceName);
128 
129  FREERDP_API LONG WINAPI Emulate_SCardIntroduceReaderW(SmartcardEmulationContext* smartcard,
130  SCARDCONTEXT hContext,
131  LPCWSTR szReaderName,
132  LPCWSTR szDeviceName);
133 
134  FREERDP_API LONG WINAPI Emulate_SCardForgetReaderA(SmartcardEmulationContext* smartcard,
135  SCARDCONTEXT hContext, LPCSTR szReaderName);
136 
137  FREERDP_API LONG WINAPI Emulate_SCardForgetReaderW(SmartcardEmulationContext* smartcard,
138  SCARDCONTEXT hContext, LPCWSTR szReaderName);
139 
140  FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupA(SmartcardEmulationContext* smartcard,
141  SCARDCONTEXT hContext,
142  LPCSTR szReaderName, LPCSTR szGroupName);
143 
144  FREERDP_API LONG WINAPI Emulate_SCardAddReaderToGroupW(SmartcardEmulationContext* smartcard,
145  SCARDCONTEXT hContext,
146  LPCWSTR szReaderName,
147  LPCWSTR szGroupName);
148 
149  FREERDP_API LONG WINAPI
150  Emulate_SCardRemoveReaderFromGroupA(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
151  LPCSTR szReaderName, LPCSTR szGroupName);
152 
153  FREERDP_API LONG WINAPI
154  Emulate_SCardRemoveReaderFromGroupW(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
155  LPCWSTR szReaderName, LPCWSTR szGroupName);
156 
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);
161 
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);
166 
167  FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameA(
168  SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
169  DWORD dwProviderId, LPCSTR szProvider);
170 
171  FREERDP_API LONG WINAPI Emulate_SCardSetCardTypeProviderNameW(
172  SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
173  DWORD dwProviderId, LPCWSTR szProvider);
174 
175  FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeA(SmartcardEmulationContext* smartcard,
176  SCARDCONTEXT hContext, LPCSTR szCardName);
177 
178  FREERDP_API LONG WINAPI Emulate_SCardForgetCardTypeW(SmartcardEmulationContext* smartcard,
179  SCARDCONTEXT hContext, LPCWSTR szCardName);
180 
181  FREERDP_API LONG WINAPI Emulate_SCardFreeMemory(SmartcardEmulationContext* smartcard,
182  SCARDCONTEXT hContext, LPVOID pvMem);
183 
184  FREERDP_API HANDLE WINAPI Emulate_SCardAccessStartedEvent(SmartcardEmulationContext* smartcard);
185 
186  FREERDP_API void WINAPI Emulate_SCardReleaseStartedEvent(SmartcardEmulationContext* smartcard);
187 
188  FREERDP_API LONG WINAPI Emulate_SCardLocateCardsA(SmartcardEmulationContext* smartcard,
189  SCARDCONTEXT hContext, LPCSTR mszCards,
190  LPSCARD_READERSTATEA rgReaderStates,
191  DWORD cReaders);
192 
193  FREERDP_API LONG WINAPI Emulate_SCardLocateCardsW(SmartcardEmulationContext* smartcard,
194  SCARDCONTEXT hContext, LPCWSTR mszCards,
195  LPSCARD_READERSTATEW rgReaderStates,
196  DWORD cReaders);
197 
198  FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRA(SmartcardEmulationContext* smartcard,
199  SCARDCONTEXT hContext,
200  LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs,
201  LPSCARD_READERSTATEA rgReaderStates,
202  DWORD cReaders);
203 
204  FREERDP_API LONG WINAPI Emulate_SCardLocateCardsByATRW(SmartcardEmulationContext* smartcard,
205  SCARDCONTEXT hContext,
206  LPSCARD_ATRMASK rgAtrMasks, DWORD cAtrs,
207  LPSCARD_READERSTATEW rgReaderStates,
208  DWORD cReaders);
209 
210  FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
211  SCARDCONTEXT hContext, DWORD dwTimeout,
212  LPSCARD_READERSTATEA rgReaderStates,
213  DWORD cReaders);
214 
215  FREERDP_API LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
216  SCARDCONTEXT hContext, DWORD dwTimeout,
217  LPSCARD_READERSTATEW rgReaderStates,
218  DWORD cReaders);
219 
220  FREERDP_API LONG WINAPI Emulate_SCardCancel(SmartcardEmulationContext* smartcard,
221  SCARDCONTEXT hContext);
222 
223  FREERDP_API LONG WINAPI Emulate_SCardConnectA(SmartcardEmulationContext* smartcard,
224  SCARDCONTEXT hContext, LPCSTR szReader,
225  DWORD dwShareMode, DWORD dwPreferredProtocols,
226  LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
227 
228  FREERDP_API LONG WINAPI Emulate_SCardConnectW(SmartcardEmulationContext* smartcard,
229  SCARDCONTEXT hContext, LPCWSTR szReader,
230  DWORD dwShareMode, DWORD dwPreferredProtocols,
231  LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol);
232 
233  FREERDP_API LONG WINAPI Emulate_SCardReconnect(SmartcardEmulationContext* smartcard,
234  SCARDHANDLE hCard, DWORD dwShareMode,
235  DWORD dwPreferredProtocols,
236  DWORD dwInitialization,
237  LPDWORD pdwActiveProtocol);
238 
239  FREERDP_API LONG WINAPI Emulate_SCardDisconnect(SmartcardEmulationContext* smartcard,
240  SCARDHANDLE hCard, DWORD dwDisposition);
241 
242  FREERDP_API LONG WINAPI Emulate_SCardBeginTransaction(SmartcardEmulationContext* smartcard,
243  SCARDHANDLE hCard);
244 
245  FREERDP_API LONG WINAPI Emulate_SCardEndTransaction(SmartcardEmulationContext* smartcard,
246  SCARDHANDLE hCard, DWORD dwDisposition);
247 
248  FREERDP_API LONG WINAPI Emulate_SCardCancelTransaction(SmartcardEmulationContext* smartcard,
249  SCARDHANDLE hCard);
250 
251  FREERDP_API LONG WINAPI Emulate_SCardState(SmartcardEmulationContext* smartcard,
252  SCARDHANDLE hCard, LPDWORD pdwState,
253  LPDWORD pdwProtocol, LPBYTE pbAtr,
254  LPDWORD pcbAtrLen);
255 
256  FREERDP_API LONG WINAPI Emulate_SCardStatusA(SmartcardEmulationContext* smartcard,
257  SCARDHANDLE hCard, LPSTR mszReaderNames,
258  LPDWORD pcchReaderLen, LPDWORD pdwState,
259  LPDWORD pdwProtocol, LPBYTE pbAtr,
260  LPDWORD pcbAtrLen);
261 
262  FREERDP_API LONG WINAPI Emulate_SCardStatusW(SmartcardEmulationContext* smartcard,
263  SCARDHANDLE hCard, LPWSTR mszReaderNames,
264  LPDWORD pcchReaderLen, LPDWORD pdwState,
265  LPDWORD pdwProtocol, LPBYTE pbAtr,
266  LPDWORD pcbAtrLen);
267 
268  FREERDP_API LONG WINAPI Emulate_SCardTransmit(SmartcardEmulationContext* smartcard,
269  SCARDHANDLE hCard, LPCSCARD_IO_REQUEST pioSendPci,
270  LPCBYTE pbSendBuffer, DWORD cbSendLength,
271  LPSCARD_IO_REQUEST pioRecvPci,
272  LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
273 
274  FREERDP_API LONG WINAPI Emulate_SCardGetTransmitCount(SmartcardEmulationContext* smartcard,
275  SCARDHANDLE hCard,
276  LPDWORD pcTransmitCount);
277 
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);
283 
284  FREERDP_API LONG WINAPI Emulate_SCardGetAttrib(SmartcardEmulationContext* smartcard,
285  SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr,
286  LPDWORD pcbAttrLen);
287 
288  FREERDP_API LONG WINAPI Emulate_SCardSetAttrib(SmartcardEmulationContext* smartcard,
289  SCARDHANDLE hCard, DWORD dwAttrId,
290  LPCBYTE pbAttr, DWORD cbAttrLen);
291 
292  FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardA(SmartcardEmulationContext* smartcard,
293  LPOPENCARDNAMEA_EX pDlgStruc);
294 
295  FREERDP_API LONG WINAPI Emulate_SCardUIDlgSelectCardW(SmartcardEmulationContext* smartcard,
296  LPOPENCARDNAMEW_EX pDlgStruc);
297 
298  FREERDP_API LONG WINAPI Emulate_GetOpenCardNameA(SmartcardEmulationContext* smartcard,
299  LPOPENCARDNAMEA pDlgStruc);
300 
301  FREERDP_API LONG WINAPI Emulate_GetOpenCardNameW(SmartcardEmulationContext* smartcard,
302  LPOPENCARDNAMEW pDlgStruc);
303 
304  FREERDP_API LONG WINAPI Emulate_SCardDlgExtendedError(SmartcardEmulationContext* smartcard);
305 
306  FREERDP_API LONG WINAPI Emulate_SCardReadCacheA(SmartcardEmulationContext* smartcard,
307  SCARDCONTEXT hContext, UUID* CardIdentifier,
308  DWORD FreshnessCounter, LPSTR LookupName,
309  PBYTE Data, DWORD* DataLen);
310 
311  FREERDP_API LONG WINAPI Emulate_SCardReadCacheW(SmartcardEmulationContext* smartcard,
312  SCARDCONTEXT hContext, UUID* CardIdentifier,
313  DWORD FreshnessCounter, LPWSTR LookupName,
314  PBYTE Data, DWORD* DataLen);
315 
316  FREERDP_API LONG WINAPI Emulate_SCardWriteCacheA(SmartcardEmulationContext* smartcard,
317  SCARDCONTEXT hContext, UUID* CardIdentifier,
318  DWORD FreshnessCounter, LPSTR LookupName,
319  PBYTE Data, DWORD DataLen);
320 
321  FREERDP_API LONG WINAPI Emulate_SCardWriteCacheW(SmartcardEmulationContext* smartcard,
322  SCARDCONTEXT hContext, UUID* CardIdentifier,
323  DWORD FreshnessCounter, LPWSTR LookupName,
324  PBYTE Data, DWORD DataLen);
325 
326  FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconA(SmartcardEmulationContext* smartcard,
327  SCARDCONTEXT hContext, LPCSTR szReaderName,
328  LPBYTE pbIcon, LPDWORD pcbIcon);
329 
330  FREERDP_API LONG WINAPI Emulate_SCardGetReaderIconW(SmartcardEmulationContext* smartcard,
331  SCARDCONTEXT hContext, LPCWSTR szReaderName,
332  LPBYTE pbIcon, LPDWORD pcbIcon);
333 
334  FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdA(SmartcardEmulationContext* smartcard,
335  SCARDCONTEXT hContext,
336  LPCSTR szReaderName,
337  LPDWORD pdwDeviceTypeId);
338  FREERDP_API LONG WINAPI Emulate_SCardGetDeviceTypeIdW(SmartcardEmulationContext* smartcard,
339  SCARDCONTEXT hContext,
340  LPCWSTR szReaderName,
341  LPDWORD pdwDeviceTypeId);
342 
343  FREERDP_API LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA(
344  SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szReaderName,
345  LPSTR szDeviceInstanceId, LPDWORD pcchDeviceInstanceId);
346 
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);
358 
359 #ifdef __cplusplus
360 }
361 #endif
362 
363 #endif /* WINPR_SMARTCARD_EMULATE_PRIVATE_H */