Re: user and group information using Win32 API [Rational Purify results]

Just to add to that, when I run Rational Purify against my application the
major error I get is:

FIM: Freeing invalid memory in RtlFreeHeap
Location of free attempt
RtlFreeHeap [ntdll.dll]
GetFileSecurityW [advapi32.dll]
GetFileSecurityA [advapi32.dll]
GetFileSecurityA [ADVAPI32.dll]

(There are 192657 occurences. So I guess this happens every time the
GetFileSecurity function is called.)
The way I am using this function in my code is: const char* filePath = nameWithPath_.c_str(); BOOL retCode = FALSE; DWORD sdSize = 4096; DWORD sdSizeRequired = 0; PSID ownerSid = 0; PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR) sdBuff;retCode = GetFileSecurity(filePath, OWNER_SECURITY_INFORMATION, sd, sdSize, &sdSizeRequired);Is the error pointed by Purify really a memory leak that I should beworrying about? How can I get rid of the same?Thanks,Siddharth."Siddharth Aggarwal" wrote in messagenews:xxxxx@ntdev...>> Hi,>> I have written a WIN32 application to get all the users that own files ona> WINNT system using GetFileSecurity() + GetSecurityDescriptorOwner() APIs.> Then I get all the groups that this user belongs to using the API> NetUserGetLocalGroups() for each of the users obtained in the first step.>> The output which I am displaying as 4 columns namely userId, username,> groupId and groupName. For fileowners of type "group", the groupId and> groupName are kept the same as userId and userName respectively. Now my> confusion arises because there are a lot of users with the same name(domain> + username) with a different Sid. e.g. PERSISTENT\siddharth_aggarwal. has6> entries below (even though there are only 2 unique groups that this user> belongs to: namely - BUILTIN\Administrators and BUILTIN\Users). So I amnot> really sure why we have a different Sid for 2 user whosedomainname+userName> is the same. i.e. Can the same user have 2 different Sid values?>> Any pointers in this regard would be really helpful.>> Thanks,> Siddharth>> Attached output> ===========>> UserID User Name> GroupID GroupName>> S-1-1-0 \Everyone> S-1-1-0 \Everyone>> S-1-5-21-1443438718-1192457488-1338337383-1015> PERSISTENT\siddharth_aggarwalS-1-5-32-544> BUILTIN\Administrators>> S-1-5-21-1443438718-1192457488-1338337383-1015> PERSISTENT\siddharth_aggarwalS-1-5-32-545> BUILTIN\Users>> S-1-5-21-1443438718-1192457488-1338337383-1318> PERSISTENT\siddharth_aggarwalS-1-5-32-544> BUILTIN\Administrators>> S-1-5-21-1443438718-1192457488-1338337383-1318> PERSISTENT\siddharth_aggarwalS-1-5-32-545> BUILTIN\Users>> S-1-5-21-1887572776-755525552-1806196434-1006SANDIEGO\persist> S-1-5-32-545 BUILTIN\Users>> S-1-5-21-1887572776-755525552-1806196434-500SANDIEGO\Administrator> S-1-5-21-1887572776-755525552-1806196434-1007 SANDIEGO\ORA_DBA>> S-1-5-21-1887572776-755525552-1806196434-500SANDIEGO\Administrator> S-1-5-21-1887572776-755525552-1806196434-1010 SANDIEGO\se>> S-1-5-21-1887572776-755525552-1806196434-500SANDIEGO\Administrator> S-1-5-32-544 BUILTIN\Administrators>> S-1-5-21-2000478354-299502267-725345543-2889PERSISTENT\siddharth_aggarwal> S-1-5-32-544 BUILTIN\Administrators>> S-1-5-21-2000478354-299502267-725345543-2889PERSISTENT\siddharth_aggarwal> S-1-5-32-545 BUILTIN\Users>> S-1-5-32-544 BUILTIN\Administrators> S-1-5-32-544 BUILTIN\Administrators>>>>>>