How to find if path is readonly

A

Alamelu

In Windows XP how to find if a particular path is readonly

For Local path c:\Test
For Network Path \\10.33.33.33\Test
For Mapped Path (subst z: \\10.33.33.33\Test) z:\

I am able to find if a existing file is readonly using GetFileAttribute, but
to how to find if a path is readonly
 
D

David Lowndes

In Windows XP how to find if a particular path is readonly
For Local path c:\Test
For Network Path \\10.33.33.33\Test
For Mapped Path (subst z: \\10.33.33.33\Test) z:\

I am able to find if a existing file is readonly using GetFileAttribute, but
to how to find if a path is readonly

Directories also have a read-only attribute in the same way as files,
however it doesn't really mean anything. Ultimately your best option
may be to do the (write) operation and see if it fails.

Dave
 
B

Ben Voigt [C++ MVP]

Alamelu said:
In Windows XP how to find if a particular path is readonly

For Local path c:\Test
For Network Path \\10.33.33.33\Test
For Mapped Path (subst z: \\10.33.33.33\Test) z:\

I am able to find if a existing file is readonly using GetFileAttribute,
but

That's a nearly useless definition of readonly. The attribute is only a
hint to the user, doesn't actually prevent writing. You most likely need to
do an effective permissions check and that works the same for files and
directories.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top