unit frmMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, XPMan;
type
TForm1 =
class(TForm)
Label1: TLabel;
edtADsPath: TEdit;
sbADsPath: TSpeedButton;
btnGet: TButton;
procedure btnGetClick(Sender: TObject);
procedure sbADsPathClick(Sender: TObject);
private
{ Private-Deklarationen }
procedure ClearAllItems;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses ActiveX, dlgADs, adsEnum, adsErr, adsHlp, AdsTLB;
{$R *.dfm}
procedure TForm1.sbADsPathClick(Sender: TObject);
begin
ADsTreeDialog := TADsTreeDialog.Create(Self);
try
ADsTreeDialog.ShowModal;
if ADsTreeDialog.ModalResult = mrOK
then
begin
edtADsPath.Text := ADsTreeDialog.ADsPath;
ClearAllItems;
end;
finally
ADsTreeDialog.Free;
end;
end;
procedure TForm1.btnGetClick(Sender: TObject);
var
ADSystemInfo : TADSystemInfo;
ADsObject : IADs;
iSecurityDescriptor : IADsSecurityDescriptor;
iAccessControlList : IADsAccessControlList;
iAccessControlEntry : IADsAccessControlEntry;
Enum : IEnumVariant;
varArr : OleVariant;
lNumElements : ULONG;
hr : HRESULT;
begin
if edtADsPath.Text = '
'
then
begin
ADSystemInfo := TADSystemInfo.Create(Self);
try
edtADsPath.Text := '
LDAP://' + ADSystemInfo.UserName;
finally
ADSystemInfo.FreeOnRelease;
end;
if SUCCEEDED(ADsGetObject(edtADsPath.Text, IADs, ADsObject))
then
begin
if SUCCEEDED(IDispatch(ADsObject.Get('
nTSecurityDescriptor')).QueryInterface(IADsSecurityDescriptor, iSecurityDescriptor))
then
begin
if SUCCEEDED(IDispatch(iSecurityDescriptor.DiscretionaryAcl).QueryInterface(IADsAccessControlList, iAccessControlList))
then
begin
hr := IDispatch(iAccessControlList._NewEnum).QueryInterface(IEnumVariant, Enum);
while SUCCEEDED(hr)
do
begin
hr := ADsEnumerateNext(Enum, 1, varArr, lNumElements);
if (lNumElements <= 0)
then Break;
if SUCCEEDED(IDispatch(varArr).QueryInterface(IADsAccessControlEntry, iAccessControlEntry))
then
begin
end;
end;
end;
end;
end;
end;
end;
procedure TForm1.ClearAllItems;
begin
end;
end.