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