jwasspi.pas 110 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277
  1. {******************************************************************************}
  2. { }
  3. { Security Service Provider API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: sspi.h, released June 2000. The original Pascal }
  9. { code is: Sspi.pas, released December 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. // $Id: JwaSspi.pas,v 1.13 2007/09/14 06:48:47 marquardt Exp $
  43. {$IFNDEF JWA_OMIT_SECTIONS}
  44. unit JwaSspi;
  45. {$WEAKPACKAGEUNIT}
  46. {$ENDIF JWA_OMIT_SECTIONS}
  47. {$HPPEMIT ''}
  48. {$HPPEMIT '#include "sspi.h"'}
  49. {$HPPEMIT ''}
  50. {$HPPEMIT '#typedef SEC_CHAR *PSEC_CHAR'}
  51. {$HPPEMIT '#typedef SEC_WCHAR *PSEC_WCHAR'}
  52. {$HPPEMIT ''}
  53. {$IFNDEF JWA_OMIT_SECTIONS}
  54. {$I jediapilib.inc}
  55. interface
  56. uses
  57. JwaWinType;
  58. {$ENDIF JWA_OMIT_SECTIONS}
  59. {$IFNDEF JWA_IMPLEMENTATIONSECTION}
  60. //
  61. // Determine environment:
  62. //
  63. const
  64. ISSP_LEVEL = 32;
  65. {$EXTERNALSYM ISSP_LEVEL}
  66. ISSP_MODE = 1;
  67. {$EXTERNALSYM ISSP_MODE}
  68. //
  69. // Now, define platform specific mappings:
  70. //
  71. //
  72. // For NT-2 and up, wtypes will define HRESULT to be long.
  73. //
  74. type
  75. SEC_WCHAR = WCHAR;
  76. {$EXTERNALSYM SEC_WCHAR}
  77. PSEC_WCHAR = ^SEC_CHAR;
  78. {$NODEFINE PSEC_WCHAR}
  79. PSecWChar = ^TSecWChar;
  80. TSecWChar = SEC_WCHAR;
  81. SEC_CHAR = CHAR;
  82. {$EXTERNALSYM SEC_CHAR}
  83. PSEC_CHAR = ^SEC_CHAR;
  84. {$NODEFINE PSEC_CHAR}
  85. PSecChar = ^TSecChar;
  86. TSecChar = SEC_CHAR;
  87. SECURITY_STATUS = LONG;
  88. {$EXTERNALSYM SECURITY_STATUS}
  89. PSecurityStatus = ^TSecurityStatus;
  90. TSecurityStatus = SECURITY_STATUS;
  91. //
  92. // Decide what a string - 32 bits only since for 16 bits it is clear.
  93. //
  94. {$IFDEF UNICODE}
  95. SECURITY_PSTR = ^SEC_WCHAR;
  96. {$EXTERNALSYM SECURITY_PSTR}
  97. SECURITY_PCSTR = ^SEC_WCHAR;
  98. {$EXTERNALSYM SECURITY_PCSTR}
  99. {$ELSE}
  100. SECURITY_PSTR = ^SEC_CHAR;
  101. {$EXTERNALSYM SECURITY_PSTR}
  102. SECURITY_PCSTR = ^SEC_CHAR;
  103. {$EXTERNALSYM SECURITY_PCSTR}
  104. {$ENDIF UNICODE}
  105. //
  106. // Okay, security specific types:
  107. //
  108. {$IFNDEF JWA_INCLUDEMODE}
  109. PSecHandle = ^SecHandle;
  110. {$EXTERNALSYM PSecHandle}
  111. _SecHandle = record
  112. dwLower: ULONG_PTR;
  113. dwUpper: ULONG_PTR;
  114. end;
  115. {$EXTERNALSYM _SecHandle}
  116. SecHandle = _SecHandle;
  117. {$EXTERNALSYM SecHandle}
  118. TSecHandle = SecHandle;
  119. {$ENDIF JWA_INCLUDEMODE}
  120. procedure SecInvalidateHandle(var x: SecHandle);
  121. {$EXTERNALSYM SecInvalidateHandle}
  122. function SecIsValidHandle(x: SecHandle): Boolean;
  123. {$EXTERNALSYM SecIsValidHandle}
  124. type
  125. CredHandle = SecHandle;
  126. {$EXTERNALSYM CredHandle}
  127. PCredHandle = ^CredHandle;
  128. {$EXTERNALSYM PCredHandle}
  129. TCredHandle = CredHandle;
  130. CtxtHandle = SecHandle;
  131. {$EXTERNALSYM CtxtHandle}
  132. {$IFNDEF JWA_INCLUDEMODE}
  133. PCtxtHandle = ^CtxtHandle;
  134. {$EXTERNALSYM PCtxthandle}
  135. {$ENDIF JWA_INCLUDEMODE}
  136. TCtxthandle = CtxtHandle;
  137. _SECURITY_INTEGER = LARGE_INTEGER;
  138. {$EXTERNALSYM _SECURITY_INTEGER}
  139. SECURITY_INTEGER = _SECURITY_INTEGER;
  140. {$EXTERNALSYM SECURITY_INTEGER}
  141. PSECURITY_INTEGER = ^SECURITY_INTEGER;
  142. {$EXTERNALSYM PSECURITY_INTEGER}
  143. // todo Timestamp was removed from SSPI in August 2001 PSDK, where is it now?!
  144. {$IFNDEF JWA_INCLUDEMODE}
  145. TimeStamp = SECURITY_INTEGER;
  146. {$EXTERNALSYM TimeStamp}
  147. {$ENDIF JWA_INCLUDEMODE}
  148. PTimeStamp = ^SECURITY_INTEGER;
  149. {$EXTERNALSYM PTimeStamp}
  150. {$IFNDEF JWA_INCLUDEMODE}
  151. TTimeStamp = TimeStamp;
  152. {$ENDIF JWA_INCLUDEMODE}
  153. //
  154. // If we are in 32 bit mode, define the SECURITY_STRING structure,
  155. // as a clone of the base UNICODE_STRING structure. This is used
  156. // internally in security components, an as the string interface
  157. // for kernel components (e.g. FSPs)
  158. //
  159. SECURITY_STRING = UNICODE_STRING;
  160. {$EXTERNALSYM SECURITY_STRING}
  161. PSECURITY_STRING = ^SECURITY_STRING;
  162. {$EXTERNALSYM PSECURITY_STRING}
  163. TSecurityString = SECURITY_STRING;
  164. PSecurityString = PSECURITY_STRING;
  165. //
  166. // SecPkgInfo structure
  167. //
  168. // Provides general information about a security provider
  169. //
  170. PSecPkgInfoW = ^SecPkgInfoW;
  171. {$EXTERNALSYM PSecPkgInfoW}
  172. _SecPkgInfoW = record
  173. fCapabilities: Cardinal; // Capability bitmask
  174. wVersion: Word; // Version of driver
  175. wRPCID: Word; // ID for RPC Runtime
  176. cbMaxToken: Cardinal; // Size of authentication token (max)
  177. Name: PSecWChar; // Text name
  178. Comment: PSecWChar; // Comment
  179. end;
  180. {$EXTERNALSYM _SecPkgInfoW}
  181. SecPkgInfoW = _SecPkgInfoW;
  182. {$EXTERNALSYM SecPkgInfoW}
  183. TSecPkgInfoW = SecPkgInfoW;
  184. PSecPkgInfoA = ^SecPkgInfoA;
  185. {$EXTERNALSYM PSecPkgInfoA}
  186. _SecPkgInfoA = record
  187. fCapabilities: Cardinal; // Capability bitmask
  188. wVersion: Word; // Version of driver
  189. wRPCID: Word; // ID for RPC Runtime
  190. cbMaxToken: Cardinal; // Size of authentication token (max)
  191. Name: PSecChar; // Text name
  192. Comment: PSecChar; // Comment
  193. end;
  194. {$EXTERNALSYM _SecPkgInfoA}
  195. SecPkgInfoA = _SecPkgInfoA;
  196. {$EXTERNALSYM SecPkgInfoA}
  197. TSecPkgInfoA = SecPkgInfoA;
  198. {$IFDEF UNICODE}
  199. SecPkgInfo = SecPkgInfoW;
  200. {$EXTERNALSYM SecPkgInfo}
  201. PSecPkgInfo = PSecPkgInfoW;
  202. {$EXTERNALSYM PSecPkgInfo}
  203. TSecPkgInfo = TSecPkgInfoW;
  204. {$ELSE}
  205. SecPkgInfo = SecPkgInfoA;
  206. {$EXTERNALSYM SecPkgInfo}
  207. PSecPkgInfo = PSecPkgInfoA;
  208. {$EXTERNALSYM PSecPkgInfo}
  209. TSecPkgInfo = TSecPkgInfoA;
  210. {$ENDIF UNICODE}
  211. //
  212. // Security Package Capabilities
  213. //
  214. const
  215. SECPKG_FLAG_INTEGRITY = $00000001; // Supports integrity on messages
  216. {$EXTERNALSYM SECPKG_FLAG_INTEGRITY}
  217. SECPKG_FLAG_PRIVACY = $00000002; // Supports privacy (confidentiality)
  218. {$EXTERNALSYM SECPKG_FLAG_PRIVACY}
  219. SECPKG_FLAG_TOKEN_ONLY = $00000004; // Only security token needed
  220. {$EXTERNALSYM SECPKG_FLAG_TOKEN_ONLY}
  221. SECPKG_FLAG_DATAGRAM = $00000008; // Datagram RPC support
  222. {$EXTERNALSYM SECPKG_FLAG_DATAGRAM}
  223. SECPKG_FLAG_CONNECTION = $00000010; // Connection oriented RPC support
  224. {$EXTERNALSYM SECPKG_FLAG_CONNECTION}
  225. SECPKG_FLAG_MULTI_REQUIRED = $00000020; // Full 3-leg required for re-auth.
  226. {$EXTERNALSYM SECPKG_FLAG_MULTI_REQUIRED}
  227. SECPKG_FLAG_CLIENT_ONLY = $00000040; // Server side functionality not available
  228. {$EXTERNALSYM SECPKG_FLAG_CLIENT_ONLY}
  229. SECPKG_FLAG_EXTENDED_ERROR = $00000080; // Supports extended error msgs
  230. {$EXTERNALSYM SECPKG_FLAG_EXTENDED_ERROR}
  231. SECPKG_FLAG_IMPERSONATION = $00000100; // Supports impersonation
  232. {$EXTERNALSYM SECPKG_FLAG_IMPERSONATION}
  233. SECPKG_FLAG_ACCEPT_WIN32_NAME = $00000200; // Accepts Win32 names
  234. {$EXTERNALSYM SECPKG_FLAG_ACCEPT_WIN32_NAME}
  235. SECPKG_FLAG_STREAM = $00000400; // Supports stream semantics
  236. {$EXTERNALSYM SECPKG_FLAG_STREAM}
  237. SECPKG_FLAG_NEGOTIABLE = $00000800; // Can be used by the negotiate package
  238. {$EXTERNALSYM SECPKG_FLAG_NEGOTIABLE}
  239. SECPKG_FLAG_GSS_COMPATIBLE = $00001000; // GSS Compatibility Available
  240. {$EXTERNALSYM SECPKG_FLAG_GSS_COMPATIBLE}
  241. SECPKG_FLAG_LOGON = $00002000; // Supports common LsaLogonUser
  242. {$EXTERNALSYM SECPKG_FLAG_LOGON}
  243. SECPKG_FLAG_ASCII_BUFFERS = $00004000; // Token Buffers are in ASCII
  244. {$EXTERNALSYM SECPKG_FLAG_ASCII_BUFFERS}
  245. SECPKG_FLAG_FRAGMENT = $00008000; // Package can fragment to fit
  246. {$EXTERNALSYM SECPKG_FLAG_FRAGMENT}
  247. SECPKG_FLAG_MUTUAL_AUTH = $00010000; // Package can perform mutual authentication
  248. {$EXTERNALSYM SECPKG_FLAG_MUTUAL_AUTH}
  249. SECPKG_FLAG_DELEGATION = $00020000; // Package can delegate
  250. {$EXTERNALSYM SECPKG_FLAG_DELEGATION}
  251. SECPKG_ID_NONE = $FFFF;
  252. {$EXTERNALSYM SECPKG_ID_NONE}
  253. //
  254. // SecBuffer
  255. //
  256. // Generic memory descriptors for buffers passed in to the security
  257. // API
  258. //
  259. type
  260. PSecBuffer = ^SecBuffer;
  261. {$EXTERNALSYM PSecBuffer}
  262. _SecBuffer = record
  263. cbBuffer: Cardinal; // Size of the buffer, in bytes
  264. BufferType: Cardinal; // Type of the buffer (below)
  265. pvBuffer: Pointer; // Pointer to the buffer
  266. end;
  267. {$EXTERNALSYM _SecBuffer}
  268. SecBuffer = _SecBuffer;
  269. {$EXTERNALSYM SecBuffer}
  270. TSecBuffer = SecBuffer;
  271. PSecBufferDesc = ^SecBufferDesc;
  272. {$EXTERNALSYM PSecBufferDesc}
  273. _SecBufferDesc = record
  274. ulVersion: Cardinal; // Version number
  275. cBuffers: Cardinal; // Number of buffers
  276. pBuffers: PSecBuffer; // Pointer to array of buffers
  277. end;
  278. {$EXTERNALSYM _SecBufferDesc}
  279. SecBufferDesc = _SecBufferDesc;
  280. {$EXTERNALSYM SecBufferDesc}
  281. TSecBufferDesc = SecBufferDesc;
  282. const
  283. SECBUFFER_VERSION = 0;
  284. {$EXTERNALSYM SECBUFFER_VERSION}
  285. SECBUFFER_EMPTY = 0; // Undefined, replaced by provider
  286. {$EXTERNALSYM SECBUFFER_EMPTY}
  287. SECBUFFER_DATA = 1; // Packet data
  288. {$EXTERNALSYM SECBUFFER_DATA}
  289. SECBUFFER_TOKEN = 2; // Security token
  290. {$EXTERNALSYM SECBUFFER_TOKEN}
  291. SECBUFFER_PKG_PARAMS = 3; // Package specific parameters
  292. {$EXTERNALSYM SECBUFFER_PKG_PARAMS}
  293. SECBUFFER_MISSING = 4; // Missing Data indicator
  294. {$EXTERNALSYM SECBUFFER_MISSING}
  295. SECBUFFER_EXTRA = 5; // Extra data
  296. {$EXTERNALSYM SECBUFFER_EXTRA}
  297. SECBUFFER_STREAM_TRAILER = 6; // Security Trailer
  298. {$EXTERNALSYM SECBUFFER_STREAM_TRAILER}
  299. SECBUFFER_STREAM_HEADER = 7; // Security Header
  300. {$EXTERNALSYM SECBUFFER_STREAM_HEADER}
  301. SECBUFFER_NEGOTIATION_INFO = 8; // Hints from the negotiation pkg
  302. {$EXTERNALSYM SECBUFFER_NEGOTIATION_INFO}
  303. SECBUFFER_PADDING = 9; // non-data padding
  304. {$EXTERNALSYM SECBUFFER_PADDING}
  305. SECBUFFER_STREAM = 10; // whole encrypted message
  306. {$EXTERNALSYM SECBUFFER_STREAM}
  307. SECBUFFER_MECHLIST = 11;
  308. {$EXTERNALSYM SECBUFFER_MECHLIST}
  309. SECBUFFER_MECHLIST_SIGNATURE = 12;
  310. {$EXTERNALSYM SECBUFFER_MECHLIST_SIGNATURE}
  311. SECBUFFER_TARGET = 13;
  312. {$EXTERNALSYM SECBUFFER_TARGET}
  313. SECBUFFER_CHANNEL_BINDINGS = 14;
  314. {$EXTERNALSYM SECBUFFER_CHANNEL_BINDINGS}
  315. SECBUFFER_ATTRMASK = DWORD($F0000000);
  316. {$EXTERNALSYM SECBUFFER_ATTRMASK}
  317. SECBUFFER_READONLY = DWORD($80000000); // Buffer is read-only
  318. {$EXTERNALSYM SECBUFFER_READONLY}
  319. SECBUFFER_READONLY_WITH_CHECKSUM = $10000000; // Buffer is read-only, and checksummed
  320. {$EXTERNALSYM SECBUFFER_READONLY_WITH_CHECKSUM}
  321. SECBUFFER_RESERVED = DWORD($60000000); // Flags reserved to security system
  322. {$EXTERNALSYM SECBUFFER_RESERVED}
  323. type
  324. PSEC_NEGOTIATION_INFO = ^SEC_NEGOTIATION_INFO;
  325. {$EXTERNALSYM PSEC_NEGOTIATION_INFO}
  326. _SEC_NEGOTIATION_INFO = record
  327. Size: Cardinal; // Size of this structure
  328. NameLength: Cardinal; // Length of name hint
  329. Name: PSecWChar; // Name hint
  330. Reserved: Pointer; // Reserved
  331. end;
  332. {$EXTERNALSYM _SEC_NEGOTIATION_INFO}
  333. SEC_NEGOTIATION_INFO = _SEC_NEGOTIATION_INFO;
  334. {$EXTERNALSYM SEC_NEGOTIATION_INFO}
  335. TSecNegotiationInfo = SEC_NEGOTIATION_INFO;
  336. PSecNegotiationInfo = PSEC_NEGOTIATION_INFO;
  337. _SEC_CHANNEL_BINDINGS = record
  338. dwInitiatorAddrType: Cardinal;
  339. cbInitiatorLength: Cardinal;
  340. dwInitiatorOffset: Cardinal;
  341. dwAcceptorAddrType: Cardinal;
  342. cbAcceptorLength: Cardinal;
  343. dwAcceptorOffset: Cardinal;
  344. cbApplicationDataLength: Cardinal;
  345. dwApplicationDataOffset: Cardinal;
  346. end;
  347. {$EXTERNALSYM _SEC_CHANNEL_BINDINGS}
  348. SEC_CHANNEL_BINDINGS = _SEC_CHANNEL_BINDINGS;
  349. {$EXTERNALSYM SEC_CHANNEL_BINDINGS}
  350. PSEC_CHANNEL_BINDINGS = ^SEC_CHANNEL_BINDINGS;
  351. {$EXTERNALSYM PSEC_CHANNEL_BINDINGS}
  352. TSecChannelBindings = SEC_CHANNEL_BINDINGS;
  353. PSecChannelBindings = PSEC_CHANNEL_BINDINGS;
  354. //
  355. // Data Representation Constant:
  356. //
  357. const
  358. SECURITY_NATIVE_DREP = $00000010;
  359. {$EXTERNALSYM SECURITY_NATIVE_DREP}
  360. SECURITY_NETWORK_DREP = $00000000;
  361. {$EXTERNALSYM SECURITY_NETWORK_DREP}
  362. //
  363. // Credential Use Flags
  364. //
  365. SECPKG_CRED_INBOUND = $00000001;
  366. {$EXTERNALSYM SECPKG_CRED_INBOUND}
  367. SECPKG_CRED_OUTBOUND = $00000002;
  368. {$EXTERNALSYM SECPKG_CRED_OUTBOUND}
  369. SECPKG_CRED_BOTH = $00000003;
  370. {$EXTERNALSYM SECPKG_CRED_BOTH}
  371. SECPKG_CRED_DEFAULT = $00000004;
  372. {$EXTERNALSYM SECPKG_CRED_DEFAULT}
  373. SECPKG_CRED_RESERVED = DWORD($F0000000);
  374. {$EXTERNALSYM SECPKG_CRED_RESERVED}
  375. //
  376. // InitializeSecurityContext Requirement and return flags:
  377. //
  378. ISC_REQ_DELEGATE = $00000001;
  379. {$EXTERNALSYM ISC_REQ_DELEGATE}
  380. ISC_REQ_MUTUAL_AUTH = $00000002;
  381. {$EXTERNALSYM ISC_REQ_MUTUAL_AUTH}
  382. ISC_REQ_REPLAY_DETECT = $00000004;
  383. {$EXTERNALSYM ISC_REQ_REPLAY_DETECT}
  384. ISC_REQ_SEQUENCE_DETECT = $00000008;
  385. {$EXTERNALSYM ISC_REQ_SEQUENCE_DETECT}
  386. ISC_REQ_CONFIDENTIALITY = $00000010;
  387. {$EXTERNALSYM ISC_REQ_CONFIDENTIALITY}
  388. ISC_REQ_USE_SESSION_KEY = $00000020;
  389. {$EXTERNALSYM ISC_REQ_USE_SESSION_KEY}
  390. ISC_REQ_PROMPT_FOR_CREDS = $00000040;
  391. {$EXTERNALSYM ISC_REQ_PROMPT_FOR_CREDS}
  392. ISC_REQ_USE_SUPPLIED_CREDS = $00000080;
  393. {$EXTERNALSYM ISC_REQ_USE_SUPPLIED_CREDS}
  394. ISC_REQ_ALLOCATE_MEMORY = $00000100;
  395. {$EXTERNALSYM ISC_REQ_ALLOCATE_MEMORY}
  396. ISC_REQ_USE_DCE_STYLE = $00000200;
  397. {$EXTERNALSYM ISC_REQ_USE_DCE_STYLE}
  398. ISC_REQ_DATAGRAM = $00000400;
  399. {$EXTERNALSYM ISC_REQ_DATAGRAM}
  400. ISC_REQ_CONNECTION = $00000800;
  401. {$EXTERNALSYM ISC_REQ_CONNECTION}
  402. ISC_REQ_CALL_LEVEL = $00001000;
  403. {$EXTERNALSYM ISC_REQ_CALL_LEVEL}
  404. ISC_REQ_FRAGMENT_SUPPLIED = $00002000;
  405. {$EXTERNALSYM ISC_REQ_FRAGMENT_SUPPLIED}
  406. ISC_REQ_EXTENDED_ERROR = $00004000;
  407. {$EXTERNALSYM ISC_REQ_EXTENDED_ERROR}
  408. ISC_REQ_STREAM = $00008000;
  409. {$EXTERNALSYM ISC_REQ_STREAM}
  410. ISC_REQ_INTEGRITY = $00010000;
  411. {$EXTERNALSYM ISC_REQ_INTEGRITY}
  412. ISC_REQ_IDENTIFY = $00020000;
  413. {$EXTERNALSYM ISC_REQ_IDENTIFY}
  414. ISC_REQ_NULL_SESSION = $00040000;
  415. {$EXTERNALSYM ISC_REQ_NULL_SESSION}
  416. ISC_REQ_MANUAL_CRED_VALIDATION = $00080000;
  417. {$EXTERNALSYM ISC_REQ_MANUAL_CRED_VALIDATION}
  418. ISC_REQ_RESERVED1 = $00100000;
  419. {$EXTERNALSYM ISC_REQ_RESERVED1}
  420. ISC_REQ_FRAGMENT_TO_FIT = $00200000;
  421. {$EXTERNALSYM ISC_REQ_FRAGMENT_TO_FIT}
  422. ISC_RET_DELEGATE = $00000001;
  423. {$EXTERNALSYM ISC_RET_DELEGATE}
  424. ISC_RET_MUTUAL_AUTH = $00000002;
  425. {$EXTERNALSYM ISC_RET_MUTUAL_AUTH}
  426. ISC_RET_REPLAY_DETECT = $00000004;
  427. {$EXTERNALSYM ISC_RET_REPLAY_DETECT}
  428. ISC_RET_SEQUENCE_DETECT = $00000008;
  429. {$EXTERNALSYM ISC_RET_SEQUENCE_DETECT}
  430. ISC_RET_CONFIDENTIALITY = $00000010;
  431. {$EXTERNALSYM ISC_RET_CONFIDENTIALITY}
  432. ISC_RET_USE_SESSION_KEY = $00000020;
  433. {$EXTERNALSYM ISC_RET_USE_SESSION_KEY}
  434. ISC_RET_USED_COLLECTED_CREDS = $00000040;
  435. {$EXTERNALSYM ISC_RET_USED_COLLECTED_CREDS}
  436. ISC_RET_USED_SUPPLIED_CREDS = $00000080;
  437. {$EXTERNALSYM ISC_RET_USED_SUPPLIED_CREDS}
  438. ISC_RET_ALLOCATED_MEMORY = $00000100;
  439. {$EXTERNALSYM ISC_RET_ALLOCATED_MEMORY}
  440. ISC_RET_USED_DCE_STYLE = $00000200;
  441. {$EXTERNALSYM ISC_RET_USED_DCE_STYLE}
  442. ISC_RET_DATAGRAM = $00000400;
  443. {$EXTERNALSYM ISC_RET_DATAGRAM}
  444. ISC_RET_CONNECTION = $00000800;
  445. {$EXTERNALSYM ISC_RET_CONNECTION}
  446. ISC_RET_INTERMEDIATE_RETURN = $00001000;
  447. {$EXTERNALSYM ISC_RET_INTERMEDIATE_RETURN}
  448. ISC_RET_CALL_LEVEL = $00002000;
  449. {$EXTERNALSYM ISC_RET_CALL_LEVEL}
  450. ISC_RET_EXTENDED_ERROR = $00004000;
  451. {$EXTERNALSYM ISC_RET_EXTENDED_ERROR}
  452. ISC_RET_STREAM = $00008000;
  453. {$EXTERNALSYM ISC_RET_STREAM}
  454. ISC_RET_INTEGRITY = $00010000;
  455. {$EXTERNALSYM ISC_RET_INTEGRITY}
  456. ISC_RET_IDENTIFY = $00020000;
  457. {$EXTERNALSYM ISC_RET_IDENTIFY}
  458. ISC_RET_NULL_SESSION = $00040000;
  459. {$EXTERNALSYM ISC_RET_NULL_SESSION}
  460. ISC_RET_MANUAL_CRED_VALIDATION = $00080000;
  461. {$EXTERNALSYM ISC_RET_MANUAL_CRED_VALIDATION}
  462. ISC_RET_RESERVED1 = $00100000;
  463. {$EXTERNALSYM ISC_RET_RESERVED1}
  464. ISC_RET_FRAGMENT_ONLY = $00200000;
  465. {$EXTERNALSYM ISC_RET_FRAGMENT_ONLY}
  466. ASC_REQ_DELEGATE = $00000001;
  467. {$EXTERNALSYM ASC_REQ_DELEGATE}
  468. ASC_REQ_MUTUAL_AUTH = $00000002;
  469. {$EXTERNALSYM ASC_REQ_MUTUAL_AUTH}
  470. ASC_REQ_REPLAY_DETECT = $00000004;
  471. {$EXTERNALSYM ASC_REQ_REPLAY_DETECT}
  472. ASC_REQ_SEQUENCE_DETECT = $00000008;
  473. {$EXTERNALSYM ASC_REQ_SEQUENCE_DETECT}
  474. ASC_REQ_CONFIDENTIALITY = $00000010;
  475. {$EXTERNALSYM ASC_REQ_CONFIDENTIALITY}
  476. ASC_REQ_USE_SESSION_KEY = $00000020;
  477. {$EXTERNALSYM ASC_REQ_USE_SESSION_KEY}
  478. ASC_REQ_ALLOCATE_MEMORY = $00000100;
  479. {$EXTERNALSYM ASC_REQ_ALLOCATE_MEMORY}
  480. ASC_REQ_USE_DCE_STYLE = $00000200;
  481. {$EXTERNALSYM ASC_REQ_USE_DCE_STYLE}
  482. ASC_REQ_DATAGRAM = $00000400;
  483. {$EXTERNALSYM ASC_REQ_DATAGRAM}
  484. ASC_REQ_CONNECTION = $00000800;
  485. {$EXTERNALSYM ASC_REQ_CONNECTION}
  486. ASC_REQ_CALL_LEVEL = $00001000;
  487. {$EXTERNALSYM ASC_REQ_CALL_LEVEL}
  488. ASC_REQ_EXTENDED_ERROR = $00008000;
  489. {$EXTERNALSYM ASC_REQ_EXTENDED_ERROR}
  490. ASC_REQ_STREAM = $00010000;
  491. {$EXTERNALSYM ASC_REQ_STREAM}
  492. ASC_REQ_INTEGRITY = $00020000;
  493. {$EXTERNALSYM ASC_REQ_INTEGRITY}
  494. ASC_REQ_LICENSING = $00040000;
  495. {$EXTERNALSYM ASC_REQ_LICENSING}
  496. ASC_REQ_IDENTIFY = $00080000;
  497. {$EXTERNALSYM ASC_REQ_IDENTIFY}
  498. ASC_REQ_ALLOW_NULL_SESSION = $00100000;
  499. {$EXTERNALSYM ASC_REQ_ALLOW_NULL_SESSION}
  500. ASC_REQ_ALLOW_NON_USER_LOGONS = $00200000;
  501. {$EXTERNALSYM ASC_REQ_ALLOW_NON_USER_LOGONS}
  502. ASC_REQ_ALLOW_CONTEXT_REPLAY = $00400000;
  503. {$EXTERNALSYM ASC_REQ_ALLOW_CONTEXT_REPLAY}
  504. ASC_REQ_FRAGMENT_TO_FIT = $00800000;
  505. {$EXTERNALSYM ASC_REQ_FRAGMENT_TO_FIT}
  506. ASC_REQ_FRAGMENT_SUPPLIED = $00002000;
  507. {$EXTERNALSYM ASC_REQ_FRAGMENT_SUPPLIED}
  508. ASC_REQ_NO_TOKEN = $01000000;
  509. {$EXTERNALSYM ASC_REQ_NO_TOKEN}
  510. ASC_RET_DELEGATE = $00000001;
  511. {$EXTERNALSYM ASC_RET_DELEGATE}
  512. ASC_RET_MUTUAL_AUTH = $00000002;
  513. {$EXTERNALSYM ASC_RET_MUTUAL_AUTH}
  514. ASC_RET_REPLAY_DETECT = $00000004;
  515. {$EXTERNALSYM ASC_RET_REPLAY_DETECT}
  516. ASC_RET_SEQUENCE_DETECT = $00000008;
  517. {$EXTERNALSYM ASC_RET_SEQUENCE_DETECT}
  518. ASC_RET_CONFIDENTIALITY = $00000010;
  519. {$EXTERNALSYM ASC_RET_CONFIDENTIALITY}
  520. ASC_RET_USE_SESSION_KEY = $00000020;
  521. {$EXTERNALSYM ASC_RET_USE_SESSION_KEY}
  522. ASC_RET_ALLOCATED_MEMORY = $00000100;
  523. {$EXTERNALSYM ASC_RET_ALLOCATED_MEMORY}
  524. ASC_RET_USED_DCE_STYLE = $00000200;
  525. {$EXTERNALSYM ASC_RET_USED_DCE_STYLE}
  526. ASC_RET_DATAGRAM = $00000400;
  527. {$EXTERNALSYM ASC_RET_DATAGRAM}
  528. ASC_RET_CONNECTION = $00000800;
  529. {$EXTERNALSYM ASC_RET_CONNECTION}
  530. ASC_RET_CALL_LEVEL = $00002000; // skipped 1000 to be like ISC_
  531. {$EXTERNALSYM ASC_RET_CALL_LEVEL}
  532. ASC_RET_THIRD_LEG_FAILED = $00004000;
  533. {$EXTERNALSYM ASC_RET_THIRD_LEG_FAILED}
  534. ASC_RET_EXTENDED_ERROR = $00008000;
  535. {$EXTERNALSYM ASC_RET_EXTENDED_ERROR}
  536. ASC_RET_STREAM = $00010000;
  537. {$EXTERNALSYM ASC_RET_STREAM}
  538. ASC_RET_INTEGRITY = $00020000;
  539. {$EXTERNALSYM ASC_RET_INTEGRITY}
  540. ASC_RET_LICENSING = $00040000;
  541. {$EXTERNALSYM ASC_RET_LICENSING}
  542. ASC_RET_IDENTIFY = $00080000;
  543. {$EXTERNALSYM ASC_RET_IDENTIFY}
  544. ASC_RET_NULL_SESSION = $00100000;
  545. {$EXTERNALSYM ASC_RET_NULL_SESSION}
  546. ASC_RET_ALLOW_NON_USER_LOGONS = $00200000;
  547. {$EXTERNALSYM ASC_RET_ALLOW_NON_USER_LOGONS}
  548. ASC_RET_ALLOW_CONTEXT_REPLAY = $00400000;
  549. {$EXTERNALSYM ASC_RET_ALLOW_CONTEXT_REPLAY}
  550. ASC_RET_FRAGMENT_ONLY = $00800000;
  551. {$EXTERNALSYM ASC_RET_FRAGMENT_ONLY}
  552. ASC_RET_NO_TOKEN = $01000000;
  553. {$EXTERNALSYM ASC_RET_NO_TOKEN}
  554. //
  555. // Security Credentials Attributes:
  556. //
  557. SECPKG_CRED_ATTR_NAMES = 1;
  558. {$EXTERNALSYM SECPKG_CRED_ATTR_NAMES}
  559. type
  560. PSecPkgCredentials_NamesW = ^SecPkgCredentials_NamesW;
  561. {$EXTERNALSYM PSecPkgCredentials_NamesW}
  562. _SecPkgCredentials_NamesW = record
  563. sUserName: PSecWChar;
  564. end;
  565. {$EXTERNALSYM _SecPkgCredentials_NamesW}
  566. SecPkgCredentials_NamesW = _SecPkgCredentials_NamesW;
  567. {$EXTERNALSYM SecPkgCredentials_NamesW}
  568. TSecPkgCredentialsNamesW = SecPkgCredentials_NamesW;
  569. PSecPkgCredentialsNamesW = PSecPkgCredentials_NamesW;
  570. PSecPkgCredentials_NamesA = ^SecPkgCredentials_NamesA;
  571. {$EXTERNALSYM PSecPkgCredentials_NamesA}
  572. _SecPkgCredentials_NamesA = record
  573. sUserName: PSecChar;
  574. end;
  575. {$EXTERNALSYM _SecPkgCredentials_NamesA}
  576. SecPkgCredentials_NamesA = _SecPkgCredentials_NamesA;
  577. {$EXTERNALSYM SecPkgCredentials_NamesA}
  578. TSecPkgCredentialsNamesA = SecPkgCredentials_NamesA;
  579. PSecPkgCredentialsNamesA = PSecPkgCredentials_NamesA;
  580. {$IFDEF UNICODE}
  581. SecPkgCredentials_Names = SecPkgCredentials_NamesW;
  582. {$EXTERNALSYM SecPkgCredentials_Names}
  583. PSecPkgCredentials_Names = PSecPkgCredentials_NamesW;
  584. {$EXTERNALSYM PSecPkgCredentials_Names}
  585. TSecPkgCredentialsNames = TSecPkgCredentialsNamesW;
  586. PSecPkgCredentialsNames = PSecPkgCredentialsNamesW;
  587. {$ELSE}
  588. SecPkgCredentials_Names = SecPkgCredentials_NamesA;
  589. {$EXTERNALSYM SecPkgCredentials_Names}
  590. PSecPkgCredentials_Names = PSecPkgCredentials_NamesA;
  591. {$EXTERNALSYM PSecPkgCredentials_Names}
  592. TSecPkgCredentialsNames = TSecPkgCredentialsNamesA;
  593. PSecPkgCredentialsNames = PSecPkgCredentialsNamesA;
  594. {$ENDIF UNICODE}
  595. //
  596. // Security Context Attributes:
  597. //
  598. const
  599. SECPKG_ATTR_SIZES = 0;
  600. {$EXTERNALSYM SECPKG_ATTR_SIZES}
  601. SECPKG_ATTR_NAMES = 1;
  602. {$EXTERNALSYM SECPKG_ATTR_NAMES}
  603. SECPKG_ATTR_LIFESPAN = 2;
  604. {$EXTERNALSYM SECPKG_ATTR_LIFESPAN}
  605. SECPKG_ATTR_DCE_INFO = 3;
  606. {$EXTERNALSYM SECPKG_ATTR_DCE_INFO}
  607. SECPKG_ATTR_STREAM_SIZES = 4;
  608. {$EXTERNALSYM SECPKG_ATTR_STREAM_SIZES}
  609. SECPKG_ATTR_KEY_INFO = 5;
  610. {$EXTERNALSYM SECPKG_ATTR_KEY_INFO}
  611. SECPKG_ATTR_AUTHORITY = 6;
  612. {$EXTERNALSYM SECPKG_ATTR_AUTHORITY}
  613. SECPKG_ATTR_PROTO_INFO = 7;
  614. {$EXTERNALSYM SECPKG_ATTR_PROTO_INFO}
  615. SECPKG_ATTR_PASSWORD_EXPIRY = 8;
  616. {$EXTERNALSYM SECPKG_ATTR_PASSWORD_EXPIRY}
  617. SECPKG_ATTR_SESSION_KEY = 9;
  618. {$EXTERNALSYM SECPKG_ATTR_SESSION_KEY}
  619. SECPKG_ATTR_PACKAGE_INFO = 10;
  620. {$EXTERNALSYM SECPKG_ATTR_PACKAGE_INFO}
  621. SECPKG_ATTR_USER_FLAGS = 11;
  622. {$EXTERNALSYM SECPKG_ATTR_USER_FLAGS}
  623. SECPKG_ATTR_NEGOTIATION_INFO = 12;
  624. {$EXTERNALSYM SECPKG_ATTR_NEGOTIATION_INFO}
  625. SECPKG_ATTR_NATIVE_NAMES = 13;
  626. {$EXTERNALSYM SECPKG_ATTR_NATIVE_NAMES}
  627. SECPKG_ATTR_FLAGS = 14;
  628. {$EXTERNALSYM SECPKG_ATTR_FLAGS}
  629. SECPKG_ATTR_USE_VALIDATED = 15;
  630. {$EXTERNALSYM SECPKG_ATTR_USE_VALIDATED}
  631. SECPKG_ATTR_CREDENTIAL_NAME = 16;
  632. {$EXTERNALSYM SECPKG_ATTR_CREDENTIAL_NAME}
  633. SECPKG_ATTR_TARGET_INFORMATION = 17;
  634. {$EXTERNALSYM SECPKG_ATTR_TARGET_INFORMATION}
  635. SECPKG_ATTR_ACCESS_TOKEN = 18;
  636. {$EXTERNALSYM SECPKG_ATTR_ACCESS_TOKEN}
  637. SECPKG_ATTR_TARGET = 19;
  638. {$EXTERNALSYM SECPKG_ATTR_TARGET}
  639. SECPKG_ATTR_AUTHENTICATION_ID = 20;
  640. {$EXTERNALSYM SECPKG_ATTR_AUTHENTICATION_ID}
  641. type
  642. PSecPkgContext_Sizes = ^SecPkgContext_Sizes;
  643. {$EXTERNALSYM PSecPkgContext_Sizes}
  644. _SecPkgContext_Sizes = record
  645. cbMaxToken: Cardinal;
  646. cbMaxSignature: Cardinal;
  647. cbBlockSize: Cardinal;
  648. cbSecurityTrailer: Cardinal;
  649. end;
  650. {$EXTERNALSYM _SecPkgContext_Sizes}
  651. SecPkgContext_Sizes = _SecPkgContext_Sizes;
  652. {$EXTERNALSYM SecPkgContext_Sizes}
  653. TSecPkgContextSizes = SecPkgContext_Sizes;
  654. PSecPkgContextSizes = PSecPkgContext_Sizes;
  655. PSecPkgContext_StreamSizes = ^SecPkgContext_StreamSizes;
  656. {$EXTERNALSYM PSecPkgContext_StreamSizes}
  657. _SecPkgContext_StreamSizes = record
  658. cbHeader: Cardinal;
  659. cbTrailer: Cardinal;
  660. cbMaximumMessage: Cardinal;
  661. cBuffers: Cardinal;
  662. cbBlockSize: Cardinal;
  663. end;
  664. {$EXTERNALSYM _SecPkgContext_StreamSizes}
  665. SecPkgContext_StreamSizes = _SecPkgContext_StreamSizes;
  666. {$EXTERNALSYM SecPkgContext_StreamSizes}
  667. TSecPkgContextStreamSizes = SecPkgContext_StreamSizes;
  668. PSecPkgContextStreamSizes = PSecPkgContext_StreamSizes;
  669. PSecPkgContext_NamesW = ^SecPkgContext_NamesW;
  670. {$EXTERNALSYM PSecPkgContext_NamesW}
  671. _SecPkgContext_NamesW = record
  672. sUserName: PSecWChar;
  673. end;
  674. {$EXTERNALSYM _SecPkgContext_NamesW}
  675. SecPkgContext_NamesW = _SecPkgContext_NamesW;
  676. {$EXTERNALSYM SecPkgContext_NamesW}
  677. TSecPkgContextNamesW = SecPkgContext_NamesW;
  678. PSecPkgContextNamesW = PSecPkgContext_NamesW;
  679. PSecPkgContext_NamesA = ^SecPkgContext_NamesA;
  680. {$EXTERNALSYM PSecPkgContext_NamesA}
  681. _SecPkgContext_NamesA = record
  682. sUserName: PSecChar;
  683. end;
  684. {$EXTERNALSYM _SecPkgContext_NamesA}
  685. SecPkgContext_NamesA = _SecPkgContext_NamesA;
  686. {$EXTERNALSYM SecPkgContext_NamesA}
  687. TSecPkgContextNamesA = SecPkgContext_NamesA;
  688. PSecPkgContextNamesA = PSecPkgContext_NamesA;
  689. {$IFDEF UNICODE}
  690. SecPkgContext_Names = SecPkgContext_NamesW;
  691. {$EXTERNALSYM SecPkgContext_Names}
  692. PSecPkgContext_Names = PSecPkgContext_NamesW;
  693. {$EXTERNALSYM PSecPkgContext_Names}
  694. TSecPkgContextNames = TSecPkgContextNamesW;
  695. PSecPkgContextNames = PSecPkgContextNamesW;
  696. {$ELSE}
  697. SecPkgContext_Names = SecPkgContext_NamesA;
  698. {$EXTERNALSYM SecPkgContext_Names}
  699. PSecPkgContext_Names = PSecPkgContext_NamesA;
  700. {$EXTERNALSYM PSecPkgContext_Names}
  701. TSecPkgContextNames = TSecPkgContextNamesA;
  702. PSecPkgContextNames = PSecPkgContextNamesA;
  703. {$ENDIF UNICODE}
  704. PSecPkgContext_LifeSpan = ^SecPkgContext_LifeSpan;
  705. {$EXTERNALSYM PSecPkgContext_LifeSpan}
  706. _SecPkgContext_Lifespan = record
  707. tsStart: TimeStamp;
  708. tsExpiry: TimeStamp;
  709. end;
  710. {$EXTERNALSYM _SecPkgContext_Lifespan}
  711. SecPkgContext_Lifespan = _SecPkgContext_Lifespan;
  712. {$EXTERNALSYM SecPkgContext_Lifespan}
  713. TSecPkgContextLifeSpan = SecPkgContext_Lifespan;
  714. PSecPkgContextLifeSpan = PSecPkgContext_LifeSpan;
  715. PSecPkgContext_DceInfo = ^SecPkgContext_DceInfo;
  716. {$EXTERNALSYM PSecPkgContext_DceInfo}
  717. _SecPkgContext_DceInfo = record
  718. AuthzSvc: Cardinal;
  719. pPac: Pointer;
  720. end;
  721. {$EXTERNALSYM _SecPkgContext_DceInfo}
  722. SecPkgContext_DceInfo = _SecPkgContext_DceInfo;
  723. {$EXTERNALSYM SecPkgContext_DceInfo}
  724. TSecPkgContextDceInfo = SecPkgContext_DceInfo;
  725. PSecPkgContextDceInfo = PSecPkgContext_DceInfo;
  726. PSecPkgContext_KeyInfoA = ^SecPkgContext_KeyInfoA;
  727. {$EXTERNALSYM PSecPkgContext_KeyInfoA}
  728. _SecPkgContext_KeyInfoA = record
  729. sSignatureAlgorithmName: PSecChar;
  730. sEncryptAlgorithmName: PSecChar;
  731. KeySize: Cardinal;
  732. SignatureAlgorithm: Cardinal;
  733. EncryptAlgorithm: Cardinal;
  734. end;
  735. {$EXTERNALSYM _SecPkgContext_KeyInfoA}
  736. SecPkgContext_KeyInfoA = _SecPkgContext_KeyInfoA;
  737. {$EXTERNALSYM SecPkgContext_KeyInfoA}
  738. TSecPkgContextKeyInfoA = SecPkgContext_KeyInfoA;
  739. PSecPkgContextKeyInfoA = PSecPkgContext_KeyInfoA;
  740. PSecPkgContext_KeyInfoW = ^SecPkgContext_KeyInfoW;
  741. {$EXTERNALSYM PSecPkgContext_KeyInfoW}
  742. _SecPkgContext_KeyInfoW = record
  743. sSignatureAlgorithmName: PSecWChar;
  744. sEncryptAlgorithmName: PSecWChar;
  745. KeySize: Cardinal;
  746. SignatureAlgorithm: Cardinal;
  747. EncryptAlgorithm: Cardinal;
  748. end;
  749. {$EXTERNALSYM _SecPkgContext_KeyInfoW}
  750. SecPkgContext_KeyInfoW = _SecPkgContext_KeyInfoW;
  751. {$EXTERNALSYM SecPkgContext_KeyInfoW}
  752. TSecPkgContextKeyInfoW = SecPkgContext_KeyInfoW;
  753. PSecPkgContextKeyInfoW = PSecPkgContext_KeyInfoW;
  754. {$IFDEF UNICODE}
  755. SecPkgContext_KeyInfo = SecPkgContext_KeyInfoW;
  756. {$EXTERNALSYM SecPkgContext_KeyInfo}
  757. PSecPkgContext_KeyInfo = PSecPkgContext_KeyInfoW;
  758. {$EXTERNALSYM PSecPkgContext_KeyInfo}
  759. TSecPkgContextKeyInfo = TSecPkgContextKeyInfoW;
  760. PSecPkgContextKeyInfo = PSecPkgContextKeyInfoW;
  761. {$ELSE}
  762. SecPkgContext_KeyInfo = SecPkgContext_KeyInfoA;
  763. {$EXTERNALSYM SecPkgContext_KeyInfo}
  764. PSecPkgContext_KeyInfo = PSecPkgContext_KeyInfoA;
  765. {$EXTERNALSYM PSecPkgContext_KeyInfo}
  766. TSecPkgContextKeyInfo = TSecPkgContextKeyInfoA;
  767. PSecPkgContextKeyInfo = PSecPkgContextKeyInfoA;
  768. {$ENDIF UNICODE}
  769. PSecPkgContext_AuthorityA = ^SecPkgContext_AuthorityA;
  770. {$EXTERNALSYM PSecPkgContext_AuthorityA}
  771. _SecPkgContext_AuthorityA = record
  772. sAuthorityName: PSecChar;
  773. end;
  774. {$EXTERNALSYM _SecPkgContext_AuthorityA}
  775. SecPkgContext_AuthorityA = _SecPkgContext_AuthorityA;
  776. {$EXTERNALSYM SecPkgContext_AuthorityA}
  777. TSecPkgContextAuthorityA = SecPkgContext_AuthorityA;
  778. PSecPkgContextAuthorityA = PSecPkgContext_AuthorityA;
  779. PSecPkgContext_AuthorityW = ^SecPkgContext_AuthorityW;
  780. {$EXTERNALSYM PSecPkgContext_AuthorityW}
  781. _SecPkgContext_AuthorityW = record
  782. sAuthorityName: PSecWChar;
  783. end;
  784. {$EXTERNALSYM _SecPkgContext_AuthorityW}
  785. SecPkgContext_AuthorityW = _SecPkgContext_AuthorityW;
  786. {$EXTERNALSYM SecPkgContext_AuthorityW}
  787. TSecPkgContextAuthorityW = SecPkgContext_AuthorityW;
  788. PSecPkgContextAuthorityW = PSecPkgContext_AuthorityW;
  789. {$IFDEF UNICODE}
  790. SecPkgContext_Authority = SecPkgContext_AuthorityW;
  791. {$EXTERNALSYM SecPkgContext_Authority}
  792. PSecPkgContext_Authority = PSecPkgContext_AuthorityW;
  793. {$EXTERNALSYM PSecPkgContext_Authority}
  794. TSecPkgContextAuthority = TSecPkgContextAuthorityW;
  795. PSecPkgContextAuthority = PSecPkgContextAuthorityW;
  796. {$ELSE}
  797. SecPkgContext_Authority = SecPkgContext_AuthorityA;
  798. {$EXTERNALSYM SecPkgContext_Authority}
  799. PSecPkgContext_Authority = PSecPkgContext_AuthorityA;
  800. {$EXTERNALSYM PSecPkgContext_Authority}
  801. TSecPkgContextAuthority = SecPkgContext_AuthorityA;
  802. PSecPkgContextAuthority = PSecPkgContext_AuthorityA;
  803. {$ENDIF UNICODE}
  804. PSecPkgContext_ProtoInfoA = ^SecPkgContext_ProtoInfoA;
  805. {$EXTERNALSYM PSecPkgContext_ProtoInfoA}
  806. _SecPkgContext_ProtoInfoA = record
  807. sProtocolName: PSecChar;
  808. majorVersion: Cardinal;
  809. minorVersion: Cardinal;
  810. end;
  811. {$EXTERNALSYM _SecPkgContext_ProtoInfoA}
  812. SecPkgContext_ProtoInfoA = _SecPkgContext_ProtoInfoA;
  813. {$EXTERNALSYM SecPkgContext_ProtoInfoA}
  814. TSecPkgContextProtoInfoA = SecPkgContext_ProtoInfoA;
  815. PSecPkgContextProtoInfoA = PSecPkgContext_ProtoInfoA;
  816. PSecPkgContext_ProtoInfoW = ^SecPkgContext_ProtoInfoW;
  817. {$EXTERNALSYM PSecPkgContext_ProtoInfoW}
  818. _SecPkgContext_ProtoInfoW = record
  819. sProtocolName: PSecWChar;
  820. majorVersion: Cardinal;
  821. minorVersion: Cardinal;
  822. end;
  823. {$EXTERNALSYM _SecPkgContext_ProtoInfoW}
  824. SecPkgContext_ProtoInfoW = _SecPkgContext_ProtoInfoW;
  825. {$EXTERNALSYM SecPkgContext_ProtoInfoW}
  826. TSecPkgContextProtoInfoW = SecPkgContext_ProtoInfoW;
  827. PSecPkgContextProtoInfoW = PSecPkgContext_ProtoInfoW;
  828. {$IFDEF UNICODE}
  829. SecPkgContext_ProtoInfo = SecPkgContext_ProtoInfoW;
  830. {$EXTERNALSYM SecPkgContext_ProtoInfo}
  831. PSecPkgContext_ProtoInfo = PSecPkgContext_ProtoInfoW;
  832. {$EXTERNALSYM PSecPkgContext_ProtoInfo}
  833. TSecPkgContextProtoInfo = TSecPkgContextProtoInfoW;
  834. PSecPkgContextProtoInfo = PSecPkgContextProtoInfoW;
  835. {$ELSE}
  836. SecPkgContext_ProtoInfo = SecPkgContext_ProtoInfoA;
  837. {$EXTERNALSYM SecPkgContext_ProtoInfo}
  838. PSecPkgContext_ProtoInfo = PSecPkgContext_ProtoInfoA;
  839. {$EXTERNALSYM PSecPkgContext_ProtoInfo}
  840. TSecPkgContextProtoInfo = TSecPkgContextProtoInfoA;
  841. PSecPkgContextProtoInfo = PSecPkgContextProtoInfoA;
  842. {$ENDIF UNICODE}
  843. PSecPkgContext_PasswordExpiry = ^SecPkgContext_PasswordExpiry;
  844. {$EXTERNALSYM PSecPkgContext_PasswordExpiry}
  845. _SecPkgContext_PasswordExpiry = record
  846. tsPasswordExpires: TimeStamp;
  847. end;
  848. {$EXTERNALSYM _SecPkgContext_PasswordExpiry}
  849. SecPkgContext_PasswordExpiry = _SecPkgContext_PasswordExpiry;
  850. {$EXTERNALSYM SecPkgContext_PasswordExpiry}
  851. TSecPkgContextPasswordExpiry = SecPkgContext_PasswordExpiry;
  852. PSecPkgContextPasswordExpiry = PSecPkgContext_PasswordExpiry;
  853. PSecPkgContext_SessionKey = ^SecPkgContext_SessionKey;
  854. {$EXTERNALSYM PSecPkgContext_SessionKey}
  855. _SecPkgContext_SessionKey = record
  856. SessionKeyLength: Cardinal;
  857. SessionKey: PByte;
  858. end;
  859. {$EXTERNALSYM _SecPkgContext_SessionKey}
  860. SecPkgContext_SessionKey = _SecPkgContext_SessionKey;
  861. {$EXTERNALSYM SecPkgContext_SessionKey}
  862. TSecPkgContextSessionKey = SecPkgContext_SessionKey;
  863. PSecPkgContextSessionKey = PSecPkgContext_SessionKey;
  864. PSecPkgContext_PackageInfoW = ^SecPkgContext_PackageInfoW;
  865. {$EXTERNALSYM PSecPkgContext_PackageInfoW}
  866. _SecPkgContext_PackageInfoW = record
  867. PackageInfo: PSecPkgInfoW;
  868. end;
  869. {$EXTERNALSYM _SecPkgContext_PackageInfoW}
  870. SecPkgContext_PackageInfoW = _SecPkgContext_PackageInfoW;
  871. {$EXTERNALSYM SecPkgContext_PackageInfoW}
  872. TSecPkgContextPackageInfoW = SecPkgContext_PackageInfoW;
  873. PSecPkgContextPackageInfoW = PSecPkgContext_PackageInfoW;
  874. PSecPkgContext_PackageInfoA = ^SecPkgContext_PackageInfoA;
  875. {$EXTERNALSYM PSecPkgContext_PackageInfoA}
  876. _SecPkgContext_PackageInfoA = record
  877. PackageInfo: PSecPkgInfoA;
  878. end;
  879. {$EXTERNALSYM _SecPkgContext_PackageInfoA}
  880. SecPkgContext_PackageInfoA = _SecPkgContext_PackageInfoA;
  881. {$EXTERNALSYM SecPkgContext_PackageInfoA}
  882. TSecPkgContextPackageInfoA = SecPkgContext_PackageInfoA;
  883. PSecPkgContextPackageInfoA = PSecPkgContext_PackageInfoA;
  884. PSecPkgContext_UserFlags = ^SecPkgContext_UserFlags;
  885. {$EXTERNALSYM PSecPkgContext_UserFlags}
  886. _SecPkgContext_UserFlags = record
  887. UserFlags: Cardinal;
  888. end;
  889. {$EXTERNALSYM _SecPkgContext_UserFlags}
  890. SecPkgContext_UserFlags = _SecPkgContext_UserFlags;
  891. {$EXTERNALSYM SecPkgContext_UserFlags}
  892. TSecPkgContextUserFlags = SecPkgContext_UserFlags;
  893. PSecPkgContextUserFlags = PSecPkgContext_UserFlags;
  894. PSecPkgContext_Flags = ^SecPkgContext_Flags;
  895. {$EXTERNALSYM PSecPkgContext_Flags}
  896. _SecPkgContext_Flags = record
  897. Flags: Cardinal;
  898. end;
  899. {$EXTERNALSYM _SecPkgContext_Flags}
  900. SecPkgContext_Flags = _SecPkgContext_Flags;
  901. {$EXTERNALSYM SecPkgContext_Flags}
  902. TSecPkgContextFlags = SecPkgContext_Flags;
  903. PSecPkgContextFlags = PSecPkgContext_Flags;
  904. {$IFDEF UNICODE}
  905. SecPkgContext_PackageInfo = SecPkgContext_PackageInfoW;
  906. {$EXTERNALSYM SecPkgContext_PackageInfo}
  907. PSecPkgContext_PackageInfo = PSecPkgContext_PackageInfoW;
  908. {$EXTERNALSYM PSecPkgContext_PackageInfo}
  909. TSecPkgContextPackageInfo = TSecPkgContextPackageInfoW;
  910. PSecPkgContextPackageInfo = PSecPkgContextPackageInfoW;
  911. {$ELSE}
  912. SecPkgContext_PackageInfo = SecPkgContext_PackageInfoA;
  913. {$EXTERNALSYM SecPkgContext_PackageInfo}
  914. PSecPkgContext_PackageInfo = PSecPkgContext_PackageInfoA;
  915. {$EXTERNALSYM PSecPkgContext_PackageInfo}
  916. TSecPkgContextPackageInfo = TSecPkgContextPackageInfoA;
  917. PSecPkgContextPackageInfo = PSecPkgContextPackageInfoA;
  918. {$ENDIF UNICODE}
  919. PSecPkgContext_NegotiationInfoA = ^SecPkgContext_NegotiationInfoA;
  920. {$EXTERNALSYM PSecPkgContext_NegotiationInfoA}
  921. _SecPkgContext_NegotiationInfoA = record
  922. PackageInfo: PSecPkgInfoA;
  923. NegotiationState: Cardinal;
  924. end;
  925. {$EXTERNALSYM _SecPkgContext_NegotiationInfoA}
  926. SecPkgContext_NegotiationInfoA = _SecPkgContext_NegotiationInfoA;
  927. {$EXTERNALSYM SecPkgContext_NegotiationInfoA}
  928. TSecPkgContextNegotiationInfoA = SecPkgContext_NegotiationInfoA;
  929. PSecPkgContextNegotiationInfoA = PSecPkgContext_NegotiationInfoA;
  930. PSecPkgContext_NegotiationInfoW = ^SecPkgContext_NegotiationInfoW;
  931. {$EXTERNALSYM PSecPkgContext_NegotiationInfoW}
  932. _SecPkgContext_NegotiationInfoW = record
  933. PackageInfo: PSecPkgInfoW;
  934. NegotiationState: Cardinal;
  935. end;
  936. {$EXTERNALSYM _SecPkgContext_NegotiationInfoW}
  937. SecPkgContext_NegotiationInfoW = _SecPkgContext_NegotiationInfoW;
  938. {$EXTERNALSYM SecPkgContext_NegotiationInfoW}
  939. TSecPkgContextNegotiationInfoW = SecPkgContext_NegotiationInfoW;
  940. PSecPkgContextNegotiationInfoW = PSecPkgContext_NegotiationInfoW ;
  941. {$IFDEF UNICODE}
  942. SecPkgContext_NegotiationInfo = SecPkgContext_NegotiationInfoW;
  943. {$EXTERNALSYM SecPkgContext_NegotiationInfo}
  944. PSecPkgContext_NegotiationInfo = PSecPkgContext_NegotiationInfoW;
  945. {$EXTERNALSYM PSecPkgContext_NegotiationInfo}
  946. TSecPkgContextNegotiationInfo = TSecPkgContextNegotiationInfoW;
  947. PSecPkgContextNegotiationInfo = PSecPkgContextNegotiationInfoW;
  948. {$ELSE}
  949. SecPkgContext_NegotiationInfo = SecPkgContext_NegotiationInfoA;
  950. {$EXTERNALSYM SecPkgContext_NegotiationInfo}
  951. PSecPkgContext_NegotiationInfo = PSecPkgContext_NegotiationInfoA;
  952. {$EXTERNALSYM PSecPkgContext_NegotiationInfo}
  953. TSecPkgContextNegotiationInfo = TSecPkgContextNegotiationInfoA;
  954. PSecPkgContextNegotiationInfo = PSecPkgContextNegotiationInfoA;
  955. {$ENDIF UNICODE}
  956. const
  957. SECPKG_NEGOTIATION_COMPLETE = 0;
  958. {$EXTERNALSYM SECPKG_NEGOTIATION_COMPLETE}
  959. SECPKG_NEGOTIATION_OPTIMISTIC = 1;
  960. {$EXTERNALSYM SECPKG_NEGOTIATION_OPTIMISTIC}
  961. SECPKG_NEGOTIATION_IN_PROGRESS = 2;
  962. {$EXTERNALSYM SECPKG_NEGOTIATION_IN_PROGRESS}
  963. SECPKG_NEGOTIATION_DIRECT = 3;
  964. {$EXTERNALSYM SECPKG_NEGOTIATION_DIRECT}
  965. SECPKG_NEGOTIATION_TRY_MULTICRED = 4;
  966. {$EXTERNALSYM SECPKG_NEGOTIATION_TRY_MULTICRED}
  967. type
  968. PSecPkgContext_NativeNamesW = ^SecPkgContext_NativeNamesW;
  969. {$EXTERNALSYM PSecPkgContext_NativeNamesW}
  970. _SecPkgContext_NativeNamesW = record
  971. sClientName: PSecWChar;
  972. sServerName: PSecWChar;
  973. end;
  974. {$EXTERNALSYM _SecPkgContext_NativeNamesW}
  975. SecPkgContext_NativeNamesW = _SecPkgContext_NativeNamesW;
  976. {$EXTERNALSYM SecPkgContext_NativeNamesW}
  977. TSecPkgContextNativeNamesW = SecPkgContext_NativeNamesW;
  978. PSecPkgContextNativeNamesW = PSecPkgContext_NativeNamesW;
  979. PSecPkgContext_NativeNamesA = ^SecPkgContext_NativeNamesA;
  980. {$EXTERNALSYM PSecPkgContext_NativeNamesA}
  981. _SecPkgContext_NativeNamesA = record
  982. sClientName: PSecChar;
  983. sServerName: PSecChar;
  984. end;
  985. {$EXTERNALSYM _SecPkgContext_NativeNamesA}
  986. SecPkgContext_NativeNamesA = _SecPkgContext_NativeNamesA;
  987. {$EXTERNALSYM SecPkgContext_NativeNamesA}
  988. TSecPkgContextNativeNamesA = SecPkgContext_NativeNamesA;
  989. PSecPkgContextNativeNamesA = PSecPkgContext_NativeNamesA;
  990. {$IFDEF UNICODE}
  991. SecPkgContext_NativeNames = SecPkgContext_NativeNamesW;
  992. {$EXTERNALSYM SecPkgContext_NativeNames}
  993. PSecPkgContext_NativeNames = PSecPkgContext_NativeNamesW;
  994. {$EXTERNALSYM PSecPkgContext_NativeNames}
  995. TSecPkgContextNativeNames = TSecPkgContextNativeNamesW;
  996. PSecPkgContextNativeNames = PSecPkgContextNativeNamesW;
  997. {$ELSE}
  998. SecPkgContext_NativeNames = SecPkgContext_NativeNamesA;
  999. {$EXTERNALSYM SecPkgContext_NativeNames}
  1000. PSecPkgContext_NativeNames = PSecPkgContext_NativeNamesA;
  1001. {$EXTERNALSYM PSecPkgContext_NativeNames}
  1002. TSecPkgContextNativeNames = TSecPkgContextNativeNamesA;
  1003. PSecPkgContextNativeNames = PSecPkgContextNativeNamesA;
  1004. {$ENDIF UNICODE}
  1005. _SecPkgContext_CredentialNameW = record
  1006. CredentialType: Cardinal;
  1007. sCredentialName: PSEC_WCHAR;
  1008. end;
  1009. {$EXTERNALSYM _SecPkgContext_CredentialNameW}
  1010. SecPkgContext_CredentialNameW = _SecPkgContext_CredentialNameW;
  1011. {$EXTERNALSYM SecPkgContext_CredentialNameW}
  1012. PSecPkgContext_CredentialNameW = ^SecPkgContext_CredentialNameW;
  1013. {$EXTERNALSYM PSecPkgContext_CredentialNameW}
  1014. TSecPkgContextCredentialNameW = SecPkgContext_CredentialNameW;
  1015. PSecPkgContextCredentialNameW = PSecPkgContext_CredentialNameW;
  1016. _SecPkgContext_CredentialNameA = record
  1017. CredentialType: Cardinal;
  1018. sCredentialName: PSEC_CHAR;
  1019. end;
  1020. {$EXTERNALSYM _SecPkgContext_CredentialNameA}
  1021. SecPkgContext_CredentialNameA = _SecPkgContext_CredentialNameA;
  1022. {$EXTERNALSYM SecPkgContext_CredentialNameA}
  1023. PSecPkgContext_CredentialNameA = ^SecPkgContext_CredentialNameA;
  1024. {$EXTERNALSYM PSecPkgContext_CredentialNameA}
  1025. TSecPkgContextCredentialNameA = SecPkgContext_CredentialNameA;
  1026. PSecPkgContextCredentialNameA = PSecPkgContext_CredentialNameA;
  1027. {$IFDEF UNICODE}
  1028. SecPkgContext_CredentialName = SecPkgContext_CredentialNameW;
  1029. {$EXTERNALSYM SecPkgContext_CredentialName}
  1030. PSecPkgContext_CredentialName = PSecPkgContext_CredentialNameW;
  1031. {$EXTERNALSYM PSecPkgContext_CredentialName}
  1032. TSecPkgContextCredentialName = TSecPkgContextCredentialNameW;
  1033. PSecPkgContextCredentialName = PSecPkgContextCredentialNameW;
  1034. {$ELSE}
  1035. SecPkgContext_CredentialName = SecPkgContext_CredentialNameA;
  1036. {$EXTERNALSYM SecPkgContext_CredentialName}
  1037. PSecPkgContext_CredentialName = PSecPkgContext_CredentialNameA;
  1038. {$EXTERNALSYM PSecPkgContext_CredentialName}
  1039. TSecPkgContextCredentialName = TSecPkgContextCredentialNameA;
  1040. PSecPkgContextCredentialName = PSecPkgContextCredentialNameA;
  1041. {$ENDIF UNICODE}
  1042. _SecPkgContext_AccessToken = record
  1043. AccessToken: Pointer;
  1044. end;
  1045. {$EXTERNALSYM _SecPkgContext_AccessToken}
  1046. SecPkgContext_AccessToken = _SecPkgContext_AccessToken;
  1047. {$EXTERNALSYM SecPkgContext_AccessToken}
  1048. PSecPkgContext_AccessToken = ^SecPkgContext_AccessToken;
  1049. {$EXTERNALSYM PSecPkgContext_AccessToken}
  1050. TSecPkgContextAccessToken = SecPkgContext_AccessToken;
  1051. PSecPkgContextAccessToken = PSecPkgContext_AccessToken;
  1052. _SecPkgContext_TargetInformation = record
  1053. MarshalledTargetInfoLength: Cardinal;
  1054. MarshalledTargetInfo: PWideChar;
  1055. end;
  1056. {$EXTERNALSYM _SecPkgContext_TargetInformation}
  1057. SecPkgContext_TargetInformation = _SecPkgContext_TargetInformation;
  1058. {$EXTERNALSYM SecPkgContext_TargetInformation}
  1059. PSecPkgContext_TargetInformation = ^SecPkgContext_TargetInformation;
  1060. {$EXTERNALSYM PSecPkgContext_TargetInformation}
  1061. TSecPkgContextTargetInformation = SecPkgContext_TargetInformation;
  1062. PSecPkgContextTargetInformation = PSecPkgContext_TargetInformation;
  1063. _SecPkgContext_AuthzID = record
  1064. AuthzIDLength: Cardinal;
  1065. AuthzID: PChar;
  1066. end;
  1067. {$EXTERNALSYM _SecPkgContext_AuthzID}
  1068. SecPkgContext_AuthzID = _SecPkgContext_AuthzID;
  1069. {$EXTERNALSYM SecPkgContext_AuthzID}
  1070. PSecPkgContext_AuthzID = ^SecPkgContext_AuthzID;
  1071. {$EXTERNALSYM PSecPkgContext_AuthzID}
  1072. TSecPkgContextAuthzID = SecPkgContext_AuthzID;
  1073. PSecPkgContextAuthzID = PSecPkgContext_AuthzID;
  1074. _SecPkgContext_Target = record
  1075. TargetLength: Cardinal;
  1076. Target: PChar;
  1077. end;
  1078. {$EXTERNALSYM _SecPkgContext_Target}
  1079. SecPkgContext_Target = _SecPkgContext_Target;
  1080. {$EXTERNALSYM SecPkgContext_Target}
  1081. PSecPkgContext_Target = ^SecPkgContext_Target;
  1082. {$EXTERNALSYM PSecPkgContext_Target}
  1083. TSecPkgContextTarget = SecPkgContext_Target;
  1084. PSecPkgContextTarget = PSecPkgContext_Target;
  1085. SEC_GET_KEY_FN = procedure(
  1086. Arg: Pointer; // Argument passed in
  1087. Principal: Pointer; // Principal ID
  1088. KeyVer: Cardinal; // Key Version
  1089. var Key: Pointer; // Returned ptr to key
  1090. var Status: SECURITY_STATUS); stdcall; // returned status
  1091. {$EXTERNALSYM SEC_GET_KEY_FN}
  1092. TSecGetKeyFn = SEC_GET_KEY_FN;
  1093. //
  1094. // Flags for ExportSecurityContext
  1095. //
  1096. const
  1097. SECPKG_CONTEXT_EXPORT_RESET_NEW = $00000001; // New context is reset to initial state
  1098. {$EXTERNALSYM SECPKG_CONTEXT_EXPORT_RESET_NEW}
  1099. SECPKG_CONTEXT_EXPORT_DELETE_OLD = $00000002; // Old context is deleted during export
  1100. {$EXTERNALSYM SECPKG_CONTEXT_EXPORT_DELETE_OLD}
  1101. function AcquireCredentialsHandleW(pszPrincipal, pszPackage: PSecWChar;
  1102. fCredentialUse: Cardinal; pvLogonId, pAuthData: Pointer;
  1103. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; phCredential: PCredHandle;
  1104. var ptsExpiry: TTimeStamp): SECURITY_STATUS; stdcall;
  1105. {$EXTERNALSYM AcquireCredentialsHandleW}
  1106. type
  1107. ACQUIRE_CREDENTIALS_HANDLE_FN_W = function(
  1108. pszPrincipal: PSecWChar;
  1109. pszPackage: PSecWChar;
  1110. fCredentialsUse: Cardinal;
  1111. pvLogonId: Pointer;
  1112. pAuthData: Pointer;
  1113. pGetKeyFn: SEC_GET_KEY_FN;
  1114. pvGetKeyArgument: Pointer;
  1115. phCredential: PCredHandle;
  1116. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1117. {$EXTERNALSYM ACQUIRE_CREDENTIALS_HANDLE_FN_W}
  1118. TAcquireCredentialsHandleFnW = ACQUIRE_CREDENTIALS_HANDLE_FN_W;
  1119. function AcquireCredentialsHandleA(pszPrincipal, pszPackage: PSecChar;
  1120. fCredentialUse: Cardinal; pvLogonId, pAuthData: Pointer;
  1121. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; phCredential: PCredHandle;
  1122. var ptsExpiry: TTimeStamp): SECURITY_STATUS; stdcall;
  1123. {$EXTERNALSYM AcquireCredentialsHandleA}
  1124. type
  1125. ACQUIRE_CREDENTIALS_HANDLE_FN_A = function(
  1126. pszPrincipal: PSecChar;
  1127. pszPackage: PSecChar;
  1128. fCredentialsUse: Cardinal;
  1129. pvLogonId: Pointer;
  1130. pAuthData: Pointer;
  1131. pGetKeyFn: SEC_GET_KEY_FN;
  1132. pvGetKeyArgument: Pointer;
  1133. phCredential: PCredHandle;
  1134. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1135. {$EXTERNALSYM ACQUIRE_CREDENTIALS_HANDLE_FN_A}
  1136. TAcquireCredentialsHandleFnA = ACQUIRE_CREDENTIALS_HANDLE_FN_A;
  1137. {$IFDEF UNICODE}
  1138. function AcquireCredentialsHandle(pszPrincipal, pszPackage: PSecWChar;
  1139. fCredentialUse: Cardinal; pvLogonId, pAuthData: Pointer;
  1140. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; phCredential: PCredHandle;
  1141. var ptsExpiry: TTimeStamp): SECURITY_STATUS; stdcall;
  1142. {$EXTERNALSYM AcquireCredentialsHandle}
  1143. type
  1144. ACQUIRE_CREDENTIALS_HANDLE_FN = ACQUIRE_CREDENTIALS_HANDLE_FN_W;
  1145. {$EXTERNALSYM ACQUIRE_CREDENTIALS_HANDLE_FN}
  1146. TAcquireCredentialsHandleFn = TAcquireCredentialsHandleFnW;
  1147. {$ELSE}
  1148. function AcquireCredentialsHandle(pszPrincipal, pszPackage: PSecChar;
  1149. fCredentialUse: Cardinal; pvLogonId, pAuthData: Pointer;
  1150. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; phCredential: PCredHandle;
  1151. var ptsExpiry: TTimeStamp): SECURITY_STATUS; stdcall;
  1152. {$EXTERNALSYM AcquireCredentialsHandle}
  1153. type
  1154. ACQUIRE_CREDENTIALS_HANDLE_FN = ACQUIRE_CREDENTIALS_HANDLE_FN_A;
  1155. {$EXTERNALSYM ACQUIRE_CREDENTIALS_HANDLE_FN}
  1156. TAcquireCredentialsHandleFn = TAcquireCredentialsHandleFnA;
  1157. {$ENDIF UNICODE}
  1158. function FreeCredentialsHandle(phCredential: PCredHandle): SECURITY_STATUS; stdcall;
  1159. {$EXTERNALSYM FreeCredentialsHandle}
  1160. type
  1161. FREE_CREDENTIALS_HANDLE_FN = function(phCredential: PCredHandle): SECURITY_STATUS; stdcall;
  1162. {$EXTERNALSYM FREE_CREDENTIALS_HANDLE_FN}
  1163. function AddCredentialsW(hCredentials: PCredHandle; pszPrincipal: PSecWChar;
  1164. pszPackage: PSecWChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1165. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer;
  1166. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1167. {$EXTERNALSYM AddCredentialsW}
  1168. type
  1169. ADD_CREDENTIALS_FN_W = function(hCredentials: PCredHandle; pszPrincipal: PSecWChar;
  1170. pszPackage: PSecWChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1171. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer;
  1172. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1173. {$EXTERNALSYM ADD_CREDENTIALS_FN_W}
  1174. function AddCredentialsA(hCredentials: PCredHandle; pszPrincipal: PSecChar;
  1175. pszPackage: PSecChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1176. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1177. {$EXTERNALSYM AddCredentialsA}
  1178. type
  1179. ADD_CREDENTIALS_FN_A = function(hCredentials: PCredHandle; pszPrincipal: PSecChar;
  1180. pszPackage: PSecChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1181. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1182. {$EXTERNALSYM ADD_CREDENTIALS_FN_A}
  1183. {$IFDEF UNICODE}
  1184. function AddCredentials(hCredentials: PCredHandle; pszPrincipal: PSecWChar;
  1185. pszPackage: PSecWChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1186. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer;
  1187. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1188. {$EXTERNALSYM AddCredentials}
  1189. type
  1190. ADD_CREDENTIALS_FN = function(hCredentials: PCredHandle; pszPrincipal: PSecWChar;
  1191. pszPackage: PSecWChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1192. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer;
  1193. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1194. {$EXTERNALSYM ADD_CREDENTIALS_FN}
  1195. {$ELSE}
  1196. function AddCredentials(hCredentials: PCredHandle; pszPrincipal: PSecChar;
  1197. pszPackage: PSecChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1198. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1199. {$EXTERNALSYM AddCredentials}
  1200. type
  1201. ADD_CREDENTIALS_FN = function(hCredentials: PCredHandle; pszPrincipal: PSecChar;
  1202. pszPackage: PSecChar; fCredentialUse: Cardinal; pAuthData: Pointer;
  1203. pGetKeyFn: SEC_GET_KEY_FN; pvGetKeyArgument: Pointer; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1204. {$EXTERNALSYM ADD_CREDENTIALS_FN}
  1205. {$ENDIF UNICODE}
  1206. ////////////////////////////////////////////////////////////////////////
  1207. ///
  1208. /// Context Management Functions
  1209. ///
  1210. ////////////////////////////////////////////////////////////////////////
  1211. function InitializeSecurityContextW(phCredential: PCredHandle; phContext: PCtxtHandle;
  1212. pszTargetName: PSecWChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1213. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1214. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1215. {$EXTERNALSYM InitializeSecurityContextW}
  1216. type
  1217. INITIALIZE_SECURITY_CONTEXT_FN_W = function(phCredential: PCredHandle; phContext: PCtxtHandle;
  1218. pszTargetName: PSecWChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1219. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1220. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1221. {$EXTERNALSYM INITIALIZE_SECURITY_CONTEXT_FN_W}
  1222. function InitializeSecurityContextA(phCredential: PCredHandle; phContext: PCtxtHandle;
  1223. pszTargetName: PSecChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1224. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1225. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1226. {$EXTERNALSYM InitializeSecurityContextA}
  1227. type
  1228. INITIALIZE_SECURITY_CONTEXT_FN_A = function(phCredential: PCredHandle; phContext: PCtxtHandle;
  1229. pszTargetName: PSecChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1230. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1231. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1232. {$EXTERNALSYM INITIALIZE_SECURITY_CONTEXT_FN_A}
  1233. {$IFDEF UNICODE}
  1234. function InitializeSecurityContext(phCredential: PCredHandle; phContext: PCtxtHandle;
  1235. pszTargetName: PSecWChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1236. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1237. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1238. {$EXTERNALSYM InitializeSecurityContext}
  1239. type
  1240. INITIALIZE_SECURITY_CONTEXT_FN = function(phCredential: PCredHandle; phContext: PCtxtHandle;
  1241. pszTargetName: PSecWChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1242. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1243. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1244. {$EXTERNALSYM INITIALIZE_SECURITY_CONTEXT_FN}
  1245. {$ELSE}
  1246. function InitializeSecurityContext(phCredential: PCredHandle; phContext: PCtxtHandle;
  1247. pszTargetName: PSecChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1248. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1249. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1250. {$EXTERNALSYM InitializeSecurityContext}
  1251. type
  1252. INITIALIZE_SECURITY_CONTEXT_FN = function(phCredential: PCredHandle; phContext: PCtxtHandle;
  1253. pszTargetName: PSecChar; fContextReq, Reserved1, TargetDataRep: Cardinal;
  1254. pInput: PSecBufferDesc; Reserved2: Cardinal; phNewContext: PCtxtHandle;
  1255. pOutput: PSecBufferDesc; var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1256. {$EXTERNALSYM INITIALIZE_SECURITY_CONTEXT_FN}
  1257. {$ENDIF UNICODE}
  1258. function AcceptSecurityContext(phCredential: PCredHandle; phContext: PCtxtHandle;
  1259. pInput: PSecBufferDesc; fContextReq, TargetDataRep: Cardinal;
  1260. phNewContext: PCtxtHandle; pOutput: PSecBufferDesc; var pfContextAttr: Cardinal;
  1261. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1262. {$EXTERNALSYM AcceptSecurityContext}
  1263. type
  1264. ACCEPT_SECURITY_CONTEXT_FN = function(phCredential: PCredHandle; phContext: PCtxtHandle;
  1265. pInput: PSecBufferDesc; fContextReq, TargetDataRep: Cardinal;
  1266. phNewContext: PCtxtHandle; pOutput: PSecBufferDesc; var pfContextAttr: Cardinal;
  1267. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1268. {$EXTERNALSYM ACCEPT_SECURITY_CONTEXT_FN}
  1269. function CompleteAuthToken(phContext: PCtxtHandle; pToken: PSecBufferDesc): SECURITY_STATUS; stdcall;
  1270. {$EXTERNALSYM CompleteAuthToken}
  1271. type
  1272. COMPLETE_AUTH_TOKEN_FN = function(phContext: PCtxtHandle; pToken: PSecBufferDesc): SECURITY_STATUS; stdcall;
  1273. {$EXTERNALSYM COMPLETE_AUTH_TOKEN_FN}
  1274. function ImpersonateSecurityContext(phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1275. {$EXTERNALSYM ImpersonateSecurityContext}
  1276. type
  1277. IMPERSONATE_SECURITY_CONTEXT_FN = function(phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1278. {$EXTERNALSYM IMPERSONATE_SECURITY_CONTEXT_FN}
  1279. function RevertSecurityContext(phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1280. {$EXTERNALSYM RevertSecurityContext}
  1281. type
  1282. REVERT_SECURITY_CONTEXT_FN = function(phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1283. {$EXTERNALSYM REVERT_SECURITY_CONTEXT_FN}
  1284. function QuerySecurityContextToken(phContext: PCtxtHandle; var Token: Pointer): SECURITY_STATUS; stdcall;
  1285. {$EXTERNALSYM QuerySecurityContextToken}
  1286. type
  1287. QUERY_SECURITY_CONTEXT_TOKEN_FN = function(phContext: PCtxtHandle;
  1288. var Token: Pointer): SECURITY_STATUS; stdcall;
  1289. {$EXTERNALSYM QUERY_SECURITY_CONTEXT_TOKEN_FN}
  1290. function DeleteSecurityContext(phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1291. {$EXTERNALSYM DeleteSecurityContext}
  1292. type
  1293. DELETE_SECURITY_CONTEXT_FN = function(phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1294. {$EXTERNALSYM DELETE_SECURITY_CONTEXT_FN}
  1295. function ApplyControlToken(phContext: PCtxtHandle; pInput: PSecBufferDesc): SECURITY_STATUS; stdcall;
  1296. {$EXTERNALSYM ApplyControlToken}
  1297. type
  1298. APPLY_CONTROL_TOKEN_FN = function(phContext: PCtxtHandle; pInput: PSecBufferDesc): SECURITY_STATUS; stdcall;
  1299. {$EXTERNALSYM APPLY_CONTROL_TOKEN_FN}
  1300. function QueryContextAttributesW(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1301. pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1302. {$EXTERNALSYM QueryContextAttributesW}
  1303. type
  1304. QUERY_CONTEXT_ATTRIBUTES_FN_W = function(phContext: PCtxtHandle;
  1305. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1306. {$EXTERNALSYM QUERY_CONTEXT_ATTRIBUTES_FN_W}
  1307. function QueryContextAttributesA(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1308. pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1309. {$EXTERNALSYM QueryContextAttributesA}
  1310. type
  1311. QUERY_CONTEXT_ATTRIBUTES_FN_A = function(phContext: PCtxtHandle;
  1312. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1313. {$EXTERNALSYM QUERY_CONTEXT_ATTRIBUTES_FN_A}
  1314. {$IFDEF UNICODE}
  1315. function QueryContextAttributes(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1316. pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1317. {$EXTERNALSYM QueryContextAttributes}
  1318. type
  1319. QUERY_CONTEXT_ATTRIBUTES_FN = function(phContext: PCtxtHandle;
  1320. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1321. {$EXTERNALSYM QUERY_CONTEXT_ATTRIBUTES_FN}
  1322. {$ELSE}
  1323. function QueryContextAttributes(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1324. pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1325. {$EXTERNALSYM QueryContextAttributes}
  1326. type
  1327. QUERY_CONTEXT_ATTRIBUTES_FN = function(phContext: PCtxtHandle;
  1328. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1329. {$EXTERNALSYM QUERY_CONTEXT_ATTRIBUTES_FN}
  1330. {$ENDIF UNICODE}
  1331. function SetContextAttributesW(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1332. pBuffer: Pointer; cbBuffer: Cardinal): SECURITY_STATUS; stdcall;
  1333. {$EXTERNALSYM SetContextAttributesW}
  1334. type
  1335. SET_CONTEXT_ATTRIBUTES_FN_W = function(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1336. pBuffer: Pointer; cbBuffer: Cardinal): SECURITY_STATUS; stdcall;
  1337. {$EXTERNALSYM SET_CONTEXT_ATTRIBUTES_FN_W}
  1338. function SetContextAttributesA(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1339. pBuffer: Pointer; cbBuffer: Cardinal): SECURITY_STATUS; stdcall;
  1340. {$EXTERNALSYM SetContextAttributesA}
  1341. type
  1342. SET_CONTEXT_ATTRIBUTES_FN_A = function(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1343. pBuffer: Pointer; cbBuffer: Cardinal): SECURITY_STATUS; stdcall;
  1344. {$EXTERNALSYM SET_CONTEXT_ATTRIBUTES_FN_A}
  1345. {$IFDEF UNICODE}
  1346. function SetContextAttributes(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1347. pBuffer: Pointer; cbBuffer: Cardinal): SECURITY_STATUS; stdcall;
  1348. {$EXTERNALSYM SetContextAttributes}
  1349. type
  1350. SET_CONTEXT_ATTRIBUTES_FN = SET_CONTEXT_ATTRIBUTES_FN_W;
  1351. {$EXTERNALSYM SET_CONTEXT_ATTRIBUTES_FN}
  1352. {$ELSE}
  1353. function SetContextAttributes(phContext: PCtxtHandle; ulAttribute: Cardinal;
  1354. pBuffer: Pointer; cbBuffer: Cardinal): SECURITY_STATUS; stdcall;
  1355. {$EXTERNALSYM SetContextAttributes}
  1356. type
  1357. SET_CONTEXT_ATTRIBUTES_FN = SET_CONTEXT_ATTRIBUTES_FN_A;
  1358. {$EXTERNALSYM SET_CONTEXT_ATTRIBUTES_FN}
  1359. {$ENDIF UNICODE}
  1360. function QueryCredentialsAttributesW(phCredential: PCredHandle;
  1361. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1362. {$EXTERNALSYM QueryCredentialsAttributesW}
  1363. type
  1364. QUERY_CREDENTIALS_ATTRIBUTES_FN_W = function(phCredential: PCredHandle;
  1365. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1366. {$EXTERNALSYM QUERY_CREDENTIALS_ATTRIBUTES_FN_W}
  1367. function QueryCredentialsAttributesA(phCredential: PCredHandle;
  1368. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1369. {$EXTERNALSYM QueryCredentialsAttributesA}
  1370. type
  1371. QUERY_CREDENTIALS_ATTRIBUTES_FN_A = function(phCredential: PCredHandle;
  1372. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1373. {$EXTERNALSYM QUERY_CREDENTIALS_ATTRIBUTES_FN_A}
  1374. {$IFDEF UNICODE}
  1375. function QueryCredentialsAttributes(phCredential: PCredHandle;
  1376. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1377. {$EXTERNALSYM QueryCredentialsAttributes}
  1378. type
  1379. QUERY_CREDENTIALS_ATTRIBUTES_FN = function(phCredential: PCredHandle;
  1380. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1381. {$EXTERNALSYM QUERY_CREDENTIALS_ATTRIBUTES_FN}
  1382. {$ELSE}
  1383. function QueryCredentialsAttributes(phCredential: PCredHandle;
  1384. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1385. {$EXTERNALSYM QueryCredentialsAttributes}
  1386. type
  1387. QUERY_CREDENTIALS_ATTRIBUTES_FN = function(phCredential: PCredHandle;
  1388. ulAttribute: Cardinal; pBuffer: Pointer): SECURITY_STATUS; stdcall;
  1389. {$EXTERNALSYM QUERY_CREDENTIALS_ATTRIBUTES_FN}
  1390. {$ENDIF UNICODE}
  1391. function FreeContextBuffer(pvContextBuffer: Pointer): SECURITY_STATUS; stdcall;
  1392. {$EXTERNALSYM FreeContextBuffer}
  1393. type
  1394. FREE_CONTEXT_BUFFER_FN = function(pvContextBuffer: Pointer): SECURITY_STATUS; stdcall;
  1395. {$EXTERNALSYM FREE_CONTEXT_BUFFER_FN}
  1396. ///////////////////////////////////////////////////////////////////
  1397. ////
  1398. //// Message Support API
  1399. ////
  1400. //////////////////////////////////////////////////////////////////
  1401. function MakeSignature(phContext: PCtxtHandle; fQOP: Cardinal;
  1402. pMessage: PSecBufferDesc; MessageSeqNo: Cardinal): SECURITY_STATUS; stdcall;
  1403. {$EXTERNALSYM MakeSignature}
  1404. type
  1405. MAKE_SIGNATURE_FN = function(phContext: PCtxtHandle; fQOP: Cardinal;
  1406. pMessage: PSecBufferDesc; MessageSeqNo: Cardinal): SECURITY_STATUS; stdcall;
  1407. {$EXTERNALSYM MAKE_SIGNATURE_FN}
  1408. function VerifySignature(phContext: PCtxtHandle; pMessage: PSecBufferDesc;
  1409. MessageSeqNo: Cardinal; var pfQOP: Cardinal): SECURITY_STATUS; stdcall;
  1410. {$EXTERNALSYM VerifySignature}
  1411. type
  1412. VERIFY_SIGNATURE_FN = function(phContext: PCtxtHandle; pMessage: PSecBufferDesc;
  1413. MessageSeqNo: Cardinal; var pfQOP: Cardinal): SECURITY_STATUS; stdcall;
  1414. {$EXTERNALSYM VERIFY_SIGNATURE_FN}
  1415. const
  1416. SECQOP_WRAP_NO_ENCRYPT = DWORD($80000001);
  1417. {$EXTERNALSYM SECQOP_WRAP_NO_ENCRYPT}
  1418. function EncryptMessage(phContext: PCtxtHandle; fQOP: Cardinal;
  1419. pMessage: PSecBufferDesc; MessageSeqNo: Cardinal): SECURITY_STATUS; stdcall;
  1420. {$EXTERNALSYM EncryptMessage}
  1421. type
  1422. ENCRYPT_MESSAGE_FN = function(phContext: PCtxtHandle; fQOP: Cardinal;
  1423. pMessage: PSecBufferDesc; MessageSeqNo: Cardinal): SECURITY_STATUS; stdcall;
  1424. {$EXTERNALSYM ENCRYPT_MESSAGE_FN}
  1425. function DecryptMessage(phContext: PCtxtHandle; pMessage: PSecBufferDesc;
  1426. MessageSeqNo: Cardinal; var pfQOP: Cardinal): SECURITY_STATUS; stdcall;
  1427. {$EXTERNALSYM DecryptMessage}
  1428. type
  1429. DECRYPT_MESSAGE_FN = function(phContext: PCtxtHandle; pMessage: PSecBufferDesc;
  1430. MessageSeqNo: Cardinal; var pfQOP: Cardinal): SECURITY_STATUS; stdcall;
  1431. {$EXTERNALSYM DECRYPT_MESSAGE_FN}
  1432. ///////////////////////////////////////////////////////////////////////////
  1433. ////
  1434. //// Misc.
  1435. ////
  1436. ///////////////////////////////////////////////////////////////////////////
  1437. function EnumerateSecurityPackagesW(var pcPackages: Cardinal;
  1438. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1439. {$EXTERNALSYM EnumerateSecurityPackagesW}
  1440. type
  1441. ENUMERATE_SECURITY_PACKAGES_FN_W = function(var pcPackages: Cardinal;
  1442. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1443. {$EXTERNALSYM ENUMERATE_SECURITY_PACKAGES_FN_W}
  1444. function EnumerateSecurityPackagesA(var pcPackages: Cardinal;
  1445. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1446. {$EXTERNALSYM EnumerateSecurityPackagesA}
  1447. type
  1448. ENUMERATE_SECURITY_PACKAGES_FN_A = function(var pcPackages: Cardinal;
  1449. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1450. {$EXTERNALSYM ENUMERATE_SECURITY_PACKAGES_FN_A}
  1451. {$IFDEF UNICODE}
  1452. function EnumerateSecurityPackages(var pcPackages: Cardinal;
  1453. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1454. {$EXTERNALSYM EnumerateSecurityPackages}
  1455. type
  1456. ENUMERATE_SECURITY_PACKAGES_FN = function(var pcPackages: Cardinal;
  1457. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1458. {$EXTERNALSYM ENUMERATE_SECURITY_PACKAGES_FN}
  1459. {$ELSE}
  1460. function EnumerateSecurityPackages(var pcPackages: Cardinal;
  1461. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1462. {$EXTERNALSYM EnumerateSecurityPackages}
  1463. type
  1464. ENUMERATE_SECURITY_PACKAGES_FN = function(var pcPackages: Cardinal;
  1465. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1466. {$EXTERNALSYM ENUMERATE_SECURITY_PACKAGES_FN}
  1467. {$ENDIF UNICODE}
  1468. function QuerySecurityPackageInfoW(pszPackageName: PSecWChar;
  1469. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1470. {$EXTERNALSYM QuerySecurityPackageInfoW}
  1471. type
  1472. QUERY_SECURITY_PACKAGE_INFO_FN_W = function(pszPackageName: PSecWChar;
  1473. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1474. {$EXTERNALSYM QUERY_SECURITY_PACKAGE_INFO_FN_W}
  1475. function QuerySecurityPackageInfoA(pszPackageName: PSecChar;
  1476. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1477. {$EXTERNALSYM QuerySecurityPackageInfoA}
  1478. type
  1479. QUERY_SECURITY_PACKAGE_INFO_FN_A = function(pszPackageName: PSecChar;
  1480. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1481. {$EXTERNALSYM QUERY_SECURITY_PACKAGE_INFO_FN_A}
  1482. {$IFDEF UNICODE}
  1483. function QuerySecurityPackageInfo(pszPackageName: PSecWChar;
  1484. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1485. {$EXTERNALSYM QuerySecurityPackageInfo}
  1486. type
  1487. QUERY_SECURITY_PACKAGE_INFO_FN = function(pszPackageName: PSecWChar;
  1488. var ppPackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1489. {$EXTERNALSYM QUERY_SECURITY_PACKAGE_INFO_FN}
  1490. {$ELSE}
  1491. function QuerySecurityPackageInfo(pszPackageName: PSecChar;
  1492. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1493. {$EXTERNALSYM QuerySecurityPackageInfo}
  1494. type
  1495. QUERY_SECURITY_PACKAGE_INFO_FN = function(pszPackageName: PSecChar;
  1496. var ppPackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1497. {$EXTERNALSYM QUERY_SECURITY_PACKAGE_INFO_FN}
  1498. {$ENDIF UNICODE}
  1499. type
  1500. _SecDelegationType = (
  1501. SecFull,
  1502. SecService,
  1503. SecTree,
  1504. SecDirectory,
  1505. SecObject);
  1506. {$EXTERNALSYM _SecDelegationType}
  1507. SecDelegationType = _SecDelegationType;
  1508. {$EXTERNALSYM SecDelegationType}
  1509. PSecDelegationType = ^SecDelegationType;
  1510. {$EXTERNALSYM PSecDelegationType}
  1511. TSecDelegationType = SecDelegationType;
  1512. //function DelegateSecurityContext(phContext: PCtxtHandle; pszTarget: PSecChar;
  1513. // DelegationType: SecDelegationType; pExpiry: PTimeStamp;
  1514. // pPackageParameters: PSecBuffer; pOutput: PSecBufferDesc): SECURITY_STATUS; stdcall;
  1515. //{$EXTERNALSYM DelegateSecurityContext}
  1516. ///////////////////////////////////////////////////////////////////////////
  1517. ////
  1518. //// Proxies
  1519. ////
  1520. ///////////////////////////////////////////////////////////////////////////
  1521. //
  1522. // Proxies are only available on NT platforms
  1523. //
  1524. ///////////////////////////////////////////////////////////////////////////
  1525. ////
  1526. //// Context export/import
  1527. ////
  1528. ///////////////////////////////////////////////////////////////////////////
  1529. function ExportSecurityContext(phContext: PCtxtHandle; fFlags: ULONG;
  1530. pPackedContext: PSecBuffer; var pToken: Pointer): SECURITY_STATUS; stdcall;
  1531. {$EXTERNALSYM ExportSecurityContext}
  1532. type
  1533. EXPORT_SECURITY_CONTEXT_FN = function(phContext: PCtxtHandle; fFlags: ULONG;
  1534. pPackedContext: PSecBuffer; var pToken: Pointer): SECURITY_STATUS; stdcall;
  1535. {$EXTERNALSYM EXPORT_SECURITY_CONTEXT_FN}
  1536. function ImportSecurityContextW(pszPackage: PSecWChar; pPackedContext: PSecBuffer;
  1537. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1538. {$EXTERNALSYM ImportSecurityContextW}
  1539. type
  1540. IMPORT_SECURITY_CONTEXT_FN_W = function(pszPackage: PSecWChar; pPackedContext: PSecBuffer;
  1541. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1542. {$EXTERNALSYM IMPORT_SECURITY_CONTEXT_FN_W}
  1543. function ImportSecurityContextA(pszPackage: PSecChar; pPackedContext: PSecBuffer;
  1544. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1545. {$EXTERNALSYM ImportSecurityContextA}
  1546. type
  1547. IMPORT_SECURITY_CONTEXT_FN_A = function(pszPackage: PSecChar; pPackedContext: PSecBuffer;
  1548. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1549. {$EXTERNALSYM IMPORT_SECURITY_CONTEXT_FN_A}
  1550. {$IFDEF UNICODE}
  1551. function ImportSecurityContext(pszPackage: PSecWChar; pPackedContext: PSecBuffer;
  1552. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1553. {$EXTERNALSYM ImportSecurityContext}
  1554. type
  1555. IMPORT_SECURITY_CONTEXT_FN = function(pszPackage: PSecWChar; pPackedContext: PSecBuffer;
  1556. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1557. {$EXTERNALSYM IMPORT_SECURITY_CONTEXT_FN}
  1558. {$ELSE}
  1559. function ImportSecurityContext(pszPackage: PSecChar; pPackedContext: PSecBuffer;
  1560. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1561. {$EXTERNALSYM ImportSecurityContext}
  1562. type
  1563. IMPORT_SECURITY_CONTEXT_FN = function(pszPackage: PSecChar; pPackedContext: PSecBuffer;
  1564. Token: Pointer; phContext: PCtxtHandle): SECURITY_STATUS; stdcall;
  1565. {$EXTERNALSYM IMPORT_SECURITY_CONTEXT_FN}
  1566. {$ENDIF UNICODE}
  1567. (*
  1568. #if ISSP_MODE == 0
  1569. NTSTATUS
  1570. NTAPI
  1571. SecMakeSPN(
  1572. IN PUNICODE_STRING ServiceClass,
  1573. IN PUNICODE_STRING ServiceName,
  1574. IN PUNICODE_STRING InstanceName OPTIONAL,
  1575. IN USHORT InstancePort OPTIONAL,
  1576. IN PUNICODE_STRING Referrer OPTIONAL,
  1577. IN OUT PUNICODE_STRING Spn,
  1578. OUT PULONG Length OPTIONAL,
  1579. IN BOOLEAN Allocate
  1580. );
  1581. NTSTATUS
  1582. NTAPI
  1583. SecMakeSPNEx(
  1584. IN PUNICODE_STRING ServiceClass,
  1585. IN PUNICODE_STRING ServiceName,
  1586. IN PUNICODE_STRING InstanceName OPTIONAL,
  1587. IN USHORT InstancePort OPTIONAL,
  1588. IN PUNICODE_STRING Referrer OPTIONAL,
  1589. IN PUNICODE_STRING TargetInfo OPTIONAL,
  1590. IN OUT PUNICODE_STRING Spn,
  1591. OUT PULONG Length OPTIONAL,
  1592. IN BOOLEAN Allocate
  1593. );
  1594. NTSTATUS
  1595. SEC_ENTRY
  1596. SecLookupAccountSid(
  1597. IN PSID Sid,
  1598. IN OUT PULONG NameSize,
  1599. OUT PUNICODE_STRING NameBuffer,
  1600. IN OUT PULONG DomainSize OPTIONAL,
  1601. OUT PUNICODE_STRING DomainBuffer OPTIONAL,
  1602. OUT PSID_NAME_USE NameUse
  1603. );
  1604. NTSTATUS
  1605. SEC_ENTRY
  1606. SecLookupAccountName(
  1607. IN PUNICODE_STRING Name,
  1608. IN OUT PULONG SidSize,
  1609. OUT PSID Sid,
  1610. OUT PSID_NAME_USE NameUse,
  1611. IN OUT PULONG DomainSize OPTIONAL,
  1612. OUT PUNICODE_STRING ReferencedDomain OPTIONAL
  1613. );
  1614. NTSTATUS
  1615. SEC_ENTRY
  1616. SecLookupWellKnownSid(
  1617. IN WELL_KNOWN_SID_TYPE SidType,
  1618. OUT PSID Sid,
  1619. ULONG SidBufferSize,
  1620. OUT PULONG SidSize OPTIONAL
  1621. );
  1622. #endif
  1623. *)
  1624. ///////////////////////////////////////////////////////////////////////////////
  1625. ////
  1626. //// Fast access for RPC:
  1627. ////
  1628. ///////////////////////////////////////////////////////////////////////////////
  1629. const
  1630. SECURITY_ENTRYPOINT_ANSIW = 'InitSecurityInterfaceW';
  1631. {$EXTERNALSYM SECURITY_ENTRYPOINT_ANSIW}
  1632. SECURITY_ENTRYPOINT_ANSIA = 'InitSecurityInterfaceA';
  1633. {$EXTERNALSYM SECURITY_ENTRYPOINT_ANSIA}
  1634. SECURITY_ENTRYPOINTW = 'InitSecurityInterfaceW';
  1635. {$EXTERNALSYM SECURITY_ENTRYPOINTW}
  1636. SECURITY_ENTRYPOINTA = 'InitSecurityInterfaceA';
  1637. {$EXTERNALSYM SECURITY_ENTRYPOINTA}
  1638. SECURITY_ENTRYPOINT16 = 'INITSECURITYINTERFACEA';
  1639. {$EXTERNALSYM SECURITY_ENTRYPOINT16}
  1640. {$IFDEF UNICODE}
  1641. SECURITY_ENTRYPOINT = SECURITY_ENTRYPOINTW;
  1642. {$EXTERNALSYM SECURITY_ENTRYPOINT}
  1643. SECURITY_ENTRYPOINT_ANSI = SECURITY_ENTRYPOINT_ANSIW;
  1644. {$EXTERNALSYM SECURITY_ENTRYPOINT_ANSI}
  1645. {$ELSE}
  1646. SECURITY_ENTRYPOINT = SECURITY_ENTRYPOINTA;
  1647. {$EXTERNALSYM SECURITY_ENTRYPOINT}
  1648. SECURITY_ENTRYPOINT_ANSI = SECURITY_ENTRYPOINT_ANSIA;
  1649. {$EXTERNALSYM SECURITY_ENTRYPOINT_ANSI}
  1650. {$ENDIF UNICODE}
  1651. function FreeCredentialHandle(phCredential: PCredHandle): SECURITY_STATUS;
  1652. {$EXTERNALSYM FreeCredentialHandle}
  1653. type
  1654. PSecurityFunctionTableW = ^SecurityFunctionTableW;
  1655. {$EXTERNALSYM PSecurityFunctionTableW}
  1656. _SECURITY_FUNCTION_TABLE_W = record
  1657. dwVersion: Cardinal;
  1658. EnumerateSecurityPackagesW: ENUMERATE_SECURITY_PACKAGES_FN_W;
  1659. QueryCredentialsAttributesW: QUERY_CREDENTIALS_ATTRIBUTES_FN_W;
  1660. AcquireCredentialsHandleW: ACQUIRE_CREDENTIALS_HANDLE_FN_W;
  1661. FreeCredentialsHandle: FREE_CREDENTIALS_HANDLE_FN;
  1662. Reserved2: Pointer;
  1663. InitializeSecurityContextW: INITIALIZE_SECURITY_CONTEXT_FN_W;
  1664. AcceptSecurityContext: ACCEPT_SECURITY_CONTEXT_FN;
  1665. CompleteAuthToken: COMPLETE_AUTH_TOKEN_FN;
  1666. DeleteSecurityContext: DELETE_SECURITY_CONTEXT_FN;
  1667. ApplyControlToken: APPLY_CONTROL_TOKEN_FN;
  1668. QueryContextAttributesW: QUERY_CONTEXT_ATTRIBUTES_FN_W;
  1669. ImpersonateSecurityContext: IMPERSONATE_SECURITY_CONTEXT_FN;
  1670. RevertSecurityContext: REVERT_SECURITY_CONTEXT_FN;
  1671. MakeSignature: MAKE_SIGNATURE_FN;
  1672. VerifySignature: VERIFY_SIGNATURE_FN;
  1673. FreeContextBuffer: FREE_CONTEXT_BUFFER_FN;
  1674. QuerySecurityPackageInfoW: QUERY_SECURITY_PACKAGE_INFO_FN_W;
  1675. Reserved3: Pointer;
  1676. Reserved4: Pointer;
  1677. ExportSecurityContext: EXPORT_SECURITY_CONTEXT_FN;
  1678. ImportSecurityContextW: IMPORT_SECURITY_CONTEXT_FN_W;
  1679. AddCredentialsW: ADD_CREDENTIALS_FN_W;
  1680. Reserved8: Pointer;
  1681. QuerySecurityContextToken: QUERY_SECURITY_CONTEXT_TOKEN_FN;
  1682. EncryptMessage: ENCRYPT_MESSAGE_FN;
  1683. DecryptMessage: DECRYPT_MESSAGE_FN;
  1684. SetContextAttributesW: SET_CONTEXT_ATTRIBUTES_FN_W;
  1685. end;
  1686. {$EXTERNALSYM _SECURITY_FUNCTION_TABLE_W}
  1687. SecurityFunctionTableW = _SECURITY_FUNCTION_TABLE_W;
  1688. {$EXTERNALSYM SecurityFunctionTableW}
  1689. TSecurityFunctionTableW = SecurityFunctionTableW;
  1690. PSecurityFunctionTableA = ^SecurityFunctionTableA;
  1691. {$EXTERNALSYM PSecurityFunctionTableA}
  1692. _SECURITY_FUNCTION_TABLE_A = record
  1693. dwVersion: Cardinal;
  1694. EnumerateSecurityPackagesA: ENUMERATE_SECURITY_PACKAGES_FN_A;
  1695. QueryCredentialsAttributesA: QUERY_CREDENTIALS_ATTRIBUTES_FN_A;
  1696. AcquireCredentialsHandleA: ACQUIRE_CREDENTIALS_HANDLE_FN_A;
  1697. FreeCredentialHandle: FREE_CREDENTIALS_HANDLE_FN;
  1698. Reserved2: Pointer;
  1699. InitializeSecurityContextA: INITIALIZE_SECURITY_CONTEXT_FN_A;
  1700. AcceptSecurityContext: ACCEPT_SECURITY_CONTEXT_FN;
  1701. CompleteAuthToken: COMPLETE_AUTH_TOKEN_FN;
  1702. DeleteSecurityContext: DELETE_SECURITY_CONTEXT_FN;
  1703. ApplyControlToken: APPLY_CONTROL_TOKEN_FN;
  1704. QueryContextAttributesA: QUERY_CONTEXT_ATTRIBUTES_FN_A;
  1705. ImpersonateSecurityContext: IMPERSONATE_SECURITY_CONTEXT_FN;
  1706. RevertSecurityContext: REVERT_SECURITY_CONTEXT_FN;
  1707. MakeSignature: MAKE_SIGNATURE_FN;
  1708. VerifySignature: VERIFY_SIGNATURE_FN;
  1709. FreeContextBuffer: FREE_CONTEXT_BUFFER_FN;
  1710. QuerySecurityPackageInfoA: QUERY_SECURITY_PACKAGE_INFO_FN_A;
  1711. Reserved3: Pointer;
  1712. Reserved4: Pointer;
  1713. ExportSecurityContext: EXPORT_SECURITY_CONTEXT_FN;
  1714. ImportSecurityContextA: IMPORT_SECURITY_CONTEXT_FN_A;
  1715. AddCredentialsA: ADD_CREDENTIALS_FN_A;
  1716. Reserved8: Pointer;
  1717. QuerySecurityContextToken: QUERY_SECURITY_CONTEXT_TOKEN_FN;
  1718. EncryptMessage: ENCRYPT_MESSAGE_FN;
  1719. DecryptMessage: DECRYPT_MESSAGE_FN;
  1720. SetContextAttributesA: SET_CONTEXT_ATTRIBUTES_FN_A;
  1721. end;
  1722. {$EXTERNALSYM _SECURITY_FUNCTION_TABLE_A}
  1723. SecurityFunctionTableA = _SECURITY_FUNCTION_TABLE_A;
  1724. {$EXTERNALSYM SecurityFunctionTableA}
  1725. TSecurityFunctionTableA = SecurityFunctionTableA;
  1726. {$IFDEF UNICODE}
  1727. SecurityFunctionTable = SecurityFunctionTableW;
  1728. {$EXTERNALSYM SecurityFunctionTable}
  1729. PSecurityFunctionTable = PSecurityFunctionTableW;
  1730. {$EXTERNALSYM PSecurityFunctionTable}
  1731. TSecurityFunctionTable = TSecurityFunctionTableW;
  1732. {$ELSE}
  1733. SecurityFunctionTable = SecurityFunctionTableA;
  1734. {$EXTERNALSYM SecurityFunctionTable}
  1735. PSecurityFunctionTable = PSecurityFunctionTableA;
  1736. {$EXTERNALSYM PSecurityFunctionTable}
  1737. TSecurityFunctionTable = TSecurityFunctionTableA;
  1738. {$ENDIF UNICODE}
  1739. const
  1740. // Function table has all routines through DecryptMessage
  1741. SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION = 1;
  1742. {$EXTERNALSYM SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION}
  1743. // Function table has all routines through SetContextAttributes
  1744. SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 = 2;
  1745. {$EXTERNALSYM SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2}
  1746. function InitSecurityInterfaceA: PSecurityFunctionTableA; stdcall;
  1747. {$EXTERNALSYM InitSecurityInterfaceA}
  1748. type
  1749. INIT_SECURITY_INTERFACE_A = function: PSecurityFunctionTableA; stdcall;
  1750. {$EXTERNALSYM INIT_SECURITY_INTERFACE_A}
  1751. function InitSecurityInterfaceW: PSecurityFunctionTableW; stdcall;
  1752. {$EXTERNALSYM InitSecurityInterfaceW}
  1753. type
  1754. INIT_SECURITY_INTERFACE_W = function: PSecurityFunctionTableW; stdcall;
  1755. {$EXTERNALSYM INIT_SECURITY_INTERFACE_W}
  1756. {$IFDEF UNICODE}
  1757. function InitSecurityInterface: PSecurityFunctionTableW; stdcall;
  1758. {$EXTERNALSYM InitSecurityInterface}
  1759. type
  1760. INIT_SECURITY_INTERFACE = function: PSecurityFunctionTableW; stdcall;
  1761. {$EXTERNALSYM INIT_SECURITY_INTERFACE}
  1762. {$ELSE}
  1763. function InitSecurityInterface: PSecurityFunctionTableA; stdcall;
  1764. {$EXTERNALSYM InitSecurityInterface}
  1765. type
  1766. INIT_SECURITY_INTERFACE = function: PSecurityFunctionTableA; stdcall;
  1767. {$EXTERNALSYM INIT_SECURITY_INTERFACE}
  1768. {$ENDIF UNICODE}
  1769. //
  1770. // SASL Profile Support
  1771. //
  1772. function SaslEnumerateProfilesA(var ProfileList: LPSTR;
  1773. var ProfileCount: ULONG): SECURITY_STATUS; stdcall;
  1774. {$EXTERNALSYM SaslEnumerateProfilesA}
  1775. function SaslEnumerateProfilesW(var ProfileList: LPWSTR;
  1776. var ProfileCount: ULONG): SECURITY_STATUS; stdcall;
  1777. {$EXTERNALSYM SaslEnumerateProfilesW}
  1778. {$IFDEF UNICODE}
  1779. function SaslEnumerateProfiles(var ProfileList: LPWSTR;
  1780. var ProfileCount: ULONG): SECURITY_STATUS; stdcall;
  1781. {$EXTERNALSYM SaslEnumerateProfiles}
  1782. {$ELSE}
  1783. function SaslEnumerateProfiles(var ProfileList: LPSTR;
  1784. var ProfileCount: ULONG): SECURITY_STATUS; stdcall;
  1785. {$EXTERNALSYM SaslEnumerateProfiles}
  1786. {$ENDIF UNICODE}
  1787. function SaslGetProfilePackageA(ProfileName: LPSTR;
  1788. var PackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1789. {$EXTERNALSYM SaslGetProfilePackageA}
  1790. function SaslGetProfilePackageW(ProfileName: LPWSTR;
  1791. var PackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1792. {$EXTERNALSYM SaslGetProfilePackageW}
  1793. {$IFDEF UNICODE}
  1794. function SaslGetProfilePackage(ProfileName: LPWSTR;
  1795. var PackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1796. {$EXTERNALSYM SaslGetProfilePackage}
  1797. {$ELSE}
  1798. function SaslGetProfilePackage(ProfileName: LPSTR;
  1799. var PackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1800. {$EXTERNALSYM SaslGetProfilePackage}
  1801. {$ENDIF UNICODE}
  1802. function SaslIdentifyPackageA(pInput: PSecBufferDesc;
  1803. var PackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1804. {$EXTERNALSYM SaslIdentifyPackageA}
  1805. function SaslIdentifyPackageW(pInput: PSecBufferDesc;
  1806. var PackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1807. {$EXTERNALSYM SaslIdentifyPackageW}
  1808. {$IFDEF UNICODE}
  1809. function SaslIdentifyPackage(pInput: PSecBufferDesc;
  1810. var PackageInfo: PSecPkgInfoW): SECURITY_STATUS; stdcall;
  1811. {$EXTERNALSYM SaslIdentifyPackage}
  1812. {$ELSE}
  1813. function SaslIdentifyPackage(pInput: PSecBufferDesc;
  1814. var PackageInfo: PSecPkgInfoA): SECURITY_STATUS; stdcall;
  1815. {$EXTERNALSYM SaslIdentifyPackage}
  1816. {$ENDIF UNICODE}
  1817. function SaslInitializeSecurityContextW(phCredential: PCredHandle;
  1818. phContext: PCtxtHandle; pszTargetName: LPWSTR; fContextReq, Reserved1: Cardinal;
  1819. TargetDataRep: Cardinal; pInput: PSecBufferDesc; Reserved2: Cardinal;
  1820. phNewContext: PCtxtHandle; pOutput: PSecBufferDesc; var pfContextAttr: Cardinal;
  1821. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1822. {$EXTERNALSYM SaslInitializeSecurityContextW}
  1823. function SaslInitializeSecurityContextA(phCredential: PCredHandle;
  1824. phContext: PCtxtHandle; pszTargetName: LPSTR; fContextReq, Reserved1: Cardinal;
  1825. TargetDataRep: Cardinal; pInput: PSecBufferDesc; Reserved2: Cardinal;
  1826. phNewContext: PCtxtHandle; pOutput: PSecBufferDesc; var pfContextAttr: Cardinal;
  1827. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1828. {$EXTERNALSYM SaslInitializeSecurityContextA}
  1829. {$IFDEF UNICODE}
  1830. function SaslInitializeSecurityContext(phCredential: PCredHandle;
  1831. phContext: PCtxtHandle; pszTargetName: LPWSTR; fContextReq, Reserved1: Cardinal;
  1832. TargetDataRep: Cardinal; pInput: PSecBufferDesc; Reserved2: Cardinal;
  1833. phNewContext: PCtxtHandle; pOutput: PSecBufferDesc; var pfContextAttr: Cardinal;
  1834. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1835. {$EXTERNALSYM SaslInitializeSecurityContext}
  1836. {$ELSE}
  1837. function SaslInitializeSecurityContext(phCredential: PCredHandle;
  1838. phContext: PCtxtHandle; pszTargetName: LPSTR; fContextReq, Reserved1: Cardinal;
  1839. TargetDataRep: Cardinal; pInput: PSecBufferDesc; Reserved2: Cardinal;
  1840. phNewContext: PCtxtHandle; pOutput: PSecBufferDesc; var pfContextAttr: Cardinal;
  1841. ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1842. {$EXTERNALSYM SaslInitializeSecurityContext}
  1843. {$ENDIF UNICODE}
  1844. function SaslAcceptSecurityContext(phCredential: PCredHandle;
  1845. phContext: PCtxtHandle; pInput: PSecBufferDesc; fContextReq: Cardinal;
  1846. TargetDataRep: Cardinal; phNewContext: PCtxtHandle; pOutput: PSecBufferDesc;
  1847. var pfContextAttr: Cardinal; ptsExpiry: PTimeStamp): SECURITY_STATUS; stdcall;
  1848. {$EXTERNALSYM SaslAcceptSecurityContext}
  1849. const
  1850. SASL_OPTION_SEND_SIZE = 1; // Maximum size to send to peer
  1851. {$EXTERNALSYM SASL_OPTION_SEND_SIZE}
  1852. SASL_OPTION_RECV_SIZE = 2; // Maximum size willing to receive
  1853. {$EXTERNALSYM SASL_OPTION_RECV_SIZE}
  1854. SASL_OPTION_AUTHZ_STRING = 3; // Authorization string
  1855. {$EXTERNALSYM SASL_OPTION_AUTHZ_STRING}
  1856. SASL_OPTION_AUTHZ_PROCESSING = 4; // Authorization string processing
  1857. {$EXTERNALSYM SASL_OPTION_AUTHZ_PROCESSING}
  1858. type
  1859. _SASL_AUTHZID_STATE = (
  1860. Sasl_AuthZIDForbidden, // allow no AuthZID strings to be specified - error out (default)
  1861. Sasl_AuthZIDProcessed); // AuthZID Strings processed by Application or SSP
  1862. {$EXTERNALSYM _SASL_AUTHZID_STATE}
  1863. SASL_AUTHZID_STATE = _SASL_AUTHZID_STATE;
  1864. {$EXTERNALSYM SASL_AUTHZID_STATE}
  1865. TSaslAuthzIDState = SASL_AUTHZID_STATE;
  1866. function SaslSetContextOption(ContextHandle: PCtxtHandle; Option: ULONG; Value: PVOID; Size: ULONG): SECURITY_STATUS; stdcall;
  1867. {$EXTERNALSYM SaslSetContextOption}
  1868. function SaslGetContextOption(ContextHandle: PCtxtHandle; Option: ULONG; Value: PVOID;
  1869. Size: ULONG; Needed: PULONG): SECURITY_STATUS; stdcall;
  1870. {$EXTERNALSYM SaslGetContextOption}
  1871. //
  1872. // This is the legacy credentials structure.
  1873. // The EX version below is preferred.
  1874. const
  1875. SEC_WINNT_AUTH_IDENTITY_ANSI = $1;
  1876. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_ANSI}
  1877. SEC_WINNT_AUTH_IDENTITY_UNICODE = $2;
  1878. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_UNICODE}
  1879. type
  1880. _SEC_WINNT_AUTH_IDENTITY_W = record
  1881. User: PWideChar;
  1882. UserLength: Cardinal;
  1883. Domain: PWideChar;
  1884. DomainLength: Cardinal;
  1885. Password: PWideChar;
  1886. PasswordLength: Cardinal;
  1887. Flags: Cardinal;
  1888. end;
  1889. {$EXTERNALSYM _SEC_WINNT_AUTH_IDENTITY_W}
  1890. SEC_WINNT_AUTH_IDENTITY_W = _SEC_WINNT_AUTH_IDENTITY_W;
  1891. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_W}
  1892. PSEC_WINNT_AUTH_IDENTITY_W = ^SEC_WINNT_AUTH_IDENTITY_W;
  1893. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY_W}
  1894. TSecWinNTAuthIdentityW = SEC_WINNT_AUTH_IDENTITY_W;
  1895. PSecWinNTAuthIdentityW = PSEC_WINNT_AUTH_IDENTITY_W;
  1896. _SEC_WINNT_AUTH_IDENTITY_A = record
  1897. User: PChar;
  1898. UserLength: Cardinal;
  1899. Domain: PChar;
  1900. DomainLength: Cardinal;
  1901. Password: PChar;
  1902. PasswordLength: Cardinal;
  1903. Flags: Cardinal;
  1904. end;
  1905. {$EXTERNALSYM _SEC_WINNT_AUTH_IDENTITY_A}
  1906. SEC_WINNT_AUTH_IDENTITY_A = _SEC_WINNT_AUTH_IDENTITY_A;
  1907. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_A}
  1908. PSEC_WINNT_AUTH_IDENTITY_A = ^SEC_WINNT_AUTH_IDENTITY_A;
  1909. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY_A}
  1910. TSecWinNTAuthIdentityA = SEC_WINNT_AUTH_IDENTITY_A;
  1911. PSecWinNTAuthIdentityA = PSEC_WINNT_AUTH_IDENTITY_A;
  1912. {$IFDEF UNICODE}
  1913. SEC_WINNT_AUTH_IDENTITY = SEC_WINNT_AUTH_IDENTITY_W;
  1914. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY}
  1915. PSEC_WINNT_AUTH_IDENTITY = PSEC_WINNT_AUTH_IDENTITY_W;
  1916. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY}
  1917. _SEC_WINNT_AUTH_IDENTITY = _SEC_WINNT_AUTH_IDENTITY_W;
  1918. {$EXTERNALSYM _SEC_WINNT_AUTH_IDENTITY}
  1919. TSecWinNTAuthIdentity = TSecWinNTAuthIdentityW;
  1920. PSecWinNTAuthIdentity = PSecWinNTAuthIdentityW;
  1921. {$ELSE}
  1922. SEC_WINNT_AUTH_IDENTITY = SEC_WINNT_AUTH_IDENTITY_A;
  1923. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY}
  1924. PSEC_WINNT_AUTH_IDENTITY = PSEC_WINNT_AUTH_IDENTITY_A;
  1925. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY}
  1926. _SEC_WINNT_AUTH_IDENTITY = _SEC_WINNT_AUTH_IDENTITY_A;
  1927. {$EXTERNALSYM _SEC_WINNT_AUTH_IDENTITY}
  1928. TSecWinNTAuthIdentity = TSecWinNTAuthIdentityA;
  1929. PSecWinNTAuthIdentity = PSecWinNTAuthIdentityA;
  1930. {$ENDIF UNICODE}
  1931. //
  1932. // This is the combined authentication identity structure that may be
  1933. // used with the negotiate package, NTLM, Kerberos, or SCHANNEL
  1934. //
  1935. const
  1936. SEC_WINNT_AUTH_IDENTITY_VERSION = $200;
  1937. type
  1938. _SEC_WINNT_AUTH_IDENTITY_EXW = record
  1939. Version: Cardinal;
  1940. Length: Cardinal;
  1941. User: PWideChar;
  1942. UserLength: Cardinal;
  1943. Domain: PWideChar;
  1944. DomainLength: Cardinal;
  1945. Password: PWideChar;
  1946. PasswordLength: Cardinal;
  1947. Flags: Cardinal;
  1948. PackageList: PWideChar;
  1949. PackageListLength: Cardinal;
  1950. end;
  1951. {$EXTERNALSYM _SEC_WINNT_AUTH_IDENTITY_EXW}
  1952. SEC_WINNT_AUTH_IDENTITY_EXW = _SEC_WINNT_AUTH_IDENTITY_EXW;
  1953. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_EXW}
  1954. PSEC_WINNT_AUTH_IDENTITY_EXW = ^SEC_WINNT_AUTH_IDENTITY_EXW;
  1955. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY_EXW}
  1956. TSecWinNTAuthIdentityExW = SEC_WINNT_AUTH_IDENTITY_EXW;
  1957. PSecWinNTAuthIdentityExW = PSEC_WINNT_AUTH_IDENTITY_EXW;
  1958. _SEC_WINNT_AUTH_IDENTITY_EXA = record
  1959. Version: Cardinal;
  1960. Length: Cardinal;
  1961. User: PChar;
  1962. UserLength: Cardinal;
  1963. Domain: PChar;
  1964. DomainLength: Cardinal;
  1965. Password: PChar;
  1966. PasswordLength: Cardinal;
  1967. Flags: Cardinal;
  1968. PackageList: PChar;
  1969. PackageListLength: Cardinal;
  1970. end;
  1971. {$EXTERNALSYM _SEC_WINNT_AUTH_IDENTITY_EXA}
  1972. SEC_WINNT_AUTH_IDENTITY_EXA = _SEC_WINNT_AUTH_IDENTITY_EXA;
  1973. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_EXA}
  1974. PSEC_WINNT_AUTH_IDENTITY_EXA = ^SEC_WINNT_AUTH_IDENTITY_EXA;
  1975. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY_EXA}
  1976. TSecWinNTAuthIdentityExA = SEC_WINNT_AUTH_IDENTITY_EXA;
  1977. PSecWinNTAuthIdentityExA = PSEC_WINNT_AUTH_IDENTITY_EXA;
  1978. {$IFDEF UNICODE}
  1979. SEC_WINNT_AUTH_IDENTITY_EX = SEC_WINNT_AUTH_IDENTITY_EXW;
  1980. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_EX}
  1981. PSEC_WINNT_AUTH_IDENTITY_EX = PSEC_WINNT_AUTH_IDENTITY_EXW;
  1982. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY_EX}
  1983. TSecWinNTAuthIdentityEx = TSecWinNTAuthIdentityExW;
  1984. PSecWinNTAuthIdentityEx = PSecWinNTAuthIdentityExW;
  1985. {$ELSE}
  1986. SEC_WINNT_AUTH_IDENTITY_EX = SEC_WINNT_AUTH_IDENTITY_EXA;
  1987. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_EX}
  1988. PSEC_WINNT_AUTH_IDENTITY_EX = PSEC_WINNT_AUTH_IDENTITY_EXA;
  1989. {$EXTERNALSYM PSEC_WINNT_AUTH_IDENTITY_EX}
  1990. TSecWinNTAuthIdentityEx = TSecWinNTAuthIdentityExA;
  1991. PSecWinNTAuthIdentityEx = PSecWinNTAuthIdentityExA;
  1992. {$ENDIF UNICODE}
  1993. //
  1994. // Common types used by negotiable security packages
  1995. //
  1996. const
  1997. SEC_WINNT_AUTH_IDENTITY_MARSHALLED = $4; // all data is in one buffer
  1998. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_MARSHALLED}
  1999. SEC_WINNT_AUTH_IDENTITY_ONLY = $8; // these credentials are for identity only - no PAC needed
  2000. {$EXTERNALSYM SEC_WINNT_AUTH_IDENTITY_ONLY}
  2001. //
  2002. // Routines for manipulating packages
  2003. //
  2004. type
  2005. _SECURITY_PACKAGE_OPTIONS = record
  2006. Size: Cardinal;
  2007. Type_: Cardinal;
  2008. Flags: Cardinal;
  2009. SignatureSize: Cardinal;
  2010. Signature: Pointer;
  2011. end;
  2012. {$EXTERNALSYM _SECURITY_PACKAGE_OPTIONS}
  2013. SECURITY_PACKAGE_OPTIONS = _SECURITY_PACKAGE_OPTIONS;
  2014. {$EXTERNALSYM SECURITY_PACKAGE_OPTIONS}
  2015. PSECURITY_PACKAGE_OPTIONS = ^SECURITY_PACKAGE_OPTIONS;
  2016. TSecurityPackageOptions = SECURITY_PACKAGE_OPTIONS;
  2017. PSecurityPackageOptions = PSECURITY_PACKAGE_OPTIONS;
  2018. const
  2019. SECPKG_OPTIONS_TYPE_UNKNOWN = 0;
  2020. {$EXTERNALSYM SECPKG_OPTIONS_TYPE_UNKNOWN}
  2021. SECPKG_OPTIONS_TYPE_LSA = 1;
  2022. {$EXTERNALSYM SECPKG_OPTIONS_TYPE_LSA}
  2023. SECPKG_OPTIONS_TYPE_SSPI = 2;
  2024. {$EXTERNALSYM SECPKG_OPTIONS_TYPE_SSPI}
  2025. SECPKG_OPTIONS_PERMANENT = $00000001;
  2026. {$EXTERNALSYM SECPKG_OPTIONS_PERMANENT}
  2027. function AddSecurityPackageA(pszPackageName: PSEC_CHAR; Options: PSECURITY_PACKAGE_OPTIONS): SECURITY_STATUS; stdcall;
  2028. {$EXTERNALSYM AddSecurityPackageA}
  2029. function AddSecurityPackageW(pszPackageName: PSEC_WCHAR; Options: PSECURITY_PACKAGE_OPTIONS): SECURITY_STATUS; stdcall;
  2030. {$EXTERNALSYM AddSecurityPackageW}
  2031. {$IFDEF UNICODE}
  2032. function AddSecurityPackage(pszPackageName: PSEC_WCHAR; Options: PSECURITY_PACKAGE_OPTIONS): SECURITY_STATUS; stdcall;
  2033. {$EXTERNALSYM AddSecurityPackage}
  2034. {$ELSE}
  2035. function AddSecurityPackage(pszPackageName: PSEC_CHAR; Options: PSECURITY_PACKAGE_OPTIONS): SECURITY_STATUS; stdcall;
  2036. {$EXTERNALSYM AddSecurityPackage}
  2037. {$ENDIF UNICODE}
  2038. function DeleteSecurityPackageA(pszPackageName: PSEC_CHAR): SECURITY_STATUS; stdcall;
  2039. {$EXTERNALSYM DeleteSecurityPackageA}
  2040. function DeleteSecurityPackageW(pszPackageName: PSEC_WCHAR): SECURITY_STATUS; stdcall;
  2041. {$EXTERNALSYM DeleteSecurityPackageW}
  2042. {$IFDEF UNICODE}
  2043. function DeleteSecurityPackage(pszPackageName: PSEC_WCHAR): SECURITY_STATUS; stdcall;
  2044. {$EXTERNALSYM DeleteSecurityPackage}
  2045. {$ELSE}
  2046. function DeleteSecurityPackage(pszPackageName: PSEC_CHAR): SECURITY_STATUS; stdcall;
  2047. {$EXTERNALSYM DeleteSecurityPackage}
  2048. {$ENDIF UNICODE}
  2049. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  2050. {$IFNDEF JWA_OMIT_SECTIONS}
  2051. implementation
  2052. //uses ...
  2053. {$ENDIF JWA_OMIT_SECTIONS}
  2054. {$IFNDEF JWA_INTERFACESECTION}
  2055. {$IFNDEF JWA_INCLUDEMODE}
  2056. const
  2057. secur32 = 'secur32.dll';
  2058. {$IFDEF UNICODE}
  2059. AWSuffix = 'W';
  2060. {$ELSE}
  2061. AWSuffix = 'A';
  2062. {$ENDIF UNICODE}
  2063. {$ENDIF JWA_INCLUDEMODE}
  2064. procedure SecInvalidateHandle(var x: SecHandle);
  2065. begin
  2066. x.dwLower := ULONG_PTR(-1);
  2067. x.dwUpper := ULONG_PTR(-1);
  2068. end;
  2069. function SecIsValidHandle(x: SecHandle): Boolean;
  2070. begin
  2071. Result := (x.dwLower <> ULONG_PTR(-1)) and (x.dwUpper <> ULONG_PTR(-1));
  2072. end;
  2073. function FreeCredentialHandle(phCredential: PCredHandle): SECURITY_STATUS;
  2074. begin
  2075. Result := FreeCredentialsHandle(phCredential);
  2076. end;
  2077. //function SspiLogonUserW; external secur32 name 'SspiLogonUserW';
  2078. //function SspiLogonUserA; external secur32 name 'SspiLogonUserA';
  2079. //{$IFDEF UNICODE}
  2080. //function SspiLogonUser; external secur32 name 'SspiLogonUserW';
  2081. //{$ELSE}
  2082. //function SspiLogonUser; external secur32 name 'SspiLogonUserA';
  2083. //{$ENDIF UNICODE}
  2084. //function DelegateSecurityContext; external secur32 name 'DelegateSecurityContext';
  2085. {$IFDEF DYNAMIC_LINK}
  2086. var
  2087. _AcquireCredentialsHandleW: Pointer;
  2088. function AcquireCredentialsHandleW;
  2089. begin
  2090. GetProcedureAddress(_AcquireCredentialsHandleW, secur32, 'AcquireCredentialsHandleW');
  2091. asm
  2092. MOV ESP, EBP
  2093. POP EBP
  2094. JMP [_AcquireCredentialsHandleW]
  2095. end;
  2096. end;
  2097. var
  2098. _AcquireCredentialsHandleA: Pointer;
  2099. function AcquireCredentialsHandleA;
  2100. begin
  2101. GetProcedureAddress(_AcquireCredentialsHandleA, secur32, 'AcquireCredentialsHandleA');
  2102. asm
  2103. MOV ESP, EBP
  2104. POP EBP
  2105. JMP [_AcquireCredentialsHandleA]
  2106. end;
  2107. end;
  2108. var
  2109. _AcquireCredentialsHandle: Pointer;
  2110. function AcquireCredentialsHandle;
  2111. begin
  2112. GetProcedureAddress(_AcquireCredentialsHandle, secur32, 'AcquireCredentialsHandle' + AWSuffix);
  2113. asm
  2114. MOV ESP, EBP
  2115. POP EBP
  2116. JMP [_AcquireCredentialsHandle]
  2117. end;
  2118. end;
  2119. var
  2120. _FreeCredentialsHandle: Pointer;
  2121. function FreeCredentialsHandle;
  2122. begin
  2123. GetProcedureAddress(_FreeCredentialsHandle, secur32, 'FreeCredentialsHandle');
  2124. asm
  2125. MOV ESP, EBP
  2126. POP EBP
  2127. JMP [_FreeCredentialsHandle]
  2128. end;
  2129. end;
  2130. var
  2131. _AddCredentialsW: Pointer;
  2132. function AddCredentialsW;
  2133. begin
  2134. GetProcedureAddress(_AddCredentialsW, secur32, 'AddCredentialsW');
  2135. asm
  2136. MOV ESP, EBP
  2137. POP EBP
  2138. JMP [_AddCredentialsW]
  2139. end;
  2140. end;
  2141. var
  2142. _AddCredentialsA: Pointer;
  2143. function AddCredentialsA;
  2144. begin
  2145. GetProcedureAddress(_AddCredentialsA, secur32, 'AddCredentialsA');
  2146. asm
  2147. MOV ESP, EBP
  2148. POP EBP
  2149. JMP [_AddCredentialsA]
  2150. end;
  2151. end;
  2152. var
  2153. _AddCredentials: Pointer;
  2154. function AddCredentials;
  2155. begin
  2156. GetProcedureAddress(_AddCredentials, secur32, 'AddCredentials' + AWSuffix);
  2157. asm
  2158. MOV ESP, EBP
  2159. POP EBP
  2160. JMP [_AddCredentials]
  2161. end;
  2162. end;
  2163. var
  2164. _InitializeSecurityContextW: Pointer;
  2165. function InitializeSecurityContextW;
  2166. begin
  2167. GetProcedureAddress(_InitializeSecurityContextW, secur32, 'InitializeSecurityContextW');
  2168. asm
  2169. MOV ESP, EBP
  2170. POP EBP
  2171. JMP [_InitializeSecurityContextW]
  2172. end;
  2173. end;
  2174. var
  2175. _InitializeSecurityContextA: Pointer;
  2176. function InitializeSecurityContextA;
  2177. begin
  2178. GetProcedureAddress(_InitializeSecurityContextA, secur32, 'InitializeSecurityContextA');
  2179. asm
  2180. MOV ESP, EBP
  2181. POP EBP
  2182. JMP [_InitializeSecurityContextA]
  2183. end;
  2184. end;
  2185. var
  2186. _InitializeSecurityContext: Pointer;
  2187. function InitializeSecurityContext;
  2188. begin
  2189. GetProcedureAddress(_InitializeSecurityContext, secur32, 'InitializeSecurityContext' + AWSuffix);
  2190. asm
  2191. MOV ESP, EBP
  2192. POP EBP
  2193. JMP [_InitializeSecurityContext]
  2194. end;
  2195. end;
  2196. var
  2197. _AcceptSecurityContext: Pointer;
  2198. function AcceptSecurityContext;
  2199. begin
  2200. GetProcedureAddress(_AcceptSecurityContext, secur32, 'AcceptSecurityContext');
  2201. asm
  2202. MOV ESP, EBP
  2203. POP EBP
  2204. JMP [_AcceptSecurityContext]
  2205. end;
  2206. end;
  2207. var
  2208. _CompleteAuthToken: Pointer;
  2209. function CompleteAuthToken;
  2210. begin
  2211. GetProcedureAddress(_CompleteAuthToken, secur32, 'CompleteAuthToken');
  2212. asm
  2213. MOV ESP, EBP
  2214. POP EBP
  2215. JMP [_CompleteAuthToken]
  2216. end;
  2217. end;
  2218. var
  2219. _ImpersonateSecurityContext: Pointer;
  2220. function ImpersonateSecurityContext;
  2221. begin
  2222. GetProcedureAddress(_ImpersonateSecurityContext, secur32, 'ImpersonateSecurityContext');
  2223. asm
  2224. MOV ESP, EBP
  2225. POP EBP
  2226. JMP [_ImpersonateSecurityContext]
  2227. end;
  2228. end;
  2229. var
  2230. _RevertSecurityContext: Pointer;
  2231. function RevertSecurityContext;
  2232. begin
  2233. GetProcedureAddress(_RevertSecurityContext, secur32, 'RevertSecurityContext');
  2234. asm
  2235. MOV ESP, EBP
  2236. POP EBP
  2237. JMP [_RevertSecurityContext]
  2238. end;
  2239. end;
  2240. var
  2241. _QuerySecurityContextToken: Pointer;
  2242. function QuerySecurityContextToken;
  2243. begin
  2244. GetProcedureAddress(_QuerySecurityContextToken, secur32, 'QuerySecurityContextToken');
  2245. asm
  2246. MOV ESP, EBP
  2247. POP EBP
  2248. JMP [_QuerySecurityContextToken]
  2249. end;
  2250. end;
  2251. var
  2252. _DeleteSecurityContext: Pointer;
  2253. function DeleteSecurityContext;
  2254. begin
  2255. GetProcedureAddress(_DeleteSecurityContext, secur32, 'DeleteSecurityContext');
  2256. asm
  2257. MOV ESP, EBP
  2258. POP EBP
  2259. JMP [_DeleteSecurityContext]
  2260. end;
  2261. end;
  2262. var
  2263. _ApplyControlToken: Pointer;
  2264. function ApplyControlToken;
  2265. begin
  2266. GetProcedureAddress(_ApplyControlToken, secur32, 'ApplyControlToken');
  2267. asm
  2268. MOV ESP, EBP
  2269. POP EBP
  2270. JMP [_ApplyControlToken]
  2271. end;
  2272. end;
  2273. var
  2274. _QueryContextAttributesW: Pointer;
  2275. function QueryContextAttributesW;
  2276. begin
  2277. GetProcedureAddress(_QueryContextAttributesW, secur32, 'QueryContextAttributesW');
  2278. asm
  2279. MOV ESP, EBP
  2280. POP EBP
  2281. JMP [_QueryContextAttributesW]
  2282. end;
  2283. end;
  2284. var
  2285. _QueryContextAttributesA: Pointer;
  2286. function QueryContextAttributesA;
  2287. begin
  2288. GetProcedureAddress(_QueryContextAttributesA, secur32, 'QueryContextAttributesA');
  2289. asm
  2290. MOV ESP, EBP
  2291. POP EBP
  2292. JMP [_QueryContextAttributesA]
  2293. end;
  2294. end;
  2295. var
  2296. _QueryContextAttributes: Pointer;
  2297. function QueryContextAttributes;
  2298. begin
  2299. GetProcedureAddress(_QueryContextAttributes, secur32, 'QueryContextAttributes' + AWSuffix);
  2300. asm
  2301. MOV ESP, EBP
  2302. POP EBP
  2303. JMP [_QueryContextAttributes]
  2304. end;
  2305. end;
  2306. var
  2307. _SetContextAttributesW: Pointer;
  2308. function SetContextAttributesW;
  2309. begin
  2310. GetProcedureAddress(_SetContextAttributesW, secur32, 'SetContextAttributesW');
  2311. asm
  2312. MOV ESP, EBP
  2313. POP EBP
  2314. JMP [_SetContextAttributesW]
  2315. end;
  2316. end;
  2317. var
  2318. _SetContextAttributesA: Pointer;
  2319. function SetContextAttributesA;
  2320. begin
  2321. GetProcedureAddress(_SetContextAttributesA, secur32, 'SetContextAttributesA');
  2322. asm
  2323. MOV ESP, EBP
  2324. POP EBP
  2325. JMP [_SetContextAttributesA]
  2326. end;
  2327. end;
  2328. var
  2329. _SetContextAttributes: Pointer;
  2330. function SetContextAttributes;
  2331. begin
  2332. GetProcedureAddress(_SetContextAttributes, secur32, 'SetContextAttributes' + AWSuffix);
  2333. asm
  2334. MOV ESP, EBP
  2335. POP EBP
  2336. JMP [_SetContextAttributes]
  2337. end;
  2338. end;
  2339. var
  2340. _QueryCredentialsAttributesW: Pointer;
  2341. function QueryCredentialsAttributesW;
  2342. begin
  2343. GetProcedureAddress(_QueryCredentialsAttributesW, secur32, 'QueryCredentialsAttributesW');
  2344. asm
  2345. MOV ESP, EBP
  2346. POP EBP
  2347. JMP [_QueryCredentialsAttributesW]
  2348. end;
  2349. end;
  2350. var
  2351. _QueryCredentialsAttributesA: Pointer;
  2352. function QueryCredentialsAttributesA;
  2353. begin
  2354. GetProcedureAddress(_QueryCredentialsAttributesA, secur32, 'QueryCredentialsAttributesA');
  2355. asm
  2356. MOV ESP, EBP
  2357. POP EBP
  2358. JMP [_QueryCredentialsAttributesA]
  2359. end;
  2360. end;
  2361. var
  2362. _QueryCredentialsAttributes: Pointer;
  2363. function QueryCredentialsAttributes;
  2364. begin
  2365. GetProcedureAddress(_QueryCredentialsAttributes, secur32, 'QueryCredentialsAttributes' + AWSuffix);
  2366. asm
  2367. MOV ESP, EBP
  2368. POP EBP
  2369. JMP [_QueryCredentialsAttributes]
  2370. end;
  2371. end;
  2372. var
  2373. _FreeContextBuffer: Pointer;
  2374. function FreeContextBuffer;
  2375. begin
  2376. GetProcedureAddress(_FreeContextBuffer, secur32, 'FreeContextBuffer');
  2377. asm
  2378. MOV ESP, EBP
  2379. POP EBP
  2380. JMP [_FreeContextBuffer]
  2381. end;
  2382. end;
  2383. var
  2384. _MakeSignature: Pointer;
  2385. function MakeSignature;
  2386. begin
  2387. GetProcedureAddress(_MakeSignature, secur32, 'MakeSignature');
  2388. asm
  2389. MOV ESP, EBP
  2390. POP EBP
  2391. JMP [_MakeSignature]
  2392. end;
  2393. end;
  2394. var
  2395. _VerifySignature: Pointer;
  2396. function VerifySignature;
  2397. begin
  2398. GetProcedureAddress(_VerifySignature, secur32, 'VerifySignature');
  2399. asm
  2400. MOV ESP, EBP
  2401. POP EBP
  2402. JMP [_VerifySignature]
  2403. end;
  2404. end;
  2405. var
  2406. _EncryptMessage: Pointer;
  2407. function EncryptMessage;
  2408. begin
  2409. GetProcedureAddress(_EncryptMessage, secur32, 'EncryptMessage');
  2410. asm
  2411. MOV ESP, EBP
  2412. POP EBP
  2413. JMP [_EncryptMessage]
  2414. end;
  2415. end;
  2416. var
  2417. _DecryptMessage: Pointer;
  2418. function DecryptMessage;
  2419. begin
  2420. GetProcedureAddress(_DecryptMessage, secur32, 'DecryptMessage');
  2421. asm
  2422. MOV ESP, EBP
  2423. POP EBP
  2424. JMP [_DecryptMessage]
  2425. end;
  2426. end;
  2427. var
  2428. _EnumerateSecurityPackagesW: Pointer;
  2429. function EnumerateSecurityPackagesW;
  2430. begin
  2431. GetProcedureAddress(_EnumerateSecurityPackagesW, secur32, 'EnumerateSecurityPackagesW');
  2432. asm
  2433. MOV ESP, EBP
  2434. POP EBP
  2435. JMP [_EnumerateSecurityPackagesW]
  2436. end;
  2437. end;
  2438. var
  2439. _EnumerateSecurityPackagesA: Pointer;
  2440. function EnumerateSecurityPackagesA;
  2441. begin
  2442. GetProcedureAddress(_EnumerateSecurityPackagesA, secur32, 'EnumerateSecurityPackagesA');
  2443. asm
  2444. MOV ESP, EBP
  2445. POP EBP
  2446. JMP [_EnumerateSecurityPackagesA]
  2447. end;
  2448. end;
  2449. var
  2450. _EnumerateSecurityPackages: Pointer;
  2451. function EnumerateSecurityPackages;
  2452. begin
  2453. GetProcedureAddress(_EnumerateSecurityPackages, secur32, 'EnumerateSecurityPackages' + AWSuffix);
  2454. asm
  2455. MOV ESP, EBP
  2456. POP EBP
  2457. JMP [_EnumerateSecurityPackages]
  2458. end;
  2459. end;
  2460. var
  2461. _QuerySecurityPackageInfoW: Pointer;
  2462. function QuerySecurityPackageInfoW;
  2463. begin
  2464. GetProcedureAddress(_QuerySecurityPackageInfoW, secur32, 'QuerySecurityPackageInfoW');
  2465. asm
  2466. MOV ESP, EBP
  2467. POP EBP
  2468. JMP [_QuerySecurityPackageInfoW]
  2469. end;
  2470. end;
  2471. var
  2472. _QuerySecurityPackageInfoA: Pointer;
  2473. function QuerySecurityPackageInfoA;
  2474. begin
  2475. GetProcedureAddress(_QuerySecurityPackageInfoA, secur32, 'QuerySecurityPackageInfoA');
  2476. asm
  2477. MOV ESP, EBP
  2478. POP EBP
  2479. JMP [_QuerySecurityPackageInfoA]
  2480. end;
  2481. end;
  2482. var
  2483. _QuerySecurityPackageInfo: Pointer;
  2484. function QuerySecurityPackageInfo;
  2485. begin
  2486. GetProcedureAddress(_QuerySecurityPackageInfo, secur32, 'QuerySecurityPackageInfo' + AWSuffix);
  2487. asm
  2488. MOV ESP, EBP
  2489. POP EBP
  2490. JMP [_QuerySecurityPackageInfo]
  2491. end;
  2492. end;
  2493. var
  2494. _ExportSecurityContext: Pointer;
  2495. function ExportSecurityContext;
  2496. begin
  2497. GetProcedureAddress(_ExportSecurityContext, secur32, 'ExportSecurityContext');
  2498. asm
  2499. MOV ESP, EBP
  2500. POP EBP
  2501. JMP [_ExportSecurityContext]
  2502. end;
  2503. end;
  2504. var
  2505. _ImportSecurityContextW: Pointer;
  2506. function ImportSecurityContextW;
  2507. begin
  2508. GetProcedureAddress(_ImportSecurityContextW, secur32, 'ImportSecurityContextW');
  2509. asm
  2510. MOV ESP, EBP
  2511. POP EBP
  2512. JMP [_ImportSecurityContextW]
  2513. end;
  2514. end;
  2515. var
  2516. _ImportSecurityContextA: Pointer;
  2517. function ImportSecurityContextA;
  2518. begin
  2519. GetProcedureAddress(_ImportSecurityContextA, secur32, 'ImportSecurityContextA');
  2520. asm
  2521. MOV ESP, EBP
  2522. POP EBP
  2523. JMP [_ImportSecurityContextA]
  2524. end;
  2525. end;
  2526. var
  2527. _ImportSecurityContext: Pointer;
  2528. function ImportSecurityContext;
  2529. begin
  2530. GetProcedureAddress(_ImportSecurityContext, secur32, 'ImportSecurityContext' + AWSuffix);
  2531. asm
  2532. MOV ESP, EBP
  2533. POP EBP
  2534. JMP [_ImportSecurityContext]
  2535. end;
  2536. end;
  2537. var
  2538. _InitSecurityInterfaceA: Pointer;
  2539. function InitSecurityInterfaceA;
  2540. begin
  2541. GetProcedureAddress(_InitSecurityInterfaceA, secur32, 'InitSecurityInterfaceA');
  2542. asm
  2543. MOV ESP, EBP
  2544. POP EBP
  2545. JMP [_InitSecurityInterfaceA]
  2546. end;
  2547. end;
  2548. var
  2549. _InitSecurityInterfaceW: Pointer;
  2550. function InitSecurityInterfaceW;
  2551. begin
  2552. GetProcedureAddress(_InitSecurityInterfaceW, secur32, 'InitSecurityInterfaceW');
  2553. asm
  2554. MOV ESP, EBP
  2555. POP EBP
  2556. JMP [_InitSecurityInterfaceW]
  2557. end;
  2558. end;
  2559. var
  2560. _InitSecurityInterface: Pointer;
  2561. function InitSecurityInterface;
  2562. begin
  2563. GetProcedureAddress(_InitSecurityInterface, secur32, 'InitSecurityInterface' + AWSuffix);
  2564. asm
  2565. MOV ESP, EBP
  2566. POP EBP
  2567. JMP [_InitSecurityInterface]
  2568. end;
  2569. end;
  2570. var
  2571. _SaslEnumerateProfilesA: Pointer;
  2572. function SaslEnumerateProfilesA;
  2573. begin
  2574. GetProcedureAddress(_SaslEnumerateProfilesA, secur32, 'SaslEnumerateProfilesA');
  2575. asm
  2576. MOV ESP, EBP
  2577. POP EBP
  2578. JMP [_SaslEnumerateProfilesA]
  2579. end;
  2580. end;
  2581. var
  2582. _SaslEnumerateProfilesW: Pointer;
  2583. function SaslEnumerateProfilesW;
  2584. begin
  2585. GetProcedureAddress(_SaslEnumerateProfilesW, secur32, 'SaslEnumerateProfilesW');
  2586. asm
  2587. MOV ESP, EBP
  2588. POP EBP
  2589. JMP [_SaslEnumerateProfilesW]
  2590. end;
  2591. end;
  2592. var
  2593. _SaslEnumerateProfiles: Pointer;
  2594. function SaslEnumerateProfiles;
  2595. begin
  2596. GetProcedureAddress(_SaslEnumerateProfiles, secur32, 'SaslEnumerateProfiles' + AWSuffix);
  2597. asm
  2598. MOV ESP, EBP
  2599. POP EBP
  2600. JMP [_SaslEnumerateProfiles]
  2601. end;
  2602. end;
  2603. var
  2604. _SaslGetProfilePackageA: Pointer;
  2605. function SaslGetProfilePackageA;
  2606. begin
  2607. GetProcedureAddress(_SaslGetProfilePackageA, secur32, 'SaslGetProfilePackageA');
  2608. asm
  2609. MOV ESP, EBP
  2610. POP EBP
  2611. JMP [_SaslGetProfilePackageA]
  2612. end;
  2613. end;
  2614. var
  2615. _SaslGetProfilePackageW: Pointer;
  2616. function SaslGetProfilePackageW;
  2617. begin
  2618. GetProcedureAddress(_SaslGetProfilePackageW, secur32, 'SaslGetProfilePackageW');
  2619. asm
  2620. MOV ESP, EBP
  2621. POP EBP
  2622. JMP [_SaslGetProfilePackageW]
  2623. end;
  2624. end;
  2625. var
  2626. _SaslGetProfilePackage: Pointer;
  2627. function SaslGetProfilePackage;
  2628. begin
  2629. GetProcedureAddress(_SaslGetProfilePackage, secur32, 'SaslGetProfilePackage' + AWSuffix);
  2630. asm
  2631. MOV ESP, EBP
  2632. POP EBP
  2633. JMP [_SaslGetProfilePackage]
  2634. end;
  2635. end;
  2636. var
  2637. _SaslIdentifyPackageA: Pointer;
  2638. function SaslIdentifyPackageA;
  2639. begin
  2640. GetProcedureAddress(_SaslIdentifyPackageA, secur32, 'SaslIdentifyPackageA');
  2641. asm
  2642. MOV ESP, EBP
  2643. POP EBP
  2644. JMP [_SaslIdentifyPackageA]
  2645. end;
  2646. end;
  2647. var
  2648. _SaslIdentifyPackageW: Pointer;
  2649. function SaslIdentifyPackageW;
  2650. begin
  2651. GetProcedureAddress(_SaslIdentifyPackageW, secur32, 'SaslIdentifyPackageW');
  2652. asm
  2653. MOV ESP, EBP
  2654. POP EBP
  2655. JMP [_SaslIdentifyPackageW]
  2656. end;
  2657. end;
  2658. var
  2659. _SaslIdentifyPackage: Pointer;
  2660. function SaslIdentifyPackage;
  2661. begin
  2662. GetProcedureAddress(_SaslIdentifyPackage, secur32, 'SaslIdentifyPackage' + AWSuffix);
  2663. asm
  2664. MOV ESP, EBP
  2665. POP EBP
  2666. JMP [_SaslIdentifyPackage]
  2667. end;
  2668. end;
  2669. var
  2670. _SaslInitializeSecurityContextW: Pointer;
  2671. function SaslInitializeSecurityContextW;
  2672. begin
  2673. GetProcedureAddress(_SaslInitializeSecurityContextW, secur32, 'SaslInitializeSecurityContextW');
  2674. asm
  2675. MOV ESP, EBP
  2676. POP EBP
  2677. JMP [_SaslInitializeSecurityContextW]
  2678. end;
  2679. end;
  2680. var
  2681. _SaslInitializeSecurityContextA: Pointer;
  2682. function SaslInitializeSecurityContextA;
  2683. begin
  2684. GetProcedureAddress(_SaslInitializeSecurityContextA, secur32, 'SaslInitializeSecurityContextA');
  2685. asm
  2686. MOV ESP, EBP
  2687. POP EBP
  2688. JMP [_SaslInitializeSecurityContextA]
  2689. end;
  2690. end;
  2691. var
  2692. _SaslInitializeSecurityContext: Pointer;
  2693. function SaslInitializeSecurityContext;
  2694. begin
  2695. GetProcedureAddress(_SaslInitializeSecurityContext, secur32, 'SaslInitializeSecurityContext' + AWSuffix);
  2696. asm
  2697. MOV ESP, EBP
  2698. POP EBP
  2699. JMP [_SaslInitializeSecurityContext]
  2700. end;
  2701. end;
  2702. var
  2703. _SaslAcceptSecurityContext: Pointer;
  2704. function SaslAcceptSecurityContext;
  2705. begin
  2706. GetProcedureAddress(_SaslAcceptSecurityContext, secur32, 'SaslAcceptSecurityContext');
  2707. asm
  2708. MOV ESP, EBP
  2709. POP EBP
  2710. JMP [_SaslAcceptSecurityContext]
  2711. end;
  2712. end;
  2713. var
  2714. _SaslSetContextOption: Pointer;
  2715. function SaslSetContextOption;
  2716. begin
  2717. GetProcedureAddress(_SaslSetContextOption, secur32, 'SaslSetContextOption');
  2718. asm
  2719. MOV ESP, EBP
  2720. POP EBP
  2721. JMP [_SaslSetContextOption]
  2722. end;
  2723. end;
  2724. var
  2725. _SaslGetContextOption: Pointer;
  2726. function SaslGetContextOption;
  2727. begin
  2728. GetProcedureAddress(_SaslGetContextOption, secur32, 'SaslGetContextOption');
  2729. asm
  2730. MOV ESP, EBP
  2731. POP EBP
  2732. JMP [_SaslGetContextOption]
  2733. end;
  2734. end;
  2735. var
  2736. _AddSecurityPackageA: Pointer;
  2737. function AddSecurityPackageA;
  2738. begin
  2739. GetProcedureAddress(_AddSecurityPackageA, secur32, 'AddSecurityPackageA');
  2740. asm
  2741. MOV ESP, EBP
  2742. POP EBP
  2743. JMP [_AddSecurityPackageA]
  2744. end;
  2745. end;
  2746. var
  2747. _AddSecurityPackageW: Pointer;
  2748. function AddSecurityPackageW;
  2749. begin
  2750. GetProcedureAddress(_AddSecurityPackageW, secur32, 'AddSecurityPackageW');
  2751. asm
  2752. MOV ESP, EBP
  2753. POP EBP
  2754. JMP [_AddSecurityPackageW]
  2755. end;
  2756. end;
  2757. var
  2758. _AddSecurityPackage: Pointer;
  2759. function AddSecurityPackage;
  2760. begin
  2761. GetProcedureAddress(_AddSecurityPackage, secur32, 'AddSecurityPackage' + AWSuffix);
  2762. asm
  2763. MOV ESP, EBP
  2764. POP EBP
  2765. JMP [_AddSecurityPackage]
  2766. end;
  2767. end;
  2768. var
  2769. _DeleteSecurityPackageA: Pointer;
  2770. function DeleteSecurityPackageA;
  2771. begin
  2772. GetProcedureAddress(_DeleteSecurityPackageA, secur32, 'DeleteSecurityPackageA');
  2773. asm
  2774. MOV ESP, EBP
  2775. POP EBP
  2776. JMP [_DeleteSecurityPackageA]
  2777. end;
  2778. end;
  2779. var
  2780. _DeleteSecurityPackageW: Pointer;
  2781. function DeleteSecurityPackageW;
  2782. begin
  2783. GetProcedureAddress(_DeleteSecurityPackageW, secur32, 'DeleteSecurityPackageW');
  2784. asm
  2785. MOV ESP, EBP
  2786. POP EBP
  2787. JMP [_DeleteSecurityPackageW]
  2788. end;
  2789. end;
  2790. var
  2791. _DeleteSecurityPackage: Pointer;
  2792. function DeleteSecurityPackage;
  2793. begin
  2794. GetProcedureAddress(_DeleteSecurityPackage, secur32, 'DeleteSecurityPackage' + AWSuffix);
  2795. asm
  2796. MOV ESP, EBP
  2797. POP EBP
  2798. JMP [_DeleteSecurityPackage]
  2799. end;
  2800. end;
  2801. {$ELSE}
  2802. function AcquireCredentialsHandleW; external secur32 name 'AcquireCredentialsHandleW';
  2803. function AcquireCredentialsHandleA; external secur32 name 'AcquireCredentialsHandleA';
  2804. function AcquireCredentialsHandle; external secur32 name 'AcquireCredentialsHandle' + AWSuffix;
  2805. function FreeCredentialsHandle; external secur32 name 'FreeCredentialsHandle';
  2806. function AddCredentialsW; external secur32 name 'AddCredentialsW';
  2807. function AddCredentialsA; external secur32 name 'AddCredentialsA';
  2808. function AddCredentials; external secur32 name 'AddCredentials' + AWSuffix;
  2809. function InitializeSecurityContextW; external secur32 name 'InitializeSecurityContextW';
  2810. function InitializeSecurityContextA; external secur32 name 'InitializeSecurityContextA';
  2811. function InitializeSecurityContext; external secur32 name 'InitializeSecurityContext' + AWSuffix;
  2812. function AcceptSecurityContext; external secur32 name 'AcceptSecurityContext';
  2813. function CompleteAuthToken; external secur32 name 'CompleteAuthToken';
  2814. function ImpersonateSecurityContext; external secur32 name 'ImpersonateSecurityContext';
  2815. function RevertSecurityContext; external secur32 name 'RevertSecurityContext';
  2816. function QuerySecurityContextToken; external secur32 name 'QuerySecurityContextToken';
  2817. function DeleteSecurityContext; external secur32 name 'DeleteSecurityContext';
  2818. function ApplyControlToken; external secur32 name 'ApplyControlToken';
  2819. function QueryContextAttributesW; external secur32 name 'QueryContextAttributesW';
  2820. function QueryContextAttributesA; external secur32 name 'QueryContextAttributesA';
  2821. function QueryContextAttributes; external secur32 name 'QueryContextAttributes' + AWSuffix;
  2822. function SetContextAttributesW; external secur32 name 'SetContextAttributesW';
  2823. function SetContextAttributesA; external secur32 name 'SetContextAttributesA';
  2824. function SetContextAttributes; external secur32 name 'SetContextAttributes' + AWSuffix;
  2825. function QueryCredentialsAttributesW; external secur32 name 'QueryCredentialsAttributesW';
  2826. function QueryCredentialsAttributesA; external secur32 name 'QueryCredentialsAttributesA';
  2827. function QueryCredentialsAttributes; external secur32 name 'QueryCredentialsAttributes' + AWSuffix;
  2828. function FreeContextBuffer; external secur32 name 'FreeContextBuffer';
  2829. function MakeSignature; external secur32 name 'MakeSignature';
  2830. function VerifySignature; external secur32 name 'VerifySignature';
  2831. function EncryptMessage; external secur32 name 'EncryptMessage';
  2832. function DecryptMessage; external secur32 name 'DecryptMessage';
  2833. function EnumerateSecurityPackagesW; external secur32 name 'EnumerateSecurityPackagesW';
  2834. function EnumerateSecurityPackagesA; external secur32 name 'EnumerateSecurityPackagesA';
  2835. function EnumerateSecurityPackages; external secur32 name 'EnumerateSecurityPackages' + AWSuffix;
  2836. function QuerySecurityPackageInfoW; external secur32 name 'QuerySecurityPackageInfoW';
  2837. function QuerySecurityPackageInfoA; external secur32 name 'QuerySecurityPackageInfoA';
  2838. function QuerySecurityPackageInfo; external secur32 name 'QuerySecurityPackageInfo' + AWSuffix;
  2839. function ExportSecurityContext; external secur32 name 'ExportSecurityContext';
  2840. function ImportSecurityContextW; external secur32 name 'ImportSecurityContextW';
  2841. function ImportSecurityContextA; external secur32 name 'ImportSecurityContextA';
  2842. function ImportSecurityContext; external secur32 name 'ImportSecurityContext' + AWSuffix;
  2843. function InitSecurityInterfaceA; external secur32 name 'InitSecurityInterfaceA';
  2844. function InitSecurityInterfaceW; external secur32 name 'InitSecurityInterfaceW';
  2845. function InitSecurityInterface; external secur32 name 'InitSecurityInterface' + AWSuffix;
  2846. function SaslEnumerateProfilesA; external secur32 name 'SaslEnumerateProfilesA';
  2847. function SaslEnumerateProfilesW; external secur32 name 'SaslEnumerateProfilesW';
  2848. function SaslEnumerateProfiles; external secur32 name 'SaslEnumerateProfiles' + AWSuffix;
  2849. function SaslGetProfilePackageA; external secur32 name 'SaslGetProfilePackageA';
  2850. function SaslGetProfilePackageW; external secur32 name 'SaslGetProfilePackageW';
  2851. function SaslGetProfilePackage; external secur32 name 'SaslGetProfilePackage' + AWSuffix;
  2852. function SaslIdentifyPackageA; external secur32 name 'SaslIdentifyPackageA';
  2853. function SaslIdentifyPackageW; external secur32 name 'SaslIdentifyPackageW';
  2854. function SaslIdentifyPackage; external secur32 name 'SaslIdentifyPackage' + AWSuffix;
  2855. function SaslInitializeSecurityContextW; external secur32 name 'SaslInitializeSecurityContextW';
  2856. function SaslInitializeSecurityContextA; external secur32 name 'SaslInitializeSecurityContextA';
  2857. function SaslInitializeSecurityContext; external secur32 name 'SaslInitializeSecurityContext' + AWSuffix;
  2858. function SaslAcceptSecurityContext; external secur32 name 'SaslAcceptSecurityContext';
  2859. function SaslSetContextOption; external secur32 name 'SaslSetContextOption';
  2860. function SaslGetContextOption; external secur32 name 'SaslGetContextOption';
  2861. function AddSecurityPackageA; external secur32 name 'AddSecurityPackageA';
  2862. function AddSecurityPackageW; external secur32 name 'AddSecurityPackageW';
  2863. function AddSecurityPackage; external secur32 name 'AddSecurityPackage' + AWSuffix;
  2864. function DeleteSecurityPackageA; external secur32 name 'DeleteSecurityPackageA';
  2865. function DeleteSecurityPackageW; external secur32 name 'DeleteSecurityPackageW';
  2866. function DeleteSecurityPackage; external secur32 name 'DeleteSecurityPackage' + AWSuffix;
  2867. {$ENDIF DYNAMIC_LINK}
  2868. {$ENDIF JWA_INTERFACESECTION}
  2869. {$IFNDEF JWA_OMIT_SECTIONS}
  2870. end.
  2871. {$ENDIF JWA_OMIT_SECTIONS}