1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #ifndef __SSPI_H__ 7 #define __SSPI_H__ 8 9 #include <_mingw_unicode.h> 10 #include <ntsecapi.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 #ifdef SECURITY_WIN32 17 #define ISSP_LEVEL 32 18 #define ISSP_MODE 1 19 #endif 20 21 #ifdef SECURITY_KERNEL 22 #define ISSP_LEVEL 32 23 24 #ifdef ISSP_MODE 25 #undef ISSP_MODE 26 #endif 27 #define ISSP_MODE 0 28 #endif 29 30 #ifdef SECURITY_MAC 31 #define ISSP_LEVEL 32 32 #define ISSP_MODE 1 33 #endif 34 35 #ifndef ISSP_LEVEL 36 #error You must define one of SECURITY_WIN32,SECURITY_KERNEL,or 37 #error SECURITY_MAC 38 #endif 39 40 #if defined(_NO_KSECDD_IMPORT_) 41 42 #define KSECDDDECLSPEC 43 #else 44 45 #define KSECDDDECLSPEC __declspec(dllimport) 46 #endif 47 48 typedef WCHAR SEC_WCHAR; 49 typedef CHAR SEC_CHAR; 50 51 #ifndef __SECSTATUS_DEFINED__ 52 typedef LONG SECURITY_STATUS; 53 #define __SECSTATUS_DEFINED__ 54 #endif 55 56 #ifndef WINAPI 57 #if defined(_ARM_) 58 #define WINAPI 59 #else 60 #define WINAPI __stdcall 61 #endif 62 #endif 63 64 #define SEC_TEXT TEXT 65 #define SEC_FAR 66 #define __SEC_FAR 67 #define SEC_ENTRY WINAPI 68 69 #if defined(UNICODE) 70 typedef SEC_WCHAR *SECURITY_PSTR; 71 typedef CONST SEC_WCHAR *SECURITY_PCSTR; 72 #else 73 typedef SEC_CHAR *SECURITY_PSTR; 74 typedef CONST SEC_CHAR *SECURITY_PCSTR; 75 #endif 76 77 78 #ifndef __SECHANDLE_DEFINED__ 79 typedef struct _SecHandle { 80 ULONG_PTR dwLower; 81 ULONG_PTR dwUpper; 82 } SecHandle,*PSecHandle; 83 84 #define __SECHANDLE_DEFINED__ 85 #endif 86 87 #define SecInvalidateHandle(x) ((PSecHandle) x)->dwLower = ((ULONG_PTR) ((INT_PTR)-1)); ((PSecHandle) x)->dwUpper = ((ULONG_PTR) ((INT_PTR)-1)); 88 #define SecIsValidHandle(x) ((((PSecHandle) x)->dwLower!=((ULONG_PTR) ((INT_PTR) -1))) && (((PSecHandle) x)->dwUpper!=((ULONG_PTR) ((INT_PTR) -1)))) 89 90 typedef SecHandle CredHandle; 91 typedef PSecHandle PCredHandle; 92 93 typedef SecHandle CtxtHandle; 94 typedef PSecHandle PCtxtHandle; 95 96 #ifdef WIN32_CHICAGO 97 __MINGW_EXTENSION typedef unsigned __int64 QWORD; 98 typedef QWORD SECURITY_INTEGER,*PSECURITY_INTEGER; 99 #define SEC_SUCCESS(Status) ((Status) >= 0) 100 #elif defined(_NTDEF_) || defined(_WINNT_) 101 typedef LARGE_INTEGER _SECURITY_INTEGER,SECURITY_INTEGER,*PSECURITY_INTEGER; 102 #else 103 typedef struct _SECURITY_INTEGER { 104 unsigned __LONG32 LowPart; 105 __LONG32 HighPart; 106 } SECURITY_INTEGER,*PSECURITY_INTEGER; 107 #endif 108 109 #ifndef SECURITY_MAC 110 typedef SECURITY_INTEGER TimeStamp; 111 typedef SECURITY_INTEGER *PTimeStamp; 112 #else 113 typedef unsigned __LONG32 TimeStamp; 114 typedef unsigned __LONG32 *PTimeStamp; 115 #endif 116 117 #ifndef _NTDEF_ 118 typedef struct _SECURITY_STRING { 119 unsigned short Length; 120 unsigned short MaximumLength; 121 unsigned short *Buffer; 122 } SECURITY_STRING,*PSECURITY_STRING; 123 #else 124 typedef UNICODE_STRING SECURITY_STRING,*PSECURITY_STRING; 125 #endif 126 127 typedef struct _SecPkgInfoW { 128 unsigned __LONG32 fCapabilities; 129 unsigned short wVersion; 130 unsigned short wRPCID; 131 unsigned __LONG32 cbMaxToken; 132 SEC_WCHAR *Name; 133 SEC_WCHAR *Comment; 134 } SecPkgInfoW,*PSecPkgInfoW; 135 136 typedef struct _SecPkgInfoA { 137 unsigned __LONG32 fCapabilities; 138 unsigned short wVersion; 139 unsigned short wRPCID; 140 unsigned __LONG32 cbMaxToken; 141 SEC_CHAR *Name; 142 SEC_CHAR *Comment; 143 } SecPkgInfoA,*PSecPkgInfoA; 144 145 #define SecPkgInfo __MINGW_NAME_AW(SecPkgInfo) 146 #define PSecPkgInfo __MINGW_NAME_AW(PSecPkgInfo) 147 148 #define SECPKG_FLAG_INTEGRITY 0x00000001 149 #define SECPKG_FLAG_PRIVACY 0x00000002 150 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004 151 #define SECPKG_FLAG_DATAGRAM 0x00000008 152 #define SECPKG_FLAG_CONNECTION 0x00000010 153 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020 154 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040 155 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080 156 #define SECPKG_FLAG_IMPERSONATION 0x00000100 157 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200 158 #define SECPKG_FLAG_STREAM 0x00000400 159 #define SECPKG_FLAG_NEGOTIABLE 0x00000800 160 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000 161 #define SECPKG_FLAG_LOGON 0x00002000 162 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000 163 #define SECPKG_FLAG_FRAGMENT 0x00008000 164 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000 165 #define SECPKG_FLAG_DELEGATION 0x00020000 166 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000 167 168 #define SECPKG_ID_NONE 0xFFFF 169 170 typedef struct _SecBuffer { 171 unsigned __LONG32 cbBuffer; 172 unsigned __LONG32 BufferType; 173 void *pvBuffer; 174 } SecBuffer,*PSecBuffer; 175 176 typedef struct _SecBufferDesc { 177 unsigned __LONG32 ulVersion; 178 unsigned __LONG32 cBuffers; 179 PSecBuffer pBuffers; 180 } SecBufferDesc,*PSecBufferDesc; 181 182 #define SECBUFFER_VERSION 0 183 184 #define SECBUFFER_EMPTY 0 185 #define SECBUFFER_DATA 1 186 #define SECBUFFER_TOKEN 2 187 #define SECBUFFER_PKG_PARAMS 3 188 #define SECBUFFER_MISSING 4 189 #define SECBUFFER_EXTRA 5 190 #define SECBUFFER_STREAM_TRAILER 6 191 #define SECBUFFER_STREAM_HEADER 7 192 #define SECBUFFER_NEGOTIATION_INFO 8 193 #define SECBUFFER_PADDING 9 194 #define SECBUFFER_STREAM 10 195 #define SECBUFFER_MECHLIST 11 196 #define SECBUFFER_MECHLIST_SIGNATURE 12 197 #define SECBUFFER_TARGET 13 198 #define SECBUFFER_CHANNEL_BINDINGS 14 199 200 #define SECBUFFER_ATTRMASK 0xF0000000 201 #define SECBUFFER_READONLY 0x80000000 202 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000 203 #define SECBUFFER_RESERVED 0x60000000 204 205 typedef struct _SEC_NEGOTIATION_INFO { 206 unsigned __LONG32 Size; 207 unsigned __LONG32 NameLength; 208 SEC_WCHAR *Name; 209 void *Reserved; 210 } SEC_NEGOTIATION_INFO,*PSEC_NEGOTIATION_INFO; 211 212 typedef struct _SEC_CHANNEL_BINDINGS { 213 unsigned __LONG32 dwInitiatorAddrType; 214 unsigned __LONG32 cbInitiatorLength; 215 unsigned __LONG32 dwInitiatorOffset; 216 unsigned __LONG32 dwAcceptorAddrType; 217 unsigned __LONG32 cbAcceptorLength; 218 unsigned __LONG32 dwAcceptorOffset; 219 unsigned __LONG32 cbApplicationDataLength; 220 unsigned __LONG32 dwApplicationDataOffset; 221 } SEC_CHANNEL_BINDINGS,*PSEC_CHANNEL_BINDINGS; 222 223 #define SECURITY_NATIVE_DREP 0x00000010 224 #define SECURITY_NETWORK_DREP 0x00000000 225 226 #define SECPKG_CRED_INBOUND 0x00000001 227 #define SECPKG_CRED_OUTBOUND 0x00000002 228 #define SECPKG_CRED_BOTH 0x00000003 229 #define SECPKG_CRED_DEFAULT 0x00000004 230 #define SECPKG_CRED_RESERVED 0xF0000000 231 232 #define ISC_REQ_DELEGATE 0x00000001 233 #define ISC_REQ_MUTUAL_AUTH 0x00000002 234 #define ISC_REQ_REPLAY_DETECT 0x00000004 235 #define ISC_REQ_SEQUENCE_DETECT 0x00000008 236 #define ISC_REQ_CONFIDENTIALITY 0x00000010 237 #define ISC_REQ_USE_SESSION_KEY 0x00000020 238 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040 239 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080 240 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100 241 #define ISC_REQ_USE_DCE_STYLE 0x00000200 242 #define ISC_REQ_DATAGRAM 0x00000400 243 #define ISC_REQ_CONNECTION 0x00000800 244 #define ISC_REQ_CALL_LEVEL 0x00001000 245 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000 246 #define ISC_REQ_EXTENDED_ERROR 0x00004000 247 #define ISC_REQ_STREAM 0x00008000 248 #define ISC_REQ_INTEGRITY 0x00010000 249 #define ISC_REQ_IDENTIFY 0x00020000 250 #define ISC_REQ_NULL_SESSION 0x00040000 251 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000 252 #define ISC_REQ_RESERVED1 0x00100000 253 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000 254 255 #define ISC_RET_DELEGATE 0x00000001 256 #define ISC_RET_MUTUAL_AUTH 0x00000002 257 #define ISC_RET_REPLAY_DETECT 0x00000004 258 #define ISC_RET_SEQUENCE_DETECT 0x00000008 259 #define ISC_RET_CONFIDENTIALITY 0x00000010 260 #define ISC_RET_USE_SESSION_KEY 0x00000020 261 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040 262 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080 263 #define ISC_RET_ALLOCATED_MEMORY 0x00000100 264 #define ISC_RET_USED_DCE_STYLE 0x00000200 265 #define ISC_RET_DATAGRAM 0x00000400 266 #define ISC_RET_CONNECTION 0x00000800 267 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000 268 #define ISC_RET_CALL_LEVEL 0x00002000 269 #define ISC_RET_EXTENDED_ERROR 0x00004000 270 #define ISC_RET_STREAM 0x00008000 271 #define ISC_RET_INTEGRITY 0x00010000 272 #define ISC_RET_IDENTIFY 0x00020000 273 #define ISC_RET_NULL_SESSION 0x00040000 274 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000 275 #define ISC_RET_RESERVED1 0x00100000 276 #define ISC_RET_FRAGMENT_ONLY 0x00200000 277 278 #define ASC_REQ_DELEGATE 0x00000001 279 #define ASC_REQ_MUTUAL_AUTH 0x00000002 280 #define ASC_REQ_REPLAY_DETECT 0x00000004 281 #define ASC_REQ_SEQUENCE_DETECT 0x00000008 282 #define ASC_REQ_CONFIDENTIALITY 0x00000010 283 #define ASC_REQ_USE_SESSION_KEY 0x00000020 284 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100 285 #define ASC_REQ_USE_DCE_STYLE 0x00000200 286 #define ASC_REQ_DATAGRAM 0x00000400 287 #define ASC_REQ_CONNECTION 0x00000800 288 #define ASC_REQ_CALL_LEVEL 0x00001000 289 #define ASC_REQ_EXTENDED_ERROR 0x00008000 290 #define ASC_REQ_STREAM 0x00010000 291 #define ASC_REQ_INTEGRITY 0x00020000 292 #define ASC_REQ_LICENSING 0x00040000 293 #define ASC_REQ_IDENTIFY 0x00080000 294 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000 295 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000 296 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000 297 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000 298 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000 299 #define ASC_REQ_NO_TOKEN 0x01000000 300 301 #define ASC_RET_DELEGATE 0x00000001 302 #define ASC_RET_MUTUAL_AUTH 0x00000002 303 #define ASC_RET_REPLAY_DETECT 0x00000004 304 #define ASC_RET_SEQUENCE_DETECT 0x00000008 305 #define ASC_RET_CONFIDENTIALITY 0x00000010 306 #define ASC_RET_USE_SESSION_KEY 0x00000020 307 #define ASC_RET_ALLOCATED_MEMORY 0x00000100 308 #define ASC_RET_USED_DCE_STYLE 0x00000200 309 #define ASC_RET_DATAGRAM 0x00000400 310 #define ASC_RET_CONNECTION 0x00000800 311 #define ASC_RET_CALL_LEVEL 0x00002000 312 #define ASC_RET_THIRD_LEG_FAILED 0x00004000 313 #define ASC_RET_EXTENDED_ERROR 0x00008000 314 #define ASC_RET_STREAM 0x00010000 315 #define ASC_RET_INTEGRITY 0x00020000 316 #define ASC_RET_LICENSING 0x00040000 317 #define ASC_RET_IDENTIFY 0x00080000 318 #define ASC_RET_NULL_SESSION 0x00100000 319 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000 320 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000 321 #define ASC_RET_FRAGMENT_ONLY 0x00800000 322 #define ASC_RET_NO_TOKEN 0x01000000 323 324 #define SECPKG_CRED_ATTR_NAMES 1 325 #define SECPKG_CRED_ATTR_SSI_PROVIDER 2 326 327 typedef struct _SecPkgCredentials_NamesW 328 { 329 SEC_WCHAR *sUserName; 330 } SecPkgCredentials_NamesW,*PSecPkgCredentials_NamesW; 331 332 typedef struct _SecPkgCredentials_NamesA 333 { 334 SEC_CHAR *sUserName; 335 } SecPkgCredentials_NamesA,*PSecPkgCredentials_NamesA; 336 337 #define SecPkgCredentials_Names __MINGW_NAME_AW(SecPkgCredentials_Names) 338 #define PSecPkgCredentials_Names __MINGW_NAME_AW(PSecPkgCredentials_Names) 339 340 typedef struct _SecPkgCredentials_SSIProviderW { 341 SEC_WCHAR *sProviderName; 342 unsigned __LONG32 ProviderInfoLength; 343 char *ProviderInfo; 344 } SecPkgCredentials_SSIProviderW,*PSecPkgCredentials_SSIProviderW; 345 346 typedef struct _SecPkgCredentials_SSIProviderA { 347 SEC_CHAR *sProviderName; 348 unsigned __LONG32 ProviderInfoLength; 349 char *ProviderInfo; 350 } SecPkgCredentials_SSIProviderA,*PSecPkgCredentials_SSIProviderA; 351 352 #define SecPkgCredentials_SSIProvider __MINGW_NAME_AW(SecPkgCredentials_SSIProvider) 353 #define PSecPkgCredentials_SSIProvider __MINGW_NAME_AW(PSecPkgCredentials_SSIProvider) 354 355 #define SECPKG_ATTR_SIZES 0 356 #define SECPKG_ATTR_NAMES 1 357 #define SECPKG_ATTR_LIFESPAN 2 358 #define SECPKG_ATTR_DCE_INFO 3 359 #define SECPKG_ATTR_STREAM_SIZES 4 360 #define SECPKG_ATTR_KEY_INFO 5 361 #define SECPKG_ATTR_AUTHORITY 6 362 #define SECPKG_ATTR_PROTO_INFO 7 363 #define SECPKG_ATTR_PASSWORD_EXPIRY 8 364 #define SECPKG_ATTR_SESSION_KEY 9 365 #define SECPKG_ATTR_PACKAGE_INFO 10 366 #define SECPKG_ATTR_USER_FLAGS 11 367 #define SECPKG_ATTR_NEGOTIATION_INFO 12 368 #define SECPKG_ATTR_NATIVE_NAMES 13 369 #define SECPKG_ATTR_FLAGS 14 370 #define SECPKG_ATTR_USE_VALIDATED 15 371 #define SECPKG_ATTR_CREDENTIAL_NAME 16 372 #define SECPKG_ATTR_TARGET_INFORMATION 17 373 #define SECPKG_ATTR_ACCESS_TOKEN 18 374 #define SECPKG_ATTR_TARGET 19 375 #define SECPKG_ATTR_AUTHENTICATION_ID 20 376 #define SECPKG_ATTR_LOGOFF_TIME 21 377 378 typedef struct _SecPkgContext_Sizes { 379 unsigned __LONG32 cbMaxToken; 380 unsigned __LONG32 cbMaxSignature; 381 unsigned __LONG32 cbBlockSize; 382 unsigned __LONG32 cbSecurityTrailer; 383 } SecPkgContext_Sizes,*PSecPkgContext_Sizes; 384 385 typedef struct _SecPkgContext_StreamSizes { 386 unsigned __LONG32 cbHeader; 387 unsigned __LONG32 cbTrailer; 388 unsigned __LONG32 cbMaximumMessage; 389 unsigned __LONG32 cBuffers; 390 unsigned __LONG32 cbBlockSize; 391 } SecPkgContext_StreamSizes,*PSecPkgContext_StreamSizes; 392 393 typedef struct _SecPkgContext_NamesW { 394 SEC_WCHAR *sUserName; 395 } SecPkgContext_NamesW,*PSecPkgContext_NamesW; 396 397 typedef struct _SecPkgContext_NamesA { 398 SEC_CHAR *sUserName; 399 } SecPkgContext_NamesA,*PSecPkgContext_NamesA; 400 401 #define SecPkgContext_Names __MINGW_NAME_AW(SecPkgContext_Names) 402 #define PSecPkgContext_Names __MINGW_NAME_AW(PSecPkgContext_Names) 403 404 typedef struct _SecPkgContext_Lifespan { 405 TimeStamp tsStart; 406 TimeStamp tsExpiry; 407 } SecPkgContext_Lifespan,*PSecPkgContext_Lifespan; 408 409 typedef struct _SecPkgContext_DceInfo { 410 unsigned __LONG32 AuthzSvc; 411 void *pPac; 412 } SecPkgContext_DceInfo,*PSecPkgContext_DceInfo; 413 414 typedef struct _SecPkgContext_KeyInfoA { 415 SEC_CHAR *sSignatureAlgorithmName; 416 SEC_CHAR *sEncryptAlgorithmName; 417 unsigned __LONG32 KeySize; 418 unsigned __LONG32 SignatureAlgorithm; 419 unsigned __LONG32 EncryptAlgorithm; 420 } SecPkgContext_KeyInfoA,*PSecPkgContext_KeyInfoA; 421 422 typedef struct _SecPkgContext_KeyInfoW { 423 SEC_WCHAR *sSignatureAlgorithmName; 424 SEC_WCHAR *sEncryptAlgorithmName; 425 unsigned __LONG32 KeySize; 426 unsigned __LONG32 SignatureAlgorithm; 427 unsigned __LONG32 EncryptAlgorithm; 428 } SecPkgContext_KeyInfoW,*PSecPkgContext_KeyInfoW; 429 430 #define SecPkgContext_KeyInfo __MINGW_NAME_AW(SecPkgContext_KeyInfo) 431 #define PSecPkgContext_KeyInfo __MINGW_NAME_AW(PSecPkgContext_KeyInfo) 432 433 typedef struct _SecPkgContext_AuthorityA { 434 SEC_CHAR *sAuthorityName; 435 } SecPkgContext_AuthorityA,*PSecPkgContext_AuthorityA; 436 437 typedef struct _SecPkgContext_AuthorityW { 438 SEC_WCHAR *sAuthorityName; 439 } SecPkgContext_AuthorityW,*PSecPkgContext_AuthorityW; 440 441 #define SecPkgContext_Authority __MINGW_NAME_AW(SecPkgContext_Authority) 442 #define PSecPkgContext_Authority __MINGW_NAME_AW(PSecPkgContext_Authority) 443 444 typedef struct _SecPkgContext_ProtoInfoA { 445 SEC_CHAR *sProtocolName; 446 unsigned __LONG32 majorVersion; 447 unsigned __LONG32 minorVersion; 448 } SecPkgContext_ProtoInfoA,*PSecPkgContext_ProtoInfoA; 449 450 typedef struct _SecPkgContext_ProtoInfoW { 451 SEC_WCHAR *sProtocolName; 452 unsigned __LONG32 majorVersion; 453 unsigned __LONG32 minorVersion; 454 } SecPkgContext_ProtoInfoW,*PSecPkgContext_ProtoInfoW; 455 456 #define SecPkgContext_ProtoInfo __MINGW_NAME_AW(SecPkgContext_ProtoInfo) 457 #define PSecPkgContext_ProtoInfo __MINGW_NAME_AW(PSecPkgContext_ProtoInfo) 458 459 typedef struct _SecPkgContext_PasswordExpiry { 460 TimeStamp tsPasswordExpires; 461 } SecPkgContext_PasswordExpiry,*PSecPkgContext_PasswordExpiry; 462 463 typedef struct _SecPkgContext_LogoffTime { 464 TimeStamp tsLogoffTime; 465 } SecPkgContext_LogoffTime,*PSecPkgContext_LogoffTime; 466 467 typedef struct _SecPkgContext_SessionKey { 468 unsigned __LONG32 SessionKeyLength; 469 unsigned char *SessionKey; 470 } SecPkgContext_SessionKey,*PSecPkgContext_SessionKey; 471 472 typedef struct _SecPkgContext_PackageInfoW { 473 PSecPkgInfoW PackageInfo; 474 } SecPkgContext_PackageInfoW,*PSecPkgContext_PackageInfoW; 475 476 typedef struct _SecPkgContext_PackageInfoA { 477 PSecPkgInfoA PackageInfo; 478 } SecPkgContext_PackageInfoA,*PSecPkgContext_PackageInfoA; 479 480 typedef struct _SecPkgContext_UserFlags { 481 unsigned __LONG32 UserFlags; 482 } SecPkgContext_UserFlags,*PSecPkgContext_UserFlags; 483 484 typedef struct _SecPkgContext_Flags { 485 unsigned __LONG32 Flags; 486 } SecPkgContext_Flags,*PSecPkgContext_Flags; 487 488 #define SecPkgContext_PackageInfo __MINGW_NAME_AW(SecPkgContext_PackageInfo) 489 #define PSecPkgContext_PackageInfo __MINGW_NAME_AW(PSecPkgContext_PackageInfo) 490 491 typedef struct _SecPkgContext_NegotiationInfoA { 492 PSecPkgInfoA PackageInfo; 493 unsigned __LONG32 NegotiationState; 494 } SecPkgContext_NegotiationInfoA,*PSecPkgContext_NegotiationInfoA; 495 496 typedef struct _SecPkgContext_NegotiationInfoW { 497 PSecPkgInfoW PackageInfo; 498 unsigned __LONG32 NegotiationState; 499 } SecPkgContext_NegotiationInfoW,*PSecPkgContext_NegotiationInfoW; 500 501 #define SecPkgContext_NegotiationInfo __MINGW_NAME_AW(SecPkgContext_NegotiationInfo) 502 #define PSecPkgContext_NegotiationInfo __MINGW_NAME_AW(PSecPkgContext_NegotiationInfo) 503 504 #define SECPKG_NEGOTIATION_COMPLETE 0 505 #define SECPKG_NEGOTIATION_OPTIMISTIC 1 506 #define SECPKG_NEGOTIATION_IN_PROGRESS 2 507 #define SECPKG_NEGOTIATION_DIRECT 3 508 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4 509 510 typedef struct _SecPkgContext_NativeNamesW { 511 SEC_WCHAR *sClientName; 512 SEC_WCHAR *sServerName; 513 } SecPkgContext_NativeNamesW,*PSecPkgContext_NativeNamesW; 514 515 typedef struct _SecPkgContext_NativeNamesA { 516 SEC_CHAR *sClientName; 517 SEC_CHAR *sServerName; 518 } SecPkgContext_NativeNamesA,*PSecPkgContext_NativeNamesA; 519 520 #define SecPkgContext_NativeNames __MINGW_NAME_AW(SecPkgContext_NativeNames) 521 #define PSecPkgContext_NativeNames __MINGW_NAME_AW(PSecPkgContext_NativeNames) 522 523 typedef struct _SecPkgContext_CredentialNameW { 524 unsigned __LONG32 CredentialType; 525 SEC_WCHAR *sCredentialName; 526 } SecPkgContext_CredentialNameW,*PSecPkgContext_CredentialNameW; 527 528 typedef struct _SecPkgContext_CredentialNameA { 529 unsigned __LONG32 CredentialType; 530 SEC_CHAR *sCredentialName; 531 } SecPkgContext_CredentialNameA,*PSecPkgContext_CredentialNameA; 532 533 #define SecPkgContext_CredentialName __MINGW_NAME_AW(SecPkgContext_CredentialName) 534 #define PSecPkgContext_CredentialName __MINGW_NAME_AW(PSecPkgContext_CredentialName) 535 536 typedef struct _SecPkgContext_AccessToken { 537 void *AccessToken; 538 } SecPkgContext_AccessToken,*PSecPkgContext_AccessToken; 539 540 typedef struct _SecPkgContext_TargetInformation { 541 unsigned __LONG32 MarshalledTargetInfoLength; 542 unsigned char *MarshalledTargetInfo; 543 } SecPkgContext_TargetInformation,*PSecPkgContext_TargetInformation; 544 545 typedef struct _SecPkgContext_AuthzID { 546 unsigned __LONG32 AuthzIDLength; 547 char *AuthzID; 548 } SecPkgContext_AuthzID,*PSecPkgContext_AuthzID; 549 550 typedef struct _SecPkgContext_Target { 551 unsigned __LONG32 TargetLength; 552 char *Target; 553 } SecPkgContext_Target,*PSecPkgContext_Target; 554 555 typedef void (WINAPI *SEC_GET_KEY_FN) (void *Arg,void *Principal,unsigned __LONG32 KeyVer,void **Key,SECURITY_STATUS *Status); 556 557 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001 558 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002 559 #define SECPKG_CONTEXT_EXPORT_TO_KERNEL 0x00000004 560 561 KSECDDDECLSPEC SECURITY_STATUS WINAPI AcquireCredentialsHandleW( 562 #if ISSP_MODE==0 563 PSECURITY_STRING pPrincipal,PSECURITY_STRING pPackage, 564 #else 565 SEC_WCHAR *pszPrincipal,SEC_WCHAR *pszPackage, 566 #endif 567 unsigned __LONG32 fCredentialUse,void *pvLogonId,void *pAuthData,SEC_GET_KEY_FN pGetKeyFn,void *pvGetKeyArgument,PCredHandle phCredential,PTimeStamp ptsExpiry); 568 569 typedef SECURITY_STATUS (WINAPI *ACQUIRE_CREDENTIALS_HANDLE_FN_W)( 570 #if ISSP_MODE==0 571 PSECURITY_STRING,PSECURITY_STRING, 572 #else 573 SEC_WCHAR *,SEC_WCHAR *, 574 #endif 575 unsigned __LONG32,void *,void *,SEC_GET_KEY_FN,void *,PCredHandle,PTimeStamp); 576 577 SECURITY_STATUS WINAPI AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal,SEC_CHAR *pszPackage,unsigned __LONG32 fCredentialUse,void *pvLogonId,void *pAuthData,SEC_GET_KEY_FN pGetKeyFn,void *pvGetKeyArgument,PCredHandle phCredential,PTimeStamp ptsExpiry); 578 579 typedef SECURITY_STATUS (WINAPI *ACQUIRE_CREDENTIALS_HANDLE_FN_A)(SEC_CHAR *,SEC_CHAR *,unsigned __LONG32,void *,void *,SEC_GET_KEY_FN,void *,PCredHandle,PTimeStamp); 580 581 #define AcquireCredentialsHandle __MINGW_NAME_AW(AcquireCredentialsHandle) 582 #define ACQUIRE_CREDENTIALS_HANDLE_FN __MINGW_NAME_UAW(ACQUIRE_CREDENTIALS_HANDLE_FN) 583 584 KSECDDDECLSPEC SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential); 585 586 typedef SECURITY_STATUS (WINAPI *FREE_CREDENTIALS_HANDLE_FN)(PCredHandle); 587 588 KSECDDDECLSPEC SECURITY_STATUS WINAPI AddCredentialsW(PCredHandle hCredentials, 589 #if ISSP_MODE==0 590 PSECURITY_STRING pPrincipal,PSECURITY_STRING pPackage, 591 #else 592 SEC_WCHAR *pszPrincipal,SEC_WCHAR *pszPackage, 593 #endif 594 unsigned __LONG32 fCredentialUse,void *pAuthData,SEC_GET_KEY_FN pGetKeyFn,void *pvGetKeyArgument,PTimeStamp ptsExpiry); 595 596 typedef SECURITY_STATUS (WINAPI *ADD_CREDENTIALS_FN_W)(PCredHandle, 597 #if ISSP_MODE==0 598 PSECURITY_STRING,PSECURITY_STRING, 599 #else 600 SEC_WCHAR *,SEC_WCHAR *, 601 #endif 602 unsigned __LONG32,void *,SEC_GET_KEY_FN,void *,PTimeStamp); 603 604 SECURITY_STATUS WINAPI AddCredentialsA(PCredHandle hCredentials,SEC_CHAR *pszPrincipal,SEC_CHAR *pszPackage,unsigned __LONG32 fCredentialUse,void *pAuthData,SEC_GET_KEY_FN pGetKeyFn,void *pvGetKeyArgument,PTimeStamp ptsExpiry); 605 606 typedef SECURITY_STATUS (WINAPI *ADD_CREDENTIALS_FN_A)(PCredHandle,SEC_CHAR *,SEC_CHAR *,unsigned __LONG32,void *,SEC_GET_KEY_FN,void *,PTimeStamp); 607 608 #define AddCredentials __MINGW_NAME_AW(AddCredentials) 609 #define ADD_CREDENTIALS_FN __MINGW_NAME_UAW(ADD_CREDENTIALS_FN) 610 611 KSECDDDECLSPEC SECURITY_STATUS WINAPI InitializeSecurityContextW(PCredHandle phCredential,PCtxtHandle phContext, 612 #if ISSP_MODE==0 613 PSECURITY_STRING pTargetName, 614 #else 615 SEC_WCHAR *pszTargetName, 616 #endif 617 unsigned __LONG32 fContextReq,unsigned __LONG32 Reserved1,unsigned __LONG32 TargetDataRep,PSecBufferDesc pInput,unsigned __LONG32 Reserved2,PCtxtHandle phNewContext,PSecBufferDesc pOutput,unsigned __LONG32 *pfContextAttr,PTimeStamp ptsExpiry); 618 619 typedef SECURITY_STATUS (WINAPI *INITIALIZE_SECURITY_CONTEXT_FN_W)(PCredHandle,PCtxtHandle, 620 #if ISSP_MODE==0 621 PSECURITY_STRING, 622 #else 623 SEC_WCHAR *, 624 #endif 625 unsigned __LONG32,unsigned __LONG32,unsigned __LONG32,PSecBufferDesc,unsigned __LONG32,PCtxtHandle,PSecBufferDesc,unsigned __LONG32 *,PTimeStamp); 626 627 SECURITY_STATUS WINAPI InitializeSecurityContextA(PCredHandle phCredential,PCtxtHandle phContext,SEC_CHAR *pszTargetName,unsigned __LONG32 fContextReq,unsigned __LONG32 Reserved1,unsigned __LONG32 TargetDataRep,PSecBufferDesc pInput,unsigned __LONG32 Reserved2,PCtxtHandle phNewContext,PSecBufferDesc pOutput,unsigned __LONG32 *pfContextAttr,PTimeStamp ptsExpiry); 628 629 typedef SECURITY_STATUS (WINAPI *INITIALIZE_SECURITY_CONTEXT_FN_A)(PCredHandle,PCtxtHandle,SEC_CHAR *,unsigned __LONG32,unsigned __LONG32,unsigned __LONG32,PSecBufferDesc,unsigned __LONG32,PCtxtHandle,PSecBufferDesc,unsigned __LONG32 *,PTimeStamp); 630 631 #define InitializeSecurityContext __MINGW_NAME_AW(InitializeSecurityContext) 632 #define INITIALIZE_SECURITY_CONTEXT_FN __MINGW_NAME_UAW(INITIALIZE_SECURITY_CONTEXT_FN) 633 634 KSECDDDECLSPEC SECURITY_STATUS WINAPI AcceptSecurityContext(PCredHandle phCredential,PCtxtHandle phContext,PSecBufferDesc pInput,unsigned __LONG32 fContextReq,unsigned __LONG32 TargetDataRep,PCtxtHandle phNewContext,PSecBufferDesc pOutput,unsigned __LONG32 *pfContextAttr,PTimeStamp ptsExpiry); 635 636 typedef SECURITY_STATUS (WINAPI *ACCEPT_SECURITY_CONTEXT_FN)(PCredHandle,PCtxtHandle,PSecBufferDesc,unsigned __LONG32,unsigned __LONG32,PCtxtHandle,PSecBufferDesc,unsigned __LONG32 *,PTimeStamp); 637 638 SECURITY_STATUS WINAPI CompleteAuthToken(PCtxtHandle phContext,PSecBufferDesc pToken); 639 640 typedef SECURITY_STATUS (WINAPI *COMPLETE_AUTH_TOKEN_FN)(PCtxtHandle,PSecBufferDesc); 641 642 KSECDDDECLSPEC SECURITY_STATUS WINAPI ImpersonateSecurityContext(PCtxtHandle phContext); 643 644 typedef SECURITY_STATUS (WINAPI *IMPERSONATE_SECURITY_CONTEXT_FN)(PCtxtHandle); 645 646 KSECDDDECLSPEC SECURITY_STATUS WINAPI RevertSecurityContext(PCtxtHandle phContext); 647 648 typedef SECURITY_STATUS (WINAPI *REVERT_SECURITY_CONTEXT_FN)(PCtxtHandle); 649 650 KSECDDDECLSPEC SECURITY_STATUS WINAPI QuerySecurityContextToken(PCtxtHandle phContext,HANDLE *Token); 651 652 typedef SECURITY_STATUS (WINAPI *QUERY_SECURITY_CONTEXT_TOKEN_FN)(PCtxtHandle,HANDLE *); 653 654 KSECDDDECLSPEC SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext); 655 656 typedef SECURITY_STATUS (WINAPI *DELETE_SECURITY_CONTEXT_FN)(PCtxtHandle); 657 658 KSECDDDECLSPEC SECURITY_STATUS WINAPI ApplyControlToken(PCtxtHandle phContext,PSecBufferDesc pInput); 659 660 typedef SECURITY_STATUS (WINAPI *APPLY_CONTROL_TOKEN_FN)(PCtxtHandle,PSecBufferDesc); 661 662 KSECDDDECLSPEC SECURITY_STATUS WINAPI QueryContextAttributesW(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer); 663 664 typedef SECURITY_STATUS (WINAPI *QUERY_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,unsigned __LONG32,void *); 665 666 SECURITY_STATUS WINAPI QueryContextAttributesA(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer); 667 668 typedef SECURITY_STATUS (WINAPI *QUERY_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,unsigned __LONG32,void *); 669 670 #define QueryContextAttributes __MINGW_NAME_AW(QueryContextAttributes) 671 #define QUERY_CONTEXT_ATTRIBUTES_FN __MINGW_NAME_UAW(QUERY_CONTEXT_ATTRIBUTES_FN) 672 673 SECURITY_STATUS WINAPI SetContextAttributesW(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer); 674 675 typedef SECURITY_STATUS (WINAPI *SET_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,unsigned __LONG32,void *,unsigned __LONG32); 676 677 SECURITY_STATUS WINAPI SetContextAttributesA(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer); 678 679 typedef SECURITY_STATUS (WINAPI *SET_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,unsigned __LONG32,void *,unsigned __LONG32); 680 681 #define SetContextAttributes __MINGW_NAME_AW(SetContextAttributes) 682 #define SET_CONTEXT_ATTRIBUTES_FN __MINGW_NAME_UAW(SET_CONTEXT_ATTRIBUTES_FN) 683 684 KSECDDDECLSPEC SECURITY_STATUS WINAPI QueryCredentialsAttributesW(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer); 685 686 typedef SECURITY_STATUS (WINAPI *QUERY_CREDENTIALS_ATTRIBUTES_FN_W)(PCredHandle,unsigned __LONG32,void *); 687 688 SECURITY_STATUS WINAPI QueryCredentialsAttributesA(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer); 689 690 typedef SECURITY_STATUS (WINAPI *QUERY_CREDENTIALS_ATTRIBUTES_FN_A)(PCredHandle,unsigned __LONG32,void *); 691 692 #define QueryCredentialsAttributes __MINGW_NAME_AW(QueryCredentialsAttributes) 693 #define QUERY_CREDENTIALS_ATTRIBUTES_FN __MINGW_NAME_UAW(QUERY_CREDENTIALS_ATTRIBUTES_FN) 694 695 KSECDDDECLSPEC SECURITY_STATUS WINAPI SetCredentialsAttributesW(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer); 696 697 typedef SECURITY_STATUS (WINAPI *SET_CREDENTIALS_ATTRIBUTES_FN_W)(PCredHandle,unsigned __LONG32,void *,unsigned __LONG32); 698 699 SECURITY_STATUS WINAPI SetCredentialsAttributesA(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer); 700 701 typedef SECURITY_STATUS (WINAPI *SET_CREDENTIALS_ATTRIBUTES_FN_A)(PCredHandle,unsigned __LONG32,void *,unsigned __LONG32); 702 703 #define SetCredentialsAttributes __MINGW_NAME_AW(SetCredentialsAttributes) 704 #define SET_CREDENTIALS_ATTRIBUTES_FN __MINGW_NAME_UAW(SET_CREDENTIALS_ATTRIBUTES_FN) 705 706 SECURITY_STATUS WINAPI FreeContextBuffer(void *pvContextBuffer); 707 708 typedef SECURITY_STATUS (WINAPI *FREE_CONTEXT_BUFFER_FN)(void *); 709 710 KSECDDDECLSPEC SECURITY_STATUS WINAPI MakeSignature(PCtxtHandle phContext,unsigned __LONG32 fQOP,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo); 711 712 typedef SECURITY_STATUS (WINAPI *MAKE_SIGNATURE_FN)(PCtxtHandle,unsigned __LONG32,PSecBufferDesc,unsigned __LONG32); 713 714 KSECDDDECLSPEC SECURITY_STATUS WINAPI VerifySignature(PCtxtHandle phContext,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo,unsigned __LONG32 *pfQOP); 715 716 typedef SECURITY_STATUS (WINAPI *VERIFY_SIGNATURE_FN)(PCtxtHandle,PSecBufferDesc,unsigned __LONG32,unsigned __LONG32 *); 717 718 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001 719 #define SECQOP_WRAP_OOB_DATA 0x40000000 720 721 SECURITY_STATUS WINAPI EncryptMessage(PCtxtHandle phContext,unsigned __LONG32 fQOP,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo); 722 723 typedef SECURITY_STATUS (WINAPI *ENCRYPT_MESSAGE_FN)(PCtxtHandle,unsigned __LONG32,PSecBufferDesc,unsigned __LONG32); 724 725 SECURITY_STATUS WINAPI DecryptMessage(PCtxtHandle phContext,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo,unsigned __LONG32 *pfQOP); 726 727 typedef SECURITY_STATUS (WINAPI *DECRYPT_MESSAGE_FN)(PCtxtHandle,PSecBufferDesc,unsigned __LONG32,unsigned __LONG32 *); 728 729 KSECDDDECLSPEC SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(unsigned __LONG32 *pcPackages,PSecPkgInfoW *ppPackageInfo); 730 731 typedef SECURITY_STATUS (WINAPI *ENUMERATE_SECURITY_PACKAGES_FN_W)(unsigned __LONG32 *,PSecPkgInfoW *); 732 733 SECURITY_STATUS WINAPI EnumerateSecurityPackagesA(unsigned __LONG32 *pcPackages,PSecPkgInfoA *ppPackageInfo); 734 735 typedef SECURITY_STATUS (WINAPI *ENUMERATE_SECURITY_PACKAGES_FN_A)(unsigned __LONG32 *,PSecPkgInfoA *); 736 737 #define EnumerateSecurityPackages __MINGW_NAME_AW(EnumerateSecurityPackages) 738 #define ENUMERATE_SECURITY_PACKAGES_FN __MINGW_NAME_UAW(ENUMERATE_SECURITY_PACKAGES_FN) 739 740 KSECDDDECLSPEC SECURITY_STATUS WINAPI QuerySecurityPackageInfoW( 741 #if ISSP_MODE==0 742 PSECURITY_STRING pPackageName, 743 #else 744 SEC_WCHAR *pszPackageName, 745 #endif 746 PSecPkgInfoW *ppPackageInfo); 747 748 typedef SECURITY_STATUS (WINAPI *QUERY_SECURITY_PACKAGE_INFO_FN_W)( 749 #if ISSP_MODE==0 750 PSECURITY_STRING, 751 #else 752 SEC_WCHAR *, 753 #endif 754 PSecPkgInfoW *); 755 756 SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName,PSecPkgInfoA *ppPackageInfo); 757 758 typedef SECURITY_STATUS (WINAPI *QUERY_SECURITY_PACKAGE_INFO_FN_A)(SEC_CHAR *,PSecPkgInfoA *); 759 760 #define QuerySecurityPackageInfo __MINGW_NAME_AW(QuerySecurityPackageInfo) 761 #define QUERY_SECURITY_PACKAGE_INFO_FN __MINGW_NAME_UAW(QUERY_SECURITY_PACKAGE_INFO_FN) 762 763 typedef enum _SecDelegationType { 764 SecFull,SecService,SecTree,SecDirectory,SecObject 765 } SecDelegationType,*PSecDelegationType; 766 767 SECURITY_STATUS WINAPI DelegateSecurityContext(PCtxtHandle phContext, 768 #if ISSP_MODE==0 769 PSECURITY_STRING pTarget, 770 #else 771 SEC_CHAR *pszTarget, 772 #endif 773 SecDelegationType DelegationType,PTimeStamp pExpiry,PSecBuffer pPackageParameters,PSecBufferDesc pOutput); 774 775 KSECDDDECLSPEC SECURITY_STATUS WINAPI ExportSecurityContext(PCtxtHandle phContext,ULONG fFlags,PSecBuffer pPackedContext,void **pToken); 776 777 typedef SECURITY_STATUS (WINAPI *EXPORT_SECURITY_CONTEXT_FN)(PCtxtHandle,ULONG,PSecBuffer,void **); 778 779 KSECDDDECLSPEC SECURITY_STATUS WINAPI ImportSecurityContextW( 780 #if ISSP_MODE==0 781 PSECURITY_STRING pszPackage, 782 #else 783 SEC_WCHAR *pszPackage, 784 #endif 785 PSecBuffer pPackedContext,void *Token,PCtxtHandle phContext); 786 787 typedef SECURITY_STATUS (WINAPI *IMPORT_SECURITY_CONTEXT_FN_W)( 788 #if ISSP_MODE==0 789 PSECURITY_STRING, 790 #else 791 SEC_WCHAR *, 792 #endif 793 PSecBuffer,VOID *,PCtxtHandle); 794 795 SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage,PSecBuffer pPackedContext,VOID *Token,PCtxtHandle phContext); 796 797 typedef SECURITY_STATUS (WINAPI *IMPORT_SECURITY_CONTEXT_FN_A)(SEC_CHAR *,PSecBuffer,void *,PCtxtHandle); 798 799 #define ImportSecurityContext __MINGW_NAME_AW(ImportSecurityContext) 800 #define IMPORT_SECURITY_CONTEXT_FN __MINGW_NAME_UAW(IMPORT_SECURITY_CONTEXT_FN) 801 802 #if ISSP_MODE==0 803 KSECDDDECLSPEC NTSTATUS NTAPI SecMakeSPN(PUNICODE_STRING ServiceClass,PUNICODE_STRING ServiceName,PUNICODE_STRING InstanceName,USHORT InstancePort,PUNICODE_STRING Referrer,PUNICODE_STRING Spn,PULONG Length,BOOLEAN Allocate); 804 KSECDDDECLSPEC NTSTATUS NTAPI SecMakeSPNEx(PUNICODE_STRING ServiceClass,PUNICODE_STRING ServiceName,PUNICODE_STRING InstanceName,USHORT InstancePort,PUNICODE_STRING Referrer,PUNICODE_STRING TargetInfo,PUNICODE_STRING Spn,PULONG Length,BOOLEAN Allocate); 805 KSECDDDECLSPEC NTSTATUS WINAPI SecLookupAccountSid(PSID Sid,PULONG NameSize,PUNICODE_STRING NameBuffer,PULONG DomainSize,PUNICODE_STRING DomainBuffer,PSID_NAME_USE NameUse); 806 KSECDDDECLSPEC NTSTATUS WINAPI SecLookupAccountName(PUNICODE_STRING Name,PULONG SidSize,PSID Sid,PSID_NAME_USE NameUse,PULONG DomainSize,PUNICODE_STRING ReferencedDomain); 807 KSECDDDECLSPEC NTSTATUS WINAPI SecLookupWellKnownSid(WELL_KNOWN_SID_TYPE SidType,PSID Sid,ULONG SidBufferSize,PULONG SidSize); 808 #endif 809 810 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW" 811 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA" 812 #define SECURITY_ENTRYPOINTW SEC_TEXT("InitSecurityInterfaceW") 813 #define SECURITY_ENTRYPOINTA SEC_TEXT("InitSecurityInterfaceA") 814 #define SECURITY_ENTRYPOINT16 "INITSECURITYINTERFACEA" 815 816 #ifdef SECURITY_WIN32 817 #define SECURITY_ENTRYPOINT __MINGW_NAME_AW(SECURITY_ENTRYPOINT) 818 #define SECURITY_ENTRYPOINT_ANSI __MINGW_NAME_AW(SECURITY_ENTRYPOINT_ANSI) 819 #else 820 #define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINT16 821 #define SECURITY_ENTRYPOINT_ANSI SECURITY_ENTRYPOINT16 822 #endif 823 824 #define FreeCredentialHandle FreeCredentialsHandle 825 826 typedef struct _SECURITY_FUNCTION_TABLE_W { 827 unsigned __LONG32 dwVersion; 828 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW; 829 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW; 830 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW; 831 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle; 832 void *Reserved2; 833 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW; 834 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext; 835 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken; 836 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext; 837 APPLY_CONTROL_TOKEN_FN ApplyControlToken; 838 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW; 839 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext; 840 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext; 841 MAKE_SIGNATURE_FN MakeSignature; 842 VERIFY_SIGNATURE_FN VerifySignature; 843 FREE_CONTEXT_BUFFER_FN FreeContextBuffer; 844 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW; 845 void *Reserved3; 846 void *Reserved4; 847 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext; 848 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW; 849 ADD_CREDENTIALS_FN_W AddCredentialsW; 850 void *Reserved8; 851 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken; 852 ENCRYPT_MESSAGE_FN EncryptMessage; 853 DECRYPT_MESSAGE_FN DecryptMessage; 854 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW; 855 SET_CREDENTIALS_ATTRIBUTES_FN_W SetCredentialsAttributesW; 856 } SecurityFunctionTableW,*PSecurityFunctionTableW; 857 858 typedef struct _SECURITY_FUNCTION_TABLE_A { 859 unsigned __LONG32 dwVersion; 860 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA; 861 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA; 862 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA; 863 FREE_CREDENTIALS_HANDLE_FN FreeCredentialHandle; 864 void *Reserved2; 865 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA; 866 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext; 867 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken; 868 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext; 869 APPLY_CONTROL_TOKEN_FN ApplyControlToken; 870 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA; 871 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext; 872 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext; 873 MAKE_SIGNATURE_FN MakeSignature; 874 VERIFY_SIGNATURE_FN VerifySignature; 875 FREE_CONTEXT_BUFFER_FN FreeContextBuffer; 876 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA; 877 void *Reserved3; 878 void *Reserved4; 879 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext; 880 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA; 881 ADD_CREDENTIALS_FN_A AddCredentialsA; 882 void *Reserved8; 883 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken; 884 ENCRYPT_MESSAGE_FN EncryptMessage; 885 DECRYPT_MESSAGE_FN DecryptMessage; 886 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA; 887 SET_CREDENTIALS_ATTRIBUTES_FN_A SetCredentialsAttributesA; 888 } SecurityFunctionTableA,*PSecurityFunctionTableA; 889 890 #define SecurityFunctionTable __MINGW_NAME_AW(SecurityFunctionTable) 891 #define PSecurityFunctionTable __MINGW_NAME_AW(PSecurityFunctionTable) 892 893 #define SECURITY_ 894 895 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1 896 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2 897 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_3 3 898 899 PSecurityFunctionTableA WINAPI InitSecurityInterfaceA(void); 900 901 typedef PSecurityFunctionTableA (WINAPI *INIT_SECURITY_INTERFACE_A)(void); 902 903 KSECDDDECLSPEC PSecurityFunctionTableW WINAPI InitSecurityInterfaceW(void); 904 905 typedef PSecurityFunctionTableW (WINAPI *INIT_SECURITY_INTERFACE_W)(void); 906 907 #define InitSecurityInterface __MINGW_NAME_AW(InitSecurityInterface) 908 #define INIT_SECURITY_INTERFACE __MINGW_NAME_UAW(INIT_SECURITY_INTERFACE) 909 910 #ifdef SECURITY_WIN32 911 912 SECURITY_STATUS WINAPI SaslEnumerateProfilesA(LPSTR *ProfileList,ULONG *ProfileCount); 913 SECURITY_STATUS WINAPI SaslEnumerateProfilesW(LPWSTR *ProfileList,ULONG *ProfileCount); 914 915 #define SaslEnumerateProfiles __MINGW_NAME_AW(SaslEnumerateProfiles) 916 917 SECURITY_STATUS WINAPI SaslGetProfilePackageA(LPSTR ProfileName,PSecPkgInfoA *PackageInfo); 918 SECURITY_STATUS WINAPI SaslGetProfilePackageW(LPWSTR ProfileName,PSecPkgInfoW *PackageInfo); 919 920 #define SaslGetProfilePackage __MINGW_NAME_AW(SaslGetProfilePackage) 921 922 SECURITY_STATUS WINAPI SaslIdentifyPackageA(PSecBufferDesc pInput,PSecPkgInfoA *PackageInfo); 923 SECURITY_STATUS WINAPI SaslIdentifyPackageW(PSecBufferDesc pInput,PSecPkgInfoW *PackageInfo); 924 925 #define SaslIdentifyPackage __MINGW_NAME_AW(SaslIdentifyPackage) 926 927 SECURITY_STATUS WINAPI SaslInitializeSecurityContextW(PCredHandle phCredential,PCtxtHandle phContext,LPWSTR pszTargetName,unsigned __LONG32 fContextReq,unsigned __LONG32 Reserved1,unsigned __LONG32 TargetDataRep,PSecBufferDesc pInput,unsigned __LONG32 Reserved2,PCtxtHandle phNewContext,PSecBufferDesc pOutput,unsigned __LONG32 *pfContextAttr,PTimeStamp ptsExpiry); 928 SECURITY_STATUS WINAPI SaslInitializeSecurityContextA(PCredHandle phCredential,PCtxtHandle phContext,LPSTR pszTargetName,unsigned __LONG32 fContextReq,unsigned __LONG32 Reserved1,unsigned __LONG32 TargetDataRep,PSecBufferDesc pInput,unsigned __LONG32 Reserved2,PCtxtHandle phNewContext,PSecBufferDesc pOutput,unsigned __LONG32 *pfContextAttr,PTimeStamp ptsExpiry); 929 930 #define SaslInitializeSecurityContext __MINGW_NAME_AW(SaslInitializeSecurityContext) 931 932 SECURITY_STATUS WINAPI SaslAcceptSecurityContext(PCredHandle phCredential,PCtxtHandle phContext,PSecBufferDesc pInput,unsigned __LONG32 fContextReq,unsigned __LONG32 TargetDataRep,PCtxtHandle phNewContext,PSecBufferDesc pOutput,unsigned __LONG32 *pfContextAttr,PTimeStamp ptsExpiry); 933 934 #define SASL_OPTION_SEND_SIZE 1 935 #define SASL_OPTION_RECV_SIZE 2 936 #define SASL_OPTION_AUTHZ_STRING 3 937 #define SASL_OPTION_AUTHZ_PROCESSING 4 938 939 typedef enum _SASL_AUTHZID_STATE { 940 Sasl_AuthZIDForbidden,Sasl_AuthZIDProcessed 941 } SASL_AUTHZID_STATE; 942 943 SECURITY_STATUS WINAPI SaslSetContextOption(PCtxtHandle ContextHandle,ULONG Option,PVOID Value,ULONG Size); 944 SECURITY_STATUS WINAPI SaslGetContextOption(PCtxtHandle ContextHandle,ULONG Option,PVOID Value,ULONG Size,PULONG Needed); 945 #endif 946 947 #ifndef _AUTH_IDENTITY_DEFINED 948 #define _AUTH_IDENTITY_DEFINED 949 950 #define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1 951 #define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2 952 953 typedef struct _SEC_WINNT_AUTH_IDENTITY_W { 954 unsigned short *User; 955 unsigned __LONG32 UserLength; 956 unsigned short *Domain; 957 unsigned __LONG32 DomainLength; 958 unsigned short *Password; 959 unsigned __LONG32 PasswordLength; 960 unsigned __LONG32 Flags; 961 } SEC_WINNT_AUTH_IDENTITY_W,*PSEC_WINNT_AUTH_IDENTITY_W; 962 963 typedef struct _SEC_WINNT_AUTH_IDENTITY_A { 964 unsigned char *User; 965 unsigned __LONG32 UserLength; 966 unsigned char *Domain; 967 unsigned __LONG32 DomainLength; 968 unsigned char *Password; 969 unsigned __LONG32 PasswordLength; 970 unsigned __LONG32 Flags; 971 } SEC_WINNT_AUTH_IDENTITY_A,*PSEC_WINNT_AUTH_IDENTITY_A; 972 973 #define SEC_WINNT_AUTH_IDENTITY __MINGW_NAME_UAW(SEC_WINNT_AUTH_IDENTITY) 974 #define PSEC_WINNT_AUTH_IDENTITY __MINGW_NAME_UAW(PSEC_WINNT_AUTH_IDENTITY) 975 #define _SEC_WINNT_AUTH_IDENTITY __MINGW_NAME_UAW(_SEC_WINNT_AUTH_IDENTITY) 976 #endif 977 978 #ifndef SEC_WINNT_AUTH_IDENTITY_VERSION 979 #define SEC_WINNT_AUTH_IDENTITY_VERSION 0x200 980 981 typedef struct _SEC_WINNT_AUTH_IDENTITY_EXW { 982 unsigned __LONG32 Version; 983 unsigned __LONG32 Length; 984 unsigned short *User; 985 unsigned __LONG32 UserLength; 986 unsigned short *Domain; 987 unsigned __LONG32 DomainLength; 988 unsigned short *Password; 989 unsigned __LONG32 PasswordLength; 990 unsigned __LONG32 Flags; 991 unsigned short *PackageList; 992 unsigned __LONG32 PackageListLength; 993 } SEC_WINNT_AUTH_IDENTITY_EXW,*PSEC_WINNT_AUTH_IDENTITY_EXW; 994 995 typedef struct _SEC_WINNT_AUTH_IDENTITY_EXA { 996 unsigned __LONG32 Version; 997 unsigned __LONG32 Length; 998 unsigned char *User; 999 unsigned __LONG32 UserLength; 1000 unsigned char *Domain; 1001 unsigned __LONG32 DomainLength; 1002 unsigned char *Password; 1003 unsigned __LONG32 PasswordLength; 1004 unsigned __LONG32 Flags; 1005 unsigned char *PackageList; 1006 unsigned __LONG32 PackageListLength; 1007 } SEC_WINNT_AUTH_IDENTITY_EXA,*PSEC_WINNT_AUTH_IDENTITY_EXA; 1008 1009 #define SEC_WINNT_AUTH_IDENTITY_EX __MINGW_NAME_AW(SEC_WINNT_AUTH_IDENTITY_EX) 1010 #define PSEC_WINNT_AUTH_IDENTITY_EX __MINGW_NAME_AW(PSEC_WINNT_AUTH_IDENTITY_EX) 1011 #endif 1012 1013 #define SEC_WINNT_AUTH_IDENTITY_MARSHALLED 0x4 1014 #define SEC_WINNT_AUTH_IDENTITY_ONLY 0x8 1015 1016 typedef struct _SECURITY_PACKAGE_OPTIONS { 1017 unsigned __LONG32 Size; 1018 unsigned __LONG32 Type; 1019 unsigned __LONG32 Flags; 1020 unsigned __LONG32 SignatureSize; 1021 void *Signature; 1022 } SECURITY_PACKAGE_OPTIONS,*PSECURITY_PACKAGE_OPTIONS; 1023 1024 #define SECPKG_OPTIONS_TYPE_UNKNOWN 0 1025 #define SECPKG_OPTIONS_TYPE_LSA 1 1026 #define SECPKG_OPTIONS_TYPE_SSPI 2 1027 1028 #define SECPKG_OPTIONS_PERMANENT 0x00000001 1029 1030 #define AddSecurityPackage __MINGW_NAME_AW(AddSecurityPackage) 1031 #define DeleteSecurityPackage __MINGW_NAME_AW(DeleteSecurityPackage) 1032 1033 SECURITY_STATUS WINAPI AddSecurityPackageA(LPSTR pszPackageName,PSECURITY_PACKAGE_OPTIONS pOptions); 1034 SECURITY_STATUS WINAPI AddSecurityPackageW(LPWSTR pszPackageName,PSECURITY_PACKAGE_OPTIONS pOptions); 1035 1036 SECURITY_STATUS WINAPI DeleteSecurityPackageA(SEC_CHAR *pszPackageName); 1037 SECURITY_STATUS WINAPI DeleteSecurityPackageW(SEC_WCHAR *pszPackageName); 1038 1039 #if (_WIN32_WINNT >= 0x0600) 1040 SECURITY_STATUS WINAPI ChangeAccountPassword( 1041 SEC_WCHAR *pszPackageName, 1042 SEC_WCHAR *pszDomainName, 1043 SEC_WCHAR *pszAccountName, 1044 SEC_WCHAR *pszOldPassword, 1045 SEC_WCHAR *pszNewPassword, 1046 BOOLEAN bImpersonating, 1047 unsigned __LONG32 dwReserved, 1048 PSecBufferDesc pOutput 1049 ); 1050 #endif /*(_WIN32_WINNT >= 0x0600)*/ 1051 #if (_WIN32_WINNT >= 0x0601) 1052 typedef struct _CREDUIWIN_MARSHALED_CONTEXT { 1053 GUID StructureType; 1054 USHORT cbHeaderLength; 1055 LUID LogonId; 1056 GUID MarshaledDataType; 1057 ULONG MarshaledDataOffset; 1058 USHORT MarshaledDataLength; 1059 } CREDUIWIN_MARSHALED_CONTEXT, *PCREDUIWIN_MARSHALED_CONTEXT; 1060 1061 #endif /*(_WIN32_WINNT >= 0x0601)*/ 1062 1063 #ifdef __cplusplus 1064 } 1065 #endif 1066 #endif 1067