IAccount bug

delphi package - easy access to security apis
Post Reply
pascal jankowski
Posts: 2
Joined: Tue May 09, 2006 8:56 am

IAccount bug

Post 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
madshi
Site Admin
Posts: 10528
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Thanks for the report, I'll have a look at this.
madshi
Site Admin
Posts: 10528
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Could you please try this one?

http://madshi.net/madCollectionBeta.exe

It should fix the problem, I think.
pascal jankowski
Posts: 2
Joined: Tue May 09, 2006 8:56 am

Post by pascal jankowski »

it is good, thank you for this version. :D
Post Reply