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