@@ -8,23 +8,26 @@ use crate::{
8
8
Handle , LpByte , LpCByte , LpCGuid , LpCStr , LpCVoid , LpCWStr , LpDword , LpGuid , LpStr , LpUuid , LpVoid , LpWStr ,
9
9
} ;
10
10
11
- pub type SCardEstablishContextFn = extern "system" fn ( u32 , * const c_void , * const c_void , LpScardContext ) -> ScardStatus ;
12
- pub type SCardReleaseContextFn = extern "system" fn ( ScardContext ) -> ScardStatus ;
13
- pub type SCardIsValidContextFn = extern "system" fn ( ScardContext ) -> ScardStatus ;
11
+ pub type SCardEstablishContextFn =
12
+ unsafe extern "system" fn ( u32 , * const c_void , * const c_void , LpScardContext ) -> ScardStatus ;
13
+ pub type SCardReleaseContextFn = unsafe extern "system" fn ( ScardContext ) -> ScardStatus ;
14
+ pub type SCardIsValidContextFn = unsafe extern "system" fn ( ScardContext ) -> ScardStatus ;
14
15
pub type SCardListReaderGroupsAFn = extern "system" fn ( ScardContext , LpStr , LpDword ) -> ScardStatus ;
15
16
pub type SCardListReaderGroupsWFn = extern "system" fn ( ScardContext , LpWStr , LpDword ) -> ScardStatus ;
16
- pub type SCardListReadersAFn = extern "system" fn ( ScardContext , LpCStr , LpStr , LpDword ) -> ScardStatus ;
17
- pub type SCardListReadersWFn = extern "system" fn ( ScardContext , LpCWStr , LpWStr , LpDword ) -> ScardStatus ;
18
- pub type SCardListCardsAFn = extern "system" fn ( ScardContext , LpCByte , LpCGuid , u32 , * mut u8 , LpDword ) -> ScardStatus ;
19
- pub type SCardListCardsWFn = extern "system" fn ( ScardContext , LpCByte , LpCGuid , u32 , * mut u16 , LpDword ) -> ScardStatus ;
17
+ pub type SCardListReadersAFn = unsafe extern "system" fn ( ScardContext , LpCStr , LpStr , LpDword ) -> ScardStatus ;
18
+ pub type SCardListReadersWFn = unsafe extern "system" fn ( ScardContext , LpCWStr , LpWStr , LpDword ) -> ScardStatus ;
19
+ pub type SCardListCardsAFn =
20
+ unsafe extern "system" fn ( ScardContext , LpCByte , LpCGuid , u32 , * mut u8 , LpDword ) -> ScardStatus ;
21
+ pub type SCardListCardsWFn =
22
+ unsafe extern "system" fn ( ScardContext , LpCByte , LpCGuid , u32 , * mut u16 , LpDword ) -> ScardStatus ;
20
23
pub type SCardListInterfacesAFn = extern "system" fn ( ScardContext , LpCStr , LpGuid , LpDword ) -> ScardStatus ;
21
24
pub type SCardListInterfacesWFn = extern "system" fn ( ScardContext , LpCWStr , LpGuid , LpDword ) -> ScardStatus ;
22
25
pub type SCardGetProviderIdAFn = extern "system" fn ( ScardContext , LpCStr , LpGuid ) -> ScardStatus ;
23
26
pub type SCardGetProviderIdWFn = extern "system" fn ( ScardContext , LpCWStr , LpGuid ) -> ScardStatus ;
24
27
pub type SCardGetCardTypeProviderNameAFn =
25
- extern "system" fn ( ScardContext , LpCStr , u32 , * mut u8 , LpDword ) -> ScardStatus ;
28
+ unsafe extern "system" fn ( ScardContext , LpCStr , u32 , * mut u8 , LpDword ) -> ScardStatus ;
26
29
pub type SCardGetCardTypeProviderNameWFn =
27
- extern "system" fn ( ScardContext , LpCWStr , u32 , * mut u16 , LpDword ) -> ScardStatus ;
30
+ unsafe extern "system" fn ( ScardContext , LpCWStr , u32 , * mut u16 , LpDword ) -> ScardStatus ;
28
31
pub type SCardIntroduceReaderGroupAFn = extern "system" fn ( ScardContext , LpCStr ) -> ScardStatus ;
29
32
pub type SCardIntroduceReaderGroupWFn = extern "system" fn ( ScardContext , LpCWStr ) -> ScardStatus ;
30
33
pub type SCardForgetReaderGroupAFn = extern "system" fn ( ScardContext , LpCStr ) -> ScardStatus ;
@@ -45,54 +48,71 @@ pub type SCardSetCardTypeProviderNameAFn = extern "system" fn(ScardContext, LpCS
45
48
pub type SCardSetCardTypeProviderNameWFn = extern "system" fn ( ScardContext , LpCWStr , u32 , LpCWStr ) -> ScardStatus ;
46
49
pub type SCardForgetCardTypeAFn = extern "system" fn ( ScardContext , LpCStr ) -> ScardStatus ;
47
50
pub type SCardForgetCardTypeWFn = extern "system" fn ( ScardContext , LpCWStr ) -> ScardStatus ;
48
- pub type SCardFreeMemoryFn = extern "system" fn ( ScardContext , LpCVoid ) -> ScardStatus ;
51
+ pub type SCardFreeMemoryFn = unsafe extern "system" fn ( ScardContext , LpCVoid ) -> ScardStatus ;
49
52
pub type SCardAccessStartedEventFn = extern "system" fn ( ) -> Handle ;
50
- pub type SCardReleaseStartedEventFn = extern "system" fn ( ) -> c_void ;
53
+ pub type SCardReleaseStartedEventFn = extern "system" fn ( ) ;
51
54
pub type SCardLocateCardsAFn = extern "system" fn ( ScardContext , LpCStr , LpScardReaderStateA , u32 ) -> ScardStatus ;
52
55
pub type SCardLocateCardsWFn = extern "system" fn ( ScardContext , LpCWStr , LpScardReaderStateW , u32 ) -> ScardStatus ;
53
56
pub type SCardLocateCardsByATRAFn =
54
57
extern "system" fn ( ScardContext , LpScardAtrMask , u32 , LpScardReaderStateA , u32 ) -> ScardStatus ;
55
58
pub type SCardLocateCardsByATRWFn =
56
59
extern "system" fn ( ScardContext , LpScardAtrMask , u32 , LpScardReaderStateW , u32 ) -> ScardStatus ;
57
- pub type SCardGetStatusChangeAFn = extern "system" fn ( ScardContext , u32 , LpScardReaderStateA , u32 ) -> ScardStatus ;
58
- pub type SCardGetStatusChangeWFn = extern "system" fn ( ScardContext , u32 , LpScardReaderStateW , u32 ) -> ScardStatus ;
60
+ pub type SCardGetStatusChangeAFn =
61
+ unsafe extern "system" fn ( ScardContext , u32 , LpScardReaderStateA , u32 ) -> ScardStatus ;
62
+ pub type SCardGetStatusChangeWFn =
63
+ unsafe extern "system" fn ( ScardContext , u32 , LpScardReaderStateW , u32 ) -> ScardStatus ;
59
64
pub type SCardCancelFn = extern "system" fn ( ScardContext ) -> ScardStatus ;
60
- pub type SCardReadCacheAFn = extern "system" fn ( ScardContext , LpUuid , u32 , LpStr , LpByte , LpDword ) -> ScardStatus ;
61
- pub type SCardReadCacheWFn = extern "system" fn ( ScardContext , LpUuid , u32 , LpWStr , LpByte , LpDword ) -> ScardStatus ;
62
- pub type SCardWriteCacheAFn = extern "system" fn ( ScardContext , LpUuid , u32 , LpStr , LpByte , u32 ) -> ScardStatus ;
63
- pub type SCardWriteCacheWFn = extern "system" fn ( ScardContext , LpUuid , u32 , LpWStr , LpByte , u32 ) -> ScardStatus ;
64
- pub type SCardGetReaderIconAFn = extern "system" fn ( ScardContext , LpCStr , LpByte , LpDword ) -> ScardStatus ;
65
- pub type SCardGetReaderIconWFn = extern "system" fn ( ScardContext , LpCWStr , LpByte , LpDword ) -> ScardStatus ;
65
+ pub type SCardReadCacheAFn =
66
+ unsafe extern "system" fn ( ScardContext , LpUuid , u32 , LpStr , LpByte , LpDword ) -> ScardStatus ;
67
+ pub type SCardReadCacheWFn =
68
+ unsafe extern "system" fn ( ScardContext , LpUuid , u32 , LpWStr , LpByte , LpDword ) -> ScardStatus ;
69
+ pub type SCardWriteCacheAFn = unsafe extern "system" fn ( ScardContext , LpUuid , u32 , LpStr , LpByte , u32 ) -> ScardStatus ;
70
+ pub type SCardWriteCacheWFn = unsafe extern "system" fn ( ScardContext , LpUuid , u32 , LpWStr , LpByte , u32 ) -> ScardStatus ;
71
+ pub type SCardGetReaderIconAFn = unsafe extern "system" fn ( ScardContext , LpCStr , LpByte , LpDword ) -> ScardStatus ;
72
+ pub type SCardGetReaderIconWFn = unsafe extern "system" fn ( ScardContext , LpCWStr , LpByte , LpDword ) -> ScardStatus ;
73
+ pub type SCardGetDeviceTypeIdAFn = unsafe extern "system" fn ( ScardContext , LpCStr , LpDword ) -> ScardStatus ;
74
+ pub type SCardGetDeviceTypeIdWFn = unsafe extern "system" fn ( ScardContext , LpCWStr , LpDword ) -> ScardStatus ;
66
75
pub type SCardGetReaderDeviceInstanceIdAFn = extern "system" fn ( ScardContext , LpCStr , LpStr , LpDword ) -> ScardStatus ;
67
76
pub type SCardGetReaderDeviceInstanceIdWFn = extern "system" fn ( ScardContext , LpCWStr , LpWStr , LpDword ) -> ScardStatus ;
68
77
pub type SCardListReadersWithDeviceInstanceIdAFn =
69
78
extern "system" fn ( ScardContext , LpCStr , LpStr , LpDword ) -> ScardStatus ;
70
79
pub type SCardListReadersWithDeviceInstanceIdWFn =
71
80
extern "system" fn ( ScardContext , LpCWStr , LpWStr , LpDword ) -> ScardStatus ;
72
81
pub type SCardAuditFn = extern "system" fn ( ScardContext , u32 ) -> ScardStatus ;
73
- pub type SCardConnectAFn = extern "system" fn ( ScardContext , LpCStr , u32 , u32 , LpScardHandle , LpDword ) -> ScardStatus ;
74
- pub type SCardConnectWFn = extern "system" fn ( ScardContext , LpCWStr , u32 , u32 , LpScardHandle , LpDword ) -> ScardStatus ;
82
+ pub type SCardConnectAFn =
83
+ unsafe extern "system" fn ( ScardContext , LpCStr , u32 , u32 , LpScardHandle , LpDword ) -> ScardStatus ;
84
+ pub type SCardConnectWFn =
85
+ unsafe extern "system" fn ( ScardContext , LpCWStr , u32 , u32 , LpScardHandle , LpDword ) -> ScardStatus ;
75
86
pub type SCardReconnectFn = extern "system" fn ( ScardHandle , u32 , u32 , u32 , LpDword ) -> ScardStatus ;
76
- pub type SCardDisconnectFn = extern "system" fn ( ScardHandle , u32 ) -> ScardStatus ;
77
- pub type SCardBeginTransactionFn = extern "system" fn ( ScardHandle ) -> ScardStatus ;
78
- pub type SCardEndTransactionFn = extern "system" fn ( ScardHandle , u32 ) -> ScardStatus ;
87
+ pub type SCardDisconnectFn = unsafe extern "system" fn ( ScardHandle , u32 ) -> ScardStatus ;
88
+ pub type SCardBeginTransactionFn = unsafe extern "system" fn ( ScardHandle ) -> ScardStatus ;
89
+ pub type SCardEndTransactionFn = unsafe extern "system" fn ( ScardHandle , u32 ) -> ScardStatus ;
79
90
pub type SCardCancelTransactionFn = extern "system" fn ( ScardHandle ) -> ScardStatus ;
80
91
pub type SCardStateFn = extern "system" fn ( ScardHandle , LpDword , LpDword , LpByte , LpDword ) -> ScardStatus ;
81
92
pub type SCardStatusAFn =
82
- extern "system" fn ( ScardHandle , LpStr , LpDword , LpDword , LpDword , LpByte , LpDword ) -> ScardStatus ;
93
+ unsafe extern "system" fn ( ScardHandle , LpStr , LpDword , LpDword , LpDword , LpByte , LpDword ) -> ScardStatus ;
83
94
pub type SCardStatusWFn =
84
- extern "system" fn ( ScardHandle , LpWStr , LpDword , LpDword , LpDword , LpByte , LpDword ) -> ScardStatus ;
85
- pub type SCardTransmitFn =
86
- extern "system" fn ( ScardHandle , LpScardIoRequest , LpCByte , u32 , LpScardIoRequest , LpByte , LpDword ) -> ScardStatus ;
95
+ unsafe extern "system" fn ( ScardHandle , LpWStr , LpDword , LpDword , LpDword , LpByte , LpDword ) -> ScardStatus ;
96
+ pub type SCardTransmitFn = unsafe extern "system" fn (
97
+ ScardHandle ,
98
+ LpScardIoRequest ,
99
+ LpCByte ,
100
+ u32 ,
101
+ LpScardIoRequest ,
102
+ LpByte ,
103
+ LpDword ,
104
+ ) -> ScardStatus ;
87
105
pub type SCardGetTransmitCountFn = extern "system" fn ( ScardHandle , LpDword ) -> ScardStatus ;
88
- pub type SCardControlFn = extern "system" fn ( ScardHandle , u32 , LpCVoid , u32 , LpVoid , u32 , LpDword ) -> ScardStatus ;
106
+ pub type SCardControlFn =
107
+ unsafe extern "system" fn ( ScardHandle , u32 , LpCVoid , u32 , LpVoid , u32 , LpDword ) -> ScardStatus ;
89
108
pub type SCardGetAttribFn = extern "system" fn ( ScardHandle , u32 , LpByte , LpDword ) -> ScardStatus ;
90
109
pub type SCardSetAttribFn = extern "system" fn ( ScardHandle , u32 , LpCByte , u32 ) -> ScardStatus ;
91
110
pub type SCardUIDlgSelectCardAFn = extern "system" fn ( LpOpenCardNameExA ) -> ScardStatus ;
92
111
pub type SCardUIDlgSelectCardWFn = extern "system" fn ( LpOpenCardNameExW ) -> ScardStatus ;
93
112
pub type GetOpenCardNameAFn = extern "system" fn ( LpOpenCardNameA ) -> ScardStatus ;
94
113
pub type GetOpenCardNameWFn = extern "system" fn ( LpOpenCardNameW ) -> ScardStatus ;
95
- pub type SCardDlgExtendedErrorFn = extern "system" fn ( ) -> i32 ;
114
+ // Not a part of the standard winscard.h API
115
+ pub type GetSCardApiFunctionTableFn = extern "system" fn ( ) -> PSCardApiFunctionTable ;
96
116
97
117
// https://github.com/FreeRDP/FreeRDP/blob/88f79c5748f4031cb50dfae3ebadcc6619b69f1c/winpr/include/winpr/smartcard.h#L1114
98
118
#[ repr( C ) ]
@@ -161,13 +181,14 @@ pub struct SCardApiFunctionTable {
161
181
pub SCardUIDlgSelectCardW : SCardUIDlgSelectCardWFn ,
162
182
pub GetOpenCardNameA : GetOpenCardNameAFn ,
163
183
pub GetOpenCardNameW : GetOpenCardNameWFn ,
164
- pub SCardDlgExtendedError : SCardDlgExtendedErrorFn ,
165
184
pub SCardReadCacheA : SCardReadCacheAFn ,
166
185
pub SCardReadCacheW : SCardReadCacheWFn ,
167
186
pub SCardWriteCacheA : SCardWriteCacheAFn ,
168
187
pub SCardWriteCacheW : SCardWriteCacheWFn ,
169
188
pub SCardGetReaderIconA : SCardGetReaderIconAFn ,
170
189
pub SCardGetReaderIconW : SCardGetReaderIconWFn ,
190
+ pub SCardGetDeviceTypeIdA : SCardGetDeviceTypeIdAFn ,
191
+ pub SCardGetDeviceTypeIdW : SCardGetDeviceTypeIdWFn ,
171
192
pub SCardGetReaderDeviceInstanceIdA : SCardGetReaderDeviceInstanceIdAFn ,
172
193
pub SCardGetReaderDeviceInstanceIdW : SCardGetReaderDeviceInstanceIdWFn ,
173
194
pub SCardListReadersWithDeviceInstanceIdA : SCardListReadersWithDeviceInstanceIdAFn ,
0 commit comments