function GetDFSList(DomainName :
String; DFs : TStrings) : Boolean;
var
rN :
String;
NSContainer : IADsContainer;
Enum : IEnumVariant;
hr : integer;
varArr : OleVariant;
lNumElements : ULONG;
item : IADs;
begin
rN := '
LDAP://CN=Dfs-Configuration,CN=System,';
rN := rN + Copy(DomainName, POS('
DC=', DomainName), Length(DomainName));
NSContainer :=
nil;
ADsGetObject(rN, IADsContainer, NSContainer);
Enum :=
nil;
hr := ADsBuildEnumerator(NSContainer, Enum);
while SUCCEEDED(hr)
do
begin
hr := ADsEnumerateNext(Enum, 1, varArr, lNumElements);
if (lNumElements<=0)
then Break;
IDispatch(varArr).QueryInterface(IADs, item);
DFs.Add(Copy(item.
Name, 4, Length(item.
Name)));
end;
Result := DFs.Count -1 > -1;
end;