program tsttrust;

{ Testprogram for the NwFile unit / NwTP 0.6, (c) 1993,1995 R.Spronk }

uses nwMisc,nwBindry,nwFile;

Var DirHandle:Byte;
    DirPath:String;
    SequenceNumber:Byte;
    TrusteeInfo: TtrusteeInformation;

    t:Byte;
    ObjName:string;
    ObjType:word;
    ObjId:Longint;
    DH,EffRights:byte;
begin

DirHandle:=0;
DirPath:='SYS:SYSTEM';

IF NOT AllocTemporaryDirHandle(31,0,DirPath,DH,EffRights)
 then writeln('allocTempDH returned err: ',nwfile.result);

{ Before scanning the trustees, you might add or delete a 
  trustee for testing purposes.

ObjId:=$06000006;
IF NOT DeleteTrustee(0,DirPath,ObjId)
 then writeln('DeleteTrustee returned error: ',nwFile.result);

ObjId:=$06000006;
IF NOT SetTrustee(0,DirPath,ObjId,TA_READ or TA_SEARCH)
 then writeln('SetTrustee returned error: ',nwFile.result); }

SequenceNumber:=0;
While ScanEntryForTrustees(DirHandle,DirPath,
                           SequenceNumber,TrusteeInfo)
 do begin
      with TrusteeInfo
       do begin
          for t:=1 to TrusteeInfo.NumberOfTrustees
           do begin
              write(HexStr(TrusteeID[t],8));
              GetBinderyObjectName(TrusteeId[t],ObjName,oBjType);
              writeln(' ',HexStr(TrusteeRights[t],4),' ',ObjName);
              end;

          end;
      end;

if nwFile.result<>$9C { no more trustees }
 then writeln('ScanEntryForTrustees returned error :',nwfile.result);

DeallocateDirHandle(DH);

readln;
end.
