sspi.h 71 KB

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