Obtaining security permissions on a folder
I've searched the forums, and it seems a lot of people are recommending GetAttr. Will GetAttr be able to read the NT security permissions of a given folder? For instance, the folder may not be read-only, but the user may not have the "create files/folders" permission, which would make it read-only in a sense. Will GetAttr be able to detect this?
Re: Obtaining security permissions on a folder
Nope, they are different things entirely.
What you can use is the GetFileSecurity API.
Re: Obtaining security permissions on a folder
I'd be trying to create a file in a directory and want to check to make sure I can before doing so. Is there anything besides those two functions I should consider?
Re: Obtaining security permissions on a folder
There is one other thing I can think of which is Share permissions - but they only apply if it is a shared folder you are working with (and have connected to it as a share, as opposed to via the parent folders etc). Unfortunately I don't know how you can detect the permissions there.
I would suggest creating a test file, but then you may not be able to Delete or Edit it!
Re: Obtaining security permissions on a folder
True. I'll just stick with the security permissions API for now. I'll write a quick sub and test it. I'll leave the thread open until I know for sure that it works.
Re: Obtaining security permissions on a folder
It looks like GetFileSecurity is VERY complicated, or at least the example on allapi is complicated. Would it be possible to get a bit of a hand with how I would just determine whether a file has read/write permissions?
Re: Obtaining security permissions on a folder
It looks like this version might be easier to use: http://www.vbforums.com/showthread.php?t=81966