1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! Security Support Provider Interface Prototypes and structure definitions
7 use ctypes::{c_char, c_int, c_uchar, c_ulong, c_ushort, c_void};
8 use shared::basetsd::ULONG_PTR;
9 use shared::guiddef::GUID;
10 use shared::minwindef::{PUCHAR, ULONG, USHORT};
11 use um::subauth::PUNICODE_STRING;
12 use um::wincred::{PCREDUI_INFOA, PCREDUI_INFOW};
13 use um::winnt::{
14     ANYSIZE_ARRAY, BOOLEAN, CHAR, HANDLE, LARGE_INTEGER, LONG, LPSTR, LPWSTR, LUID, PCSTR, PCWSTR,
15     PVOID, WCHAR
16 };
17 pub type SEC_WCHAR = WCHAR;
18 pub type SEC_CHAR = CHAR;
19 pub type SECURITY_STATUS = LONG;
20 STRUCT!{struct SecHandle {
21     dwLower: ULONG_PTR,
22     dwUpper: ULONG_PTR,
23 }}
24 pub type PSecHandle = *mut SecHandle;
25 pub const SEC_DELETED_HANDLE: ULONG_PTR = 2;
26 pub type CredHandle = SecHandle;
27 pub type PCredHandle = PSecHandle;
28 pub type CtxtHandle = SecHandle;
29 pub type PCtxtHandle = PSecHandle;
30 pub type SECURITY_INTEGER = LARGE_INTEGER;
31 pub type PSECURITY_INTEGER = *mut LARGE_INTEGER;
32 pub type TimeStamp = SECURITY_INTEGER;
33 pub type PTimeStamp = *mut SECURITY_INTEGER;
34 STRUCT!{struct SECURITY_STRING {
35     Length: c_ushort,
36     MaximumLength: c_ushort,
37     Buffer: *mut c_ushort,
38 }}
39 pub type PSECURITY_STRING = *mut SECURITY_STRING;
40 STRUCT!{struct SecPkgInfoW {
41     fCapabilities: c_ulong,
42     wVersion: c_ushort,
43     wRPCID: c_ushort,
44     cbMaxToken: c_ulong,
45     Name: *mut SEC_WCHAR,
46     Comment: *mut SEC_WCHAR,
47 }}
48 pub type PSecPkgInfoW = *mut SecPkgInfoW;
49 STRUCT!{struct SecPkgInfoA {
50     fCapabilities: c_ulong,
51     wVersion: c_ushort,
52     wRPCID: c_ushort,
53     cbMaxToken: c_ulong,
54     Name: *mut SEC_CHAR,
55     Comment: *mut SEC_CHAR,
56 }}
57 pub type PSecPkgInfoA = *mut SecPkgInfoA;
58 pub const SECPKG_FLAG_INTEGRITY: c_ulong = 0x00000001;
59 pub const SECPKG_FLAG_PRIVACY: c_ulong = 0x00000002;
60 pub const SECPKG_FLAG_TOKEN_ONLY: c_ulong = 0x00000004;
61 pub const SECPKG_FLAG_DATAGRAM: c_ulong = 0x00000008;
62 pub const SECPKG_FLAG_CONNECTION: c_ulong = 0x00000010;
63 pub const SECPKG_FLAG_MULTI_REQUIRED: c_ulong = 0x00000020;
64 pub const SECPKG_FLAG_CLIENT_ONLY: c_ulong = 0x00000040;
65 pub const SECPKG_FLAG_EXTENDED_ERROR: c_ulong = 0x00000080;
66 pub const SECPKG_FLAG_IMPERSONATION: c_ulong = 0x00000100;
67 pub const SECPKG_FLAG_ACCEPT_WIN32_NAME: c_ulong = 0x00000200;
68 pub const SECPKG_FLAG_STREAM: c_ulong = 0x00000400;
69 pub const SECPKG_FLAG_NEGOTIABLE: c_ulong = 0x00000800;
70 pub const SECPKG_FLAG_GSS_COMPATIBLE: c_ulong = 0x00001000;
71 pub const SECPKG_FLAG_LOGON: c_ulong = 0x00002000;
72 pub const SECPKG_FLAG_ASCII_BUFFERS: c_ulong = 0x00004000;
73 pub const SECPKG_FLAG_FRAGMENT: c_ulong = 0x00008000;
74 pub const SECPKG_FLAG_MUTUAL_AUTH: c_ulong = 0x00010000;
75 pub const SECPKG_FLAG_DELEGATION: c_ulong = 0x00020000;
76 pub const SECPKG_FLAG_READONLY_WITH_CHECKSUM: c_ulong = 0x00040000;
77 pub const SECPKG_FLAG_RESTRICTED_TOKENS: c_ulong = 0x00080000;
78 pub const SECPKG_FLAG_NEGO_EXTENDER: c_ulong = 0x00100000;
79 pub const SECPKG_FLAG_NEGOTIABLE2: c_ulong = 0x00200000;
80 pub const SECPKG_FLAG_APPCONTAINER_PASSTHROUGH: c_ulong = 0x00400000;
81 pub const SECPKG_FLAG_APPCONTAINER_CHECKS: c_ulong = 0x00800000;
82 pub const SECPKG_ID_NONE: c_ulong = 0xFFFF;
83 pub const SECPKG_CALLFLAGS_APPCONTAINER: c_ulong = 0x00000001;
84 pub const SECPKG_CALLFLAGS_APPCONTAINER_AUTHCAPABLE: c_ulong = 0x00000002;
85 pub const SECPKG_CALLFLAGS_FORCE_SUPPLIED: c_ulong = 0x00000004;
86 STRUCT!{struct SecBuffer {
87     cbBuffer: c_ulong,
88     BufferType: c_ulong,
89     pvBuffer: *mut c_void,
90 }}
91 pub type PSecBuffer = *mut SecBuffer;
92 STRUCT!{struct SecBufferDesc {
93     ulVersion: c_ulong,
94     cBuffers: c_ulong,
95     pBuffers: PSecBuffer,
96 }}
97 pub type PSecBufferDesc = *mut SecBufferDesc;
98 pub const SECBUFFER_VERSION: c_ulong = 0;
99 pub const SECBUFFER_EMPTY: c_ulong = 0;
100 pub const SECBUFFER_DATA: c_ulong = 1;
101 pub const SECBUFFER_TOKEN: c_ulong = 2;
102 pub const SECBUFFER_PKG_PARAMS: c_ulong = 3;
103 pub const SECBUFFER_MISSING: c_ulong = 4;
104 pub const SECBUFFER_EXTRA: c_ulong = 5;
105 pub const SECBUFFER_STREAM_TRAILER: c_ulong = 6;
106 pub const SECBUFFER_STREAM_HEADER: c_ulong = 7;
107 pub const SECBUFFER_NEGOTIATION_INFO: c_ulong = 8;
108 pub const SECBUFFER_PADDING: c_ulong = 9;
109 pub const SECBUFFER_STREAM: c_ulong = 10;
110 pub const SECBUFFER_MECHLIST: c_ulong = 11;
111 pub const SECBUFFER_MECHLIST_SIGNATURE: c_ulong = 12;
112 pub const SECBUFFER_TARGET: c_ulong = 13;
113 pub const SECBUFFER_CHANNEL_BINDINGS: c_ulong = 14;
114 pub const SECBUFFER_CHANGE_PASS_RESPONSE: c_ulong = 15;
115 pub const SECBUFFER_TARGET_HOST: c_ulong = 16;
116 pub const SECBUFFER_ALERT: c_ulong = 17;
117 pub const SECBUFFER_APPLICATION_PROTOCOLS: c_ulong = 18;
118 pub const SECBUFFER_ATTRMASK: c_ulong = 0xF0000000;
119 pub const SECBUFFER_READONLY: c_ulong = 0x80000000;
120 pub const SECBUFFER_READONLY_WITH_CHECKSUM: c_ulong = 0x10000000;
121 pub const SECBUFFER_RESERVED: c_ulong = 0x60000000;
122 STRUCT!{struct SEC_NEGOTIATION_INFO {
123     Size: c_ulong,
124     NameLength: c_ulong,
125     Name: *mut SEC_WCHAR,
126     Reserved: *mut c_void,
127 }}
128 pub type PSEC_NEGOTIATION_INFO = *mut SEC_NEGOTIATION_INFO;
129 STRUCT!{struct SEC_CHANNEL_BINDINGS {
130     dwInitiatorAddrType: c_ulong,
131     cbInitiatorLength: c_ulong,
132     dwInitiatorOffset: c_ulong,
133     dwAcceptorAddrType: c_ulong,
134     cbAcceptorLength: c_ulong,
135     dwAcceptorOffset: c_ulong,
136     cbApplicationDataLength: c_ulong,
137     dwApplicationDataOffset: c_ulong,
138 }}
139 pub type PSEC_CHANNEL_BINDINGS = *mut SEC_CHANNEL_BINDINGS;
140 ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT {
141     SecApplicationProtocolNegotiationExt_None,
142     SecApplicationProtocolNegotiationExt_NPN,
143     SecApplicationProtocolNegotiationExt_ALPN,
144 }}
145 pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT = *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT;
146 STRUCT!{struct SEC_APPLICATION_PROTOCOL_LIST {
147     ProtoNegoExt: SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT,
148     ProtocolListSize: c_ushort,
149     ProtocolList: [c_uchar; 0],
150 }}
151 pub type PSEC_APPLICATION_PROTOCOL_LIST = *mut SEC_APPLICATION_PROTOCOL_LIST;
152 STRUCT!{struct SEC_APPLICATION_PROTOCOLS {
153     ProtocolListsSize: c_ulong,
154     ProtocolLists: [SEC_APPLICATION_PROTOCOL_LIST; ANYSIZE_ARRAY],
155 }}
156 pub type PSEC_APPLICATION_PROTOCOLS = *mut SEC_APPLICATION_PROTOCOLS;
157 pub const SECURITY_NATIVE_DREP: c_ulong = 0x00000010;
158 pub const SECURITY_NETWORK_DREP: c_ulong = 0x00000000;
159 pub const SECPKG_CRED_INBOUND: c_ulong = 0x00000001;
160 pub const SECPKG_CRED_OUTBOUND: c_ulong = 0x00000002;
161 pub const SECPKG_CRED_BOTH: c_ulong = 0x00000003;
162 pub const SECPKG_CRED_DEFAULT: c_ulong = 0x00000004;
163 pub const SECPKG_CRED_RESERVED: c_ulong = 0xF0000000;
164 pub const SECPKG_CRED_AUTOLOGON_RESTRICTED: c_ulong = 0x00000010;
165 pub const SECPKG_CRED_PROCESS_POLICY_ONLY: c_ulong = 0x00000020;
166 pub const ISC_REQ_DELEGATE: c_ulong = 0x00000001;
167 pub const ISC_REQ_MUTUAL_AUTH: c_ulong = 0x00000002;
168 pub const ISC_REQ_REPLAY_DETECT: c_ulong = 0x00000004;
169 pub const ISC_REQ_SEQUENCE_DETECT: c_ulong = 0x00000008;
170 pub const ISC_REQ_CONFIDENTIALITY: c_ulong = 0x00000010;
171 pub const ISC_REQ_USE_SESSION_KEY: c_ulong = 0x00000020;
172 pub const ISC_REQ_PROMPT_FOR_CREDS: c_ulong = 0x00000040;
173 pub const ISC_REQ_USE_SUPPLIED_CREDS: c_ulong = 0x00000080;
174 pub const ISC_REQ_ALLOCATE_MEMORY: c_ulong = 0x00000100;
175 pub const ISC_REQ_USE_DCE_STYLE: c_ulong = 0x00000200;
176 pub const ISC_REQ_DATAGRAM: c_ulong = 0x00000400;
177 pub const ISC_REQ_CONNECTION: c_ulong = 0x00000800;
178 pub const ISC_REQ_CALL_LEVEL: c_ulong = 0x00001000;
179 pub const ISC_REQ_FRAGMENT_SUPPLIED: c_ulong = 0x00002000;
180 pub const ISC_REQ_EXTENDED_ERROR: c_ulong = 0x00004000;
181 pub const ISC_REQ_STREAM: c_ulong = 0x00008000;
182 pub const ISC_REQ_INTEGRITY: c_ulong = 0x00010000;
183 pub const ISC_REQ_IDENTIFY: c_ulong = 0x00020000;
184 pub const ISC_REQ_NULL_SESSION: c_ulong = 0x00040000;
185 pub const ISC_REQ_MANUAL_CRED_VALIDATION: c_ulong = 0x00080000;
186 pub const ISC_REQ_RESERVED1: c_ulong = 0x00100000;
187 pub const ISC_REQ_FRAGMENT_TO_FIT: c_ulong = 0x00200000;
188 pub const ISC_REQ_FORWARD_CREDENTIALS: c_ulong = 0x00400000;
189 pub const ISC_REQ_NO_INTEGRITY: c_ulong = 0x00800000;
190 pub const ISC_REQ_USE_HTTP_STYLE: c_ulong = 0x01000000;
191 pub const ISC_REQ_UNVERIFIED_TARGET_NAME: c_ulong = 0x20000000;
192 pub const ISC_REQ_CONFIDENTIALITY_ONLY: c_ulong = 0x40000000;
193 pub const ISC_RET_DELEGATE: c_ulong = 0x00000001;
194 pub const ISC_RET_MUTUAL_AUTH: c_ulong = 0x00000002;
195 pub const ISC_RET_REPLAY_DETECT: c_ulong = 0x00000004;
196 pub const ISC_RET_SEQUENCE_DETECT: c_ulong = 0x00000008;
197 pub const ISC_RET_CONFIDENTIALITY: c_ulong = 0x00000010;
198 pub const ISC_RET_USE_SESSION_KEY: c_ulong = 0x00000020;
199 pub const ISC_RET_USED_COLLECTED_CREDS: c_ulong = 0x00000040;
200 pub const ISC_RET_USED_SUPPLIED_CREDS: c_ulong = 0x00000080;
201 pub const ISC_RET_ALLOCATED_MEMORY: c_ulong = 0x00000100;
202 pub const ISC_RET_USED_DCE_STYLE: c_ulong = 0x00000200;
203 pub const ISC_RET_DATAGRAM: c_ulong = 0x00000400;
204 pub const ISC_RET_CONNECTION: c_ulong = 0x00000800;
205 pub const ISC_RET_INTERMEDIATE_RETURN: c_ulong = 0x00001000;
206 pub const ISC_RET_CALL_LEVEL: c_ulong = 0x00002000;
207 pub const ISC_RET_EXTENDED_ERROR: c_ulong = 0x00004000;
208 pub const ISC_RET_STREAM: c_ulong = 0x00008000;
209 pub const ISC_RET_INTEGRITY: c_ulong = 0x00010000;
210 pub const ISC_RET_IDENTIFY: c_ulong = 0x00020000;
211 pub const ISC_RET_NULL_SESSION: c_ulong = 0x00040000;
212 pub const ISC_RET_MANUAL_CRED_VALIDATION: c_ulong = 0x00080000;
213 pub const ISC_RET_RESERVED1: c_ulong = 0x00100000;
214 pub const ISC_RET_FRAGMENT_ONLY: c_ulong = 0x00200000;
215 pub const ISC_RET_FORWARD_CREDENTIALS: c_ulong = 0x00400000;
216 pub const ISC_RET_USED_HTTP_STYLE: c_ulong = 0x01000000;
217 pub const ISC_RET_NO_ADDITIONAL_TOKEN: c_ulong = 0x02000000;
218 pub const ISC_RET_REAUTHENTICATION: c_ulong = 0x08000000;
219 pub const ISC_RET_CONFIDENTIALITY_ONLY: c_ulong = 0x40000000;
220 pub const ASC_REQ_DELEGATE: c_ulong = 0x00000001;
221 pub const ASC_REQ_MUTUAL_AUTH: c_ulong = 0x00000002;
222 pub const ASC_REQ_REPLAY_DETECT: c_ulong = 0x00000004;
223 pub const ASC_REQ_SEQUENCE_DETECT: c_ulong = 0x00000008;
224 pub const ASC_REQ_CONFIDENTIALITY: c_ulong = 0x00000010;
225 pub const ASC_REQ_USE_SESSION_KEY: c_ulong = 0x00000020;
226 pub const ASC_REQ_SESSION_TICKET: c_ulong = 0x00000040;
227 pub const ASC_REQ_ALLOCATE_MEMORY: c_ulong = 0x00000100;
228 pub const ASC_REQ_USE_DCE_STYLE: c_ulong = 0x00000200;
229 pub const ASC_REQ_DATAGRAM: c_ulong = 0x00000400;
230 pub const ASC_REQ_CONNECTION: c_ulong = 0x00000800;
231 pub const ASC_REQ_CALL_LEVEL: c_ulong = 0x00001000;
232 pub const ASC_REQ_EXTENDED_ERROR: c_ulong = 0x00008000;
233 pub const ASC_REQ_STREAM: c_ulong = 0x00010000;
234 pub const ASC_REQ_INTEGRITY: c_ulong = 0x00020000;
235 pub const ASC_REQ_LICENSING: c_ulong = 0x00040000;
236 pub const ASC_REQ_IDENTIFY: c_ulong = 0x00080000;
237 pub const ASC_REQ_ALLOW_NULL_SESSION: c_ulong = 0x00100000;
238 pub const ASC_REQ_ALLOW_NON_USER_LOGONS: c_ulong = 0x00200000;
239 pub const ASC_REQ_ALLOW_CONTEXT_REPLAY: c_ulong = 0x00400000;
240 pub const ASC_REQ_FRAGMENT_TO_FIT: c_ulong = 0x00800000;
241 pub const ASC_REQ_FRAGMENT_SUPPLIED: c_ulong = 0x00002000;
242 pub const ASC_REQ_NO_TOKEN: c_ulong = 0x01000000;
243 pub const ASC_REQ_PROXY_BINDINGS: c_ulong = 0x04000000;
244 pub const ASC_REQ_ALLOW_MISSING_BINDINGS: c_ulong = 0x10000000;
245 pub const ASC_RET_DELEGATE: c_ulong = 0x00000001;
246 pub const ASC_RET_MUTUAL_AUTH: c_ulong = 0x00000002;
247 pub const ASC_RET_REPLAY_DETECT: c_ulong = 0x00000004;
248 pub const ASC_RET_SEQUENCE_DETECT: c_ulong = 0x00000008;
249 pub const ASC_RET_CONFIDENTIALITY: c_ulong = 0x00000010;
250 pub const ASC_RET_USE_SESSION_KEY: c_ulong = 0x00000020;
251 pub const ASC_RET_SESSION_TICKET: c_ulong = 0x00000040;
252 pub const ASC_RET_ALLOCATED_MEMORY: c_ulong = 0x00000100;
253 pub const ASC_RET_USED_DCE_STYLE: c_ulong = 0x00000200;
254 pub const ASC_RET_DATAGRAM: c_ulong = 0x00000400;
255 pub const ASC_RET_CONNECTION: c_ulong = 0x00000800;
256 pub const ASC_RET_CALL_LEVEL: c_ulong = 0x00002000;
257 pub const ASC_RET_THIRD_LEG_FAILED: c_ulong = 0x00004000;
258 pub const ASC_RET_EXTENDED_ERROR: c_ulong = 0x00008000;
259 pub const ASC_RET_STREAM: c_ulong = 0x00010000;
260 pub const ASC_RET_INTEGRITY: c_ulong = 0x00020000;
261 pub const ASC_RET_LICENSING: c_ulong = 0x00040000;
262 pub const ASC_RET_IDENTIFY: c_ulong = 0x00080000;
263 pub const ASC_RET_NULL_SESSION: c_ulong = 0x00100000;
264 pub const ASC_RET_ALLOW_NON_USER_LOGONS: c_ulong = 0x00200000;
265 pub const ASC_RET_ALLOW_CONTEXT_REPLAY: c_ulong = 0x00400000;
266 pub const ASC_RET_FRAGMENT_ONLY: c_ulong = 0x00800000;
267 pub const ASC_RET_NO_TOKEN: c_ulong = 0x01000000;
268 pub const ASC_RET_NO_ADDITIONAL_TOKEN: c_ulong = 0x02000000;
269 pub const SECPKG_CRED_ATTR_NAMES: c_ulong = 1;
270 pub const SECPKG_CRED_ATTR_SSI_PROVIDER: c_ulong = 2;
271 pub const SECPKG_CRED_ATTR_KDC_PROXY_SETTINGS: c_ulong = 3;
272 pub const SECPKG_CRED_ATTR_CERT: c_ulong = 4;
273 STRUCT!{struct SecPkgCredentials_NamesW {
274     sUserName: *mut SEC_WCHAR,
275 }}
276 pub type PSecPkgCredentials_NamesW = *mut SecPkgCredentials_NamesW;
277 STRUCT!{struct SecPkgCredentials_NamesA {
278     sUserName: *mut SEC_CHAR,
279 }}
280 pub type PSecPkgCredentials_NamesA = *mut SecPkgCredentials_NamesA;
281 STRUCT!{struct SecPkgCredentials_SSIProviderW {
282     sProviderName: *mut SEC_WCHAR,
283     ProviderInfoLength: c_ulong,
284     ProviderInfo: *mut c_char,
285 }}
286 pub type PSecPkgCredentials_SSIProviderW = *mut SecPkgCredentials_SSIProviderW;
287 STRUCT!{struct SecPkgCredentials_SSIProviderA {
288     sProviderName: *mut SEC_CHAR,
289     ProviderInfoLength: c_ulong,
290     ProviderInfo: *mut c_char,
291 }}
292 pub type PSecPkgCredentials_SSIProviderA = *mut SecPkgCredentials_SSIProviderA;
293 pub const KDC_PROXY_SETTINGS_V1: ULONG = 1;
294 pub const KDC_PROXY_SETTINGS_FLAGS_FORCEPROXY: ULONG = 0x1;
295 STRUCT!{struct SecPkgCredentials_KdcProxySettingsW {
296     Version: ULONG,
297     Flags: ULONG,
298     ProxyServerOffset: USHORT,
299     ProxyServerLength: USHORT,
300     ClientTlsCredOffset: USHORT,
301     ClientTlsCredLength: USHORT,
302 }}
303 pub type PSecPkgCredentials_KdcProxySettingsW = *mut SecPkgCredentials_KdcProxySettingsW;
304 STRUCT!{struct SecPkgCredentials_Cert {
305     EncodedCertSize: c_ulong,
306     EncodedCert: *mut c_uchar,
307 }}
308 pub type PSecPkgCredentials_Cert = *mut SecPkgCredentials_Cert;
309 pub const SECPKG_ATTR_SIZES: c_ulong = 0;
310 pub const SECPKG_ATTR_NAMES: c_ulong = 1;
311 pub const SECPKG_ATTR_LIFESPAN: c_ulong = 2;
312 pub const SECPKG_ATTR_DCE_INFO: c_ulong = 3;
313 pub const SECPKG_ATTR_STREAM_SIZES: c_ulong = 4;
314 pub const SECPKG_ATTR_KEY_INFO: c_ulong = 5;
315 pub const SECPKG_ATTR_AUTHORITY: c_ulong = 6;
316 pub const SECPKG_ATTR_PROTO_INFO: c_ulong = 7;
317 pub const SECPKG_ATTR_PASSWORD_EXPIRY: c_ulong = 8;
318 pub const SECPKG_ATTR_SESSION_KEY: c_ulong = 9;
319 pub const SECPKG_ATTR_PACKAGE_INFO: c_ulong = 10;
320 pub const SECPKG_ATTR_USER_FLAGS: c_ulong = 11;
321 pub const SECPKG_ATTR_NEGOTIATION_INFO: c_ulong = 12;
322 pub const SECPKG_ATTR_NATIVE_NAMES: c_ulong = 13;
323 pub const SECPKG_ATTR_FLAGS: c_ulong = 14;
324 pub const SECPKG_ATTR_USE_VALIDATED: c_ulong = 15;
325 pub const SECPKG_ATTR_CREDENTIAL_NAME: c_ulong = 16;
326 pub const SECPKG_ATTR_TARGET_INFORMATION: c_ulong = 17;
327 pub const SECPKG_ATTR_ACCESS_TOKEN: c_ulong = 18;
328 pub const SECPKG_ATTR_TARGET: c_ulong = 19;
329 pub const SECPKG_ATTR_AUTHENTICATION_ID: c_ulong = 20;
330 pub const SECPKG_ATTR_LOGOFF_TIME: c_ulong = 21;
331 pub const SECPKG_ATTR_NEGO_KEYS: c_ulong = 22;
332 pub const SECPKG_ATTR_PROMPTING_NEEDED: c_ulong = 24;
333 pub const SECPKG_ATTR_UNIQUE_BINDINGS: c_ulong = 25;
334 pub const SECPKG_ATTR_ENDPOINT_BINDINGS: c_ulong = 26;
335 pub const SECPKG_ATTR_CLIENT_SPECIFIED_TARGET: c_ulong = 27;
336 pub const SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS: c_ulong = 30;
337 pub const SECPKG_ATTR_NEGO_PKG_INFO: c_ulong = 31;
338 pub const SECPKG_ATTR_NEGO_STATUS: c_ulong = 32;
339 pub const SECPKG_ATTR_CONTEXT_DELETED: c_ulong = 33;
340 pub const SECPKG_ATTR_DTLS_MTU: c_ulong = 34;
341 pub const SECPKG_ATTR_DATAGRAM_SIZES: c_ulong = SECPKG_ATTR_STREAM_SIZES;
342 pub const SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES: c_ulong = 128;
343 pub const SECPKG_ATTR_APPLICATION_PROTOCOL: c_ulong = 35;
344 STRUCT!{struct SecPkgContext_SubjectAttributes {
345     AttributeInfo: *mut c_void,
346 }}
347 pub type PSecPkgContext_SubjectAttributes = *mut SecPkgContext_SubjectAttributes;
348 pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS: c_ulong = 0x1;
349 pub const SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM: c_ulong = 0x2;
350 ENUM!{enum SECPKG_CRED_CLASS {
351     SecPkgCredClass_None = 0,
352     SecPkgCredClass_Ephemeral = 10,
353     SecPkgCredClass_PersistedGeneric = 20,
354     SecPkgCredClass_PersistedSpecific = 30,
355     SecPkgCredClass_Explicit = 40,
356 }}
357 pub type PSECPKG_CRED_CLASS = *mut SECPKG_CRED_CLASS;
358 STRUCT!{struct SecPkgContext_CredInfo {
359     CredClass: SECPKG_CRED_CLASS,
360     IsPromptingNeeded: c_ulong,
361 }}
362 pub type PSecPkgContext_CredInfo = *mut SecPkgContext_CredInfo;
363 STRUCT!{struct SecPkgContext_NegoPackageInfo {
364     PackageMask: c_ulong,
365 }}
366 pub type PSecPkgContext_NegoPackageInfo = *mut SecPkgContext_NegoPackageInfo;
367 STRUCT!{struct SecPkgContext_NegoStatus {
368     LastStatus: c_ulong,
369 }}
370 pub type PSecPkgContext_NegoStatus = *mut SecPkgContext_NegoStatus;
371 STRUCT!{struct SecPkgContext_Sizes {
372     cbMaxToken: c_ulong,
373     cbMaxSignature: c_ulong,
374     cbBlockSize: c_ulong,
375     cbSecurityTrailer: c_ulong,
376 }}
377 pub type PSecPkgContext_Sizes = *mut SecPkgContext_Sizes;
378 STRUCT!{struct SecPkgContext_StreamSizes {
379     cbHeader: c_ulong,
380     cbTrailer: c_ulong,
381     cbMaximumMessage: c_ulong,
382     cBuffers: c_ulong,
383     cbBlockSize: c_ulong,
384 }}
385 pub type PSecPkgContext_StreamSizes = *mut SecPkgContext_StreamSizes;
386 pub type SecPkgContext_DatagramSizes = SecPkgContext_StreamSizes;
387 pub type PSecPkgContext_DatagramSizes = PSecPkgContext_StreamSizes;
388 STRUCT!{struct SecPkgContext_NamesW {
389     sUserName: *mut SEC_WCHAR,
390 }}
391 pub type PSecPkgContext_NamesW = *mut SecPkgContext_NamesW;
392 ENUM!{enum SECPKG_ATTR_LCT_STATUS {
393     SecPkgAttrLastClientTokenYes,
394     SecPkgAttrLastClientTokenNo,
395     SecPkgAttrLastClientTokenMaybe,
396 }}
397 pub type PSECPKG_ATTR_LCT_STATUS = *mut SECPKG_ATTR_LCT_STATUS;
398 STRUCT!{struct SecPkgContext_LastClientTokenStatus {
399     LastClientTokenStatus: SECPKG_ATTR_LCT_STATUS,
400 }}
401 pub type PSecPkgContext_LastClientTokenStatus = *mut SecPkgContext_LastClientTokenStatus;
402 STRUCT!{struct SecPkgContext_NamesA {
403     sUserName: *mut SEC_CHAR,
404 }}
405 pub type PSecPkgContext_NamesA = *mut SecPkgContext_NamesA;
406 STRUCT!{struct SecPkgContext_Lifespan {
407     tsStart: TimeStamp,
408     tsExpiry: TimeStamp,
409 }}
410 pub type PSecPkgContext_Lifespan = *mut SecPkgContext_Lifespan;
411 STRUCT!{struct SecPkgContext_DceInfo {
412     AuthzSvc: c_ulong,
413     pPac: *mut c_void,
414 }}
415 pub type PSecPkgContext_DceInfo = *mut SecPkgContext_DceInfo;
416 STRUCT!{struct SecPkgContext_KeyInfoA {
417     sSignatureAlgorithmName: *mut SEC_CHAR,
418     sEncryptAlgorithmName: *mut SEC_CHAR,
419     KeySize: c_ulong,
420     SignatureAlgorithm: c_ulong,
421     EncryptAlgorithm: c_ulong,
422 }}
423 pub type PSecPkgContext_KeyInfoA = *mut SecPkgContext_KeyInfoA;
424 STRUCT!{struct SecPkgContext_KeyInfoW {
425     sSignatureAlgorithmName: *mut SEC_WCHAR,
426     sEncryptAlgorithmName: *mut SEC_WCHAR,
427     KeySize: c_ulong,
428     SignatureAlgorithm: c_ulong,
429     EncryptAlgorithm: c_ulong,
430 }}
431 pub type PSecPkgContext_KeyInfoW = *mut SecPkgContext_KeyInfoW;
432 STRUCT!{struct SecPkgContext_AuthorityA {
433     sAuthorityName: *mut SEC_CHAR,
434 }}
435 pub type PSecPkgContext_AuthorityA = *mut SecPkgContext_AuthorityA;
436 STRUCT!{struct SecPkgContext_AuthorityW {
437     sAuthorityName: *mut SEC_WCHAR,
438 }}
439 pub type PSecPkgContext_AuthorityW = *mut SecPkgContext_AuthorityW;
440 STRUCT!{struct SecPkgContext_ProtoInfoA {
441     sProtocolName: *mut SEC_CHAR,
442     majorVersion: c_ulong,
443     minorVersion: c_ulong,
444 }}
445 pub type PSecPkgContext_ProtoInfoA = *mut SecPkgContext_ProtoInfoA;
446 STRUCT!{struct SecPkgContext_ProtoInfoW {
447     sProtocolName: *mut SEC_WCHAR,
448     majorVersion: c_ulong,
449     minorVersion: c_ulong,
450 }}
451 pub type PSecPkgContext_ProtoInfoW = *mut SecPkgContext_ProtoInfoW;
452 STRUCT!{struct SecPkgContext_PasswordExpiry {
453     tsPasswordExpires: TimeStamp,
454 }}
455 pub type PSecPkgContext_PasswordExpiry = *mut SecPkgContext_PasswordExpiry;
456 STRUCT!{struct SecPkgContext_LogoffTime {
457     tsLogoffTime: TimeStamp,
458 }}
459 pub type PSecPkgContext_LogoffTime = *mut SecPkgContext_LogoffTime;
460 STRUCT!{struct SecPkgContext_SessionKey {
461     SessionKeyLength: c_ulong,
462     SessionKey: *mut c_uchar,
463 }}
464 pub type PSecPkgContext_SessionKey = *mut SecPkgContext_SessionKey;
465 STRUCT!{struct SecPkgContext_NegoKeys {
466     KeyType: c_ulong,
467     KeyLength: c_ushort,
468     KeyValue: *mut c_uchar,
469     VerifyKeyType: c_ulong,
470     VerifyKeyLength: c_ushort,
471     VerifyKeyValue: *mut c_uchar,
472 }}
473 pub type PSecPkgContext_NegoKeys = *mut SecPkgContext_NegoKeys;
474 STRUCT!{struct SecPkgContext_PackageInfoW {
475     PackageInfo: PSecPkgInfoW,
476 }}
477 pub type PSecPkgContext_PackageInfoW = *mut SecPkgContext_PackageInfoW;
478 STRUCT!{struct SecPkgContext_PackageInfoA {
479     PackageInfo: PSecPkgInfoA,
480 }}
481 pub type PSecPkgContext_PackageInfoA = *mut SecPkgContext_PackageInfoA;
482 STRUCT!{struct SecPkgContext_UserFlags {
483     UserFlags: c_ulong,
484 }}
485 pub type PSecPkgContext_UserFlags = *mut SecPkgContext_UserFlags;
486 STRUCT!{struct SecPkgContext_Flags {
487     Flags: c_ulong,
488 }}
489 pub type PSecPkgContext_Flags = *mut SecPkgContext_Flags;
490 STRUCT!{struct SecPkgContext_NegotiationInfoA {
491     PackageInfo: PSecPkgInfoA,
492     NegotiationState: c_ulong,
493 }}
494 pub type PSecPkgContext_NegotiationInfoA = *mut SecPkgContext_NegotiationInfoA;
495 STRUCT!{struct SecPkgContext_NegotiationInfoW {
496     PackageInfo: PSecPkgInfoW,
497     NegotiationState: c_ulong,
498 }}
499 pub type PSecPkgContext_NegotiationInfoW = *mut SecPkgContext_NegotiationInfoW;
500 pub const SECPKG_NEGOTIATION_COMPLETE: c_ulong = 0;
501 pub const SECPKG_NEGOTIATION_OPTIMISTIC: c_ulong = 1;
502 pub const SECPKG_NEGOTIATION_IN_PROGRESS: c_ulong = 2;
503 pub const SECPKG_NEGOTIATION_DIRECT: c_ulong = 3;
504 pub const SECPKG_NEGOTIATION_TRY_MULTICRED: c_ulong = 4;
505 STRUCT!{struct SecPkgContext_NativeNamesW {
506     sClientName: *mut SEC_WCHAR,
507     sServerName: *mut SEC_WCHAR,
508 }}
509 pub type PSecPkgContext_NativeNamesW = *mut SecPkgContext_NativeNamesW;
510 STRUCT!{struct SecPkgContext_NativeNamesA {
511     sClientName: *mut SEC_CHAR,
512     sServerName: *mut SEC_CHAR,
513 }}
514 pub type PSecPkgContext_NativeNamesA = *mut SecPkgContext_NativeNamesA;
515 STRUCT!{struct SecPkgContext_CredentialNameW {
516     CredentialType: c_ulong,
517     sCredentialName: *mut SEC_WCHAR,
518 }}
519 pub type PSecPkgContext_CredentialNameW = *mut SecPkgContext_CredentialNameW;
520 STRUCT!{struct SecPkgContext_CredentialNameA {
521     CredentialType: c_ulong,
522     sCredentialName: *mut SEC_CHAR,
523 }}
524 pub type PSecPkgContext_CredentialNameA = *mut SecPkgContext_CredentialNameA;
525 STRUCT!{struct SecPkgContext_AccessToken {
526     AccessToken: *mut c_void,
527 }}
528 pub type PSecPkgContext_AccessToken = *mut SecPkgContext_AccessToken;
529 STRUCT!{struct SecPkgContext_TargetInformation {
530     MarshalledTargetInfoLength: c_ulong,
531     MarshalledTargetInfo: *mut c_uchar,
532 }}
533 pub type PSecPkgContext_TargetInformation = *mut SecPkgContext_TargetInformation;
534 STRUCT!{struct SecPkgContext_AuthzID {
535     AuthzIDLength: c_ulong,
536     AuthzID: *mut c_char,
537 }}
538 pub type PSecPkgContext_AuthzID = *mut SecPkgContext_AuthzID;
539 STRUCT!{struct SecPkgContext_Target {
540     TargetLength: c_ulong,
541     Target: *mut c_char,
542 }}
543 pub type PSecPkgContext_Target = *mut SecPkgContext_Target;
544 STRUCT!{struct SecPkgContext_ClientSpecifiedTarget {
545     sTargetName: *mut SEC_WCHAR,
546 }}
547 pub type PSecPkgContext_ClientSpecifiedTarget = *mut SecPkgContext_ClientSpecifiedTarget;
548 STRUCT!{struct SecPkgContext_Bindings {
549     BindingsLength: c_ulong,
550     Bindings: *mut SEC_CHANNEL_BINDINGS,
551 }}
552 pub type PSecPkgContext_Bindings = *mut SecPkgContext_Bindings;
553 ENUM!{enum SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS {
554     SecApplicationProtocolNegotiationStatus_None,
555     SecApplicationProtocolNegotiationStatus_Success,
556     SecApplicationProtocolNegotiationStatus_SelectedClientOnly,
557 }}
558 pub type PSEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS =
559     *mut SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS;
560 pub const MAX_PROTOCOL_ID_SIZE: usize = 0xff;
561 STRUCT!{struct SecPkgContext_ApplicationProtocol {
562     ProtoNegoStatus: SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS,
563     ProtoNegoExt: SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT,
564     ProtocolIdSize: c_uchar,
565     ProtocolId: [c_uchar; MAX_PROTOCOL_ID_SIZE],
566 }}
567 pub type PSecPkgContext_ApplicationProtocol = *mut SecPkgContext_ApplicationProtocol;
568 FN!{stdcall SEC_GET_KEY_FN(
569     Arg: *mut c_void,
570     Principal: *mut c_void,
571     KeyVer: c_ulong,
572     Key: *mut *mut c_void,
573     Status: *mut SECURITY_STATUS,
574 ) -> ()}
575 pub const SECPKG_CONTEXT_EXPORT_RESET_NEW: c_ulong = 0x00000001;
576 pub const SECPKG_CONTEXT_EXPORT_DELETE_OLD: c_ulong = 0x00000002;
577 pub const SECPKG_CONTEXT_EXPORT_TO_KERNEL: c_ulong = 0x00000004;
578 extern "system" {
AcquireCredentialsHandleW( pszPrincipal: LPWSTR, pszPackage: LPWSTR, fCredentialUse: c_ulong, pvLogonId: *mut c_void, pAuthData: *mut c_void, pGetKeyFn: SEC_GET_KEY_FN, pvGetKeyArgument: *mut c_void, phCredential: PCredHandle, ptsExpiry: PTimeStamp, ) -> SECURITY_STATUS579     pub fn AcquireCredentialsHandleW(
580         pszPrincipal: LPWSTR,
581         pszPackage: LPWSTR,
582         fCredentialUse: c_ulong,
583         pvLogonId: *mut c_void,
584         pAuthData: *mut c_void,
585         pGetKeyFn: SEC_GET_KEY_FN,
586         pvGetKeyArgument: *mut c_void,
587         phCredential: PCredHandle,
588         ptsExpiry: PTimeStamp,
589     ) -> SECURITY_STATUS;
590 }
591 FN!{stdcall ACQUIRE_CREDENTIALS_HANDLE_FN_W(
592     *mut SEC_WCHAR,
593     *mut SEC_WCHAR,
594     c_ulong,
595     *mut c_void,
596     *mut c_void,
597     SEC_GET_KEY_FN,
598     *mut c_void,
599     PCredHandle,
600     PTimeStamp,
601 ) -> SECURITY_STATUS}
602 extern "system" {
AcquireCredentialsHandleA( pszPrincipal: LPSTR, pszPackage: LPSTR, fCredentialUse: c_ulong, pvLogonId: *mut c_void, pAuthData: *mut c_void, pGetKeyFn: SEC_GET_KEY_FN, pvGetKeyArgument: *mut c_void, phCredential: PCredHandle, ptsExpiry: PTimeStamp, ) -> SECURITY_STATUS603     pub fn AcquireCredentialsHandleA(
604         pszPrincipal: LPSTR,
605         pszPackage: LPSTR,
606         fCredentialUse: c_ulong,
607         pvLogonId: *mut c_void,
608         pAuthData: *mut c_void,
609         pGetKeyFn: SEC_GET_KEY_FN,
610         pvGetKeyArgument: *mut c_void,
611         phCredential: PCredHandle,
612         ptsExpiry: PTimeStamp,
613     ) -> SECURITY_STATUS;
614 }
615 FN!{stdcall ACQUIRE_CREDENTIALS_HANDLE_FN_A(
616     *mut SEC_CHAR,
617     *mut SEC_CHAR,
618     c_ulong,
619     *mut c_void,
620     *mut c_void,
621     SEC_GET_KEY_FN,
622     *mut c_void,
623     PCredHandle,
624     PTimeStamp,
625 ) -> SECURITY_STATUS}
626 extern "system" {
FreeCredentialsHandle( phCredential: PCredHandle, ) -> SECURITY_STATUS627     pub fn FreeCredentialsHandle(
628         phCredential: PCredHandle,
629     ) -> SECURITY_STATUS;
630 }
631 FN!{stdcall FREE_CREDENTIALS_HANDLE_FN(
632     PCredHandle,
633 ) -> SECURITY_STATUS}
634 extern "system" {
AddCredentialsW( hCredentials: PCredHandle, pszPrincipal: LPWSTR, pszPackage: LPWSTR, fCredentialUse: c_ulong, pAuthData: *mut c_void, pGetKeyFn: SEC_GET_KEY_FN, pvGetKeyArgument: *mut c_void, ptsExpiry: PTimeStamp, ) -> SECURITY_STATUS635     pub fn AddCredentialsW(
636         hCredentials: PCredHandle,
637         pszPrincipal: LPWSTR,
638         pszPackage: LPWSTR,
639         fCredentialUse: c_ulong,
640         pAuthData: *mut c_void,
641         pGetKeyFn: SEC_GET_KEY_FN,
642         pvGetKeyArgument: *mut c_void,
643         ptsExpiry: PTimeStamp,
644     ) -> SECURITY_STATUS;
645 }
646 FN!{stdcall ADD_CREDENTIALS_FN_W(
647     PCredHandle,
648     *mut SEC_WCHAR,
649     *mut SEC_WCHAR,
650     c_ulong,
651     *mut c_void,
652     SEC_GET_KEY_FN,
653     *mut c_void,
654     PTimeStamp,
655 ) -> SECURITY_STATUS}
656 extern "system" {
AddCredentialsA( hCredentials: PCredHandle, pszPrincipal: LPSTR, pszPackage: LPSTR, fCredentialUse: c_ulong, pAuthData: *mut c_void, pGetKeyFn: SEC_GET_KEY_FN, pvGetKeyArgument: *mut c_void, ptsExpiry: PTimeStamp, ) -> SECURITY_STATUS657     pub fn AddCredentialsA(
658         hCredentials: PCredHandle,
659         pszPrincipal: LPSTR,
660         pszPackage: LPSTR,
661         fCredentialUse: c_ulong,
662         pAuthData: *mut c_void,
663         pGetKeyFn: SEC_GET_KEY_FN,
664         pvGetKeyArgument: *mut c_void,
665         ptsExpiry: PTimeStamp,
666     ) -> SECURITY_STATUS;
667 }
668 FN!{stdcall ADD_CREDENTIALS_FN_A(
669     PCredHandle,
670     *mut SEC_CHAR,
671     *mut SEC_CHAR,
672     c_ulong,
673     *mut c_void,
674     SEC_GET_KEY_FN,
675     *mut c_void,
676     PTimeStamp,
677 ) -> SECURITY_STATUS}
678 extern "system" {
679     // pub fn spiCreateAsyncContext();
680     // pub fn SspiFreeAsyncContext();
681     // pub fn SspiReinitAsyncContext();
682     // pub fn SspiSetAsyncNotifyCallback();
683     // pub fn SspiAsyncContextRequiresNotify();
684     // pub fn SspiGetAsyncCallStatus();
685     // pub fn SspiAcquireCredentialsHandleAsyncW();
686     // pub fn SspiAcquireCredentialsHandleAsyncA();
687     // pub fn SspiInitializeSecurityContextAsyncW();
688     // pub fn SspiInitializeSecurityContextAsyncA();
689     // pub fn SspiAcceptSecurityContextAsync();
690     // pub fn SspiFreeCredentialsHandleAsync();
691     // pub fn SspiDeleteSecurityContextAsync();
ChangeAccountPasswordW( pszPackageName: *mut SEC_WCHAR, pszDomainName: *mut SEC_WCHAR, pszAccountName: *mut SEC_WCHAR, pszOldPassword: *mut SEC_WCHAR, pszNewPassword: *mut SEC_WCHAR, bImpersonating: BOOLEAN, dwReserved: c_ulong, pOutput: PSecBufferDesc, ) -> SECURITY_STATUS692     pub fn ChangeAccountPasswordW(
693         pszPackageName: *mut SEC_WCHAR,
694         pszDomainName: *mut SEC_WCHAR,
695         pszAccountName: *mut SEC_WCHAR,
696         pszOldPassword: *mut SEC_WCHAR,
697         pszNewPassword: *mut SEC_WCHAR,
698         bImpersonating: BOOLEAN,
699         dwReserved: c_ulong,
700         pOutput: PSecBufferDesc,
701     ) -> SECURITY_STATUS;
702 }
703 FN!{stdcall CHANGE_PASSWORD_FN_W(
704     *mut SEC_WCHAR,
705     *mut SEC_WCHAR,
706     *mut SEC_WCHAR,
707     *mut SEC_WCHAR,
708     *mut SEC_WCHAR,
709     BOOLEAN,
710     c_ulong,
711     PSecBufferDesc,
712 ) -> SECURITY_STATUS}
713 extern "system" {
ChangeAccountPasswordA( pszPackageName: *mut SEC_CHAR, pszDomainName: *mut SEC_CHAR, pszAccountName: *mut SEC_CHAR, pszOldPassword: *mut SEC_CHAR, pszNewPassword: *mut SEC_CHAR, bImpersonating: BOOLEAN, dwReserved: c_ulong, pOutput: PSecBufferDesc, ) -> SECURITY_STATUS714     pub fn ChangeAccountPasswordA(
715         pszPackageName: *mut SEC_CHAR,
716         pszDomainName: *mut SEC_CHAR,
717         pszAccountName: *mut SEC_CHAR,
718         pszOldPassword: *mut SEC_CHAR,
719         pszNewPassword: *mut SEC_CHAR,
720         bImpersonating: BOOLEAN,
721         dwReserved: c_ulong,
722         pOutput: PSecBufferDesc,
723     ) -> SECURITY_STATUS;
724 }
725 FN!{stdcall CHANGE_PASSWORD_FN_A(
726     *mut SEC_CHAR,
727     *mut SEC_CHAR,
728     *mut SEC_CHAR,
729     *mut SEC_CHAR,
730     *mut SEC_CHAR,
731     BOOLEAN,
732     c_ulong,
733     PSecBufferDesc,
734 ) -> SECURITY_STATUS}
735 extern "system" {
InitializeSecurityContextW( phCredential: PCredHandle, phContext: PCtxtHandle, pszTargetName: *mut SEC_WCHAR, fContextReq: c_ulong, Reserved1: c_ulong, TargetDataRep: c_ulong, pInput: PSecBufferDesc, Reserved2: c_ulong, phNewContext: PCtxtHandle, pOutput: PSecBufferDesc, pfContextAttr: *mut c_ulong, ptsExpiry: PTimeStamp, ) -> SECURITY_STATUS736     pub fn InitializeSecurityContextW(
737         phCredential: PCredHandle,
738         phContext: PCtxtHandle,
739         pszTargetName: *mut SEC_WCHAR,
740         fContextReq: c_ulong,
741         Reserved1: c_ulong,
742         TargetDataRep: c_ulong,
743         pInput: PSecBufferDesc,
744         Reserved2: c_ulong,
745         phNewContext: PCtxtHandle,
746         pOutput: PSecBufferDesc,
747         pfContextAttr: *mut c_ulong,
748         ptsExpiry: PTimeStamp,
749     ) -> SECURITY_STATUS;
750 }
751 // INITIALIZE_SECURITY_CONTEXT_FN_W
752 extern "system" {
InitializeSecurityContextA( phCredential: PCredHandle, phContext: PCtxtHandle, pszTargetName: *mut SEC_CHAR, fContextReq: c_ulong, Reserved1: c_ulong, TargetDataRep: c_ulong, pInput: PSecBufferDesc, Reserved2: c_ulong, phNewContext: PCtxtHandle, pOutput: PSecBufferDesc, pfContextAttr: *mut c_ulong, ptsExpiry: PTimeStamp, ) -> SECURITY_STATUS753     pub fn InitializeSecurityContextA(
754         phCredential: PCredHandle,
755         phContext: PCtxtHandle,
756         pszTargetName: *mut SEC_CHAR,
757         fContextReq: c_ulong,
758         Reserved1: c_ulong,
759         TargetDataRep: c_ulong,
760         pInput: PSecBufferDesc,
761         Reserved2: c_ulong,
762         phNewContext: PCtxtHandle,
763         pOutput: PSecBufferDesc,
764         pfContextAttr: *mut c_ulong,
765         ptsExpiry: PTimeStamp,
766     ) -> SECURITY_STATUS;
AcceptSecurityContext( phCredential: PCredHandle, phContext: PCtxtHandle, pInput: PSecBufferDesc, fContextReq: c_ulong, TargetDataRep: c_ulong, phNewContext: PCtxtHandle, pOutput: PSecBufferDesc, pfContextAttr: *mut c_ulong, ptsExpiry: PTimeStamp, ) -> SECURITY_STATUS767     pub fn AcceptSecurityContext(
768         phCredential: PCredHandle,
769         phContext: PCtxtHandle,
770         pInput: PSecBufferDesc,
771         fContextReq: c_ulong,
772         TargetDataRep: c_ulong,
773         phNewContext: PCtxtHandle,
774         pOutput: PSecBufferDesc,
775         pfContextAttr: *mut c_ulong,
776         ptsExpiry: PTimeStamp,
777     ) -> SECURITY_STATUS;
CompleteAuthToken( phContext: PCtxtHandle, pToken: PSecBufferDesc, ) -> SECURITY_STATUS778     pub fn CompleteAuthToken(
779         phContext: PCtxtHandle,
780         pToken: PSecBufferDesc,
781     ) -> SECURITY_STATUS;
ImpersonateSecurityContext( phContext: PCtxtHandle, ) -> SECURITY_STATUS782     pub fn ImpersonateSecurityContext(
783         phContext: PCtxtHandle,
784     ) -> SECURITY_STATUS;
RevertSecurityContext( phContext: PCtxtHandle, ) -> SECURITY_STATUS785     pub fn RevertSecurityContext(
786         phContext: PCtxtHandle,
787     ) -> SECURITY_STATUS;
QuerySecurityContextToken( phContext: PCtxtHandle, Token: *mut *mut c_void, ) -> SECURITY_STATUS788     pub fn QuerySecurityContextToken(
789         phContext: PCtxtHandle,
790         Token: *mut *mut c_void,
791     ) -> SECURITY_STATUS;
DeleteSecurityContext( phContext: PCtxtHandle, ) -> SECURITY_STATUS792     pub fn DeleteSecurityContext(
793         phContext: PCtxtHandle,
794     ) -> SECURITY_STATUS;
ApplyControlToken( phContext: PCtxtHandle, pInput: PSecBufferDesc, ) -> SECURITY_STATUS795     pub fn ApplyControlToken(
796         phContext: PCtxtHandle,
797         pInput: PSecBufferDesc,
798     ) -> SECURITY_STATUS;
QueryContextAttributesW( phContext: PCtxtHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, ) -> SECURITY_STATUS799     pub fn QueryContextAttributesW(
800         phContext: PCtxtHandle,
801         ulAttribute: c_ulong,
802         pBuffer: *mut c_void,
803     ) -> SECURITY_STATUS;
804     // pub fn QueryContextAttributesExW();
QueryContextAttributesA( phContext: PCtxtHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, ) -> SECURITY_STATUS805     pub fn QueryContextAttributesA(
806         phContext: PCtxtHandle,
807         ulAttribute: c_ulong,
808         pBuffer: *mut c_void,
809     ) -> SECURITY_STATUS;
810     // pub fn QueryContextAttributesExA();
SetContextAttributesW( phContext: PCtxtHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, cbBuffer: c_ulong, ) -> SECURITY_STATUS811     pub fn SetContextAttributesW(
812         phContext: PCtxtHandle,
813         ulAttribute: c_ulong,
814         pBuffer: *mut c_void,
815         cbBuffer: c_ulong,
816     ) -> SECURITY_STATUS;
SetContextAttributesA( phContext: PCtxtHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, cbBuffer: c_ulong, ) -> SECURITY_STATUS817     pub fn SetContextAttributesA(
818         phContext: PCtxtHandle,
819         ulAttribute: c_ulong,
820         pBuffer: *mut c_void,
821         cbBuffer: c_ulong,
822     ) -> SECURITY_STATUS;
QueryCredentialsAttributesW( phCredential: PCredHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, ) -> SECURITY_STATUS823     pub fn QueryCredentialsAttributesW(
824         phCredential: PCredHandle,
825         ulAttribute: c_ulong,
826         pBuffer: *mut c_void,
827     ) -> SECURITY_STATUS;
828     // pub fn QueryCredentialsAttributesExW();
QueryCredentialsAttributesA( phCredential: PCredHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, ) -> SECURITY_STATUS829     pub fn QueryCredentialsAttributesA(
830         phCredential: PCredHandle,
831         ulAttribute: c_ulong,
832         pBuffer: *mut c_void,
833     ) -> SECURITY_STATUS;
834     // pub fn QueryCredentialsAttributesExA();
SetCredentialsAttributesW( phCredential: PCredHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, cbBuffer: c_ulong, ) -> SECURITY_STATUS835     pub fn SetCredentialsAttributesW(
836         phCredential: PCredHandle,
837         ulAttribute: c_ulong,
838         pBuffer: *mut c_void,
839         cbBuffer: c_ulong,
840     ) -> SECURITY_STATUS;
SetCredentialsAttributesA( phCredential: PCredHandle, ulAttribute: c_ulong, pBuffer: *mut c_void, cbBuffer: c_ulong, ) -> SECURITY_STATUS841     pub fn SetCredentialsAttributesA(
842         phCredential: PCredHandle,
843         ulAttribute: c_ulong,
844         pBuffer: *mut c_void,
845         cbBuffer: c_ulong,
846     ) -> SECURITY_STATUS;
FreeContextBuffer( pvContextBuffer: PVOID, ) -> SECURITY_STATUS847     pub fn FreeContextBuffer(
848         pvContextBuffer: PVOID,
849     ) -> SECURITY_STATUS;
MakeSignature( phContext: PCtxtHandle, fQOP: c_ulong, pMessage: PSecBufferDesc, MessageSeqNo: c_ulong, ) -> SECURITY_STATUS850     pub fn MakeSignature(
851         phContext: PCtxtHandle,
852         fQOP: c_ulong,
853         pMessage: PSecBufferDesc,
854         MessageSeqNo: c_ulong,
855     ) -> SECURITY_STATUS;
VerifySignature( phContext: PCtxtHandle, pMessage: PSecBufferDesc, MessageSeqNo: c_ulong, pfQOP: *mut c_ulong, ) -> SECURITY_STATUS856     pub fn VerifySignature(
857         phContext: PCtxtHandle,
858         pMessage: PSecBufferDesc,
859         MessageSeqNo: c_ulong,
860         pfQOP: *mut c_ulong,
861     ) -> SECURITY_STATUS;
EncryptMessage( phContext: PCtxtHandle, fQOP: c_ulong, pMessage: PSecBufferDesc, MessageSeqNo: c_ulong, ) -> SECURITY_STATUS862     pub fn EncryptMessage(
863         phContext: PCtxtHandle,
864         fQOP: c_ulong,
865         pMessage: PSecBufferDesc,
866         MessageSeqNo: c_ulong,
867     ) -> SECURITY_STATUS;
DecryptMessage( phContext: PCtxtHandle, pMessage: PSecBufferDesc, MessageSeqNo: c_ulong, pfQOP: *mut c_ulong, ) -> SECURITY_STATUS868     pub fn DecryptMessage(
869         phContext: PCtxtHandle,
870         pMessage: PSecBufferDesc,
871         MessageSeqNo: c_ulong,
872         pfQOP: *mut c_ulong,
873     ) -> SECURITY_STATUS;
EnumerateSecurityPackagesW( pcPackages: *mut c_ulong, ppPackageInfo: *mut PSecPkgInfoW, ) -> SECURITY_STATUS874     pub fn EnumerateSecurityPackagesW(
875         pcPackages: *mut c_ulong,
876         ppPackageInfo: *mut PSecPkgInfoW,
877     ) -> SECURITY_STATUS;
EnumerateSecurityPackagesA( pcPackages: *mut c_ulong, ppPackageInfo: *mut PSecPkgInfoA, ) -> SECURITY_STATUS878     pub fn EnumerateSecurityPackagesA(
879         pcPackages: *mut c_ulong,
880         ppPackageInfo: *mut PSecPkgInfoA,
881     ) -> SECURITY_STATUS;
QuerySecurityPackageInfoW( pszPackageName: LPWSTR, ppPackageInfo: *mut PSecPkgInfoW, ) -> SECURITY_STATUS882     pub fn QuerySecurityPackageInfoW(
883         pszPackageName: LPWSTR,
884         ppPackageInfo: *mut PSecPkgInfoW,
885     ) -> SECURITY_STATUS;
QuerySecurityPackageInfoA( pszPackageName: LPSTR, ppPackageInfo: *mut PSecPkgInfoA, ) -> SECURITY_STATUS886     pub fn QuerySecurityPackageInfoA(
887         pszPackageName: LPSTR,
888         ppPackageInfo: *mut PSecPkgInfoA,
889     ) -> SECURITY_STATUS;
890 }
891 ENUM!{enum SecDelegationType {
892     SecFull,
893     SecService,
894     SecTree,
895     SecDirectory,
896     SecObject,
897 }}
898 pub type PSecDelegationType = *mut SecDelegationType;
899 extern "system" {
900     // pub fn DelegateSecurityContext();
ExportSecurityContext( phContext: PCtxtHandle, fFlags: ULONG, pPackedContext: PSecBuffer, pToken: *mut *mut c_void, ) -> SECURITY_STATUS901     pub fn ExportSecurityContext(
902         phContext: PCtxtHandle,
903         fFlags: ULONG,
904         pPackedContext: PSecBuffer,
905         pToken: *mut *mut c_void,
906     ) -> SECURITY_STATUS;
ImportSecurityContextW( pszPackage: LPWSTR, pPackedContext: PSecBuffer, Token: *mut c_void, phContext: PCtxtHandle, ) -> SECURITY_STATUS907     pub fn ImportSecurityContextW(
908         pszPackage: LPWSTR,
909         pPackedContext: PSecBuffer,
910         Token: *mut c_void,
911         phContext: PCtxtHandle,
912     ) -> SECURITY_STATUS;
ImportSecurityContextA( pszPackage: LPSTR, pPackedContext: PSecBuffer, Token: *mut c_void, phContext: PCtxtHandle, ) -> SECURITY_STATUS913     pub fn ImportSecurityContextA(
914         pszPackage: LPSTR,
915         pPackedContext: PSecBuffer,
916         Token: *mut c_void,
917         phContext: PCtxtHandle,
918     ) -> SECURITY_STATUS;
919 // pub fn SecMakeSPN();
920 // pub fn SecMakeSPNEx();
921 // pub fn SecMakeSPNEx2();
922 // pub fn SecLookupAccountSid();
923 // pub fn SecLookupAccountName();
924 // pub fn SecLookupWellKnownSid();
925 }
926 extern "system" {
927     // pub fn InitSecurityInterfaceA();
928     // pub fn InitSecurityInterfaceW();
929     // pub fn SaslEnumerateProfilesA();
930     // pub fn SaslEnumerateProfilesW();
931     // pub fn SaslGetProfilePackageA();
932     // pub fn SaslGetProfilePackageW();
933     // pub fn SaslIdentifyPackageA();
934     // pub fn SaslIdentifyPackageW();
935     // pub fn SaslInitializeSecurityContextW();
936     // pub fn SaslInitializeSecurityContextA();
937     // pub fn SaslAcceptSecurityContext();
938     // pub fn SaslSetContextOption();
939     // pub fn SaslGetContextOption();
940 }
941 pub type PSEC_WINNT_AUTH_IDENTITY_OPAQUE = PVOID;
942 extern "system" {
SspiPromptForCredentialsW( pszTargetName: PCWSTR, pUiInfo: PCREDUI_INFOW, dwAuthError: c_ulong, pszPackage: PCWSTR, pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE, ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE, pfSave: *mut c_int, dwFlags: c_ulong, ) -> c_ulong943     pub fn SspiPromptForCredentialsW(
944         pszTargetName: PCWSTR,
945         pUiInfo: PCREDUI_INFOW,
946         dwAuthError: c_ulong,
947         pszPackage: PCWSTR,
948         pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE,
949         ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE,
950         pfSave: *mut c_int,
951         dwFlags: c_ulong,
952     ) -> c_ulong;
SspiPromptForCredentialsA( pszTargetName: PCSTR, pUiInfo: PCREDUI_INFOA, dwAuthError: c_ulong, pszPackage: PCSTR, pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE, ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE, pfSave: *mut c_int, dwFlags: c_ulong, ) -> c_ulong953     pub fn SspiPromptForCredentialsA(
954         pszTargetName: PCSTR,
955         pUiInfo: PCREDUI_INFOA,
956         dwAuthError: c_ulong,
957         pszPackage: PCSTR,
958         pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE,
959         ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE,
960         pfSave: *mut c_int,
961         dwFlags: c_ulong,
962     ) -> c_ulong;
963 }
964 STRUCT!{struct SEC_WINNT_AUTH_BYTE_VECTOR {
965     ByteArrayOffset: c_ulong,
966     ByteArrayLength: c_ushort,
967 }}
968 pub type PSEC_WINNT_AUTH_BYTE_VECTOR = *mut SEC_WINNT_AUTH_BYTE_VECTOR;
969 STRUCT!{struct SEC_WINNT_AUTH_DATA {
970     CredType: GUID,
971     CredData: SEC_WINNT_AUTH_BYTE_VECTOR,
972 }}
973 pub type PSEC_WINNT_AUTH_DATA = *mut SEC_WINNT_AUTH_DATA;
974 STRUCT!{struct SEC_WINNT_AUTH_PACKED_CREDENTIALS {
975     cbHeaderLength: c_ushort,
976     cbStructureLength: c_ushort,
977     AuthData: SEC_WINNT_AUTH_DATA,
978 }}
979 pub type PSEC_WINNT_AUTH_PACKED_CREDENTIALS = *mut SEC_WINNT_AUTH_PACKED_CREDENTIALS;
980 DEFINE_GUID!{SEC_WINNT_AUTH_DATA_TYPE_PASSWORD,
981     0x28bfc32f, 0x10f6, 0x4738, 0x98, 0xd1, 0x1a, 0xc0, 0x61, 0xdf, 0x71, 0x6a}
982 DEFINE_GUID!{SEC_WINNT_AUTH_DATA_TYPE_CERT,
983     0x235f69ad, 0x73fb, 0x4dbc, 0x82, 0x3, 0x6, 0x29, 0xe7, 0x39, 0x33, 0x9b}
984 STRUCT!{struct SEC_WINNT_AUTH_DATA_PASSWORD {
985     UnicodePassword: SEC_WINNT_AUTH_BYTE_VECTOR,
986 }}
987 pub type PSEC_WINNT_AUTH_DATA_PASSWORD = *mut SEC_WINNT_AUTH_DATA_PASSWORD;
988 DEFINE_GUID!{SEC_WINNT_AUTH_DATA_TYPE_CSP_DATA,
989     0x68fd9879, 0x79c, 0x4dfe, 0x82, 0x81, 0x57, 0x8a, 0xad, 0xc1, 0xc1, 0x0}
990 // GUID SEC_WINNT_AUTH_DATA_TYPE_SMARTCARD_CONTEXTS
991 STRUCT!{struct SEC_WINNT_AUTH_CERTIFICATE_DATA {
992     cbHeaderLength: c_ushort,
993     cbStructureLength: c_ushort,
994     Certificate: SEC_WINNT_AUTH_BYTE_VECTOR,
995 }}
996 pub type PSEC_WINNT_AUTH_CERTIFICATE_DATA = *mut SEC_WINNT_AUTH_CERTIFICATE_DATA;
997 STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT_VECTOR {
998     CredUIContextArrayOffset: ULONG,
999     CredUIContextCount: USHORT,
1000 }}
1001 pub type PSEC_WINNT_CREDUI_CONTEXT_VECTOR = *mut SEC_WINNT_CREDUI_CONTEXT_VECTOR;
1002 STRUCT!{struct SEC_WINNT_AUTH_SHORT_VECTOR {
1003     ShortArrayOffset: ULONG,
1004     ShortArrayCount: USHORT,
1005 }}
1006 pub type PSEC_WINNT_AUTH_SHORT_VECTOR = *mut SEC_WINNT_AUTH_SHORT_VECTOR;
1007 extern "system" {
SspiGetCredUIContext( ContextHandle: HANDLE, CredType: *mut GUID, LogonId: *mut LUID, CredUIContexts: *mut PSEC_WINNT_CREDUI_CONTEXT_VECTOR, TokenHandle: *mut HANDLE, ) -> SECURITY_STATUS1008     pub fn SspiGetCredUIContext(
1009         ContextHandle: HANDLE,
1010         CredType: *mut GUID,
1011         LogonId: *mut LUID,
1012         CredUIContexts: *mut PSEC_WINNT_CREDUI_CONTEXT_VECTOR,
1013         TokenHandle: *mut HANDLE,
1014     ) -> SECURITY_STATUS;
SspiUpdateCredentials( ContextHandle: HANDLE, CredType: *mut GUID, FlatCredUIContextLength: ULONG, FlatCredUIContext: PUCHAR, ) -> SECURITY_STATUS1015     pub fn SspiUpdateCredentials(
1016         ContextHandle: HANDLE,
1017         CredType: *mut GUID,
1018         FlatCredUIContextLength: ULONG,
1019         FlatCredUIContext: PUCHAR,
1020     ) -> SECURITY_STATUS;
1021 }
1022 STRUCT!{struct CREDUIWIN_MARSHALED_CONTEXT {
1023     StructureType: GUID,
1024     cbHeaderLength: USHORT,
1025     LogonId: LUID,
1026     MarshaledDataType: GUID,
1027     MarshaledDataOffset: ULONG,
1028     MarshaledDataLength: USHORT,
1029 }}
1030 pub type PCREDUIWIN_MARSHALED_CONTEXT = *mut CREDUIWIN_MARSHALED_CONTEXT;
1031 STRUCT!{struct SEC_WINNT_CREDUI_CONTEXT {
1032     cbHeaderLength: USHORT,
1033     CredUIContextHandle: HANDLE,
1034     UIInfo: PCREDUI_INFOW,
1035     dwAuthError: ULONG,
1036     pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE,
1037     TargetName: PUNICODE_STRING,
1038 }}
1039 pub type PSEC_WINNT_CREDUI_CONTEXT = *mut SEC_WINNT_CREDUI_CONTEXT;
1040 // GUID CREDUIWIN_STRUCTURE_TYPE_SSPIPFC
1041 // GUID SSPIPFC_STRUCTURE_TYPE_CREDUI_CONTEXT
1042 extern "system" {
SspiUnmarshalCredUIContext( MarshaledCredUIContext: PUCHAR, MarshaledCredUIContextLength: ULONG, CredUIContext: *mut PSEC_WINNT_CREDUI_CONTEXT, ) -> SECURITY_STATUS1043     pub fn SspiUnmarshalCredUIContext(
1044         MarshaledCredUIContext: PUCHAR,
1045         MarshaledCredUIContextLength: ULONG,
1046         CredUIContext: *mut PSEC_WINNT_CREDUI_CONTEXT,
1047     ) -> SECURITY_STATUS;
1048     // pub fn SspiPrepareForCredRead();
1049     // pub fn SspiPrepareForCredWrite();
1050     // pub fn SspiEncryptAuthIdentity();
1051     // pub fn SspiEncryptAuthIdentityEx();
1052     // pub fn SspiDecryptAuthIdentity();
1053     // pub fn SspiDecryptAuthIdentityEx();
1054     // pub fn SspiIsAuthIdentityEncrypted();
1055     // pub fn SspiEncodeAuthIdentityAsStrings();
1056     // pub fn SspiValidateAuthIdentity();
1057     // pub fn SspiCopyAuthIdentity();
1058     // pub fn SspiFreeAuthIdentity();
1059     // pub fn SspiZeroAuthIdentity();
1060     // pub fn SspiLocalFree();
1061     // pub fn SspiEncodeStringsAsAuthIdentity();
1062     // pub fn SspiCompareAuthIdentities();
1063     // pub fn SspiMarshalAuthIdentity();
1064     // pub fn SspiUnmarshalAuthIdentity();
SspiIsPromptingNeeded( ErrorOrNtStatus: c_ulong, ) -> BOOLEAN1065     pub fn SspiIsPromptingNeeded(
1066         ErrorOrNtStatus: c_ulong,
1067     ) -> BOOLEAN;
1068     // pub fn SspiGetTargetHostName();
1069     // pub fn SspiExcludePackage();
1070     // pub fn AddSecurityPackageA();
1071     // pub fn AddSecurityPackageW();
1072     // pub fn DeleteSecurityPackageA();
1073     // pub fn DeleteSecurityPackageW();
1074 }
1075