FreeRDP
scard.h
1 
21 #ifndef FREERDP_CHANNEL_SCARD_H
22 #define FREERDP_CHANNEL_SCARD_H
23 
24 #include <winpr/crt.h>
25 #include <winpr/smartcard.h>
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
32 #define RDP_SCARD_CTL_CODE(code) \
33  CTL_CODE(FILE_DEVICE_FILE_SYSTEM, (code), METHOD_BUFFERED, FILE_ANY_ACCESS)
34 
35 #define SCARD_IOCTL_ESTABLISHCONTEXT RDP_SCARD_CTL_CODE(5) /* SCardEstablishContext */
36 #define SCARD_IOCTL_RELEASECONTEXT RDP_SCARD_CTL_CODE(6) /* SCardReleaseContext */
37 #define SCARD_IOCTL_ISVALIDCONTEXT RDP_SCARD_CTL_CODE(7) /* SCardIsValidContext */
38 #define SCARD_IOCTL_LISTREADERGROUPSA RDP_SCARD_CTL_CODE(8) /* SCardListReaderGroupsA */
39 #define SCARD_IOCTL_LISTREADERGROUPSW RDP_SCARD_CTL_CODE(9) /* SCardListReaderGroupsW */
40 #define SCARD_IOCTL_LISTREADERSA RDP_SCARD_CTL_CODE(10) /* SCardListReadersA */
41 #define SCARD_IOCTL_LISTREADERSW RDP_SCARD_CTL_CODE(11) /* SCardListReadersW */
42 #define SCARD_IOCTL_INTRODUCEREADERGROUPA RDP_SCARD_CTL_CODE(20) /* SCardIntroduceReaderGroupA */
43 #define SCARD_IOCTL_INTRODUCEREADERGROUPW RDP_SCARD_CTL_CODE(21) /* SCardIntroduceReaderGroupW */
44 #define SCARD_IOCTL_FORGETREADERGROUPA RDP_SCARD_CTL_CODE(22) /* SCardForgetReaderGroupA */
45 #define SCARD_IOCTL_FORGETREADERGROUPW RDP_SCARD_CTL_CODE(23) /* SCardForgetReaderGroupW */
46 #define SCARD_IOCTL_INTRODUCEREADERA RDP_SCARD_CTL_CODE(24) /* SCardIntroduceReaderA */
47 #define SCARD_IOCTL_INTRODUCEREADERW RDP_SCARD_CTL_CODE(25) /* SCardIntroduceReaderW */
48 #define SCARD_IOCTL_FORGETREADERA RDP_SCARD_CTL_CODE(26) /* SCardForgetReaderA */
49 #define SCARD_IOCTL_FORGETREADERW RDP_SCARD_CTL_CODE(27) /* SCardForgetReaderW */
50 #define SCARD_IOCTL_ADDREADERTOGROUPA RDP_SCARD_CTL_CODE(28) /* SCardAddReaderToGroupA */
51 #define SCARD_IOCTL_ADDREADERTOGROUPW RDP_SCARD_CTL_CODE(29) /* SCardAddReaderToGroupW */
52 #define SCARD_IOCTL_REMOVEREADERFROMGROUPA \
53  RDP_SCARD_CTL_CODE(30) /* SCardRemoveReaderFromGroupA \
54  */
55 #define SCARD_IOCTL_REMOVEREADERFROMGROUPW \
56  RDP_SCARD_CTL_CODE(31) /* SCardRemoveReaderFromGroupW \
57  */
58 #define SCARD_IOCTL_LOCATECARDSA RDP_SCARD_CTL_CODE(38) /* SCardLocateCardsA */
59 #define SCARD_IOCTL_LOCATECARDSW RDP_SCARD_CTL_CODE(39) /* SCardLocateCardsW */
60 #define SCARD_IOCTL_GETSTATUSCHANGEA RDP_SCARD_CTL_CODE(40) /* SCardGetStatusChangeA */
61 #define SCARD_IOCTL_GETSTATUSCHANGEW RDP_SCARD_CTL_CODE(41) /* SCardGetStatusChangeW */
62 #define SCARD_IOCTL_CANCEL RDP_SCARD_CTL_CODE(42) /* SCardCancel */
63 #define SCARD_IOCTL_CONNECTA RDP_SCARD_CTL_CODE(43) /* SCardConnectA */
64 #define SCARD_IOCTL_CONNECTW RDP_SCARD_CTL_CODE(44) /* SCardConnectW */
65 #define SCARD_IOCTL_RECONNECT RDP_SCARD_CTL_CODE(45) /* SCardReconnect */
66 #define SCARD_IOCTL_DISCONNECT RDP_SCARD_CTL_CODE(46) /* SCardDisconnect */
67 #define SCARD_IOCTL_BEGINTRANSACTION RDP_SCARD_CTL_CODE(47) /* SCardBeginTransaction */
68 #define SCARD_IOCTL_ENDTRANSACTION RDP_SCARD_CTL_CODE(48) /* SCardEndTransaction */
69 #define SCARD_IOCTL_STATE RDP_SCARD_CTL_CODE(49) /* SCardState */
70 #define SCARD_IOCTL_STATUSA RDP_SCARD_CTL_CODE(50) /* SCardStatusA */
71 #define SCARD_IOCTL_STATUSW RDP_SCARD_CTL_CODE(51) /* SCardStatusW */
72 #define SCARD_IOCTL_TRANSMIT RDP_SCARD_CTL_CODE(52) /* SCardTransmit */
73 #define SCARD_IOCTL_CONTROL RDP_SCARD_CTL_CODE(53) /* SCardControl */
74 #define SCARD_IOCTL_GETATTRIB RDP_SCARD_CTL_CODE(54) /* SCardGetAttrib */
75 #define SCARD_IOCTL_SETATTRIB RDP_SCARD_CTL_CODE(55) /* SCardSetAttrib */
76 #define SCARD_IOCTL_ACCESSSTARTEDEVENT RDP_SCARD_CTL_CODE(56) /* SCardAccessStartedEvent */
77 #define SCARD_IOCTL_RELEASETARTEDEVENT RDP_SCARD_CTL_CODE(57) /* SCardReleaseStartedEvent */
78 #define SCARD_IOCTL_LOCATECARDSBYATRA RDP_SCARD_CTL_CODE(58) /* SCardLocateCardsByATRA */
79 #define SCARD_IOCTL_LOCATECARDSBYATRW RDP_SCARD_CTL_CODE(59) /* SCardLocateCardsByATRW */
80 #define SCARD_IOCTL_READCACHEA RDP_SCARD_CTL_CODE(60) /* SCardReadCacheA */
81 #define SCARD_IOCTL_READCACHEW RDP_SCARD_CTL_CODE(61) /* SCardReadCacheW */
82 #define SCARD_IOCTL_WRITECACHEA RDP_SCARD_CTL_CODE(62) /* SCardWriteCacheA */
83 #define SCARD_IOCTL_WRITECACHEW RDP_SCARD_CTL_CODE(63) /* SCardWriteCacheW */
84 #define SCARD_IOCTL_GETTRANSMITCOUNT RDP_SCARD_CTL_CODE(64) /* SCardGetTransmitCount */
85 #define SCARD_IOCTL_GETREADERICON RDP_SCARD_CTL_CODE(65) /* SCardGetReaderIconA */
86 #define SCARD_IOCTL_GETDEVICETYPEID RDP_SCARD_CTL_CODE(66) /* SCardGetDeviceTypeIdA */
87 
88 #pragma pack(push, 1)
89 
90 /* interface type_scard_pack */
91 /* [unique][version][uuid] */
92 
93 typedef struct
94 {
95  /* [range] */ DWORD cbContext;
96  /* [size_is][unique] */ BYTE pbContext[8];
98 
99 typedef struct
100 {
101  /* [range] */ DWORD cbHandle;
102  /* [size_is] */ BYTE pbHandle[8];
104 
105 typedef struct
106 {
107  LONG ReturnCode;
109 
110 typedef struct
111 {
112  LONG ReturnCode;
113  /* [range] */ DWORD cBytes;
114  /* [size_is][unique] */ BYTE* msz;
116 
117 typedef struct
118 {
119  LONG ReturnCode;
120  REDIR_SCARDCONTEXT hContext;
122 
123 typedef struct
124 {
125  DWORD dwCurrentState;
126  DWORD dwEventState;
127  /* [range] */ DWORD cbAtr;
128  BYTE rgbAtr[36];
130 
131 typedef struct
132 {
133  /* [range] */ DWORD cbAtr;
134  BYTE rgbAtr[36];
135  BYTE rgbMask[36];
137 
138 typedef struct
139 {
140  LONG ReturnCode;
141  /* [range] */ DWORD cReaders;
142  /* [size_is] */ ReaderState_Return* rgReaderStates;
144 
145 typedef struct
146 {
147  LONG ReturnCode;
148  ULONG cbDataLen;
149  BYTE* pbData;
151 
152 typedef struct
153 {
154  LONG ReturnCode;
155  ULONG dwDeviceId;
157 
158 typedef struct
159 {
160  LONG ReturnCode;
161  REDIR_SCARDCONTEXT hContext;
162  REDIR_SCARDHANDLE hCard;
163  DWORD dwActiveProtocol;
165 
166 typedef struct
167 {
168  LONG ReturnCode;
169  DWORD dwActiveProtocol;
171 
172 typedef struct
173 {
174  LONG ReturnCode;
175  DWORD dwState;
176  DWORD dwProtocol;
177  /* [range] */ DWORD cbAtrLen;
178  /* [size_is][unique] */ BYTE rgAtr[36];
180 
181 typedef struct
182 {
183  LONG ReturnCode;
184  /* [range] */ DWORD cBytes;
185  /* [size_is][unique] */ BYTE* mszReaderNames;
186  DWORD dwState;
187  DWORD dwProtocol;
188  BYTE pbAtr[32];
189  /* [range] */ DWORD cbAtrLen;
191 
192 typedef struct
193 {
194  DWORD dwProtocol;
195  /* [range] */ DWORD cbExtraBytes;
196  /* [size_is][unique] */ BYTE* pbExtraBytes;
198 
199 typedef struct
200 {
201  LONG ReturnCode;
202  /* [unique] */ LPSCARD_IO_REQUEST pioRecvPci;
203  /* [range] */ DWORD cbRecvLength;
204  /* [size_is][unique] */ BYTE* pbRecvBuffer;
206 
207 typedef struct
208 {
209  LONG ReturnCode;
210  DWORD cTransmitCount;
212 
213 typedef struct
214 {
215  LONG ReturnCode;
216  /* [range] */ DWORD cbOutBufferSize;
217  /* [size_is][unique] */ BYTE* pvOutBuffer;
219 
220 typedef struct
221 {
222  LONG ReturnCode;
223  /* [range] */ DWORD cbAttrLen;
224  /* [size_is][unique] */ BYTE* pbAttr;
226 
227 typedef struct
228 {
229  LONG ReturnCode;
230  /* [range] */ DWORD cbDataLen;
231  /* [size_is][unique] */ BYTE* pbData;
233 #pragma pack(pop)
234 
235 typedef struct
236 {
237  REDIR_SCARDCONTEXT hContext;
238  REDIR_SCARDHANDLE hCard;
240 
241 typedef struct
242 {
243  Handles_Call handles;
244  LONG fmszGroupsIsNULL;
245  DWORD cchGroups;
247 
248 typedef struct
249 {
250  Handles_Call handles;
251  /* [range] */ DWORD cBytes;
252  /* [size_is][unique] */ BYTE* mszGroups;
253  LONG fmszReadersIsNULL;
254  DWORD cchReaders;
256 
257 typedef struct
258 {
259  Handles_Call handles;
260  DWORD dwTimeOut;
261  /* [range] */ DWORD cReaders;
262  /* [size_is] */ LPSCARD_READERSTATEA rgReaderStates;
264 
265 typedef struct
266 {
267  Handles_Call handles;
268  /* [range] */ DWORD cBytes;
269  /* [size_is] */ CHAR* mszCards;
270  /* [range] */ DWORD cReaders;
271  /* [size_is] */ LPSCARD_READERSTATEA rgReaderStates;
273 
274 typedef struct
275 {
276  Handles_Call handles;
277  /* [range] */ DWORD cBytes;
278  /* [size_is] */ WCHAR* mszCards;
279  /* [range] */ DWORD cReaders;
280  /* [size_is] */ LPSCARD_READERSTATEW rgReaderStates;
282 
283 typedef struct
284 {
285  Handles_Call handles;
286  /* [range] */ DWORD cAtrs;
287  /* [size_is] */ LocateCards_ATRMask* rgAtrMasks;
288  /* [range] */ DWORD cReaders;
289  /* [size_is] */ LPSCARD_READERSTATEA rgReaderStates;
291 
292 typedef struct
293 {
294  Handles_Call handles;
295  /* [range] */ DWORD cAtrs;
296  /* [size_is] */ LocateCards_ATRMask* rgAtrMasks;
297  /* [range] */ DWORD cReaders;
298  /* [size_is] */ LPSCARD_READERSTATEW rgReaderStates;
300 
301 typedef struct
302 {
303  Handles_Call handles;
304  DWORD dwTimeOut;
305  /* [range] */ DWORD cReaders;
306  /* [size_is] */ LPSCARD_READERSTATEW rgReaderStates;
308 
309 typedef struct
310 {
311  Handles_Call handles;
312  WCHAR* szReaderName;
314 
315 typedef struct
316 {
317  Handles_Call handles;
318  WCHAR* szReaderName;
320 
321 typedef struct
322 {
323  Handles_Call handles;
324  DWORD dwShareMode;
325  DWORD dwPreferredProtocols;
327 
328 typedef struct
329 {
330  Connect_Common_Call Common;
331  /* [string] */ CHAR* szReader;
333 
334 typedef struct
335 {
336  Connect_Common_Call Common;
337  /* [string] */ WCHAR* szReader;
339 
340 typedef struct
341 {
342  Handles_Call handles;
343  DWORD dwShareMode;
344  DWORD dwPreferredProtocols;
345  DWORD dwInitialization;
347 
348 typedef struct
349 {
350  Handles_Call handles;
351  DWORD dwDisposition;
353 
354 typedef struct
355 {
356  Handles_Call handles;
357  LONG fpbAtrIsNULL;
358  DWORD cbAtrLen;
360 
361 typedef struct
362 {
363  Handles_Call handles;
364  LONG fmszReaderNamesIsNULL;
365  DWORD cchReaderLen;
366  DWORD cbAtrLen;
368 
369 typedef struct
370 {
371  Handles_Call handles;
372  LPSCARD_IO_REQUEST pioSendPci;
373  /* [range] */ DWORD cbSendLength;
374  /* [size_is] */ BYTE* pbSendBuffer;
375  /* [unique] */ LPSCARD_IO_REQUEST pioRecvPci;
376  LONG fpbRecvBufferIsNULL;
377  DWORD cbRecvLength;
379 
380 typedef struct
381 {
382  Handles_Call handles;
383  LONG LongValue;
385 
386 typedef struct
387 {
388  Handles_Call handles;
390 
391 typedef struct
392 {
393  Handles_Call handles;
394  /* [string] */ char* sz;
396 
397 typedef struct
398 {
399  Handles_Call handles;
400  /* [string] */ WCHAR* sz;
402 
403 typedef struct
404 {
405  Handles_Call handles;
406  /* [string] */ char* sz1;
407  /* [string] */ char* sz2;
409 
410 typedef struct
411 {
412  Handles_Call handles;
413  /* [string] */ WCHAR* sz1;
414  /* [string] */ WCHAR* sz2;
416 
417 typedef struct
418 {
419  Handles_Call handles;
420  DWORD dwScope;
422 
423 typedef struct
424 {
425  Handles_Call handles;
427 
428 typedef struct
429 {
430  Handles_Call handles;
431  DWORD dwControlCode;
432  /* [range] */ DWORD cbInBufferSize;
433  /* [size_is][unique] */ BYTE* pvInBuffer;
434  LONG fpvOutBufferIsNULL;
435  DWORD cbOutBufferSize;
437 
438 typedef struct
439 {
440  Handles_Call handles;
441  DWORD dwAttrId;
442  LONG fpbAttrIsNULL;
443  DWORD cbAttrLen;
445 
446 typedef struct
447 {
448  Handles_Call handles;
449  DWORD dwAttrId;
450  /* [range] */ DWORD cbAttrLen;
451  /* [size_is] */ BYTE* pbAttr;
453 
454 typedef struct
455 {
456  Handles_Call handles;
457  UUID* CardIdentifier;
458  DWORD FreshnessCounter;
459  LONG fPbDataIsNULL;
460  DWORD cbDataLen;
462 
463 typedef struct
464 {
465  ReadCache_Common Common;
466  /* [string] */ char* szLookupName;
468 
469 typedef struct
470 {
471  ReadCache_Common Common;
472  /* [string] */ WCHAR* szLookupName;
474 
475 typedef struct
476 {
477  Handles_Call handles;
478  UUID* CardIdentifier;
479  DWORD FreshnessCounter;
480  /* [range] */ DWORD cbDataLen;
481  /* [size_is][unique] */ BYTE* pbData;
483 
484 typedef struct
485 {
486  WriteCache_Common Common;
487  /* [string] */ char* szLookupName;
489 
490 typedef struct
491 {
492  WriteCache_Common Common;
493  /* [string] */ WCHAR* szLookupName;
495 
496 #ifdef __cplusplus
497 }
498 #endif
499 
500 #endif /* FREERDP_CHANNEL_SCARD_H */