/packages/winunits-jedi/src/jwantdsapi.pas

https://github.com/slibre/freepascal · Pascal · 5268 lines · 2848 code · 687 blank · 1733 comment · 1 complexity · 2fa5e6104dbfdbaeef6739aea0fb8c06 MD5 · raw file

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