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