Reputation: 1247
I know of two methods which are not reliable:
Most useful would be a code sample, because the win32 ACL access functions are extremely complicated. Please don't post links to msdn, I've been there and can't for the life of me figure out what I'm supposed to do with all those DACLs, SACLs and security descriptors - I work on a cross-platform app which needs this particular piece of functionality, but otherwise is platform-agnostic. Solutions simpler than accessing Windows ACLs more than welcome.
Edit: you can safely assume that directory permissions won't change while the app is running.
Upvotes: 1
Views: 3054
Reputation: 4356
you can disable location virtualization for your application in a manifest file (http://www.codeguru.com/csharp/csharp/cs_misc/designtechniques/article.php/c15455/) - this should make CreateFile reliable enough for your purposes.
Upvotes: 5
Reputation:
There is no reliable method, on any operating system, because the permissions can be changed between testing them and actually writing a file.
Upvotes: 1