I try to uses madSecurity Unit with IAccount interface to know ACE'owner for all file on my disk (a lot of).
I obtain each time a overflow of memory
Code and execute this example
Code: Select all
for I := 0 to 1000000 do
with FileSecurity('c:\myTestFile.ext') do
s := Items[I].Account.domain; //or user
I think that you do not release the token correctly...
-----------
My temporary solution not to encounter this problem.
Code: Select all
function LookupAccountBySid(Sid: PSID): String;
var
Name,
Domain : String;
NameSize,
DomainSize : DWORD;
Use : Cardinal;
begin
NameSize := 0;
DomainSize := 0;
LookupAccountSid(nil, Sid, nil, NameSize, nil, DomainSize, Use);
SetLength(Name, NameSize);
SetLength(Domain, DomainSize);
LookupAccountSid(nil, Sid, PChar(Name), NameSize, PChar(Domain), DomainSize, Use);
Result := PChar(Domain) + '/' + PChar(Name);
end;
Code: Select all
LookupAccountBySid(FileSecurity('c:\myTestFile.ext').Items[I].Account.PSid);