jwantdsapi.pas 170 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241
  1. {******************************************************************************}
  2. { }
  3. { DC and Replication Management 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: ntdsapi.h, released June 2000. The original Pascal }
  9. { code is: NtDsApi.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: JwaNtDsApi.pas,v 1.10 2005/09/06 16:36:50 marquardt Exp $
  43. unit JwaNtDsApi;
  44. {$WEAKPACKAGEUNIT}
  45. {$I jediapilib.inc}
  46. interface
  47. uses
  48. JwaWindows, JwaSchedule;
  49. {$HPPEMIT ''}
  50. {$HPPEMIT '#include "ntdsapi.h"'}
  51. {$HPPEMIT ''}
  52. {$HPPEMIT 'typedef PDS_REPSYNCALL_ERRINFOW *PPDS_REPSYNCALL_ERRINFOW'}
  53. {$HPPEMIT 'typedef PDS_REPSYNCALL_ERRINFOA *PPDS_REPSYNCALL_ERRINFOA'}
  54. {$HPPEMIT '#ifdef UNICODE'}
  55. {$HPPEMIT 'typedef PPDS_REPSYNCALL_ERRINFOW PPDS_REPSYNCALL_ERRINFO'}
  56. {$HPPEMIT '#else'}
  57. {$HPPEMIT 'typedef PPDS_REPSYNCALL_ERRINFOA PPDS_REPSYNCALL_ERRINFO'}
  58. {$HPPEMIT '#endif'}
  59. {$HPPEMIT ''}
  60. //////////////////////////////////////////////////////////////////////////
  61. // //
  62. // Data definitions //
  63. // //
  64. //////////////////////////////////////////////////////////////////////////
  65. // Following constants define the Active Directory Behavior
  66. // Version numbers.
  67. const
  68. DS_BEHAVIOR_WIN2000 = 0;
  69. {$EXTERNALSYM DS_BEHAVIOR_WIN2000}
  70. DS_BEHAVIOR_WIN_DOT_NET_WITH_MIXED_DOMAINS = 1;
  71. {$EXTERNALSYM DS_BEHAVIOR_WIN_DOT_NET_WITH_MIXED_DOMAINS}
  72. DS_BEHAVIOR_WIN_DOT_NET = 2;
  73. {$EXTERNALSYM DS_BEHAVIOR_WIN_DOT_NET}
  74. // (MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT))
  75. DS_DEFAULT_LOCALE = DWORD((DWORD(SORT_DEFAULT) shl 16) or ((SUBLANG_ENGLISH_US shl 10) or LANG_ENGLISH));
  76. {$EXTERNALSYM DS_DEFAULT_LOCALE}
  77. DS_DEFAULT_LOCALE_COMPARE_FLAGS = (NORM_IGNORECASE or NORM_IGNOREKANATYPE or
  78. NORM_IGNORENONSPACE or NORM_IGNOREWIDTH or SORT_STRINGSORT);
  79. {$EXTERNALSYM DS_DEFAULT_LOCALE_COMPARE_FLAGS}
  80. // When booted to DS mode, this event is signalled when the DS has completed
  81. // its initial sync attempts. The period of time between system startup and
  82. // this event's state being set is indeterminate from the local service's
  83. // standpoint. In the meantime the contents of the DS should be considered
  84. // incomplete / out-dated, and the machine will not be advertised as a domain
  85. // controller to off-machine clients. Other local services that rely on
  86. // information published in the DS should avoid accessing (or at least
  87. // relying on) the contents of the DS until this event is set.
  88. DS_SYNCED_EVENT_NAME = 'NTDSInitialSyncsCompleted';
  89. {$EXTERNALSYM DS_SYNCED_EVENT_NAME}
  90. DS_SYNCED_EVENT_NAME_W = 'NTDSInitialSyncsCompleted';
  91. {$EXTERNALSYM DS_SYNCED_EVENT_NAME_W}
  92. // Permissions bits used in security descriptors in the directory.
  93. ACTRL_DS_OPEN = $00000000;
  94. {$EXTERNALSYM ACTRL_DS_OPEN}
  95. ACTRL_DS_CREATE_CHILD = $00000001;
  96. {$EXTERNALSYM ACTRL_DS_CREATE_CHILD}
  97. ACTRL_DS_DELETE_CHILD = $00000002;
  98. {$EXTERNALSYM ACTRL_DS_DELETE_CHILD}
  99. ACTRL_DS_LIST = $00000004;
  100. {$EXTERNALSYM ACTRL_DS_LIST}
  101. ACTRL_DS_SELF = $00000008;
  102. {$EXTERNALSYM ACTRL_DS_SELF}
  103. ACTRL_DS_READ_PROP = $00000010;
  104. {$EXTERNALSYM ACTRL_DS_READ_PROP}
  105. ACTRL_DS_WRITE_PROP = $00000020;
  106. {$EXTERNALSYM ACTRL_DS_WRITE_PROP}
  107. ACTRL_DS_DELETE_TREE = $00000040;
  108. {$EXTERNALSYM ACTRL_DS_DELETE_TREE}
  109. ACTRL_DS_LIST_OBJECT = $00000080;
  110. {$EXTERNALSYM ACTRL_DS_LIST_OBJECT}
  111. ACTRL_DS_CONTROL_ACCESS = $00000100;
  112. {$EXTERNALSYM ACTRL_DS_CONTROL_ACCESS}
  113. // generic read
  114. DS_GENERIC_READ = STANDARD_RIGHTS_READ or ACTRL_DS_LIST or ACTRL_DS_READ_PROP or
  115. ACTRL_DS_LIST_OBJECT;
  116. {$EXTERNALSYM DS_GENERIC_READ}
  117. // generic execute
  118. DS_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE or ACTRL_DS_LIST;
  119. {$EXTERNALSYM DS_GENERIC_EXECUTE}
  120. // generic right
  121. DS_GENERIC_WRITE = STANDARD_RIGHTS_WRITE or ACTRL_DS_SELF or ACTRL_DS_WRITE_PROP;
  122. {$EXTERNALSYM DS_GENERIC_WRITE}
  123. // generic all
  124. DS_GENERIC_ALL = STANDARD_RIGHTS_REQUIRED or ACTRL_DS_CREATE_CHILD or
  125. ACTRL_DS_DELETE_CHILD or ACTRL_DS_DELETE_TREE or ACTRL_DS_READ_PROP or
  126. ACTRL_DS_WRITE_PROP or ACTRL_DS_LIST or ACTRL_DS_LIST_OBJECT or
  127. ACTRL_DS_CONTROL_ACCESS or ACTRL_DS_SELF;
  128. {$EXTERNALSYM DS_GENERIC_ALL}
  129. type
  130. DS_NAME_FORMAT = (
  131. // unknown name type
  132. DS_UNKNOWN_NAME,
  133. // eg: CN=User Name,OU=Users,DC=Example,DC=Microsoft,DC=Com
  134. DS_FQDN_1779_NAME,
  135. // eg: Exmaple\UserName
  136. // Domain-only version includes trailing '\\'.
  137. DS_NT4_ACCOUNT_NAME,
  138. // Probably "User Name" but could be something else. I.e. The
  139. // display name is not necessarily the defining RDN.
  140. DS_DISPLAY_NAME,
  141. // obsolete - see #define later
  142. // DS_DOMAIN_SIMPLE_NAME,
  143. DS_STUB_4,
  144. // obsolete - see #define later
  145. // DS_ENTERPRISE_SIMPLE_NAME,
  146. DS_STUB_5,
  147. // String-ized GUID as returned by IIDFromString().
  148. // eg: {4fa050f0-f561-11cf-bdd9-00aa003a77b6}
  149. DS_UNIQUE_ID_NAME,
  150. // eg: example.microsoft.com/software/user name
  151. // Domain-only version includes trailing '/'.
  152. DS_CANONICAL_NAME,
  153. // eg: [email protected]
  154. DS_USER_PRINCIPAL_NAME,
  155. // Same as DS_CANONICAL_NAME except that rightmost '/' is
  156. // replaced with '\n' - even in domain-only case.
  157. // eg: example.microsoft.com/software\nuser name
  158. DS_CANONICAL_NAME_EX,
  159. // eg: www/[email protected] - generalized service principal
  160. // names.
  161. DS_SERVICE_PRINCIPAL_NAME,
  162. // This is the string representation of a SID. Invalid for formatDesired.
  163. // See sddl.h for SID binary <--> text conversion routines.
  164. // eg: S-1-5-21-397955417-626881126-188441444-501
  165. DS_SID_OR_SID_HISTORY_NAME,
  166. // Pseudo-name format so GetUserNameEx can return the DNS domain name to
  167. // a caller. This level is not supported by the DS APIs.
  168. DS_DNS_DOMAIN_NAME);
  169. {$EXTERNALSYM DS_NAME_FORMAT}
  170. TDsNameFormat = DS_NAME_FORMAT;
  171. // Map old name formats to closest new format so that old code builds
  172. // against new headers w/o errors and still gets (almost) correct result.
  173. const
  174. DS_DOMAIN_SIMPLE_NAME = DS_USER_PRINCIPAL_NAME;
  175. {$EXTERNALSYM DS_DOMAIN_SIMPLE_NAME}
  176. DS_ENTERPRISE_SIMPLE_NAME = DS_USER_PRINCIPAL_NAME;
  177. {$EXTERNALSYM DS_ENTERPRISE_SIMPLE_NAME}
  178. type
  179. DS_NAME_FLAGS = DWORD;
  180. {$EXTERNALSYM DS_NAME_FLAGS}
  181. TDsNameFlags = DS_NAME_FLAGS;
  182. const
  183. DS_NAME_NO_FLAGS = $0;
  184. {$EXTERNALSYM DS_NAME_NO_FLAGS}
  185. // Perform a syntactical mapping at the client (if possible) without
  186. // going out on the wire. Returns DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING
  187. // if a purely syntactical mapping is not possible.
  188. DS_NAME_FLAG_SYNTACTICAL_ONLY = $1;
  189. {$EXTERNALSYM DS_NAME_FLAG_SYNTACTICAL_ONLY}
  190. // Force a trip to the DC for evaluation, even if this could be
  191. // locally cracked syntactically.
  192. DS_NAME_FLAG_EVAL_AT_DC = $2;
  193. {$EXTERNALSYM DS_NAME_FLAG_EVAL_AT_DC}
  194. // The call fails if the DC is not a GC
  195. DS_NAME_FLAG_GCVERIFY = $4;
  196. {$EXTERNALSYM DS_NAME_FLAG_GCVERIFY}
  197. // Enable cross forest trust referral
  198. DS_NAME_FLAG_TRUST_REFERRAL = $8;
  199. {$EXTERNALSYM DS_NAME_FLAG_TRUST_REFERRAL}
  200. type
  201. DS_NAME_ERROR = (
  202. DS_NAME_NO_ERROR,
  203. // Generic processing error.
  204. DS_NAME_ERROR_RESOLVING,
  205. // Couldn't find the name at all - or perhaps caller doesn't have
  206. // rights to see it.
  207. DS_NAME_ERROR_NOT_FOUND,
  208. // Input name mapped to more than one output name.
  209. DS_NAME_ERROR_NOT_UNIQUE,
  210. // Input name found, but not the associated output format.
  211. // Can happen if object doesn't have all the required attributes.
  212. DS_NAME_ERROR_NO_MAPPING,
  213. // Unable to resolve entire name, but was able to determine which
  214. // domain object resides in. Thus DS_NAME_RESULT_ITEM?.pDomain
  215. // is valid on return.
  216. DS_NAME_ERROR_DOMAIN_ONLY,
  217. // Unable to perform a purely syntactical mapping at the client
  218. // without going out on the wire.
  219. DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING,
  220. // The name is from an external trusted forest.
  221. DS_NAME_ERROR_TRUST_REFERRAL);
  222. {$EXTERNALSYM DS_NAME_ERROR}
  223. TDsNameError = DS_NAME_ERROR;
  224. const
  225. DS_NAME_LEGAL_FLAGS = DS_NAME_FLAG_SYNTACTICAL_ONLY;
  226. {$EXTERNALSYM DS_NAME_LEGAL_FLAGS}
  227. type
  228. DS_SPN_NAME_TYPE = (
  229. // "paulle-nec.ntwksta.ms.com"
  230. DS_SPN_DNS_HOST,
  231. // "cn=paulle-nec,ou=computers,dc=ntwksta,dc=ms,dc=com"
  232. DS_SPN_DN_HOST,
  233. // "paulle-nec"
  234. DS_SPN_NB_HOST,
  235. // "ntdev.ms.com"
  236. DS_SPN_DOMAIN,
  237. // "ntdev"
  238. DS_SPN_NB_DOMAIN,
  239. // "cn=anRpcService,cn=RPC Services,cn=system,dc=ms,dc=com"
  240. // "cn=aWsService,cn=Winsock Services,cn=system,dc=ms,dc=com"
  241. // "cn=aService,dc=itg,dc=ms,dc=com"
  242. // "www.ms.com", "ftp.ms.com", "ldap.ms.com"
  243. // "products.ms.com"
  244. DS_SPN_SERVICE);
  245. {$EXTERNALSYM DS_SPN_NAME_TYPE}
  246. TDsSpnNameType = DS_SPN_NAME_TYPE;
  247. DS_SPN_WRITE_OP = (
  248. DS_SPN_ADD_SPN_OP, // add SPNs
  249. DS_SPN_REPLACE_SPN_OP, // set all SPNs
  250. DS_SPN_DELETE_SPN_OP); // Delete SPNs
  251. {$EXTERNALSYM DS_SPN_WRITE_OP}
  252. TDsSpnWriteOp = DS_SPN_WRITE_OP;
  253. PDS_NAME_RESULT_ITEMA = ^DS_NAME_RESULT_ITEMA;
  254. {$EXTERNALSYM PDS_NAME_RESULT_ITEMA}
  255. DS_NAME_RESULT_ITEMA = record
  256. status: DWORD; // DS_NAME_ERROR
  257. pDomain: LPSTR; // DNS domain
  258. pName: LPSTR; // name in requested format
  259. end;
  260. {$EXTERNALSYM DS_NAME_RESULT_ITEMA}
  261. TDsNameResultItemA = DS_NAME_RESULT_ITEMA;
  262. PDsNameResultItemA = PDS_NAME_RESULT_ITEMA;
  263. PDS_NAME_RESULTA = ^DS_NAME_RESULTA;
  264. {$EXTERNALSYM PDS_NAME_RESULTA}
  265. DS_NAME_RESULTA = record
  266. cItems: DWORD; // item count
  267. rItems: PDS_NAME_RESULT_ITEMA; // item array
  268. end;
  269. {$EXTERNALSYM DS_NAME_RESULTA}
  270. TDsNameResultA = DS_NAME_RESULTA;
  271. PDsNameResultA = PDS_NAME_RESULTA;
  272. PDS_NAME_RESULT_ITEMW = ^DS_NAME_RESULT_ITEMW;
  273. {$EXTERNALSYM PDS_NAME_RESULT_ITEMW}
  274. DS_NAME_RESULT_ITEMW = record
  275. status: DWORD; // DS_NAME_ERROR
  276. pDomain: LPWSTR; // DNS domain
  277. pName: LPWSTR; // name in requested format
  278. end;
  279. {$EXTERNALSYM DS_NAME_RESULT_ITEMW}
  280. TDsNameResultItemW = DS_NAME_RESULT_ITEMW;
  281. PDsNameResultItemW = PDS_NAME_RESULT_ITEMW;
  282. PDS_NAME_RESULTW = ^DS_NAME_RESULTW;
  283. {$EXTERNALSYM PDS_NAME_RESULTW}
  284. DS_NAME_RESULTW = record
  285. cItems: DWORD; // item count
  286. rItems: PDS_NAME_RESULT_ITEMW; // item array
  287. end;
  288. {$EXTERNALSYM DS_NAME_RESULTW}
  289. TDsNameResultW = DS_NAME_RESULTW;
  290. PDsNameResultW = PDS_NAME_RESULTW;
  291. {$IFDEF UNICODE}
  292. DS_NAME_RESULT = DS_NAME_RESULTW;
  293. {$EXTERNALSYM DS_NAME_RESULT}
  294. PDS_NAME_RESULT = PDS_NAME_RESULTW;
  295. {$EXTERNALSYM PDS_NAME_RESULT}
  296. DS_NAME_RESULT_ITEM = DS_NAME_RESULT_ITEMW;
  297. {$EXTERNALSYM DS_NAME_RESULT_ITEM}
  298. PDS_NAME_RESULT_ITEM = PDS_NAME_RESULT_ITEMW;
  299. {$EXTERNALSYM PDS_NAME_RESULT_ITEM}
  300. TDsNameResult = TDsNameResultW;
  301. PDsNameResult = PDsNameResultW;
  302. TDsNameResultItem = TDsNameResultItemW;
  303. PDsNameResultItem = PDsNameResultItemW;
  304. {$ELSE}
  305. DS_NAME_RESULT = DS_NAME_RESULTA;
  306. {$EXTERNALSYM DS_NAME_RESULT}
  307. PDS_NAME_RESULT = PDS_NAME_RESULTA;
  308. {$EXTERNALSYM PDS_NAME_RESULT}
  309. DS_NAME_RESULT_ITEM = DS_NAME_RESULT_ITEMA;
  310. {$EXTERNALSYM DS_NAME_RESULT_ITEM}
  311. PDS_NAME_RESULT_ITEM = PDS_NAME_RESULT_ITEMA;
  312. {$EXTERNALSYM PDS_NAME_RESULT_ITEM}
  313. TDsNameResult = TDsNameResultA;
  314. PDsNameResult = PDsNameResultA;
  315. TDsNameResultItem = TDsNameResultItemA;
  316. PDsNameResultItem = PDsNameResultItemA;
  317. {$ENDIF UNICODE}
  318. // Public replication option flags
  319. // ********************
  320. // DsBindWithSpnEx flags
  321. // ********************
  322. // Allow the Bind to use delegate service level, so that you can
  323. // do ntdsapi operations that require delegation, such as
  324. // DsAddSidHistory, and DsReplicaSyncAll(). Most operations do
  325. // not require DELEGATE so this flag should only be specified
  326. // if you need it, because if you bind to a rogue server with
  327. // the DELEGATE flag, you'll allow the rogue server to use your
  328. // credentials to connect back to a non-rogue server and perform
  329. // operations other than you intended.
  330. const
  331. NTDSAPI_BIND_ALLOW_DELEGATION = $00000001;
  332. {$EXTERNALSYM NTDSAPI_BIND_ALLOW_DELEGATION}
  333. // ********************
  334. // Replica Sync flags
  335. // These flag values are used both as input to DsReplicaSync and
  336. // as output from DsReplicaGetInfo, PENDING_OPS, DS_REPL_OPW.ulOptions
  337. // ********************
  338. // Perform this operation asynchronously.
  339. // Required when using DS_REPSYNC_ALL_SOURCES
  340. const
  341. DS_REPSYNC_ASYNCHRONOUS_OPERATION = $00000001;
  342. {$EXTERNALSYM DS_REPSYNC_ASYNCHRONOUS_OPERATION}
  343. // Writeable replica. Otherwise, read-only.
  344. DS_REPSYNC_WRITEABLE = $00000002;
  345. {$EXTERNALSYM DS_REPSYNC_WRITEABLE}
  346. // This is a periodic sync request as scheduled by the admin.
  347. DS_REPSYNC_PERIODIC = $00000004;
  348. {$EXTERNALSYM DS_REPSYNC_PERIODIC}
  349. // Use inter-site messaging
  350. DS_REPSYNC_INTERSITE_MESSAGING = $00000008;
  351. {$EXTERNALSYM DS_REPSYNC_INTERSITE_MESSAGING}
  352. // Sync from all sources.
  353. DS_REPSYNC_ALL_SOURCES = $00000010;
  354. {$EXTERNALSYM DS_REPSYNC_ALL_SOURCES}
  355. // Sync starting from scratch (i.e., at the first USN).
  356. DS_REPSYNC_FULL = $00000020;
  357. {$EXTERNALSYM DS_REPSYNC_FULL}
  358. // This is a notification of an update that was marked urgent.
  359. DS_REPSYNC_URGENT = $00000040;
  360. {$EXTERNALSYM DS_REPSYNC_URGENT}
  361. // Don't discard this synchronization request, even if a similar
  362. // sync is pending.
  363. DS_REPSYNC_NO_DISCARD = $00000080;
  364. {$EXTERNALSYM DS_REPSYNC_NO_DISCARD}
  365. // Sync even if link is currently disabled.
  366. DS_REPSYNC_FORCE = $00000100;
  367. {$EXTERNALSYM DS_REPSYNC_FORCE}
  368. // Causes the source DSA to check if a reps-to is present for the local DSA
  369. // (aka the destination). If not, one is added. This ensures that
  370. // source sends change notifications.
  371. DS_REPSYNC_ADD_REFERENCE = $00000200;
  372. {$EXTERNALSYM DS_REPSYNC_ADD_REFERENCE}
  373. // A sync from this source has never completed (e.g., a new source).
  374. DS_REPSYNC_NEVER_COMPLETED = $00000400;
  375. {$EXTERNALSYM DS_REPSYNC_NEVER_COMPLETED}
  376. // When this sync is complete, requests a sync in the opposite direction.
  377. DS_REPSYNC_TWO_WAY = $00000800;
  378. {$EXTERNALSYM DS_REPSYNC_TWO_WAY}
  379. // Do not request change notifications from this source.
  380. DS_REPSYNC_NEVER_NOTIFY = $00001000;
  381. {$EXTERNALSYM DS_REPSYNC_NEVER_NOTIFY}
  382. // Sync the NC from this source when the DSA is started.
  383. DS_REPSYNC_INITIAL = $00002000;
  384. {$EXTERNALSYM DS_REPSYNC_INITIAL}
  385. // Use compression when replicating. Saves message size (e.g., network
  386. // bandwidth) at the expense of extra CPU overhead at both the source and
  387. // destination servers.
  388. DS_REPSYNC_USE_COMPRESSION = $00004000;
  389. {$EXTERNALSYM DS_REPSYNC_USE_COMPRESSION}
  390. // Sync was abandoned for lack of updates
  391. DS_REPSYNC_ABANDONED = $00008000;
  392. {$EXTERNALSYM DS_REPSYNC_ABANDONED}
  393. // Initial sync in progress
  394. DS_REPSYNC_INITIAL_IN_PROGRESS = $00010000;
  395. {$EXTERNALSYM DS_REPSYNC_INITIAL_IN_PROGRESS}
  396. // Partial Attribute Set sync in progress
  397. DS_REPSYNC_PARTIAL_ATTRIBUTE_SET = $00020000;
  398. {$EXTERNALSYM DS_REPSYNC_PARTIAL_ATTRIBUTE_SET}
  399. // Sync is being retried
  400. DS_REPSYNC_REQUEUE = $00040000;
  401. {$EXTERNALSYM DS_REPSYNC_REQUEUE}
  402. // Sync is a notification request from a source
  403. DS_REPSYNC_NOTIFICATION = $00080000;
  404. {$EXTERNALSYM DS_REPSYNC_NOTIFICATION}
  405. // Sync is a special form which requests to establish contact
  406. // now and do the rest of the sync later
  407. DS_REPSYNC_ASYNCHRONOUS_REPLICA = $00100000;
  408. {$EXTERNALSYM DS_REPSYNC_ASYNCHRONOUS_REPLICA}
  409. // Request critical objects only
  410. DS_REPSYNC_CRITICAL = $00200000;
  411. {$EXTERNALSYM DS_REPSYNC_CRITICAL}
  412. // A full synchronization is in progress
  413. DS_REPSYNC_FULL_IN_PROGRESS = $00400000;
  414. {$EXTERNALSYM DS_REPSYNC_FULL_IN_PROGRESS}
  415. // Synchronization request was previously preempted
  416. DS_REPSYNC_PREEMPTED = $00800000;
  417. {$EXTERNALSYM DS_REPSYNC_PREEMPTED}
  418. // ********************
  419. // Replica Add flags
  420. // ********************
  421. // Perform this operation asynchronously.
  422. DS_REPADD_ASYNCHRONOUS_OPERATION = $00000001;
  423. {$EXTERNALSYM DS_REPADD_ASYNCHRONOUS_OPERATION}
  424. // Create a writeable replica. Otherwise, read-only.
  425. DS_REPADD_WRITEABLE = $00000002;
  426. {$EXTERNALSYM DS_REPADD_WRITEABLE}
  427. // Sync the NC from this source when the DSA is started.
  428. DS_REPADD_INITIAL = $00000004;
  429. {$EXTERNALSYM DS_REPADD_INITIAL}
  430. // Sync the NC from this source periodically, as defined by the
  431. // schedule passed in the preptimesSync argument.
  432. DS_REPADD_PERIODIC = $00000008;
  433. {$EXTERNALSYM DS_REPADD_PERIODIC}
  434. // Sync from the source DSA via an Intersite Messaging Service (ISM) transport
  435. // (e.g., SMTP) rather than native DS RPC.
  436. DS_REPADD_INTERSITE_MESSAGING = $00000010;
  437. {$EXTERNALSYM DS_REPADD_INTERSITE_MESSAGING}
  438. // Don't replicate the NC now -- just save enough state such that we
  439. // know to replicate it later.
  440. DS_REPADD_ASYNCHRONOUS_REPLICA = $00000020;
  441. {$EXTERNALSYM DS_REPADD_ASYNCHRONOUS_REPLICA}
  442. // Disable notification-based synchronization for the NC from this source.
  443. // This is expected to be a temporary state; the similar flag
  444. // DS_REPADD_NEVER_NOTIFY should be used if the disable is to be more permanent.
  445. DS_REPADD_DISABLE_NOTIFICATION = $00000040;
  446. {$EXTERNALSYM DS_REPADD_DISABLE_NOTIFICATION}
  447. // Disable periodic synchronization for the NC from this source
  448. DS_REPADD_DISABLE_PERIODIC = $00000080;
  449. {$EXTERNALSYM DS_REPADD_DISABLE_PERIODIC}
  450. // Use compression when replicating. Saves message size (e.g., network
  451. // bandwidth) at the expense of extra CPU overhead at both the source and
  452. // destination servers.
  453. DS_REPADD_USE_COMPRESSION = $00000100;
  454. {$EXTERNALSYM DS_REPADD_USE_COMPRESSION}
  455. // Do not request change notifications from this source. When this flag is
  456. // set, the source will not notify the destination when changes occur.
  457. // Recommended for all intersite replication, which may occur over WAN links.
  458. // This is expected to be a more or less permanent state; the similar flag
  459. // DS_REPADD_DISABLE_NOTIFICATION should be used if notifications are to be
  460. // disabled only temporarily.
  461. DS_REPADD_NEVER_NOTIFY = $00000200;
  462. {$EXTERNALSYM DS_REPADD_NEVER_NOTIFY}
  463. // When this sync is complete, requests a sync in the opposite direction.
  464. DS_REPADD_TWO_WAY = $00000400;
  465. {$EXTERNALSYM DS_REPADD_TWO_WAY}
  466. // Request critical objects only
  467. // Critical only is only allowed while installing
  468. // A critical only sync does not bring all objects in the partition. It
  469. // replicates just the ones necessary for minimal directory operation.
  470. // A normal, non-critical sync must be performed before the partition
  471. // can be considered fully synchronized.
  472. DS_REPADD_CRITICAL = $00000800;
  473. {$EXTERNALSYM DS_REPADD_CRITICAL}
  474. // ********************
  475. // Replica Delete flags
  476. // ********************
  477. // Perform this operation asynchronously.
  478. DS_REPDEL_ASYNCHRONOUS_OPERATION = $00000001;
  479. {$EXTERNALSYM DS_REPDEL_ASYNCHRONOUS_OPERATION}
  480. // The replica being deleted is writeable.
  481. DS_REPDEL_WRITEABLE = $00000002;
  482. {$EXTERNALSYM DS_REPDEL_WRITEABLE}
  483. // Replica is a mail-based replica
  484. DS_REPDEL_INTERSITE_MESSAGING = $00000004;
  485. {$EXTERNALSYM DS_REPDEL_INTERSITE_MESSAGING}
  486. // Ignore any error generated by contacting the source to tell it to scratch
  487. // this server from its Reps-To for this NC.
  488. DS_REPDEL_IGNORE_ERRORS = $00000008;
  489. {$EXTERNALSYM DS_REPDEL_IGNORE_ERRORS}
  490. // Do not contact the source telling it to scratch this server from its
  491. // Rep-To for this NC. Otherwise, if the link is RPC-based, the source will
  492. // be contacted.
  493. DS_REPDEL_LOCAL_ONLY = $00000010;
  494. {$EXTERNALSYM DS_REPDEL_LOCAL_ONLY}
  495. // Delete all the objects in the NC
  496. // "No source" is incompatible with (and rejected for) writeable NCs. This is
  497. // valid only for read-only NCs, and then only if the NC has no source. This
  498. // can occur when the NC has been partially deleted (in which case the KCC
  499. // periodically calls the delete API with the "no source" flag set).
  500. DS_REPDEL_NO_SOURCE = $00000020;
  501. {$EXTERNALSYM DS_REPDEL_NO_SOURCE}
  502. // Allow deletion of read-only replica even if it sources
  503. // other read-only replicas.
  504. DS_REPDEL_REF_OK = $00000040;
  505. {$EXTERNALSYM DS_REPDEL_REF_OK}
  506. // ********************
  507. // Replica Modify flags
  508. // ********************
  509. // Perform this operation asynchronously.
  510. DS_REPMOD_ASYNCHRONOUS_OPERATION = $00000001;
  511. {$EXTERNALSYM DS_REPMOD_ASYNCHRONOUS_OPERATION}
  512. // The replica is writeable.
  513. DS_REPMOD_WRITEABLE = $00000002;
  514. {$EXTERNALSYM DS_REPMOD_WRITEABLE}
  515. // ********************
  516. // Replica Modify fields
  517. // ********************
  518. DS_REPMOD_UPDATE_FLAGS = $00000001;
  519. {$EXTERNALSYM DS_REPMOD_UPDATE_FLAGS}
  520. DS_REPMOD_UPDATE_ADDRESS = $00000002;
  521. {$EXTERNALSYM DS_REPMOD_UPDATE_ADDRESS}
  522. DS_REPMOD_UPDATE_SCHEDULE = $00000004;
  523. {$EXTERNALSYM DS_REPMOD_UPDATE_SCHEDULE}
  524. DS_REPMOD_UPDATE_RESULT = $00000008;
  525. {$EXTERNALSYM DS_REPMOD_UPDATE_RESULT}
  526. DS_REPMOD_UPDATE_TRANSPORT = $00000010;
  527. {$EXTERNALSYM DS_REPMOD_UPDATE_TRANSPORT}
  528. // ********************
  529. // Update Refs fields
  530. // ********************
  531. // Perform this operation asynchronously.
  532. DS_REPUPD_ASYNCHRONOUS_OPERATION = $00000001;
  533. {$EXTERNALSYM DS_REPUPD_ASYNCHRONOUS_OPERATION}
  534. // The replica being deleted is writeable.
  535. DS_REPUPD_WRITEABLE = $00000002;
  536. {$EXTERNALSYM DS_REPUPD_WRITEABLE}
  537. // Add a reference
  538. DS_REPUPD_ADD_REFERENCE = $00000004;
  539. {$EXTERNALSYM DS_REPUPD_ADD_REFERENCE}
  540. // Remove a reference
  541. DS_REPUPD_DELETE_REFERENCE = $00000008;
  542. {$EXTERNALSYM DS_REPUPD_DELETE_REFERENCE}
  543. // ********************
  544. // NC Related Flags
  545. // ********************
  546. //
  547. // Instance Type bits, specifies flags for NC head creation.
  548. //
  549. DS_INSTANCETYPE_IS_NC_HEAD = $00000001; // This if what to specify on an object to indicate it's an NC Head.
  550. {$EXTERNALSYM DS_INSTANCETYPE_IS_NC_HEAD}
  551. DS_INSTANCETYPE_NC_IS_WRITEABLE = $00000004; // This is to indicate that the NC Head is writeable.
  552. {$EXTERNALSYM DS_INSTANCETYPE_NC_IS_WRITEABLE}
  553. DS_INSTANCETYPE_NC_COMING = $00000010; // This is to indicate that this NC is still replicating in objects to this DC, and may not be a complete NC.
  554. {$EXTERNALSYM DS_INSTANCETYPE_NC_COMING}
  555. DS_INSTANCETYPE_NC_GOING = $00000020; // This is to indicate that this NC is in the process of being removed from this DC, and may not be a complete NC.
  556. {$EXTERNALSYM DS_INSTANCETYPE_NC_GOING}
  557. // ********************
  558. // xxx_OPT_xxx Flags
  559. // ********************
  560. // These macros define bit flags which can be set in the "options" attribute
  561. // of objects of the specified object class.
  562. // Bit flags valid for options attribute on NTDS-DSA objects.
  563. //
  564. NTDSDSA_OPT_IS_GC = 1 shl 0; // DSA is a global catalog
  565. {$EXTERNALSYM NTDSDSA_OPT_IS_GC}
  566. NTDSDSA_OPT_DISABLE_INBOUND_REPL = 1 shl 1; // disable inbound replication
  567. {$EXTERNALSYM NTDSDSA_OPT_DISABLE_INBOUND_REPL}
  568. NTDSDSA_OPT_DISABLE_OUTBOUND_REPL = 1 shl 2; // disable outbound replication
  569. {$EXTERNALSYM NTDSDSA_OPT_DISABLE_OUTBOUND_REPL}
  570. NTDSDSA_OPT_DISABLE_NTDSCONN_XLATE = 1 shl 3; // disable logical conn xlation
  571. {$EXTERNALSYM NTDSDSA_OPT_DISABLE_NTDSCONN_XLATE}
  572. // Bit flags for options attribute on NTDS-Connection objects.
  573. //
  574. // The reasons that two bits are required to control notification are as follows.
  575. // We must support existing connections with the old behavior and the UI does not
  576. // create manual connections with the new bit set.
  577. // The default for existing and manually created connections with bits 2 and 3
  578. // clear must be the standard prior behavior: notification for intra-site and
  579. // no notification for inter-site.
  580. // We need a way to distinguish a old connection which desires the default
  581. // notification rules, and a new connection for which we desire to explicitly
  582. // control the notification state as passed down from a site link. Thus we
  583. // have a new bit to say we are overriding the default, and a new bit to indicate
  584. // what the overridden default shall be.
  585. //
  586. NTDSCONN_OPT_IS_GENERATED = 1 shl 0; // object generated by DS, not admin
  587. {$EXTERNALSYM NTDSCONN_OPT_IS_GENERATED}
  588. NTDSCONN_OPT_TWOWAY_SYNC = 1 shl 1; // force sync in opposite direction at end of sync
  589. {$EXTERNALSYM NTDSCONN_OPT_TWOWAY_SYNC}
  590. NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT = 1 shl 2; // Do not use defaults to determine notification
  591. {$EXTERNALSYM NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT}
  592. NTDSCONN_OPT_USE_NOTIFY = 1 shl 3; // Does source notify destination
  593. {$EXTERNALSYM NTDSCONN_OPT_USE_NOTIFY}
  594. // For intra-site connections, this bit has no meaning.
  595. // For inter-site connections, this bit means:
  596. // 0 - Compression of replication data enabled
  597. // 1 - Compression of replication data disabled
  598. NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSION = 1 shl 4;
  599. {$EXTERNALSYM NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSION}
  600. // For connections whose IS_GENERATED bit is 0, this bit has no effect.
  601. // For KCC-generated connections, this bit indicates that the schedule attribute
  602. // is owned by the user and should not be touched by the KCC.
  603. NTDSCONN_OPT_USER_OWNED_SCHEDULE = 1 shl 5;
  604. {$EXTERNALSYM NTDSCONN_OPT_USER_OWNED_SCHEDULE}
  605. //
  606. // The high 4 bits of the options attribute are used by NTFRS to assign priority
  607. // for inbound connections. Bit 31 is used to force FRS to ignore schedule during
  608. // the initial sync. Bits 30 - 28 are used to specify a priority between 0-7.
  609. //
  610. FRSCONN_PRIORITY_MASK = $70000000;
  611. {$EXTERNALSYM FRSCONN_PRIORITY_MASK}
  612. FRSCONN_MAX_PRIORITY = $8;
  613. {$EXTERNALSYM FRSCONN_MAX_PRIORITY}
  614. DSCONN_OPT_IGNORE_SCHEDULE_MASK = DWORD($80000000);
  615. {$EXTERNALSYM DSCONN_OPT_IGNORE_SCHEDULE_MASK}
  616. function NTDSCONN_IGNORE_SCHEDULE(_options_: DWORD): DWORD;
  617. {$EXTERNALSYM NTDSCONN_IGNORE_SCHEDULE}
  618. function FRSCONN_GET_PRIORITY(_options_: DWORD): DWORD;
  619. {$EXTERNALSYM FRSCONN_GET_PRIORITY}
  620. // Bit flags for options attribute on NTDS-Site-Settings objects.
  621. //
  622. const
  623. NTDSSETTINGS_OPT_IS_AUTO_TOPOLOGY_DISABLED = 1 shl 0; // automatic topology gen disabled
  624. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_AUTO_TOPOLOGY_DISABLED}
  625. NTDSSETTINGS_OPT_IS_TOPL_CLEANUP_DISABLED = 1 shl 1; // automatic topology cleanup disabled
  626. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_TOPL_CLEANUP_DISABLED}
  627. NTDSSETTINGS_OPT_IS_TOPL_MIN_HOPS_DISABLED = 1 shl 2; // automatic minimum hops topology disabled
  628. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_TOPL_MIN_HOPS_DISABLED}
  629. NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED = 1 shl 3; // automatic stale server detection disabled
  630. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED}
  631. NTDSSETTINGS_OPT_IS_INTER_SITE_AUTO_TOPOLOGY_DISABLED = 1 shl 4; // automatic inter-site topology gen disabled
  632. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_INTER_SITE_AUTO_TOPOLOGY_DISABLED}
  633. NTDSSETTINGS_OPT_IS_GROUP_CACHING_ENABLED = 1 shl 5; // group memberships for users enabled
  634. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_GROUP_CACHING_ENABLED}
  635. NTDSSETTINGS_OPT_FORCE_KCC_WHISTLER_BEHAVIOR = 1 shl 6; // force KCC to operate in Whistler behavior mode
  636. {$EXTERNALSYM NTDSSETTINGS_OPT_FORCE_KCC_WHISTLER_BEHAVIOR}
  637. NTDSSETTINGS_OPT_FORCE_KCC_W2K_ELECTION = 1 shl 7; // force KCC to use the Windows 2000 ISTG election algorithm
  638. {$EXTERNALSYM NTDSSETTINGS_OPT_FORCE_KCC_W2K_ELECTION}
  639. NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLED = 1 shl 8; // prevent the KCC from randomly picking a bridgehead when creating a connection
  640. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLED}
  641. NTDSSETTINGS_OPT_IS_SCHEDULE_HASHING_ENABLED = 1 shl 9; // allow the KCC to use hashing when creating a replication schedule
  642. {$EXTERNALSYM NTDSSETTINGS_OPT_IS_SCHEDULE_HASHING_ENABLED}
  643. // Bit flags for options attribute on Inter-Site-Transport objects
  644. //
  645. // Note, the sense of the flag should be such that the default state or
  646. // behavior corresponds to the flag NOT being present. Put another way, the
  647. // flag should state the OPPOSITE of the default
  648. //
  649. // default: schedules are significant
  650. NTDSTRANSPORT_OPT_IGNORE_SCHEDULES = 1 shl 0; // Schedules disabled
  651. {$EXTERNALSYM NTDSTRANSPORT_OPT_IGNORE_SCHEDULES}
  652. // default: links transitive (bridges not required)
  653. NTDSTRANSPORT_OPT_BRIDGES_REQUIRED = 1 shl 1; // siteLink bridges are required
  654. {$EXTERNALSYM NTDSTRANSPORT_OPT_BRIDGES_REQUIRED}
  655. // Bit flags for options attribute on site-Connection objects
  656. //
  657. // These are not realized in the DS, but are built up in the KCC
  658. NTDSSITECONN_OPT_USE_NOTIFY = 1 shl 0; // Use notification on this link
  659. {$EXTERNALSYM NTDSSITECONN_OPT_USE_NOTIFY}
  660. NTDSSITECONN_OPT_TWOWAY_SYNC = 1 shl 1; // force sync in opposite direction at end of sync
  661. {$EXTERNALSYM NTDSSITECONN_OPT_TWOWAY_SYNC}
  662. // This bit means:
  663. // 0 - Compression of replication data across this site connection enabled
  664. // 1 - Compression of replication data across this site connection disabled
  665. NTDSSITECONN_OPT_DISABLE_COMPRESSION = 1 shl 2;
  666. {$EXTERNALSYM NTDSSITECONN_OPT_DISABLE_COMPRESSION}
  667. // Bit flags for options attribute on site-Link objects
  668. // Note that these options are AND-ed along a site-link path
  669. //
  670. NTDSSITELINK_OPT_USE_NOTIFY = 1 shl 0; // Use notification on this link
  671. {$EXTERNALSYM NTDSSITELINK_OPT_USE_NOTIFY}
  672. NTDSSITELINK_OPT_TWOWAY_SYNC = 1 shl 1; // force sync in opposite direction at end of sync
  673. {$EXTERNALSYM NTDSSITELINK_OPT_TWOWAY_SYNC}
  674. // This bit means:
  675. // 0 - Compression of replication data across this site link enabled
  676. // 1 - Compression of replication data across this site link disabled
  677. NTDSSITELINK_OPT_DISABLE_COMPRESSION = 1 shl 2;
  678. {$EXTERNALSYM NTDSSITELINK_OPT_DISABLE_COMPRESSION}
  679. // ***********************
  680. // Well Known Object Guids
  681. // ***********************
  682. GUID_USERS_CONTAINER_A = 'a9d1ca15768811d1aded00c04fd8d5cd';
  683. {$EXTERNALSYM GUID_USERS_CONTAINER_A}
  684. GUID_COMPUTRS_CONTAINER_A = 'aa312825768811d1aded00c04fd8d5cd';
  685. {$EXTERNALSYM GUID_COMPUTRS_CONTAINER_A}
  686. GUID_SYSTEMS_CONTAINER_A = 'ab1d30f3768811d1aded00c04fd8d5cd';
  687. {$EXTERNALSYM GUID_SYSTEMS_CONTAINER_A}
  688. GUID_DOMAIN_CONTROLLERS_CONTAINER_A = 'a361b2ffffd211d1aa4b00c04fd7d83a';
  689. {$EXTERNALSYM GUID_DOMAIN_CONTROLLERS_CONTAINER_A}
  690. GUID_INFRASTRUCTURE_CONTAINER_A = '2fbac1870ade11d297c400c04fd8d5cd';
  691. {$EXTERNALSYM GUID_INFRASTRUCTURE_CONTAINER_A}
  692. GUID_DELETED_OBJECTS_CONTAINER_A = '18e2ea80684f11d2b9aa00c04f79f805';
  693. {$EXTERNALSYM GUID_DELETED_OBJECTS_CONTAINER_A}
  694. GUID_LOSTANDFOUND_CONTAINER_A = 'ab8153b7768811d1aded00c04fd8d5cd';
  695. {$EXTERNALSYM GUID_LOSTANDFOUND_CONTAINER_A}
  696. GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_A = '22b70c67d56e4efb91e9300fca3dc1aa';
  697. {$EXTERNALSYM GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_A}
  698. GUID_PROGRAM_DATA_CONTAINER_A = '09460c08ae1e4a4ea0f64aee7daa1e5a';
  699. {$EXTERNALSYM GUID_PROGRAM_DATA_CONTAINER_A}
  700. GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_A = 'f4be92a4c777485e878e9421d53087db';
  701. {$EXTERNALSYM GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_A}
  702. GUID_USERS_CONTAINER_W = WideString('a9d1ca15768811d1aded00c04fd8d5cd');
  703. {$EXTERNALSYM GUID_USERS_CONTAINER_W}
  704. GUID_COMPUTRS_CONTAINER_W = WideString('aa312825768811d1aded00c04fd8d5cd');
  705. {$EXTERNALSYM GUID_COMPUTRS_CONTAINER_W}
  706. GUID_SYSTEMS_CONTAINER_W = WideString('ab1d30f3768811d1aded00c04fd8d5cd');
  707. {$EXTERNALSYM GUID_SYSTEMS_CONTAINER_W}
  708. GUID_DOMAIN_CONTROLLERS_CONTAINER_W = WideString('a361b2ffffd211d1aa4b00c04fd7d83a');
  709. {$EXTERNALSYM GUID_DOMAIN_CONTROLLERS_CONTAINER_W}
  710. GUID_INFRASTRUCTURE_CONTAINER_W = WideString('2fbac1870ade11d297c400c04fd8d5cd');
  711. {$EXTERNALSYM GUID_INFRASTRUCTURE_CONTAINER_W}
  712. GUID_DELETED_OBJECTS_CONTAINER_W = WideString('18e2ea80684f11d2b9aa00c04f79f805');
  713. {$EXTERNALSYM GUID_DELETED_OBJECTS_CONTAINER_W}
  714. GUID_LOSTANDFOUND_CONTAINER_W = WideString('ab8153b7768811d1aded00c04fd8d5cd');
  715. {$EXTERNALSYM GUID_LOSTANDFOUND_CONTAINER_W}
  716. GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_W = WideString('22b70c67d56e4efb91e9300fca3dc1aa');
  717. {$EXTERNALSYM GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_W}
  718. GUID_PROGRAM_DATA_CONTAINER_W = WideString('09460c08ae1e4a4ea0f64aee7daa1e5a');
  719. {$EXTERNALSYM GUID_PROGRAM_DATA_CONTAINER_W}
  720. GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_W = WideString('f4be92a4c777485e878e9421d53087db');
  721. {$EXTERNALSYM GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_W}
  722. GUID_USERS_CONTAINER_BYTE = '\xa9\xd1\xca\x15\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd';
  723. {$EXTERNALSYM GUID_USERS_CONTAINER_BYTE}
  724. GUID_COMPUTRS_CONTAINER_BYTE = '\xaa\x31\x28\x25\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd';
  725. {$EXTERNALSYM GUID_COMPUTRS_CONTAINER_BYTE}
  726. GUID_SYSTEMS_CONTAINER_BYTE = '\xab\x1d\x30\xf3\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd';
  727. {$EXTERNALSYM GUID_SYSTEMS_CONTAINER_BYTE}
  728. GUID_DOMAIN_CONTROLLERS_CONTAINER_BYTE = '\xa3\x61\xb2\xff\xff\xd2\x11\xd1\xaa\x4b\x00\xc0\x4f\xd7\xd8\x3a';
  729. {$EXTERNALSYM GUID_DOMAIN_CONTROLLERS_CONTAINER_BYTE}
  730. GUID_INFRASTRUCTURE_CONTAINER_BYTE = '\x2f\xba\xc1\x87\x0a\xde\x11\xd2\x97\xc4\x00\xc0\x4f\xd8\xd5\xcd';
  731. {$EXTERNALSYM GUID_INFRASTRUCTURE_CONTAINER_BYTE}
  732. GUID_DELETED_OBJECTS_CONTAINER_BYTE = '\x18\xe2\xea\x80\x68\x4f\x11\xd2\xb9\xaa\x00\xc0\x4f\x79\xf8\x05';
  733. {$EXTERNALSYM GUID_DELETED_OBJECTS_CONTAINER_BYTE}
  734. GUID_LOSTANDFOUND_CONTAINER_BYTE = '\xab\x81\x53\xb7\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd';
  735. {$EXTERNALSYM GUID_LOSTANDFOUND_CONTAINER_BYTE}
  736. GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_BYTE = '\x22\xb7\x0c\x67\xd5\x6e\x4e\xfb\x91\xe9\x30\x0f\xca\x3d\xc1\xaa';
  737. {$EXTERNALSYM GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_BYTE}
  738. GUID_PROGRAM_DATA_CONTAINER_BYTE = '\x09\x46\x0c\x08\xae\x1e\x4a\x4e\xa0\xf6\x4a\xee\x7d\xaa\x1e\x5a';
  739. {$EXTERNALSYM GUID_PROGRAM_DATA_CONTAINER_BYTE}
  740. GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_BYTE = '\xf4\xbe\x92\xa4\xc7\x77\x48\x5e\x87\x8e\x94\x21\xd5\x30\x87\xdb';
  741. {$EXTERNALSYM GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_BYTE}
  742. type
  743. _DS_MANGLE_FOR = (
  744. DS_MANGLE_UNKNOWN,
  745. DS_MANGLE_OBJECT_RDN_FOR_DELETION,
  746. DS_MANGLE_OBJECT_RDN_FOR_NAME_CONFLICT);
  747. {$EXTERNALSYM _DS_MANGLE_FOR}
  748. DS_MANGLE_FOR = _DS_MANGLE_FOR;
  749. {$EXTERNALSYM DS_MANGLE_FOR}
  750. TDsMangleFor = DS_MANGLE_FOR;
  751. PDsMangleFor = ^DS_MANGLE_FOR;
  752. //////////////////////////////////////////////////////////////////////////
  753. // //
  754. // Prototypes //
  755. // //
  756. //////////////////////////////////////////////////////////////////////////
  757. // DSBind takes two optional input parameters which identify whether the
  758. // caller found a domain controller themselves via DsGetDcName or whether
  759. // a domain controller should be found using default parameters.
  760. // Behavior of the possible combinations are outlined below.
  761. //
  762. // DomainControllerName(value), DnsDomainName(NULL)
  763. //
  764. // The value for DomainControllerName is assumed to have been
  765. // obtained via DsGetDcName (i.e. Field with the same name in a
  766. // DOMAIN_CONTROLLER_INFO struct on return from DsGetDcName call.)
  767. // The client is bound to the domain controller at this name.
  768. //
  769. // Mutual authentication will be performed using an SPN of
  770. // LDAP/DomainControllerName provided DomainControllerName
  771. // is not a NETBIOS name or IP address - i.e. it must be a
  772. // DNS host name.
  773. //
  774. // DomainControllerName(value), DnsDomainName(value)
  775. //
  776. // DsBind will connect to the server identified by DomainControllerName.
  777. //
  778. // Mutual authentication will be performed using an SPN of
  779. // LDAP/DomainControllerName/DnsDomainName provided neither value
  780. // is a NETBIOS names or IP address - i.e. they must be
  781. // valid DNS names.
  782. //
  783. // DomainControllerName(NULL), DnsDomainName(NULL)
  784. //
  785. // DsBind will attempt to find to a global catalog and fail if one
  786. // can not be found.
  787. //
  788. // Mutual authentication will be performed using an SPN of
  789. // GC/DnsHostName/ForestName where DnsHostName and ForestName
  790. // represent the DomainControllerName and DnsForestName fields
  791. // respectively of the DOMAIN_CONTROLLER_INFO returned by the
  792. // DsGetDcName call used to find a global catalog.
  793. //
  794. // DomainControllerName(NULL), DnsDomainName(value)
  795. //
  796. // DsBind will attempt to find a domain controller for the domain
  797. // identified by DnsDomainName and fail if one can not be found.
  798. //
  799. // Mutual authentication will be performed using an SPN of
  800. // LDAP/DnsHostName/DnsDomainName where DnsDomainName is that
  801. // provided by the caller and DnsHostName is that returned by
  802. // DsGetDcName for the domain specified - provided DnsDomainName
  803. // is a valid DNS domain name - i.e. not a NETBIOS domain name.
  804. function DsBindA(DomainControllerName: LPCSTR; DnsDomainName: LPCSTR;
  805. var phDS: HANDLE): DWORD; stdcall;
  806. {$EXTERNALSYM DsBindA}
  807. function DsBindW(DomainControllerName: LPCWSTR; DnsDomainName: LPCWSTR;
  808. var phDS: HANDLE): DWORD; stdcall;
  809. {$EXTERNALSYM DsBindW}
  810. function DsBind(DomainControllerName: LPCTSTR; DnsDomainName: LPCTSTR;
  811. var phDS: HANDLE): DWORD; stdcall;
  812. {$EXTERNALSYM DsBind}
  813. function DsBindWithCredA(DomainControllerName: LPCSTR; DnsDomainName: LPCSTR;
  814. AuthIdentity: RPC_AUTH_IDENTITY_HANDLE; var phDS: HANDLE): DWORD; stdcall;
  815. {$EXTERNALSYM DsBindWithCredA}
  816. function DsBindWithCredW(DomainControllerName: LPCWSTR; DnsDomainName: LPCWSTR;
  817. AuthIdentity: RPC_AUTH_IDENTITY_HANDLE; var phDS: HANDLE): DWORD; stdcall;
  818. {$EXTERNALSYM DsBindWithCredW}
  819. function DsBindWithCred(DomainControllerName: LPCTSTR; DnsDomainName: LPCTSTR;
  820. AuthIdentity: RPC_AUTH_IDENTITY_HANDLE; var phDS: HANDLE): DWORD; stdcall;
  821. {$EXTERNALSYM DsBindWithCred}
  822. //
  823. // DsBindWithSpn{A|W} allows the caller to specify the service principal
  824. // name (SPN) which will be used for mutual authentication against
  825. // the destination server. Do not provide an SPN if you are expecting
  826. // DsBind to find a server for you as SPNs are machine specific and its
  827. // unlikely the SPN you provide matches the server DsBind finds for you.
  828. // Providing a NULL ServicePrincipalName argument results in behavior
  829. // identical to DsBindWithCred{A|W}.
  830. //
  831. function DsBindWithSpnA(DomainControllerName: LPCSTR; DnsDomainName: LPCSTR;
  832. AuthIdentity: RPC_AUTH_IDENTITY_HANDLE; ServicePrincipalName: LPCSTR;
  833. var phDS: HANDLE): DWORD; stdcall;
  834. {$EXTERNALSYM DsBindWithSpnA}
  835. function DsBindWithSpnW(DomainControllerName: LPCWSTR; DnsDomainName: LPCWSTR;
  836. AuthIdentity: RPC_AUTH_IDENTITY_HANDLE; ServicePrincipalName: LPCWSTR;
  837. var phDS: HANDLE): DWORD; stdcall;
  838. {$EXTERNALSYM DsBindWithSpnW}
  839. function DsBindWithSpn(DomainControllerName: LPCTSTR; DnsDomainName: LPCTSTR;
  840. AuthIdentity: RPC_AUTH_IDENTITY_HANDLE; ServicePrincipalName: LPCTSTR;
  841. var phDS: HANDLE): DWORD; stdcall;
  842. {$EXTERNALSYM DsBindWithSpn}
  843. //
  844. // DsBindWithSpnEx{A|W} allows you all the options of the previous
  845. // DsBindWithSpn(), plus the added benefit of specifying some optional
  846. // Binding flags. Currently if you pass NTDSAPI_BIND_ALLOW_DELEGATION,
  847. // you will get the exact old behaviour. If you can avoid it, you
  848. // should not specify this flag, see flag above for details.
  849. //
  850. function DsBindWithSpnExW(DomainControllerName, DnsDomainName: LPCWSTR; AuthIdentity: RPC_AUTH_IDENTITY_HANDLE;
  851. ServicePrincipalName: LPCWSTR; BindFlags: DWORD; phDS: LPHANDLE): DWORD; stdcall;
  852. {$EXTERNALSYM DsBindWithSpnExW}
  853. function DsBindWithSpnExA(DomainControllerName, DnsDomainName: LPCSTR; AuthIdentity: RPC_AUTH_IDENTITY_HANDLE;
  854. ServicePrincipalName: LPCSTR; BindFlags: DWORD; phDS: LPHANDLE): DWORD; stdcall;
  855. {$EXTERNALSYM DsBindWithSpnExA}
  856. function DsBindWithSpnEx(DomainControllerName, DnsDomainName: LPCTSTR; AuthIdentity: RPC_AUTH_IDENTITY_HANDLE;
  857. ServicePrincipalName: LPCTSTR; BindFlags: DWORD; phDS: LPHANDLE): DWORD; stdcall;
  858. {$EXTERNALSYM DsBindWithSpnEx}
  859. //
  860. // DsBindToISTG{A|W} allows the caller to bind to the server which
  861. // holds the Inter-Site Topology Generator role in the specified site.
  862. // The site name should be the RDN of a site. If no site is specified,
  863. // the function will try to bind to the ISTG in a nearby site.
  864. //
  865. function DsBindToISTGW(SiteName: LPCWSTR; phDS: LPHANDLE): DWORD; stdcall;
  866. {$EXTERNALSYM DsBindToISTGW}
  867. function DsBindToISTGA(SiteName: LPCSTR; phDS: LPHANDLE): DWORD; stdcall;
  868. {$EXTERNALSYM DsBindToISTGA}
  869. function DsBindToISTG(SiteName: LPCTSTR; phDS: LPHANDLE): DWORD; stdcall;
  870. {$EXTERNALSYM DsBindToISTG}
  871. //
  872. // DsBindingSetTimeout allows the caller to specify a timeout value
  873. // which will be honored by all RPC calls using the specified binding
  874. // handle. RPC calls which take longer the timeout value are canceled.
  875. //
  876. function DsBindingSetTimeout(hDS: HANDLE; cTimeoutSecs: ULONG): DWORD; stdcall;
  877. {$EXTERNALSYM DsBindingSetTimeout}
  878. //
  879. // DsUnBind
  880. //
  881. function DsUnBindA(var phDS: HANDLE): DWORD; stdcall;
  882. {$EXTERNALSYM DsUnBindA}
  883. function DsUnBindW(var phDS: HANDLE): DWORD; stdcall;
  884. {$EXTERNALSYM DsUnBindW}
  885. function DsUnBind(var phDS: HANDLE): DWORD; stdcall;
  886. {$EXTERNALSYM DsUnBind}
  887. //
  888. // DsMakePasswordCredentials
  889. //
  890. // This function constructs a credential structure which is suitable for input
  891. // to the DsBindWithCredentials function, or the ldap_open function(winldap.h)
  892. // The credential must be freed using DsFreeCredential.
  893. //
  894. // None of the input parameters may be present indicating a null, default
  895. // credential. Otherwise the username must be present. If the domain or
  896. // password are null, they default to empty strings. The domain name may be
  897. // null when the username is fully qualified, for example UPN format.
  898. //
  899. function DsMakePasswordCredentialsA(User: LPCSTR; Domain: LPCSTR;
  900. Password: LPCSTR; var pAuthIdentity: RPC_AUTH_IDENTITY_HANDLE): DWORD; stdcall;
  901. {$EXTERNALSYM DsMakePasswordCredentialsA}
  902. function DsMakePasswordCredentialsW(User: LPCWSTR; Domain: LPCWSTR;
  903. Password: LPCWSTR; var pAuthIdentity: RPC_AUTH_IDENTITY_HANDLE): DWORD; stdcall;
  904. {$EXTERNALSYM DsMakePasswordCredentialsW}
  905. function DsMakePasswordCredentials(User: LPCTSTR; Domain: LPCTSTR;
  906. Password: LPCTSTR; var pAuthIdentity: RPC_AUTH_IDENTITY_HANDLE): DWORD; stdcall;
  907. {$EXTERNALSYM DsMakePasswordCredentials}
  908. procedure DsFreePasswordCredentialsA(AuthIdentity: RPC_AUTH_IDENTITY_HANDLE); stdcall;
  909. {$EXTERNALSYM DsFreePasswordCredentialsA}
  910. procedure DsFreePasswordCredentialsW(AuthIdentity: RPC_AUTH_IDENTITY_HANDLE); stdcall;
  911. {$EXTERNALSYM DsFreePasswordCredentialsW}
  912. procedure DsFreePasswordCredentials(AuthIdentity: RPC_AUTH_IDENTITY_HANDLE); stdcall;
  913. {$EXTERNALSYM DsFreePasswordCredentials}
  914. //
  915. // DsCrackNames
  916. //
  917. function DsCrackNamesA(hDS: HANDLE; flags: DS_NAME_FLAGS;
  918. formatOffered: DS_NAME_FORMAT; formatDesired: DS_NAME_FORMAT; cNames: DWORD;
  919. rpNames: LPCSTR; var ppResult: PDS_NAME_RESULTA): DWORD; stdcall;
  920. {$EXTERNALSYM DsCrackNamesA}
  921. function DsCrackNamesW(hDS: HANDLE; flags: DS_NAME_FLAGS;
  922. formatOffered: DS_NAME_FORMAT; formatDesired: DS_NAME_FORMAT; cNames: DWORD;
  923. rpNames: LPCWSTR; var ppResult: PDS_NAME_RESULTW): DWORD; stdcall;
  924. {$EXTERNALSYM DsCrackNamesW}
  925. function DsCrackNames(hDS: HANDLE; flags: DS_NAME_FLAGS;
  926. formatOffered: DS_NAME_FORMAT; formatDesired: DS_NAME_FORMAT; cNames: DWORD;
  927. rpNames: LPCTSTR; var ppResult: PDS_NAME_RESULT): DWORD; stdcall;
  928. {$EXTERNALSYM DsCrackNames}
  929. //
  930. // DsFreeNameResult
  931. //
  932. procedure DsFreeNameResultA(pResult: PDS_NAME_RESULTA); stdcall;
  933. {$EXTERNALSYM DsFreeNameResultA}
  934. procedure DsFreeNameResultW(pResult: PDS_NAME_RESULTW); stdcall;
  935. {$EXTERNALSYM DsFreeNameResultW}
  936. procedure DsFreeNameResult(pResult: PDS_NAME_RESULT); stdcall;
  937. {$EXTERNALSYM DsFreeNameResult}
  938. // ==========================================================
  939. // DSMakeSpn -- client call to create SPN for a service to which it wants to
  940. // authenticate.
  941. // This name is then passed to "pszTargetName" of InitializeSecurityContext().
  942. //
  943. // Notes:
  944. // If the service name is a DNS host name, or canonical DNS service name
  945. // e.g. "www.ms.com", i.e., caller resolved with gethostbyname, then instance
  946. // name should be NULL.
  947. // Realm is host name minus first component, unless it is in the exception list
  948. //
  949. // If the service name is NetBIOS machine name, then instance name should be
  950. // NULL
  951. // Form must be <domain>\<machine>
  952. // Realm will be <domain>
  953. //
  954. // If the service name is that of a replicated service, where each replica has
  955. // its own account (e.g., with SRV records) then the caller must supply the
  956. // instance name then realm name is same as ServiceName
  957. //
  958. // If the service name is a DN, then must also supply instance name
  959. // (DN could be name of service object (incl RPC or Winsock), name of machine
  960. // account, name of domain object)
  961. // then realm name is domain part of the DN
  962. //
  963. // If the service name is NetBIOS domain name, then must also supply instance
  964. // name; realm name is domain name
  965. //
  966. // If the service is named by an IP address -- then use referring service name
  967. // as service name
  968. //
  969. // ServiceClass - e.g. "http", "ftp", "ldap", GUID
  970. // ServiceName - DNS or DN; assumes we can compute domain from service name
  971. // InstanceName OPTIONAL- DNS name of host for instance of service
  972. // InstancePort - port number for instance (0 if default)
  973. // Referrer OPTIONAL- DNS name of host that gave this referral
  974. // pcSpnLength - in -- max length IN CHARACTERS of principal name;
  975. // out -- actual
  976. // Length includes terminator
  977. // pszSPN - server principal name
  978. //
  979. // If buffer is not large enough, ERROR_BUFFER_OVERFLOW is returned and the
  980. // needed length is returned in pcSpnLength.
  981. //
  982. //
  983. function DsMakeSpnA(ServiceClass: LPCSTR; ServiceName: LPCSTR;
  984. InstanceName: LPCSTR; InstancePort: USHORT; Referrer: LPCSTR;
  985. var pcSpnLength: DWORD; pszSpn: LPSTR): DWORD; stdcall;
  986. {$EXTERNALSYM DsMakeSpnA}
  987. function DsMakeSpnW(ServiceClass: LPCWSTR; ServiceName: LPCWSTR;
  988. InstanceName: LPCWSTR; InstancePort: USHORT; Referrer: LPCWSTR;
  989. var pcSpnLength: DWORD; pszSpn: LPWSTR): DWORD; stdcall;
  990. {$EXTERNALSYM DsMakeSpnW}
  991. function DsMakeSpn(ServiceClass: LPCTSTR; ServiceName: LPCTSTR;
  992. InstanceName: LPCTSTR; InstancePort: USHORT; Referrer: LPCTSTR;
  993. var pcSpnLength: DWORD; pszSpn: LPTSTR): DWORD; stdcall;
  994. {$EXTERNALSYM DsMakeSpn}
  995. // ==========================================================
  996. // DsGetSPN -- server's call to gets SPNs for a service name by which it is
  997. // known to clients. N.B.: there may be more than one name by which clients
  998. // know it the SPNs are then passed to DsAddAccountSpn to register them in
  999. // the DS
  1000. //
  1001. // IN SpnNameType eType,
  1002. // IN LPCTSTR ServiceClass,
  1003. // kind of service -- "http", "ldap", "ftp", etc.
  1004. // IN LPCTSTR ServiceName OPTIONAL,
  1005. // name of service -- DN or DNS; not needed for host-based
  1006. // IN USHORT InstancePort,
  1007. // port number (0 => default) for instances
  1008. // IN USHORT cInstanceNames,
  1009. // count of extra instance names and ports (0=>use gethostbyname)
  1010. // IN LPCTSTR InstanceNames[] OPTIONAL,
  1011. // extra instance names (not used for host names)
  1012. // IN USHORT InstancePorts[] OPTIONAL,
  1013. // extra instance ports (0 => default)
  1014. // IN OUT PULONG pcSpn, // count of SPNs
  1015. // IN OUT LPTSTR * prpszSPN[]
  1016. // a bunch of SPNs for this service; free with DsFreeSpnArray
  1017. function DsGetSpnA(ServiceType: DS_SPN_NAME_TYPE; ServiceClass: LPCSTR;
  1018. ServiceName: LPCSTR; InstancePort: USHORT; cInstanceNames: USHORT;
  1019. pInstanceNames: LPCSTR; pInstancePorts: PUSHORT; var pcSpn: DWORD;
  1020. var prpszSpn: LPSTR): DWORD; stdcall;
  1021. {$EXTERNALSYM DsGetSpnA}
  1022. function DsGetSpnW(ServiceType: DS_SPN_NAME_TYPE; ServiceClass: LPCWSTR;
  1023. ServiceName: LPCWSTR; InstancePort: USHORT; cInstanceNames: USHORT;
  1024. pInstanceNames: LPCWSTR; pInstancePorts: PUSHORT; var pcSpn: DWORD;
  1025. var prpszSpn: LPWSTR): DWORD; stdcall;
  1026. {$EXTERNALSYM DsGetSpnW}
  1027. function DsGetSpn(ServiceType: DS_SPN_NAME_TYPE; ServiceClass: LPCTSTR;
  1028. ServiceName: LPCTSTR; InstancePort: USHORT; cInstanceNames: USHORT;
  1029. pInstanceNames: LPCTSTR; pInstancePorts: PUSHORT; var pcSpn: DWORD;
  1030. var prpszSpn: LPTSTR): DWORD; stdcall;
  1031. {$EXTERNALSYM DsGetSpn}
  1032. // ==========================================================
  1033. // DsFreeSpnArray() -- Free array returned by DsGetSpn{A,W}
  1034. procedure DsFreeSpnArrayA(cSpn: DWORD; rpszSpn: LPSTR); stdcall;
  1035. {$EXTERNALSYM DsFreeSpnArrayA}
  1036. procedure DsFreeSpnArrayW(cSpn: DWORD; rpszSpn: LPWSTR); stdcall;
  1037. {$EXTERNALSYM DsFreeSpnArrayW}
  1038. procedure DsFreeSpnArray(cSpn: DWORD; rpszSpn: LPTSTR); stdcall;
  1039. {$EXTERNALSYM DsFreeSpnArray}
  1040. // ==========================================================
  1041. // DsCrackSpn() -- parse an SPN into the ServiceClass,
  1042. // ServiceName, and InstanceName (and InstancePort) pieces.
  1043. // An SPN is passed in, along with a pointer to the maximum length
  1044. // for each piece and a pointer to a buffer where each piece should go.
  1045. // On exit, the maximum lengths are updated to the actual length for each piece
  1046. // and the buffer contain the appropriate piece. The InstancePort is 0 if not
  1047. // present.
  1048. //
  1049. // DWORD DsCrackSpn(
  1050. // IN LPTSTR pszSPN, // the SPN to parse
  1051. // IN OUT PUSHORT pcServiceClass, // input -- max length of ServiceClass;
  1052. // output -- actual length
  1053. // OUT LPCTSTR ServiceClass, // the ServiceClass part of the SPN
  1054. // IN OUT PUSHORT pcServiceName, // input -- max length of ServiceName;
  1055. // output -- actual length
  1056. // OUT LPCTSTR ServiceName, // the ServiceName part of the SPN
  1057. // IN OUT PUSHORT pcInstance, // input -- max length of ServiceClass;
  1058. // output -- actual length
  1059. // OUT LPCTSTR InstanceName, // the InstanceName part of the SPN
  1060. // OUT PUSHORT InstancePort // instance port
  1061. //
  1062. // Note: lengths are in characters; all string lengths include terminators
  1063. // All arguments except pszSpn are optional.
  1064. //
  1065. function DsCrackSpnA(pszSpn: LPCSTR; pcServiceClass: LPDWORD; ServiceClass: LPSTR;
  1066. pcServiceName: LPDWORD; ServiceName: LPSTR; pcInstanceName: LPDWORD;
  1067. InstanceName: LPSTR; pInstancePort: PUSHORT): DWORD; stdcall;
  1068. {$EXTERNALSYM DsCrackSpnA}
  1069. function DsCrackSpnW(pszSpn: LPCWSTR; pcServiceClass: LPDWORD; ServiceClass: LPWSTR;
  1070. pcServiceName: LPDWORD; ServiceName: LPWSTR; pcInstanceName: LPDWORD;
  1071. InstanceName: LPWSTR; pInstancePort: PUSHORT): DWORD; stdcall;
  1072. {$EXTERNALSYM DsCrackSpnW}
  1073. function DsCrackSpn(pszSpn: LPCTSTR; pcServiceClass: LPDWORD; ServiceClass: LPTSTR;
  1074. pcServiceName: LPDWORD; ServiceName: LPTSTR; pcInstanceName: LPDWORD;
  1075. InstanceName: LPTSTR; pInstancePort: PUSHORT): DWORD; stdcall;
  1076. {$EXTERNALSYM DsCrackSpn}
  1077. // ==========================================================
  1078. // DsWriteAccountSpn -- set or add SPNs for an account object
  1079. // Usually done by service itself, or perhaps by an admin.
  1080. //
  1081. // This call is RPC'd to the DC where the account object is stored, so it can
  1082. // securely enforce policy on what SPNs are allowed on the account. Direct LDAP
  1083. // writes to the SPN property are not allowed -- all writes must come through
  1084. // this RPC call. (Reads via // LDAP are OK.)
  1085. //
  1086. // The account object can be a machine accout, or a service (user) account.
  1087. //
  1088. // If called by the service to register itself, it can most easily get
  1089. // the names by calling DsGetSpn with each of the names that
  1090. // clients can use to find the service.
  1091. //
  1092. // IN SpnWriteOp eOp, // set, add
  1093. // IN LPCTSTR pszAccount, // DN of account to which to add SPN
  1094. // IN int cSPN, // count of SPNs to add to account
  1095. // IN LPCTSTR rpszSPN[] // SPNs to add to altSecID property
  1096. function DsWriteAccountSpnA(hDS: HANDLE; Operation: DS_SPN_WRITE_OP;
  1097. pszAccount: LPCSTR; cSpn: DWORD; rpszSpn: LPCSTR): DWORD; stdcall;
  1098. {$EXTERNALSYM DsWriteAccountSpnA}
  1099. function DsWriteAccountSpnW(hDS: HANDLE; Operation: DS_SPN_WRITE_OP;
  1100. pszAccount: LPCWSTR; cSpn: DWORD; rpszSpn: LPCWSTR): DWORD; stdcall;
  1101. {$EXTERNALSYM DsWriteAccountSpnW}
  1102. function DsWriteAccountSpn(hDS: HANDLE; Operation: DS_SPN_WRITE_OP;
  1103. pszAccount: LPCTSTR; cSpn: DWORD; rpszSpn: LPCTSTR): DWORD; stdcall;
  1104. {$EXTERNALSYM DsWriteAccountSpn}
  1105. {++
  1106. Routine Description:
  1107. Constructs a Service Principal Name suitable to identify the desired server.
  1108. The service class and part of a dns hostname must be supplied.
  1109. This routine is a simplified wrapper to DsMakeSpn.
  1110. The ServiceName is made canonical by resolving through DNS.
  1111. Guid-based dns names are not supported.
  1112. NOTE:
  1113. This routine is no longer recommended for use. In order to be secure, an SPN
  1114. should be constructed purely on the client without reliance on other services,
  1115. such as DNS, which may be spoofed.
  1116. The simplified SPN constructed looks like this:
  1117. ServiceClass / ServiceName / ServiceName
  1118. The instance name portion (2nd position) is always defaulted. The port and
  1119. referrer fields are not used.
  1120. Arguments:
  1121. ServiceClass - Class of service, defined by the service, can be any
  1122. string unique to the service
  1123. ServiceName - dns hostname, fully qualified or not
  1124. Stringized IP address is also resolved if necessary
  1125. pcSpnLength - IN, maximum length of buffer, in chars
  1126. OUT, space utilized, in chars, including terminator
  1127. pszSpn - Buffer, atleast of length *pcSpnLength
  1128. Return Value:
  1129. WINAPI - Win32 error code
  1130. --}
  1131. function DsClientMakeSpnForTargetServerA(ServiceClass: LPCSTR; ServiceName: LPCSTR;
  1132. var pcSpnLength: DWORD; pszSpn: LPSTR): DWORD; stdcall;
  1133. {$EXTERNALSYM DsClientMakeSpnForTargetServerA}
  1134. function DsClientMakeSpnForTargetServerW(ServiceClass: LPCWSTR; ServiceName: LPCWSTR;
  1135. var pcSpnLength: DWORD; pszSpn: LPWSTR): DWORD; stdcall;
  1136. {$EXTERNALSYM DsClientMakeSpnForTargetServerW}
  1137. function DsClientMakeSpnForTargetServer(ServiceClass: LPCTSTR; ServiceName: LPCTSTR;
  1138. var pcSpnLength: DWORD; pszSpn: LPTSTR): DWORD; stdcall;
  1139. {$EXTERNALSYM DsClientMakeSpnForTargetServer}
  1140. {++
  1141. outine Description:
  1142. Register Service Principal Names for a server application.
  1143. This routine does the following:
  1144. 1. Enumerates a list of server SPNs using DsGetSpn and the provided class
  1145. 2. Determines the domain of the current user context
  1146. 3. Determines the DN of the current user context if not supplied
  1147. 4. Locates a domain controller
  1148. 5. Binds to the domain controller
  1149. 6. Uses DsWriteAccountSpn to write the SPNs on the named object DN
  1150. 7. Unbinds
  1151. Construct server SPNs for this service, and write them to the right object.
  1152. If the userObjectDn is specified, the SPN is written to that object.
  1153. Otherwise the Dn is defaulted, to the user object, then computer.
  1154. Now, bind to the DS, and register the name on the object for the
  1155. user this service is running as. So, if we're running as local
  1156. system, we'll register it on the computer object itself. If we're
  1157. running as a domain user, we'll add the SPN to the user's object.
  1158. Arguments:
  1159. Operation - What should be done with the values: add, replace or delete
  1160. ServiceClass - Unique string identifying service
  1161. UserObjectDN - Optional, dn of object to write SPN to
  1162. Return Value:
  1163. WINAPI - Win32 error code
  1164. --}
  1165. function DsServerRegisterSpnA(Operation: DS_SPN_WRITE_OP; ServiceClass: LPCSTR;
  1166. UserObjectDN: LPCSTR): DWORD; stdcall;
  1167. {$EXTERNALSYM DsServerRegisterSpnA}
  1168. function DsServerRegisterSpnW(Operation: DS_SPN_WRITE_OP; ServiceClass: LPCWSTR;
  1169. UserObjectDN: LPCWSTR): DWORD; stdcall;
  1170. {$EXTERNALSYM DsServerRegisterSpnW}
  1171. function DsServerRegisterSpn(Operation: DS_SPN_WRITE_OP; ServiceClass: LPCTSTR;
  1172. UserObjectDN: LPCTSTR): DWORD; stdcall;
  1173. {$EXTERNALSYM DsServerRegisterSpn}
  1174. // DsReplicaSync. The server that this call is executing on is called the
  1175. // destination. The destination's naming context will be brought up to date
  1176. // with respect to a source system. The source system is identified by the
  1177. // uuid. The uuid is that of the source system's "NTDS Settings" object.
  1178. // The destination system must already be configured such that the source
  1179. // system is one of the systems from which it recieves replication data
  1180. // ("replication from"). This is usually done automatically by the KCC.
  1181. //
  1182. // PARAMETERS:
  1183. // pNC (DSNAME *)
  1184. // Name of the NC to synchronize.
  1185. // puuidSourceDRA (SZ)
  1186. // objectGuid of DSA with which to synchronize the replica.
  1187. // ulOptions (ULONG)
  1188. // Bitwise OR of zero or more flags
  1189. // RETURNS: WIN32 STATUS
  1190. function DsReplicaSyncA(hDS: HANDLE; NameContext: LPCSTR; pUuidDsaSrc: LPUUID;
  1191. Options: ULONG): DWORD; stdcall;
  1192. {$EXTERNALSYM DsReplicaSyncA}
  1193. function DsReplicaSyncW(hDS: HANDLE; NameContext: LPCWSTR; pUuidDsaSrc: LPUUID;
  1194. Options: ULONG): DWORD; stdcall;
  1195. {$EXTERNALSYM DsReplicaSyncW}
  1196. function DsReplicaSync(hDS: HANDLE; NameContext: LPCTSTR; pUuidDsaSrc: LPUUID;
  1197. Options: ULONG): DWORD; stdcall;
  1198. {$EXTERNALSYM DsReplicaSync}
  1199. // DsReplicaAdd
  1200. //
  1201. {
  1202. Description:
  1203. This call is executed on the destination. It causes the destination to
  1204. add a "replication from" reference to the indicated source system.
  1205. The source server is identified by string name, not uuid as with Sync.
  1206. The DsaSrcAddress parameter is the transport specific address of the source
  1207. DSA, usually its guid-based dns name. The guid in the guid-based dns name is
  1208. the object-guid of that server's ntds-dsa (settings) object.
  1209. Arguments:
  1210. pNC (IN) - NC for which to add the replica.
  1211. pSourceDsaDN (IN) - DN of the source DSA's ntdsDsa object. Required if
  1212. ulOptions includes DS_REPADD_ASYNCHRONOUS_REPLICA; ignored otherwise.
  1213. pTransportDN (IN) - DN of the interSiteTransport object representing the
  1214. transport by which to communicate with the source server. Required if
  1215. ulOptions includes INTERSITE_MESSAGING; ignored otherwise.
  1216. pszSourceDsaAddress (IN) - Transport-specific address of the source DSA.
  1217. pSchedule (IN) - Schedule by which to replicate the NC from this
  1218. source in the future.
  1219. ulOptions (IN) - flags
  1220. RETURNS: WIN32 STATUS
  1221. }
  1222. function DsReplicaAddA(hDS: HANDLE; NameContext: LPCSTR; SourceDsaDn: LPCSTR;
  1223. TransportDn: LPCSTR; SourceDsaAddress: LPCSTR; pSchedule: PSCHEDULE;
  1224. Options: DWORD): DWORD; stdcall;
  1225. {$EXTERNALSYM DsReplicaAddA}
  1226. function DsReplicaAddW(hDS: HANDLE; NameContext: LPCWSTR; SourceDsaDn: LPCWSTR;
  1227. TransportDn: LPCWSTR; SourceDsaAddress: LPCWSTR; pSchedule: PSCHEDULE;
  1228. Options: DWORD): DWORD; stdcall;
  1229. {$EXTERNALSYM DsReplicaAddW}
  1230. function DsReplicaAdd(hDS: HANDLE; NameContext: LPCTSTR; SourceDsaDn: LPCTSTR;
  1231. TransportDn: LPCTSTR; SourceDsaAddress: LPCTSTR; pSchedule: PSCHEDULE;
  1232. Options: DWORD): DWORD; stdcall;
  1233. {$EXTERNALSYM DsReplicaAdd}
  1234. // DsReplicaDel
  1235. //
  1236. // The server that this call is executing on is the destination. The call
  1237. // causes the destination to remove a "replication from" reference to the
  1238. // indicated source server.
  1239. // The source server is identified by string name, not uuid as with Sync.
  1240. // The DsaSrc parameter is the transport specific address of the source DSA,
  1241. // usually its guid-based dns name. The guid in the guid-based dns name is
  1242. // the object-guid of that server's ntds-dsa (settings) object.
  1243. // If you remove an NC from a given destination and specify the "no source"
  1244. // flag, then the entire replica will be removed from the DC.
  1245. //
  1246. // PARAMETERS:
  1247. // pNC (DSNAME *)
  1248. // Name of the NC for which to delete a source.
  1249. // pszSourceDRA (SZ)
  1250. // DSA for which to delete the source.
  1251. // ulOptions (ULONG)
  1252. // Bitwise OR of zero or more flags
  1253. //
  1254. //
  1255. // RETURNS: WIN32 STATUS
  1256. function DsReplicaDelA(hDS: HANDLE; NameContext: LPCSTR; DsaSrc: LPCSTR;
  1257. Options: ULONG): DWORD; stdcall;
  1258. {$EXTERNALSYM DsReplicaDelA}
  1259. function DsReplicaDelW(hDS: HANDLE; NameContext: LPCWSTR; DsaSrc: LPCWSTR;
  1260. Options: ULONG): DWORD; stdcall;
  1261. {$EXTERNALSYM DsReplicaDelW}
  1262. function DsReplicaDel(hDS: HANDLE; NameContext: LPCTSTR; DsaSrc: LPCTSTR;
  1263. Options: ULONG): DWORD; stdcall;
  1264. {$EXTERNALSYM DsReplicaDel}
  1265. // DsReplicaModify
  1266. //
  1267. //
  1268. // Modify a source for a given naming context
  1269. //
  1270. // The value must already exist.
  1271. //
  1272. // Either the UUID or the address may be used to identify the current value.
  1273. // If a UUID is specified, the UUID will be used for comparison. Otherwise,
  1274. // the address will be used for comparison.
  1275. //
  1276. // PARAMETERS:
  1277. // pNC (DSNAME *)
  1278. // Name of the NC for which the Reps-From should be modified.
  1279. // puuidSourceDRA (UUID *)
  1280. // Guid of the DSA object for the source server. May be NULL if:
  1281. // . ulModifyFields does not include DS_REPMOD_UPDATE_ADDRESS and
  1282. // . pmtxSourceDRA is non-NULL.
  1283. // puuidTransportObj (UUID *)
  1284. // objectGuid of the transport by which replication is to be performed
  1285. // Ignored if ulModifyFields does not include
  1286. // DS_REPMOD_UPDATE_TRANSPORT.
  1287. // pszSourceDRA (SZ)
  1288. // DSA for which the reference should be added or deleted. Ignored if
  1289. // puuidSourceDRA is non-NULL and ulModifyFields does not include
  1290. // DS_REPMOD_UPDATE_ADDRESS.
  1291. // prtSchedule (REPLTIMES *)
  1292. // Periodic replication schedule for this replica. Ignored if
  1293. // ulModifyFields does not include DS_REPMOD_UPDATE_SCHEDULE.
  1294. // ulReplicaFlags (ULONG)
  1295. // Flags to set for this replica. Ignored if ulModifyFields does not
  1296. // include DS_REPMOD_UPDATE_FLAGS.
  1297. // ulModifyFields (ULONG)
  1298. // Fields to update. One or more of the following bit flags:
  1299. // UPDATE_ADDRESS
  1300. // Update the MTX_ADDR associated with the referenced server.
  1301. // UPDATE_SCHEDULE
  1302. // Update the periodic replication schedule associated with
  1303. // the replica.
  1304. // UPDATE_FLAGS
  1305. // Update the flags associated with the replica.
  1306. // UPDATE_TRANSPORT
  1307. // Update the transport associated with the replica.
  1308. // ulOptions (ULONG)
  1309. // Bitwise OR of zero or more of the following:
  1310. // DS_REPMOD_ASYNCHRONOUS_OPERATION
  1311. // Perform this operation asynchronously.
  1312. // RETURNS: WIN32 STATUS
  1313. function DsReplicaModifyA(hDS: HANDLE; NameContext: LPCSTR; pUuidSourceDsa: LPUUID;
  1314. TransportDn: LPCSTR; SourceDsaAddress: LPCSTR; pSchedule: PSCHEDULE;
  1315. ReplicaFlags: DWORD; ModifyFields: DWORD; Options: DWORD): DWORD; stdcall;
  1316. {$EXTERNALSYM DsReplicaModifyA}
  1317. function DsReplicaModifyW(hDS: HANDLE; NameContext: LPCWSTR; pUuidSourceDsa: LPUUID;
  1318. TransportDn: LPCWSTR; SourceDsaAddress: LPCWSTR; pSchedule: PSCHEDULE;
  1319. ReplicaFlags: DWORD; ModifyFields: DWORD; Options: DWORD): DWORD; stdcall;
  1320. {$EXTERNALSYM DsReplicaModifyW}
  1321. function DsReplicaModify(hDS: HANDLE; NameContext: LPCTSTR; pUuidSourceDsa: LPUUID;
  1322. TransportDn: LPCTSTR; SourceDsaAddress: LPCTSTR; pSchedule: PSCHEDULE;
  1323. ReplicaFlags: DWORD; ModifyFields: DWORD; Options: DWORD): DWORD; stdcall;
  1324. {$EXTERNALSYM DsReplicaModify}
  1325. // DsReplicaUpdateRefs
  1326. //
  1327. // In this case, the RPC is being executed on the "source" of destination-sourc
  1328. // replication relationship. This function tells the source that it no longer
  1329. // supplies replication information to the indicated destination system.
  1330. // Add or remove a target server from the Reps-To property on the given NC.
  1331. // Add/remove a reference given the DSNAME of the corresponding NTDS-DSA
  1332. // object.
  1333. //
  1334. // PARAMETERS:
  1335. // pNC (DSNAME *)
  1336. // Name of the NC for which the Reps-To should be modified.
  1337. // DsaDest (SZ)
  1338. // Network address of DSA for which the reference should be added
  1339. // or deleted.
  1340. // pUuidDsaDest (UUID *)
  1341. // objectGuid of the DSA object for which the reference should be
  1342. // added or deleted.
  1343. // ulOptions (ULONG)
  1344. // Bitwise OR of zero or more of the following:
  1345. // DS_REPUPD_ASYNC_OP
  1346. // Perform this operation asynchronously.
  1347. // DS_REPUPD_ADD_REFERENCE
  1348. // Add the given server to the Reps-To property.
  1349. // DS_REPUPD_DEL_REFERENCE
  1350. // Remove the given server from the Reps-To property.
  1351. // Note that ADD_REF and DEL_REF may be paired to perform
  1352. // "add or update".
  1353. //
  1354. // RETURNS: WIN32 STATUS
  1355. function DsReplicaUpdateRefsA(hDS: HANDLE; NameContext: LPCSTR; DsaDest: LPCSTR;
  1356. pUuidDsaDest: LPUUID; Options: ULONG): DWORD; stdcall;
  1357. {$EXTERNALSYM DsReplicaUpdateRefsA}
  1358. function DsReplicaUpdateRefsW(hDS: HANDLE; NameContext: LPCWSTR; DsaDest: LPCWSTR;
  1359. pUuidDsaDest: LPUUID; Options: ULONG): DWORD; stdcall;
  1360. {$EXTERNALSYM DsReplicaUpdateRefsW}
  1361. function DsReplicaUpdateRefs(hDS: HANDLE; NameContext: LPCTSTR; DsaDest: LPCTSTR;
  1362. pUuidDsaDest: LPUUID; Options: ULONG): DWORD; stdcall;
  1363. {$EXTERNALSYM DsReplicaUpdateRefs}
  1364. // Friends of DsReplicaSyncAll
  1365. type
  1366. DS_REPSYNCALL_ERROR = (
  1367. DS_REPSYNCALL_WIN32_ERROR_CONTACTING_SERVER,
  1368. DS_REPSYNCALL_WIN32_ERROR_REPLICATING,
  1369. DS_REPSYNCALL_SERVER_UNREACHABLE);
  1370. {$EXTERNALSYM DS_REPSYNCALL_ERROR}
  1371. TDsReSynCallError = DS_REPSYNCALL_ERROR;
  1372. DS_REPSYNCALL_EVENT = (
  1373. DS_REPSYNCALL_EVENT_ERROR,
  1374. DS_REPSYNCALL_EVENT_SYNC_STARTED,
  1375. DS_REPSYNCALL_EVENT_SYNC_COMPLETED,
  1376. DS_REPSYNCALL_EVENT_FINISHED);
  1377. {$EXTERNALSYM DS_REPSYNCALL_EVENT}
  1378. TDsReSynCallEvent = DS_REPSYNCALL_EVENT;
  1379. // Friends of DsReplicaSyncAll
  1380. PDS_REPSYNCALL_SYNCA = ^DS_REPSYNCALL_SYNCA;
  1381. {$EXTERNALSYM PDS_REPSYNCALL_SYNCA}
  1382. DS_REPSYNCALL_SYNCA = record
  1383. pszSrcId: LPSTR;
  1384. pszDstId: LPSTR;
  1385. pszNC: LPSTR;
  1386. pguidSrc: LPGUID;
  1387. pguidDst: LPGUID;
  1388. end;
  1389. {$EXTERNALSYM DS_REPSYNCALL_SYNCA}
  1390. TDsRepsyncallSyncA = DS_REPSYNCALL_SYNCA;
  1391. PDsRepsyncallSyncA = PDS_REPSYNCALL_SYNCA;
  1392. PDS_REPSYNCALL_SYNCW = ^DS_REPSYNCALL_SYNCW;
  1393. {$EXTERNALSYM PDS_REPSYNCALL_SYNCW}
  1394. DS_REPSYNCALL_SYNCW = record
  1395. pszSrcId: LPWSTR;
  1396. pszDstId: LPWSTR;
  1397. pszNC: LPWSTR;
  1398. pguidSrc: LPGUID;
  1399. pguidDst: LPGUID;
  1400. end;
  1401. {$EXTERNALSYM DS_REPSYNCALL_SYNCW}
  1402. TDsRepsyncallSyncW = DS_REPSYNCALL_SYNCW;
  1403. PDsRepsyncallSyncW = PDS_REPSYNCALL_SYNCW;
  1404. PDS_REPSYNCALL_ERRINFOA = ^DS_REPSYNCALL_ERRINFOA;
  1405. {$EXTERNALSYM PDS_REPSYNCALL_ERRINFOA}
  1406. DS_REPSYNCALL_ERRINFOA = record
  1407. pszSvrId: LPSTR;
  1408. error: DS_REPSYNCALL_ERROR;
  1409. dwWin32Err: DWORD;
  1410. pszSrcId: LPSTR;
  1411. end;
  1412. {$EXTERNALSYM DS_REPSYNCALL_ERRINFOA}
  1413. PPDS_REPSYNCALL_ERRINFOA = ^PDS_REPSYNCALL_ERRINFOA;
  1414. {$NODEFINE PPDS_REPSYNCALL_ERRINFOA}
  1415. TDsRepSynCallErrInfoA = DS_REPSYNCALL_ERRINFOA;
  1416. PDsRepSynCallErrInfoA = PDS_REPSYNCALL_ERRINFOA;
  1417. PDS_REPSYNCALL_ERRINFOW = ^DS_REPSYNCALL_ERRINFOW;
  1418. {$EXTERNALSYM PDS_REPSYNCALL_ERRINFOW}
  1419. DS_REPSYNCALL_ERRINFOW = record
  1420. pszSvrId: LPWSTR;
  1421. error: DS_REPSYNCALL_ERROR;
  1422. dwWin32Err: DWORD;
  1423. pszSrcId: LPWSTR;
  1424. end;
  1425. {$EXTERNALSYM DS_REPSYNCALL_ERRINFOW}
  1426. PPDS_REPSYNCALL_ERRINFOW = ^PDS_REPSYNCALL_ERRINFOW;
  1427. {$NODEFINE PPDS_REPSYNCALL_ERRINFOW}
  1428. TDsRepSynCallErrInfoW = DS_REPSYNCALL_ERRINFOW;
  1429. PDsRepSynCallErrInfoW = PDS_REPSYNCALL_ERRINFOW;
  1430. PDS_REPSYNCALL_UPDATEA = ^DS_REPSYNCALL_UPDATEA;
  1431. {$EXTERNALSYM PDS_REPSYNCALL_UPDATEA}
  1432. DS_REPSYNCALL_UPDATEA = record
  1433. event: DS_REPSYNCALL_EVENT;
  1434. pErrInfo: PDS_REPSYNCALL_ERRINFOA;
  1435. pSync: PDS_REPSYNCALL_SYNCA;
  1436. end;
  1437. {$EXTERNALSYM DS_REPSYNCALL_UPDATEA}
  1438. TDsRepSynCallUpdateA = DS_REPSYNCALL_UPDATEA;
  1439. PDsRepSynCallUpdateA = PDS_REPSYNCALL_UPDATEA;
  1440. PDS_REPSYNCALL_UPDATEW = ^DS_REPSYNCALL_UPDATEW;
  1441. {$EXTERNALSYM PDS_REPSYNCALL_UPDATEW}
  1442. DS_REPSYNCALL_UPDATEW = record
  1443. event: DS_REPSYNCALL_EVENT;
  1444. pErrInfo: PDS_REPSYNCALL_ERRINFOW;
  1445. pSync: PDS_REPSYNCALL_SYNCW;
  1446. end;
  1447. {$EXTERNALSYM DS_REPSYNCALL_UPDATEW}
  1448. TDsRepSynCallUpdateW = DS_REPSYNCALL_UPDATEW;
  1449. PDsRepSynCallUpdateW = PDS_REPSYNCALL_UPDATEW;
  1450. {$IFDEF UNICODE}
  1451. DS_REPSYNCALL_SYNC = DS_REPSYNCALL_SYNCW;
  1452. {$EXTERNALSYM DS_REPSYNCALL_SYNC}
  1453. DS_REPSYNCALL_ERRINFO = DS_REPSYNCALL_ERRINFOW;
  1454. {$EXTERNALSYM DS_REPSYNCALL_ERRINFO}
  1455. PPDS_REPSYNCALL_ERRINFO = PPDS_REPSYNCALL_ERRINFOW;
  1456. {$NODEFINE PPDS_REPSYNCALL_ERRINFO}
  1457. DS_REPSYNCALL_UPDATE = DS_REPSYNCALL_UPDATEW;
  1458. {$EXTERNALSYM DS_REPSYNCALL_UPDATE}
  1459. PDS_REPSYNCALL_SYNC = PDS_REPSYNCALL_SYNCW;
  1460. {$EXTERNALSYM PDS_REPSYNCALL_SYNC}
  1461. PDS_REPSYNCALL_ERRINFO = PDS_REPSYNCALL_ERRINFOW;
  1462. {$EXTERNALSYM PDS_REPSYNCALL_ERRINFO}
  1463. PDS_REPSYNCALL_UPDATE = PDS_REPSYNCALL_UPDATEW;
  1464. {$EXTERNALSYM PDS_REPSYNCALL_UPDATE}
  1465. TDsRepSynCallSync = TDsRepSynCallSyncW;
  1466. PDsRepSynCallSync = PDsRepSynCallSyncW;
  1467. TDsRepSynCallErrInfo = TDsRepSynCallErrInfoW;
  1468. PDsRepSynCallErrInfo = PDsRepSynCallErrInfoW;
  1469. TDsRepSynCallUpdate = TDsRepSynCallUpdateW;
  1470. PDsRepSynCallUpdate = PDsRepSynCallUpdateW;
  1471. {$ELSE}
  1472. DS_REPSYNCALL_SYNC = DS_REPSYNCALL_SYNCA;
  1473. {$EXTERNALSYM DS_REPSYNCALL_SYNC}
  1474. DS_REPSYNCALL_ERRINFO = DS_REPSYNCALL_ERRINFOA;
  1475. {$EXTERNALSYM DS_REPSYNCALL_ERRINFO}
  1476. PPDS_REPSYNCALL_ERRINFO = PPDS_REPSYNCALL_ERRINFOA;
  1477. {$NODEFINE PPDS_REPSYNCALL_ERRINFO}
  1478. DS_REPSYNCALL_UPDATE = DS_REPSYNCALL_UPDATEA;
  1479. {$EXTERNALSYM DS_REPSYNCALL_UPDATE}
  1480. PDS_REPSYNCALL_SYNC = PDS_REPSYNCALL_SYNCA;
  1481. {$EXTERNALSYM PDS_REPSYNCALL_SYNC}
  1482. PDS_REPSYNCALL_ERRINFO = PDS_REPSYNCALL_ERRINFOA;
  1483. {$EXTERNALSYM PDS_REPSYNCALL_ERRINFO}
  1484. PDS_REPSYNCALL_UPDATE = PDS_REPSYNCALL_UPDATEA;
  1485. {$EXTERNALSYM PDS_REPSYNCALL_UPDATE}
  1486. TDsRepSynCallSync = TDsRepSynCallSyncA;
  1487. PDsRepSynCallSync = PDsRepSynCallSyncA;
  1488. TDsRepSynCallErrInfo = TDsRepSynCallErrInfoA;
  1489. PDsRepSynCallErrInfo = PDsRepSynCallErrInfoA;
  1490. TDsRepSynCallUpdate = TDsRepSynCallUpdateA;
  1491. PDsRepSynCallUpdate = PDsRepSynCallUpdateA;
  1492. {$ENDIF UNICODE}
  1493. // **********************
  1494. // Replica SyncAll flags
  1495. // **********************
  1496. const
  1497. // This option has no effect.
  1498. DS_REPSYNCALL_NO_OPTIONS = $00000000;
  1499. {$EXTERNALSYM DS_REPSYNCALL_NO_OPTIONS}
  1500. // Ordinarily, if a server cannot be contacted, DsReplicaSyncAll tries to
  1501. // route around it and replicate from as many servers as possible. Enabling
  1502. // this option will cause DsReplicaSyncAll to generate a fatal error if any
  1503. // server cannot be contacted, or if any server is unreachable (due to a
  1504. // disconnected or broken topology.)
  1505. DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE = $00000001;
  1506. {$EXTERNALSYM DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE}
  1507. // This option disables transitive replication; syncs will only be performed
  1508. // with adjacent servers and no DsBind calls will be made.
  1509. DS_REPSYNCALL_SYNC_ADJACENT_SERVERS_ONLY = $00000002;
  1510. {$EXTERNALSYM DS_REPSYNCALL_SYNC_ADJACENT_SERVERS_ONLY}
  1511. // Ordinarily, when DsReplicaSyncAll encounters a non-fatal error, it returns
  1512. // the GUID DNS of the relevant server(s). Enabling this option causes
  1513. // DsReplicaSyncAll to return the servers' DNs instead.
  1514. DS_REPSYNCALL_ID_SERVERS_BY_DN = $00000004;
  1515. {$EXTERNALSYM DS_REPSYNCALL_ID_SERVERS_BY_DN}
  1516. // This option disables all syncing. The topology will still be analyzed and
  1517. // unavailable / unreachable servers will still be identified.
  1518. DS_REPSYNCALL_DO_NOT_SYNC = $00000008;
  1519. {$EXTERNALSYM DS_REPSYNCALL_DO_NOT_SYNC}
  1520. // Ordinarily, DsReplicaSyncAll attempts to bind to all servers before
  1521. // generating the topology. If a server cannot be contacted, DsReplicaSyncAll
  1522. // excludes that server from the topology and tries to route around it. If
  1523. // this option is enabled, checking will be bypassed and DsReplicaSyncAll will
  1524. // assume all servers are responding. This will speed operation of
  1525. // DsReplicaSyncAll, but if some servers are not responding, some transitive
  1526. // replications may be blocked.
  1527. DS_REPSYNCALL_SKIP_INITIAL_CHECK = $00000010;
  1528. {$EXTERNALSYM DS_REPSYNCALL_SKIP_INITIAL_CHECK}
  1529. // Push mode. Push changes from the home server out to all partners using
  1530. // transitive replication. This reverses the direction of replication, and
  1531. // the order of execution of the replication sets from the usual "pulling"
  1532. // mode of execution.
  1533. DS_REPSYNCALL_PUSH_CHANGES_OUTWARD = $00000020;
  1534. {$EXTERNALSYM DS_REPSYNCALL_PUSH_CHANGES_OUTWARD}
  1535. // Cross site boundaries. By default, the only servers that are considered are
  1536. // those in the same site as the home system. With this option, all servers in
  1537. // the enterprise, across all sites, are eligible. They must be connected by
  1538. // a synchronous (RPC) transport, however.
  1539. DS_REPSYNCALL_CROSS_SITE_BOUNDARIES = $00000040;
  1540. {$EXTERNALSYM DS_REPSYNCALL_CROSS_SITE_BOUNDARIES}
  1541. // DsReplicaSyncAll. Syncs the destination server with all other servers
  1542. // in the site.
  1543. //
  1544. // PARAMETERS:
  1545. // hDS (IN) - A DS connection bound to the destination server.
  1546. // pszNameContext (IN) - The naming context to synchronize
  1547. // ulFlags (IN) - Bitwise OR of zero or more flags
  1548. // pFnCallBack (IN, OPTIONAL) - Callback function for message-passing.
  1549. // pCallbackData (IN, OPTIONAL) - A pointer that will be passed to the
  1550. // first argument of the callback function.
  1551. // pErrors (OUT, OPTIONAL) - Pointer to a (PDS_REPSYNCALL_ERRINFO *)
  1552. // object that will hold an array of error structures.
  1553. type
  1554. TSynchUpdateProcA = function(pData: LPVOID; pUpdate: PDS_REPSYNCALL_UPDATEA): BOOL; stdcall;
  1555. TSynchUpdateProcW = function(pData: LPVOID; pUpdate: PDS_REPSYNCALL_UPDATEW): BOOL; stdcall;
  1556. {$IFDEF UNICODE}
  1557. TSynchUpdateProc = TSynchUpdateProcW;
  1558. {$ELSE}
  1559. TSynchUpdateProc = TSynchUpdateProcA;
  1560. {$ENDIF UNICODE}
  1561. function DsReplicaSyncAllA(hDS: HANDLE; pszNameContext: LPCSTR; ulFlags: ULONG;
  1562. pfnCallBack: TSynchUpdateProcA; pCallbackData: LPVOID;
  1563. pErrors: PPDS_REPSYNCALL_ERRINFOA): DWORD; stdcall;
  1564. {$EXTERNALSYM DsReplicaSyncAllA}
  1565. function DsReplicaSyncAllW(hDS: HANDLE; pszNameContext: LPCWSTR; ulFlags: ULONG;
  1566. pfnCallBackW: TSynchUpdateProcW; pCallbackData: LPVOID;
  1567. pErrors: PPDS_REPSYNCALL_ERRINFOW): DWORD; stdcall;
  1568. {$EXTERNALSYM DsReplicaSyncAllW}
  1569. function DsReplicaSyncAll(hDS: HANDLE; pszNameContext: LPCTSTR; ulFlags: ULONG;
  1570. pfnCallBack: TSynchUpdateProc; pCallbackData: LPVOID;
  1571. pErrors: PPDS_REPSYNCALL_ERRINFO): DWORD; stdcall;
  1572. {$EXTERNALSYM DsReplicaSyncAll}
  1573. function DsRemoveDsServerA(hDs: HANDLE; ServerDN: LPSTR; DomainDN: LPSTR;
  1574. fLastDcInDomain: PBOOL; fCommit: BOOL): DWORD; stdcall;
  1575. {$EXTERNALSYM DsRemoveDsServerA}
  1576. function DsRemoveDsServerW(hDs: HANDLE; ServerDN: LPWSTR; DomainDN: LPWSTR;
  1577. fLastDcInDomain: PBOOL; fCommit: BOOL): DWORD; stdcall;
  1578. {$EXTERNALSYM DsRemoveDsServerW}
  1579. function DsRemoveDsServer(hDs: HANDLE; ServerDN: LPTSTR; DomainDN: LPTSTR;
  1580. fLastDcInDomain: PBOOL; fCommit: BOOL): DWORD; stdcall;
  1581. {$EXTERNALSYM DsRemoveDsServer}
  1582. function DsRemoveDsDomainA(hDs: HANDLE; DomainDN: LPSTR): DWORD; stdcall;
  1583. {$EXTERNALSYM DsRemoveDsDomainA}
  1584. function DsRemoveDsDomainW(hDs: HANDLE; DomainDN: LPWSTR): DWORD; stdcall;
  1585. {$EXTERNALSYM DsRemoveDsDomainW}
  1586. function DsRemoveDsDomain(hDs: HANDLE; DomainDN: LPTSTR): DWORD; stdcall;
  1587. {$EXTERNALSYM DsRemoveDsDomain}
  1588. function DsListSitesA(hDs: HANDLE; var ppSites: PDS_NAME_RESULTA): DWORD; stdcall;
  1589. {$EXTERNALSYM DsListSitesA}
  1590. function DsListSitesW(hDs: HANDLE; var ppSites: PDS_NAME_RESULTW): DWORD; stdcall;
  1591. {$EXTERNALSYM DsListSitesW}
  1592. function DsListSites(hDs: HANDLE; var ppSites: PDS_NAME_RESULT): DWORD; stdcall;
  1593. {$EXTERNALSYM DsListSites}
  1594. function DsListServersInSiteA(hDs: HANDLE; site: LPCSTR;
  1595. var ppServers: PDS_NAME_RESULTA): DWORD; stdcall;
  1596. {$EXTERNALSYM DsListServersInSiteA}
  1597. function DsListServersInSiteW(hDs: HANDLE; site: LPCWSTR;
  1598. var ppServers: PDS_NAME_RESULTW): DWORD; stdcall;
  1599. {$EXTERNALSYM DsListServersInSiteW}
  1600. function DsListServersInSite(hDs: HANDLE; site: LPCTSTR;
  1601. var ppServers: PDS_NAME_RESULT): DWORD; stdcall;
  1602. {$EXTERNALSYM DsListServersInSite}
  1603. function DsListDomainsInSiteA(hDs: HANDLE; site: LPCSTR;
  1604. var ppDomains: PDS_NAME_RESULTA): DWORD; stdcall;
  1605. {$EXTERNALSYM DsListDomainsInSiteA}
  1606. function DsListDomainsInSiteW(hDs: HANDLE; site: LPCWSTR;
  1607. var ppDomains: PDS_NAME_RESULTW): DWORD; stdcall;
  1608. {$EXTERNALSYM DsListDomainsInSiteW}
  1609. function DsListDomainsInSite(hDs: HANDLE; site: LPCTSTR;
  1610. var ppDomains: PDS_NAME_RESULT): DWORD; stdcall;
  1611. {$EXTERNALSYM DsListDomainsInSite}
  1612. function DsListServersForDomainInSiteA(hDs: HANDLE; domain: LPCSTR; site: LPCSTR;
  1613. var ppServers: PDS_NAME_RESULTA): DWORD; stdcall;
  1614. {$EXTERNALSYM DsListServersForDomainInSiteA}
  1615. function DsListServersForDomainInSiteW(hDs: HANDLE; domain: LPCWSTR; site: LPCWSTR;
  1616. var ppServers: PDS_NAME_RESULTW): DWORD; stdcall;
  1617. {$EXTERNALSYM DsListServersForDomainInSiteW}
  1618. function DsListServersForDomainInSite(hDs: HANDLE; domain: LPCTSTR; site: LPCTSTR;
  1619. var ppServers: PDS_NAME_RESULT): DWORD; stdcall;
  1620. {$EXTERNALSYM DsListServersForDomainInSite}
  1621. // Define indices for DsListInfoForServer return data. Check status
  1622. // for each field as a given value may not be present.
  1623. const
  1624. DS_LIST_DSA_OBJECT_FOR_SERVER = 0;
  1625. {$EXTERNALSYM DS_LIST_DSA_OBJECT_FOR_SERVER}
  1626. DS_LIST_DNS_HOST_NAME_FOR_SERVER = 1;
  1627. {$EXTERNALSYM DS_LIST_DNS_HOST_NAME_FOR_SERVER}
  1628. DS_LIST_ACCOUNT_OBJECT_FOR_SERVER = 2;
  1629. {$EXTERNALSYM DS_LIST_ACCOUNT_OBJECT_FOR_SERVER}
  1630. function DsListInfoForServerA(hDs: HANDLE; server: LPCSTR;
  1631. var ppInfo: PDS_NAME_RESULTA): DWORD; stdcall;
  1632. {$EXTERNALSYM DsListInfoForServerA}
  1633. function DsListInfoForServerW(hDs: HANDLE; server: LPCWSTR;
  1634. var ppInfo: PDS_NAME_RESULTW): DWORD; stdcall;
  1635. {$EXTERNALSYM DsListInfoForServerW}
  1636. function DsListInfoForServer(hDs: HANDLE; server: LPCTSTR;
  1637. var ppInfo: PDS_NAME_RESULT): DWORD; stdcall;
  1638. {$EXTERNALSYM DsListInfoForServer}
  1639. // Define indices for DsListRoles return data. Check status for
  1640. // each field as a given value may not be present.
  1641. const
  1642. DS_ROLE_SCHEMA_OWNER = 0;
  1643. {$EXTERNALSYM DS_ROLE_SCHEMA_OWNER}
  1644. DS_ROLE_DOMAIN_OWNER = 1;
  1645. {$EXTERNALSYM DS_ROLE_DOMAIN_OWNER}
  1646. DS_ROLE_PDC_OWNER = 2;
  1647. {$EXTERNALSYM DS_ROLE_PDC_OWNER}
  1648. DS_ROLE_RID_OWNER = 3;
  1649. {$EXTERNALSYM DS_ROLE_RID_OWNER}
  1650. DS_ROLE_INFRASTRUCTURE_OWNER = 4;
  1651. {$EXTERNALSYM DS_ROLE_INFRASTRUCTURE_OWNER}
  1652. function DsListRolesA(hDs: HANDLE; var ppRoles: PDS_NAME_RESULTA): DWORD; stdcall;
  1653. {$EXTERNALSYM DsListRolesA}
  1654. function DsListRolesW(hDs: HANDLE; var ppRoles: PDS_NAME_RESULTW): DWORD; stdcall;
  1655. {$EXTERNALSYM DsListRolesW}
  1656. function DsListRoles(hDs: HANDLE; var ppRoles: PDS_NAME_RESULT): DWORD; stdcall;
  1657. {$EXTERNALSYM DsListRoles}
  1658. //
  1659. // DsQuerySitesByCost{A|W} allows the caller to determine the
  1660. // communication cost between the From Site and each of the sites
  1661. // in the list of To Sites. The costs are returned in the rgSiteInfo
  1662. // structure which must be freed with DsQuerySitesFree.
  1663. //
  1664. // The Site Names should all be passed as RDNs. For example, if the
  1665. // site's DN is "CN=Foo,CN=Sites,CN=Configuration,...", the RDN is
  1666. // simply "Foo".
  1667. //
  1668. type
  1669. DS_SITE_COST_INFO = record
  1670. errorCode: DWORD;
  1671. cost: DWORD;
  1672. end;
  1673. {$EXTERNALSYM DS_SITE_COST_INFO}
  1674. PDS_SITE_COST_INFO = ^DS_SITE_COST_INFO;
  1675. {$EXTERNALSYM PDS_SITE_COST_INFO}
  1676. TDsSiteCostInfo = DS_SITE_COST_INFO;
  1677. PDsSiteCostInfo = PDS_SITE_COST_INFO;
  1678. function DsQuerySitesByCostW(hDS: HANDLE; pwszFromSite: LPWSTR; out rgwszToSites: LPWSTR; cToSites, dwFlags: DWORD;
  1679. out prgSiteInfo: PDS_SITE_COST_INFO): DWORD; stdcall;
  1680. {$EXTERNALSYM DsQuerySitesByCostW}
  1681. function DsQuerySitesByCostA(hDS: HANDLE; pwszFromSite: LPSTR; out rgwszToSites: LPSTR; cToSites, dwFlags: DWORD;
  1682. out prgSiteInfo: PDS_SITE_COST_INFO): DWORD; stdcall;
  1683. {$EXTERNALSYM DsQuerySitesByCostA}
  1684. function DsQuerySitesByCost(hDS: HANDLE; pwszFromSite: LPTSTR; out rgwszToSites: LPTSTR; cToSites, dwFlags: DWORD;
  1685. out prgSiteInfo: PDS_SITE_COST_INFO): DWORD; stdcall;
  1686. {$EXTERNALSYM DsQuerySitesByCost}
  1687. //
  1688. // DsQuerySitesByCost will free the site info array returned
  1689. // from DsQuerySitesByCost{A|W}.
  1690. //
  1691. procedure DsQuerySitesFree(rgSiteInfo: PDS_SITE_COST_INFO); stdcall;
  1692. {$EXTERNALSYM DsQuerySitesFree}
  1693. // Definitions required for DsMapSchemaGuid routines.
  1694. const
  1695. DS_SCHEMA_GUID_NOT_FOUND = 0;
  1696. {$EXTERNALSYM DS_SCHEMA_GUID_NOT_FOUND}
  1697. DS_SCHEMA_GUID_ATTR = 1;
  1698. {$EXTERNALSYM DS_SCHEMA_GUID_ATTR}
  1699. DS_SCHEMA_GUID_ATTR_SET = 2;
  1700. {$EXTERNALSYM DS_SCHEMA_GUID_ATTR_SET}
  1701. DS_SCHEMA_GUID_CLASS = 3;
  1702. {$EXTERNALSYM DS_SCHEMA_GUID_CLASS}
  1703. DS_SCHEMA_GUID_CONTROL_RIGHT = 4;
  1704. {$EXTERNALSYM DS_SCHEMA_GUID_CONTROL_RIGHT}
  1705. type
  1706. PDS_SCHEMA_GUID_MAPA = ^DS_SCHEMA_GUID_MAPA;
  1707. {$EXTERNALSYM PDS_SCHEMA_GUID_MAPA}
  1708. DS_SCHEMA_GUID_MAPA = record
  1709. guid: GUID; // mapped GUID
  1710. guidType: DWORD; // DS_SCHEMA_GUID_* value
  1711. pName: LPSTR; // might be NULL
  1712. end;
  1713. {$EXTERNALSYM DS_SCHEMA_GUID_MAPA}
  1714. TDsSchemaGuidMapA = DS_SCHEMA_GUID_MAPA;
  1715. PDsSchemaGuidMapA = PDS_SCHEMA_GUID_MAPA;
  1716. PDS_SCHEMA_GUID_MAPW = ^DS_SCHEMA_GUID_MAPW;
  1717. {$EXTERNALSYM PDS_SCHEMA_GUID_MAPW}
  1718. DS_SCHEMA_GUID_MAPW = record
  1719. guid: GUID; // mapped GUID
  1720. guidType: DWORD; // DS_SCHEMA_GUID_* value
  1721. pName: LPWSTR; // might be NULL
  1722. end;
  1723. {$EXTERNALSYM DS_SCHEMA_GUID_MAPW}
  1724. TDsSchemaGuidMapW = DS_SCHEMA_GUID_MAPW;
  1725. PDsSchemaGuidMapW = PDS_SCHEMA_GUID_MAPW;
  1726. {$IFDEF UNICODE}
  1727. TDsSchemaGuidMap = DS_SCHEMA_GUID_MAPW;
  1728. PDsSchemaGuidMap = PDS_SCHEMA_GUID_MAPW;
  1729. DS_SCHEMA_GUID_MAP = DS_SCHEMA_GUID_MAPW;
  1730. PDS_SCHEMA_GUID_MAP = PDS_SCHEMA_GUID_MAPW;
  1731. {$ELSE}
  1732. TDsSchemaGuidMap = DS_SCHEMA_GUID_MAPW;
  1733. PDsSchemaGuidMap = PDS_SCHEMA_GUID_MAPW;
  1734. DS_SCHEMA_GUID_MAP = DS_SCHEMA_GUID_MAPA;
  1735. PDS_SCHEMA_GUID_MAP = PDS_SCHEMA_GUID_MAPA;
  1736. {$ENDIF UNICODE}
  1737. function DsMapSchemaGuidsA(hDs: HANDLE; cGuids: DWORD; rGuids: PGUID;
  1738. var ppGuidMap: PDS_SCHEMA_GUID_MAPA): DWORD; stdcall;
  1739. {$EXTERNALSYM DsMapSchemaGuidsA}
  1740. function DsMapSchemaGuidsW(hDs: HANDLE; cGuids: DWORD; rGuids: PGUID;
  1741. var ppGuidMap: PDS_SCHEMA_GUID_MAPW): DWORD; stdcall;
  1742. {$EXTERNALSYM DsMapSchemaGuidsW}
  1743. function DsMapSchemaGuids(hDs: HANDLE; cGuids: DWORD; rGuids: PGUID;
  1744. var ppGuidMap: PDS_SCHEMA_GUID_MAP): DWORD; stdcall;
  1745. {$EXTERNALSYM DsMapSchemaGuids}
  1746. procedure DsFreeSchemaGuidMapA(pGuidMap: PDS_SCHEMA_GUID_MAPA); stdcall;
  1747. {$EXTERNALSYM DsFreeSchemaGuidMapA}
  1748. procedure DsFreeSchemaGuidMapW(pGuidMap: PDS_SCHEMA_GUID_MAPW); stdcall;
  1749. {$EXTERNALSYM DsFreeSchemaGuidMapW}
  1750. procedure DsFreeSchemaGuidMap(pGuidMap: PDS_SCHEMA_GUID_MAP); stdcall;
  1751. {$EXTERNALSYM DsFreeSchemaGuidMap}
  1752. type
  1753. PDS_DOMAIN_CONTROLLER_INFO_1A = ^DS_DOMAIN_CONTROLLER_INFO_1A;
  1754. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_1A}
  1755. DS_DOMAIN_CONTROLLER_INFO_1A = record
  1756. NetbiosName: LPSTR; // might be NULL
  1757. DnsHostName: LPSTR; // might be NULL
  1758. SiteName: LPSTR; // might be NULL
  1759. ComputerObjectName: LPSTR; // might be NULL
  1760. ServerObjectName: LPSTR; // might be NULL
  1761. fIsPdc: BOOL;
  1762. fDsEnabled: BOOL;
  1763. end;
  1764. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_1A}
  1765. TDsDomainControllerInfo1A = DS_DOMAIN_CONTROLLER_INFO_1A;
  1766. PDsDomainControllerInfo1A = PDS_DOMAIN_CONTROLLER_INFO_1A;
  1767. PDS_DOMAIN_CONTROLLER_INFO_1W = ^DS_DOMAIN_CONTROLLER_INFO_1W;
  1768. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_1W}
  1769. DS_DOMAIN_CONTROLLER_INFO_1W = record
  1770. NetbiosName: LPWSTR; // might be NULL
  1771. DnsHostName: LPWSTR; // might be NULL
  1772. SiteName: LPWSTR; // might be NULL
  1773. ComputerObjectName: LPWSTR; // might be NULL
  1774. ServerObjectName: LPWSTR; // might be NULL
  1775. fIsPdc: BOOL;
  1776. fDsEnabled: BOOL;
  1777. end;
  1778. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_1W}
  1779. TDsDomainControllerInfo1W = DS_DOMAIN_CONTROLLER_INFO_1W;
  1780. PDsDomainControllerInfo1W = PDS_DOMAIN_CONTROLLER_INFO_1W;
  1781. PDS_DOMAIN_CONTROLLER_INFO_2A = ^DS_DOMAIN_CONTROLLER_INFO_2A;
  1782. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_2A}
  1783. DS_DOMAIN_CONTROLLER_INFO_2A = record
  1784. NetbiosName: LPSTR; // might be NULL
  1785. DnsHostName: LPSTR; // might be NULL
  1786. SiteName: LPSTR; // might be NULL
  1787. SiteObjectName: LPSTR; // might be NULL
  1788. ComputerObjectName: LPSTR; // might be NULL
  1789. ServerObjectName: LPSTR; // might be NULL
  1790. NtdsDsaObjectName: LPSTR; // might be NULL
  1791. fIsPdc: BOOL;
  1792. fDsEnabled: BOOL;
  1793. fIsGc: BOOL;
  1794. // Valid iff SiteObjectName non-NULL.
  1795. SiteObjectGuid: GUID;
  1796. // Valid iff ComputerObjectName non-NULL.
  1797. ComputerObjectGuid: GUID;
  1798. // Valid iff ServerObjectName non-NULL;
  1799. ServerObjectGuid: GUID;
  1800. // Valid iff fDsEnabled is TRUE.
  1801. NtdsDsaObjectGuid: GUID;
  1802. end;
  1803. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_2A}
  1804. TDsDomainControllerInfo2A = DS_DOMAIN_CONTROLLER_INFO_2A;
  1805. PDsDomainControllerInfo2A = PDS_DOMAIN_CONTROLLER_INFO_2A;
  1806. PDS_DOMAIN_CONTROLLER_INFO_2W = ^DS_DOMAIN_CONTROLLER_INFO_2W;
  1807. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_2W}
  1808. DS_DOMAIN_CONTROLLER_INFO_2W = record
  1809. NetbiosName: LPWSTR; // might be NULL
  1810. DnsHostName: LPWSTR; // might be NULL
  1811. SiteName: LPWSTR; // might be NULL
  1812. SiteObjectName: LPWSTR; // might be NULL
  1813. ComputerObjectName: LPWSTR; // might be NULL
  1814. ServerObjectName: LPWSTR; // might be NULL
  1815. NtdsDsaObjectName: LPWSTR; // might be NULL
  1816. fIsPdc: BOOL;
  1817. fDsEnabled: BOOL;
  1818. fIsGc: BOOL;
  1819. // Valid iff SiteObjectName non-NULL.
  1820. SiteObjectGuid: GUID;
  1821. // Valid iff ComputerObjectName non-NULL.
  1822. ComputerObjectGuid: GUID;
  1823. // Valid iff ServerObjectName non-NULL;
  1824. ServerObjectGuid: GUID;
  1825. // Valid iff fDsEnabled is TRUE.
  1826. NtdsDsaObjectGuid: GUID;
  1827. end;
  1828. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_2W}
  1829. TDsDomainControllerInfo2W = DS_DOMAIN_CONTROLLER_INFO_2W;
  1830. PDsDomainControllerInfo2W = PDS_DOMAIN_CONTROLLER_INFO_2W;
  1831. {$IFDEF UNICODE}
  1832. DS_DOMAIN_CONTROLLER_INFO_1 = DS_DOMAIN_CONTROLLER_INFO_1W;
  1833. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_1}
  1834. DS_DOMAIN_CONTROLLER_INFO_2 = DS_DOMAIN_CONTROLLER_INFO_2W;
  1835. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_2}
  1836. PDS_DOMAIN_CONTROLLER_INFO_1 = PDS_DOMAIN_CONTROLLER_INFO_1W;
  1837. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_1}
  1838. PDS_DOMAIN_CONTROLLER_INFO_2 = PDS_DOMAIN_CONTROLLER_INFO_2W;
  1839. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_2}
  1840. TDsDomainControllerInfo1 = TDsDomainControllerInfo1W;
  1841. PDsDomainControllerInfo1 = PDsDomainControllerInfo1W;
  1842. TDsDomainControllerInfo2 = TDsDomainControllerInfo2W;
  1843. PDsDomainControllerInfo2 = PDsDomainControllerInfo2W;
  1844. {$ELSE}
  1845. DS_DOMAIN_CONTROLLER_INFO_1 = DS_DOMAIN_CONTROLLER_INFO_1A;
  1846. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_1}
  1847. DS_DOMAIN_CONTROLLER_INFO_2 = DS_DOMAIN_CONTROLLER_INFO_2A;
  1848. {$EXTERNALSYM DS_DOMAIN_CONTROLLER_INFO_2}
  1849. PDS_DOMAIN_CONTROLLER_INFO_1 = PDS_DOMAIN_CONTROLLER_INFO_1A;
  1850. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_1}
  1851. PDS_DOMAIN_CONTROLLER_INFO_2 = PDS_DOMAIN_CONTROLLER_INFO_2A;
  1852. {$EXTERNALSYM PDS_DOMAIN_CONTROLLER_INFO_2}
  1853. TDsDomainControllerInfo1 = TDsDomainControllerInfo1A;
  1854. PDsDomainControllerInfo1 = PDsDomainControllerInfo1A;
  1855. TDsDomainControllerInfo2 = TDsDomainControllerInfo2A;
  1856. PDsDomainControllerInfo2 = PDsDomainControllerInfo2A;
  1857. {$ENDIF UNICODE}
  1858. // The following APIs strictly find domain controller account objects
  1859. // in the DS and return information associated with them. As such, they
  1860. // may return entries which correspond to domain controllers long since
  1861. // decommissioned, etc. and there is no guarantee that there exists a
  1862. // physical domain controller at all. Use DsGetDcName (dsgetdc.h) to find
  1863. // live domain controllers for a domain.
  1864. function DsGetDomainControllerInfoA(hDs: HANDLE; DomainName: LPCSTR;
  1865. InfoLevel: DWORD; var pcOut: DWORD; ppInfo: PPVOID): DWORD; stdcall;
  1866. {$EXTERNALSYM DsGetDomainControllerInfoA}
  1867. function DsGetDomainControllerInfoW(hDs: HANDLE; DomainName: LPCWSTR;
  1868. InfoLevel: DWORD; var pcOut: DWORD; ppInfo: PPVOID): DWORD; stdcall;
  1869. {$EXTERNALSYM DsGetDomainControllerInfoW}
  1870. function DsGetDomainControllerInfo(hDs: HANDLE; DomainName: LPCTSTR;
  1871. InfoLevel: DWORD; var pcOut: DWORD; ppInfo: PPVOID): DWORD; stdcall;
  1872. {$EXTERNALSYM DsGetDomainControllerInfo}
  1873. procedure DsFreeDomainControllerInfoA(InfoLevel: DWORD; cInfo: DWORD;
  1874. pInfo: PVOID); stdcall;
  1875. {$EXTERNALSYM DsFreeDomainControllerInfoA}
  1876. procedure DsFreeDomainControllerInfoW(InfoLevel: DWORD; cInfo: DWORD;
  1877. pInfo: PVOID); stdcall;
  1878. {$EXTERNALSYM DsFreeDomainControllerInfoW}
  1879. procedure DsFreeDomainControllerInfo(InfoLevel: DWORD; cInfo: DWORD;
  1880. pInfo: PVOID); stdcall;
  1881. {$EXTERNALSYM DsFreeDomainControllerInfo}
  1882. type
  1883. // Which task should be run?
  1884. DS_KCC_TASKID = (DS_KCC_TASKID_UPDATE_TOPOLOGY);
  1885. {$EXTERNALSYM DS_KCC_TASKID}
  1886. TDsKccTaskId = DS_KCC_TASKID;
  1887. // Don't wait for completion of the task; queue it and return.
  1888. const
  1889. DS_KCC_FLAG_ASYNC_OP = 1 shl 0;
  1890. {$EXTERNALSYM DS_KCC_FLAG_ASYNC_OP}
  1891. // Don't enqueue the task if another queued task will run soon.
  1892. DS_KCC_FLAG_DAMPED = 1 shl 1;
  1893. {$EXTERNALSYM DS_KCC_FLAG_DAMPED}
  1894. function DsReplicaConsistencyCheck(hDS: HANDLE; TaskID: DS_KCC_TASKID;
  1895. dwFlags: DWORD): DWORD; stdcall;
  1896. {$EXTERNALSYM DsReplicaConsistencyCheck}
  1897. function DsReplicaVerifyObjectsW(hDS: HANDLE; NameContext: LPCWSTR; const pUuidDsaSrc: UUID; ulOptions: ULONG): DWORD; stdcall;
  1898. {$EXTERNALSYM DsReplicaVerifyObjectsW}
  1899. function DsReplicaVerifyObjectsA(hDS: HANDLE; NameContext: LPCSTR; const pUuidDsaSrc: UUID; ulOptions: ULONG): DWORD; stdcall;
  1900. {$EXTERNALSYM DsReplicaVerifyObjectsA}
  1901. function DsReplicaVerifyObjects(hDS: HANDLE; NameContext: LPCTSTR; const pUuidDsaSrc: UUID; ulOptions: ULONG): DWORD; stdcall;
  1902. {$EXTERNALSYM DsReplicaVerifyObjects}
  1903. // Do not delete objects on DsReplicaVerifyObjects call
  1904. const
  1905. DS_EXIST_ADVISORY_MODE = $1;
  1906. {$EXTERNALSYM DS_EXIST_ADVISORY_MODE}
  1907. type
  1908. _DS_REPL_INFO_TYPE = (
  1909. DS_REPL_INFO_NEIGHBORS, // returns DS_REPL_NEIGHBORS *
  1910. DS_REPL_INFO_CURSORS_FOR_NC, // returns DS_REPL_CURSORS *
  1911. DS_REPL_INFO_METADATA_FOR_OBJ, // returns DS_REPL_OBJECT_META_DATA *
  1912. DS_REPL_INFO_KCC_DSA_CONNECT_FAILURES, // both return
  1913. DS_REPL_INFO_KCC_DSA_LINK_FAILURES, // DS_REPL_KCC_DSA_FAILURES *
  1914. DS_REPL_INFO_PENDING_OPS, // returns DS_REPL_PENDING_OPS *
  1915. ////////////////////////////////////////////////////////////////////////////
  1916. //
  1917. // The following info types are not supported by Windows 2000. Calling
  1918. // DsReplicaGetInfo() with one of the types on a Windows 2000 client or
  1919. // where hDS is bound to a Windows 2000 DC will fail with
  1920. // ERROR_NOT_SUPPORTED.
  1921. //
  1922. DS_REPL_INFO_METADATA_FOR_ATTR_VALUE, // returns DS_REPL_ATTR_VALUE_META_DATA *
  1923. DS_REPL_INFO_CURSORS_2_FOR_NC, // returns DS_REPL_CURSORS_2 *
  1924. DS_REPL_INFO_CURSORS_3_FOR_NC, // returns DS_REPL_CURSORS_3 *
  1925. DS_REPL_INFO_METADATA_2_FOR_OBJ, // returns DS_REPL_OBJECT_META_DATA_2 *
  1926. DS_REPL_INFO_METADATA_2_FOR_ATTR_VALUE, // returns DS_REPL_ATTR_VALUE_META_DATA_2 *
  1927. // <- insert new DS_REPL_INFO_* types here.
  1928. DS_REPL_INFO_TYPE_MAX);
  1929. {$EXTERNALSYM _DS_REPL_INFO_TYPE}
  1930. DS_REPL_INFO_TYPE = _DS_REPL_INFO_TYPE;
  1931. {$EXTERNALSYM DS_REPL_INFO_TYPE}
  1932. TDsReplInfoType = DS_REPL_INFO_TYPE;
  1933. // Bit values for flags argument to DsReplicaGetInfo2
  1934. const
  1935. DS_REPL_INFO_FLAG_IMPROVE_LINKED_ATTRS = $00000001;
  1936. {$EXTERNALSYM DS_REPL_INFO_FLAG_IMPROVE_LINKED_ATTRS}
  1937. // Bit values for the dwReplicaFlags field of the DS_REPL_NEIGHBOR structure.
  1938. // Bit values for the dwReplicaFlags field of the DS_REPL_NEIGHBOR structure.
  1939. // Also used for the ulReplicaFlags argument to DsReplicaModify
  1940. DS_REPL_NBR_WRITEABLE = $00000010;
  1941. {$EXTERNALSYM DS_REPL_NBR_WRITEABLE}
  1942. DS_REPL_NBR_SYNC_ON_STARTUP = $00000020;
  1943. {$EXTERNALSYM DS_REPL_NBR_SYNC_ON_STARTUP}
  1944. DS_REPL_NBR_DO_SCHEDULED_SYNCS = $00000040;
  1945. {$EXTERNALSYM DS_REPL_NBR_DO_SCHEDULED_SYNCS}
  1946. DS_REPL_NBR_USE_ASYNC_INTERSITE_TRANSPORT = $00000080;
  1947. {$EXTERNALSYM DS_REPL_NBR_USE_ASYNC_INTERSITE_TRANSPORT}
  1948. DS_REPL_NBR_TWO_WAY_SYNC = $00000200;
  1949. {$EXTERNALSYM DS_REPL_NBR_TWO_WAY_SYNC}
  1950. DS_REPL_NBR_RETURN_OBJECT_PARENTS = $00000800;
  1951. {$EXTERNALSYM DS_REPL_NBR_RETURN_OBJECT_PARENTS}
  1952. DS_REPL_NBR_FULL_SYNC_IN_PROGRESS = $00010000;
  1953. {$EXTERNALSYM DS_REPL_NBR_FULL_SYNC_IN_PROGRESS}
  1954. DS_REPL_NBR_FULL_SYNC_NEXT_PACKET = $00020000;
  1955. {$EXTERNALSYM DS_REPL_NBR_FULL_SYNC_NEXT_PACKET}
  1956. DS_REPL_NBR_NEVER_SYNCED = $00200000;
  1957. {$EXTERNALSYM DS_REPL_NBR_NEVER_SYNCED}
  1958. DS_REPL_NBR_PREEMPTED = $01000000;
  1959. {$EXTERNALSYM DS_REPL_NBR_PREEMPTED}
  1960. DS_REPL_NBR_IGNORE_CHANGE_NOTIFICATIONS = $04000000;
  1961. {$EXTERNALSYM DS_REPL_NBR_IGNORE_CHANGE_NOTIFICATIONS}
  1962. DS_REPL_NBR_DISABLE_SCHEDULED_SYNC = $08000000;
  1963. {$EXTERNALSYM DS_REPL_NBR_DISABLE_SCHEDULED_SYNC}
  1964. DS_REPL_NBR_COMPRESS_CHANGES = $10000000;
  1965. {$EXTERNALSYM DS_REPL_NBR_COMPRESS_CHANGES}
  1966. DS_REPL_NBR_NO_CHANGE_NOTIFICATIONS = $20000000;
  1967. {$EXTERNALSYM DS_REPL_NBR_NO_CHANGE_NOTIFICATIONS}
  1968. DS_REPL_NBR_PARTIAL_ATTRIBUTE_SET = $40000000;
  1969. {$EXTERNALSYM DS_REPL_NBR_PARTIAL_ATTRIBUTE_SET}
  1970. // This is the mask of replica flags that may be changed on the DsReplicaModify
  1971. // call using the ulReplicaFlags parameter. The other flags are protected
  1972. // system flags. The previous values of the system flags must be read in
  1973. // advance and merged into the ulReplicaFlags parameter unchanged.
  1974. DS_REPL_NBR_MODIFIABLE_MASK =
  1975. DS_REPL_NBR_SYNC_ON_STARTUP or
  1976. DS_REPL_NBR_DO_SCHEDULED_SYNCS or
  1977. DS_REPL_NBR_TWO_WAY_SYNC or
  1978. DS_REPL_NBR_IGNORE_CHANGE_NOTIFICATIONS or
  1979. DS_REPL_NBR_DISABLE_SCHEDULED_SYNC or
  1980. DS_REPL_NBR_COMPRESS_CHANGES or
  1981. DS_REPL_NBR_NO_CHANGE_NOTIFICATIONS;
  1982. {$EXTERNALSYM DS_REPL_NBR_MODIFIABLE_MASK}
  1983. type
  1984. _DS_REPL_NEIGHBORW = record
  1985. pszNamingContext: LPWSTR;
  1986. pszSourceDsaDN: LPWSTR;
  1987. pszSourceDsaAddress: LPWSTR;
  1988. pszAsyncIntersiteTransportDN: LPWSTR;
  1989. dwReplicaFlags: DWORD;
  1990. dwReserved: DWORD; // alignment
  1991. uuidNamingContextObjGuid: UUID;
  1992. uuidSourceDsaObjGuid: UUID;
  1993. uuidSourceDsaInvocationID: UUID;
  1994. uuidAsyncIntersiteTransportObjGuid: UUID;
  1995. usnLastObjChangeSynced: USN;
  1996. usnAttributeFilter: USN;
  1997. ftimeLastSyncSuccess: FILETIME;
  1998. ftimeLastSyncAttempt: FILETIME;
  1999. dwLastSyncResult: DWORD;
  2000. cNumConsecutiveSyncFailures: DWORD;
  2001. end;
  2002. {$EXTERNALSYM _DS_REPL_NEIGHBORW}
  2003. DS_REPL_NEIGHBORW = _DS_REPL_NEIGHBORW;
  2004. {$EXTERNALSYM DS_REPL_NEIGHBORW}
  2005. TDsReplNeighborW = DS_REPL_NEIGHBORW;
  2006. PDsReplNeighborW = ^DS_REPL_NEIGHBORW;
  2007. // Fields can be added only to the end of this structure.
  2008. _DS_REPL_NEIGHBORW_BLOB = record
  2009. oszNamingContext: DWORD;
  2010. oszSourceDsaDN: DWORD;
  2011. oszSourceDsaAddress: DWORD;
  2012. oszAsyncIntersiteTransportDN: DWORD;
  2013. dwReplicaFlags: DWORD;
  2014. dwReserved: DWORD;
  2015. uuidNamingContextObjGuid: UUID;
  2016. uuidSourceDsaObjGuid: UUID;
  2017. uuidSourceDsaInvocationID: UUID;
  2018. uuidAsyncIntersiteTransportObjGuid: UUID;
  2019. usnLastObjChangeSynced: USN;
  2020. usnAttributeFilter: USN;
  2021. ftimeLastSyncSuccess: FILETIME;
  2022. ftimeLastSyncAttempt: FILETIME;
  2023. dwLastSyncResult: DWORD;
  2024. cNumConsecutiveSyncFailures: DWORD;
  2025. end;
  2026. {$EXTERNALSYM _DS_REPL_NEIGHBORW_BLOB}
  2027. DS_REPL_NEIGHBORW_BLOB = _DS_REPL_NEIGHBORW_BLOB;
  2028. {$EXTERNALSYM DS_REPL_NEIGHBORW_BLOB}
  2029. TDsReplNeighborwBlob = DS_REPL_NEIGHBORW_BLOB;
  2030. PDsReplNeighborwBlob = ^DS_REPL_NEIGHBORW_BLOB;
  2031. _DS_REPL_NEIGHBORSW = record
  2032. cNumNeighbors: DWORD;
  2033. dwReserved: DWORD; // alignment
  2034. rgNeighbor: array [0..0] of DS_REPL_NEIGHBORW;
  2035. end;
  2036. {$EXTERNALSYM _DS_REPL_NEIGHBORSW}
  2037. DS_REPL_NEIGHBORSW = _DS_REPL_NEIGHBORSW;
  2038. {$EXTERNALSYM DS_REPL_NEIGHBORSW}
  2039. TDsReplNeighborsW = DS_REPL_NEIGHBORSW;
  2040. PDsReplNeighborsW = ^DS_REPL_NEIGHBORSW;
  2041. _DS_REPL_CURSOR = record
  2042. uuidSourceDsaInvocationID: UUID;
  2043. usnAttributeFilter: USN;
  2044. end;
  2045. {$EXTERNALSYM _DS_REPL_CURSOR}
  2046. DS_REPL_CURSOR = _DS_REPL_CURSOR;
  2047. {$EXTERNALSYM DS_REPL_CURSOR}
  2048. TDsReplCursor = DS_REPL_CURSOR;
  2049. PDsReplCursor = ^DS_REPL_CURSOR;
  2050. _DS_REPL_CURSOR_2 = record
  2051. uuidSourceDsaInvocationID: UUID;
  2052. usnAttributeFilter: USN;
  2053. ftimeLastSyncSuccess: FILETIME;
  2054. end;
  2055. {$EXTERNALSYM _DS_REPL_CURSOR_2}
  2056. DS_REPL_CURSOR_2 = _DS_REPL_CURSOR_2;
  2057. {$EXTERNALSYM DS_REPL_CURSOR_2}
  2058. TDsReplCursor2 = DS_REPL_CURSOR_2;
  2059. PDsReplCursor2 = ^DS_REPL_CURSOR_2;
  2060. _DS_REPL_CURSOR_3W = record
  2061. uuidSourceDsaInvocationID: UUID;
  2062. usnAttributeFilter: USN;
  2063. ftimeLastSyncSuccess: FILETIME;
  2064. pszSourceDsaDN: LPWSTR;
  2065. end;
  2066. {$EXTERNALSYM _DS_REPL_CURSOR_3W}
  2067. DS_REPL_CURSOR_3W = _DS_REPL_CURSOR_3W;
  2068. {$EXTERNALSYM DS_REPL_CURSOR_3W}
  2069. TDsReplCursow3W = DS_REPL_CURSOR_3W;
  2070. PDsReplCursow3W = ^DS_REPL_CURSOR_3W;
  2071. // Fields can be added only to the end of this structure.
  2072. _DS_REPL_CURSOR_BLOB = record
  2073. uuidSourceDsaInvocationID: UUID;
  2074. usnAttributeFilter: USN;
  2075. ftimeLastSyncSuccess: FILETIME;
  2076. oszSourceDsaDN: DWORD;
  2077. end;
  2078. {$EXTERNALSYM _DS_REPL_CURSOR_BLOB}
  2079. DS_REPL_CURSOR_BLOB = _DS_REPL_CURSOR_BLOB;
  2080. {$EXTERNALSYM DS_REPL_CURSOR_BLOB}
  2081. TDsReplCursorBlob = DS_REPL_CURSOR_BLOB;
  2082. PDsReplCursorBlob = ^DS_REPL_CURSOR_BLOB;
  2083. _DS_REPL_CURSORS = record
  2084. cNumCursors: DWORD;
  2085. dwReserved: DWORD; // alignment
  2086. rgCursor: array [0..0] of DS_REPL_CURSOR;
  2087. end;
  2088. {$EXTERNALSYM _DS_REPL_CURSORS}
  2089. DS_REPL_CURSORS = _DS_REPL_CURSORS;
  2090. {$EXTERNALSYM DS_REPL_CURSORS}
  2091. TDsReplCursors = DS_REPL_CURSORS;
  2092. PDsReplCursors = ^DS_REPL_CURSORS;
  2093. _DS_REPL_CURSORS_2 = record
  2094. cNumCursors: DWORD;
  2095. dwEnumerationContext: DWORD;
  2096. // keep this 8 byte aligned
  2097. rgCursor: array [0..0] of DS_REPL_CURSOR_2;
  2098. end;
  2099. {$EXTERNALSYM _DS_REPL_CURSORS_2}
  2100. DS_REPL_CURSORS_2 = _DS_REPL_CURSORS_2;
  2101. {$EXTERNALSYM DS_REPL_CURSORS_2}
  2102. TDsReplCursors2 = DS_REPL_CURSORS_2;
  2103. PDsReplCursors2 = ^DS_REPL_CURSORS_2;
  2104. _DS_REPL_CURSORS_3W = record
  2105. cNumCursors: DWORD;
  2106. dwEnumerationContext: DWORD;
  2107. // keep this 8 byte aligned
  2108. rgCursor: array [0..0] of DS_REPL_CURSOR_3W;
  2109. end;
  2110. {$EXTERNALSYM _DS_REPL_CURSORS_3W}
  2111. DS_REPL_CURSORS_3W = _DS_REPL_CURSORS_3W;
  2112. {$EXTERNALSYM DS_REPL_CURSORS_3W}
  2113. TDsReplCursors3W = DS_REPL_CURSORS_3W;
  2114. PDsReplCursors3W = ^DS_REPL_CURSORS_3W;
  2115. _DS_REPL_ATTR_META_DATA = record
  2116. pszAttributeName: LPWSTR;
  2117. dwVersion: DWORD;
  2118. ftimeLastOriginatingChange: FILETIME;
  2119. uuidLastOriginatingDsaInvocationID: UUID;
  2120. usnOriginatingChange: USN; // in the originating DSA's USN space
  2121. usnLocalChange: USN; // in the local DSA's USN space
  2122. end;
  2123. {$EXTERNALSYM _DS_REPL_ATTR_META_DATA}
  2124. DS_REPL_ATTR_META_DATA = _DS_REPL_ATTR_META_DATA;
  2125. {$EXTERNALSYM DS_REPL_ATTR_META_DATA}
  2126. TDsReplAttrMetaData = DS_REPL_ATTR_META_DATA;
  2127. PDsReplAttrMetaData = ^DS_REPL_ATTR_META_DATA;
  2128. _DS_REPL_ATTR_META_DATA_2 = record
  2129. pszAttributeName: LPWSTR;
  2130. dwVersion: DWORD;
  2131. ftimeLastOriginatingChange: FILETIME;
  2132. uuidLastOriginatingDsaInvocationID: UUID;
  2133. usnOriginatingChange: USN; // in the originating DSA's USN space
  2134. usnLocalChange: USN; // in the local DSA's USN space
  2135. pszLastOriginatingDsaDN: LPWSTR;
  2136. end;
  2137. {$EXTERNALSYM _DS_REPL_ATTR_META_DATA_2}
  2138. DS_REPL_ATTR_META_DATA_2 = _DS_REPL_ATTR_META_DATA_2;
  2139. {$EXTERNALSYM DS_REPL_ATTR_META_DATA_2}
  2140. TDsReplAttrMetaData2 = DS_REPL_ATTR_META_DATA_2;
  2141. PDsReplAttrMetaData2 = ^DS_REPL_ATTR_META_DATA_2;
  2142. // Fields can be added only to the end of this structure.
  2143. _DS_REPL_ATTR_META_DATA_BLOB = record
  2144. oszAttributeName: DWORD;
  2145. dwVersion: DWORD;
  2146. ftimeLastOriginatingChange: FILETIME;
  2147. uuidLastOriginatingDsaInvocationID: UUID;
  2148. usnOriginatingChange: USN; // in the originating DSA's USN space
  2149. usnLocalChange: USN; // in the local DSA's USN space
  2150. oszLastOriginatingDsaDN: DWORD;
  2151. end;
  2152. {$EXTERNALSYM _DS_REPL_ATTR_META_DATA_BLOB}
  2153. DS_REPL_ATTR_META_DATA_BLOB = _DS_REPL_ATTR_META_DATA_BLOB;
  2154. {$EXTERNALSYM DS_REPL_ATTR_META_DATA_BLOB}
  2155. TDsReplAttrMetaDataBlob = DS_REPL_ATTR_META_DATA_BLOB;
  2156. PDsReplAttrMetaDataBlob = ^DS_REPL_ATTR_META_DATA_BLOB;
  2157. _DS_REPL_OBJ_META_DATA = record
  2158. cNumEntries: DWORD;
  2159. dwReserved: DWORD; // alignment
  2160. rgMetaData: array [0..0] of DS_REPL_ATTR_META_DATA;
  2161. end;
  2162. {$EXTERNALSYM _DS_REPL_OBJ_META_DATA}
  2163. DS_REPL_OBJ_META_DATA = _DS_REPL_OBJ_META_DATA;
  2164. {$EXTERNALSYM DS_REPL_OBJ_META_DATA}
  2165. TDsReplObjMetaData = DS_REPL_OBJ_META_DATA;
  2166. PDsReplObjMetaData = ^DS_REPL_OBJ_META_DATA;
  2167. _DS_REPL_OBJ_META_DATA_2 = record
  2168. cNumEntries: DWORD;
  2169. dwReserved: DWORD; // alignment
  2170. rgMetaData: array [0..0] of DS_REPL_ATTR_META_DATA_2;
  2171. end;
  2172. {$EXTERNALSYM _DS_REPL_OBJ_META_DATA_2}
  2173. DS_REPL_OBJ_META_DATA_2 = _DS_REPL_OBJ_META_DATA_2;
  2174. {$EXTERNALSYM DS_REPL_OBJ_META_DATA_2}
  2175. TDsReplObjMetaData2 = DS_REPL_OBJ_META_DATA_2;
  2176. PDsReplObjMetaData2 = ^DS_REPL_OBJ_META_DATA_2;
  2177. _DS_REPL_KCC_DSA_FAILUREW = record
  2178. pszDsaDN: LPWSTR;
  2179. uuidDsaObjGuid: UUID;
  2180. ftimeFirstFailure: FILETIME;
  2181. cNumFailures: DWORD;
  2182. dwLastResult: DWORD; // Win32 error code
  2183. end;
  2184. {$EXTERNALSYM _DS_REPL_KCC_DSA_FAILUREW}
  2185. DS_REPL_KCC_DSA_FAILUREW = _DS_REPL_KCC_DSA_FAILUREW;
  2186. {$EXTERNALSYM DS_REPL_KCC_DSA_FAILUREW}
  2187. TDsReplKccDsaFailureW = DS_REPL_KCC_DSA_FAILUREW;
  2188. PDsReplKccDsaFailureW = ^DS_REPL_KCC_DSA_FAILUREW;
  2189. // Fields can be added only to the end of this structure.
  2190. _DS_REPL_KCC_DSA_FAILUREW_BLOB = record
  2191. oszDsaDN: DWORD;
  2192. uuidDsaObjGuid: UUID;
  2193. ftimeFirstFailure: FILETIME;
  2194. cNumFailures: DWORD;
  2195. dwLastResult: DWORD; // Win32 error code
  2196. end;
  2197. {$EXTERNALSYM _DS_REPL_KCC_DSA_FAILUREW_BLOB}
  2198. DS_REPL_KCC_DSA_FAILUREW_BLOB = _DS_REPL_KCC_DSA_FAILUREW_BLOB;
  2199. {$EXTERNALSYM DS_REPL_KCC_DSA_FAILUREW_BLOB}
  2200. TDsReplKccDsaFailureWBlob = DS_REPL_KCC_DSA_FAILUREW_BLOB;
  2201. PDsReplKccDsaFailureWBlob = ^DS_REPL_KCC_DSA_FAILUREW_BLOB;
  2202. _DS_REPL_KCC_DSA_FAILURESW = record
  2203. cNumEntries: DWORD;
  2204. dwReserved: DWORD; // alignment
  2205. rgDsaFailure: array [0..0] of DS_REPL_KCC_DSA_FAILUREW;
  2206. end;
  2207. {$EXTERNALSYM _DS_REPL_KCC_DSA_FAILURESW}
  2208. DS_REPL_KCC_DSA_FAILURESW = _DS_REPL_KCC_DSA_FAILURESW;
  2209. {$EXTERNALSYM DS_REPL_KCC_DSA_FAILURESW}
  2210. TDsReplKccDsaFailuresW = DS_REPL_KCC_DSA_FAILURESW;
  2211. PDsReplKccDsaFailuresW = ^DS_REPL_KCC_DSA_FAILURESW;
  2212. _DS_REPL_OP_TYPE = (
  2213. DS_REPL_OP_TYPE_SYNC,
  2214. DS_REPL_OP_TYPE_ADD,
  2215. DS_REPL_OP_TYPE_DELETE,
  2216. DS_REPL_OP_TYPE_MODIFY,
  2217. DS_REPL_OP_TYPE_UPDATE_REFS);
  2218. {$EXTERNALSYM _DS_REPL_OP_TYPE}
  2219. DS_REPL_OP_TYPE = _DS_REPL_OP_TYPE;
  2220. {$EXTERNALSYM DS_REPL_OP_TYPE}
  2221. _DS_REPL_OPW = record
  2222. ftimeEnqueued: FILETIME; // time at which the operation was enqueued
  2223. ulSerialNumber: ULONG; // ID of this sync; unique per machine per boot
  2224. ulPriority: ULONG; // > priority, > urgency
  2225. OpType: DS_REPL_OP_TYPE;
  2226. ulOptions: ULONG; // Zero or more bits specific to OpType; e.g.,
  2227. // DS_REPADD_* for DS_REPL_OP_TYPE_ADD,
  2228. // DS_REPSYNC_* for DS_REPL_OP_TYPE_SYNC, etc.
  2229. pszNamingContext: LPWSTR;
  2230. pszDsaDN: LPWSTR;
  2231. pszDsaAddress: LPWSTR;
  2232. uuidNamingContextObjGuid: UUID;
  2233. uuidDsaObjGuid: UUID;
  2234. end;
  2235. {$EXTERNALSYM _DS_REPL_OPW}
  2236. DS_REPL_OPW = _DS_REPL_OPW;
  2237. {$EXTERNALSYM DS_REPL_OPW}
  2238. TDsReplOpW = DS_REPL_OPW;
  2239. PDsReplOpW = ^DS_REPL_OPW;
  2240. // Fields can be added only to the end of this structure.
  2241. _DS_REPL_OPW_BLOB = record
  2242. ftimeEnqueued: FILETIME; // time at which the operation was enqueued
  2243. ulSerialNumber: ULONG; // ID of this sync; unique per machine per boot
  2244. ulPriority: ULONG; // > priority, > urgency
  2245. OpType: DS_REPL_OP_TYPE;
  2246. ulOptions: ULONG; // Zero or more bits specific to OpType; e.g.,
  2247. // DS_REPADD_* for DS_REPL_OP_TYPE_ADD,
  2248. // DS_REPSYNC_* for DS_REPL_OP_TYPE_SYNC, etc.
  2249. oszNamingContext: DWORD;
  2250. oszDsaDN: DWORD;
  2251. oszDsaAddress: DWORD;
  2252. uuidNamingContextObjGuid: UUID;
  2253. uuidDsaObjGuid: UUID;
  2254. end;
  2255. {$EXTERNALSYM _DS_REPL_OPW_BLOB}
  2256. DS_REPL_OPW_BLOB = _DS_REPL_OPW_BLOB;
  2257. {$EXTERNALSYM DS_REPL_OPW_BLOB}
  2258. TDsReplOpwBlob = DS_REPL_OPW_BLOB;
  2259. PDsReplOpwBlob = ^DS_REPL_OPW_BLOB;
  2260. _DS_REPL_PENDING_OPSW = record
  2261. ftimeCurrentOpStarted: FILETIME;
  2262. cNumPendingOps: DWORD;
  2263. rgPendingOp: array [0..0] of DS_REPL_OPW;
  2264. end;
  2265. {$EXTERNALSYM _DS_REPL_PENDING_OPSW}
  2266. DS_REPL_PENDING_OPSW = _DS_REPL_PENDING_OPSW;
  2267. {$EXTERNALSYM DS_REPL_PENDING_OPSW}
  2268. TDsReplPendingOpsW = DS_REPL_PENDING_OPSW;
  2269. PDsReplPendingOpsW = ^DS_REPL_PENDING_OPSW;
  2270. _DS_REPL_VALUE_META_DATA = record
  2271. pszAttributeName: LPWSTR;
  2272. pszObjectDn: LPWSTR;
  2273. cbData: DWORD;
  2274. pbData: LPBYTE;
  2275. ftimeDeleted: FILETIME;
  2276. ftimeCreated: FILETIME;
  2277. dwVersion: DWORD;
  2278. ftimeLastOriginatingChange: FILETIME;
  2279. uuidLastOriginatingDsaInvocationID: UUID;
  2280. usnOriginatingChange: USN; // in the originating DSA's USN space
  2281. usnLocalChange: USN; // in the local DSA's USN space
  2282. end;
  2283. {$EXTERNALSYM _DS_REPL_VALUE_META_DATA}
  2284. DS_REPL_VALUE_META_DATA = _DS_REPL_VALUE_META_DATA;
  2285. {$EXTERNALSYM DS_REPL_VALUE_META_DATA}
  2286. TDsReplValueMetaData = DS_REPL_VALUE_META_DATA;
  2287. PDsReplValueMetaData = ^DS_REPL_VALUE_META_DATA;
  2288. _DS_REPL_VALUE_META_DATA_2 = record
  2289. pszAttributeName: LPWSTR;
  2290. pszObjectDn: LPWSTR;
  2291. cbData: DWORD;
  2292. pbData: LPBYTE;
  2293. ftimeDeleted: FILETIME;
  2294. ftimeCreated: FILETIME;
  2295. dwVersion: DWORD;
  2296. ftimeLastOriginatingChange: FILETIME;
  2297. uuidLastOriginatingDsaInvocationID: UUID;
  2298. usnOriginatingChange: USN; // in the originating DSA's USN space
  2299. usnLocalChange: USN; // in the local DSA's USN space
  2300. pszLastOriginatingDsaDN: LPWSTR;
  2301. end;
  2302. {$EXTERNALSYM _DS_REPL_VALUE_META_DATA_2}
  2303. DS_REPL_VALUE_META_DATA_2 = _DS_REPL_VALUE_META_DATA_2;
  2304. {$EXTERNALSYM DS_REPL_VALUE_META_DATA_2}
  2305. TDsReplValueMetaData2 = DS_REPL_VALUE_META_DATA_2;
  2306. PDsReplValueMetaData2 = ^DS_REPL_VALUE_META_DATA_2;
  2307. // Fields can be added only to the end of this structure.
  2308. _DS_REPL_VALUE_META_DATA_BLOB = record
  2309. oszAttributeName: DWORD;
  2310. oszObjectDn: DWORD;
  2311. cbData: DWORD;
  2312. obData: DWORD;
  2313. ftimeDeleted: FILETIME;
  2314. ftimeCreated: FILETIME;
  2315. dwVersion: DWORD;
  2316. ftimeLastOriginatingChange: FILETIME;
  2317. uuidLastOriginatingDsaInvocationID: UUID;
  2318. usnOriginatingChange: USN; // in the originating DSA's USN space
  2319. usnLocalChange: USN; // in the local DSA's USN space
  2320. oszLastOriginatingDsaDN: DWORD;
  2321. end;
  2322. {$EXTERNALSYM _DS_REPL_VALUE_META_DATA_BLOB}
  2323. DS_REPL_VALUE_META_DATA_BLOB = _DS_REPL_VALUE_META_DATA_BLOB;
  2324. {$EXTERNALSYM DS_REPL_VALUE_META_DATA_BLOB}
  2325. TDsReplValueMetaDataBlob = DS_REPL_VALUE_META_DATA_BLOB;
  2326. PsReplValueMetaDataBlob = ^DS_REPL_VALUE_META_DATA_BLOB;
  2327. _DS_REPL_ATTR_VALUE_META_DATA = record
  2328. cNumEntries: DWORD;
  2329. dwEnumerationContext: DWORD;
  2330. rgMetaData: array [0..0] of DS_REPL_VALUE_META_DATA;
  2331. end;
  2332. {$EXTERNALSYM _DS_REPL_ATTR_VALUE_META_DATA}
  2333. DS_REPL_ATTR_VALUE_META_DATA = _DS_REPL_ATTR_VALUE_META_DATA;
  2334. {$EXTERNALSYM DS_REPL_ATTR_VALUE_META_DATA}
  2335. TDsReplAttrValueMetaData = DS_REPL_ATTR_VALUE_META_DATA;
  2336. PDsReplAttrValueMetaData = ^DS_REPL_ATTR_VALUE_META_DATA;
  2337. _DS_REPL_ATTR_VALUE_META_DATA_2 = record
  2338. cNumEntries: DWORD;
  2339. dwEnumerationContext: DWORD;
  2340. rgMetaData: array [0..0] of DS_REPL_VALUE_META_DATA_2;
  2341. end;
  2342. {$EXTERNALSYM _DS_REPL_ATTR_VALUE_META_DATA_2}
  2343. DS_REPL_ATTR_VALUE_META_DATA_2 = _DS_REPL_ATTR_VALUE_META_DATA_2;
  2344. {$EXTERNALSYM DS_REPL_ATTR_VALUE_META_DATA_2}
  2345. TDsReplAttrValueMetaData2 = DS_REPL_ATTR_VALUE_META_DATA_2;
  2346. PDsReplAttrValueMetaData2 = ^DS_REPL_ATTR_VALUE_META_DATA_2;
  2347. _DS_REPL_QUEUE_STATISTICSW = record
  2348. ftimeCurrentOpStarted: FILETIME;
  2349. cNumPendingOps: DWORD;
  2350. ftimeOldestSync: FILETIME;
  2351. ftimeOldestAdd: FILETIME;
  2352. ftimeOldestMod: FILETIME;
  2353. ftimeOldestDel: FILETIME;
  2354. ftimeOldestUpdRefs: FILETIME;
  2355. end;
  2356. {$EXTERNALSYM _DS_REPL_QUEUE_STATISTICSW}
  2357. DS_REPL_QUEUE_STATISTICSW = _DS_REPL_QUEUE_STATISTICSW;
  2358. {$EXTERNALSYM DS_REPL_QUEUE_STATISTICSW}
  2359. TDsReplQueueStatisticsW = DS_REPL_QUEUE_STATISTICSW;
  2360. PDsReplQueueStatisticsW = ^DS_REPL_QUEUE_STATISTICSW;
  2361. // Fields can be added only to the end of this structure.
  2362. DS_REPL_QUEUE_STATISTICSW_BLOB = _DS_REPL_QUEUE_STATISTICSW;
  2363. {$EXTERNALSYM DS_REPL_QUEUE_STATISTICSW_BLOB}
  2364. TDsReplQueueStatisticsWBlob = DS_REPL_QUEUE_STATISTICSW_BLOB;
  2365. function DsReplicaGetInfoW(hDS: HANDLE; InfoType: DS_REPL_INFO_TYPE;
  2366. pszObject: LPCWSTR; puuidForSourceDsaObjGuid: LPUUID; ppInfo: PPVOID): DWORD; stdcall;
  2367. {$EXTERNALSYM DsReplicaGetInfoW}
  2368. procedure DsReplicaFreeInfo(InfoType: DS_REPL_INFO_TYPE; pInfo: PVOID); stdcall;
  2369. {$EXTERNALSYM DsReplicaFreeInfo}
  2370. {$IFDEF UNICODE}
  2371. function DsReplicaGetInfo(hDS: HANDLE; InfoType: DS_REPL_INFO_TYPE;
  2372. pszObject: LPCWSTR; puuidForSourceDsaObjGuid: LPUUID; ppInfo: PPVOID): DWORD; stdcall;
  2373. {$EXTERNALSYM DsReplicaGetInfo}
  2374. // This API is not supported by Windows 2000 clients or Windows 2000 DCs.
  2375. function DsReplicaGetInfo2W(hDS: HANDLE; InfoType: DS_REPL_INFO_TYPE; pszObject: LPCWSTR; const puuidForSourceDsaObjGuid: UUID; pszAttributeName,
  2376. pszValue: LPCWSTR; dwFlags, dwEnumerationContext: DWORD; var ppInfo: LPVOID): DWORD; stdcall;
  2377. {$EXTERNALSYM DsReplicaGetInfo2W}
  2378. type
  2379. DS_REPL_NEIGHBOR = DS_REPL_NEIGHBORW;
  2380. {$EXTERNALSYM DS_REPL_NEIGHBOR}
  2381. DS_REPL_NEIGHBORS = DS_REPL_NEIGHBORSW;
  2382. {$EXTERNALSYM DS_REPL_NEIGHBORS}
  2383. DS_REPL_CURSOR_3 = DS_REPL_CURSOR_3W;
  2384. {$EXTERNALSYM DS_REPL_CURSOR_3}
  2385. DS_REPL_CURSORS_3 = DS_REPL_CURSORS_3W;
  2386. {$EXTERNALSYM DS_REPL_CURSORS_3}
  2387. DS_REPL_KCC_DSA_FAILURES = DS_REPL_KCC_DSA_FAILURESW;
  2388. {$EXTERNALSYM DS_REPL_KCC_DSA_FAILURES}
  2389. DS_REPL_KCC_DSA_FAILURE = DS_REPL_KCC_DSA_FAILUREW;
  2390. {$EXTERNALSYM DS_REPL_KCC_DSA_FAILURE}
  2391. DS_REPL_OP = DS_REPL_OPW;
  2392. {$EXTERNALSYM DS_REPL_OP}
  2393. DS_REPL_PENDING_OPS = DS_REPL_PENDING_OPSW;
  2394. {$EXTERNALSYM DS_REPL_PENDING_OPS}
  2395. TDsReplNeighbor = TDsReplNeighborW;
  2396. TDsReplNeighbors = TDsReplNeighborsW;
  2397. TDsReplCursors3 = TDsReplCursors3W;
  2398. TDsReplKccDsaFailures = TDsReplKccDsaFailuresW;
  2399. TDsReplKccDsaFailure = TDsReplKccDsaFailureW;
  2400. TDsReplOp = TDsReplOpW;
  2401. TDsReplPendingOps = TDsReplPendingOpsW;
  2402. {$ELSE}
  2403. // No ANSI equivalents currently supported.
  2404. {$ENDIF UNICODE}
  2405. function DsAddSidHistoryA(hDS: HANDLE; Flags: DWORD; SrcDomain: LPCSTR;
  2406. SrcPrincipal: LPCSTR; SrcDomainController: LPCSTR;
  2407. SrcDomainCreds: RPC_AUTH_IDENTITY_HANDLE; DstDomain: LPCSTR;
  2408. DstPrincipal: LPCSTR): DWORD; stdcall;
  2409. {$EXTERNALSYM DsAddSidHistoryA}
  2410. function DsAddSidHistoryW(hDS: HANDLE; Flags: DWORD; SrcDomain: LPCWSTR;
  2411. SrcPrincipal: LPCWSTR; SrcDomainController: LPCWSTR;
  2412. SrcDomainCreds: RPC_AUTH_IDENTITY_HANDLE; DstDomain: LPCWSTR;
  2413. DstPrincipal: LPCWSTR): DWORD; stdcall;
  2414. {$EXTERNALSYM DsAddSidHistoryW}
  2415. function DsAddSidHistory(hDS: HANDLE; Flags: DWORD; SrcDomain: LPCTSTR;
  2416. SrcPrincipal: LPCTSTR; SrcDomainController: LPCTSTR;
  2417. SrcDomainCreds: RPC_AUTH_IDENTITY_HANDLE; DstDomain: LPCTSTR;
  2418. DstPrincipal: LPCTSTR): DWORD; stdcall;
  2419. {$EXTERNALSYM DsAddSidHistory}
  2420. // The DsInheritSecurityIdentity API adds the source principal's SID and
  2421. // SID history to the destination principal's SID history and then DELETES
  2422. // THE SOURCE PRINCIPAL. Source and destination principal must be in the
  2423. // same domain.
  2424. function DsInheritSecurityIdentityA(hDS: HANDLE; Flags: DWORD;
  2425. SrcPrincipal: LPCSTR; DstPrincipal: LPCSTR): DWORD; stdcall;
  2426. {$EXTERNALSYM DsInheritSecurityIdentityA}
  2427. function DsInheritSecurityIdentityW(hDS: HANDLE; Flags: DWORD;
  2428. SrcPrincipal: LPCWSTR; DstPrincipal: LPCWSTR): DWORD; stdcall;
  2429. {$EXTERNALSYM DsInheritSecurityIdentityW}
  2430. function DsInheritSecurityIdentity(hDS: HANDLE; Flags: DWORD;
  2431. SrcPrincipal: LPCTSTR; DstPrincipal: LPCTSTR): DWORD; stdcall;
  2432. {$EXTERNALSYM DsInheritSecurityIdentity}
  2433. {ifndef MIDL_PASS
  2434. /*++
  2435. ==========================================================
  2436. NTDSAPI
  2437. DWORD
  2438. WINAPI
  2439. DsQuoteRdnValue(
  2440. IN DWORD cUnquotedRdnValueLength,
  2441. IN LPCTCH psUnquotedRdnValue,
  2442. IN OUT DWORD *pcQuotedRdnValueLength,
  2443. OUT LPTCH psQuotedRdnValue
  2444. )
  2445. ++
  2446. Description
  2447. This client call converts an RDN value into a quoted RDN value if
  2448. the RDN value contains characters that require quotes. The resultant
  2449. RDN can be submitted as part of a DN to the DS using various APIs
  2450. such as LDAP.
  2451. No quotes are added if none are needed. In this case, the
  2452. output RDN value will be the same as the input RDN value.
  2453. The RDN is quoted in accordance with the specification "Lightweight
  2454. Directory Access Protocol (v3): UTF-8 String Representation of
  2455. Distinguished Names", RFC 2253.
  2456. The input and output RDN values are *NOT* NULL terminated.
  2457. The changes made by this call can be undone by calling
  2458. DsUnquoteRdnValue().
  2459. Arguments:
  2460. cUnquotedRdnValueLength - The length of psUnquotedRdnValue in chars.
  2461. psUnquotedRdnValue - Unquoted RDN value.
  2462. pcQuotedRdnValueeLength - IN, maximum length of psQuotedRdnValue, in chars
  2463. OUT ERROR_SUCCESS, chars utilized in psQuotedRdnValue
  2464. OUT ERROR_BUFFER_OVERFLOW, chars needed in psQuotedRdnValue
  2465. psQuotedRdnValue - The resultant and perhaps quoted RDN value
  2466. Return Value:
  2467. ERROR_SUCCESS
  2468. If quotes or escapes were needed, then psQuotedRdnValue contains
  2469. the quoted, escaped version of psUnquotedRdnValue. Otherwise,
  2470. psQuotedRdnValue contains a copy of psUnquotedRdnValue. In either
  2471. case, pcQuotedRdnValueLength contains the space utilized, in chars.
  2472. ERROR_BUFFER_OVERFLOW
  2473. psQuotedRdnValueLength contains the space needed, in chars,
  2474. to hold psQuotedRdnValue.
  2475. ERROR_INVALID_PARAMETER
  2476. Invalid parameter.
  2477. ERROR_NOT_ENOUGH_MEMORY
  2478. Allocation error.
  2479. --}
  2480. function DsQuoteRdnValueA(cUnquotedRdnValueLength: DWORD;
  2481. psUnquotedRdnValue: LPCCH; var pcQuotedRdnValueLength: DWORD;
  2482. psQuotedRdnValue: LPCH): DWORD; stdcall;
  2483. {$EXTERNALSYM DsQuoteRdnValueA}
  2484. function DsQuoteRdnValueW(cUnquotedRdnValueLength: DWORD;
  2485. psUnquotedRdnValue: LPCWCH; var pcQuotedRdnValueLength: DWORD;
  2486. psQuotedRdnValue: LPWCH): DWORD; stdcall;
  2487. {$EXTERNALSYM DsQuoteRdnValueW}
  2488. function DsQuoteRdnValue(cUnquotedRdnValueLength: DWORD;
  2489. psUnquotedRdnValue: LPCTCH; var pcQuotedRdnValueLength: DWORD;
  2490. psQuotedRdnValue: LPTCH): DWORD; stdcall;
  2491. {$EXTERNALSYM DsQuoteRdnValue}
  2492. {++
  2493. ==========================================================
  2494. NTDSAPI
  2495. DWORD
  2496. WINAPI
  2497. DsUnquoteRdnValue(
  2498. IN DWORD cQuotedRdnValueLength,
  2499. IN LPCTCH psQuotedRdnValue,
  2500. IN OUT DWORD *pcUnquotedRdnValueLength,
  2501. OUT LPTCH psUnquotedRdnValue
  2502. )
  2503. Description
  2504. This client call converts a quoted RDN Value into an unquoted RDN
  2505. Value. The resultant RDN value should *NOT* be submitted as part
  2506. of a DN to the DS using various APIs such as LDAP.
  2507. When psQuotedRdnValue is quoted:
  2508. The leading and trailing quote are removed.
  2509. Whitespace before the first quote is discarded.
  2510. Whitespace trailing the last quote is discarded.
  2511. Escapes are removed and the char following the escape is kept.
  2512. The following actions are taken when psQuotedRdnValue is unquoted:
  2513. Leading whitespace is discarded.
  2514. Trailing whitespace is kept.
  2515. Escaped non-special chars return an error.
  2516. Unescaped special chars return an error.
  2517. RDN values beginning with # (ignoring leading whitespace) are
  2518. treated as a stringized BER value and converted accordingly.
  2519. Escaped hex digits (\89) are converted into a binary byte (0x89).
  2520. Escapes are removed from escaped special chars.
  2521. The following actions are always taken:
  2522. Escaped special chars are unescaped.
  2523. The input and output RDN values are not NULL terminated.
  2524. Arguments:
  2525. cQuotedRdnValueLength - The length of psQuotedRdnValue in chars.
  2526. psQuotedRdnValue - RDN value that may be quoted and may be escaped.
  2527. pcUnquotedRdnValueLength - IN, maximum length of psUnquotedRdnValue, in chars
  2528. OUT ERROR_SUCCESS, chars used in psUnquotedRdnValue
  2529. OUT ERROR_BUFFER_OVERFLOW, chars needed for psUnquotedRdnValue
  2530. psUnquotedRdnValue - The resultant unquoted RDN value.
  2531. Return Value:
  2532. ERROR_SUCCESS
  2533. psUnquotedRdnValue contains the unquoted and unescaped version
  2534. of psQuotedRdnValue. pcUnquotedRdnValueLength contains the space
  2535. used, in chars.
  2536. ERROR_BUFFER_OVERFLOW
  2537. psUnquotedRdnValueLength contains the space needed, in chars,
  2538. to hold psUnquotedRdnValue.
  2539. ERROR_INVALID_PARAMETER
  2540. Invalid parameter.
  2541. ERROR_NOT_ENOUGH_MEMORY
  2542. Allocation error.
  2543. --}
  2544. function DsUnquoteRdnValueA(cQuotedRdnValueLength: DWORD; psQuotedRdnValue: LPCCH;
  2545. var pcUnquotedRdnValueLength: DWORD; psUnquotedRdnValue: LPCH): DWORD; stdcall;
  2546. {$EXTERNALSYM DsUnquoteRdnValueA}
  2547. function DsUnquoteRdnValueW(cQuotedRdnValueLength: DWORD; psQuotedRdnValue: LPCWCH;
  2548. var pcUnquotedRdnValueLength: DWORD; psUnquotedRdnValue: LPWCH): DWORD; stdcall;
  2549. {$EXTERNALSYM DsUnquoteRdnValueW}
  2550. function DsUnquoteRdnValue(cQuotedRdnValueLength: DWORD; psQuotedRdnValue: LPCTCH;
  2551. var pcUnquotedRdnValueLength: DWORD; psUnquotedRdnValue: LPTCH): DWORD; stdcall;
  2552. {$EXTERNALSYM DsUnquoteRdnValue}
  2553. (*++
  2554. ==========================================================
  2555. NTDSAPI
  2556. DWORD
  2557. WINAPI
  2558. DsGetRdnW(
  2559. IN OUT LPCWCH *ppDN,
  2560. IN OUT DWORD *pcDN,
  2561. OUT LPCWCH *ppKey,
  2562. OUT DWORD *pcKey,
  2563. OUT LPCWCH *ppVal,
  2564. OUT DWORD *pcVal
  2565. )
  2566. Description
  2567. This client call accepts a DN with quoted RDNs and returns the address
  2568. and length, in chars, of the key and value for the first RDN in the DN.
  2569. The RDN value returned is still quoted. Use DsUnquoteRdnValue to unquote
  2570. the value for display.
  2571. This client call also returns the address and length of the rest of the
  2572. DN. A subsequent call using the returned DN address and length will
  2573. return information about the next RDN.
  2574. The following loop processes each RDN in pDN:
  2575. ccDN = wcslen(pDN)
  2576. while (ccDN) {
  2577. error = DsGetRdn(&pDN,
  2578. &ccDN,
  2579. &pKey,
  2580. &ccKey,
  2581. &pVal,
  2582. &ccVal);
  2583. if (error != ERROR_SUCCESS) {
  2584. process error;
  2585. return;
  2586. }
  2587. if (ccKey) {
  2588. process pKey;
  2589. }
  2590. if (ccVal) {
  2591. process pVal;
  2592. }
  2593. }
  2594. For example, given the DN "cn=bob,dc=com", the first call to DsGetRdnW
  2595. returns the addresses for ",dc=com", "cn", and "bob" with respective
  2596. lengths of 7, 2, and 3. A subsequent call with ",dc=com" returns "",
  2597. "dc", and "com" with respective lengths 0, 2, and 3.
  2598. Arguments:
  2599. ppDN
  2600. IN : *ppDN points to a DN
  2601. OUT: *ppDN points to the rest of the DN following the first RDN
  2602. pcDN
  2603. IN : *pcDN is the count of chars in the input *ppDN, not including
  2604. any terminating NULL
  2605. OUT: *pcDN is the count of chars in the output *ppDN, not including
  2606. any terminating NULL
  2607. ppKey
  2608. OUT: Undefined if *pcKey is 0. Otherwise, *ppKey points to the first
  2609. key in the DN
  2610. pcKey
  2611. OUT: *pcKey is the count of chars in *ppKey.
  2612. ppVal
  2613. OUT: Undefined if *pcVal is 0. Otherwise, *ppVal points to the first
  2614. value in the DN
  2615. pcVal
  2616. OUT: *pcVal is the count of chars in *ppVal
  2617. Return Value:
  2618. ERROR_SUCCESS
  2619. If *pccDN is not 0, then *ppDN points to the rest of the DN following
  2620. the first RDN. If *pccDN is 0, then *ppDN is undefined.
  2621. If *pccKey is not 0, then *ppKey points to the first key in DN. If
  2622. *pccKey is 0, then *ppKey is undefined.
  2623. If *pccVal is not 0, then *ppVal points to the first value in DN. If
  2624. *pccVal is 0, then *ppVal is undefined.
  2625. ERROR_DS_NAME_UNPARSEABLE
  2626. The first RDN in *ppDN could not be parsed. All output parameters
  2627. are undefined.
  2628. Any other error
  2629. All output parameters are undefined.
  2630. --*)
  2631. function DsGetRdnW(var ppDN: LPCWCH; var pcDN: DWORD; var ppKey: LPCWCH; var pcKey: DWORD; var ppVal: LPCWCH; var pcVal: DWORD): DWORD; stdcall;
  2632. {$EXTERNALSYM DsGetRdnW}
  2633. (*++
  2634. ==========================================================
  2635. NTDSAPI
  2636. BOOL
  2637. WINAPI
  2638. DsCrackUnquotedMangledRdnW(
  2639. IN LPCWSTR pszRDN,
  2640. IN DWORD cchRDN,
  2641. OUT OPTIONAL GUID *pGuid,
  2642. OUT OPTIONAL DS_MANGLE_FOR *peDsMangleFor
  2643. );
  2644. Description
  2645. Determine whether the given RDN is in mangled form. If so, the mangled RDN
  2646. is decoded, and the guid and mangle type are returned.
  2647. The RDN should already be in unquoted form. See DsUnquoteRdnValue.
  2648. Arguments:
  2649. pszRDN (IN) - Character string containing RDN. Termination is optional.
  2650. cchRDN (IN) - Length of RDN excluding termination, if any
  2651. pGuid (OUT, OPTIONAL) - Pointer to storage to receive decoded guid.
  2652. Only returned if RDN is mangled.
  2653. peDsMangleFor (OUT, OPTIONAL) - Pointer to storage to receive mangle type.
  2654. Only returned if RDN is mangled
  2655. Return Value:
  2656. BOOL - Whether the RDN is mangled or not
  2657. --*)
  2658. function DsCrackUnquotedMangledRdnW(pszRDN: LPCWSTR; cchRDN: DWORD; pGuid: LPGUID; peDsMangleFor: PDsMangleFor): BOOL; stdcall;
  2659. {$EXTERNALSYM DsCrackUnquotedMangledRdnW}
  2660. function DsCrackUnquotedMangledRdnA(pszRDN: LPCSTR; cchRDN: DWORD; pGuid: LPGUID; peDsMangleFor: PDsMangleFor): BOOL; stdcall;
  2661. {$EXTERNALSYM DsCrackUnquotedMangledRdnA}
  2662. function DsCrackUnquotedMangledRdn(pszRDN: LPCTSTR; cchRDN: DWORD; pGuid: LPGUID; peDsMangleFor: PDsMangleFor): BOOL; stdcall;
  2663. {$EXTERNALSYM DsCrackUnquotedMangledRdn}
  2664. (*++
  2665. ==========================================================
  2666. NTDSAPI
  2667. BOOL
  2668. WINAPI
  2669. DsIsMangledRdnValueW(
  2670. LPCWSTR pszRdn,
  2671. DWORD cRdn,
  2672. DS_MANGLE_FOR eDsMangleForDesired
  2673. );
  2674. Description
  2675. Determine if the given RDN Value is mangled, and of the given type. Note that
  2676. the key portion of an RDN should not be supplied.
  2677. The name may be quoted or unquoted. This routine tries to unquote the value. If
  2678. the unquote operation fails, the routine proceeds to attempt the unmangle.
  2679. A change was made in the default quoting behavior of DNs returned from the DS
  2680. between Windows 2000 and Windows XP. This routine transparently handles RDNs with
  2681. special characters in either form.
  2682. The routine expects the value part of the RDN.
  2683. If you have full DN, use DsIsMangledDn() below.
  2684. To check for deleted name:
  2685. DsIsMangledRdnValueW( rdn, rdnlen, DS_MANGLE_OBJECT_FOR_DELETION )
  2686. To check for a conflicted name:
  2687. DsIsMangledRdnValueW( rdn, rdnlen, DS_MANGLE_OBJECT_FOR_NAME_CONFLICT )
  2688. Arguments:
  2689. pszRdn (IN) - RDN value character string. Termination is not required and
  2690. is ignored.
  2691. cRdn (IN) - Length of RDN value in characters excluding termination
  2692. eDsMangleForDesired (IN) - Type of mangling to check for
  2693. Return Value:
  2694. BOOL - True if the Rdn is mangled and is of the required type
  2695. --*)
  2696. function DsIsMangledRdnValueW(pszRdn: LPCWSTR; cRdn: DWORD; eDsMangleForDesired: DS_MANGLE_FOR): BOOL; stdcall;
  2697. {$EXTERNALSYM DsIsMangledRdnValueW}
  2698. function DsIsMangledRdnValueA(pszRdn: LPCSTR; cRdn: DWORD; eDsMangleForDesired: DS_MANGLE_FOR): BOOL; stdcall;
  2699. {$EXTERNALSYM DsIsMangledRdnValueA}
  2700. function DsIsMangledRdnValue(pszRdn: LPCTSTR; cRdn: DWORD; eDsMangleForDesired: DS_MANGLE_FOR): BOOL; stdcall;
  2701. {$EXTERNALSYM DsIsMangledRdnValue}
  2702. (*++
  2703. ==========================================================
  2704. NTDSAPI
  2705. BOOL
  2706. WINAPI
  2707. DsIsMangledDnW(
  2708. LPCWSTR pszDn,
  2709. DS_MANGLE_FOR eDsMangleFor
  2710. );
  2711. Description
  2712. Determine if the first RDN in a quoted DN is a mangled name of given type.
  2713. The DN must be suitable for input to DsGetRdn().
  2714. To check for deleted name:
  2715. DsIsMangledDnW( dn, DS_MANGLE_OBJECT_FOR_DELETION )
  2716. To check for a conflicted name:
  2717. DsIsMangledDnW( Dn, DS_MANGLE_OBJECT_FOR_NAME_CONFLICT )
  2718. Arguments:
  2719. pszDn (IN) - Quoted Distinguished Name as returned by DS functions
  2720. eDsMangleFor (IN) - Type of mangling to check for
  2721. Return Value:
  2722. BOOL - True if first RDN is mangled and is of the given mangle type
  2723. --*)
  2724. function DsIsMangledDnA(pszDn: LPCSTR; eDsMangleFor: DS_MANGLE_FOR): BOOL; stdcall;
  2725. {$EXTERNALSYM DsIsMangledDnA}
  2726. function DsIsMangledDnW(pszDn: LPCWSTR; eDsMangleFor: DS_MANGLE_FOR): BOOL; stdcall;
  2727. {$EXTERNALSYM DsIsMangledDnW}
  2728. function DsIsMangledDn(pszDn: LPCTSTR; eDsMangleFor: DS_MANGLE_FOR): BOOL; stdcall;
  2729. {$EXTERNALSYM DsIsMangledDn}
  2730. implementation
  2731. uses
  2732. JwaWinDLLNames;
  2733. function NTDSCONN_IGNORE_SCHEDULE(_options_: DWORD): DWORD;
  2734. begin
  2735. // todo NTDSCONN_OPT_IGNORE_SCHEDULE_MASK only defined in pre-release version
  2736. Result := (_options_ and DWORD($80000000){NTDSCONN_OPT_IGNORE_SCHEDULE_MASK}) shr 31;
  2737. end;
  2738. function FRSCONN_GET_PRIORITY(_options_: DWORD): DWORD;
  2739. begin
  2740. if ((_options_ and FRSCONN_PRIORITY_MASK) shr 28) <> 0 then
  2741. Result := (_options_ and FRSCONN_PRIORITY_MASK) shr 28
  2742. else
  2743. Result := FRSCONN_MAX_PRIORITY;
  2744. end;
  2745. {$IFDEF DYNAMIC_LINK}
  2746. var
  2747. _DsBindA: Pointer;
  2748. function DsBindA;
  2749. begin
  2750. GetProcedureAddress(_DsBindA, ntdsapilib, 'DsBindA');
  2751. asm
  2752. MOV ESP, EBP
  2753. POP EBP
  2754. JMP [_DsBindA]
  2755. end;
  2756. end;
  2757. var
  2758. _DsBindW: Pointer;
  2759. function DsBindW;
  2760. begin
  2761. GetProcedureAddress(_DsBindW, ntdsapilib, 'DsBindW');
  2762. asm
  2763. MOV ESP, EBP
  2764. POP EBP
  2765. JMP [_DsBindW]
  2766. end;
  2767. end;
  2768. var
  2769. _DsBind: Pointer;
  2770. function DsBind;
  2771. begin
  2772. GetProcedureAddress(_DsBind, ntdsapilib, 'DsBind' + AWSuffix);
  2773. asm
  2774. MOV ESP, EBP
  2775. POP EBP
  2776. JMP [_DsBind]
  2777. end;
  2778. end;
  2779. var
  2780. _DsBindWithCredA: Pointer;
  2781. function DsBindWithCredA;
  2782. begin
  2783. GetProcedureAddress(_DsBindWithCredA, ntdsapilib, 'DsBindWithCredA');
  2784. asm
  2785. MOV ESP, EBP
  2786. POP EBP
  2787. JMP [_DsBindWithCredA]
  2788. end;
  2789. end;
  2790. var
  2791. _DsBindWithCredW: Pointer;
  2792. function DsBindWithCredW;
  2793. begin
  2794. GetProcedureAddress(_DsBindWithCredW, ntdsapilib, 'DsBindWithCredW');
  2795. asm
  2796. MOV ESP, EBP
  2797. POP EBP
  2798. JMP [_DsBindWithCredW]
  2799. end;
  2800. end;
  2801. var
  2802. _DsBindWithCred: Pointer;
  2803. function DsBindWithCred;
  2804. begin
  2805. GetProcedureAddress(_DsBindWithCred, ntdsapilib, 'DsBindWithCred' + AWSuffix);
  2806. asm
  2807. MOV ESP, EBP
  2808. POP EBP
  2809. JMP [_DsBindWithCred]
  2810. end;
  2811. end;
  2812. var
  2813. _DsBindWithSpnA: Pointer;
  2814. function DsBindWithSpnA;
  2815. begin
  2816. GetProcedureAddress(_DsBindWithSpnA, ntdsapilib, 'DsBindWithSpnA');
  2817. asm
  2818. MOV ESP, EBP
  2819. POP EBP
  2820. JMP [_DsBindWithSpnA]
  2821. end;
  2822. end;
  2823. var
  2824. _DsBindWithSpnW: Pointer;
  2825. function DsBindWithSpnW;
  2826. begin
  2827. GetProcedureAddress(_DsBindWithSpnW, ntdsapilib, 'DsBindWithSpnW');
  2828. asm
  2829. MOV ESP, EBP
  2830. POP EBP
  2831. JMP [_DsBindWithSpnW]
  2832. end;
  2833. end;
  2834. var
  2835. _DsBindWithSpn: Pointer;
  2836. function DsBindWithSpn;
  2837. begin
  2838. GetProcedureAddress(_DsBindWithSpn, ntdsapilib, 'DsBindWithSpn' + AWSuffix);
  2839. asm
  2840. MOV ESP, EBP
  2841. POP EBP
  2842. JMP [_DsBindWithSpn]
  2843. end;
  2844. end;
  2845. var
  2846. _DsBindWithSpnExW: Pointer;
  2847. function DsBindWithSpnExW;
  2848. begin
  2849. GetProcedureAddress(_DsBindWithSpnExW, ntdsapilib, 'DsBindWithSpnExW');
  2850. asm
  2851. MOV ESP, EBP
  2852. POP EBP
  2853. JMP [_DsBindWithSpnExW]
  2854. end;
  2855. end;
  2856. var
  2857. _DsBindWithSpnExA: Pointer;
  2858. function DsBindWithSpnExA;
  2859. begin
  2860. GetProcedureAddress(_DsBindWithSpnExA, ntdsapilib, 'DsBindWithSpnExA');
  2861. asm
  2862. MOV ESP, EBP
  2863. POP EBP
  2864. JMP [_DsBindWithSpnExA]
  2865. end;
  2866. end;
  2867. var
  2868. _DsBindWithSpnEx: Pointer;
  2869. function DsBindWithSpnEx;
  2870. begin
  2871. GetProcedureAddress(_DsBindWithSpnEx, ntdsapilib, 'DsBindWithSpnEx' + AWSuffix);
  2872. asm
  2873. MOV ESP, EBP
  2874. POP EBP
  2875. JMP [_DsBindWithSpnEx]
  2876. end;
  2877. end;
  2878. var
  2879. _DsBindToISTGW: Pointer;
  2880. function DsBindToISTGW;
  2881. begin
  2882. GetProcedureAddress(_DsBindToISTGW, ntdsapilib, 'DsBindToISTGW');
  2883. asm
  2884. MOV ESP, EBP
  2885. POP EBP
  2886. JMP [_DsBindToISTGW]
  2887. end;
  2888. end;
  2889. var
  2890. _DsBindToISTGA: Pointer;
  2891. function DsBindToISTGA;
  2892. begin
  2893. GetProcedureAddress(_DsBindToISTGA, ntdsapilib, 'DsBindToISTGA');
  2894. asm
  2895. MOV ESP, EBP
  2896. POP EBP
  2897. JMP [_DsBindToISTGA]
  2898. end;
  2899. end;
  2900. var
  2901. _DsBindToISTG: Pointer;
  2902. function DsBindToISTG;
  2903. begin
  2904. GetProcedureAddress(_DsBindToISTG, ntdsapilib, 'DsBindToISTG' + AWSuffix);
  2905. asm
  2906. MOV ESP, EBP
  2907. POP EBP
  2908. JMP [_DsBindToISTG]
  2909. end;
  2910. end;
  2911. var
  2912. _DsBindingSetTimeout: Pointer;
  2913. function DsBindingSetTimeout;
  2914. begin
  2915. GetProcedureAddress(_DsBindingSetTimeout, ntdsapilib, 'DsBindingSetTimeout');
  2916. asm
  2917. MOV ESP, EBP
  2918. POP EBP
  2919. JMP [_DsBindingSetTimeout]
  2920. end;
  2921. end;
  2922. var
  2923. _DsUnBindA: Pointer;
  2924. function DsUnBindA;
  2925. begin
  2926. GetProcedureAddress(_DsUnBindA, ntdsapilib, 'DsUnBindA');
  2927. asm
  2928. MOV ESP, EBP
  2929. POP EBP
  2930. JMP [_DsUnBindA]
  2931. end;
  2932. end;
  2933. var
  2934. _DsUnBindW: Pointer;
  2935. function DsUnBindW;
  2936. begin
  2937. GetProcedureAddress(_DsUnBindW, ntdsapilib, 'DsUnBindW');
  2938. asm
  2939. MOV ESP, EBP
  2940. POP EBP
  2941. JMP [_DsUnBindW]
  2942. end;
  2943. end;
  2944. var
  2945. _DsUnBind: Pointer;
  2946. function DsUnBind;
  2947. begin
  2948. GetProcedureAddress(_DsUnBind, ntdsapilib, 'DsUnBind' + AWSuffix);
  2949. asm
  2950. MOV ESP, EBP
  2951. POP EBP
  2952. JMP [_DsUnBind]
  2953. end;
  2954. end;
  2955. var
  2956. _DsMakePasswordCredentialsA: Pointer;
  2957. function DsMakePasswordCredentialsA;
  2958. begin
  2959. GetProcedureAddress(_DsMakePasswordCredentialsA, ntdsapilib, 'DsMakePasswordCredentialsA');
  2960. asm
  2961. MOV ESP, EBP
  2962. POP EBP
  2963. JMP [_DsMakePasswordCredentialsA]
  2964. end;
  2965. end;
  2966. var
  2967. _DsMakePasswordCredentialsW: Pointer;
  2968. function DsMakePasswordCredentialsW;
  2969. begin
  2970. GetProcedureAddress(_DsMakePasswordCredentialsW, ntdsapilib, 'DsMakePasswordCredentialsW');
  2971. asm
  2972. MOV ESP, EBP
  2973. POP EBP
  2974. JMP [_DsMakePasswordCredentialsW]
  2975. end;
  2976. end;
  2977. var
  2978. _DsMakePasswordCredentials: Pointer;
  2979. function DsMakePasswordCredentials;
  2980. begin
  2981. GetProcedureAddress(_DsMakePasswordCredentials, ntdsapilib, 'DsMakePasswordCredentials' + AWSuffix);
  2982. asm
  2983. MOV ESP, EBP
  2984. POP EBP
  2985. JMP [_DsMakePasswordCredentials]
  2986. end;
  2987. end;
  2988. var
  2989. _DsFreePasswordCredentials: Pointer;
  2990. procedure DsFreePasswordCredentials;
  2991. begin
  2992. GetProcedureAddress(_DsFreePasswordCredentials, ntdsapilib, 'DsFreePasswordCredentials');
  2993. asm
  2994. MOV ESP, EBP
  2995. POP EBP
  2996. JMP [_DsFreePasswordCredentials]
  2997. end;
  2998. end;
  2999. var
  3000. _DsFreePasswordCredentialsA: Pointer;
  3001. procedure DsFreePasswordCredentialsA;
  3002. begin
  3003. GetProcedureAddress(_DsFreePasswordCredentialsA, ntdsapilib, 'DsFreePasswordCredentials');
  3004. asm
  3005. MOV ESP, EBP
  3006. POP EBP
  3007. JMP [_DsFreePasswordCredentialsA]
  3008. end;
  3009. end;
  3010. var
  3011. _DsFreePasswordCredentialsW: Pointer;
  3012. procedure DsFreePasswordCredentialsW;
  3013. begin
  3014. GetProcedureAddress(_DsFreePasswordCredentialsW, ntdsapilib, 'DsFreePasswordCredentials');
  3015. asm
  3016. MOV ESP, EBP
  3017. POP EBP
  3018. JMP [_DsFreePasswordCredentialsW]
  3019. end;
  3020. end;
  3021. var
  3022. _DsCrackNamesA: Pointer;
  3023. function DsCrackNamesA;
  3024. begin
  3025. GetProcedureAddress(_DsCrackNamesA, ntdsapilib, 'DsCrackNamesA');
  3026. asm
  3027. MOV ESP, EBP
  3028. POP EBP
  3029. JMP [_DsCrackNamesA]
  3030. end;
  3031. end;
  3032. var
  3033. _DsCrackNamesW: Pointer;
  3034. function DsCrackNamesW;
  3035. begin
  3036. GetProcedureAddress(_DsCrackNamesW, ntdsapilib, 'DsCrackNamesW');
  3037. asm
  3038. MOV ESP, EBP
  3039. POP EBP
  3040. JMP [_DsCrackNamesW]
  3041. end;
  3042. end;
  3043. var
  3044. _DsCrackNames: Pointer;
  3045. function DsCrackNames;
  3046. begin
  3047. GetProcedureAddress(_DsCrackNames, ntdsapilib, 'DsCrackNames' + AWSuffix);
  3048. asm
  3049. MOV ESP, EBP
  3050. POP EBP
  3051. JMP [_DsCrackNames]
  3052. end;
  3053. end;
  3054. var
  3055. _DsFreeNameResultA: Pointer;
  3056. procedure DsFreeNameResultA;
  3057. begin
  3058. GetProcedureAddress(_DsFreeNameResultA, ntdsapilib, 'DsFreeNameResultA');
  3059. asm
  3060. MOV ESP, EBP
  3061. POP EBP
  3062. JMP [_DsFreeNameResultA]
  3063. end;
  3064. end;
  3065. var
  3066. _DsFreeNameResultW: Pointer;
  3067. procedure DsFreeNameResultW;
  3068. begin
  3069. GetProcedureAddress(_DsFreeNameResultW, ntdsapilib, 'DsFreeNameResultW');
  3070. asm
  3071. MOV ESP, EBP
  3072. POP EBP
  3073. JMP [_DsFreeNameResultW]
  3074. end;
  3075. end;
  3076. var
  3077. _DsFreeNameResult: Pointer;
  3078. procedure DsFreeNameResult;
  3079. begin
  3080. GetProcedureAddress(_DsFreeNameResult, ntdsapilib, 'DsFreeNameResult' + AWSuffix);
  3081. asm
  3082. MOV ESP, EBP
  3083. POP EBP
  3084. JMP [_DsFreeNameResult]
  3085. end;
  3086. end;
  3087. var
  3088. _DsMakeSpnA: Pointer;
  3089. function DsMakeSpnA;
  3090. begin
  3091. GetProcedureAddress(_DsMakeSpnA, ntdsapilib, 'DsMakeSpnA');
  3092. asm
  3093. MOV ESP, EBP
  3094. POP EBP
  3095. JMP [_DsMakeSpnA]
  3096. end;
  3097. end;
  3098. var
  3099. _DsMakeSpnW: Pointer;
  3100. function DsMakeSpnW;
  3101. begin
  3102. GetProcedureAddress(_DsMakeSpnW, ntdsapilib, 'DsMakeSpnW');
  3103. asm
  3104. MOV ESP, EBP
  3105. POP EBP
  3106. JMP [_DsMakeSpnW]
  3107. end;
  3108. end;
  3109. var
  3110. _DsMakeSpn: Pointer;
  3111. function DsMakeSpn;
  3112. begin
  3113. GetProcedureAddress(_DsMakeSpn, ntdsapilib, 'DsMakeSpn' + AWSuffix);
  3114. asm
  3115. MOV ESP, EBP
  3116. POP EBP
  3117. JMP [_DsMakeSpn]
  3118. end;
  3119. end;
  3120. var
  3121. _DsGetSpnA: Pointer;
  3122. function DsGetSpnA;
  3123. begin
  3124. GetProcedureAddress(_DsGetSpnA, ntdsapilib, 'DsGetSpnA');
  3125. asm
  3126. MOV ESP, EBP
  3127. POP EBP
  3128. JMP [_DsGetSpnA]
  3129. end;
  3130. end;
  3131. var
  3132. _DsGetSpnW: Pointer;
  3133. function DsGetSpnW;
  3134. begin
  3135. GetProcedureAddress(_DsGetSpnW, ntdsapilib, 'DsGetSpnW');
  3136. asm
  3137. MOV ESP, EBP
  3138. POP EBP
  3139. JMP [_DsGetSpnW]
  3140. end;
  3141. end;
  3142. var
  3143. _DsGetSpn: Pointer;
  3144. function DsGetSpn;
  3145. begin
  3146. GetProcedureAddress(_DsGetSpn, ntdsapilib, 'DsGetSpn' + AWSuffix);
  3147. asm
  3148. MOV ESP, EBP
  3149. POP EBP
  3150. JMP [_DsGetSpn]
  3151. end;
  3152. end;
  3153. var
  3154. _DsFreeSpnArrayA: Pointer;
  3155. procedure DsFreeSpnArrayA;
  3156. begin
  3157. GetProcedureAddress(_DsFreeSpnArrayA, ntdsapilib, 'DsFreeSpnArrayA');
  3158. asm
  3159. MOV ESP, EBP
  3160. POP EBP
  3161. JMP [_DsFreeSpnArrayA]
  3162. end;
  3163. end;
  3164. var
  3165. _DsFreeSpnArrayW: Pointer;
  3166. procedure DsFreeSpnArrayW;
  3167. begin
  3168. GetProcedureAddress(_DsFreeSpnArrayW, ntdsapilib, 'DsFreeSpnArrayW');
  3169. asm
  3170. MOV ESP, EBP
  3171. POP EBP
  3172. JMP [_DsFreeSpnArrayW]
  3173. end;
  3174. end;
  3175. var
  3176. _DsFreeSpnArray: Pointer;
  3177. procedure DsFreeSpnArray;
  3178. begin
  3179. GetProcedureAddress(_DsFreeSpnArray, ntdsapilib, 'DsFreeSpnArray' + AWSuffix);
  3180. asm
  3181. MOV ESP, EBP
  3182. POP EBP
  3183. JMP [_DsFreeSpnArray]
  3184. end;
  3185. end;
  3186. var
  3187. _DsCrackSpnA: Pointer;
  3188. function DsCrackSpnA;
  3189. begin
  3190. GetProcedureAddress(_DsCrackSpnA, ntdsapilib, 'DsCrackSpnA');
  3191. asm
  3192. MOV ESP, EBP
  3193. POP EBP
  3194. JMP [_DsCrackSpnA]
  3195. end;
  3196. end;
  3197. var
  3198. _DsCrackSpnW: Pointer;
  3199. function DsCrackSpnW;
  3200. begin
  3201. GetProcedureAddress(_DsCrackSpnW, ntdsapilib, 'DsCrackSpnW');
  3202. asm
  3203. MOV ESP, EBP
  3204. POP EBP
  3205. JMP [_DsCrackSpnW]
  3206. end;
  3207. end;
  3208. var
  3209. _DsCrackSpn: Pointer;
  3210. function DsCrackSpn;
  3211. begin
  3212. GetProcedureAddress(_DsCrackSpn, ntdsapilib, 'DsCrackSpn' + AWSuffix);
  3213. asm
  3214. MOV ESP, EBP
  3215. POP EBP
  3216. JMP [_DsCrackSpn]
  3217. end;
  3218. end;
  3219. var
  3220. _DsWriteAccountSpnA: Pointer;
  3221. function DsWriteAccountSpnA;
  3222. begin
  3223. GetProcedureAddress(_DsWriteAccountSpnA, ntdsapilib, 'DsWriteAccountSpnA');
  3224. asm
  3225. MOV ESP, EBP
  3226. POP EBP
  3227. JMP [_DsWriteAccountSpnA]
  3228. end;
  3229. end;
  3230. var
  3231. _DsWriteAccountSpnW: Pointer;
  3232. function DsWriteAccountSpnW;
  3233. begin
  3234. GetProcedureAddress(_DsWriteAccountSpnW, ntdsapilib, 'DsWriteAccountSpnW');
  3235. asm
  3236. MOV ESP, EBP
  3237. POP EBP
  3238. JMP [_DsWriteAccountSpnW]
  3239. end;
  3240. end;
  3241. var
  3242. _DsWriteAccountSpn: Pointer;
  3243. function DsWriteAccountSpn;
  3244. begin
  3245. GetProcedureAddress(_DsWriteAccountSpn, ntdsapilib, 'DsWriteAccountSpn' + AWSuffix);
  3246. asm
  3247. MOV ESP, EBP
  3248. POP EBP
  3249. JMP [_DsWriteAccountSpn]
  3250. end;
  3251. end;
  3252. var
  3253. _DsClientMakeSpnForTargetServerA: Pointer;
  3254. function DsClientMakeSpnForTargetServerA;
  3255. begin
  3256. GetProcedureAddress(_DsClientMakeSpnForTargetServerA, ntdsapilib, 'DsClientMakeSpnForTargetServerA');
  3257. asm
  3258. MOV ESP, EBP
  3259. POP EBP
  3260. JMP [_DsClientMakeSpnForTargetServerA]
  3261. end;
  3262. end;
  3263. var
  3264. _DsClientMakeSpnForTargetServerW: Pointer;
  3265. function DsClientMakeSpnForTargetServerW;
  3266. begin
  3267. GetProcedureAddress(_DsClientMakeSpnForTargetServerW, ntdsapilib, 'DsClientMakeSpnForTargetServerW');
  3268. asm
  3269. MOV ESP, EBP
  3270. POP EBP
  3271. JMP [_DsClientMakeSpnForTargetServerW]
  3272. end;
  3273. end;
  3274. var
  3275. _DsClientMakeSpnForTargetServer: Pointer;
  3276. function DsClientMakeSpnForTargetServer;
  3277. begin
  3278. GetProcedureAddress(_DsClientMakeSpnForTargetServer, ntdsapilib, 'DsClientMakeSpnForTargetServer' + AWSuffix);
  3279. asm
  3280. MOV ESP, EBP
  3281. POP EBP
  3282. JMP [_DsClientMakeSpnForTargetServer]
  3283. end;
  3284. end;
  3285. var
  3286. _DsServerRegisterSpnA: Pointer;
  3287. function DsServerRegisterSpnA;
  3288. begin
  3289. GetProcedureAddress(_DsServerRegisterSpnA, ntdsapilib, 'DsServerRegisterSpnA');
  3290. asm
  3291. MOV ESP, EBP
  3292. POP EBP
  3293. JMP [_DsServerRegisterSpnA]
  3294. end;
  3295. end;
  3296. var
  3297. _DsServerRegisterSpnW: Pointer;
  3298. function DsServerRegisterSpnW;
  3299. begin
  3300. GetProcedureAddress(_DsServerRegisterSpnW, ntdsapilib, 'DsServerRegisterSpnW');
  3301. asm
  3302. MOV ESP, EBP
  3303. POP EBP
  3304. JMP [_DsServerRegisterSpnW]
  3305. end;
  3306. end;
  3307. var
  3308. _DsServerRegisterSpn: Pointer;
  3309. function DsServerRegisterSpn;
  3310. begin
  3311. GetProcedureAddress(_DsServerRegisterSpn, ntdsapilib, 'DsServerRegisterSpn' + AWSuffix);
  3312. asm
  3313. MOV ESP, EBP
  3314. POP EBP
  3315. JMP [_DsServerRegisterSpn]
  3316. end;
  3317. end;
  3318. var
  3319. _DsReplicaSyncA: Pointer;
  3320. function DsReplicaSyncA;
  3321. begin
  3322. GetProcedureAddress(_DsReplicaSyncA, ntdsapilib, 'DsReplicaSyncA');
  3323. asm
  3324. MOV ESP, EBP
  3325. POP EBP
  3326. JMP [_DsReplicaSyncA]
  3327. end;
  3328. end;
  3329. var
  3330. _DsReplicaSyncW: Pointer;
  3331. function DsReplicaSyncW;
  3332. begin
  3333. GetProcedureAddress(_DsReplicaSyncW, ntdsapilib, 'DsReplicaSyncW');
  3334. asm
  3335. MOV ESP, EBP
  3336. POP EBP
  3337. JMP [_DsReplicaSyncW]
  3338. end;
  3339. end;
  3340. var
  3341. _DsReplicaSync: Pointer;
  3342. function DsReplicaSync;
  3343. begin
  3344. GetProcedureAddress(_DsReplicaSync, ntdsapilib, 'DsReplicaSync' + AWSuffix);
  3345. asm
  3346. MOV ESP, EBP
  3347. POP EBP
  3348. JMP [_DsReplicaSync]
  3349. end;
  3350. end;
  3351. var
  3352. _DsReplicaAddA: Pointer;
  3353. function DsReplicaAddA;
  3354. begin
  3355. GetProcedureAddress(_DsReplicaAddA, ntdsapilib, 'DsReplicaAddA');
  3356. asm
  3357. MOV ESP, EBP
  3358. POP EBP
  3359. JMP [_DsReplicaAddA]
  3360. end;
  3361. end;
  3362. var
  3363. _DsReplicaAddW: Pointer;
  3364. function DsReplicaAddW;
  3365. begin
  3366. GetProcedureAddress(_DsReplicaAddW, ntdsapilib, 'DsReplicaAddW');
  3367. asm
  3368. MOV ESP, EBP
  3369. POP EBP
  3370. JMP [_DsReplicaAddW]
  3371. end;
  3372. end;
  3373. var
  3374. _DsReplicaAdd: Pointer;
  3375. function DsReplicaAdd;
  3376. begin
  3377. GetProcedureAddress(_DsReplicaAdd, ntdsapilib, 'DsReplicaAdd' + AWSuffix);
  3378. asm
  3379. MOV ESP, EBP
  3380. POP EBP
  3381. JMP [_DsReplicaAdd]
  3382. end;
  3383. end;
  3384. var
  3385. _DsReplicaDelA: Pointer;
  3386. function DsReplicaDelA;
  3387. begin
  3388. GetProcedureAddress(_DsReplicaDelA, ntdsapilib, 'DsReplicaDelA');
  3389. asm
  3390. MOV ESP, EBP
  3391. POP EBP
  3392. JMP [_DsReplicaDelA]
  3393. end;
  3394. end;
  3395. var
  3396. _DsReplicaDelW: Pointer;
  3397. function DsReplicaDelW;
  3398. begin
  3399. GetProcedureAddress(_DsReplicaDelW, ntdsapilib, 'DsReplicaDelW');
  3400. asm
  3401. MOV ESP, EBP
  3402. POP EBP
  3403. JMP [_DsReplicaDelW]
  3404. end;
  3405. end;
  3406. var
  3407. _DsReplicaDel: Pointer;
  3408. function DsReplicaDel;
  3409. begin
  3410. GetProcedureAddress(_DsReplicaDel, ntdsapilib, 'DsReplicaDel' + AWSuffix);
  3411. asm
  3412. MOV ESP, EBP
  3413. POP EBP
  3414. JMP [_DsReplicaDel]
  3415. end;
  3416. end;
  3417. var
  3418. _DsReplicaModifyA: Pointer;
  3419. function DsReplicaModifyA;
  3420. begin
  3421. GetProcedureAddress(_DsReplicaModifyA, ntdsapilib, 'DsReplicaModifyA');
  3422. asm
  3423. MOV ESP, EBP
  3424. POP EBP
  3425. JMP [_DsReplicaModifyA]
  3426. end;
  3427. end;
  3428. var
  3429. _DsReplicaModifyW: Pointer;
  3430. function DsReplicaModifyW;
  3431. begin
  3432. GetProcedureAddress(_DsReplicaModifyW, ntdsapilib, 'DsReplicaModifyW');
  3433. asm
  3434. MOV ESP, EBP
  3435. POP EBP
  3436. JMP [_DsReplicaModifyW]
  3437. end;
  3438. end;
  3439. var
  3440. _DsReplicaModify: Pointer;
  3441. function DsReplicaModify;
  3442. begin
  3443. GetProcedureAddress(_DsReplicaModify, ntdsapilib, 'DsReplicaModify' + AWSuffix);
  3444. asm
  3445. MOV ESP, EBP
  3446. POP EBP
  3447. JMP [_DsReplicaModify]
  3448. end;
  3449. end;
  3450. var
  3451. _DsReplicaUpdateRefsA: Pointer;
  3452. function DsReplicaUpdateRefsA;
  3453. begin
  3454. GetProcedureAddress(_DsReplicaUpdateRefsA, ntdsapilib, 'DsReplicaUpdateRefsA');
  3455. asm
  3456. MOV ESP, EBP
  3457. POP EBP
  3458. JMP [_DsReplicaUpdateRefsA]
  3459. end;
  3460. end;
  3461. var
  3462. _DsReplicaUpdateRefsW: Pointer;
  3463. function DsReplicaUpdateRefsW;
  3464. begin
  3465. GetProcedureAddress(_DsReplicaUpdateRefsW, ntdsapilib, 'DsReplicaUpdateRefsW');
  3466. asm
  3467. MOV ESP, EBP
  3468. POP EBP
  3469. JMP [_DsReplicaUpdateRefsW]
  3470. end;
  3471. end;
  3472. var
  3473. _DsReplicaUpdateRefs: Pointer;
  3474. function DsReplicaUpdateRefs;
  3475. begin
  3476. GetProcedureAddress(_DsReplicaUpdateRefs, ntdsapilib, 'DsReplicaUpdateRefs' + AWSuffix);
  3477. asm
  3478. MOV ESP, EBP
  3479. POP EBP
  3480. JMP [_DsReplicaUpdateRefs]
  3481. end;
  3482. end;
  3483. var
  3484. _DsReplicaSyncAllA: Pointer;
  3485. function DsReplicaSyncAllA;
  3486. begin
  3487. GetProcedureAddress(_DsReplicaSyncAllA, ntdsapilib, 'DsReplicaSyncAllA');
  3488. asm
  3489. MOV ESP, EBP
  3490. POP EBP
  3491. JMP [_DsReplicaSyncAllA]
  3492. end;
  3493. end;
  3494. var
  3495. _DsReplicaSyncAllW: Pointer;
  3496. function DsReplicaSyncAllW;
  3497. begin
  3498. GetProcedureAddress(_DsReplicaSyncAllW, ntdsapilib, 'DsReplicaSyncAllW');
  3499. asm
  3500. MOV ESP, EBP
  3501. POP EBP
  3502. JMP [_DsReplicaSyncAllW]
  3503. end;
  3504. end;
  3505. var
  3506. _DsReplicaSyncAll: Pointer;
  3507. function DsReplicaSyncAll;
  3508. begin
  3509. GetProcedureAddress(_DsReplicaSyncAll, ntdsapilib, 'DsReplicaSyncAll' + AWSuffix);
  3510. asm
  3511. MOV ESP, EBP
  3512. POP EBP
  3513. JMP [_DsReplicaSyncAll]
  3514. end;
  3515. end;
  3516. var
  3517. _DsRemoveDsServerA: Pointer;
  3518. function DsRemoveDsServerA;
  3519. begin
  3520. GetProcedureAddress(_DsRemoveDsServerA, ntdsapilib, 'DsRemoveDsServerA');
  3521. asm
  3522. MOV ESP, EBP
  3523. POP EBP
  3524. JMP [_DsRemoveDsServerA]
  3525. end;
  3526. end;
  3527. var
  3528. _DsRemoveDsServerW: Pointer;
  3529. function DsRemoveDsServerW;
  3530. begin
  3531. GetProcedureAddress(_DsRemoveDsServerW, ntdsapilib, 'DsRemoveDsServerW');
  3532. asm
  3533. MOV ESP, EBP
  3534. POP EBP
  3535. JMP [_DsRemoveDsServerW]
  3536. end;
  3537. end;
  3538. var
  3539. _DsRemoveDsServer: Pointer;
  3540. function DsRemoveDsServer;
  3541. begin
  3542. GetProcedureAddress(_DsRemoveDsServer, ntdsapilib, 'DsRemoveDsServer' + AWSuffix);
  3543. asm
  3544. MOV ESP, EBP
  3545. POP EBP
  3546. JMP [_DsRemoveDsServer]
  3547. end;
  3548. end;
  3549. var
  3550. _DsRemoveDsDomainA: Pointer;
  3551. function DsRemoveDsDomainA;
  3552. begin
  3553. GetProcedureAddress(_DsRemoveDsDomainA, ntdsapilib, 'DsRemoveDsDomainA');
  3554. asm
  3555. MOV ESP, EBP
  3556. POP EBP
  3557. JMP [_DsRemoveDsDomainA]
  3558. end;
  3559. end;
  3560. var
  3561. _DsRemoveDsDomainW: Pointer;
  3562. function DsRemoveDsDomainW;
  3563. begin
  3564. GetProcedureAddress(_DsRemoveDsDomainW, ntdsapilib, 'DsRemoveDsDomainW');
  3565. asm
  3566. MOV ESP, EBP
  3567. POP EBP
  3568. JMP [_DsRemoveDsDomainW]
  3569. end;
  3570. end;
  3571. var
  3572. _DsRemoveDsDomain: Pointer;
  3573. function DsRemoveDsDomain;
  3574. begin
  3575. GetProcedureAddress(_DsRemoveDsDomain, ntdsapilib, 'DsRemoveDsDomain' + AWSuffix);
  3576. asm
  3577. MOV ESP, EBP
  3578. POP EBP
  3579. JMP [_DsRemoveDsDomain]
  3580. end;
  3581. end;
  3582. var
  3583. _DsListSitesA: Pointer;
  3584. function DsListSitesA;
  3585. begin
  3586. GetProcedureAddress(_DsListSitesA, ntdsapilib, 'DsListSitesA');
  3587. asm
  3588. MOV ESP, EBP
  3589. POP EBP
  3590. JMP [_DsListSitesA]
  3591. end;
  3592. end;
  3593. var
  3594. _DsListSitesW: Pointer;
  3595. function DsListSitesW;
  3596. begin
  3597. GetProcedureAddress(_DsListSitesW, ntdsapilib, 'DsListSitesW');
  3598. asm
  3599. MOV ESP, EBP
  3600. POP EBP
  3601. JMP [_DsListSitesW]
  3602. end;
  3603. end;
  3604. var
  3605. _DsListSites: Pointer;
  3606. function DsListSites;
  3607. begin
  3608. GetProcedureAddress(_DsListSites, ntdsapilib, 'DsListSites' + AWSuffix);
  3609. asm
  3610. MOV ESP, EBP
  3611. POP EBP
  3612. JMP [_DsListSites]
  3613. end;
  3614. end;
  3615. var
  3616. _DsListServersInSiteA: Pointer;
  3617. function DsListServersInSiteA;
  3618. begin
  3619. GetProcedureAddress(_DsListServersInSiteA, ntdsapilib, 'DsListServersInSiteA');
  3620. asm
  3621. MOV ESP, EBP
  3622. POP EBP
  3623. JMP [_DsListServersInSiteA]
  3624. end;
  3625. end;
  3626. var
  3627. _DsListServersInSiteW: Pointer;
  3628. function DsListServersInSiteW;
  3629. begin
  3630. GetProcedureAddress(_DsListServersInSiteW, ntdsapilib, 'DsListServersInSiteW');
  3631. asm
  3632. MOV ESP, EBP
  3633. POP EBP
  3634. JMP [_DsListServersInSiteW]
  3635. end;
  3636. end;
  3637. var
  3638. _DsListServersInSite: Pointer;
  3639. function DsListServersInSite;
  3640. begin
  3641. GetProcedureAddress(_DsListServersInSite, ntdsapilib, 'DsListServersInSite' + AWSuffix);
  3642. asm
  3643. MOV ESP, EBP
  3644. POP EBP
  3645. JMP [_DsListServersInSite]
  3646. end;
  3647. end;
  3648. var
  3649. _DsListDomainsInSiteA: Pointer;
  3650. function DsListDomainsInSiteA;
  3651. begin
  3652. GetProcedureAddress(_DsListDomainsInSiteA, ntdsapilib, 'DsListDomainsInSiteA');
  3653. asm
  3654. MOV ESP, EBP
  3655. POP EBP
  3656. JMP [_DsListDomainsInSiteA]
  3657. end;
  3658. end;
  3659. var
  3660. _DsListDomainsInSiteW: Pointer;
  3661. function DsListDomainsInSiteW;
  3662. begin
  3663. GetProcedureAddress(_DsListDomainsInSiteW, ntdsapilib, 'DsListDomainsInSiteW');
  3664. asm
  3665. MOV ESP, EBP
  3666. POP EBP
  3667. JMP [_DsListDomainsInSiteW]
  3668. end;
  3669. end;
  3670. var
  3671. _DsListDomainsInSite: Pointer;
  3672. function DsListDomainsInSite;
  3673. begin
  3674. GetProcedureAddress(_DsListDomainsInSite, ntdsapilib, 'DsListDomainsInSite' + AWSuffix);
  3675. asm
  3676. MOV ESP, EBP
  3677. POP EBP
  3678. JMP [_DsListDomainsInSite]
  3679. end;
  3680. end;
  3681. var
  3682. _DsListServersForDomainInSiteA: Pointer;
  3683. function DsListServersForDomainInSiteA;
  3684. begin
  3685. GetProcedureAddress(_DsListServersForDomainInSiteA, ntdsapilib, 'DsListServersForDomainInSiteA');
  3686. asm
  3687. MOV ESP, EBP
  3688. POP EBP
  3689. JMP [_DsListServersForDomainInSiteA]
  3690. end;
  3691. end;
  3692. var
  3693. _DsListServersForDomainInSiteW: Pointer;
  3694. function DsListServersForDomainInSiteW;
  3695. begin
  3696. GetProcedureAddress(_DsListServersForDomainInSiteW, ntdsapilib, 'DsListServersForDomainInSiteW');
  3697. asm
  3698. MOV ESP, EBP
  3699. POP EBP
  3700. JMP [_DsListServersForDomainInSiteW]
  3701. end;
  3702. end;
  3703. var
  3704. _DsListServersForDomainInSite: Pointer;
  3705. function DsListServersForDomainInSite;
  3706. begin
  3707. GetProcedureAddress(_DsListServersForDomainInSite, ntdsapilib, 'DsListServersForDomainInSite' + AWSuffix);
  3708. asm
  3709. MOV ESP, EBP
  3710. POP EBP
  3711. JMP [_DsListServersForDomainInSite]
  3712. end;
  3713. end;
  3714. var
  3715. _DsListInfoForServerA: Pointer;
  3716. function DsListInfoForServerA;
  3717. begin
  3718. GetProcedureAddress(_DsListInfoForServerA, ntdsapilib, 'DsListInfoForServerA');
  3719. asm
  3720. MOV ESP, EBP
  3721. POP EBP
  3722. JMP [_DsListInfoForServerA]
  3723. end;
  3724. end;
  3725. var
  3726. _DsListInfoForServerW: Pointer;
  3727. function DsListInfoForServerW;
  3728. begin
  3729. GetProcedureAddress(_DsListInfoForServerW, ntdsapilib, 'DsListInfoForServerW');
  3730. asm
  3731. MOV ESP, EBP
  3732. POP EBP
  3733. JMP [_DsListInfoForServerW]
  3734. end;
  3735. end;
  3736. var
  3737. _DsListInfoForServer: Pointer;
  3738. function DsListInfoForServer;
  3739. begin
  3740. GetProcedureAddress(_DsListInfoForServer, ntdsapilib, 'DsListInfoForServer' + AWSuffix);
  3741. asm
  3742. MOV ESP, EBP
  3743. POP EBP
  3744. JMP [_DsListInfoForServer]
  3745. end;
  3746. end;
  3747. var
  3748. _DsListRolesA: Pointer;
  3749. function DsListRolesA;
  3750. begin
  3751. GetProcedureAddress(_DsListRolesA, ntdsapilib, 'DsListRolesA');
  3752. asm
  3753. MOV ESP, EBP
  3754. POP EBP
  3755. JMP [_DsListRolesA]
  3756. end;
  3757. end;
  3758. var
  3759. _DsListRolesW: Pointer;
  3760. function DsListRolesW;
  3761. begin
  3762. GetProcedureAddress(_DsListRolesW, ntdsapilib, 'DsListRolesW');
  3763. asm
  3764. MOV ESP, EBP
  3765. POP EBP
  3766. JMP [_DsListRolesW]
  3767. end;
  3768. end;
  3769. var
  3770. _DsListRoles: Pointer;
  3771. function DsListRoles;
  3772. begin
  3773. GetProcedureAddress(_DsListRoles, ntdsapilib, 'DsListRoles' + AWSuffix);
  3774. asm
  3775. MOV ESP, EBP
  3776. POP EBP
  3777. JMP [_DsListRoles]
  3778. end;
  3779. end;
  3780. var
  3781. _DsQuerySitesByCostW: Pointer;
  3782. function DsQuerySitesByCostW;
  3783. begin
  3784. GetProcedureAddress(_DsQuerySitesByCostW, ntdsapilib, 'DsQuerySitesByCostW');
  3785. asm
  3786. MOV ESP, EBP
  3787. POP EBP
  3788. JMP [_DsQuerySitesByCostW]
  3789. end;
  3790. end;
  3791. var
  3792. _DsQuerySitesByCostA: Pointer;
  3793. function DsQuerySitesByCostA;
  3794. begin
  3795. GetProcedureAddress(_DsQuerySitesByCostA, ntdsapilib, 'DsQuerySitesByCostA');
  3796. asm
  3797. MOV ESP, EBP
  3798. POP EBP
  3799. JMP [_DsQuerySitesByCostA]
  3800. end;
  3801. end;
  3802. var
  3803. _DsQuerySitesByCost: Pointer;
  3804. function DsQuerySitesByCost;
  3805. begin
  3806. GetProcedureAddress(_DsQuerySitesByCost, ntdsapilib, 'DsQuerySitesByCost' + AWSuffix);
  3807. asm
  3808. MOV ESP, EBP
  3809. POP EBP
  3810. JMP [_DsQuerySitesByCost]
  3811. end;
  3812. end;
  3813. var
  3814. _DsQuerySitesFree: Pointer;
  3815. procedure DsQuerySitesFree;
  3816. begin
  3817. GetProcedureAddress(_DsQuerySitesFree, ntdsapilib, 'DsQuerySitesFree');
  3818. asm
  3819. MOV ESP, EBP
  3820. POP EBP
  3821. JMP [_DsQuerySitesFree]
  3822. end;
  3823. end;
  3824. var
  3825. _DsMapSchemaGuidsA: Pointer;
  3826. function DsMapSchemaGuidsA;
  3827. begin
  3828. GetProcedureAddress(_DsMapSchemaGuidsA, ntdsapilib, 'DsMapSchemaGuidsA');
  3829. asm
  3830. MOV ESP, EBP
  3831. POP EBP
  3832. JMP [_DsMapSchemaGuidsA]
  3833. end;
  3834. end;
  3835. var
  3836. _DsMapSchemaGuidsW: Pointer;
  3837. function DsMapSchemaGuidsW;
  3838. begin
  3839. GetProcedureAddress(_DsMapSchemaGuidsW, ntdsapilib, 'DsMapSchemaGuidsW');
  3840. asm
  3841. MOV ESP, EBP
  3842. POP EBP
  3843. JMP [_DsMapSchemaGuidsW]
  3844. end;
  3845. end;
  3846. var
  3847. _DsFreeSchemaGuidMapA: Pointer;
  3848. procedure DsFreeSchemaGuidMapA;
  3849. begin
  3850. GetProcedureAddress(_DsFreeSchemaGuidMapA, ntdsapilib, 'DsFreeSchemaGuidMapA');
  3851. asm
  3852. MOV ESP, EBP
  3853. POP EBP
  3854. JMP [_DsFreeSchemaGuidMapA]
  3855. end;
  3856. end;
  3857. var
  3858. _DsFreeSchemaGuidMapW: Pointer;
  3859. procedure DsFreeSchemaGuidMapW;
  3860. begin
  3861. GetProcedureAddress(_DsFreeSchemaGuidMapW, ntdsapilib, 'DsFreeSchemaGuidMapW');
  3862. asm
  3863. MOV ESP, EBP
  3864. POP EBP
  3865. JMP [_DsFreeSchemaGuidMapW]
  3866. end;
  3867. end;
  3868. var
  3869. _DsMapSchemaGuids: Pointer;
  3870. function DsMapSchemaGuids;
  3871. begin
  3872. GetProcedureAddress(_DsMapSchemaGuids, ntdsapilib, 'DsMapSchemaGuids' + AWSuffix);
  3873. asm
  3874. MOV ESP, EBP
  3875. POP EBP
  3876. JMP [_DsMapSchemaGuids]
  3877. end;
  3878. end;
  3879. var
  3880. _DsFreeSchemaGuidMap: Pointer;
  3881. procedure DsFreeSchemaGuidMap;
  3882. begin
  3883. GetProcedureAddress(_DsFreeSchemaGuidMap, ntdsapilib, 'DsFreeSchemaGuidMap' + AWSuffix);
  3884. asm
  3885. MOV ESP, EBP
  3886. POP EBP
  3887. JMP [_DsFreeSchemaGuidMap]
  3888. end;
  3889. end;
  3890. var
  3891. _DsGetDomainControllerInfoA: Pointer;
  3892. function DsGetDomainControllerInfoA;
  3893. begin
  3894. GetProcedureAddress(_DsGetDomainControllerInfoA, ntdsapilib, 'DsGetDomainControllerInfoA');
  3895. asm
  3896. MOV ESP, EBP
  3897. POP EBP
  3898. JMP [_DsGetDomainControllerInfoA]
  3899. end;
  3900. end;
  3901. var
  3902. _DsGetDomainControllerInfoW: Pointer;
  3903. function DsGetDomainControllerInfoW;
  3904. begin
  3905. GetProcedureAddress(_DsGetDomainControllerInfoW, ntdsapilib, 'DsGetDomainControllerInfoW');
  3906. asm
  3907. MOV ESP, EBP
  3908. POP EBP
  3909. JMP [_DsGetDomainControllerInfoW]
  3910. end;
  3911. end;
  3912. var
  3913. _DsGetDomainControllerInfo: Pointer;
  3914. function DsGetDomainControllerInfo;
  3915. begin
  3916. GetProcedureAddress(_DsGetDomainControllerInfo, ntdsapilib, 'DsGetDomainControllerInfo' + AWSuffix);
  3917. asm
  3918. MOV ESP, EBP
  3919. POP EBP
  3920. JMP [_DsGetDomainControllerInfo]
  3921. end;
  3922. end;
  3923. var
  3924. _DsFreeDomainControllerInfoA: Pointer;
  3925. procedure DsFreeDomainControllerInfoA;
  3926. begin
  3927. GetProcedureAddress(_DsFreeDomainControllerInfoA, ntdsapilib, 'DsFreeDomainControllerInfoA');
  3928. asm
  3929. MOV ESP, EBP
  3930. POP EBP
  3931. JMP [_DsFreeDomainControllerInfoA]
  3932. end;
  3933. end;
  3934. var
  3935. _DsFreeDomainControllerInfoW: Pointer;
  3936. procedure DsFreeDomainControllerInfoW;
  3937. begin
  3938. GetProcedureAddress(_DsFreeDomainControllerInfoW, ntdsapilib, 'DsFreeDomainControllerInfoW');
  3939. asm
  3940. MOV ESP, EBP
  3941. POP EBP
  3942. JMP [_DsFreeDomainControllerInfoW]
  3943. end;
  3944. end;
  3945. var
  3946. _DsFreeDomainControllerInfo: Pointer;
  3947. procedure DsFreeDomainControllerInfo;
  3948. begin
  3949. GetProcedureAddress(_DsFreeDomainControllerInfo, ntdsapilib, 'DsFreeDomainControllerInfo' + AWSuffix);
  3950. asm
  3951. MOV ESP, EBP
  3952. POP EBP
  3953. JMP [_DsFreeDomainControllerInfo]
  3954. end;
  3955. end;
  3956. var
  3957. _DsReplicaConsistencyCheck: Pointer;
  3958. function DsReplicaConsistencyCheck;
  3959. begin
  3960. GetProcedureAddress(_DsReplicaConsistencyCheck, ntdsapilib, 'DsReplicaConsistencyCheck');
  3961. asm
  3962. MOV ESP, EBP
  3963. POP EBP
  3964. JMP [_DsReplicaConsistencyCheck]
  3965. end;
  3966. end;
  3967. var
  3968. _DsReplicaVerifyObjectsW: Pointer;
  3969. function DsReplicaVerifyObjectsW;
  3970. begin
  3971. GetProcedureAddress(_DsReplicaVerifyObjectsW, ntdsapilib, 'DsReplicaVerifyObjectsW');
  3972. asm
  3973. MOV ESP, EBP
  3974. POP EBP
  3975. JMP [_DsReplicaVerifyObjectsW]
  3976. end;
  3977. end;
  3978. var
  3979. _DsReplicaVerifyObjectsA: Pointer;
  3980. function DsReplicaVerifyObjectsA;
  3981. begin
  3982. GetProcedureAddress(_DsReplicaVerifyObjectsA, ntdsapilib, 'DsReplicaVerifyObjectsA');
  3983. asm
  3984. MOV ESP, EBP
  3985. POP EBP
  3986. JMP [_DsReplicaVerifyObjectsA]
  3987. end;
  3988. end;
  3989. var
  3990. _DsReplicaVerifyObjects: Pointer;
  3991. function DsReplicaVerifyObjects;
  3992. begin
  3993. GetProcedureAddress(_DsReplicaVerifyObjects, ntdsapilib, 'DsReplicaVerifyObjects' + AWSuffix);
  3994. asm
  3995. MOV ESP, EBP
  3996. POP EBP
  3997. JMP [_DsReplicaVerifyObjects]
  3998. end;
  3999. end;
  4000. var
  4001. _DsReplicaGetInfoW: Pointer;
  4002. function DsReplicaGetInfoW;
  4003. begin
  4004. GetProcedureAddress(_DsReplicaGetInfoW, ntdsapilib, 'DsReplicaGetInfoW');
  4005. asm
  4006. MOV ESP, EBP
  4007. POP EBP
  4008. JMP [_DsReplicaGetInfoW]
  4009. end;
  4010. end;
  4011. var
  4012. _DsReplicaFreeInfo: Pointer;
  4013. procedure DsReplicaFreeInfo;
  4014. begin
  4015. GetProcedureAddress(_DsReplicaFreeInfo, ntdsapilib, 'DsReplicaFreeInfo');
  4016. asm
  4017. MOV ESP, EBP
  4018. POP EBP
  4019. JMP [_DsReplicaFreeInfo]
  4020. end;
  4021. end;
  4022. {$IFDEF UNICODE}
  4023. var
  4024. _DsReplicaGetInfo: Pointer;
  4025. function DsReplicaGetInfo;
  4026. begin
  4027. GetProcedureAddress(_DsReplicaGetInfo, ntdsapilib, 'DsReplicaGetInfoW');
  4028. asm
  4029. MOV ESP, EBP
  4030. POP EBP
  4031. JMP [_DsReplicaGetInfo]
  4032. end;
  4033. end;
  4034. var
  4035. _DsReplicaGetInfo2W: Pointer;
  4036. function DsReplicaGetInfo2W;
  4037. begin
  4038. GetProcedureAddress(_DsReplicaGetInfo2W, ntdsapilib, 'DsReplicaGetInfo2W');
  4039. asm
  4040. MOV ESP, EBP
  4041. POP EBP
  4042. JMP [_DsReplicaGetInfo2W]
  4043. end;
  4044. end;
  4045. {$ENDIF UNICODE}
  4046. var
  4047. _DsAddSidHistoryA: Pointer;
  4048. function DsAddSidHistoryA;
  4049. begin
  4050. GetProcedureAddress(_DsAddSidHistoryA, ntdsapilib, 'DsAddSidHistoryA');
  4051. asm
  4052. MOV ESP, EBP
  4053. POP EBP
  4054. JMP [_DsAddSidHistoryA]
  4055. end;
  4056. end;
  4057. var
  4058. _DsAddSidHistoryW: Pointer;
  4059. function DsAddSidHistoryW;
  4060. begin
  4061. GetProcedureAddress(_DsAddSidHistoryW, ntdsapilib, 'DsAddSidHistoryW');
  4062. asm
  4063. MOV ESP, EBP
  4064. POP EBP
  4065. JMP [_DsAddSidHistoryW]
  4066. end;
  4067. end;
  4068. var
  4069. _DsAddSidHistory: Pointer;
  4070. function DsAddSidHistory;
  4071. begin
  4072. GetProcedureAddress(_DsAddSidHistory, ntdsapilib, 'DsAddSidHistory' + AWSuffix);
  4073. asm
  4074. MOV ESP, EBP
  4075. POP EBP
  4076. JMP [_DsAddSidHistory]
  4077. end;
  4078. end;
  4079. var
  4080. _DsInheritSecurityIdentityA: Pointer;
  4081. function DsInheritSecurityIdentityA;
  4082. begin
  4083. GetProcedureAddress(_DsInheritSecurityIdentityA, ntdsapilib, 'DsInheritSecurityIdentityA');
  4084. asm
  4085. MOV ESP, EBP
  4086. POP EBP
  4087. JMP [_DsInheritSecurityIdentityA]
  4088. end;
  4089. end;
  4090. var
  4091. _DsInheritSecurityIdentityW: Pointer;
  4092. function DsInheritSecurityIdentityW;
  4093. begin
  4094. GetProcedureAddress(_DsInheritSecurityIdentityW, ntdsapilib, 'DsInheritSecurityIdentityW');
  4095. asm
  4096. MOV ESP, EBP
  4097. POP EBP
  4098. JMP [_DsInheritSecurityIdentityW]
  4099. end;
  4100. end;
  4101. var
  4102. _DsInheritSecurityIdentity: Pointer;
  4103. function DsInheritSecurityIdentity;
  4104. begin
  4105. GetProcedureAddress(_DsInheritSecurityIdentity, ntdsapilib, 'DsInheritSecurityIdentity' + AWSuffix);
  4106. asm
  4107. MOV ESP, EBP
  4108. POP EBP
  4109. JMP [_DsInheritSecurityIdentity]
  4110. end;
  4111. end;
  4112. var
  4113. _DsQuoteRdnValueA: Pointer;
  4114. function DsQuoteRdnValueA;
  4115. begin
  4116. GetProcedureAddress(_DsQuoteRdnValueA, ntdsapilib, 'DsQuoteRdnValueA');
  4117. asm
  4118. MOV ESP, EBP
  4119. POP EBP
  4120. JMP [_DsQuoteRdnValueA]
  4121. end;
  4122. end;
  4123. var
  4124. _DsQuoteRdnValueW: Pointer;
  4125. function DsQuoteRdnValueW;
  4126. begin
  4127. GetProcedureAddress(_DsQuoteRdnValueW, ntdsapilib, 'DsQuoteRdnValueW');
  4128. asm
  4129. MOV ESP, EBP
  4130. POP EBP
  4131. JMP [_DsQuoteRdnValueW]
  4132. end;
  4133. end;
  4134. var
  4135. _DsQuoteRdnValue: Pointer;
  4136. function DsQuoteRdnValue;
  4137. begin
  4138. GetProcedureAddress(_DsQuoteRdnValue, ntdsapilib, 'DsQuoteRdnValue' + AWSuffix);
  4139. asm
  4140. MOV ESP, EBP
  4141. POP EBP
  4142. JMP [_DsQuoteRdnValue]
  4143. end;
  4144. end;
  4145. var
  4146. _DsUnquoteRdnValueA: Pointer;
  4147. function DsUnquoteRdnValueA;
  4148. begin
  4149. GetProcedureAddress(_DsUnquoteRdnValueA, ntdsapilib, 'DsUnquoteRdnValueA');
  4150. asm
  4151. MOV ESP, EBP
  4152. POP EBP
  4153. JMP [_DsUnquoteRdnValueA]
  4154. end;
  4155. end;
  4156. var
  4157. _DsUnquoteRdnValueW: Pointer;
  4158. function DsUnquoteRdnValueW;
  4159. begin
  4160. GetProcedureAddress(_DsUnquoteRdnValueW, ntdsapilib, 'DsUnquoteRdnValueW');
  4161. asm
  4162. MOV ESP, EBP
  4163. POP EBP
  4164. JMP [_DsUnquoteRdnValueW]
  4165. end;
  4166. end;
  4167. var
  4168. _DsUnquoteRdnValue: Pointer;
  4169. function DsUnquoteRdnValue;
  4170. begin
  4171. GetProcedureAddress(_DsUnquoteRdnValue, ntdsapilib, 'DsUnquoteRdnValue' + AWSuffix);
  4172. asm
  4173. MOV ESP, EBP
  4174. POP EBP
  4175. JMP [_DsUnquoteRdnValue]
  4176. end;
  4177. end;
  4178. var
  4179. _DsGetRdnW: Pointer;
  4180. function DsGetRdnW;
  4181. begin
  4182. GetProcedureAddress(_DsGetRdnW, ntdsapilib, 'DsGetRdnW');
  4183. asm
  4184. MOV ESP, EBP
  4185. POP EBP
  4186. JMP [_DsGetRdnW]
  4187. end;
  4188. end;
  4189. var
  4190. _DsCrackUnquotedMangledRdnW: Pointer;
  4191. function DsCrackUnquotedMangledRdnW;
  4192. begin
  4193. GetProcedureAddress(_DsCrackUnquotedMangledRdnW, ntdsapilib, 'DsCrackUnquotedMangledRdnW');
  4194. asm
  4195. MOV ESP, EBP
  4196. POP EBP
  4197. JMP [_DsCrackUnquotedMangledRdnW]
  4198. end;
  4199. end;
  4200. var
  4201. _DsCrackUnquotedMangledRdnA: Pointer;
  4202. function DsCrackUnquotedMangledRdnA;
  4203. begin
  4204. GetProcedureAddress(_DsCrackUnquotedMangledRdnA, ntdsapilib, 'DsCrackUnquotedMangledRdnA');
  4205. asm
  4206. MOV ESP, EBP
  4207. POP EBP
  4208. JMP [_DsCrackUnquotedMangledRdnA]
  4209. end;
  4210. end;
  4211. var
  4212. _DsCrackUnquotedMangledRdn: Pointer;
  4213. function DsCrackUnquotedMangledRdn;
  4214. begin
  4215. GetProcedureAddress(_DsCrackUnquotedMangledRdn, ntdsapilib, 'DsCrackUnquotedMangledRdn' + AWSuffix);
  4216. asm
  4217. MOV ESP, EBP
  4218. POP EBP
  4219. JMP [_DsCrackUnquotedMangledRdn]
  4220. end;
  4221. end;
  4222. var
  4223. _DsIsMangledRdnValueW: Pointer;
  4224. function DsIsMangledRdnValueW;
  4225. begin
  4226. GetProcedureAddress(_DsIsMangledRdnValueW, ntdsapilib, 'DsIsMangledRdnValueW');
  4227. asm
  4228. MOV ESP, EBP
  4229. POP EBP
  4230. JMP [_DsIsMangledRdnValueW]
  4231. end;
  4232. end;
  4233. var
  4234. _DsIsMangledRdnValueA: Pointer;
  4235. function DsIsMangledRdnValueA;
  4236. begin
  4237. GetProcedureAddress(_DsIsMangledRdnValueA, ntdsapilib, 'DsIsMangledRdnValueA');
  4238. asm
  4239. MOV ESP, EBP
  4240. POP EBP
  4241. JMP [_DsIsMangledRdnValueA]
  4242. end;
  4243. end;
  4244. var
  4245. _DsIsMangledRdnValue: Pointer;
  4246. function DsIsMangledRdnValue;
  4247. begin
  4248. GetProcedureAddress(_DsIsMangledRdnValue, ntdsapilib, 'DsIsMangledRdnValue' + AWSuffix);
  4249. asm
  4250. MOV ESP, EBP
  4251. POP EBP
  4252. JMP [_DsIsMangledRdnValue]
  4253. end;
  4254. end;
  4255. var
  4256. _DsIsMangledDnA: Pointer;
  4257. function DsIsMangledDnA;
  4258. begin
  4259. GetProcedureAddress(_DsIsMangledDnA, ntdsapilib, 'DsIsMangledDnA');
  4260. asm
  4261. MOV ESP, EBP
  4262. POP EBP
  4263. JMP [_DsIsMangledDnA]
  4264. end;
  4265. end;
  4266. var
  4267. _DsIsMangledDnW: Pointer;
  4268. function DsIsMangledDnW;
  4269. begin
  4270. GetProcedureAddress(_DsIsMangledDnW, ntdsapilib, 'DsIsMangledDnW');
  4271. asm
  4272. MOV ESP, EBP
  4273. POP EBP
  4274. JMP [_DsIsMangledDnW]
  4275. end;
  4276. end;
  4277. var
  4278. _DsIsMangledDn: Pointer;
  4279. function DsIsMangledDn;
  4280. begin
  4281. GetProcedureAddress(_DsIsMangledDn, ntdsapilib, 'DsIsMangledDn' + AWSuffix);
  4282. asm
  4283. MOV ESP, EBP
  4284. POP EBP
  4285. JMP [_DsIsMangledDn]
  4286. end;
  4287. end;
  4288. {$ELSE}
  4289. function DsBindA; external ntdsapilib name 'DsBindA';
  4290. function DsBindW; external ntdsapilib name 'DsBindW';
  4291. function DsBind; external ntdsapilib name 'DsBind' + AWSuffix;
  4292. function DsBindWithCredA; external ntdsapilib name 'DsBindWithCredA';
  4293. function DsBindWithCredW; external ntdsapilib name 'DsBindWithCredW';
  4294. function DsBindWithCred; external ntdsapilib name 'DsBindWithCred' + AWSuffix;
  4295. function DsBindWithSpnA; external ntdsapilib name 'DsBindWithSpnA';
  4296. function DsBindWithSpnW; external ntdsapilib name 'DsBindWithSpnW';
  4297. function DsBindWithSpn; external ntdsapilib name 'DsBindWithSpn' + AWSuffix;
  4298. function DsBindWithSpnExW; external ntdsapilib name 'DsBindWithSpnExW';
  4299. function DsBindWithSpnExA; external ntdsapilib name 'DsBindWithSpnExA';
  4300. function DsBindWithSpnEx; external ntdsapilib name 'DsBindWithSpnEx' + AWSuffix;
  4301. function DsBindToISTGW; external ntdsapilib name 'DsBindToISTGW';
  4302. function DsBindToISTGA; external ntdsapilib name 'DsBindToISTGA';
  4303. function DsBindToISTG; external ntdsapilib name 'DsBindToISTG' + AWSuffix;
  4304. function DsBindingSetTimeout; external ntdsapilib name 'DsBindingSetTimeout';
  4305. function DsUnBindA; external ntdsapilib name 'DsUnBindA';
  4306. function DsUnBindW; external ntdsapilib name 'DsUnBindW';
  4307. function DsUnBind; external ntdsapilib name 'DsUnBind' + AWSuffix;
  4308. function DsMakePasswordCredentialsA; external ntdsapilib name 'DsMakePasswordCredentialsA';
  4309. function DsMakePasswordCredentialsW; external ntdsapilib name 'DsMakePasswordCredentialsW';
  4310. function DsMakePasswordCredentials; external ntdsapilib name 'DsMakePasswordCredentials' + AWSuffix;
  4311. procedure DsFreePasswordCredentials; external ntdsapilib name 'DsFreePasswordCredentials';
  4312. procedure DsFreePasswordCredentialsA; external ntdsapilib name 'DsFreePasswordCredentials';
  4313. procedure DsFreePasswordCredentialsW; external ntdsapilib name 'DsFreePasswordCredentials';
  4314. function DsCrackNamesA; external ntdsapilib name 'DsCrackNamesA';
  4315. function DsCrackNamesW; external ntdsapilib name 'DsCrackNamesW';
  4316. function DsCrackNames; external ntdsapilib name 'DsCrackNames' + AWSuffix;
  4317. procedure DsFreeNameResultA; external ntdsapilib name 'DsFreeNameResultA';
  4318. procedure DsFreeNameResultW; external ntdsapilib name 'DsFreeNameResultW';
  4319. procedure DsFreeNameResult; external ntdsapilib name 'DsFreeNameResult' + AWSuffix;
  4320. function DsMakeSpnA; external ntdsapilib name 'DsMakeSpnA';
  4321. function DsMakeSpnW; external ntdsapilib name 'DsMakeSpnW';
  4322. function DsMakeSpn; external ntdsapilib name 'DsMakeSpn' + AWSuffix;
  4323. function DsGetSpnA; external ntdsapilib name 'DsGetSpnA';
  4324. function DsGetSpnW; external ntdsapilib name 'DsGetSpnW';
  4325. function DsGetSpn; external ntdsapilib name 'DsGetSpn' + AWSuffix;
  4326. procedure DsFreeSpnArrayA; external ntdsapilib name 'DsFreeSpnArrayA';
  4327. procedure DsFreeSpnArrayW; external ntdsapilib name 'DsFreeSpnArrayW';
  4328. procedure DsFreeSpnArray; external ntdsapilib name 'DsFreeSpnArray' + AWSuffix;
  4329. function DsCrackSpnA; external ntdsapilib name 'DsCrackSpnA';
  4330. function DsCrackSpnW; external ntdsapilib name 'DsCrackSpnW';
  4331. function DsCrackSpn; external ntdsapilib name 'DsCrackSpn' + AWSuffix;
  4332. function DsWriteAccountSpnA; external ntdsapilib name 'DsWriteAccountSpnA';
  4333. function DsWriteAccountSpnW; external ntdsapilib name 'DsWriteAccountSpnW';
  4334. function DsWriteAccountSpn; external ntdsapilib name 'DsWriteAccountSpn' + AWSuffix;
  4335. function DsClientMakeSpnForTargetServerA; external ntdsapilib name 'DsClientMakeSpnForTargetServerA';
  4336. function DsClientMakeSpnForTargetServerW; external ntdsapilib name 'DsClientMakeSpnForTargetServerW';
  4337. function DsClientMakeSpnForTargetServer; external ntdsapilib name 'DsClientMakeSpnForTargetServer' + AWSuffix;
  4338. function DsServerRegisterSpnA; external ntdsapilib name 'DsServerRegisterSpnA';
  4339. function DsServerRegisterSpnW; external ntdsapilib name 'DsServerRegisterSpnW';
  4340. function DsServerRegisterSpn; external ntdsapilib name 'DsServerRegisterSpn' + AWSuffix;
  4341. function DsReplicaSyncA; external ntdsapilib name 'DsReplicaSyncA';
  4342. function DsReplicaSyncW; external ntdsapilib name 'DsReplicaSyncW';
  4343. function DsReplicaSync; external ntdsapilib name 'DsReplicaSync' + AWSuffix;
  4344. function DsReplicaAddA; external ntdsapilib name 'DsReplicaAddA';
  4345. function DsReplicaAddW; external ntdsapilib name 'DsReplicaAddW';
  4346. function DsReplicaAdd; external ntdsapilib name 'DsReplicaAdd' + AWSuffix;
  4347. function DsReplicaDelA; external ntdsapilib name 'DsReplicaDelA';
  4348. function DsReplicaDelW; external ntdsapilib name 'DsReplicaDelW';
  4349. function DsReplicaDel; external ntdsapilib name 'DsReplicaDel' + AWSuffix;
  4350. function DsReplicaModifyA; external ntdsapilib name 'DsReplicaModifyA';
  4351. function DsReplicaModifyW; external ntdsapilib name 'DsReplicaModifyW';
  4352. function DsReplicaModify; external ntdsapilib name 'DsReplicaModify' + AWSuffix;
  4353. function DsReplicaUpdateRefsA; external ntdsapilib name 'DsReplicaUpdateRefsA';
  4354. function DsReplicaUpdateRefsW; external ntdsapilib name 'DsReplicaUpdateRefsW';
  4355. function DsReplicaUpdateRefs; external ntdsapilib name 'DsReplicaUpdateRefs' + AWSuffix;
  4356. function DsReplicaSyncAllA; external ntdsapilib name 'DsReplicaSyncAllA';
  4357. function DsReplicaSyncAllW; external ntdsapilib name 'DsReplicaSyncAllW';
  4358. function DsReplicaSyncAll; external ntdsapilib name 'DsReplicaSyncAll' + AWSuffix;
  4359. function DsRemoveDsServerA; external ntdsapilib name 'DsRemoveDsServerA';
  4360. function DsRemoveDsServerW; external ntdsapilib name 'DsRemoveDsServerW';
  4361. function DsRemoveDsServer; external ntdsapilib name 'DsRemoveDsServer' + AWSuffix;
  4362. function DsRemoveDsDomainA; external ntdsapilib name 'DsRemoveDsDomainA';
  4363. function DsRemoveDsDomainW; external ntdsapilib name 'DsRemoveDsDomainW';
  4364. function DsRemoveDsDomain; external ntdsapilib name 'DsRemoveDsDomain' + AWSuffix;
  4365. function DsListSitesA; external ntdsapilib name 'DsListSitesA';
  4366. function DsListSitesW; external ntdsapilib name 'DsListSitesW';
  4367. function DsListSites; external ntdsapilib name 'DsListSites' + AWSuffix;
  4368. function DsListServersInSiteA; external ntdsapilib name 'DsListServersInSiteA';
  4369. function DsListServersInSiteW; external ntdsapilib name 'DsListServersInSiteW';
  4370. function DsListServersInSite; external ntdsapilib name 'DsListServersInSite' + AWSuffix;
  4371. function DsListDomainsInSiteA; external ntdsapilib name 'DsListDomainsInSiteA';
  4372. function DsListDomainsInSiteW; external ntdsapilib name 'DsListDomainsInSiteW';
  4373. function DsListDomainsInSite; external ntdsapilib name 'DsListDomainsInSite' + AWSuffix;
  4374. function DsListServersForDomainInSiteA; external ntdsapilib name 'DsListServersForDomainInSiteA';
  4375. function DsListServersForDomainInSiteW; external ntdsapilib name 'DsListServersForDomainInSiteW';
  4376. function DsListServersForDomainInSite; external ntdsapilib name 'DsListServersForDomainInSite' + AWSuffix;
  4377. function DsListInfoForServerA; external ntdsapilib name 'DsListInfoForServerA';
  4378. function DsListInfoForServerW; external ntdsapilib name 'DsListInfoForServerW';
  4379. function DsListInfoForServer; external ntdsapilib name 'DsListInfoForServer' + AWSuffix;
  4380. function DsListRolesA; external ntdsapilib name 'DsListRolesA';
  4381. function DsListRolesW; external ntdsapilib name 'DsListRolesW';
  4382. function DsListRoles; external ntdsapilib name 'DsListRoles' + AWSuffix;
  4383. function DsQuerySitesByCostW; external ntdsapilib name 'DsQuerySitesByCostW';
  4384. function DsQuerySitesByCostA; external ntdsapilib name 'DsQuerySitesByCostA';
  4385. function DsQuerySitesByCost; external ntdsapilib name 'DsQuerySitesByCost' + AWSuffix;
  4386. procedure DsQuerySitesFree; external ntdsapilib name 'DsQuerySitesFree';
  4387. function DsMapSchemaGuidsA; external ntdsapilib name 'DsMapSchemaGuidsA';
  4388. function DsMapSchemaGuidsW; external ntdsapilib name 'DsMapSchemaGuidsW';
  4389. procedure DsFreeSchemaGuidMapA; external ntdsapilib name 'DsFreeSchemaGuidMapA';
  4390. procedure DsFreeSchemaGuidMapW; external ntdsapilib name 'DsFreeSchemaGuidMapW';
  4391. function DsMapSchemaGuids; external ntdsapilib name 'DsMapSchemaGuids' + AWSuffix;
  4392. procedure DsFreeSchemaGuidMap; external ntdsapilib name 'DsFreeSchemaGuidMap' + AWSuffix;
  4393. function DsGetDomainControllerInfoA; external ntdsapilib name 'DsGetDomainControllerInfoA';
  4394. function DsGetDomainControllerInfoW; external ntdsapilib name 'DsGetDomainControllerInfoW';
  4395. function DsGetDomainControllerInfo; external ntdsapilib name 'DsGetDomainControllerInfo' + AWSuffix;
  4396. procedure DsFreeDomainControllerInfoA; external ntdsapilib name 'DsFreeDomainControllerInfoA';
  4397. procedure DsFreeDomainControllerInfoW; external ntdsapilib name 'DsFreeDomainControllerInfoW';
  4398. procedure DsFreeDomainControllerInfo; external ntdsapilib name 'DsFreeDomainControllerInfo' + AWSuffix;
  4399. function DsReplicaConsistencyCheck; external ntdsapilib name 'DsReplicaConsistencyCheck';
  4400. function DsReplicaVerifyObjectsW; external ntdsapilib name 'DsReplicaVerifyObjectsW';
  4401. function DsReplicaVerifyObjectsA; external ntdsapilib name 'DsReplicaVerifyObjectsA';
  4402. function DsReplicaVerifyObjects; external ntdsapilib name 'DsReplicaVerifyObjects' + AWSuffix;
  4403. function DsReplicaGetInfoW; external ntdsapilib name 'DsReplicaGetInfoW';
  4404. procedure DsReplicaFreeInfo; external ntdsapilib name 'DsReplicaFreeInfo';
  4405. {$IFDEF UNICODE}
  4406. function DsReplicaGetInfo; external ntdsapilib name 'DsReplicaGetInfoW';
  4407. function DsReplicaGetInfo2W; external ntdsapilib name 'DsReplicaGetInfo2W';
  4408. {$ENDIF UNICODE}
  4409. function DsAddSidHistoryA; external ntdsapilib name 'DsAddSidHistoryA';
  4410. function DsAddSidHistoryW; external ntdsapilib name 'DsAddSidHistoryW';
  4411. function DsAddSidHistory; external ntdsapilib name 'DsAddSidHistory' + AWSuffix;
  4412. function DsInheritSecurityIdentityA; external ntdsapilib name 'DsInheritSecurityIdentityA';
  4413. function DsInheritSecurityIdentityW; external ntdsapilib name 'DsInheritSecurityIdentityW';
  4414. function DsInheritSecurityIdentity; external ntdsapilib name 'DsInheritSecurityIdentity' + AWSuffix;
  4415. function DsQuoteRdnValueA; external ntdsapilib name 'DsQuoteRdnValueA';
  4416. function DsQuoteRdnValueW; external ntdsapilib name 'DsQuoteRdnValueW';
  4417. function DsQuoteRdnValue; external ntdsapilib name 'DsQuoteRdnValue' + AWSuffix;
  4418. function DsUnquoteRdnValueA; external ntdsapilib name 'DsUnquoteRdnValueA';
  4419. function DsUnquoteRdnValueW; external ntdsapilib name 'DsUnquoteRdnValueW';
  4420. function DsUnquoteRdnValue; external ntdsapilib name 'DsUnquoteRdnValue' + AWSuffix;
  4421. function DsGetRdnW; external ntdsapilib name 'DsGetRdnW';
  4422. function DsCrackUnquotedMangledRdnW; external ntdsapilib name 'DsCrackUnquotedMangledRdnW';
  4423. function DsCrackUnquotedMangledRdnA; external ntdsapilib name 'DsCrackUnquotedMangledRdnA';
  4424. function DsCrackUnquotedMangledRdn; external ntdsapilib name 'DsCrackUnquotedMangledRdn' + AWSuffix;
  4425. function DsIsMangledRdnValueW; external ntdsapilib name 'DsIsMangledRdnValueW';
  4426. function DsIsMangledRdnValueA; external ntdsapilib name 'DsIsMangledRdnValueA';
  4427. function DsIsMangledRdnValue; external ntdsapilib name 'DsIsMangledRdnValue' + AWSuffix;
  4428. function DsIsMangledDnA; external ntdsapilib name 'DsIsMangledDnA';
  4429. function DsIsMangledDnW; external ntdsapilib name 'DsIsMangledDnW';
  4430. function DsIsMangledDn; external ntdsapilib name 'DsIsMangledDn' + AWSuffix;
  4431. {$ENDIF DYNAMIC_LINK}
  4432. end.