zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

sspi.h (73200B) - Raw


      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 #define SEC_DELETED_HANDLE ((ULONG_PTR)(-2))
     91 
     92   typedef SecHandle CredHandle;
     93   typedef PSecHandle PCredHandle;
     94 
     95   typedef SecHandle CtxtHandle;
     96   typedef PSecHandle PCtxtHandle;
     97 
     98 #ifdef WIN32_CHICAGO
     99   __MINGW_EXTENSION typedef unsigned __int64 QWORD;
    100   typedef QWORD SECURITY_INTEGER,*PSECURITY_INTEGER;
    101 #define SEC_SUCCESS(Status) ((Status) >= 0)
    102 #elif defined(_NTDEF_) || defined(_WINNT_)
    103   typedef LARGE_INTEGER _SECURITY_INTEGER,SECURITY_INTEGER,*PSECURITY_INTEGER;
    104 #else
    105   typedef struct _SECURITY_INTEGER {
    106     unsigned __LONG32 LowPart;
    107     __LONG32 HighPart;
    108   } SECURITY_INTEGER,*PSECURITY_INTEGER;
    109 #endif
    110 
    111 #ifndef SECURITY_MAC
    112   typedef SECURITY_INTEGER TimeStamp;
    113   typedef SECURITY_INTEGER *PTimeStamp;
    114 #else
    115   typedef unsigned __LONG32 TimeStamp;
    116   typedef unsigned __LONG32 *PTimeStamp;
    117 #endif
    118 
    119 #ifndef _NTDEF_
    120   typedef struct _SECURITY_STRING {
    121     unsigned short Length;
    122     unsigned short MaximumLength;
    123     unsigned short *Buffer;
    124   } SECURITY_STRING,*PSECURITY_STRING;
    125 #else
    126   typedef UNICODE_STRING SECURITY_STRING,*PSECURITY_STRING;
    127 #endif
    128 
    129   typedef struct _SecPkgInfoW {
    130     unsigned __LONG32 fCapabilities;
    131     unsigned short wVersion;
    132     unsigned short wRPCID;
    133     unsigned __LONG32 cbMaxToken;
    134     SEC_WCHAR *Name;
    135     SEC_WCHAR *Comment;
    136   } SecPkgInfoW,*PSecPkgInfoW;
    137 
    138   typedef struct _SecPkgInfoA {
    139     unsigned __LONG32 fCapabilities;
    140     unsigned short wVersion;
    141     unsigned short wRPCID;
    142     unsigned __LONG32 cbMaxToken;
    143     SEC_CHAR *Name;
    144     SEC_CHAR *Comment;
    145   } SecPkgInfoA,*PSecPkgInfoA;
    146 
    147 #define SecPkgInfo __MINGW_NAME_AW(SecPkgInfo)
    148 #define PSecPkgInfo __MINGW_NAME_AW(PSecPkgInfo)
    149 
    150 #define SECPKG_FLAG_INTEGRITY 0x00000001
    151 #define SECPKG_FLAG_PRIVACY 0x00000002
    152 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004
    153 #define SECPKG_FLAG_DATAGRAM 0x00000008
    154 #define SECPKG_FLAG_CONNECTION 0x00000010
    155 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020
    156 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040
    157 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080
    158 #define SECPKG_FLAG_IMPERSONATION 0x00000100
    159 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200
    160 #define SECPKG_FLAG_STREAM 0x00000400
    161 #define SECPKG_FLAG_NEGOTIABLE 0x00000800
    162 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000
    163 #define SECPKG_FLAG_LOGON 0x00002000
    164 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000
    165 #define SECPKG_FLAG_FRAGMENT 0x00008000
    166 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000
    167 #define SECPKG_FLAG_DELEGATION 0x00020000
    168 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
    169 #define SECPKG_FLAG_RESTRICTED_TOKENS 0x00080000
    170 #define SECPKG_FLAG_NEGO_EXTENDER 0x00100000
    171 #define SECPKG_FLAG_NEGOTIABLE2 0x00200000
    172 #define SECPKG_FLAG_APPCONTAINER_PASSTHROUGH 0x00400000
    173 #define SECPKG_FLAG_APPCONTAINER_CHECKS 0x00800000
    174 #define SECPKG_FLAG_CREDENTIAL_ISOLATION_ENABLED 0x01000000
    175 #define SECPKG_FLAG_APPLY_LOOPBACK 0x02000000
    176 
    177 #define SECPKG_ID_NONE 0xFFFF
    178 
    179 #define SECPKG_CALLFLAGS_APPCONTAINER 0x00000001
    180 #define SECPKG_CALLFLAGS_APPCONTAINER_AUTHCAPABLE 0x00000002
    181 #define SECPKG_CALLFLAGS_FORCE_SUPPLIED 0x00000004
    182 #define SECPKG_CALLFLAGS_APPCONTAINER_UPNCAPABLE 0x00000008
    183 
    184   typedef struct _SecBuffer {
    185     unsigned __LONG32 cbBuffer;
    186     unsigned __LONG32 BufferType;
    187     void *pvBuffer;
    188   } SecBuffer,*PSecBuffer;
    189 
    190   typedef struct _SecBufferDesc {
    191     unsigned __LONG32 ulVersion;
    192     unsigned __LONG32 cBuffers;
    193     PSecBuffer pBuffers;
    194   } SecBufferDesc,*PSecBufferDesc;
    195 
    196 #define SECBUFFER_VERSION 0
    197 
    198 #define SECBUFFER_EMPTY 0
    199 #define SECBUFFER_DATA 1
    200 #define SECBUFFER_TOKEN 2
    201 #define SECBUFFER_PKG_PARAMS 3
    202 #define SECBUFFER_MISSING 4
    203 #define SECBUFFER_EXTRA 5
    204 #define SECBUFFER_STREAM_TRAILER 6
    205 #define SECBUFFER_STREAM_HEADER 7
    206 #define SECBUFFER_NEGOTIATION_INFO 8
    207 #define SECBUFFER_PADDING 9
    208 #define SECBUFFER_STREAM 10
    209 #define SECBUFFER_MECHLIST 11
    210 #define SECBUFFER_MECHLIST_SIGNATURE 12
    211 #define SECBUFFER_TARGET 13
    212 #define SECBUFFER_CHANNEL_BINDINGS 14
    213 #define SECBUFFER_CHANGE_PASS_RESPONSE 15
    214 #define SECBUFFER_TARGET_HOST 16
    215 #define SECBUFFER_ALERT 17
    216 #define SECBUFFER_APPLICATION_PROTOCOLS 18
    217 #define SECBUFFER_SRTP_PROTECTION_PROFILES 19
    218 #define SECBUFFER_SRTP_MASTER_KEY_IDENTIFIER 20
    219 #define SECBUFFER_TOKEN_BINDING 21
    220 #define SECBUFFER_PRESHARED_KEY 22
    221 #define SECBUFFER_PRESHARED_KEY_IDENTITY 23
    222 #define SECBUFFER_DTLS_MTU 24
    223 #define SECBUFFER_SEND_GENERIC_TLS_EXTENSION 25
    224 #define SECBUFFER_SUBSCRIBE_GENERIC_TLS_EXTENSION 26
    225 #define SECBUFFER_FLAGS 27
    226 #define SECBUFFER_TRAFFIC_SECRETS 28
    227 #define SECBUFFER_CERTIFICATE_REQUEST_CONTEXT 29
    228 
    229 #define SECBUFFER_ATTRMASK 0xF0000000
    230 #define SECBUFFER_READONLY 0x80000000
    231 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
    232 #define SECBUFFER_RESERVED 0x60000000
    233 
    234   typedef struct _SEC_NEGOTIATION_INFO {
    235     unsigned __LONG32 Size;
    236     unsigned __LONG32 NameLength;
    237     SEC_WCHAR *Name;
    238     void *Reserved;
    239   } SEC_NEGOTIATION_INFO,*PSEC_NEGOTIATION_INFO;
    240 
    241   typedef struct _SEC_CHANNEL_BINDINGS {
    242     unsigned __LONG32 dwInitiatorAddrType;
    243     unsigned __LONG32 cbInitiatorLength;
    244     unsigned __LONG32 dwInitiatorOffset;
    245     unsigned __LONG32 dwAcceptorAddrType;
    246     unsigned __LONG32 cbAcceptorLength;
    247     unsigned __LONG32 dwAcceptorOffset;
    248     unsigned __LONG32 cbApplicationDataLength;
    249     unsigned __LONG32 dwApplicationDataOffset;
    250   } SEC_CHANNEL_BINDINGS,*PSEC_CHANNEL_BINDINGS;
    251 
    252   typedef enum _SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT {
    253     SecApplicationProtocolNegotiationExt_None,
    254     SecApplicationProtocolNegotiationExt_NPN,
    255     SecApplicationProtocolNegotiationExt_ALPN
    256   } SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT,*PSEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT;
    257 
    258   typedef struct _SEC_APPLICATION_PROTOCOL_LIST {
    259     SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT ProtoNegoExt;
    260     unsigned short ProtocolListSize;
    261     unsigned char ProtocolList[ANYSIZE_ARRAY];
    262   } SEC_APPLICATION_PROTOCOL_LIST,*PSEC_APPLICATION_PROTOCOL_LIST;
    263 
    264   typedef struct _SEC_APPLICATION_PROTOCOLS {
    265     unsigned __LONG32 ProtocolListsSize;
    266     SEC_APPLICATION_PROTOCOL_LIST ProtocolLists[ANYSIZE_ARRAY];
    267   } SEC_APPLICATION_PROTOCOLS,*PSEC_APPLICATION_PROTOCOLS;
    268 
    269   typedef struct _SEC_SRTP_PROTECTION_PROFILES {
    270     unsigned short ProfilesSize;
    271     unsigned short ProfilesList[ANYSIZE_ARRAY];
    272   } SEC_SRTP_PROTECTION_PROFILES,*PSEC_SRTP_PROTECTION_PROFILES;
    273 
    274   typedef struct _SEC_SRTP_MASTER_KEY_IDENTIFIER {
    275     unsigned char MasterKeyIdentifierSize;
    276     unsigned char MasterKeyIdentifier[ANYSIZE_ARRAY];
    277   } SEC_SRTP_MASTER_KEY_IDENTIFIER,*PSEC_SRTP_MASTER_KEY_IDENTIFIER;
    278 
    279   typedef struct _SEC_TOKEN_BINDING {
    280     unsigned char MajorVersion;
    281     unsigned char MinorVersion;
    282     unsigned short KeyParametersSize;
    283     unsigned char KeyParameters[ANYSIZE_ARRAY];
    284   } SEC_TOKEN_BINDING,*PSEC_TOKEN_BINDING;
    285 
    286   typedef struct _SEC_PRESHAREDKEY {
    287     unsigned short KeySize;
    288     unsigned char Key[ANYSIZE_ARRAY];
    289   } SEC_PRESHAREDKEY,*PSEC_PRESHAREDKEY;
    290 
    291   typedef struct _SEC_PRESHAREDKEY_IDENTITY {
    292     unsigned short KeyIdentitySize;
    293     unsigned char KeyIdentity[ANYSIZE_ARRAY];
    294   } SEC_PRESHAREDKEY_IDENTITY,*PSEC_PRESHAREDKEY_IDENTITY;
    295 
    296   typedef struct _SEC_DTLS_MTU {
    297     unsigned short PathMTU;
    298   } SEC_DTLS_MTU,*PSEC_DTLS_MTU;
    299 
    300   typedef struct _SEC_FLAGS {
    301     unsigned long long Flags;
    302   } SEC_FLAGS,*PSEC_FLAGS;
    303 
    304   typedef struct _SEC_CERTIFICATE_REQUEST_CONTEXT {
    305     unsigned char cbCertificateRequestContext;
    306     unsigned char rgCertificateRequestContext[ANYSIZE_ARRAY];
    307   } SEC_CERTIFICATE_REQUEST_CONTEXT,*PSEC_CERTIFICATE_REQUEST_CONTEXT;
    308 
    309   typedef enum _SEC_TRAFFIC_SECRET_TYPE {
    310     SecTrafficSecret_None,
    311     SecTrafficSecret_Client,
    312     SecTrafficSecret_Server
    313   } SEC_TRAFFIC_SECRET_TYPE,*PSEC_TRAFFIC_SECRET_TYPE;
    314 
    315 #define SZ_ALG_MAX_SIZE 64
    316 
    317   typedef struct _SEC_TRAFFIC_SECRETS {
    318     wchar_t SymmetricAlgId[SZ_ALG_MAX_SIZE];
    319     wchar_t ChainingMode[SZ_ALG_MAX_SIZE];
    320     wchar_t HashAlgId[SZ_ALG_MAX_SIZE];
    321     unsigned short KeySize;
    322     unsigned short IvSize;
    323     unsigned short MsgSequenceStart;
    324     unsigned short MsgSequenceEnd;
    325     SEC_TRAFFIC_SECRET_TYPE TrafficSecretType;
    326     unsigned short TrafficSecretSize;
    327     unsigned char TrafficSecret[ANYSIZE_ARRAY];
    328 } SEC_TRAFFIC_SECRETS,*PSEC_TRAFFIC_SECRETS;
    329 
    330 #define SECURITY_NATIVE_DREP 0x00000010
    331 #define SECURITY_NETWORK_DREP 0x00000000
    332 
    333 #define SECPKG_CRED_INBOUND 0x00000001
    334 #define SECPKG_CRED_OUTBOUND 0x00000002
    335 #define SECPKG_CRED_BOTH 0x00000003
    336 #define SECPKG_CRED_DEFAULT 0x00000004
    337 #define SECPKG_CRED_RESERVED 0xF0000000
    338 
    339 #define SECPKG_CRED_AUTOLOGON_RESTRICTED 0x00000010
    340 #define SECPKG_CRED_PROCESS_POLICY_ONLY 0x00000020
    341 
    342 #define ISC_REQ_DELEGATE 0x00000001
    343 #define ISC_REQ_MUTUAL_AUTH 0x00000002
    344 #define ISC_REQ_REPLAY_DETECT 0x00000004
    345 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
    346 #define ISC_REQ_CONFIDENTIALITY 0x00000010
    347 #define ISC_REQ_USE_SESSION_KEY 0x00000020
    348 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
    349 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
    350 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
    351 #define ISC_REQ_USE_DCE_STYLE 0x00000200
    352 #define ISC_REQ_DATAGRAM 0x00000400
    353 #define ISC_REQ_CONNECTION 0x00000800
    354 #define ISC_REQ_CALL_LEVEL 0x00001000
    355 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
    356 #define ISC_REQ_EXTENDED_ERROR 0x00004000
    357 #define ISC_REQ_STREAM 0x00008000
    358 #define ISC_REQ_INTEGRITY 0x00010000
    359 #define ISC_REQ_IDENTIFY 0x00020000
    360 #define ISC_REQ_NULL_SESSION 0x00040000
    361 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
    362 #define ISC_REQ_RESERVED1 0x00100000
    363 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
    364 #define ISC_REQ_FORWARD_CREDENTIALS 0x00400000
    365 #define ISC_REQ_NO_INTEGRITY 0x00800000
    366 #define ISC_REQ_USE_HTTP_STYLE 0x01000000
    367 #define ISC_REQ_UNVERIFIED_TARGET_NAME 0x20000000
    368 #define ISC_REQ_CONFIDENTIALITY_ONLY 0x40000000
    369 #define ISC_REQ_MESSAGES 0x0000000100000000
    370 #define ISC_REQ_DEFERRED_CRED_VALIDATION 0x0000000200000000
    371 #define ISC_REQ_NO_POST_HANDSHAKE_AUTH 0x0000000400000000
    372 
    373 #define ISC_RET_DELEGATE 0x00000001
    374 #define ISC_RET_MUTUAL_AUTH 0x00000002
    375 #define ISC_RET_REPLAY_DETECT 0x00000004
    376 #define ISC_RET_SEQUENCE_DETECT 0x00000008
    377 #define ISC_RET_CONFIDENTIALITY 0x00000010
    378 #define ISC_RET_USE_SESSION_KEY 0x00000020
    379 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
    380 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
    381 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
    382 #define ISC_RET_USED_DCE_STYLE 0x00000200
    383 #define ISC_RET_DATAGRAM 0x00000400
    384 #define ISC_RET_CONNECTION 0x00000800
    385 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
    386 #define ISC_RET_CALL_LEVEL 0x00002000
    387 #define ISC_RET_EXTENDED_ERROR 0x00004000
    388 #define ISC_RET_STREAM 0x00008000
    389 #define ISC_RET_INTEGRITY 0x00010000
    390 #define ISC_RET_IDENTIFY 0x00020000
    391 #define ISC_RET_NULL_SESSION 0x00040000
    392 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
    393 #define ISC_RET_RESERVED1 0x00100000
    394 #define ISC_RET_FRAGMENT_ONLY 0x00200000
    395 #define ISC_RET_FORWARD_CREDENTIALS 0x00400000
    396 #define ISC_RET_USED_HTTP_STYLE 0x01000000
    397 #define ISC_RET_NO_ADDITIONAL_TOKEN 0x02000000
    398 #define ISC_RET_REAUTHENTICATION 0x08000000
    399 #define ISC_RET_CONFIDENTIALITY_ONLY 0x40000000
    400 #define ISC_RET_MESSAGES 0x0000000100000000
    401 #define ISC_RET_DEFERRED_CRED_VALIDATION 0x0000000200000000
    402 #define ISC_RET_NO_POST_HANDSHAKE_AUTH 0x0000000400000000
    403 
    404 #define ASC_REQ_DELEGATE 0x00000001
    405 #define ASC_REQ_MUTUAL_AUTH 0x00000002
    406 #define ASC_REQ_REPLAY_DETECT 0x00000004
    407 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
    408 #define ASC_REQ_CONFIDENTIALITY 0x00000010
    409 #define ASC_REQ_USE_SESSION_KEY 0x00000020
    410 #define ASC_REQ_SESSION_TICKET 0x00000040
    411 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
    412 #define ASC_REQ_USE_DCE_STYLE 0x00000200
    413 #define ASC_REQ_DATAGRAM 0x00000400
    414 #define ASC_REQ_CONNECTION 0x00000800
    415 #define ASC_REQ_CALL_LEVEL 0x00001000
    416 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
    417 #define ASC_REQ_EXTENDED_ERROR 0x00008000
    418 #define ASC_REQ_STREAM 0x00010000
    419 #define ASC_REQ_INTEGRITY 0x00020000
    420 #define ASC_REQ_LICENSING 0x00040000
    421 #define ASC_REQ_IDENTIFY 0x00080000
    422 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
    423 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
    424 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
    425 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
    426 #define ASC_REQ_NO_TOKEN 0x01000000
    427 #define ASC_REQ_PROXY_BINDINGS 0x04000000
    428 #define ASC_REQ_ALLOW_MISSING_BINDINGS 0x10000000
    429 #define ASC_REQ_MESSAGES 0x0000000100000000
    430 
    431 #define ASC_RET_DELEGATE 0x00000001
    432 #define ASC_RET_MUTUAL_AUTH 0x00000002
    433 #define ASC_RET_REPLAY_DETECT 0x00000004
    434 #define ASC_RET_SEQUENCE_DETECT 0x00000008
    435 #define ASC_RET_CONFIDENTIALITY 0x00000010
    436 #define ASC_RET_USE_SESSION_KEY 0x00000020
    437 #define ASC_RET_SESSION_TICKET 0x00000040
    438 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
    439 #define ASC_RET_USED_DCE_STYLE 0x00000200
    440 #define ASC_RET_DATAGRAM 0x00000400
    441 #define ASC_RET_CONNECTION 0x00000800
    442 #define ASC_RET_CALL_LEVEL 0x00002000
    443 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
    444 #define ASC_RET_EXTENDED_ERROR 0x00008000
    445 #define ASC_RET_STREAM 0x00010000
    446 #define ASC_RET_INTEGRITY 0x00020000
    447 #define ASC_RET_LICENSING 0x00040000
    448 #define ASC_RET_IDENTIFY 0x00080000
    449 #define ASC_RET_NULL_SESSION 0x00100000
    450 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
    451 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000
    452 #define ASC_RET_FRAGMENT_ONLY 0x00800000
    453 #define ASC_RET_NO_TOKEN 0x01000000
    454 #define ASC_RET_NO_ADDITIONAL_TOKEN 0x02000000
    455 #define ASC_RET_MESSAGES 0x0000000100000000
    456 
    457 #define SECPKG_CRED_ATTR_NAMES 1
    458 #define SECPKG_CRED_ATTR_SSI_PROVIDER 2
    459 #define SECPKG_CRED_ATTR_KDC_PROXY_SETTINGS 3
    460 #define SECPKG_CRED_ATTR_CERT 4
    461 #define SECPKG_CRED_ATTR_PAC_BYPASS 5
    462 
    463   typedef struct _SecPkgCredentials_NamesW
    464   {
    465     SEC_WCHAR *sUserName;
    466   } SecPkgCredentials_NamesW,*PSecPkgCredentials_NamesW;
    467 
    468   typedef struct _SecPkgCredentials_NamesA
    469   {
    470     SEC_CHAR *sUserName;
    471   } SecPkgCredentials_NamesA,*PSecPkgCredentials_NamesA;
    472 
    473 #define SecPkgCredentials_Names __MINGW_NAME_AW(SecPkgCredentials_Names)
    474 #define PSecPkgCredentials_Names __MINGW_NAME_AW(PSecPkgCredentials_Names)
    475 
    476   typedef struct _SecPkgCredentials_SSIProviderW {
    477     SEC_WCHAR *sProviderName;
    478     unsigned __LONG32 ProviderInfoLength;
    479     char *ProviderInfo;
    480   } SecPkgCredentials_SSIProviderW,*PSecPkgCredentials_SSIProviderW;
    481 
    482   typedef struct _SecPkgCredentials_SSIProviderA {
    483     SEC_CHAR *sProviderName;
    484     unsigned __LONG32 ProviderInfoLength;
    485     char *ProviderInfo;
    486   } SecPkgCredentials_SSIProviderA,*PSecPkgCredentials_SSIProviderA;
    487 
    488 #define SecPkgCredentials_SSIProvider __MINGW_NAME_AW(SecPkgCredentials_SSIProvider)
    489 #define PSecPkgCredentials_SSIProvider __MINGW_NAME_AW(PSecPkgCredentials_SSIProvider)
    490 
    491 #define KDC_PROXY_SETTINGS_V1 1
    492 #define KDC_PROXY_SETTINGS_FLAGS_FORCEPROXY 0x1
    493 
    494   typedef struct _SecPkgCredentials_KdcProxySettingsW {
    495     ULONG Version;
    496     ULONG Flags;
    497     USHORT ProxyServerOffset;
    498     USHORT ProxyServerLength;
    499     USHORT ClientTlsCredOffset;
    500     USHORT ClientTlsCredLength;
    501   } SecPkgCredentials_KdcProxySettingsW,*PSecPkgCredentials_KdcProxySettingsW;
    502 
    503   typedef struct _SecPkgCredentials_Cert {
    504     unsigned __LONG32 EncodedCertSize;
    505     unsigned char *EncodedCert;
    506   } SecPkgCredentials_Cert,*PSecPkgCredentials_Cert;
    507 
    508 #define SECPKG_ATTR_SIZES 0
    509 #define SECPKG_ATTR_NAMES 1
    510 #define SECPKG_ATTR_LIFESPAN 2
    511 #define SECPKG_ATTR_DCE_INFO 3
    512 #define SECPKG_ATTR_STREAM_SIZES 4
    513 #define SECPKG_ATTR_KEY_INFO 5
    514 #define SECPKG_ATTR_AUTHORITY 6
    515 #define SECPKG_ATTR_PROTO_INFO 7
    516 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
    517 #define SECPKG_ATTR_SESSION_KEY 9
    518 #define SECPKG_ATTR_PACKAGE_INFO 10
    519 #define SECPKG_ATTR_USER_FLAGS 11
    520 #define SECPKG_ATTR_NEGOTIATION_INFO 12
    521 #define SECPKG_ATTR_NATIVE_NAMES 13
    522 #define SECPKG_ATTR_FLAGS 14
    523 #define SECPKG_ATTR_USE_VALIDATED 15
    524 #define SECPKG_ATTR_CREDENTIAL_NAME 16
    525 #define SECPKG_ATTR_TARGET_INFORMATION 17
    526 #define SECPKG_ATTR_ACCESS_TOKEN 18
    527 #define SECPKG_ATTR_TARGET 19
    528 #define SECPKG_ATTR_AUTHENTICATION_ID 20
    529 #define SECPKG_ATTR_LOGOFF_TIME 21
    530 #define SECPKG_ATTR_NEGO_KEYS 22
    531 #define SECPKG_ATTR_PROMPTING_NEEDED 24
    532 #define SECPKG_ATTR_UNIQUE_BINDINGS 25
    533 #define SECPKG_ATTR_ENDPOINT_BINDINGS 26
    534 #define SECPKG_ATTR_CLIENT_SPECIFIED_TARGET 27
    535 #define SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS 30
    536 #define SECPKG_ATTR_NEGO_PKG_INFO 31
    537 #define SECPKG_ATTR_NEGO_STATUS 32
    538 #define SECPKG_ATTR_CONTEXT_DELETED 33
    539 #define SECPKG_ATTR_DTLS_MTU 34
    540 #define SECPKG_ATTR_DATAGRAM_SIZES SECPKG_ATTR_STREAM_SIZES
    541 #define SECPKG_ATTR_SUBJECT_SECURITY_ATTRIBUTES 128
    542 #define SECPKG_ATTR_APPLICATION_PROTOCOL 35
    543 #define SECPKG_ATTR_NEGOTIATED_TLS_EXTENSIONS 36
    544 #define SECPKG_ATTR_IS_LOOPBACK 37
    545 
    546   typedef struct _SecPkgContext_SubjectAttributes {
    547     void *AttributeInfo;
    548   } SecPkgContext_SubjectAttributes,*PSecPkgContext_SubjectAttributes;
    549 
    550 #define SECPKG_ATTR_NEGO_INFO_FLAG_NO_KERBEROS 0x1
    551 #define SECPKG_ATTR_NEGO_INFO_FLAG_NO_NTLM 0x2
    552 
    553   typedef enum _SECPKG_CRED_CLASS {
    554     SecPkgCredClass_None = 0,
    555     SecPkgCredClass_Ephemeral = 10,
    556     SecPkgCredClass_PersistedGeneric = 20,
    557     SecPkgCredClass_PersistedSpecific = 30,
    558     SecPkgCredClass_Explicit = 40
    559   } SECPKG_CRED_CLASS,*PSECPKG_CRED_CLASS;
    560 
    561   typedef struct _SecPkgContext_CredInfo {
    562     SECPKG_CRED_CLASS CredClass;
    563     unsigned __LONG32 IsPromptingNeeded;
    564   } SecPkgContext_CredInfo,*PSecPkgContext_CredInfo;
    565 
    566   typedef struct _SecPkgContext_NegoPackageInfo {
    567     unsigned __LONG32 PackageMask;
    568   } SecPkgContext_NegoPackageInfo,*PSecPkgContext_NegoPackageInfo;
    569 
    570   typedef struct _SecPkgContext_NegoStatus {
    571     unsigned __LONG32 LastStatus;
    572   } SecPkgContext_NegoStatus,*PSecPkgContext_NegoStatus;
    573 
    574   typedef struct _SecPkgContext_Sizes {
    575     unsigned __LONG32 cbMaxToken;
    576     unsigned __LONG32 cbMaxSignature;
    577     unsigned __LONG32 cbBlockSize;
    578     unsigned __LONG32 cbSecurityTrailer;
    579   } SecPkgContext_Sizes,*PSecPkgContext_Sizes;
    580 
    581   typedef struct _SecPkgContext_StreamSizes {
    582     unsigned __LONG32 cbHeader;
    583     unsigned __LONG32 cbTrailer;
    584     unsigned __LONG32 cbMaximumMessage;
    585     unsigned __LONG32 cBuffers;
    586     unsigned __LONG32 cbBlockSize;
    587   } SecPkgContext_StreamSizes,*PSecPkgContext_StreamSizes;
    588 
    589 typedef SecPkgContext_StreamSizes SecPkgContext_DatagramSizes;
    590 typedef PSecPkgContext_StreamSizes PSecPkgContext_DatagramSizes;
    591 
    592   typedef struct _SecPkgContext_NamesW {
    593     SEC_WCHAR *sUserName;
    594   } SecPkgContext_NamesW,*PSecPkgContext_NamesW;
    595 
    596   typedef enum _SECPKG_ATTR_LCT_STATUS {
    597     SecPkgAttrLastClientTokenYes,
    598     SecPkgAttrLastClientTokenNo,
    599     SecPkgAttrLastClientTokenMaybe
    600   } SECPKG_ATTR_LCT_STATUS,*PSECPKG_ATTR_LCT_STATUS;
    601 
    602   typedef struct _SecPkgContext_LastClientTokenStatus {
    603     SECPKG_ATTR_LCT_STATUS LastClientTokenStatus;
    604   } SecPkgContext_LastClientTokenStatus,*PSecPkgContext_LastClientTokenStatus;
    605 
    606   typedef struct _SecPkgContext_NamesA {
    607     SEC_CHAR *sUserName;
    608   } SecPkgContext_NamesA,*PSecPkgContext_NamesA;
    609 
    610 #define SecPkgContext_Names __MINGW_NAME_AW(SecPkgContext_Names)
    611 #define PSecPkgContext_Names __MINGW_NAME_AW(PSecPkgContext_Names)
    612 
    613   typedef struct _SecPkgContext_Lifespan {
    614     TimeStamp tsStart;
    615     TimeStamp tsExpiry;
    616   } SecPkgContext_Lifespan,*PSecPkgContext_Lifespan;
    617 
    618   typedef struct _SecPkgContext_DceInfo {
    619     unsigned __LONG32 AuthzSvc;
    620     void *pPac;
    621   } SecPkgContext_DceInfo,*PSecPkgContext_DceInfo;
    622 
    623   typedef struct _SecPkgContext_KeyInfoA {
    624     SEC_CHAR *sSignatureAlgorithmName;
    625     SEC_CHAR *sEncryptAlgorithmName;
    626     unsigned __LONG32 KeySize;
    627     unsigned __LONG32 SignatureAlgorithm;
    628     unsigned __LONG32 EncryptAlgorithm;
    629   } SecPkgContext_KeyInfoA,*PSecPkgContext_KeyInfoA;
    630 
    631   typedef struct _SecPkgContext_KeyInfoW {
    632     SEC_WCHAR *sSignatureAlgorithmName;
    633     SEC_WCHAR *sEncryptAlgorithmName;
    634     unsigned __LONG32 KeySize;
    635     unsigned __LONG32 SignatureAlgorithm;
    636     unsigned __LONG32 EncryptAlgorithm;
    637   } SecPkgContext_KeyInfoW,*PSecPkgContext_KeyInfoW;
    638 
    639 #define SecPkgContext_KeyInfo __MINGW_NAME_AW(SecPkgContext_KeyInfo)
    640 #define PSecPkgContext_KeyInfo __MINGW_NAME_AW(PSecPkgContext_KeyInfo)
    641 
    642   typedef struct _SecPkgContext_AuthorityA {
    643     SEC_CHAR *sAuthorityName;
    644   } SecPkgContext_AuthorityA,*PSecPkgContext_AuthorityA;
    645 
    646   typedef struct _SecPkgContext_AuthorityW {
    647     SEC_WCHAR *sAuthorityName;
    648   } SecPkgContext_AuthorityW,*PSecPkgContext_AuthorityW;
    649 
    650 #define SecPkgContext_Authority __MINGW_NAME_AW(SecPkgContext_Authority)
    651 #define PSecPkgContext_Authority __MINGW_NAME_AW(PSecPkgContext_Authority)
    652 
    653   typedef struct _SecPkgContext_ProtoInfoA {
    654     SEC_CHAR *sProtocolName;
    655     unsigned __LONG32 majorVersion;
    656     unsigned __LONG32 minorVersion;
    657   } SecPkgContext_ProtoInfoA,*PSecPkgContext_ProtoInfoA;
    658 
    659   typedef struct _SecPkgContext_ProtoInfoW {
    660     SEC_WCHAR *sProtocolName;
    661     unsigned __LONG32 majorVersion;
    662     unsigned __LONG32 minorVersion;
    663   } SecPkgContext_ProtoInfoW,*PSecPkgContext_ProtoInfoW;
    664 
    665 #define SecPkgContext_ProtoInfo __MINGW_NAME_AW(SecPkgContext_ProtoInfo)
    666 #define PSecPkgContext_ProtoInfo __MINGW_NAME_AW(PSecPkgContext_ProtoInfo)
    667 
    668   typedef struct _SecPkgContext_PasswordExpiry {
    669     TimeStamp tsPasswordExpires;
    670   } SecPkgContext_PasswordExpiry,*PSecPkgContext_PasswordExpiry;
    671 
    672   typedef struct _SecPkgContext_LogoffTime {
    673     TimeStamp tsLogoffTime;
    674   } SecPkgContext_LogoffTime,*PSecPkgContext_LogoffTime;
    675 
    676   typedef struct _SecPkgContext_SessionKey {
    677     unsigned __LONG32 SessionKeyLength;
    678     unsigned char *SessionKey;
    679   } SecPkgContext_SessionKey,*PSecPkgContext_SessionKey;
    680 
    681   typedef struct _SecPkgContext_NegoKeys {
    682     unsigned __LONG32 KeyType;
    683     unsigned short KeyLength;
    684     unsigned char *KeyValue;
    685     unsigned __LONG32 VerifyKeyType;
    686     unsigned short VerifyKeyLength;
    687     unsigned char *VerifyKeyValue;
    688   } SecPkgContext_NegoKeys,*PSecPkgContext_NegoKeys;
    689 
    690   typedef struct _SecPkgContext_PackageInfoW {
    691     PSecPkgInfoW PackageInfo;
    692   } SecPkgContext_PackageInfoW,*PSecPkgContext_PackageInfoW;
    693 
    694   typedef struct _SecPkgContext_PackageInfoA {
    695     PSecPkgInfoA PackageInfo;
    696   } SecPkgContext_PackageInfoA,*PSecPkgContext_PackageInfoA;
    697 
    698   typedef struct _SecPkgContext_UserFlags {
    699     unsigned __LONG32 UserFlags;
    700   } SecPkgContext_UserFlags,*PSecPkgContext_UserFlags;
    701 
    702   typedef struct _SecPkgContext_Flags {
    703     unsigned __LONG32 Flags;
    704   } SecPkgContext_Flags,*PSecPkgContext_Flags;
    705 
    706 #define SecPkgContext_PackageInfo __MINGW_NAME_AW(SecPkgContext_PackageInfo)
    707 #define PSecPkgContext_PackageInfo __MINGW_NAME_AW(PSecPkgContext_PackageInfo)
    708 
    709   typedef struct _SecPkgContext_NegotiationInfoA {
    710     PSecPkgInfoA PackageInfo;
    711     unsigned __LONG32 NegotiationState;
    712   } SecPkgContext_NegotiationInfoA,*PSecPkgContext_NegotiationInfoA;
    713 
    714   typedef struct _SecPkgContext_NegotiationInfoW {
    715     PSecPkgInfoW PackageInfo;
    716     unsigned __LONG32 NegotiationState;
    717   } SecPkgContext_NegotiationInfoW,*PSecPkgContext_NegotiationInfoW;
    718 
    719 #define SecPkgContext_NegotiationInfo __MINGW_NAME_AW(SecPkgContext_NegotiationInfo)
    720 #define PSecPkgContext_NegotiationInfo __MINGW_NAME_AW(PSecPkgContext_NegotiationInfo)
    721 
    722 #define SECPKG_NEGOTIATION_COMPLETE 0
    723 #define SECPKG_NEGOTIATION_OPTIMISTIC 1
    724 #define SECPKG_NEGOTIATION_IN_PROGRESS 2
    725 #define SECPKG_NEGOTIATION_DIRECT 3
    726 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
    727 
    728   typedef struct _SecPkgContext_NativeNamesW {
    729     SEC_WCHAR *sClientName;
    730     SEC_WCHAR *sServerName;
    731   } SecPkgContext_NativeNamesW,*PSecPkgContext_NativeNamesW;
    732 
    733   typedef struct _SecPkgContext_NativeNamesA {
    734     SEC_CHAR *sClientName;
    735     SEC_CHAR *sServerName;
    736   } SecPkgContext_NativeNamesA,*PSecPkgContext_NativeNamesA;
    737 
    738 #define SecPkgContext_NativeNames __MINGW_NAME_AW(SecPkgContext_NativeNames)
    739 #define PSecPkgContext_NativeNames __MINGW_NAME_AW(PSecPkgContext_NativeNames)
    740 
    741   typedef struct _SecPkgContext_CredentialNameW {
    742     unsigned __LONG32 CredentialType;
    743     SEC_WCHAR *sCredentialName;
    744   } SecPkgContext_CredentialNameW,*PSecPkgContext_CredentialNameW;
    745 
    746   typedef struct _SecPkgContext_CredentialNameA {
    747     unsigned __LONG32 CredentialType;
    748     SEC_CHAR *sCredentialName;
    749   } SecPkgContext_CredentialNameA,*PSecPkgContext_CredentialNameA;
    750 
    751 #define SecPkgContext_CredentialName __MINGW_NAME_AW(SecPkgContext_CredentialName)
    752 #define PSecPkgContext_CredentialName __MINGW_NAME_AW(PSecPkgContext_CredentialName)
    753 
    754   typedef struct _SecPkgContext_AccessToken {
    755     void *AccessToken;
    756   } SecPkgContext_AccessToken,*PSecPkgContext_AccessToken;
    757 
    758   typedef struct _SecPkgContext_TargetInformation {
    759     unsigned __LONG32 MarshalledTargetInfoLength;
    760     unsigned char *MarshalledTargetInfo;
    761   } SecPkgContext_TargetInformation,*PSecPkgContext_TargetInformation;
    762 
    763   typedef struct _SecPkgContext_AuthzID {
    764     unsigned __LONG32 AuthzIDLength;
    765     char *AuthzID;
    766   } SecPkgContext_AuthzID,*PSecPkgContext_AuthzID;
    767 
    768   typedef struct _SecPkgContext_Target {
    769     unsigned __LONG32 TargetLength;
    770     char *Target;
    771   } SecPkgContext_Target,*PSecPkgContext_Target;
    772 
    773   typedef struct _SecPkgContext_ClientSpecifiedTarget {
    774     SEC_WCHAR *sTargetName;
    775   } SecPkgContext_ClientSpecifiedTarget,*PSecPkgContext_ClientSpecifiedTarget;
    776 
    777   typedef struct _SecPkgContext_Bindings {
    778     unsigned __LONG32 BindingsLength;
    779     SEC_CHANNEL_BINDINGS *Bindings;
    780   } SecPkgContext_Bindings,*PSecPkgContext_Bindings;
    781 
    782   typedef enum _SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS {
    783     SecApplicationProtocolNegotiationStatus_None,
    784     SecApplicationProtocolNegotiationStatus_Success,
    785     SecApplicationProtocolNegotiationStatus_SelectedClientOnly
    786   } SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS,*PSEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS;
    787 
    788 #define MAX_PROTOCOL_ID_SIZE 0xff
    789 
    790   typedef struct _SecPkgContext_ApplicationProtocol {
    791     SEC_APPLICATION_PROTOCOL_NEGOTIATION_STATUS ProtoNegoStatus;
    792     SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT ProtoNegoExt;
    793     unsigned char ProtocolIdSize;
    794     unsigned char ProtocolId[MAX_PROTOCOL_ID_SIZE];
    795   } SecPkgContext_ApplicationProtocol,*PSecPkgContext_ApplicationProtocol;
    796 
    797   typedef struct _SecPkgContext_NegotiatedTlsExtensions {
    798     unsigned __LONG32 ExtensionsCount;
    799     unsigned short *Extensions;
    800   } SecPkgContext_NegotiatedTlsExtensions,*PSecPkgContext_NegotiatedTlsExtensions;
    801 
    802   typedef struct _SECPKG_APP_MODE_INFO {
    803     ULONG UserFunction;
    804     ULONG_PTR Argument1;
    805     ULONG_PTR Argument2;
    806     SecBuffer UserData;
    807     BOOLEAN ReturnToLsa;
    808   } SECPKG_APP_MODE_INFO,*PSECPKG_APP_MODE_INFO;
    809 
    810   typedef void (WINAPI *SEC_GET_KEY_FN) (void *Arg,void *Principal,unsigned __LONG32 KeyVer,void **Key,SECURITY_STATUS *Status);
    811 
    812 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001
    813 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
    814 #define SECPKG_CONTEXT_EXPORT_TO_KERNEL 0x00000004
    815 
    816   KSECDDDECLSPEC SECURITY_STATUS WINAPI AcquireCredentialsHandleW(
    817 #if ISSP_MODE==0
    818     PSECURITY_STRING pPrincipal,PSECURITY_STRING pPackage,
    819 #else
    820     SEC_WCHAR *pszPrincipal,SEC_WCHAR *pszPackage,
    821 #endif
    822     unsigned __LONG32 fCredentialUse,void *pvLogonId,void *pAuthData,SEC_GET_KEY_FN pGetKeyFn,void *pvGetKeyArgument,PCredHandle phCredential,PTimeStamp ptsExpiry);
    823 
    824   typedef SECURITY_STATUS (WINAPI *ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
    825 #if ISSP_MODE==0
    826     PSECURITY_STRING,PSECURITY_STRING,
    827 #else
    828     SEC_WCHAR *,SEC_WCHAR *,
    829 #endif
    830     unsigned __LONG32,void *,void *,SEC_GET_KEY_FN,void *,PCredHandle,PTimeStamp);
    831 
    832   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);
    833 
    834   typedef SECURITY_STATUS (WINAPI *ACQUIRE_CREDENTIALS_HANDLE_FN_A)(SEC_CHAR *,SEC_CHAR *,unsigned __LONG32,void *,void *,SEC_GET_KEY_FN,void *,PCredHandle,PTimeStamp);
    835 
    836 #define AcquireCredentialsHandle __MINGW_NAME_AW(AcquireCredentialsHandle)
    837 #define ACQUIRE_CREDENTIALS_HANDLE_FN __MINGW_NAME_UAW(ACQUIRE_CREDENTIALS_HANDLE_FN)
    838 
    839   KSECDDDECLSPEC SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential);
    840 
    841   typedef SECURITY_STATUS (WINAPI *FREE_CREDENTIALS_HANDLE_FN)(PCredHandle);
    842 
    843   KSECDDDECLSPEC SECURITY_STATUS WINAPI AddCredentialsW(PCredHandle hCredentials,
    844 #if ISSP_MODE==0
    845     PSECURITY_STRING pPrincipal,PSECURITY_STRING pPackage,
    846 #else
    847     SEC_WCHAR *pszPrincipal,SEC_WCHAR *pszPackage,
    848 #endif
    849     unsigned __LONG32 fCredentialUse,void *pAuthData,SEC_GET_KEY_FN pGetKeyFn,void *pvGetKeyArgument,PTimeStamp ptsExpiry);
    850 
    851   typedef SECURITY_STATUS (WINAPI *ADD_CREDENTIALS_FN_W)(PCredHandle,
    852 #if ISSP_MODE==0
    853     PSECURITY_STRING,PSECURITY_STRING,
    854 #else
    855     SEC_WCHAR *,SEC_WCHAR *,
    856 #endif
    857     unsigned __LONG32,void *,SEC_GET_KEY_FN,void *,PTimeStamp);
    858 
    859   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);
    860 
    861   typedef SECURITY_STATUS (WINAPI *ADD_CREDENTIALS_FN_A)(PCredHandle,SEC_CHAR *,SEC_CHAR *,unsigned __LONG32,void *,SEC_GET_KEY_FN,void *,PTimeStamp);
    862 
    863 #define AddCredentials __MINGW_NAME_AW(AddCredentials)
    864 #define ADD_CREDENTIALS_FN __MINGW_NAME_UAW(ADD_CREDENTIALS_FN)
    865 
    866   KSECDDDECLSPEC SECURITY_STATUS WINAPI InitializeSecurityContextW(PCredHandle phCredential,PCtxtHandle phContext,
    867 #if ISSP_MODE==0
    868     PSECURITY_STRING pTargetName,
    869 #else
    870     SEC_WCHAR *pszTargetName,
    871 #endif
    872     unsigned __LONG32 fContextReq,unsigned __LONG32 Reserved1,unsigned __LONG32 TargetDataRep,PSecBufferDesc pInput,unsigned __LONG32 Reserved2,PCtxtHandle phNewContext,PSecBufferDesc pOutput,unsigned __LONG32 *pfContextAttr,PTimeStamp ptsExpiry);
    873 
    874   typedef SECURITY_STATUS (WINAPI *INITIALIZE_SECURITY_CONTEXT_FN_W)(PCredHandle,PCtxtHandle,
    875 #if ISSP_MODE==0
    876     PSECURITY_STRING,
    877 #else
    878     SEC_WCHAR *,
    879 #endif
    880     unsigned __LONG32,unsigned __LONG32,unsigned __LONG32,PSecBufferDesc,unsigned __LONG32,PCtxtHandle,PSecBufferDesc,unsigned __LONG32 *,PTimeStamp);
    881 
    882   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);
    883 
    884   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);
    885 
    886 #define InitializeSecurityContext __MINGW_NAME_AW(InitializeSecurityContext)
    887 #define INITIALIZE_SECURITY_CONTEXT_FN __MINGW_NAME_UAW(INITIALIZE_SECURITY_CONTEXT_FN)
    888 
    889   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);
    890 
    891   typedef SECURITY_STATUS (WINAPI *ACCEPT_SECURITY_CONTEXT_FN)(PCredHandle,PCtxtHandle,PSecBufferDesc,unsigned __LONG32,unsigned __LONG32,PCtxtHandle,PSecBufferDesc,unsigned __LONG32 *,PTimeStamp);
    892 
    893   SECURITY_STATUS WINAPI CompleteAuthToken(PCtxtHandle phContext,PSecBufferDesc pToken);
    894 
    895   typedef SECURITY_STATUS (WINAPI *COMPLETE_AUTH_TOKEN_FN)(PCtxtHandle,PSecBufferDesc);
    896 
    897   KSECDDDECLSPEC SECURITY_STATUS WINAPI ImpersonateSecurityContext(PCtxtHandle phContext);
    898 
    899   typedef SECURITY_STATUS (WINAPI *IMPERSONATE_SECURITY_CONTEXT_FN)(PCtxtHandle);
    900 
    901   KSECDDDECLSPEC SECURITY_STATUS WINAPI RevertSecurityContext(PCtxtHandle phContext);
    902 
    903   typedef SECURITY_STATUS (WINAPI *REVERT_SECURITY_CONTEXT_FN)(PCtxtHandle);
    904 
    905   KSECDDDECLSPEC SECURITY_STATUS WINAPI QuerySecurityContextToken(PCtxtHandle phContext,HANDLE *Token);
    906 
    907   typedef SECURITY_STATUS (WINAPI *QUERY_SECURITY_CONTEXT_TOKEN_FN)(PCtxtHandle,HANDLE *);
    908 
    909   KSECDDDECLSPEC SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext);
    910 
    911   typedef SECURITY_STATUS (WINAPI *DELETE_SECURITY_CONTEXT_FN)(PCtxtHandle);
    912 
    913   KSECDDDECLSPEC SECURITY_STATUS WINAPI ApplyControlToken(PCtxtHandle phContext,PSecBufferDesc pInput);
    914 
    915   typedef SECURITY_STATUS (WINAPI *APPLY_CONTROL_TOKEN_FN)(PCtxtHandle,PSecBufferDesc);
    916 
    917   KSECDDDECLSPEC SECURITY_STATUS WINAPI QueryContextAttributesW(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer);
    918 
    919   typedef SECURITY_STATUS (WINAPI *QUERY_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,unsigned __LONG32,void *);
    920 
    921   SECURITY_STATUS WINAPI QueryContextAttributesA(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer);
    922 
    923   typedef SECURITY_STATUS (WINAPI *QUERY_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,unsigned __LONG32,void *);
    924 
    925 #define QueryContextAttributes __MINGW_NAME_AW(QueryContextAttributes)
    926 #define QUERY_CONTEXT_ATTRIBUTES_FN __MINGW_NAME_UAW(QUERY_CONTEXT_ATTRIBUTES_FN)
    927 
    928   SECURITY_STATUS WINAPI QueryContextAttributesExW(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    929 
    930   typedef SECURITY_STATUS (WINAPI *QUERY_CONTEXT_ATTRIBUTES_EX_FN_W)(PCtxtHandle,unsigned __LONG32,void*,unsigned __LONG32);
    931 
    932   SECURITY_STATUS WINAPI QueryContextAttributesExA(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    933 
    934   typedef SECURITY_STATUS (WINAPI *QUERY_CONTEXT_ATTRIBUTES_EX_FN_A)(PCtxtHandle,unsigned __LONG32,void*,unsigned __LONG32);
    935 
    936 #define QueryContextAttributesEx __MINGW_NAME_AW(QueryContextAttributesEx)
    937 #define QUERY_CONTEXT_ATTRIBUTES_EX_FN __MINGW_NAME_UAW(QUERY_CONTEXT_ATTRIBUTES_EX_FN)
    938 
    939   SECURITY_STATUS WINAPI SetContextAttributesW(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    940 
    941   typedef SECURITY_STATUS (WINAPI *SET_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,unsigned __LONG32,void *,unsigned __LONG32);
    942 
    943   SECURITY_STATUS WINAPI SetContextAttributesA(PCtxtHandle phContext,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    944 
    945   typedef SECURITY_STATUS (WINAPI *SET_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,unsigned __LONG32,void *,unsigned __LONG32);
    946 
    947 #define SetContextAttributes __MINGW_NAME_AW(SetContextAttributes)
    948 #define SET_CONTEXT_ATTRIBUTES_FN __MINGW_NAME_UAW(SET_CONTEXT_ATTRIBUTES_FN)
    949 
    950   KSECDDDECLSPEC SECURITY_STATUS WINAPI QueryCredentialsAttributesW(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer);
    951 
    952   typedef SECURITY_STATUS (WINAPI *QUERY_CREDENTIALS_ATTRIBUTES_FN_W)(PCredHandle,unsigned __LONG32,void *);
    953 
    954   SECURITY_STATUS WINAPI QueryCredentialsAttributesA(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer);
    955 
    956   typedef SECURITY_STATUS (WINAPI *QUERY_CREDENTIALS_ATTRIBUTES_FN_A)(PCredHandle,unsigned __LONG32,void *);
    957 
    958 #define QueryCredentialsAttributes __MINGW_NAME_AW(QueryCredentialsAttributes)
    959 #define QUERY_CREDENTIALS_ATTRIBUTES_FN __MINGW_NAME_UAW(QUERY_CREDENTIALS_ATTRIBUTES_FN)
    960 
    961   SECURITY_STATUS WINAPI QueryCredentialsAttributesExW(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    962 
    963   typedef SECURITY_STATUS (WINAPI *QUERY_CREDENTIALS_ATTRIBUTES_EX_FN_W)(PCredHandle,unsigned __LONG32,void*,unsigned __LONG32);
    964 
    965   SECURITY_STATUS WINAPI QueryCredentialsAttributesExA(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    966 
    967   typedef SECURITY_STATUS (WINAPI *QUERY_CREDENTIALS_ATTRIBUTES_EX_FN_A)(PCredHandle,unsigned __LONG32,void*,unsigned __LONG32);
    968 
    969 #define QueryCredentialsAttributesEx __MINGW_NAME_AW(QueryCredentialsAttributesEx)
    970 #define QUERY_CREDENTIALS_ATTRIBUTES_EX_FN __MINGW_NAME_UAW(QUERY_CREDENTIALS_ATTRIBUTES_EX_FN)
    971 
    972   KSECDDDECLSPEC SECURITY_STATUS WINAPI SetCredentialsAttributesW(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    973 
    974   typedef SECURITY_STATUS (WINAPI *SET_CREDENTIALS_ATTRIBUTES_FN_W)(PCredHandle,unsigned __LONG32,void *,unsigned __LONG32);
    975 
    976   SECURITY_STATUS WINAPI SetCredentialsAttributesA(PCredHandle phCredential,unsigned __LONG32 ulAttribute,void *pBuffer,unsigned __LONG32 cbBuffer);
    977 
    978   typedef SECURITY_STATUS (WINAPI *SET_CREDENTIALS_ATTRIBUTES_FN_A)(PCredHandle,unsigned __LONG32,void *,unsigned __LONG32);
    979 
    980 #define SetCredentialsAttributes __MINGW_NAME_AW(SetCredentialsAttributes)
    981 #define SET_CREDENTIALS_ATTRIBUTES_FN __MINGW_NAME_UAW(SET_CREDENTIALS_ATTRIBUTES_FN)
    982 
    983   SECURITY_STATUS WINAPI FreeContextBuffer(void *pvContextBuffer);
    984 
    985   typedef SECURITY_STATUS (WINAPI *FREE_CONTEXT_BUFFER_FN)(void *);
    986 
    987   KSECDDDECLSPEC SECURITY_STATUS WINAPI MakeSignature(PCtxtHandle phContext,unsigned __LONG32 fQOP,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo);
    988 
    989   typedef SECURITY_STATUS (WINAPI *MAKE_SIGNATURE_FN)(PCtxtHandle,unsigned __LONG32,PSecBufferDesc,unsigned __LONG32);
    990 
    991   KSECDDDECLSPEC SECURITY_STATUS WINAPI VerifySignature(PCtxtHandle phContext,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo,unsigned __LONG32 *pfQOP);
    992 
    993   typedef SECURITY_STATUS (WINAPI *VERIFY_SIGNATURE_FN)(PCtxtHandle,PSecBufferDesc,unsigned __LONG32,unsigned __LONG32 *);
    994 
    995 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
    996 #define SECQOP_WRAP_OOB_DATA 0x40000000
    997 
    998   SECURITY_STATUS WINAPI EncryptMessage(PCtxtHandle phContext,unsigned __LONG32 fQOP,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo);
    999 
   1000   typedef SECURITY_STATUS (WINAPI *ENCRYPT_MESSAGE_FN)(PCtxtHandle,unsigned __LONG32,PSecBufferDesc,unsigned __LONG32);
   1001 
   1002   SECURITY_STATUS WINAPI DecryptMessage(PCtxtHandle phContext,PSecBufferDesc pMessage,unsigned __LONG32 MessageSeqNo,unsigned __LONG32 *pfQOP);
   1003 
   1004   typedef SECURITY_STATUS (WINAPI *DECRYPT_MESSAGE_FN)(PCtxtHandle,PSecBufferDesc,unsigned __LONG32,unsigned __LONG32 *);
   1005 
   1006   KSECDDDECLSPEC SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(unsigned __LONG32 *pcPackages,PSecPkgInfoW *ppPackageInfo);
   1007 
   1008   typedef SECURITY_STATUS (WINAPI *ENUMERATE_SECURITY_PACKAGES_FN_W)(unsigned __LONG32 *,PSecPkgInfoW *);
   1009 
   1010   SECURITY_STATUS WINAPI EnumerateSecurityPackagesA(unsigned __LONG32 *pcPackages,PSecPkgInfoA *ppPackageInfo);
   1011 
   1012   typedef SECURITY_STATUS (WINAPI *ENUMERATE_SECURITY_PACKAGES_FN_A)(unsigned __LONG32 *,PSecPkgInfoA *);
   1013 
   1014 #define EnumerateSecurityPackages __MINGW_NAME_AW(EnumerateSecurityPackages)
   1015 #define ENUMERATE_SECURITY_PACKAGES_FN __MINGW_NAME_UAW(ENUMERATE_SECURITY_PACKAGES_FN)
   1016 
   1017   KSECDDDECLSPEC SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(
   1018 #if ISSP_MODE==0
   1019     PSECURITY_STRING pPackageName,
   1020 #else
   1021     SEC_WCHAR *pszPackageName,
   1022 #endif
   1023     PSecPkgInfoW *ppPackageInfo);
   1024 
   1025   typedef SECURITY_STATUS (WINAPI *QUERY_SECURITY_PACKAGE_INFO_FN_W)(
   1026 #if ISSP_MODE==0
   1027     PSECURITY_STRING,
   1028 #else
   1029     SEC_WCHAR *,
   1030 #endif
   1031     PSecPkgInfoW *);
   1032 
   1033   SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName,PSecPkgInfoA *ppPackageInfo);
   1034 
   1035   typedef SECURITY_STATUS (WINAPI *QUERY_SECURITY_PACKAGE_INFO_FN_A)(SEC_CHAR *,PSecPkgInfoA *);
   1036 
   1037 #define QuerySecurityPackageInfo __MINGW_NAME_AW(QuerySecurityPackageInfo)
   1038 #define QUERY_SECURITY_PACKAGE_INFO_FN __MINGW_NAME_UAW(QUERY_SECURITY_PACKAGE_INFO_FN)
   1039 
   1040   typedef enum _SecDelegationType {
   1041     SecFull,SecService,SecTree,SecDirectory,SecObject
   1042   } SecDelegationType,*PSecDelegationType;
   1043 
   1044   SECURITY_STATUS WINAPI DelegateSecurityContext(PCtxtHandle phContext,
   1045 #if ISSP_MODE==0
   1046     PSECURITY_STRING pTarget,
   1047 #else
   1048     SEC_CHAR *pszTarget,
   1049 #endif
   1050     SecDelegationType DelegationType,PTimeStamp pExpiry,PSecBuffer pPackageParameters,PSecBufferDesc pOutput);
   1051 
   1052   KSECDDDECLSPEC SECURITY_STATUS WINAPI ExportSecurityContext(PCtxtHandle phContext,ULONG fFlags,PSecBuffer pPackedContext,void **pToken);
   1053 
   1054   typedef SECURITY_STATUS (WINAPI *EXPORT_SECURITY_CONTEXT_FN)(PCtxtHandle,ULONG,PSecBuffer,void **);
   1055 
   1056   KSECDDDECLSPEC SECURITY_STATUS WINAPI ImportSecurityContextW(
   1057 #if ISSP_MODE==0
   1058     PSECURITY_STRING pszPackage,
   1059 #else
   1060     SEC_WCHAR *pszPackage,
   1061 #endif
   1062     PSecBuffer pPackedContext,void *Token,PCtxtHandle phContext);
   1063 
   1064   typedef SECURITY_STATUS (WINAPI *IMPORT_SECURITY_CONTEXT_FN_W)(
   1065 #if ISSP_MODE==0
   1066     PSECURITY_STRING,
   1067 #else
   1068     SEC_WCHAR *,
   1069 #endif
   1070     PSecBuffer,VOID *,PCtxtHandle);
   1071 
   1072   SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage,PSecBuffer pPackedContext,VOID *Token,PCtxtHandle phContext);
   1073 
   1074   typedef SECURITY_STATUS (WINAPI *IMPORT_SECURITY_CONTEXT_FN_A)(SEC_CHAR *,PSecBuffer,void *,PCtxtHandle);
   1075 
   1076 #define ImportSecurityContext __MINGW_NAME_AW(ImportSecurityContext)
   1077 #define IMPORT_SECURITY_CONTEXT_FN __MINGW_NAME_UAW(IMPORT_SECURITY_CONTEXT_FN)
   1078 
   1079 #if ISSP_MODE==0
   1080   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);
   1081   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);
   1082   KSECDDDECLSPEC NTSTATUS NTAPI SecMakeSPNEx2(PUNICODE_STRING ServiceClass,PUNICODE_STRING ServiceName,PUNICODE_STRING InstanceName,USHORT InstancePort,PUNICODE_STRING Referrer,PUNICODE_STRING InTargetInfo,PUNICODE_STRING Spn,PULONG TotalSize,BOOLEAN Allocate,BOOLEAN IsTargetInfoMarshaled);
   1083   KSECDDDECLSPEC NTSTATUS WINAPI SecLookupAccountSid(PSID Sid,PULONG NameSize,PUNICODE_STRING NameBuffer,PULONG DomainSize,PUNICODE_STRING DomainBuffer,PSID_NAME_USE NameUse);
   1084   KSECDDDECLSPEC NTSTATUS WINAPI SecLookupAccountName(PUNICODE_STRING Name,PULONG SidSize,PSID Sid,PSID_NAME_USE NameUse,PULONG DomainSize,PUNICODE_STRING ReferencedDomain);
   1085   KSECDDDECLSPEC NTSTATUS WINAPI SecLookupWellKnownSid(WELL_KNOWN_SID_TYPE SidType,PSID Sid,ULONG SidBufferSize,PULONG SidSize);
   1086 #endif
   1087 
   1088 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
   1089 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
   1090 #define SECURITY_ENTRYPOINTW SEC_TEXT("InitSecurityInterfaceW")
   1091 #define SECURITY_ENTRYPOINTA SEC_TEXT("InitSecurityInterfaceA")
   1092 #define SECURITY_ENTRYPOINT16 "INITSECURITYINTERFACEA"
   1093 
   1094 #ifdef SECURITY_WIN32
   1095 #define SECURITY_ENTRYPOINT __MINGW_NAME_AW(SECURITY_ENTRYPOINT)
   1096 #define SECURITY_ENTRYPOINT_ANSI __MINGW_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
   1097 #else
   1098 #define SECURITY_ENTRYPOINT SECURITY_ENTRYPOINT16
   1099 #define SECURITY_ENTRYPOINT_ANSI SECURITY_ENTRYPOINT16
   1100 #endif
   1101 
   1102 #define FreeCredentialHandle FreeCredentialsHandle
   1103 
   1104 #if ISSP_MODE != 0
   1105 
   1106 SECURITY_STATUS SEC_ENTRY ChangeAccountPasswordW(SEC_WCHAR* pszPackageName,
   1107                                                  SEC_WCHAR* pszDomainName,
   1108                                                  SEC_WCHAR* pszAccountName,
   1109                                                  SEC_WCHAR* pszOldPassword,
   1110                                                  SEC_WCHAR* pszNewPassword,
   1111                                                  BOOLEAN bImpersonating,
   1112                                                  unsigned __LONG32 dwReserved,
   1113                                                  PSecBufferDesc pOutput);
   1114 
   1115 typedef SECURITY_STATUS (SEC_ENTRY *CHANGE_PASSWORD_FN_W)(SEC_WCHAR*,
   1116                                                           SEC_WCHAR*,
   1117                                                           SEC_WCHAR*,
   1118                                                           SEC_WCHAR*,
   1119                                                           SEC_WCHAR*,
   1120                                                           BOOLEAN,
   1121                                                           unsigned __LONG32,
   1122                                                           PSecBufferDesc);
   1123 
   1124 SECURITY_STATUS SEC_ENTRY ChangeAccountPasswordA(SEC_CHAR* pszPackageName,
   1125                                                  SEC_CHAR* pszDomainName,
   1126                                                  SEC_CHAR* pszAccountName,
   1127                                                  SEC_CHAR* pszOldPassword,
   1128                                                  SEC_CHAR* pszNewPassword,
   1129                                                  BOOLEAN bImpersonating,
   1130                                                  unsigned __LONG32 dwReserved,
   1131                                                  PSecBufferDesc pOutput);
   1132 
   1133 typedef SECURITY_STATUS (SEC_ENTRY *CHANGE_PASSWORD_FN_A)(SEC_CHAR*,
   1134                                                           SEC_CHAR*,
   1135                                                           SEC_CHAR*,
   1136                                                           SEC_CHAR*,
   1137                                                           SEC_CHAR*,
   1138                                                           BOOLEAN,
   1139                                                           unsigned __LONG32,
   1140                                                           PSecBufferDesc);
   1141 
   1142 #define ChangeAccountPassword __MINGW_NAME_AW(ChangeAccountPassword)
   1143 #define CHANGE_PASSWORD_FN __MINGW_NAME_UAW(CHANGE_PASSWORD_FN)
   1144 
   1145 #endif
   1146 
   1147   typedef struct _SECURITY_FUNCTION_TABLE_W {
   1148     unsigned __LONG32 dwVersion;
   1149     ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW;
   1150     QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW;
   1151     ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW;
   1152     FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
   1153     void *Reserved2;
   1154     INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW;
   1155     ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
   1156     COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
   1157     DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
   1158     APPLY_CONTROL_TOKEN_FN ApplyControlToken;
   1159     QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW;
   1160     IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
   1161     REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
   1162     MAKE_SIGNATURE_FN MakeSignature;
   1163     VERIFY_SIGNATURE_FN VerifySignature;
   1164     FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
   1165     QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW;
   1166     void *Reserved3;
   1167     void *Reserved4;
   1168     EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
   1169     IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW;
   1170     ADD_CREDENTIALS_FN_W AddCredentialsW;
   1171     void *Reserved8;
   1172     QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
   1173     ENCRYPT_MESSAGE_FN EncryptMessage;
   1174     DECRYPT_MESSAGE_FN DecryptMessage;
   1175     SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW;
   1176     SET_CREDENTIALS_ATTRIBUTES_FN_W SetCredentialsAttributesW;
   1177 #if ISSP_MODE != 0
   1178     CHANGE_PASSWORD_FN_W ChangeAccountPasswordW;
   1179 #else
   1180     void* Reserved9;
   1181 #endif
   1182 #if NTDDI_VERSION > NTDDI_WINBLUE
   1183     QUERY_CONTEXT_ATTRIBUTES_EX_FN_W QueryContextAttributesExW;
   1184     QUERY_CREDENTIALS_ATTRIBUTES_EX_FN_W QueryCredentialsAttributesExW;
   1185 #endif
   1186   } SecurityFunctionTableW,*PSecurityFunctionTableW;
   1187 
   1188   typedef struct _SECURITY_FUNCTION_TABLE_A {
   1189     unsigned __LONG32 dwVersion;
   1190     ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA;
   1191     QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
   1192     ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA;
   1193     FREE_CREDENTIALS_HANDLE_FN FreeCredentialHandle;
   1194     void *Reserved2;
   1195     INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA;
   1196     ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
   1197     COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
   1198     DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
   1199     APPLY_CONTROL_TOKEN_FN ApplyControlToken;
   1200     QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA;
   1201     IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
   1202     REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
   1203     MAKE_SIGNATURE_FN MakeSignature;
   1204     VERIFY_SIGNATURE_FN VerifySignature;
   1205     FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
   1206     QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA;
   1207     void *Reserved3;
   1208     void *Reserved4;
   1209     EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
   1210     IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA;
   1211     ADD_CREDENTIALS_FN_A AddCredentialsA;
   1212     void *Reserved8;
   1213     QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
   1214     ENCRYPT_MESSAGE_FN EncryptMessage;
   1215     DECRYPT_MESSAGE_FN DecryptMessage;
   1216     SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA;
   1217     SET_CREDENTIALS_ATTRIBUTES_FN_A SetCredentialsAttributesA;
   1218 #if ISSP_MODE != 0
   1219     CHANGE_PASSWORD_FN_A ChangeAccountPasswordA;
   1220 #else
   1221     void* Reserved9;
   1222 #endif
   1223 #if NTDDI_VERSION > NTDDI_WINBLUE
   1224     QUERY_CONTEXT_ATTRIBUTES_EX_FN_A QueryContextAttributesExA;
   1225     QUERY_CREDENTIALS_ATTRIBUTES_EX_FN_A QueryCredentialsAttributesExA;
   1226 #endif
   1227   } SecurityFunctionTableA,*PSecurityFunctionTableA;
   1228 
   1229 #define SecurityFunctionTable __MINGW_NAME_AW(SecurityFunctionTable)
   1230 #define PSecurityFunctionTable __MINGW_NAME_AW(PSecurityFunctionTable)
   1231 
   1232 #define SECURITY_
   1233 
   1234 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1
   1235 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
   1236 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_3 3
   1237 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_4 4
   1238 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_5 5
   1239 
   1240   PSecurityFunctionTableA WINAPI InitSecurityInterfaceA(void);
   1241 
   1242   typedef PSecurityFunctionTableA (WINAPI *INIT_SECURITY_INTERFACE_A)(void);
   1243 
   1244   KSECDDDECLSPEC PSecurityFunctionTableW WINAPI InitSecurityInterfaceW(void);
   1245 
   1246   typedef PSecurityFunctionTableW (WINAPI *INIT_SECURITY_INTERFACE_W)(void);
   1247 
   1248 #define InitSecurityInterface __MINGW_NAME_AW(InitSecurityInterface)
   1249 #define INIT_SECURITY_INTERFACE __MINGW_NAME_UAW(INIT_SECURITY_INTERFACE)
   1250 
   1251 #ifdef SECURITY_WIN32
   1252 
   1253   SECURITY_STATUS WINAPI SaslEnumerateProfilesA(LPSTR *ProfileList,ULONG *ProfileCount);
   1254   SECURITY_STATUS WINAPI SaslEnumerateProfilesW(LPWSTR *ProfileList,ULONG *ProfileCount);
   1255 
   1256 #define SaslEnumerateProfiles __MINGW_NAME_AW(SaslEnumerateProfiles)
   1257 
   1258   SECURITY_STATUS WINAPI SaslGetProfilePackageA(LPSTR ProfileName,PSecPkgInfoA *PackageInfo);
   1259   SECURITY_STATUS WINAPI SaslGetProfilePackageW(LPWSTR ProfileName,PSecPkgInfoW *PackageInfo);
   1260 
   1261 #define SaslGetProfilePackage __MINGW_NAME_AW(SaslGetProfilePackage)
   1262 
   1263   SECURITY_STATUS WINAPI SaslIdentifyPackageA(PSecBufferDesc pInput,PSecPkgInfoA *PackageInfo);
   1264   SECURITY_STATUS WINAPI SaslIdentifyPackageW(PSecBufferDesc pInput,PSecPkgInfoW *PackageInfo);
   1265 
   1266 #define SaslIdentifyPackage __MINGW_NAME_AW(SaslIdentifyPackage)
   1267 
   1268   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);
   1269   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);
   1270 
   1271 #define SaslInitializeSecurityContext __MINGW_NAME_AW(SaslInitializeSecurityContext)
   1272 
   1273   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);
   1274 
   1275 #define SASL_OPTION_SEND_SIZE 1
   1276 #define SASL_OPTION_RECV_SIZE 2
   1277 #define SASL_OPTION_AUTHZ_STRING 3
   1278 #define SASL_OPTION_AUTHZ_PROCESSING 4
   1279 
   1280   typedef enum _SASL_AUTHZID_STATE {
   1281     Sasl_AuthZIDForbidden,Sasl_AuthZIDProcessed
   1282   } SASL_AUTHZID_STATE;
   1283 
   1284   SECURITY_STATUS WINAPI SaslSetContextOption(PCtxtHandle ContextHandle,ULONG Option,PVOID Value,ULONG Size);
   1285   SECURITY_STATUS WINAPI SaslGetContextOption(PCtxtHandle ContextHandle,ULONG Option,PVOID Value,ULONG Size,PULONG Needed);
   1286 #endif
   1287 
   1288 #ifndef _AUTH_IDENTITY_EX2_DEFINED
   1289 #define _AUTH_IDENTITY_EX2_DEFINED
   1290 
   1291 #define SEC_WINNT_AUTH_IDENTITY_VERSION_2 0x201
   1292 
   1293   typedef struct _SEC_WINNT_AUTH_IDENTITY_EX2 {
   1294     unsigned __LONG32 Version;
   1295     unsigned short cbHeaderLength;
   1296     unsigned __LONG32 cbStructureLength;
   1297     unsigned __LONG32 UserOffset;
   1298     unsigned short UserLength;
   1299     unsigned __LONG32 DomainOffset;
   1300     unsigned short DomainLength;
   1301     unsigned __LONG32 PackedCredentialsOffset;
   1302     unsigned short PackedCredentialsLength;
   1303     unsigned __LONG32 Flags;
   1304     unsigned __LONG32 PackageListOffset;
   1305     unsigned short PackageListLength;
   1306   } SEC_WINNT_AUTH_IDENTITY_EX2, *PSEC_WINNT_AUTH_IDENTITY_EX2;
   1307 
   1308 #endif
   1309 
   1310 #ifndef _AUTH_IDENTITY_DEFINED
   1311 #define _AUTH_IDENTITY_DEFINED
   1312 
   1313 #define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1
   1314 #define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2
   1315 
   1316   typedef struct _SEC_WINNT_AUTH_IDENTITY_W {
   1317     unsigned short *User;
   1318     unsigned __LONG32 UserLength;
   1319     unsigned short *Domain;
   1320     unsigned __LONG32 DomainLength;
   1321     unsigned short *Password;
   1322     unsigned __LONG32 PasswordLength;
   1323     unsigned __LONG32 Flags;
   1324   } SEC_WINNT_AUTH_IDENTITY_W,*PSEC_WINNT_AUTH_IDENTITY_W;
   1325 
   1326   typedef struct _SEC_WINNT_AUTH_IDENTITY_A {
   1327     unsigned char *User;
   1328     unsigned __LONG32 UserLength;
   1329     unsigned char *Domain;
   1330     unsigned __LONG32 DomainLength;
   1331     unsigned char *Password;
   1332     unsigned __LONG32 PasswordLength;
   1333     unsigned __LONG32 Flags;
   1334   } SEC_WINNT_AUTH_IDENTITY_A,*PSEC_WINNT_AUTH_IDENTITY_A;
   1335 
   1336 #define SEC_WINNT_AUTH_IDENTITY __MINGW_NAME_UAW(SEC_WINNT_AUTH_IDENTITY)
   1337 #define PSEC_WINNT_AUTH_IDENTITY __MINGW_NAME_UAW(PSEC_WINNT_AUTH_IDENTITY)
   1338 #define _SEC_WINNT_AUTH_IDENTITY __MINGW_NAME_UAW(_SEC_WINNT_AUTH_IDENTITY)
   1339 #endif
   1340 
   1341 #ifndef SEC_WINNT_AUTH_IDENTITY_VERSION
   1342 #define SEC_WINNT_AUTH_IDENTITY_VERSION 0x200
   1343 
   1344   typedef struct _SEC_WINNT_AUTH_IDENTITY_EXW {
   1345     unsigned __LONG32 Version;
   1346     unsigned __LONG32 Length;
   1347     unsigned short *User;
   1348     unsigned __LONG32 UserLength;
   1349     unsigned short *Domain;
   1350     unsigned __LONG32 DomainLength;
   1351     unsigned short *Password;
   1352     unsigned __LONG32 PasswordLength;
   1353     unsigned __LONG32 Flags;
   1354     unsigned short *PackageList;
   1355     unsigned __LONG32 PackageListLength;
   1356   } SEC_WINNT_AUTH_IDENTITY_EXW,*PSEC_WINNT_AUTH_IDENTITY_EXW;
   1357 
   1358   typedef struct _SEC_WINNT_AUTH_IDENTITY_EXA {
   1359     unsigned __LONG32 Version;
   1360     unsigned __LONG32 Length;
   1361     unsigned char *User;
   1362     unsigned __LONG32 UserLength;
   1363     unsigned char *Domain;
   1364     unsigned __LONG32 DomainLength;
   1365     unsigned char *Password;
   1366     unsigned __LONG32 PasswordLength;
   1367     unsigned __LONG32 Flags;
   1368     unsigned char *PackageList;
   1369     unsigned __LONG32 PackageListLength;
   1370   } SEC_WINNT_AUTH_IDENTITY_EXA,*PSEC_WINNT_AUTH_IDENTITY_EXA;
   1371 
   1372 #define SEC_WINNT_AUTH_IDENTITY_EX __MINGW_NAME_AW(SEC_WINNT_AUTH_IDENTITY_EX)
   1373 #define PSEC_WINNT_AUTH_IDENTITY_EX __MINGW_NAME_AW(PSEC_WINNT_AUTH_IDENTITY_EX)
   1374 #endif
   1375 
   1376 #ifndef _AUTH_IDENTITY_INFO_DEFINED
   1377 #define _AUTH_IDENTITY_INFO_DEFINED
   1378 
   1379   typedef union _SEC_WINNT_AUTH_IDENTITY_INFO {
   1380     SEC_WINNT_AUTH_IDENTITY_EXW AuthIdExw;
   1381     SEC_WINNT_AUTH_IDENTITY_EXA AuthIdExa;
   1382     SEC_WINNT_AUTH_IDENTITY_A AuthId_a;
   1383     SEC_WINNT_AUTH_IDENTITY_W AuthId_w;
   1384     SEC_WINNT_AUTH_IDENTITY_EX2 AuthIdEx2;
   1385   } SEC_WINNT_AUTH_IDENTITY_INFO, *PSEC_WINNT_AUTH_IDENTITY_INFO;
   1386 
   1387 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_PROCESS_ENCRYPTED     0x10
   1388 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SYSTEM_PROTECTED      0x20
   1389 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_USER_PROTECTED        0x40
   1390 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SYSTEM_ENCRYPTED      0x80
   1391 
   1392 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_RESERVED              0x10000
   1393 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_NULL_USER             0x20000
   1394 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_NULL_DOMAIN           0x40000
   1395 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_ID_PROVIDER           0x80000
   1396 
   1397 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_USE_MASK              0xff000000
   1398 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_SAVE  0x80000000
   1399 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_BY_CALLER   SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_SAVE
   1400 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_CHECKED     0x40000000
   1401 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_NO_CHECKBOX           0x20000000
   1402 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_LOAD  0x10000000
   1403 
   1404 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_VALID_SSPIPFC_FLAGS \
   1405   (SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_SAVE | \
   1406    SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_CHECKED | \
   1407    SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_NO_CHECKBOX | \
   1408    SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_LOAD)
   1409 
   1410 #endif
   1411 
   1412 #define SSPIPFC_CREDPROV_DO_NOT_SAVE          0x00000001
   1413 #define SSPIPFC_SAVE_CRED_BY_CALLER           SSPIPFC_CREDPROV_DO_NOT_SAVE
   1414 #define SSPIPFC_NO_CHECKBOX                   0x00000002
   1415 #define SSPIPFC_CREDPROV_DO_NOT_LOAD          0x00000004
   1416 #define SSPIPFC_USE_CREDUIBROKER	          0x00000008
   1417 #define SSPIPFC_VALID_FLAGS \
   1418   (SSPIPFC_CREDPROV_DO_NOT_SAVE | SSPIPFC_NO_CHECKBOX | SSPIPFC_CREDPROV_DO_NOT_LOAD | SSPIPFC_USE_CREDUIBROKER)
   1419 
   1420 #ifndef _SSPIPFC_NONE_
   1421 
   1422 typedef PVOID PSEC_WINNT_AUTH_IDENTITY_OPAQUE;
   1423 
   1424 unsigned __LONG32 SEC_ENTRY SspiPromptForCredentialsW(
   1425   PCWSTR pszTargetName,
   1426 #ifdef _CREDUI_INFO_DEFINED
   1427   PCREDUI_INFOW pUiInfo,
   1428 #else
   1429   PVOID pUiInfo,
   1430 #endif
   1431   unsigned __LONG32 dwAuthError,
   1432   PCWSTR pszPackage,
   1433   PSEC_WINNT_AUTH_IDENTITY_OPAQUE pInputAuthIdentity,
   1434   PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity,
   1435   int* pfSave,
   1436   unsigned __LONG32 dwFlags
   1437 );
   1438 
   1439 unsigned __LONG32 SEC_ENTRY SspiPromptForCredentialsA(
   1440   PCSTR pszTargetName,
   1441 #ifdef _CREDUI_INFO_DEFINED
   1442   PCREDUI_INFOA pUiInfo,
   1443 #else
   1444   PVOID pUiInfo,
   1445 #endif
   1446   unsigned __LONG32 dwAuthError,
   1447   PCSTR pszPackage,
   1448   PSEC_WINNT_AUTH_IDENTITY_OPAQUE pInputAuthIdentity,
   1449   PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity,
   1450   int* pfSave,
   1451   unsigned __LONG32 dwFlags
   1452 );
   1453 
   1454 #define SspiPromptForCredentials __MINGW_NAME_AW(SspiPromptForCredentials)
   1455 
   1456 #else
   1457 
   1458 typedef PSEC_WINNT_AUTH_IDENTITY_INFO PSEC_WINNT_AUTH_IDENTITY_OPAQUE;
   1459 
   1460 #endif
   1461 
   1462 #ifdef _SEC_WINNT_AUTH_TYPES
   1463 
   1464 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_PASSWORD =
   1465   { 0x28bfc32f, 0x10f6, 0x4738, { 0x98, 0xd1, 0x1a, 0xc0, 0x61, 0xdf, 0x71, 0x6a } };
   1466 
   1467 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_CERT =
   1468   { 0x235f69ad, 0x73fb, 0x4dbc, { 0x82, 0x3, 0x6, 0x29, 0xe7, 0x39, 0x33, 0x9b } };
   1469 
   1470 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_CREDMAN_CERT =
   1471   { 0x7cb72412, 0x1016, 0x491a, { 0x8c, 0x87, 0x4d, 0x2a, 0xa1, 0xb7, 0xdd, 0x3a } };
   1472 
   1473 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_NGC =
   1474   { 0x10a47879, 0x5ebf, 0x4b85, { 0xbd, 0x8d, 0xc2, 0x1b, 0xb4, 0xf4, 0x9c, 0x8a } };
   1475 
   1476 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_FIDO =
   1477   { 0x32e8f8d7, 0x7871, 0x4bcc, { 0x83, 0xc5, 0x46, 0xf, 0x66, 0xc6, 0x13, 0x5c } };
   1478 
   1479 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_KEYTAB =
   1480   { 0xd587aae8, 0xf78f, 0x4455, { 0xa1, 0x12, 0xc9, 0x34, 0xbe, 0xee, 0x7c, 0xe1 } };
   1481 
   1482 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_DELEGATION_TOKEN =
   1483   { 0x12e52e0f, 0x6f9b, 0x4f83, { 0x90, 0x20, 0x9d, 0xe4, 0x2b, 0x22, 0x62, 0x67 } };
   1484 
   1485 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_CSP_DATA =
   1486   { 0x68fd9879, 0x79c, 0x4dfe, { 0x82, 0x81, 0x57, 0x8a, 0xad, 0xc1, 0xc1, 0x0 } };
   1487 
   1488 EXTERN_C __declspec(selectany) const GUID SEC_WINNT_AUTH_DATA_TYPE_SMARTCARD_CONTEXTS =
   1489   { 0xb86c4ff3, 0x49d7, 0x4dc4, { 0xb5, 0x60, 0xb1, 0x16, 0x36, 0x85, 0xb2, 0x36 } };
   1490 
   1491 EXTERN_C __declspec(selectany) const GUID CREDUIWIN_STRUCTURE_TYPE_SSPIPFC  =
   1492   { 0x3c3e93d9, 0xd96b, 0x49b5, { 0x94, 0xa7, 0x45, 0x85, 0x92, 0x8, 0x83, 0x37 } };
   1493 
   1494 EXTERN_C __declspec(selectany) const GUID SSPIPFC_STRUCTURE_TYPE_CREDUI_CONTEXT =
   1495   { 0xc2fffe6f, 0x503d, 0x4c3d, { 0xa9, 0x5e, 0xbc, 0xe8, 0x21, 0x21, 0x3d, 0x44 } };
   1496 
   1497 typedef struct _SEC_WINNT_AUTH_BYTE_VECTOR {
   1498   unsigned __LONG32 ByteArrayOffset;
   1499   unsigned short ByteArrayLength;
   1500 } SEC_WINNT_AUTH_BYTE_VECTOR, *PSEC_WINNT_AUTH_BYTE_VECTOR;
   1501 
   1502 typedef struct _SEC_WINNT_AUTH_DATA {
   1503   GUID CredType;
   1504   SEC_WINNT_AUTH_BYTE_VECTOR CredData;
   1505 } SEC_WINNT_AUTH_DATA, *PSEC_WINNT_AUTH_DATA;
   1506 
   1507 typedef struct _SEC_WINNT_AUTH_PACKED_CREDENTIALS {
   1508   unsigned short cbHeaderLength;
   1509   unsigned short cbStructureLength;
   1510   SEC_WINNT_AUTH_DATA AuthData;
   1511 } SEC_WINNT_AUTH_PACKED_CREDENTIALS, *PSEC_WINNT_AUTH_PACKED_CREDENTIALS;
   1512 
   1513 typedef struct _SEC_WINNT_AUTH_DATA_PASSWORD {
   1514   SEC_WINNT_AUTH_BYTE_VECTOR UnicodePassword;
   1515 } SEC_WINNT_AUTH_DATA_PASSWORD, PSEC_WINNT_AUTH_DATA_PASSWORD;
   1516 
   1517 typedef struct _SEC_WINNT_AUTH_CERTIFICATE_DATA {
   1518   unsigned short cbHeaderLength;
   1519   unsigned short cbStructureLength;
   1520   SEC_WINNT_AUTH_BYTE_VECTOR Certificate;
   1521 } SEC_WINNT_AUTH_CERTIFICATE_DATA, *PSEC_WINNT_AUTH_CERTIFICATE_DATA;
   1522 
   1523 typedef struct _SEC_WINNT_AUTH_NGC_DATA {
   1524   LUID LogonId;
   1525   unsigned __LONG32 Flags;
   1526   SEC_WINNT_AUTH_BYTE_VECTOR CspInfo;
   1527   SEC_WINNT_AUTH_BYTE_VECTOR UserIdKeyAuthTicket;
   1528   SEC_WINNT_AUTH_BYTE_VECTOR DecryptionKeyName;
   1529   SEC_WINNT_AUTH_BYTE_VECTOR DecryptionKeyAuthTicket;
   1530 } SEC_WINNT_AUTH_NGC_DATA, *PSEC_WINNT_AUTH_NGC_DATA;
   1531 
   1532 #define NGC_DATA_FLAG_KERB_CERTIFICATE_LOGON_FLAG_CHECK_DUPLICATES      1
   1533 #define NGC_DATA_FLAG_KERB_CERTIFICATE_LOGON_FLAG_USE_CERTIFICATE_INFO  2
   1534 #define NGC_DATA_FLAG_IS_SMARTCARD_DATA                                 4
   1535 #define NGC_DATA_FLAG_IS_CLOUD_TRUST_CRED                               8
   1536 
   1537 typedef struct _SEC_WINNT_AUTH_DATA_TYPE_SMARTCARD_CONTEXTS_DATA {
   1538   PVOID pcc;
   1539   PVOID hProv;
   1540   LPWSTR pwszECDHKeyName;
   1541 } SEC_WINNT_AUTH_DATA_TYPE_SMARTCARD_CONTEXTS_DATA, *PSEC_WINNT_AUTH_DATA_TYPE_SMARTCARD_CONTEXTS_DATA;
   1542 
   1543 typedef struct _SEC_WINNT_AUTH_FIDO_DATA {
   1544   unsigned short cbHeaderLength;
   1545   unsigned short cbStructureLength;
   1546   SEC_WINNT_AUTH_BYTE_VECTOR Secret;
   1547   SEC_WINNT_AUTH_BYTE_VECTOR NewSecret;
   1548   SEC_WINNT_AUTH_BYTE_VECTOR EncryptedNewSecret;
   1549   SEC_WINNT_AUTH_BYTE_VECTOR NetworkLogonBuffer;
   1550   ULONG64 ulSignatureCount;
   1551 } SEC_WINNT_AUTH_FIDO_DATA, *PSEC_WINNT_AUTH_FIDO_DATA;
   1552 
   1553 typedef struct _SEC_WINNT_CREDUI_CONTEXT_VECTOR {
   1554   ULONG CredUIContextArrayOffset;
   1555   USHORT CredUIContextCount;
   1556 } SEC_WINNT_CREDUI_CONTEXT_VECTOR, *PSEC_WINNT_CREDUI_CONTEXT_VECTOR;
   1557 
   1558 typedef struct _SEC_WINNT_AUTH_SHORT_VECTOR {
   1559   ULONG ShortArrayOffset;
   1560   USHORT ShortArrayCount;
   1561 } SEC_WINNT_AUTH_SHORT_VECTOR, *PSEC_WINNT_AUTH_SHORT_VECTOR;
   1562 
   1563 typedef struct _CREDUIWIN_MARSHALED_CONTEXT {
   1564   GUID StructureType;
   1565   USHORT cbHeaderLength;
   1566   LUID LogonId;
   1567   GUID MarshaledDataType;
   1568   ULONG MarshaledDataOffset;
   1569   USHORT MarshaledDataLength;
   1570 } CREDUIWIN_MARSHALED_CONTEXT, *PCREDUIWIN_MARSHALED_CONTEXT;
   1571 
   1572 typedef struct _SEC_WINNT_CREDUI_CONTEXT {
   1573   USHORT cbHeaderLength;
   1574   HANDLE CredUIContextHandle;
   1575 #ifdef _CREDUI_INFO_DEFINED
   1576   PCREDUI_INFOW UIInfo;
   1577 #else
   1578   PVOID UIInfo;
   1579 #endif
   1580   ULONG dwAuthError;
   1581   PSEC_WINNT_AUTH_IDENTITY_OPAQUE pInputAuthIdentity;
   1582   PUNICODE_STRING TargetName;
   1583 } SEC_WINNT_CREDUI_CONTEXT, *PSEC_WINNT_CREDUI_CONTEXT;
   1584 
   1585 typedef struct _SEC_WINNT_AUTH_PACKED_CREDENTIALS_EX {
   1586   unsigned short cbHeaderLength;
   1587   unsigned __LONG32 Flags;
   1588   SEC_WINNT_AUTH_BYTE_VECTOR PackedCredentials;
   1589   SEC_WINNT_AUTH_SHORT_VECTOR PackageList;
   1590 } SEC_WINNT_AUTH_PACKED_CREDENTIALS_EX, *PSEC_WINNT_AUTH_PACKED_CREDENTIALS_EX;
   1591 
   1592 SECURITY_STATUS SEC_ENTRY SspiGetCredUIContext(HANDLE ContextHandle, GUID* CredType,
   1593                                                LUID* LogonId,
   1594                                                PSEC_WINNT_CREDUI_CONTEXT_VECTOR* CredUIContexts,
   1595                                                HANDLE* TokenHandle);
   1596 SECURITY_STATUS SEC_ENTRY SspiUpdateCredentials(HANDLE ContextHandle, GUID* CredType,
   1597                                                 ULONG FlatCredUIContextLength,
   1598                                                 PUCHAR FlatCredUIContext);
   1599 SECURITY_STATUS SEC_ENTRY SspiUnmarshalCredUIContext(PUCHAR MarshaledCredUIContext,
   1600                                                      ULONG MarshaledCredUIContextLength,
   1601                                                      PSEC_WINNT_CREDUI_CONTEXT* CredUIContext);
   1602 
   1603 #endif
   1604 
   1605 #define SEC_WINNT_AUTH_IDENTITY_MARSHALLED 0x4
   1606 #define SEC_WINNT_AUTH_IDENTITY_ONLY 0x8
   1607 
   1608 typedef struct _SECURITY_PACKAGE_OPTIONS {
   1609   unsigned __LONG32 Size;
   1610   unsigned __LONG32 Type;
   1611   unsigned __LONG32 Flags;
   1612   unsigned __LONG32 SignatureSize;
   1613   void *Signature;
   1614 } SECURITY_PACKAGE_OPTIONS,*PSECURITY_PACKAGE_OPTIONS;
   1615 
   1616 #define SECPKG_OPTIONS_TYPE_UNKNOWN 0
   1617 #define SECPKG_OPTIONS_TYPE_LSA 1
   1618 #define SECPKG_OPTIONS_TYPE_SSPI 2
   1619 
   1620 #define SECPKG_OPTIONS_PERMANENT 0x00000001
   1621 
   1622 #define AddSecurityPackage __MINGW_NAME_AW(AddSecurityPackage)
   1623 #define DeleteSecurityPackage __MINGW_NAME_AW(DeleteSecurityPackage)
   1624 
   1625 SECURITY_STATUS WINAPI AddSecurityPackageA(LPSTR pszPackageName,PSECURITY_PACKAGE_OPTIONS pOptions);
   1626 SECURITY_STATUS WINAPI AddSecurityPackageW(LPWSTR pszPackageName,PSECURITY_PACKAGE_OPTIONS pOptions);
   1627 
   1628   SECURITY_STATUS WINAPI DeleteSecurityPackageA(SEC_CHAR *pszPackageName);
   1629   SECURITY_STATUS WINAPI DeleteSecurityPackageW(SEC_WCHAR *pszPackageName);
   1630 
   1631 #if ISSP_MODE == 0
   1632 
   1633 typedef struct _SspiAsyncContext SspiAsyncContext;
   1634 
   1635 typedef void (*SspiAsyncNotifyCallback)(SspiAsyncContext* Handle, PVOID CallbackData);
   1636 
   1637 SspiAsyncContext* SspiCreateAsyncContext();
   1638 void SspiFreeAsyncContext(SspiAsyncContext* Handle);
   1639 NTSTATUS SspiReinitAsyncContext(SspiAsyncContext* Handle);
   1640 SECURITY_STATUS SspiSetAsyncNotifyCallback(SspiAsyncContext* Context,
   1641                                            SspiAsyncNotifyCallback Callback,
   1642                                            void* CallbackData);
   1643 BOOLEAN SspiAsyncContextRequiresNotify(SspiAsyncContext* AsyncContext);
   1644 SECURITY_STATUS SspiGetAsyncCallStatus(SspiAsyncContext* Handle);
   1645 
   1646 SECURITY_STATUS SspiAcquireCredentialsHandleAsyncW(
   1647   SspiAsyncContext* AsyncContext,
   1648 #if ISSP_MODE == 0
   1649   PSECURITY_STRING pszPrincipal,
   1650   PSECURITY_STRING pszPackage,
   1651 #else
   1652   LPWSTR pszPrincipal,
   1653   LPWSTR pszPackage,
   1654 #endif
   1655   unsigned __LONG32 fCredentialUse,
   1656   void* pvLogonId,
   1657   void* pAuthData,
   1658   SEC_GET_KEY_FN pGetKeyFn,
   1659   void* pvGetKeyArgument,
   1660   PCredHandle phCredential,
   1661   PTimeStamp ptsExpiry
   1662 );
   1663 
   1664 SECURITY_STATUS SspiAcquireCredentialsHandleAsyncA(
   1665   SspiAsyncContext* AsyncContext,
   1666   LPSTR pszPrincipal,
   1667   LPSTR pszPackage,
   1668   unsigned __LONG32 fCredentialUse,
   1669   void * pvLogonId,
   1670   void * pAuthData,
   1671   SEC_GET_KEY_FN pGetKeyFn,
   1672   void * pvGetKeyArgument,
   1673   PCredHandle phCredential,
   1674   PTimeStamp ptsExpiry
   1675 );
   1676 
   1677 SECURITY_STATUS SspiInitializeSecurityContextAsyncW(
   1678   SspiAsyncContext* AsyncContext,
   1679   PCredHandle phCredential,
   1680   PCtxtHandle phContext,
   1681 #if ISSP_MODE == 0
   1682   PSECURITY_STRING pszTargetName,
   1683 #else
   1684   LPWSTR pszTargetName,
   1685 #endif
   1686   unsigned __LONG32 fContextReq,
   1687   unsigned __LONG32 Reserved1,
   1688   unsigned __LONG32 TargetDataRep,
   1689   PSecBufferDesc pInput,
   1690   unsigned __LONG32 Reserved2,
   1691   PCtxtHandle phNewContext,
   1692   PSecBufferDesc pOutput,
   1693   unsigned __LONG32* pfContextAttr,
   1694   PTimeStamp ptsExpiry
   1695 );
   1696 
   1697 SECURITY_STATUS SspiInitializeSecurityContextAsyncA(
   1698   SspiAsyncContext* AsyncContext,
   1699   PCredHandle phCredential,
   1700   PCtxtHandle phContext,
   1701   LPSTR pszTargetName,
   1702   unsigned __LONG32 fContextReq,
   1703   unsigned __LONG32 Reserved1,
   1704   unsigned __LONG32 TargetDataRep,
   1705   PSecBufferDesc pInput,
   1706   unsigned __LONG32 Reserved2,
   1707   PCtxtHandle phNewContext,
   1708   PSecBufferDesc pOutput,
   1709   unsigned __LONG32* pfContextAttr,
   1710   PTimeStamp ptsExpiry
   1711 );
   1712 
   1713 SECURITY_STATUS SspiAcceptSecurityContextAsync(
   1714   SspiAsyncContext* AsyncContext,
   1715   PCredHandle phCredential,
   1716   PCtxtHandle phContext,
   1717   PSecBufferDesc pInput,
   1718   unsigned __LONG32 fContextReq,
   1719   unsigned __LONG32 TargetDataRep,
   1720   PCtxtHandle phNewContext,
   1721   PSecBufferDesc pOutput,
   1722   unsigned __LONG32* pfContextAttr,
   1723   PTimeStamp ptsExpiry
   1724 );
   1725 
   1726 SECURITY_STATUS SspiFreeCredentialsHandleAsync(
   1727   SspiAsyncContext* AsyncContext,
   1728   PCredHandle phCredential
   1729 );
   1730 
   1731 SECURITY_STATUS SspiDeleteSecurityContextAsync(
   1732   SspiAsyncContext* AsyncContext,
   1733   PCtxtHandle phContext
   1734 );
   1735 
   1736 #define SspiAcquireCredentialsHandleAsync __MINGW_NAME_AW(SspiAcquireCredentialsHandleAsync)
   1737 #define SspiInitializeSecurityContextAsync __MINGW_NAME_AW(SspiInitializeSecurityContextAsync)
   1738 
   1739 #endif
   1740 
   1741 SECURITY_STATUS SEC_ENTRY SspiPrepareForCredRead(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity,
   1742                                                  PCWSTR pszTargetName, PULONG pCredmanCredentialType,
   1743                                                  PCWSTR* ppszCredmanTargetName);
   1744 
   1745 SECURITY_STATUS SEC_ENTRY SspiPrepareForCredWrite(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity,
   1746                                                   PCWSTR pszTargetName, PULONG pCredmanCredentialType,
   1747                                                   PCWSTR* ppszCredmanTargetName, PCWSTR* ppszCredmanUserName,
   1748                                                   PUCHAR *ppCredentialBlob, PULONG pCredentialBlobSize);
   1749 
   1750 #define SEC_WINNT_AUTH_IDENTITY_ENCRYPT_SAME_LOGON            1
   1751 #define SEC_WINNT_AUTH_IDENTITY_ENCRYPT_SAME_PROCESS          2
   1752 #define SEC_WINNT_AUTH_IDENTITY_ENCRYPT_FOR_SYSTEM            4
   1753 
   1754 SECURITY_STATUS SEC_ENTRY SspiEncryptAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
   1755 
   1756 SECURITY_STATUS SEC_ENTRY SspiEncryptAuthIdentityEx(ULONG Options, PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
   1757 
   1758 SECURITY_STATUS SEC_ENTRY SspiDecryptAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE EncryptedAuthData);
   1759 
   1760 SECURITY_STATUS SEC_ENTRY SspiDecryptAuthIdentityEx(ULONG Options, PSEC_WINNT_AUTH_IDENTITY_OPAQUE EncryptedAuthData);
   1761 
   1762 BOOLEAN SEC_ENTRY SspiIsAuthIdentityEncrypted(PSEC_WINNT_AUTH_IDENTITY_OPAQUE EncryptedAuthData);
   1763 
   1764 #if NTDDI_VERSION >= NTDDI_WIN7
   1765 
   1766 SECURITY_STATUS SEC_ENTRY SspiEncodeAuthIdentityAsStrings(PSEC_WINNT_AUTH_IDENTITY_OPAQUE pAuthIdentity,
   1767                                                           PCWSTR* ppszUserName, PCWSTR* ppszDomainName,
   1768                                                           PCWSTR* ppszPackedCredentialsString);
   1769 
   1770 SECURITY_STATUS SEC_ENTRY SspiValidateAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
   1771 
   1772 SECURITY_STATUS SEC_ENTRY SspiCopyAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData,
   1773                                                PSEC_WINNT_AUTH_IDENTITY_OPAQUE* AuthDataCopy);
   1774 
   1775 VOID SEC_ENTRY SspiFreeAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
   1776 
   1777 VOID SEC_ENTRY SspiZeroAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthData);
   1778 
   1779 VOID SEC_ENTRY SspiLocalFree(PVOID DataBuffer);
   1780 
   1781 SECURITY_STATUS SEC_ENTRY SspiEncodeStringsAsAuthIdentity(PCWSTR pszUserName, PCWSTR pszDomainName,
   1782                                                           PCWSTR pszPackedCredentialsString,
   1783                                                           PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity);
   1784 
   1785 SECURITY_STATUS SEC_ENTRY SspiCompareAuthIdentities(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity1,
   1786                                                     PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity2,
   1787                                                     PBOOLEAN SameSuppliedUser, PBOOLEAN SameSuppliedIdentity);
   1788 
   1789 SECURITY_STATUS SEC_ENTRY SspiMarshalAuthIdentity(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity,
   1790                                                   unsigned __LONG32* AuthIdentityLength,
   1791                                                   char** AuthIdentityByteArray);
   1792 
   1793 SECURITY_STATUS SEC_ENTRY SspiUnmarshalAuthIdentity(unsigned __LONG32 AuthIdentityLength,
   1794                                                     char* AuthIdentityByteArray,
   1795                                                     PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppAuthIdentity);
   1796 
   1797 BOOLEAN SEC_ENTRY SspiIsPromptingNeeded(unsigned __LONG32 ErrorOrNtStatus);
   1798 
   1799 SECURITY_STATUS SEC_ENTRY SspiGetTargetHostName(PCWSTR pszTargetName, PWSTR* pszHostName);
   1800 
   1801 SECURITY_STATUS SEC_ENTRY SspiExcludePackage(PSEC_WINNT_AUTH_IDENTITY_OPAQUE AuthIdentity,
   1802                                              PCWSTR pszPackageName,
   1803                                              PSEC_WINNT_AUTH_IDENTITY_OPAQUE* ppNewAuthIdentity);
   1804 
   1805 #endif
   1806 
   1807 #ifdef __cplusplus
   1808 }
   1809 #endif
   1810 #endif