How to check File or Registry Permissions
Ok, I am at my witts end, and have been working on this for about a week now, with very little actual progress, so any help would be appreciated.
If I knew C++, I think this would be easy by simply checking the ACL or DCL and being done with it.
In VB .NET I would like to output to a file all the permissions of a file and a registry key. For example:
c:\file1.txt:
Owner: Bob
Full Control: Adminstrators group
Deny: John
Read: Accounts Payable Group; Joe
Execute: Everyone
RegKey: HKEY_CURRENT_CONFIG\Software\Microsoft\windows\CurrentVersion\Internet Settings
Full Control: Adminstrators group
Deny: John
Read: Accounts Payable Group; Joe
Execute: Everyone
While the output would mirror something like that of above, the process to get there has thus far illuded me.
Does anyone know if I have to use the Win32 API to get to this kind of information or am I supposed to use any one of the following to namespaces?
System.Security.Permissions.RegistryPermission
System.Security.Permissions.FileIOPermissionAccess
System.Security.Permissions.FileIOPermissionAttribute
If anyone can point me to something of an easy solution that would be great! So far, I have seen code on this and it appears I have to use C++ and work with ACE Entries using the DACL and ACL. Since I don't know C++, this would be kinda tough.
Also, there is an MSDN article entitled, "How DACLs Control Access to an Object", but no sample code.
Thanks to everyone in advance!
Bob