how to make disk partiotion or whole hard disk readonly?

As title:
how to make disk partiotion or whole hard disk readonly?
[75 byte] By [richanel] at [2007-11-20 1:37:49]
# 1 Re: how to make disk partiotion or whole hard disk readonly?
use _chmod on all your files.
Skizmo at 2007-11-10 23:17:55 >
# 2 Re: how to make disk partiotion or whole hard disk readonly?
use _chmod on all your files.But doing this way a new file can always be created on the drive.
kumaresh_ana at 2007-11-10 23:18:55 >
# 3 Re: how to make disk partiotion or whole hard disk readonly?
I'm not aware of any Win API to make a volume read-only. GetVolumeInformation() can retrieve the flags associated with a volume, among which, On WinXP, Win Server 2003, you can find FILE_READ_ONLY_VOLUME forread-only volumes, but there doesn't seem to be any API to make a volume read-only.

Try _chmod() on the root folder (C:\, d:\) . If it doesn't work, I don't think it's possible.
cilu at 2007-11-10 23:19:54 >
# 4 Re: how to make disk partiotion or whole hard disk readonly?
I'm not aware of any Win API to make a volume read-only. GetVolumeInformation() can retrieve the flags associated with a volume, among which, On WinXP, Win Server 2003, you can find FILE_READ_ONLY_VOLUME forread-only volumes, but there doesn't seem to be any API to make a volume read-only.

Try _chmod() on the root folder (C:\, d:\) . If it doesn't work, I don't think it's possible.

*****************************************************
Can we make a drive read only using an API
dineshkokate at 2007-11-10 23:20:53 >
# 5 Re: how to make disk partiotion or whole hard disk readonly?
*****************************************************
Can we make a drive read only using an API
Again, I am not aware of any API to do that. However, you could try to monitor a particular path (like c:\) for any change and invalidate them. You can use FindFirstChangeNotification() and FindNextChangeNotification() with FILE_NOTIFY_CHANGE_FILE_NAME that includes the creation or deletion of files/folders.
cilu at 2007-11-10 23:21:59 >