jwantdsapi.pas 171 KB

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