Page 1 of 1

IAccount bug

Posted: Tue May 09, 2006 9:10 am
by pascal jankowski
Hello Mathias,

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   
Observe the behavior of the following processes. (lsass.exe and project1.exe)

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);
Best regard

Posted: Wed May 10, 2006 7:08 am
by madshi
Thanks for the report, I'll have a look at this.

Posted: Fri May 26, 2006 10:18 am
by madshi
Could you please try this one?

http://madshi.net/madCollectionBeta.exe

It should fix the problem, I think.

Posted: Mon May 29, 2006 12:56 pm
by pascal jankowski
it is good, thank you for this version. :D