Getting Folder Permissions
From: Hari Shankar (Hari.Shankar_at_in.bosch.com)
Date: 03/22/04
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: Network Drive mapping ( Programmatically )"
- Previous message: Mohamoss: "RE: DB Sample Code Request"
- Next in thread: Willy Denoyette [MVP]: "Re: Getting Folder Permissions"
- Reply: Willy Denoyette [MVP]: "Re: Getting Folder Permissions"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Mar 2004 18:33:05 +0530
Hello folks
I have to get the NTFS permissions of a folder programmatically. I am using
C#. Pls hint me if i am missing anything in the code below.
private void GetSecurityPermission(string strShareName)
{
NERR eRetVal = NERR.ERROR_FAILURE;
EXPLICIT_ACCESS oEA;
IntPtr pZero = IntPtr.Zero; IntPtr pSidOwner = pZero; IntPtr pSidGroup =
pZero; IntPtr pSACL = pZero; IntPtr pDACL = pZero;IntPtr psd = pZero;
int nExplicitEntriesCount = 0;bool bDaclPresent;IntPtr ppDacl;bool
bDaclDefaulted;
///Get the DACL information of strShareName using GetNamedSecurityInfo()
API.
/// SE_FILE_OBJECT constant says that the named securable object is a
file or folder
eRetVal = CDecls.GetNamedSecurityInfo(strShareName,
SE_OBJECT_TYPE.SE_FILE_OBJECT,
SECURITY_INFORMATION.DACL_SECURITY_INFORMATION, out pSidOwner,
out pSidGroup, out pDACL, out pSACL, out psd);
if (eRetVal == NERR.ERROR_SUCCESS)
{
eRetVal = CDecls.GetExplicitEntriesFromAcl(pDACL, ref
nExplicitEntriesCount, out oEA);
if(eRetVal == NERR.ERROR_SUCCESS)
{
for (int nIndex = 0; nIndex < nExplicitEntriesCount; nIndex++)
{
}
}
}
}
Thanx a ton.
Ciao
Hari
- Next message: Nicholas Paldino [.NET/C# MVP]: "Re: Network Drive mapping ( Programmatically )"
- Previous message: Mohamoss: "RE: DB Sample Code Request"
- Next in thread: Willy Denoyette [MVP]: "Re: Getting Folder Permissions"
- Reply: Willy Denoyette [MVP]: "Re: Getting Folder Permissions"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|