Can anybody tell me any API or sample code snippet to find out the Directory access permissions, to find out whether or not a directory have write protection.

I found "GetNamedSecurityInfo" API, but don't know how to use it.

I want this in both Window and linux.

Any help will be appreciated.