wininet: Fix a couple of memory leaks.
[wine.git] / include / sspi.h
blobb8761a5dfebc534246490f82b279c1cb0b4f7e0e
1 /*
2 * Copyright (C) 2004 Juan Lang
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 #ifndef __WINE_SSPI_H__
19 #define __WINE_SSPI_H__
21 /* FIXME: #include <sdkddkver.h> */
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
27 #define SEC_ENTRY __stdcall
29 typedef WCHAR SEC_WCHAR;
30 typedef CHAR SEC_CHAR;
32 #ifndef __SECSTATUS_DEFINED__
33 #define __SECSTATUS_DEFINED__
34 typedef LONG SECURITY_STATUS;
35 #endif
37 #ifdef UNICODE
38 typedef SEC_WCHAR * SECURITY_PSTR;
39 typedef const SEC_WCHAR * SECURITY_PCSTR;
40 #else
41 typedef SEC_CHAR * SECURITY_PSTR;
42 typedef const SEC_CHAR * SECURITY_PCSTR;
43 #endif
45 #ifndef __SECHANDLE_DEFINED__
46 #define __SECHANDLE_DEFINED__
47 typedef struct _SecHandle
49 ULONG_PTR dwLower;
50 ULONG_PTR dwUpper;
51 } SecHandle, *PSecHandle;
52 #endif
54 #define SecInvalidateHandle(x) do { \
55 ((PSecHandle)(x))->dwLower = ((ULONG_PTR)((INT_PTR)-1)); \
56 ((PSecHandle)(x))->dwUpper = ((ULONG_PTR)((INT_PTR)-1)); \
57 } while (0)
59 #define SecIsValidHandle(x) \
60 ((((PSecHandle)(x))->dwLower != ((ULONG_PTR)(INT_PTR)-1)) && \
61 (((PSecHandle)(x))->dwUpper != ((ULONG_PTR)(INT_PTR)-1)))
63 typedef SecHandle CredHandle;
64 typedef PSecHandle PCredHandle;
66 #ifndef __WINE_CTXTHANDLE_DEFINED__
67 #define __WINE_CTXTHANDLE_DEFINED__
68 typedef SecHandle CtxtHandle;
69 typedef PSecHandle PCtxtHandle;
70 #endif
72 typedef struct _SECURITY_INTEGER
74 ULONG LowPart;
75 LONG HighPart;
76 } SECURITY_INTEGER, *PSECURITY_INTEGER;
77 typedef SECURITY_INTEGER TimeStamp, *PTimeStamp;
79 #ifndef __UNICODE_STRING_DEFINED__
80 #define __UNICODE_STRING_DEFINED__
81 typedef struct _UNICODE_STRING {
82 USHORT Length; /* bytes */
83 USHORT MaximumLength; /* bytes */
84 PWSTR Buffer;
85 } UNICODE_STRING, *PUNICODE_STRING;
86 #endif
88 typedef UNICODE_STRING SECURITY_STRING, *PSECURITY_STRING;
90 typedef struct _SecPkgInfoA
92 ULONG fCapabilities;
93 USHORT wVersion;
94 USHORT wRPCID;
95 ULONG cbMaxToken;
96 SEC_CHAR *Name;
97 SEC_CHAR *Comment;
98 } SecPkgInfoA, *PSecPkgInfoA;
100 typedef struct _SecPkgInfoW
102 ULONG fCapabilities;
103 USHORT wVersion;
104 USHORT wRPCID;
105 ULONG cbMaxToken;
106 SEC_WCHAR *Name;
107 SEC_WCHAR *Comment;
108 } SecPkgInfoW, *PSecPkgInfoW;
110 #define SecPkgInfo WINELIB_NAME_AW(SecPkgInfo)
111 #define PSecPkgInfo WINELIB_NAME_AW(PSecPkgInfo)
113 /* fCapabilities field of SecPkgInfo */
114 #define SECPKG_FLAG_INTEGRITY 0x00000001
115 #define SECPKG_FLAG_PRIVACY 0x00000002
116 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004
117 #define SECPKG_FLAG_DATAGRAM 0x00000008
118 #define SECPKG_FLAG_CONNECTION 0x00000010
119 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020
120 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040
121 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080
122 #define SECPKG_FLAG_IMPERSONATION 0x00000100
123 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200
124 #define SECPKG_FLAG_STREAM 0x00000400
125 #define SECPKG_FLAG_NEGOTIABLE 0x00000800
126 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000
127 #define SECPKG_FLAG_LOGON 0x00002000
128 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000
129 #define SECPKG_FLAG_FRAGMENT 0x00008000
130 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000
131 #define SECPKG_FLAG_DELEGATION 0x00020000
132 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
133 #define SECPKG_FLAG_RESTRICTED_TOKENS 0x00080000
134 #define SECPKG_FLAG_NEGO_EXTENDER 0x00100000
135 #define SECPKG_FLAG_NEGOTIABLE2 0x00200000
136 #define SECPKG_FLAG_APPCONTAINER_PASSTHROUGH 0x00400000
137 #define SECPKG_FLAG_APPCONTAINER_CHECKS 0x00800000
139 #define SECPKG_ID_NONE 0xffff
141 typedef struct _SecBuffer
143 ULONG cbBuffer;
144 ULONG BufferType;
145 PVOID pvBuffer;
146 } SecBuffer, *PSecBuffer;
148 /* values for BufferType */
149 #define SECBUFFER_EMPTY 0
150 #define SECBUFFER_DATA 1
151 #define SECBUFFER_TOKEN 2
152 #define SECBUFFER_PKG_PARAMS 3
153 #define SECBUFFER_MISSING 4
154 #define SECBUFFER_EXTRA 5
155 #define SECBUFFER_STREAM_TRAILER 6
156 #define SECBUFFER_STREAM_HEADER 7
157 #define SECBUFFER_NEGOTIATION_INFO 8
158 #define SECBUFFER_PADDING 9
159 #define SECBUFFER_STREAM 10
160 #define SECBUFFER_MECHLIST 11
161 #define SECBUFFER_MECHLIST_SIGNATURE 12
162 #define SECBUFFER_TARGET 13
163 #define SECBUFFER_CHANNEL_BINDINGS 14
165 #define SECBUFFER_ATTRMASK 0xf0000000
166 #define SECBUFFER_READONLY 0x80000000
167 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
168 #define SECBUFFER_RESERVED 0x60000000
170 typedef struct _SecBufferDesc
172 ULONG ulVersion;
173 ULONG cBuffers;
174 PSecBuffer pBuffers;
175 } SecBufferDesc, *PSecBufferDesc;
177 /* values for ulVersion */
178 #define SECBUFFER_VERSION 0
180 typedef void (SEC_ENTRY *SEC_GET_KEY_FN)(void *Arg, void *Principal,
181 ULONG KeyVer, void **Key, SECURITY_STATUS *Status);
183 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(PULONG pcPackages,
184 PSecPkgInfoA *ppPackageInfo);
185 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(PULONG pcPackages,
186 PSecPkgInfoW *ppPackageInfo);
187 #define EnumerateSecurityPackages WINELIB_NAME_AW(EnumerateSecurityPackages)
189 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_A)(PULONG,
190 PSecPkgInfoA *);
191 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_W)(PULONG,
192 PSecPkgInfoW *);
193 #define ENUMERATE_SECURITY_PACKAGES_FN WINELIB_NAME_AW(ENUMERATE_SECURITY_PACKAGES_FN_)
195 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(
196 PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
197 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(
198 PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
199 #define QueryCredentialsAttributes WINELIB_NAME_AW(QueryCredentialsAttributes)
201 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_A)
202 (PCredHandle, ULONG, PVOID);
203 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_W)
204 (PCredHandle, ULONG, PVOID);
205 #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_)
207 typedef struct _SEC_CHANNEL_BINDINGS {
208 ULONG dwInitiatorAddrType;
209 ULONG cbInitiatorLength;
210 ULONG dwInitiatorOffset;
211 ULONG dwAcceptorAddrType;
212 ULONG cbAcceptorLength;
213 ULONG dwAcceptorOffset;
214 ULONG cbApplicationDataLength;
215 ULONG dwApplicationDataOffset;
216 } SEC_CHANNEL_BINDINGS, *PSEC_CHANNEL_BINDINGS;
218 /* values for QueryCredentialsAttributes ulAttribute */
219 #define SECPKG_CRED_ATTR_NAMES 1
221 /* types for QueryCredentialsAttributes */
222 typedef struct _SecPkgCredentials_NamesA
224 SEC_CHAR *sUserName;
225 } SecPkgCredentials_NamesA, *PSecPkgCredentials_NamesA;
227 typedef struct _SecPkgCredentials_NamesW
229 SEC_WCHAR *sUserName;
230 } SecPkgCredentials_NamesW, *PSecPkgCredentials_NamesW;
232 #define SecPkgCredentials_Names WINELIB_NAME_AW(SecPkgCredentials_Names)
234 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(
235 SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse,
236 PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
237 PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
238 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(
239 SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse,
240 PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
241 PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
242 #define AcquireCredentialsHandle WINELIB_NAME_AW(AcquireCredentialsHandle)
244 /* flags for fCredentialsUse */
245 #define SECPKG_CRED_INBOUND 0x00000001
246 #define SECPKG_CRED_OUTBOUND 0x00000002
247 #define SECPKG_CRED_BOTH (SECPKG_CRED_INBOUND | SECPKG_CRED_OUTBOUND)
248 #define SECPKG_CRED_DEFAULT 0x00000004
249 #define SECPKG_CRED_RESERVED 0xf0000000
251 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_A)(
252 SEC_CHAR *, SEC_CHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
253 PCredHandle, PTimeStamp);
254 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
255 SEC_WCHAR *, SEC_WCHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
256 PCredHandle, PTimeStamp);
257 #define ACQUIRE_CREDENTIALS_HANDLE_FN WINELIB_NAME_AW(ACQUIRE_CREDENTIALS_HANDLE_FN_)
259 SECURITY_STATUS SEC_ENTRY FreeContextBuffer(PVOID pv);
261 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CONTEXT_BUFFER_FN)(PVOID);
263 SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(PCredHandle
264 phCredential);
266 #define FreeCredentialHandle FreeCredentialsHandle
268 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CREDENTIALS_HANDLE_FN)(PCredHandle);
270 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(
271 PCredHandle phCredential, PCtxtHandle phContext,
272 SEC_CHAR *pszTargetName, ULONG fContextReq,
273 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
274 ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
275 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
276 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(
277 PCredHandle phCredential, PCtxtHandle phContext,
278 SEC_WCHAR *pszTargetName, ULONG fContextReq,
279 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
280 ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
281 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
282 #define InitializeSecurityContext WINELIB_NAME_AW(InitializeSecurityContext)
284 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_A)
285 (PCredHandle, PCtxtHandle, SEC_CHAR *, ULONG, ULONG, ULONG, PSecBufferDesc,
286 ULONG, PCtxtHandle, PSecBufferDesc, ULONG *, PTimeStamp);
287 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_W)
288 (PCredHandle, PCtxtHandle, SEC_WCHAR *, ULONG, ULONG, ULONG, PSecBufferDesc,
289 ULONG, PCtxtHandle, PSecBufferDesc, ULONG *, PTimeStamp);
290 #define INITIALIZE_SECURITY_CONTEXT_FN WINELIB_NAME_AW(INITIALIZE_SECURITY_CONTEXT_FN_)
292 /* flags for InitializeSecurityContext fContextReq and pfContextAttr */
293 #define ISC_REQ_DELEGATE 0x00000001
294 #define ISC_REQ_MUTUAL_AUTH 0x00000002
295 #define ISC_REQ_REPLAY_DETECT 0x00000004
296 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
297 #define ISC_REQ_CONFIDENTIALITY 0x00000010
298 #define ISC_REQ_USE_SESSION_KEY 0x00000020
299 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
300 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
301 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
302 #define ISC_REQ_USE_DCE_STYLE 0x00000200
303 #define ISC_REQ_DATAGRAM 0x00000400
304 #define ISC_REQ_CONNECTION 0x00000800
305 #define ISC_REQ_CALL_LEVEL 0x00001000
306 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
307 #define ISC_REQ_EXTENDED_ERROR 0x00004000
308 #define ISC_REQ_STREAM 0x00008000
309 #define ISC_REQ_INTEGRITY 0x00010000
310 #define ISC_REQ_IDENTIFY 0x00020000
311 #define ISC_REQ_NULL_SESSION 0x00040000
312 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
313 #define ISC_REQ_RESERVED1 0x00100000
314 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
316 #define ISC_RET_DELEGATE 0x00000001
317 #define ISC_RET_MUTUAL_AUTH 0x00000002
318 #define ISC_RET_REPLAY_DETECT 0x00000004
319 #define ISC_RET_SEQUENCE_DETECT 0x00000008
320 #define ISC_RET_CONFIDENTIALITY 0x00000010
321 #define ISC_RET_USE_SESSION_KEY 0x00000020
322 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
323 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
324 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
325 #define ISC_RET_USED_DCE_STYLE 0x00000200
326 #define ISC_RET_DATAGRAM 0x00000400
327 #define ISC_RET_CONNECTION 0x00000800
328 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
329 #define ISC_RET_CALL_LEVEL 0x00002000
330 #define ISC_RET_EXTENDED_ERROR 0x00004000
331 #define ISC_RET_STREAM 0x00008000
332 #define ISC_RET_INTEGRITY 0x00010000
333 #define ISC_RET_IDENTIFY 0x00020000
334 #define ISC_RET_NULL_SESSION 0x00040000
335 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
336 #define ISC_RET_RESERVED1 0x00100000
337 #define ISC_RET_FRAGMENT_ONLY 0x00200000
339 SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(
340 PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput,
341 ULONG fContextReq, ULONG TargetDataRep,
342 PCtxtHandle phNewContext, PSecBufferDesc pOutput,
343 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
345 typedef SECURITY_STATUS (SEC_ENTRY *ACCEPT_SECURITY_CONTEXT_FN)(PCredHandle,
346 PCtxtHandle, PSecBufferDesc, ULONG, ULONG, PCtxtHandle,
347 PSecBufferDesc, ULONG *, PTimeStamp);
349 /* flags for AcceptSecurityContext fContextReq and pfContextAttr */
350 #define ASC_REQ_DELEGATE 0x00000001
351 #define ASC_REQ_MUTUAL_AUTH 0x00000002
352 #define ASC_REQ_REPLAY_DETECT 0x00000004
353 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
354 #define ASC_REQ_CONFIDENTIALITY 0x00000010
355 #define ASC_REQ_USE_SESSION_KEY 0x00000020
356 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
357 #define ASC_REQ_USE_DCE_STYLE 0x00000200
358 #define ASC_REQ_DATAGRAM 0x00000400
359 #define ASC_REQ_CONNECTION 0x00000800
360 #define ASC_REQ_CALL_LEVEL 0x00001000
361 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
362 #define ASC_REQ_EXTENDED_ERROR 0x00008000
363 #define ASC_REQ_STREAM 0x00010000
364 #define ASC_REQ_INTEGRITY 0x00020000
365 #define ASC_REQ_LICENSING 0x00040000
366 #define ASC_REQ_IDENTIFY 0x00080000
367 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
368 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
369 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
370 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
371 #define ASC_REQ_FRAGMENT_NO_TOKEN 0x01000000
373 #define ASC_RET_DELEGATE 0x00000001
374 #define ASC_RET_MUTUAL_AUTH 0x00000002
375 #define ASC_RET_REPLAY_DETECT 0x00000004
376 #define ASC_RET_SEQUENCE_DETECT 0x00000008
377 #define ASC_RET_CONFIDENTIALITY 0x00000010
378 #define ASC_RET_USE_SESSION_KEY 0x00000020
379 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
380 #define ASC_RET_USED_DCE_STYLE 0x00000200
381 #define ASC_RET_DATAGRAM 0x00000400
382 #define ASC_RET_CONNECTION 0x00000800
383 #define ASC_RET_CALL_LEVEL 0x00002000
384 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
385 #define ASC_RET_EXTENDED_ERROR 0x00008000
386 #define ASC_RET_STREAM 0x00010000
387 #define ASC_RET_INTEGRITY 0x00020000
388 #define ASC_RET_LICENSING 0x00040000
389 #define ASC_RET_IDENTIFY 0x00080000
390 #define ASC_RET_NULL_SESSION 0x00100000
391 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
392 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000
393 #define ASC_RET_FRAGMENT_ONLY 0x00800000
394 #define ASC_RET_NO_TOKEN 0x01000000
396 /* values for TargetDataRep */
397 #define SECURITY_NATIVE_DREP 0x00000010
398 #define SECURITY_NETWORK_DREP 0x00000000
400 SECURITY_STATUS SEC_ENTRY CompleteAuthToken(PCtxtHandle phContext,
401 PSecBufferDesc pToken);
403 typedef SECURITY_STATUS (SEC_ENTRY *COMPLETE_AUTH_TOKEN_FN)(PCtxtHandle,
404 PSecBufferDesc);
406 SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(PCtxtHandle phContext);
408 typedef SECURITY_STATUS (SEC_ENTRY *DELETE_SECURITY_CONTEXT_FN)(PCtxtHandle);
410 SECURITY_STATUS SEC_ENTRY ApplyControlToken(PCtxtHandle phContext,
411 PSecBufferDesc pInput);
413 typedef SECURITY_STATUS (SEC_ENTRY *APPLY_CONTROL_TOKEN_FN)(PCtxtHandle,
414 PSecBufferDesc);
416 SECURITY_STATUS SEC_ENTRY QueryContextAttributesA(PCtxtHandle phContext,
417 ULONG ulAttribute, void *pBuffer);
418 SECURITY_STATUS SEC_ENTRY QueryContextAttributesW(PCtxtHandle phContext,
419 ULONG ulAttribute, void *pBuffer);
420 #define QueryContextAttributes WINELIB_NAME_AW(QueryContextAttributes)
422 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
423 ULONG, void *);
424 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
425 ULONG, void *);
426 #define QUERY_CONTEXT_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CONTEXT_ATTRIBUTES_FN_)
428 /* values for QueryContextAttributes/SetContextAttributes ulAttribute */
429 #define SECPKG_ATTR_SIZES 0
430 #define SECPKG_ATTR_NAMES 1
431 #define SECPKG_ATTR_LIFESPAN 2
432 #define SECPKG_ATTR_DCE_INFO 3
433 #define SECPKG_ATTR_STREAM_SIZES 4
434 #define SECPKG_ATTR_KEY_INFO 5
435 #define SECPKG_ATTR_AUTHORITY 6
436 #define SECPKG_ATTR_PROTO_INFO 7
437 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
438 #define SECPKG_ATTR_SESSION_KEY 9
439 #define SECPKG_ATTR_PACKAGE_INFO 10
440 #define SECPKG_ATTR_USER_FLAGS 11
441 #define SECPKG_ATTR_NEGOTIATION_INFO 12
442 #define SECPKG_ATTR_NATIVE_NAMES 13
443 #define SECPKG_ATTR_FLAGS 14
444 #define SECPKG_ATTR_USE_VALIDATED 15
445 #define SECPKG_ATTR_CREDENTIAL_NAME 16
446 #define SECPKG_ATTR_TARGET_INFORMATION 17
447 #define SECPKG_ATTR_ACCESS_TOKEN 18
448 #define SECPKG_ATTR_TARGET 19
449 #define SECPKG_ATTR_AUTHENTICATION_ID 20
450 #define SECPKG_ATTR_LOGOFF_TIME 21
451 #define SECPKG_ATTR_NEGO_KEYS 22
452 #define SECPKG_ATTR_PROMPTING_NEEDED 24
453 #define SECPKG_ATTR_UNIQUE_BINDINGS 25
454 #define SECPKG_ATTR_ENDPOINT_BINDINGS 26
455 #define SECPKG_ATTR_CLIENT_SPECIFIED_TARGET 27
456 #define SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS 30
457 #define SECPKG_ATTR_NEGO_PKG_INFO 31
458 #define SECPKG_ATTR_NEGO_STATUS 32
459 #define SECPKG_ATTR_CONTEXT_DELETED 33
461 #define SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES 128
462 #define SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS 0x1
463 #define SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM 0x2
465 /* types for QueryContextAttributes/SetContextAttributes */
467 typedef struct _SecPkgContext_Sizes
469 ULONG cbMaxToken;
470 ULONG cbMaxSignature;
471 ULONG cbBlockSize;
472 ULONG cbSecurityTrailer;
473 } SecPkgContext_Sizes, *PSecPkgContext_Sizes;
475 typedef struct _SecPkgContext_StreamSizes
477 ULONG cbHeader;
478 ULONG cbTrailer;
479 ULONG cbMaximumMessage;
480 ULONG cbBuffers;
481 ULONG cbBlockSize;
482 } SecPkgContext_StreamSizes, *PSecPkgContext_StreamSizes;
484 typedef struct _SecPkgContext_NamesA
486 SEC_CHAR *sUserName;
487 } SecPkgContext_NamesA, *PSecPkgContext_NamesA;
489 typedef struct _SecPkgContext_NamesW
491 SEC_WCHAR *sUserName;
492 } SecPkgContext_NamesW, *PSecPkgContext_NamesW;
494 #define SecPkgContext_Names WINELIB_NAME_AW(SecPkgContext_Names)
495 #define PSecPkgContext_Names WINELIB_NAME_AW(PSecPkgContext_Names)
497 typedef struct _SecPkgContext_Lifespan
499 TimeStamp tsStart;
500 TimeStamp tsExpiry;
501 } SecPkgContext_Lifespan, *PSecPkgContext_Lifespan;
503 typedef struct _SecPkgContext_DceInfo
505 ULONG AuthzSvc;
506 PVOID pPac;
507 } SecPkgContext_DceInfo, *PSecPkgContext_DceInfo;
509 typedef struct _SecPkgContext_KeyInfoA
511 SEC_CHAR *sSignatureAlgorithmName;
512 SEC_CHAR *sEncryptAlgorithmName;
513 ULONG KeySize;
514 ULONG SignatureAlgorithm;
515 ULONG EncryptAlgorithm;
516 } SecPkgContext_KeyInfoA, *PSecPkgContext_KeyInfoA;
518 typedef struct _SecPkgContext_KeyInfoW
520 SEC_WCHAR *sSignatureAlgorithmName;
521 SEC_WCHAR *sEncryptAlgorithmName;
522 ULONG KeySize;
523 ULONG SignatureAlgorithm;
524 ULONG EncryptAlgorithm;
525 } SecPkgContext_KeyInfoW, *PSecPkgContext_KeyInfoW;
527 #define SecPkgContext_KeyInfo WINELIB_NAME_AW(SecPkgContext_KeyInfo)
528 #define PSecPkgContext_KeyInfo WINELIB_NAME_AW(PSecPkgContext_KeyInfo)
530 typedef struct _SecPkgContext_AuthorityA
532 SEC_CHAR *sAuthorityName;
533 } SecPkgContext_AuthorityA, *PSecPkgContext_AuthorityA;
535 typedef struct _SecPkgContext_AuthorityW
537 SEC_WCHAR *sAuthorityName;
538 } SecPkgContext_AuthorityW, *PSecPkgContext_AuthorityW;
540 #define SecPkgContext_Authority WINELIB_NAME_AW(SecPkgContext_Authority)
541 #define PSecPkgContext_Authority WINELIB_NAME_AW(PSecPkgContext_Authority)
543 typedef struct _SecPkgContext_ProtoInfoA
545 SEC_CHAR *sProtocolName;
546 ULONG majorVersion;
547 ULONG minorVersion;
548 } SecPkgContext_ProtoInfoA, *PSecPkgContext_ProtoInfoA;
550 typedef struct _SecPkgContext_ProtoInfoW
552 SEC_WCHAR *sProtocolName;
553 ULONG majorVersion;
554 ULONG minorVersion;
555 } SecPkgContext_ProtoInfoW, *PSecPkgContext_ProtoInfoW;
557 #define SecPkgContext_ProtoInfo WINELIB_NAME_AW(SecPkgContext_ProtoInfo)
558 #define PSecPkgContext_ProtoInfo WINELIB_NAME_AW(PSecPkgContext_ProtoInfo)
560 typedef struct _SecPkgContext_PasswordExpiry
562 TimeStamp tsPasswordExpires;
563 } SecPkgContext_PasswordExpiry, *PSecPkgContext_PasswordExpiry;
565 typedef struct _SecPkgContext_SessionKey
567 ULONG SessionKeyLength;
568 unsigned char *SessionKey;
569 } SecPkgContext_SessionKey, *PSecPkgContext_SessionKey;
571 typedef struct _SecPkgContext_PackageInfoA
573 PSecPkgInfoA PackageInfo;
574 } SecPkgContext_PackageInfoA, *PSecPkgContext_PackageInfoA;
576 typedef struct _SecPkgContext_PackageInfoW
578 PSecPkgInfoW PackageInfo;
579 } SecPkgContext_PackageInfoW, *PSecPkgContext_PackageInfoW;
581 #define SecPkgContext_PackageInfo WINELIB_NAME_AW(SecPkgContext_PackageInfo)
582 #define PSecPkgContext_PackageInfo WINELIB_NAME_AW(PSecPkgContext_PackageInfo)
584 typedef struct _SecPkgContext_Flags
586 ULONG Flags;
587 } SecPkgContext_Flags, *PSecPkgContext_Flags;
589 typedef struct _SecPkgContext_UserFlags
591 ULONG UserFlags;
592 } SecPkgContext_UserFlags, *PSecPkgContext_UserFlags;
594 typedef struct _SecPkgContext_NegotiationInfoA
596 PSecPkgInfoA PackageInfo;
597 ULONG NegotiationState;
598 } SecPkgContext_NegotiationInfoA, *PSecPkgContext_NegotiationInfoA;
600 typedef struct _SecPkgContext_NegotiationInfoW
602 PSecPkgInfoW PackageInfo;
603 ULONG NegotiationState;
604 } SecPkgContext_NegotiationInfoW, *PSecPkgContext_NegotiationInfoW;
606 #define SecPkgContext_NegotiationInfo WINELIB_NAME_AW(SecPkgContext_NegotiationInfo)
607 #define PSecPkgContext_NegotiationInfo WINELIB_NAME_AW(PSecPkgContext_NegotiationInfo)
609 /* values for NegotiationState */
610 #define SECPKG_NEGOTIATION_COMPLETE 0
611 #define SECPKG_NEGOTIATION_OPTIMISTIC 1
612 #define SECPKG_NEGOTIATION_IN_PROGRESS 2
613 #define SECPKG_NEGOTIATION_DIRECT 3
614 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
616 typedef struct _SecPkgContext_NativeNamesA
618 SEC_CHAR *sClientName;
619 SEC_CHAR *sServerName;
620 } SecPkgContext_NativeNamesA, *PSecPkgContext_NativeNamesA;
622 typedef struct _SecPkgContext_NativeNamesW
624 SEC_WCHAR *sClientName;
625 SEC_WCHAR *sServerName;
626 } SecPkgContext_NativeNamesW, *PSecPkgContext_NativeNamesW;
628 #define SecPkgContext_NativeNames WINELIB_NAME_AW(SecPkgContext_NativeNames)
629 #define PSecPkgContext_NativeNames WINELIB_NAME_AW(PSecPkgContext_NativeNames)
631 typedef struct _SecPkgContext_CredentialNameA
633 ULONG CredentialType;
634 SEC_CHAR *sCredentialName;
635 } SecPkgContext_CredentialNameA, *PSecPkgContext_CredentialNameA;
637 typedef struct _SecPkgContext_CredentialNameW
639 ULONG CredentialType;
640 SEC_WCHAR *sCredentialName;
641 } SecPkgContext_CredentialNameW, *PSecPkgContext_CredentialNameW;
643 #define SecPkgContext_CredentialName WINELIB_NAME_AW(SecPkgContext_CredentialName)
644 #define PSecPkgContext_CredentialName WINELIB_NAME_AW(PSecPkgContext_CredentialName)
646 typedef struct _SecPkgContext_AccessToken
648 void *AccessToken;
649 } SecPkgContext_AccessToken, *PSecPkgContext_AccessToken;
651 typedef struct _SecPkgContext_TargetInformation
653 ULONG MarshalledTargetInfoLength;
654 unsigned char *MarshalledTargetInfo;
655 } SecPkgContext_TargetInformation, *PSecPkgContext_TargetInformation;
657 typedef struct _SecPkgContext_AuthzID
659 ULONG AuthzIDLength;
660 char *AuthzID;
661 } SecPkgContext_AuthzID, *PSecPkgContext_AuthzID;
663 typedef struct _SecPkgContext_Target
665 ULONG TargetLength;
666 char *Target;
667 } SecPkgContext_Target, *PSecPkgContext_Target;
669 typedef struct _SecPkgContext_Bindings
671 ULONG BindingsLength;
672 SEC_CHANNEL_BINDINGS *Bindings;
673 } SecPkgContext_Bindings, *PSecPkgContext_Bindings;
675 SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(PCtxtHandle phContext);
677 typedef SECURITY_STATUS (SEC_ENTRY *IMPERSONATE_SECURITY_CONTEXT_FN)
678 (PCtxtHandle);
680 SECURITY_STATUS SEC_ENTRY RevertSecurityContext(PCtxtHandle phContext);
682 typedef SECURITY_STATUS (SEC_ENTRY *REVERT_SECURITY_CONTEXT_FN)(PCtxtHandle);
684 SECURITY_STATUS SEC_ENTRY MakeSignature(PCtxtHandle phContext,
685 ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo);
687 typedef SECURITY_STATUS (SEC_ENTRY *MAKE_SIGNATURE_FN)(PCtxtHandle,
688 ULONG, PSecBufferDesc, ULONG);
690 SECURITY_STATUS SEC_ENTRY VerifySignature(PCtxtHandle phContext,
691 PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
693 typedef SECURITY_STATUS (SEC_ENTRY *VERIFY_SIGNATURE_FN)(PCtxtHandle,
694 PSecBufferDesc, ULONG, PULONG);
696 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(
697 SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo);
698 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(
699 SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo);
700 #define QuerySecurityPackageInfo WINELIB_NAME_AW(QuerySecurityPackageInfo)
702 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_A)
703 (SEC_CHAR *, PSecPkgInfoA *);
704 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_W)
705 (SEC_WCHAR *, PSecPkgInfoW *);
706 #define QUERY_SECURITY_PACKAGE_INFO_FN WINELIB_NAME_AW(QUERY_SECURITY_PACKAGE_INFO_FN_)
708 SECURITY_STATUS SEC_ENTRY ExportSecurityContext(PCtxtHandle phContext,
709 ULONG fFlags, PSecBuffer pPackedContext, void **pToken);
711 typedef SECURITY_STATUS (SEC_ENTRY *EXPORT_SECURITY_CONTEXT_FN)(PCtxtHandle,
712 ULONG, PSecBuffer, void **);
714 /* values for ExportSecurityContext fFlags */
715 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001
716 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
718 SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(SEC_CHAR *pszPackage,
719 PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
720 SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR *pszPackage,
721 PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
722 #define ImportSecurityContext WINELIB_NAME_AW(ImportSecurityContext)
724 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_A)(SEC_CHAR *,
725 PSecBuffer, void *, PCtxtHandle);
726 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_W)(SEC_WCHAR *,
727 PSecBuffer, void *, PCtxtHandle);
728 #define IMPORT_SECURITY_CONTEXT_FN WINELIB_NAME_AW(IMPORT_SECURITY_CONTEXT_FN_)
730 SECURITY_STATUS SEC_ENTRY AddCredentialsA(PCredHandle hCredentials,
731 SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse,
732 void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
733 PTimeStamp ptsExpiry);
734 SECURITY_STATUS SEC_ENTRY AddCredentialsW(PCredHandle hCredentials,
735 SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse,
736 void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
737 PTimeStamp ptsExpiry);
738 #define AddCredentials WINELIB_NAME_AW(AddCredentials)
740 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_A)(PCredHandle,
741 SEC_CHAR *, SEC_CHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
742 PTimeStamp);
743 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_W)(PCredHandle,
744 SEC_WCHAR *, SEC_WCHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
745 PTimeStamp);
747 SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(PCtxtHandle phContext,
748 HANDLE *phToken);
750 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_CONTEXT_TOKEN_FN)
751 (PCtxtHandle, HANDLE *);
753 SECURITY_STATUS SEC_ENTRY EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
754 PSecBufferDesc pMessage, ULONG MessageSeqNo);
755 SECURITY_STATUS SEC_ENTRY DecryptMessage(PCtxtHandle phContext,
756 PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
758 /* values for EncryptMessage fQOP */
759 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
761 typedef SECURITY_STATUS (SEC_ENTRY *ENCRYPT_MESSAGE_FN)(PCtxtHandle, ULONG,
762 PSecBufferDesc, ULONG);
763 typedef SECURITY_STATUS (SEC_ENTRY *DECRYPT_MESSAGE_FN)(PCtxtHandle,
764 PSecBufferDesc, ULONG, PULONG);
766 SECURITY_STATUS SEC_ENTRY SetContextAttributesA(PCtxtHandle phContext,
767 ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
768 SECURITY_STATUS SEC_ENTRY SetContextAttributesW(PCtxtHandle phContext,
769 ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
770 #define SetContextAttributes WINELIB_NAME_AW(SetContextAttributes)
772 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
773 ULONG, void *, ULONG);
774 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
775 ULONG, void *, ULONG);
777 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
778 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
779 #define SECURITY_ENTRYPOINT_ANSI WINELIB_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
781 typedef struct _SECURITY_FUNCTION_TABLE_A
783 ULONG dwVersion;
784 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA;
785 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
786 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA;
787 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
788 void *Reserved2;
789 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA;
790 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
791 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
792 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
793 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
794 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA;
795 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
796 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
797 MAKE_SIGNATURE_FN MakeSignature;
798 VERIFY_SIGNATURE_FN VerifySignature;
799 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
800 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA;
801 void *Reserved3;
802 void *Reserved4;
803 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
804 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA;
805 ADD_CREDENTIALS_FN_A AddCredentialsA;
806 void *Reserved8;
807 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
808 ENCRYPT_MESSAGE_FN EncryptMessage;
809 DECRYPT_MESSAGE_FN DecryptMessage;
810 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA;
811 } SecurityFunctionTableA, *PSecurityFunctionTableA;
813 typedef struct _SECURITY_FUNCTION_TABLE_W
815 ULONG dwVersion;
816 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW;
817 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW;
818 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW;
819 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
820 void *Reserved2;
821 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW;
822 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
823 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
824 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
825 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
826 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW;
827 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
828 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
829 MAKE_SIGNATURE_FN MakeSignature;
830 VERIFY_SIGNATURE_FN VerifySignature;
831 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
832 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW;
833 void *Reserved3;
834 void *Reserved4;
835 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
836 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW;
837 ADD_CREDENTIALS_FN_W AddCredentialsW;
838 void *Reserved8;
839 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
840 ENCRYPT_MESSAGE_FN EncryptMessage;
841 DECRYPT_MESSAGE_FN DecryptMessage;
842 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW;
843 } SecurityFunctionTableW, *PSecurityFunctionTableW;
845 #define SecurityFunctionTable WINELIB_NAME_AW(SecurityFunctionTable)
846 #define PSecurityFunctionTable WINELIB_NAME_AW(PSecurityFunctionTable)
848 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1
849 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
851 PSecurityFunctionTableA SEC_ENTRY InitSecurityInterfaceA(void);
852 PSecurityFunctionTableW SEC_ENTRY InitSecurityInterfaceW(void);
853 #define InitSecurityInterface WINELIB_NAME_AW(InitSecurityInterface)
855 typedef PSecurityFunctionTableA (SEC_ENTRY *INIT_SECURITY_INTERFACE_A)(void);
856 typedef PSecurityFunctionTableW (SEC_ENTRY *INIT_SECURITY_INTERFACE_W)(void);
857 #define INIT_SECURITY_INTERFACE WINELIB_NAME_AW(INIT_SECURITY_INTERFACE_)
859 #ifdef __cplusplus
861 #endif
863 #endif /* ndef __WINE_SSPI_H__ */