home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 April
/
Chip_2002-04_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
NT.ZIP
/
Demos
/
FileSecurity
/
Unit1.pas
< prev
Wrap
Pascal/Delphi Source File
|
2002-01-21
|
2KB
|
73 lines
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, NTFileSecurity, StdCtrls, Spin, IdGlobal;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label5: TLabel;
SpinEdit1: TSpinEdit;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
OpenDialog1: TOpenDialog;
Label6: TLabel;
NTFileSecurity1: TNTFileSecurity;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var AC:Integer;
begin
If OpenDialog1.Execute Then
Begin
Label6.Caption:=ExtractFileName(OpenDialog1.FileName);
NTFileSecurity1.FileName:=OpenDialog1.FileName;
AC:=NTFileSecurity1.GetAceCount;
MessageBeep(MB_ICONINFORMATION);
Application.MessageBox(PChar('There are ' + IntToStr(AC) + ' ACE(s) In The ACL For This File...'),'NTTools',mb_OK + mb_ICONINFORMATION);
SpinEdit1.MaxValue:=AC-1;
Edit1.Text:=IntToStr(AC);
End;
end;
procedure TForm1.Button2Click(Sender: TObject);
var Ptr:Pointer;
begin
Ptr:=NTFileSecurity1.GetFileAce(SpinEdit1.Value);
If Ptr=nil Then
Begin
MessageBeep(MB_ICONEXCLAMATION);
Application.MessageBox('Unable to retrieve ACE for file !','NTTools',mb_OK + mb_ICONEXCLAMATION);
Exit;
End;
Edit2.Text:=NTFileSecurity1.OwnerName;
Edit3.Text:=NTFileSecurity1.DomainName;
Edit4.Text:=IntToBin(NTFileSecurity1.AccessMask);
end;
end.