0

I would like to change a file to read only from my application. For that i have used,

SetFileAttributes(szFile, FILE_ATTRIBUTE_READONLY);

And worked. But the readonly property could be changed from the file properties on right clicking the file.

But I would like to block that too...

Is it possible to disable the Read-Only check-box in the file-properties, after making the file readonly.

if possible how it could be done..?

please help me...

Thanks in advance....

Paul R
  • 208,748
  • 37
  • 389
  • 560
JijeshKV
  • 670
  • 2
  • 7
  • 26

2 Answers2

1

You need to set Read Permissions to everyone. See for example SetNamedSecurityInfo function. Or Cacls utility.

Jacob Seleznev
  • 8,013
  • 3
  • 24
  • 34
0

You can't do this. If the user account has sufficient privileges, then whatever your program can do, other programs (like Windows Explorer and its file properties) can do as well. However if the user is restricted to a limited user account, you can set the security descriptor on the file to prevent the user from modifying the attributes.

wj32
  • 8,053
  • 3
  • 28
  • 37