server: Convert source files to utf-8.
[wine/multimedia.git] / include / sspi.h
blob29eda33a078314d44798a0ccdbfb9ecc25be38b9
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 unsigned long 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 unsigned long fCapabilities;
93 unsigned short wVersion;
94 unsigned short wRPCID;
95 unsigned long cbMaxToken;
96 SEC_CHAR *Name;
97 SEC_CHAR *Comment;
98 } SecPkgInfoA, *PSecPkgInfoA;
100 typedef struct _SecPkgInfoW
102 unsigned long fCapabilities;
103 unsigned short wVersion;
104 unsigned short wRPCID;
105 unsigned long 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
134 typedef struct _SecBuffer
136 unsigned long cbBuffer;
137 unsigned long BufferType;
138 void *pvBuffer;
139 } SecBuffer, *PSecBuffer;
141 /* values for BufferType */
142 #define SECBUFFER_EMPTY 0
143 #define SECBUFFER_DATA 1
144 #define SECBUFFER_TOKEN 2
145 #define SECBUFFER_PKG_PARAMS 3
146 #define SECBUFFER_MISSING 4
147 #define SECBUFFER_EXTRA 5
148 #define SECBUFFER_STREAM_TRAILER 6
149 #define SECBUFFER_STREAM_HEADER 7
150 #define SECBUFFER_NEGOTIATION_INFO 8
151 #define SECBUFFER_PADDING 9
152 #define SECBUFFER_STREAM 10
153 #define SECBUFFER_MECHLIST 11
154 #define SECBUFFER_MECHLIST_SIGNATURE 12
155 #define SECBUFFER_TARGET 13
156 #define SECBUFFER_CHANNEL_BINDINGS 14
158 #define SECBUFFER_ATTRMASK 0xf0000000
159 #define SECBUFFER_READONLY 0x80000000
160 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
161 #define SECBUFFER_RESERVED 0x60000000
163 typedef struct _SecBufferDesc
165 unsigned long ulVersion;
166 unsigned long cBuffers;
167 PSecBuffer pBuffers;
168 } SecBufferDesc, *PSecBufferDesc;
170 /* values for ulVersion */
171 #define SECBUFFER_VERSION 0
173 typedef void (SEC_ENTRY *SEC_GET_KEY_FN)(void *Arg, void *Principal,
174 unsigned long KeyVer, void **Key, SECURITY_STATUS *Status);
176 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(PULONG pcPackages,
177 PSecPkgInfoA *ppPackageInfo);
178 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(PULONG pcPackages,
179 PSecPkgInfoW *ppPackageInfo);
180 #define EnumerateSecurityPackages WINELIB_NAME_AW(EnumerateSecurityPackages)
182 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_A)(PULONG,
183 PSecPkgInfoA *);
184 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_W)(PULONG,
185 PSecPkgInfoW *);
186 #define ENUMERATE_SECURITY_PACKAGES_FN WINELIB_NAME_AW(ENUMERATE_SECURITY_PACKAGES_FN_)
188 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(
189 PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
190 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(
191 PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
192 #define QueryCredentialsAttributes WINELIB_NAME_AW(QueryCredentialsAttributes)
194 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_A)
195 (PCredHandle, ULONG, PVOID);
196 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_W)
197 (PCredHandle, ULONG, PVOID);
198 #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_)
200 /* values for QueryCredentialsAttributes ulAttribute */
201 #define SECPKG_CRED_ATTR_NAMES 1
203 /* types for QueryCredentialsAttributes */
204 typedef struct _SecPkgCredentials_NamesA
206 SEC_CHAR *sUserName;
207 } SecPkgCredentials_NamesA, *PSecPkgCredentials_NamesA;
209 typedef struct _SecPkgCredentials_NamesW
211 SEC_WCHAR *sUserName;
212 } SecPkgCredentials_NamesW, *PSecPkgCredentials_NamesW;
214 #define SecPkgCredentials_Names WINELIB_NAME_AW(SecPkgCredentials_Names)
216 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(
217 SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse,
218 PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
219 PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
220 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(
221 SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse,
222 PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
223 PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
224 #define AcquireCredentialsHandle WINELIB_NAME_AW(AcquireCredentialsHandle)
226 /* flags for fCredentialsUse */
227 #define SECPKG_CRED_INBOUND 0x00000001
228 #define SECPKG_CRED_OUTBOUND 0x00000002
229 #define SECPKG_CRED_BOTH (SECPKG_CRED_INBOUND | SECPKG_CRED_OUTBOUND)
230 #define SECPKG_CRED_DEFAULT 0x00000004
231 #define SECPKG_CRED_RESERVED 0xf0000000
233 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_A)(
234 SEC_CHAR *, SEC_CHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
235 PCredHandle, PTimeStamp);
236 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
237 SEC_WCHAR *, SEC_WCHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
238 PCredHandle, PTimeStamp);
239 #define ACQUIRE_CREDENTIALS_HANDLE_FN WINELIB_NAME_AW(ACQUIRE_CREDENTIALS_HANDLE_FN_)
241 SECURITY_STATUS SEC_ENTRY FreeContextBuffer(PVOID pv);
243 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CONTEXT_BUFFER_FN)(PVOID);
245 SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(PCredHandle
246 phCredential);
248 #define FreeCredentialHandle FreeCredentialsHandle
250 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CREDENTIALS_HANDLE_FN)(PCredHandle);
252 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(
253 PCredHandle phCredential, PCtxtHandle phContext,
254 SEC_CHAR *pszTargetName, ULONG fContextReq,
255 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
256 ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
257 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
258 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(
259 PCredHandle phCredential, PCtxtHandle phContext,
260 SEC_WCHAR *pszTargetName, ULONG fContextReq,
261 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
262 ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
263 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
264 #define InitializeSecurityContext WINELIB_NAME_AW(InitializeSecurityContext)
266 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_A)
267 (PCredHandle, PCtxtHandle, SEC_CHAR *, ULONG, ULONG, ULONG, PSecBufferDesc,
268 ULONG, PCtxtHandle, PSecBufferDesc, ULONG *, PTimeStamp);
269 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_W)
270 (PCredHandle, PCtxtHandle, SEC_WCHAR *, ULONG, ULONG, ULONG, PSecBufferDesc,
271 ULONG, PCtxtHandle, PSecBufferDesc, ULONG *, PTimeStamp);
272 #define INITIALIZE_SECURITY_CONTEXT_FN WINELIB_NAME_AW(INITIALIZE_SECURITY_CONTEXT_FN_)
274 /* flags for InitializeSecurityContext fContextReq and pfContextAttr */
275 #define ISC_REQ_DELEGATE 0x00000001
276 #define ISC_REQ_MUTUAL_AUTH 0x00000002
277 #define ISC_REQ_REPLAY_DETECT 0x00000004
278 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
279 #define ISC_REQ_CONFIDENTIALITY 0x00000010
280 #define ISC_REQ_USE_SESSION_KEY 0x00000020
281 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
282 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
283 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
284 #define ISC_REQ_USE_DCE_STYLE 0x00000200
285 #define ISC_REQ_DATAGRAM 0x00000400
286 #define ISC_REQ_CONNECTION 0x00000800
287 #define ISC_REQ_CALL_LEVEL 0x00001000
288 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
289 #define ISC_REQ_EXTENDED_ERROR 0x00004000
290 #define ISC_REQ_STREAM 0x00008000
291 #define ISC_REQ_INTEGRITY 0x00010000
292 #define ISC_REQ_IDENTIFY 0x00020000
293 #define ISC_REQ_NULL_SESSION 0x00040000
294 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
295 #define ISC_REQ_RESERVED1 0x00100000
296 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
298 #define ISC_RET_DELEGATE 0x00000001
299 #define ISC_RET_MUTUAL_AUTH 0x00000002
300 #define ISC_RET_REPLAY_DETECT 0x00000004
301 #define ISC_RET_SEQUENCE_DETECT 0x00000008
302 #define ISC_RET_CONFIDENTIALITY 0x00000010
303 #define ISC_RET_USE_SESSION_KEY 0x00000020
304 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
305 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
306 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
307 #define ISC_RET_USED_DCE_STYLE 0x00000200
308 #define ISC_RET_DATAGRAM 0x00000400
309 #define ISC_RET_CONNECTION 0x00000800
310 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
311 #define ISC_RET_CALL_LEVEL 0x00002000
312 #define ISC_RET_EXTENDED_ERROR 0x00004000
313 #define ISC_RET_STREAM 0x00008000
314 #define ISC_RET_INTEGRITY 0x00010000
315 #define ISC_RET_IDENTIFY 0x00020000
316 #define ISC_RET_NULL_SESSION 0x00040000
317 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
318 #define ISC_RET_RESERVED1 0x00100000
319 #define ISC_RET_FRAGMENT_ONLY 0x00200000
321 SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(
322 PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput,
323 ULONG fContextReq, ULONG TargetDataRep,
324 PCtxtHandle phNewContext, PSecBufferDesc pOutput,
325 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
327 typedef SECURITY_STATUS (SEC_ENTRY *ACCEPT_SECURITY_CONTEXT_FN)(PCredHandle,
328 PCtxtHandle, PSecBufferDesc, ULONG, ULONG, PCtxtHandle,
329 PSecBufferDesc, ULONG *, PTimeStamp);
331 /* flags for AcceptSecurityContext fContextReq and pfContextAttr */
332 #define ASC_REQ_DELEGATE 0x00000001
333 #define ASC_REQ_MUTUAL_AUTH 0x00000002
334 #define ASC_REQ_REPLAY_DETECT 0x00000004
335 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
336 #define ASC_REQ_CONFIDENTIALITY 0x00000010
337 #define ASC_REQ_USE_SESSION_KEY 0x00000020
338 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
339 #define ASC_REQ_USE_DCE_STYLE 0x00000200
340 #define ASC_REQ_DATAGRAM 0x00000400
341 #define ASC_REQ_CONNECTION 0x00000800
342 #define ASC_REQ_CALL_LEVEL 0x00001000
343 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
344 #define ASC_REQ_EXTENDED_ERROR 0x00008000
345 #define ASC_REQ_STREAM 0x00010000
346 #define ASC_REQ_INTEGRITY 0x00020000
347 #define ASC_REQ_LICENSING 0x00040000
348 #define ASC_REQ_IDENTIFY 0x00080000
349 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
350 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
351 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
352 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
353 #define ASC_REQ_FRAGMENT_NO_TOKEN 0x01000000
355 #define ASC_RET_DELEGATE 0x00000001
356 #define ASC_RET_MUTUAL_AUTH 0x00000002
357 #define ASC_RET_REPLAY_DETECT 0x00000004
358 #define ASC_RET_SEQUENCE_DETECT 0x00000008
359 #define ASC_RET_CONFIDENTIALITY 0x00000010
360 #define ASC_RET_USE_SESSION_KEY 0x00000020
361 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
362 #define ASC_RET_USED_DCE_STYLE 0x00000200
363 #define ASC_RET_DATAGRAM 0x00000400
364 #define ASC_RET_CONNECTION 0x00000800
365 #define ASC_RET_CALL_LEVEL 0x00002000
366 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
367 #define ASC_RET_EXTENDED_ERROR 0x00008000
368 #define ASC_RET_STREAM 0x00010000
369 #define ASC_RET_INTEGRITY 0x00020000
370 #define ASC_RET_LICENSING 0x00040000
371 #define ASC_RET_IDENTIFY 0x00080000
372 #define ASC_RET_NULL_SESSION 0x00100000
373 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
374 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000
375 #define ASC_RET_FRAGMENT_ONLY 0x00800000
376 #define ASC_RET_NO_TOKEN 0x01000000
378 /* values for TargetDataRep */
379 #define SECURITY_NATIVE_DREP 0x00000010
380 #define SECURITY_NETWORK_DREP 0x00000000
382 SECURITY_STATUS SEC_ENTRY CompleteAuthToken(PCtxtHandle phContext,
383 PSecBufferDesc pToken);
385 typedef SECURITY_STATUS (SEC_ENTRY *COMPLETE_AUTH_TOKEN_FN)(PCtxtHandle,
386 PSecBufferDesc);
388 SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(PCtxtHandle phContext);
390 typedef SECURITY_STATUS (SEC_ENTRY *DELETE_SECURITY_CONTEXT_FN)(PCtxtHandle);
392 SECURITY_STATUS SEC_ENTRY ApplyControlToken(PCtxtHandle phContext,
393 PSecBufferDesc pInput);
395 typedef SECURITY_STATUS (SEC_ENTRY *APPLY_CONTROL_TOKEN_FN)(PCtxtHandle,
396 PSecBufferDesc);
398 SECURITY_STATUS SEC_ENTRY QueryContextAttributesA(PCtxtHandle phContext,
399 ULONG ulAttribute, void *pBuffer);
400 SECURITY_STATUS SEC_ENTRY QueryContextAttributesW(PCtxtHandle phContext,
401 ULONG ulAttribute, void *pBuffer);
402 #define QueryContextAttributes WINELIB_NAME_AW(QueryContextAttributes)
404 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
405 ULONG, void *);
406 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
407 ULONG, void *);
408 #define QUERY_CONTEXT_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CONTEXT_ATTRIBUTES_FN_)
410 /* values for QueryContextAttributes/SetContextAttributes ulAttribute */
411 #define SECPKG_ATTR_SIZES 0
412 #define SECPKG_ATTR_NAMES 1
413 #define SECPKG_ATTR_LIFESPAN 2
414 #define SECPKG_ATTR_DCE_INFO 3
415 #define SECPKG_ATTR_STREAM_SIZES 4
416 #define SECPKG_ATTR_KEY_INFO 5
417 #define SECPKG_ATTR_AUTHORITY 6
418 #define SECPKG_ATTR_PROTO_INFO 7
419 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
420 #define SECPKG_ATTR_SESSION_KEY 9
421 #define SECPKG_ATTR_PACKAGE_INFO 10
422 #define SECPKG_ATTR_USER_FLAGS 11
423 #define SECPKG_ATTR_NEGOTIATION_INFO 12
424 #define SECPKG_ATTR_NATIVE_NAMES 13
425 #define SECPKG_ATTR_FLAGS 14
426 #define SECPKG_ATTR_USE_VALIDATED 15
427 #define SECPKG_ATTR_CREDENTIAL_NAME 16
428 #define SECPKG_ATTR_TARGET_INFORMATION 17
429 #define SECPKG_ATTR_ACCESS_TOKEN 18
430 #define SECPKG_ATTR_TARGET 19
431 #define SECPKG_ATTR_AUTHENTICATION_ID 20
433 /* types for QueryContextAttributes/SetContextAttributes */
435 typedef struct _SecPkgContext_Sizes
437 unsigned long cbMaxToken;
438 unsigned long cbMaxSignature;
439 unsigned long cbBlockSize;
440 unsigned long cbSecurityTrailer;
441 } SecPkgContext_Sizes, *PSecPkgContext_Sizes;
443 typedef struct _SecPkgContext_StreamSizes
445 unsigned long cbHeader;
446 unsigned long cbTrailer;
447 unsigned long cbMaximumMessage;
448 unsigned long cbBuffers;
449 unsigned long cbBlockSize;
450 } SecPkgContext_StreamSizes, *PSecPkgContext_StreamSizes;
452 typedef struct _SecPkgContext_NamesA
454 SEC_CHAR *sUserName;
455 } SecPkgContext_NamesA, *PSecPkgContext_NamesA;
457 typedef struct _SecPkgContext_NamesW
459 SEC_WCHAR *sUserName;
460 } SecPkgContext_NamesW, *PSecPkgContext_NamesW;
462 #define SecPkgContext_Names WINELIB_NAME_AW(SecPkgContext_Names)
463 #define PSecPkgContext_Names WINELIB_NAME_AW(PSecPkgContext_Names)
465 typedef struct _SecPkgContext_Lifespan
467 TimeStamp tsStart;
468 TimeStamp tsExpiry;
469 } SecPkgContext_Lifespan, *PSecPkgContext_Lifespan;
471 typedef struct _SecPkgContext_DceInfo
473 unsigned long AuthzSvc;
474 void *pPac;
475 } SecPkgContext_DceInfo, *PSecPkgContext_DceInfo;
477 typedef struct _SecPkgContext_KeyInfoA
479 SEC_CHAR *sSignatureAlgorithmName;
480 SEC_CHAR *sEncryptAlgorithmName;
481 unsigned long KeySize;
482 unsigned long SignatureAlgorithm;
483 unsigned long EncryptAlgorithm;
484 } SecPkgContext_KeyInfoA, *PSecPkgContext_KeyInfoA;
486 typedef struct _SecPkgContext_KeyInfoW
488 SEC_WCHAR *sSignatureAlgorithmName;
489 SEC_WCHAR *sEncryptAlgorithmName;
490 unsigned long KeySize;
491 unsigned long SignatureAlgorithm;
492 unsigned long EncryptAlgorithm;
493 } SecPkgContext_KeyInfoW, *PSecPkgContext_KeyInfoW;
495 #define SecPkgContext_KeyInfo WINELIB_NAME_AW(SecPkgContext_KeyInfo)
496 #define PSecPkgContext_KeyInfo WINELIB_NAME_AW(PSecPkgContext_KeyInfo)
498 typedef struct _SecPkgContext_AuthorityA
500 SEC_CHAR *sAuthorityName;
501 } SecPkgContext_AuthorityA, *PSecPkgContext_AuthorityA;
503 typedef struct _SecPkgContext_AuthorityW
505 SEC_WCHAR *sAuthorityName;
506 } SecPkgContext_AuthorityW, *PSecPkgContext_AuthorityW;
508 #define SecPkgContext_Authority WINELIB_NAME_AW(SecPkgContext_Authority)
509 #define PSecPkgContext_Authority WINELIB_NAME_AW(PSecPkgContext_Authority)
511 typedef struct _SecPkgContext_ProtoInfoA
513 SEC_CHAR *sProtocolName;
514 unsigned long majorVersion;
515 unsigned long minorVersion;
516 } SecPkgContext_ProtoInfoA, *PSecPkgContext_ProtoInfoA;
518 typedef struct _SecPkgContext_ProtoInfoW
520 SEC_WCHAR *sProtocolName;
521 unsigned long majorVersion;
522 unsigned long minorVersion;
523 } SecPkgContext_ProtoInfoW, *PSecPkgContext_ProtoInfoW;
525 #define SecPkgContext_ProtoInfo WINELIB_NAME_AW(SecPkgContext_ProtoInfo)
526 #define PSecPkgContext_ProtoInfo WINELIB_NAME_AW(PSecPkgContext_ProtoInfo)
528 typedef struct _SecPkgContext_PasswordExpiry
530 TimeStamp tsPasswordExpires;
531 } SecPkgContext_PasswordExpiry, *PSecPkgContext_PasswordExpiry;
533 typedef struct _SecPkgContext_SessionKey
535 unsigned long SessionKeyLength;
536 unsigned char *SessionKey;
537 } SecPkgContext_SessionKey, *PSecPkgContext_SessionKey;
539 typedef struct _SecPkgContext_PackageInfoA
541 PSecPkgInfoA PackageInfo;
542 } SecPkgContext_PackageInfoA, *PSecPkgContext_PackageInfoA;
544 typedef struct _SecPkgContext_PackageInfoW
546 PSecPkgInfoW PackageInfo;
547 } SecPkgContext_PackageInfoW, *PSecPkgContext_PackageInfoW;
549 #define SecPkgContext_PackageInfo WINELIB_NAME_AW(SecPkgContext_PackageInfo)
550 #define PSecPkgContext_PackageInfo WINELIB_NAME_AW(PSecPkgContext_PackageInfo)
552 typedef struct _SecPkgContext_Flags
554 unsigned long Flags;
555 } SecPkgContext_Flags, *PSecPkgContext_Flags;
557 typedef struct _SecPkgContext_UserFlags
559 unsigned long UserFlags;
560 } SecPkgContext_UserFlags, *PSecPkgContext_UserFlags;
562 typedef struct _SecPkgContext_NegotiationInfoA
564 PSecPkgInfoA PackageInfo;
565 unsigned long NegotiationState;
566 } SecPkgContext_NegotiationInfoA, *PSecPkgContext_NegotiationInfoA;
568 typedef struct _SecPkgContext_NegotiationInfoW
570 PSecPkgInfoW PackageInfo;
571 unsigned long NegotiationState;
572 } SecPkgContext_NegotiationInfoW, *PSecPkgContext_NegotiationInfoW;
574 #define SecPkgContext_NegotiationInfo WINELIB_NAME_AW(SecPkgContext_NegotiationInfo)
575 #define PSecPkgContext_NegotiationInfo WINELIB_NAME_AW(PSecPkgContext_NegotiationInfo)
577 /* values for NegotiationState */
578 #define SECPKG_NEGOTIATION_COMPLETE 0
579 #define SECPKG_NEGOTIATION_OPTIMISTIC 1
580 #define SECPKG_NEGOTIATION_IN_PROGRESS 2
581 #define SECPKG_NEGOTIATION_DIRECT 3
582 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
584 typedef struct _SecPkgContext_NativeNamesA
586 SEC_CHAR *sClientName;
587 SEC_CHAR *sServerName;
588 } SecPkgContext_NativeNamesA, *PSecPkgContext_NativeNamesA;
590 typedef struct _SecPkgContext_NativeNamesW
592 SEC_WCHAR *sClientName;
593 SEC_WCHAR *sServerName;
594 } SecPkgContext_NativeNamesW, *PSecPkgContext_NativeNamesW;
596 #define SecPkgContext_NativeNames WINELIB_NAME_AW(SecPkgContext_NativeNames)
597 #define PSecPkgContext_NativeNames WINELIB_NAME_AW(PSecPkgContext_NativeNames)
599 typedef struct _SecPkgContext_CredentialNameA
601 unsigned long CredentialType;
602 SEC_CHAR *sCredentialName;
603 } SecPkgContext_CredentialNameA, *PSecPkgContext_CredentialNameA;
605 typedef struct _SecPkgContext_CredentialNameW
607 unsigned long CredentialType;
608 SEC_WCHAR *sCredentialName;
609 } SecPkgContext_CredentialNameW, *PSecPkgContext_CredentialNameW;
611 #define SecPkgContext_CredentialName WINELIB_NAME_AW(SecPkgContext_CredentialName)
612 #define PSecPkgContext_CredentialName WINELIB_NAME_AW(PSecPkgContext_CredentialName)
614 typedef struct _SecPkgContext_AccessToken
616 void *AccessToken;
617 } SecPkgContext_AccessToken, *PSecPkgContext_AccessToken;
619 typedef struct _SecPkgContext_TargetInformation
621 unsigned long MarshalledTargetInfoLength;
622 unsigned char *MarshalledTargetInfo;
623 } SecPkgContext_TargetInformation, *PSecPkgContext_TargetInformation;
625 typedef struct _SecPkgContext_AuthzID
627 unsigned long AuthzIDLength;
628 char *AuthzID;
629 } SecPkgContext_AuthzID, *PSecPkgContext_AuthzID;
631 typedef struct _SecPkgContext_Target
633 unsigned long TargetLength;
634 char *Target;
635 } SecPkgContext_Target, *PSecPkgContext_Target;
637 SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(PCtxtHandle phContext);
639 typedef SECURITY_STATUS (SEC_ENTRY *IMPERSONATE_SECURITY_CONTEXT_FN)
640 (PCtxtHandle);
642 SECURITY_STATUS SEC_ENTRY RevertSecurityContext(PCtxtHandle phContext);
644 typedef SECURITY_STATUS (SEC_ENTRY *REVERT_SECURITY_CONTEXT_FN)(PCtxtHandle);
646 SECURITY_STATUS SEC_ENTRY MakeSignature(PCtxtHandle phContext,
647 ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo);
649 typedef SECURITY_STATUS (SEC_ENTRY *MAKE_SIGNATURE_FN)(PCtxtHandle,
650 ULONG, PSecBufferDesc, ULONG);
652 SECURITY_STATUS SEC_ENTRY VerifySignature(PCtxtHandle phContext,
653 PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
655 typedef SECURITY_STATUS (SEC_ENTRY *VERIFY_SIGNATURE_FN)(PCtxtHandle,
656 PSecBufferDesc, ULONG, PULONG);
658 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(
659 SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo);
660 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(
661 SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo);
662 #define QuerySecurityPackageInfo WINELIB_NAME_AW(QuerySecurityPackageInfo)
664 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_A)
665 (SEC_CHAR *, PSecPkgInfoA *);
666 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_W)
667 (SEC_WCHAR *, PSecPkgInfoW *);
668 #define QUERY_SECURITY_PACKAGE_INFO_FN WINELIB_NAME_AW(QUERY_SECURITY_PACKAGE_INFO_FN_)
670 SECURITY_STATUS SEC_ENTRY ExportSecurityContext(PCtxtHandle phContext,
671 ULONG fFlags, PSecBuffer pPackedContext, void **pToken);
673 typedef SECURITY_STATUS (SEC_ENTRY *EXPORT_SECURITY_CONTEXT_FN)(PCtxtHandle,
674 ULONG, PSecBuffer, void **);
676 /* values for ExportSecurityContext fFlags */
677 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001
678 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
680 SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(SEC_CHAR *pszPackage,
681 PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
682 SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR *pszPackage,
683 PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
684 #define ImportSecurityContext WINELIB_NAME_AW(ImportSecurityContext)
686 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_A)(SEC_CHAR *,
687 PSecBuffer, void *, PCtxtHandle);
688 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_W)(SEC_WCHAR *,
689 PSecBuffer, void *, PCtxtHandle);
690 #define IMPORT_SECURITY_CONTEXT_FN WINELIB_NAME_AW(IMPORT_SECURITY_CONTEXT_FN_)
692 SECURITY_STATUS SEC_ENTRY AddCredentialsA(PCredHandle hCredentials,
693 SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse,
694 void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
695 PTimeStamp ptsExpiry);
696 SECURITY_STATUS SEC_ENTRY AddCredentialsW(PCredHandle hCredentials,
697 SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse,
698 void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
699 PTimeStamp ptsExpiry);
700 #define AddCredentials WINELIB_NAME_AW(AddCredentials)
702 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_A)(PCredHandle,
703 SEC_CHAR *, SEC_CHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
704 PTimeStamp);
705 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_W)(PCredHandle,
706 SEC_WCHAR *, SEC_WCHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
707 PTimeStamp);
709 SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(PCtxtHandle phContext,
710 HANDLE *phToken);
712 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_CONTEXT_TOKEN_FN)
713 (PCtxtHandle, HANDLE *);
715 SECURITY_STATUS SEC_ENTRY EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
716 PSecBufferDesc pMessage, ULONG MessageSeqNo);
717 SECURITY_STATUS SEC_ENTRY DecryptMessage(PCtxtHandle phContext,
718 PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
720 /* values for EncryptMessage fQOP */
721 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
723 typedef SECURITY_STATUS (SEC_ENTRY *ENCRYPT_MESSAGE_FN)(PCtxtHandle, ULONG,
724 PSecBufferDesc, ULONG);
725 typedef SECURITY_STATUS (SEC_ENTRY *DECRYPT_MESSAGE_FN)(PCtxtHandle,
726 PSecBufferDesc, ULONG, PULONG);
728 SECURITY_STATUS SEC_ENTRY SetContextAttributesA(PCtxtHandle phContext,
729 ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
730 SECURITY_STATUS SEC_ENTRY SetContextAttributesW(PCtxtHandle phContext,
731 ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
732 #define SetContextAttributes WINELIB_NAME_AW(SetContextAttributes)
734 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
735 ULONG, void *, ULONG);
736 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
737 ULONG, void *, ULONG);
739 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
740 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
741 #define SECURITY_ENTRYPOINT_ANSI WINELIB_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
743 typedef struct _SECURITY_FUNCTION_TABLE_A
745 unsigned long dwVersion;
746 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA;
747 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
748 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA;
749 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
750 void *Reserved2;
751 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA;
752 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
753 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
754 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
755 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
756 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA;
757 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
758 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
759 MAKE_SIGNATURE_FN MakeSignature;
760 VERIFY_SIGNATURE_FN VerifySignature;
761 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
762 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA;
763 void *Reserved3;
764 void *Reserved4;
765 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
766 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA;
767 ADD_CREDENTIALS_FN_A AddCredentialsA;
768 void *Reserved8;
769 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
770 ENCRYPT_MESSAGE_FN EncryptMessage;
771 DECRYPT_MESSAGE_FN DecryptMessage;
772 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA;
773 } SecurityFunctionTableA, *PSecurityFunctionTableA;
775 typedef struct _SECURITY_FUNCTION_TABLE_W
777 unsigned long dwVersion;
778 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW;
779 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW;
780 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW;
781 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
782 void *Reserved2;
783 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW;
784 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
785 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
786 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
787 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
788 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW;
789 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
790 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
791 MAKE_SIGNATURE_FN MakeSignature;
792 VERIFY_SIGNATURE_FN VerifySignature;
793 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
794 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW;
795 void *Reserved3;
796 void *Reserved4;
797 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
798 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW;
799 ADD_CREDENTIALS_FN_W AddCredentialsW;
800 void *Reserved8;
801 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
802 ENCRYPT_MESSAGE_FN EncryptMessage;
803 DECRYPT_MESSAGE_FN DecryptMessage;
804 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW;
805 } SecurityFunctionTableW, *PSecurityFunctionTableW;
807 #define SecurityFunctionTable WINELIB_NAME_AW(SecurityFunctionTable)
808 #define PSecurityFunctionTable WINELIB_NAME_AW(PSecurityFunctionTable)
810 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1
811 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
813 PSecurityFunctionTableA SEC_ENTRY InitSecurityInterfaceA(void);
814 PSecurityFunctionTableW SEC_ENTRY InitSecurityInterfaceW(void);
815 #define InitSecurityInterface WINELIB_NAME_AW(InitSecurityInterface)
817 typedef PSecurityFunctionTableA (SEC_ENTRY *INIT_SECURITY_INTERFACE_A)(void);
818 typedef PSecurityFunctionTableW (SEC_ENTRY *INIT_SECURITY_INTERFACE_W)(void);
819 #define INIT_SECURITY_INTERFACE WINELIB_NAME_AW(INIT_SECURITY_INTERFACE_)
821 #ifdef __cplusplus
823 #endif
825 #endif /* ndef __WINE_SSPI_H__ */