jwasspi.pas 109 KB

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