jwasspi.pas 110 KB

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