Can there be any bug in GetSecurityInfo ?
- From: Akın ÖCal <AknCal@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 3 Jul 2007 02:06:03 -0700
I am doing everything for allocating and freeing sid structure but it always
gives leakages please check the code :
BOOL GetAll (char* sFileOrFolderName )
{
DWORD dwRtnCode = 0;
HANDLE hFile;
char* pSidOwner = (char * ) malloc (MAX_SID_SIZE);
ZeroMemory(pSidOwner,MAX_SID_SIZE);
hFile = CreateFile(
sFileOrFolderName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
return FALSE;
}
dwRtnCode = GetSecurityInfo(
hFile,
SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION,
(PSID *)(pSidOwner),
NULL,
NULL,
NULL,
NULL);
if( !pSidOwner )
{
CloseHandle(hFile);
return FALSE;
}
free(pSidOwner);
CloseHandle(hFile);
return TRUE ;
}
int _tmain(int argc, _TCHAR* argv[])
{
while(1)
{
if(!GetAll("d:\\aa.txt"))
{
printf("\nFailed");
}
Sleep(1000);
}
return 0;
}
.
- Follow-Ups:
- RE: Can there be any bug in GetSecurityInfo ?
- From: lelteto
- RE: Can there be any bug in GetSecurityInfo ?
- Prev by Date: Re: Failed to decrypt
- Next by Date: acquiring access token for "LocalService" from application started by the admin for SHGetFolderPath()
- Previous by thread: Domain Controller SubAuthentication Filter
- Next by thread: RE: Can there be any bug in GetSecurityInfo ?
- Index(es):
Relevant Pages
|