dplayx: Fix a typo.
[wine] / include / sspi.h
1 /*
2  * Copyright (C) 2004 Juan Lang
3  *
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.
8  *
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.
13  *
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
17  */
18 #ifndef __WINE_SSPI_H__
19 #define __WINE_SSPI_H__
20
21 /* FIXME: #include <sdkddkver.h> */
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #define SEC_ENTRY __stdcall
28
29 typedef WCHAR SEC_WCHAR;
30 typedef CHAR  SEC_CHAR;
31
32 #ifndef __SECSTATUS_DEFINED__
33 #define __SECSTATUS_DEFINED__
34 typedef LONG SECURITY_STATUS;
35 #endif
36
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
44
45 #ifndef __SECHANDLE_DEFINED__
46 #define __SECHANDLE_DEFINED__
47 typedef struct _SecHandle
48 {
49     ULONG_PTR dwLower;
50     ULONG_PTR dwUpper;
51 } SecHandle, *PSecHandle;
52 #endif
53
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)
58
59 #define SecIsValidHandle(x) \
60  ((((PSecHandle)(x))->dwLower != ((ULONG_PTR)(INT_PTR)-1)) && \
61  (((PSecHandle)(x))->dwUpper != ((ULONG_PTR)(INT_PTR)-1)))
62
63 typedef SecHandle CredHandle;
64 typedef PSecHandle PCredHandle;
65
66 typedef SecHandle CtxtHandle;
67 typedef PSecHandle PCtxtHandle;
68
69 typedef struct _SECURITY_INTEGER
70 {
71     unsigned long LowPart;
72     long HighPart;
73 } SECURITY_INTEGER, *PSECURITY_INTEGER;
74 typedef SECURITY_INTEGER TimeStamp, *PTimeStamp;
75
76 #ifndef __UNICODE_STRING_DEFINED__
77 #define __UNICODE_STRING_DEFINED__
78 typedef struct _UNICODE_STRING {
79   USHORT Length;        /* bytes */
80   USHORT MaximumLength; /* bytes */
81   PWSTR  Buffer;
82 } UNICODE_STRING, *PUNICODE_STRING;
83 #endif
84
85 typedef UNICODE_STRING SECURITY_STRING, *PSECURITY_STRING;
86
87 typedef struct _SecPkgInfoA
88 {
89     unsigned long  fCapabilities;
90     unsigned short wVersion;
91     unsigned short wRPCID;
92     unsigned long  cbMaxToken;
93     SEC_CHAR      *Name;
94     SEC_CHAR      *Comment;
95 } SecPkgInfoA, *PSecPkgInfoA;
96
97 typedef struct _SecPkgInfoW
98 {
99     unsigned long  fCapabilities;
100     unsigned short wVersion;
101     unsigned short wRPCID;
102     unsigned long  cbMaxToken;
103     SEC_WCHAR     *Name;
104     SEC_WCHAR     *Comment;
105 } SecPkgInfoW, *PSecPkgInfoW;
106
107 #define SecPkgInfo WINELIB_NAME_AW(SecPkgInfo)
108 #define PSecPkgInfo WINELIB_NAME_AW(PSecPkgInfo)
109
110 /* fCapabilities field of SecPkgInfo */
111 #define SECPKG_FLAG_INTEGRITY              0x00000001
112 #define SECPKG_FLAG_PRIVACY                0x00000002
113 #define SECPKG_FLAG_TOKEN_ONLY             0x00000004
114 #define SECPKG_FLAG_DATAGRAM               0x00000008
115 #define SECPKG_FLAG_CONNECTION             0x00000010
116 #define SECPKG_FLAG_MULTI_REQUIRED         0x00000020
117 #define SECPKG_FLAG_CLIENT_ONLY            0x00000040
118 #define SECPKG_FLAG_EXTENDED_ERROR         0x00000080
119 #define SECPKG_FLAG_IMPERSONATION          0x00000100
120 #define SECPKG_FLAG_ACCEPT_WIN32_NAME      0x00000200
121 #define SECPKG_FLAG_STREAM                 0x00000400
122 #define SECPKG_FLAG_NEGOTIABLE             0x00000800
123 #define SECPKG_FLAG_GSS_COMPATIBLE         0x00001000
124 #define SECPKG_FLAG_LOGON                  0x00002000
125 #define SECPKG_FLAG_ASCII_BUFFERS          0x00004000
126 #define SECPKG_FLAG_FRAGMENT               0x00008000
127 #define SECPKG_FLAG_MUTUAL_AUTH            0x00010000
128 #define SECPKG_FLAG_DELEGATION             0x00020000
129 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
130
131 typedef struct _SecBuffer
132 {
133     unsigned long cbBuffer;
134     unsigned long BufferType;
135     void         *pvBuffer;
136 } SecBuffer, *PSecBuffer;
137
138 /* values for BufferType */
139 #define SECBUFFER_EMPTY               0
140 #define SECBUFFER_DATA                1
141 #define SECBUFFER_TOKEN               2
142 #define SECBUFFER_PKG_PARAMS          3
143 #define SECBUFFER_MISSING             4
144 #define SECBUFFER_EXTRA               5
145 #define SECBUFFER_STREAM_TRAILER      6
146 #define SECBUFFER_HEADER              7
147 #define SECBUFFER_NEGOTIATION_INFO    8
148 #define SECBUFFER_PADDING             9
149 #define SECBUFFER_STREAM             10
150 #define SECBUFFER_MECHLIST           11
151 #define SECBUFFER_MECHLIST_SIGNATURE 12
152 #define SECBUFFER_TARGET             13
153 #define SECBUFFER_CHANNEL_BINDINGS   14
154
155 #define SECBUFFER_ATTRMASK               0xf0000000
156 #define SECBUFFER_READONLY               0x80000000
157 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
158 #define SECBUFFER_RESERVED               0x60000000
159
160 typedef struct _SecBufferDesc
161 {
162     unsigned long ulVersion;
163     unsigned long cBuffers;
164     PSecBuffer    pBuffers;
165 } SecBufferDesc, *PSecBufferDesc;
166
167 /* values for ulVersion */
168 #define SECBUFFER_VERSION 0
169
170 typedef void (SEC_ENTRY *SEC_GET_KEY_FN)(void *Arg, void *Principal,
171  unsigned long KeyVer, void **Key, SECURITY_STATUS *Status);
172
173 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(PULONG pcPackages,
174  PSecPkgInfoA *ppPackageInfo);
175 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(PULONG pcPackages,
176  PSecPkgInfoW *ppPackageInfo);
177 #define EnumerateSecurityPackages WINELIB_NAME_AW(EnumerateSecurityPackages)
178
179 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_A)(PULONG,
180  PSecPkgInfoA *);
181 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_W)(PULONG,
182  PSecPkgInfoW *);
183 #define ENUMERATE_SECURITY_PACKAGES_FN WINELIB_NAME_AW(ENUMERATE_SECURITY_PACKAGES_FN_)
184
185 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(
186  PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
187 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(
188  PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
189 #define QueryCredentialsAttributes WINELIB_NAME_AW(QueryCredentialsAttributes)
190
191 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_A)
192  (PCredHandle, ULONG, PVOID);
193 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_W)
194  (PCredHandle, ULONG, PVOID);
195 #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_)
196
197 /* values for QueryCredentialsAttributes ulAttribute */
198 #define SECPKG_CRED_ATTR_NAMES 1
199
200 /* types for QueryCredentialsAttributes */
201 typedef struct _SecPkgCredentials_NamesA
202 {
203     SEC_CHAR *sUserName;
204 } SecPkgCredentials_NamesA, *PSecPkgCredentials_NamesA;
205
206 typedef struct _SecPkgCredentials_NamesW
207 {
208     SEC_WCHAR *sUserName;
209 } SecPkgCredentials_NamesW, *PSecPkgCredentials_NamesW;
210
211 #define SecPkgCredentials_Names WINELIB_NAME_AW(SecPkgCredentials_Names)
212
213 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(
214  SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse,
215  PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
216  PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
217 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(
218  SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse,
219  PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
220  PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
221 #define AcquireCredentialsHandle WINELIB_NAME_AW(AcquireCredentialsHandle)
222
223 /* flags for fCredentialsUse */
224 #define SECPKG_CRED_INBOUND  0x00000001
225 #define SECPKG_CRED_OUTBOUND 0x00000002
226 #define SECPKG_CRED_BOTH     (SECPKG_CRED_INBOUND | SECPKG_CRED_OUTBOUND)
227 #define SECPKG_CRED_DEFAULT  0x00000004
228 #define SECPKG_CRED_RESERVED 0xf0000000
229
230 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_A)(
231  SEC_CHAR *, SEC_CHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
232  PCredHandle, PTimeStamp);
233 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
234  SEC_WCHAR *, SEC_WCHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
235  PCredHandle, PTimeStamp);
236 #define ACQUIRE_CREDENTIALS_HANDLE_FN WINELIB_NAME_AW(ACQUIRE_CREDENTIALS_HANDLE_FN_)
237
238 SECURITY_STATUS SEC_ENTRY FreeContextBuffer(PVOID pv);
239
240 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CONTEXT_BUFFER_FN)(PVOID);
241
242 SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(PCredHandle
243  phCredential);
244
245 #define FreeCredentialHandle FreeCredentialsHandle
246
247 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CREDENTIALS_HANDLE_FN)(PCredHandle);
248
249 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(
250  PCredHandle phCredential, PCtxtHandle phContext,
251  SEC_CHAR *pszTargetName, ULONG fContextReq,
252  ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
253  ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
254  ULONG *pfContextAttr, PTimeStamp ptsExpiry);
255 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(
256  PCredHandle phCredential, PCtxtHandle phContext,
257  SEC_WCHAR *pszTargetName, ULONG fContextReq,
258  ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
259  ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
260  ULONG *pfContextAttr, PTimeStamp ptsExpiry);
261 #define InitializeSecurityContext WINELIB_NAME_AW(InitializeSecurityContext)
262
263 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_A)
264  (PCredHandle, PCtxtHandle, SEC_CHAR *, ULONG, ULONG, ULONG, PSecBufferDesc,
265  ULONG, PCtxtHandle, PSecBufferDesc, ULONG *, PTimeStamp);
266 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_W)
267  (PCredHandle, PCtxtHandle, SEC_WCHAR *, ULONG, ULONG, ULONG, PSecBufferDesc,
268  ULONG, PCtxtHandle, PSecBufferDesc, ULONG *, PTimeStamp);
269 #define INITIALIZE_SECURITY_CONTEXT_FN WINELIB_NAME_AW(INITIALIZE_SECURITY_CONTEXT_FN_)
270
271 /* flags for InitializeSecurityContext fContextReq and pfContextAttr */
272 #define ISC_REQ_DELEGATE               0x00000001
273 #define ISC_REQ_MUTUAL_AUTH            0x00000002
274 #define ISC_REQ_REPLAY_DETECT          0x00000004
275 #define ISC_REQ_SEQUENCE_DETECT        0x00000008
276 #define ISC_REQ_CONFIDENTIALITY        0x00000010
277 #define ISC_REQ_USE_SESSION_KEY        0x00000020
278 #define ISC_REQ_PROMPT_FOR_CREDS       0x00000040
279 #define ISC_REQ_USE_SUPPLIED_CREDS     0x00000080
280 #define ISC_REQ_ALLOCATE_MEMORY        0x00000100
281 #define ISC_REQ_USE_DCE_STYLE          0x00000200
282 #define ISC_REQ_DATAGRAM               0x00000400
283 #define ISC_REQ_CONNECTION             0x00000800
284 #define ISC_REQ_CALL_LEVEL             0x00001000
285 #define ISC_REQ_FRAGMENT_SUPPLIED      0x00002000
286 #define ISC_REQ_EXTENDED_ERROR         0x00004000
287 #define ISC_REQ_STREAM                 0x00008000
288 #define ISC_REQ_INTEGRITY              0x00010000
289 #define ISC_REQ_IDENTIFY               0x00020000
290 #define ISC_REQ_NULL_SESSION           0x00040000
291 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
292 #define ISC_REQ_RESERVED1              0x00100000
293 #define ISC_REQ_FRAGMENT_TO_FIT        0x00200000
294
295 #define ISC_RET_DELEGATE               0x00000001
296 #define ISC_RET_MUTUAL_AUTH            0x00000002
297 #define ISC_RET_REPLAY_DETECT          0x00000004
298 #define ISC_RET_SEQUENCE_DETECT        0x00000008
299 #define ISC_RET_CONFIDENTIALITY        0x00000010
300 #define ISC_RET_USE_SESSION_KEY        0x00000020
301 #define ISC_RET_USED_COLLECTED_CREDS   0x00000040
302 #define ISC_RET_USED_SUPPLIED_CREDS    0x00000080
303 #define ISC_RET_ALLOCATED_MEMORY       0x00000100
304 #define ISC_RET_USED_DCE_STYLE         0x00000200
305 #define ISC_RET_DATAGRAM               0x00000400
306 #define ISC_RET_CONNECTION             0x00000800
307 #define ISC_RET_INTERMEDIATE_RETURN    0x00001000
308 #define ISC_RET_CALL_LEVEL             0x00002000
309 #define ISC_RET_EXTENDED_ERROR         0x00004000
310 #define ISC_RET_STREAM                 0x00008000
311 #define ISC_RET_INTEGRITY              0x00010000
312 #define ISC_RET_IDENTIFY               0x00020000
313 #define ISC_RET_NULL_SESSION           0x00040000
314 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
315 #define ISC_RET_RESERVED1              0x00100000
316 #define ISC_RET_FRAGMENT_ONLY          0x00200000
317
318 SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(
319  PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput,
320  ULONG fContextReq, ULONG TargetDataRep,
321  PCtxtHandle phNewContext, PSecBufferDesc pOutput,
322  ULONG *pfContextAttr, PTimeStamp ptsExpiry);
323
324 typedef SECURITY_STATUS (SEC_ENTRY *ACCEPT_SECURITY_CONTEXT_FN)(PCredHandle,
325  PCtxtHandle, PSecBufferDesc, ULONG, ULONG, PCtxtHandle,
326  PSecBufferDesc, ULONG *, PTimeStamp);
327
328 /* flags for AcceptSecurityContext fContextReq and pfContextAttr */
329 #define ASC_REQ_DELEGATE               0x00000001
330 #define ASC_REQ_MUTUAL_AUTH            0x00000002
331 #define ASC_REQ_REPLAY_DETECT          0x00000004
332 #define ASC_REQ_SEQUENCE_DETECT        0x00000008
333 #define ASC_REQ_CONFIDENTIALITY        0x00000010
334 #define ASC_REQ_USE_SESSION_KEY        0x00000020
335 #define ASC_REQ_ALLOCATE_MEMORY        0x00000100
336 #define ASC_REQ_USE_DCE_STYLE          0x00000200
337 #define ASC_REQ_DATAGRAM               0x00000400
338 #define ASC_REQ_CONNECTION             0x00000800
339 #define ASC_REQ_CALL_LEVEL             0x00001000
340 #define ASC_REQ_FRAGMENT_SUPPLIED      0x00002000
341 #define ASC_REQ_EXTENDED_ERROR         0x00008000
342 #define ASC_REQ_STREAM                 0x00010000
343 #define ASC_REQ_INTEGRITY              0x00020000
344 #define ASC_REQ_LICENSING              0x00040000
345 #define ASC_REQ_IDENTIFY               0x00080000
346 #define ASC_REQ_ALLOW_NULL_SESSION     0x00100000
347 #define ASC_REQ_ALLOW_NON_USER_LOGONS  0x00200000
348 #define ASC_REQ_ALLOW_CONTEXT_REPLAY   0x00400000
349 #define ASC_REQ_FRAGMENT_TO_FIT        0x00800000
350 #define ASC_REQ_FRAGMENT_NO_TOKEN      0x01000000
351
352 #define ASC_RET_DELEGATE               0x00000001
353 #define ASC_RET_MUTUAL_AUTH            0x00000002
354 #define ASC_RET_REPLAY_DETECT          0x00000004
355 #define ASC_RET_SEQUENCE_DETECT        0x00000008
356 #define ASC_RET_CONFIDENTIALITY        0x00000010
357 #define ASC_RET_USE_SESSION_KEY        0x00000020
358 #define ASC_RET_ALLOCATED_MEMORY       0x00000100
359 #define ASC_RET_USED_DCE_STYLE         0x00000200
360 #define ASC_RET_DATAGRAM               0x00000400
361 #define ASC_RET_CONNECTION             0x00000800
362 #define ASC_RET_CALL_LEVEL             0x00002000
363 #define ASC_RET_THIRD_LEG_FAILED       0x00004000
364 #define ASC_RET_EXTENDED_ERROR         0x00008000
365 #define ASC_RET_STREAM                 0x00010000
366 #define ASC_RET_INTEGRITY              0x00020000
367 #define ASC_RET_LICENSING              0x00040000
368 #define ASC_RET_IDENTIFY               0x00080000
369 #define ASC_RET_NULL_SESSION           0x00100000
370 #define ASC_RET_ALLOW_NON_USER_LOGONS  0x00200000
371 #define ASC_RET_ALLOW_CONTEXT_REPLAY   0x00400000
372 #define ASC_RET_FRAGMENT_ONLY          0x00800000
373 #define ASC_RET_NO_TOKEN               0x01000000
374
375 /* values for TargetDataRep */
376 #define SECURITY_NATIVE_DREP  0x00000010
377 #define SECURITY_NETWORK_DREP 0x00000000
378
379 SECURITY_STATUS SEC_ENTRY CompleteAuthToken(PCtxtHandle phContext,
380  PSecBufferDesc pToken);
381
382 typedef SECURITY_STATUS (SEC_ENTRY *COMPLETE_AUTH_TOKEN_FN)(PCtxtHandle,
383  PSecBufferDesc);
384
385 SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(PCtxtHandle phContext);
386
387 typedef SECURITY_STATUS (SEC_ENTRY *DELETE_SECURITY_CONTEXT_FN)(PCtxtHandle);
388
389 SECURITY_STATUS SEC_ENTRY ApplyControlToken(PCtxtHandle phContext,
390  PSecBufferDesc pInput);
391
392 typedef SECURITY_STATUS (SEC_ENTRY *APPLY_CONTROL_TOKEN_FN)(PCtxtHandle,
393  PSecBufferDesc);
394
395 SECURITY_STATUS SEC_ENTRY QueryContextAttributesA(PCtxtHandle phContext,
396  ULONG ulAttribute, void *pBuffer);
397 SECURITY_STATUS SEC_ENTRY QueryContextAttributesW(PCtxtHandle phContext,
398  ULONG ulAttribute, void *pBuffer);
399 #define QueryContextAttributes WINELIB_NAME_AW(QueryContextAttributes)
400
401 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
402  ULONG, void *);
403 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
404  ULONG, void *);
405 #define QUERY_CONTEXT_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CONTEXT_ATTRIBUTES_FN_)
406
407 /* values for QueryContextAttributes/SetContextAttributes ulAttribute */
408 #define SECPKG_ATTR_SIZES               0
409 #define SECPKG_ATTR_NAMES               1
410 #define SECPKG_ATTR_LIFESPAN            2
411 #define SECPKG_ATTR_DCE_INFO            3
412 #define SECPKG_ATTR_STREAM_SIZES        4
413 #define SECPKG_ATTR_KEY_INFO            5
414 #define SECPKG_ATTR_AUTHORITY           6
415 #define SECPKG_ATTR_PROTO_INFO          7
416 #define SECPKG_ATTR_PASSWORD_EXPIRY     8
417 #define SECPKG_ATTR_SESSION_KEY         9
418 #define SECPKG_ATTR_PACKAGE_INFO       10
419 #define SECPKG_ATTR_USER_FLAGS         11
420 #define SECPKG_ATTR_NEGOTIATION_INFO   12
421 #define SECPKG_ATTR_NATIVE_NAMES       13
422 #define SECPKG_ATTR_FLAGS              14
423 #define SECPKG_ATTR_USE_VALIDATED      15
424 #define SECPKG_ATTR_CREDENTIAL_NAME    16
425 #define SECPKG_ATTR_TARGET_INFORMATION 17
426 #define SECPKG_ATTR_ACCESS_TOKEN       18
427 #define SECPKG_ATTR_TARGET             19
428 #define SECPKG_ATTR_AUTHENTICATION_ID  20
429
430 /* types for QueryContextAttributes/SetContextAttributes */
431
432 typedef struct _SecPkgContext_Sizes
433 {
434     unsigned long cbMaxToken;
435     unsigned long cbMaxSignature;
436     unsigned long cbBlockSize;
437     unsigned long cbSecurityTrailer;
438 } SecPkgContext_Sizes, *PSecPkgContext_Sizes;
439
440 typedef struct _SecPkgContext_StreamSizes
441 {
442     unsigned long cbHeader;
443     unsigned long cbTrailer;
444     unsigned long cbMaximumMessage;
445     unsigned long cbBuffers;
446     unsigned long cbBlockSize;
447 } SecPkgContext_StreamSizes, *PSecPkgContext_StreamSizes;
448
449 typedef struct _SecPkgContext_NamesA
450 {
451     SEC_CHAR *sUserName;
452 } SecPkgContext_NamesA, *PSecPkgContext_NamesA;
453
454 typedef struct _SecPkgContext_NamesW
455 {
456     SEC_WCHAR *sUserName;
457 } SecPkgContext_NamesW, *PSecPkgContext_NamesW;
458
459 #define SecPkgContext_Names WINELIB_NAME_AW(SecPkgContext_Names)
460 #define PSecPkgContext_Names WINELIB_NAME_AW(PSecPkgContext_Names)
461
462 typedef struct _SecPkgContext_Lifespan
463 {
464     TimeStamp tsStart;
465     TimeStamp tsExpiry;
466 } SecPkgContext_Lifespan, *PSecPkgContext_Lifespan;
467
468 typedef struct _SecPkgContext_DceInfo
469 {
470     unsigned long AuthzSvc;
471     void *pPac;
472 } SecPkgContext_DceInfo, *PSecPkgContext_DceInfo;
473
474 typedef struct _SecPkgContext_KeyInfoA
475 {
476     SEC_CHAR      *sSignatureAlgorithmName;
477     SEC_CHAR      *sEncryptAlgorithmName;
478     unsigned long  KeySize;
479     unsigned long  SignatureAlgorithm;
480     unsigned long  EncryptAlgorithm;
481 } SecPkgContext_KeyInfoA, *PSecPkgContext_KeyInfoA;
482
483 typedef struct _SecPkgContext_KeyInfoW
484 {
485     SEC_WCHAR     *sSignatureAlgorithmName;
486     SEC_WCHAR     *sEncryptAlgorithmName;
487     unsigned long  KeySize;
488     unsigned long  SignatureAlgorithm;
489     unsigned long  EncryptAlgorithm;
490 } SecPkgContext_KeyInfoW, *PSecPkgContext_KeyInfoW;
491
492 #define SecPkgContext_KeyInfo WINELIB_NAME_AW(SecPkgContext_KeyInfo)
493 #define PSecPkgContext_KeyInfo WINELIB_NAME_AW(PSecPkgContext_KeyInfo)
494
495 typedef struct _SecPkgContext_AuthorityA
496 {
497     SEC_CHAR *sAuthorityName;
498 } SecPkgContext_AuthorityA, *PSecPkgContext_AuthorityA;
499
500 typedef struct _SecPkgContext_AuthorityW
501 {
502     SEC_WCHAR *sAuthorityName;
503 } SecPkgContext_AuthorityW, *PSecPkgContext_AuthorityW;
504
505 #define SecPkgContext_Authority WINELIB_NAME_AW(SecPkgContext_Authority)
506 #define PSecPkgContext_Authority WINELIB_NAME_AW(PSecPkgContext_Authority)
507
508 typedef struct _SecPkgContext_ProtoInfoA
509 {
510     SEC_CHAR     *sProtocolName;
511     unsigned long majorVersion;
512     unsigned long minorVersion;
513 } SecPkgContext_ProtoInfoA, *PSecPkgContext_ProtoInfoA;
514
515 typedef struct _SecPkgContext_ProtoInfoW
516 {
517     SEC_WCHAR    *sProtocolName;
518     unsigned long majorVersion;
519     unsigned long minorVersion;
520 } SecPkgContext_ProtoInfoW, *PSecPkgContext_ProtoInfoW;
521
522 #define SecPkgContext_ProtoInfo WINELIB_NAME_AW(SecPkgContext_ProtoInfo)
523 #define PSecPkgContext_ProtoInfo WINELIB_NAME_AW(PSecPkgContext_ProtoInfo)
524
525 typedef struct _SecPkgContext_PasswordExpiry
526 {
527     TimeStamp tsPasswordExpires;
528 } SecPkgContext_PasswordExpiry, *PSecPkgContext_PasswordExpiry;
529
530 typedef struct _SecPkgContext_SessionKey
531 {
532     unsigned long  SessionKeyLength;
533     unsigned char *SessionKey;
534 } SecPkgContext_SessionKey, *PSecPkgContext_SessionKey;
535
536 typedef struct _SecPkgContext_PackageInfoA
537 {
538     PSecPkgInfoA PackageInfo;
539 } SecPkgContext_PackageInfoA, *PSecPkgContext_PackageInfoA;
540
541 typedef struct _SecPkgContext_PackageInfoW
542 {
543     PSecPkgInfoW PackageInfo;
544 } SecPkgContext_PackageInfoW, *PSecPkgContext_PackageInfoW;
545
546 #define SecPkgContext_PackageInfo WINELIB_NAME_AW(SecPkgContext_PackageInfo)
547 #define PSecPkgContext_PackageInfo WINELIB_NAME_AW(PSecPkgContext_PackageInfo)
548
549 typedef struct _SecPkgContext_Flags
550 {
551     unsigned long Flags;
552 } SecPkgContext_Flags, *PSecPkgContext_Flags;
553
554 typedef struct _SecPkgContext_UserFlags
555 {
556     unsigned long UserFlags;
557 } SecPkgContext_UserFlags, *PSecPkgContext_UserFlags;
558
559 typedef struct _SecPkgContext_NegotiationInfoA
560 {
561     PSecPkgInfoA  PackageInfo;
562     unsigned long NegotiationState;
563 } SecPkgContext_NegotiationInfoA, *PSecPkgContext_NegotiationInfoA;
564
565 typedef struct _SecPkgContext_NegotiationInfoW
566 {
567     PSecPkgInfoW  PackageInfo;
568     unsigned long NegotiationState;
569 } SecPkgContext_NegotiationInfoW, *PSecPkgContext_NegotiationInfoW;
570
571 #define SecPkgContext_NegotiationInfo WINELIB_NAME_AW(SecPkgContext_NegotiationInfo)
572 #define PSecPkgContext_NegotiationInfo WINELIB_NAME_AW(PSecPkgContext_NegotiationInfo)
573
574 /* values for NegotiationState */
575 #define SECPKG_NEGOTIATION_COMPLETE      0
576 #define SECPKG_NEGOTIATION_OPTIMISTIC    1
577 #define SECPKG_NEGOTIATION_IN_PROGRESS   2
578 #define SECPKG_NEGOTIATION_DIRECT        3
579 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
580
581 typedef struct _SecPkgContext_NativeNamesA
582 {
583     SEC_CHAR *sClientName;
584     SEC_CHAR *sServerName;
585 } SecPkgContext_NativeNamesA, *PSecPkgContext_NativeNamesA;
586
587 typedef struct _SecPkgContext_NativeNamesW
588 {
589     SEC_WCHAR *sClientName;
590     SEC_WCHAR *sServerName;
591 } SecPkgContext_NativeNamesW, *PSecPkgContext_NativeNamesW;
592
593 #define SecPkgContext_NativeNames WINELIB_NAME_AW(SecPkgContext_NativeNames)
594 #define PSecPkgContext_NativeNames WINELIB_NAME_AW(PSecPkgContext_NativeNames)
595
596 typedef struct _SecPkgContext_CredentialNameA
597 {
598     unsigned long  CredentialType;
599     SEC_CHAR      *sCredentialName;
600 } SecPkgContext_CredentialNameA, *PSecPkgContext_CredentialNameA;
601
602 typedef struct _SecPkgContext_CredentialNameW
603 {
604     unsigned long  CredentialType;
605     SEC_WCHAR     *sCredentialName;
606 } SecPkgContext_CredentialNameW, *PSecPkgContext_CredentialNameW;
607
608 #define SecPkgContext_CredentialName WINELIB_NAME_AW(SecPkgContext_CredentialName)
609 #define PSecPkgContext_CredentialName WINELIB_NAME_AW(PSecPkgContext_CredentialName)
610
611 typedef struct _SecPkgContext_AccessToken
612 {
613     void *AccessToken;
614 } SecPkgContext_AccessToken, *PSecPkgContext_AccessToken;
615
616 typedef struct _SecPkgContext_TargetInformation
617 {
618     unsigned long  MarshalledTargetInfoLength;
619     unsigned char *MarshalledTargetInfo;
620 } SecPkgContext_TargetInformation, *PSecPkgContext_TargetInformation;
621
622 typedef struct _SecPkgContext_AuthzID
623 {
624     unsigned long  AuthzIDLength;
625     char          *AuthzID;
626 } SecPkgContext_AuthzID, *PSecPkgContext_AuthzID;
627
628 typedef struct _SecPkgContext_Target
629 {
630     unsigned long  TargetLength;
631     char          *Target;
632 } SecPkgContext_Target, *PSecPkgContext_Target;
633
634 SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(PCtxtHandle phContext);
635
636 typedef SECURITY_STATUS (SEC_ENTRY *IMPERSONATE_SECURITY_CONTEXT_FN)
637  (PCtxtHandle);
638
639 SECURITY_STATUS SEC_ENTRY RevertSecurityContext(PCtxtHandle phContext);
640
641 typedef SECURITY_STATUS (SEC_ENTRY *REVERT_SECURITY_CONTEXT_FN)(PCtxtHandle);
642
643 SECURITY_STATUS SEC_ENTRY MakeSignature(PCtxtHandle phContext,
644  ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo);
645
646 typedef SECURITY_STATUS (SEC_ENTRY *MAKE_SIGNATURE_FN)(PCtxtHandle,
647  ULONG, PSecBufferDesc, ULONG);
648
649 SECURITY_STATUS SEC_ENTRY VerifySignature(PCtxtHandle phContext,
650  PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
651
652 typedef SECURITY_STATUS (SEC_ENTRY *VERIFY_SIGNATURE_FN)(PCtxtHandle,
653  PSecBufferDesc, ULONG, PULONG);
654
655 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(
656  SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo);
657 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(
658  SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo);
659 #define QuerySecurityPackageInfo WINELIB_NAME_AW(QuerySecurityPackageInfo)
660
661 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_A)
662  (SEC_CHAR *, PSecPkgInfoA *);
663 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_W)
664  (SEC_WCHAR *, PSecPkgInfoW *);
665 #define QUERY_SECURITY_PACKAGE_INFO_FN WINELIB_NAME_AW(QUERY_SECURITY_PACKAGE_INFO_FN_)
666
667 SECURITY_STATUS SEC_ENTRY ExportSecurityContext(PCtxtHandle phContext,
668  ULONG fFlags, PSecBuffer pPackedContext, void **pToken);
669
670 typedef SECURITY_STATUS (SEC_ENTRY *EXPORT_SECURITY_CONTEXT_FN)(PCtxtHandle,
671  ULONG, PSecBuffer, void **);
672
673 /* values for ExportSecurityContext fFlags */
674 #define SECPKG_CONTEXT_EXPORT_RESET_NEW  0x00000001
675 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
676
677 SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(SEC_CHAR *pszPackage,
678  PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
679 SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR *pszPackage,
680  PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
681 #define ImportSecurityContext WINELIB_NAME_AW(ImportSecurityContext)
682
683 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_A)(SEC_CHAR *,
684  PSecBuffer, void *, PCtxtHandle);
685 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_W)(SEC_WCHAR *,
686  PSecBuffer, void *, PCtxtHandle);
687 #define IMPORT_SECURITY_CONTEXT_FN WINELIB_NAME_AW(IMPORT_SECURITY_CONTEXT_FN_)
688
689 SECURITY_STATUS SEC_ENTRY AddCredentialsA(PCredHandle hCredentials,
690  SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse,
691  void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
692  PTimeStamp ptsExpiry);
693 SECURITY_STATUS SEC_ENTRY AddCredentialsW(PCredHandle hCredentials,
694  SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse,
695  void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
696  PTimeStamp ptsExpiry);
697 #define AddCredentials WINELIB_NAME_AW(AddCredentials)
698
699 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_A)(PCredHandle,
700  SEC_CHAR *, SEC_CHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
701  PTimeStamp);
702 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_W)(PCredHandle,
703  SEC_WCHAR *, SEC_WCHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
704  PTimeStamp);
705
706 SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(PCtxtHandle phContext,
707  HANDLE *phToken);
708
709 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_CONTEXT_TOKEN_FN)
710  (PCtxtHandle, HANDLE *);
711
712 SECURITY_STATUS SEC_ENTRY EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
713  PSecBufferDesc pMessage, ULONG MessageSeqNo);
714 SECURITY_STATUS SEC_ENTRY DecryptMessage(PCtxtHandle phContext,
715  PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
716
717 /* values for EncryptMessage fQOP */
718 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
719
720 typedef SECURITY_STATUS (SEC_ENTRY *ENCRYPT_MESSAGE_FN)(PCtxtHandle, ULONG,
721  PSecBufferDesc, ULONG);
722 typedef SECURITY_STATUS (SEC_ENTRY *DECRYPT_MESSAGE_FN)(PCtxtHandle,
723  PSecBufferDesc, ULONG, PULONG);
724
725 SECURITY_STATUS SEC_ENTRY SetContextAttributesA(PCtxtHandle phContext,
726  ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
727 SECURITY_STATUS SEC_ENTRY SetContextAttributesW(PCtxtHandle phContext,
728  ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
729 #define SetContextAttributes WINELIB_NAME_AW(SetContextAttributes)
730
731 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
732  ULONG, void *, ULONG);
733 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
734  ULONG, void *, ULONG);
735
736 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
737 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
738 #define SECURITY_ENTRYPOINT_ANSI WINELIB_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
739
740 typedef struct _SECURITY_FUNCTION_TABLE_A
741 {
742     unsigned long                     dwVersion;
743     ENUMERATE_SECURITY_PACKAGES_FN_A  EnumerateSecurityPackagesA;
744     QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
745     ACQUIRE_CREDENTIALS_HANDLE_FN_A   AcquireCredentialsHandleA;
746     FREE_CREDENTIALS_HANDLE_FN        FreeCredentialsHandle;
747     void                             *Reserved2;
748     INITIALIZE_SECURITY_CONTEXT_FN_A  InitializeSecurityContextA;
749     ACCEPT_SECURITY_CONTEXT_FN        AcceptSecurityContext;
750     COMPLETE_AUTH_TOKEN_FN            CompleteAuthToken;
751     DELETE_SECURITY_CONTEXT_FN        DeleteSecurityContext;
752     APPLY_CONTROL_TOKEN_FN            ApplyControlToken;
753     QUERY_CONTEXT_ATTRIBUTES_FN_A     QueryContextAttributesA;
754     IMPERSONATE_SECURITY_CONTEXT_FN   ImpersonateSecurityContext;
755     REVERT_SECURITY_CONTEXT_FN        RevertSecurityContext;
756     MAKE_SIGNATURE_FN                 MakeSignature;
757     VERIFY_SIGNATURE_FN               VerifySignature;
758     FREE_CONTEXT_BUFFER_FN            FreeContextBuffer;
759     QUERY_SECURITY_PACKAGE_INFO_FN_A  QuerySecurityPackageInfoA;
760     void                             *Reserved3;
761     void                             *Reserved4;
762     EXPORT_SECURITY_CONTEXT_FN        ExportSecurityContext;
763     IMPORT_SECURITY_CONTEXT_FN_A      ImportSecurityContextA;
764     ADD_CREDENTIALS_FN_A              AddCredentialsA;
765     void                             *Reserved8;
766     QUERY_SECURITY_CONTEXT_TOKEN_FN   QuerySecurityContextToken;
767     ENCRYPT_MESSAGE_FN                EncryptMessage;
768     DECRYPT_MESSAGE_FN                DecryptMessage;
769     SET_CONTEXT_ATTRIBUTES_FN_A       SetContextAttributesA;
770 } SecurityFunctionTableA, *PSecurityFunctionTableA;
771
772 typedef struct _SECURITY_FUNCTION_TABLE_W
773 {
774     unsigned long                     dwVersion;
775     ENUMERATE_SECURITY_PACKAGES_FN_W  EnumerateSecurityPackagesW;
776     QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW;
777     ACQUIRE_CREDENTIALS_HANDLE_FN_W   AcquireCredentialsHandleW;
778     FREE_CREDENTIALS_HANDLE_FN        FreeCredentialsHandle;
779     void                             *Reserved2;
780     INITIALIZE_SECURITY_CONTEXT_FN_W  InitializeSecurityContextW;
781     ACCEPT_SECURITY_CONTEXT_FN        AcceptSecurityContext;
782     COMPLETE_AUTH_TOKEN_FN            CompleteAuthToken;
783     DELETE_SECURITY_CONTEXT_FN        DeleteSecurityContext;
784     APPLY_CONTROL_TOKEN_FN            ApplyControlToken;
785     QUERY_CONTEXT_ATTRIBUTES_FN_W     QueryContextAttributesW;
786     IMPERSONATE_SECURITY_CONTEXT_FN   ImpersonateSecurityContext;
787     REVERT_SECURITY_CONTEXT_FN        RevertSecurityContext;
788     MAKE_SIGNATURE_FN                 MakeSignature;
789     VERIFY_SIGNATURE_FN               VerifySignature;
790     FREE_CONTEXT_BUFFER_FN            FreeContextBuffer;
791     QUERY_SECURITY_PACKAGE_INFO_FN_W  QuerySecurityPackageInfoW;
792     void                             *Reserved3;
793     void                             *Reserved4;
794     EXPORT_SECURITY_CONTEXT_FN        ExportSecurityContext;
795     IMPORT_SECURITY_CONTEXT_FN_W      ImportSecurityContextW;
796     ADD_CREDENTIALS_FN_W              AddCredentialsW;
797     void                             *Reserved8;
798     QUERY_SECURITY_CONTEXT_TOKEN_FN   QuerySecurityContextToken;
799     ENCRYPT_MESSAGE_FN                EncryptMessage;
800     DECRYPT_MESSAGE_FN                DecryptMessage;
801     SET_CONTEXT_ATTRIBUTES_FN_W       SetContextAttributesW;
802 } SecurityFunctionTableW, *PSecurityFunctionTableW;
803
804 #define SecurityFunctionTable WINELIB_NAME_AW(SecurityFunctionTable)
805 #define PSecurityFunctionTable WINELIB_NAME_AW(PSecurityFunctionTable)
806
807 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION   1
808 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
809
810 PSecurityFunctionTableA SEC_ENTRY InitSecurityInterfaceA(void);
811 PSecurityFunctionTableW SEC_ENTRY InitSecurityInterfaceW(void);
812 #define InitSecurityInterface WINELIB_NAME_AW(InitSecurityInterface)
813
814 typedef PSecurityFunctionTableA (SEC_ENTRY *INIT_SECURITY_INTERFACE_A)(void);
815 typedef PSecurityFunctionTableW (SEC_ENTRY *INIT_SECURITY_INTERFACE_W)(void);
816 #define INIT_SECURITY_INTERFACE WINELIB_NAME_AW(INIT_SECURITY_INTERFACE_)
817
818 #ifdef __cplusplus
819 }
820 #endif
821
822 #endif /* ndef __WINE_SSPI_H__ */