Reputation: 89
I'm using win32. I wanna create a hidden and undeletable file using CreateFile()
if possible. I haven't tried anything so far because the documentation is complex.
Here is an example where my app would be useful.
Let just say we have two people living in the same room, like in college. One of them Always goes on the other guy's laptop and delete some stuff for fun. The other guy can make his files undeletable to stop his other friend from deleting his files. This is just basic example.
Upvotes: 0
Views: 1341
Reputation: 36016
Whats wrong with using NTFS permissions to accomplish this? i.e. The two users should have different user accounts, only one of them with administrator privileges. You can't protect users from administrators, or administrators from each other, so the "Deletes for fun" guy should be the plain user.
Upvotes: 1
Reputation: 13973
It's not possible to create a hidden and un-deletable file.
The closest you can get is creating a file with the hidden attribute and having a process run at all times to keep the file locked, preventing deletion.
This, of course, doesn't prevent the user from checking 'Show Hidden Files' in folder options, closing the process that has the file locked, or using some application to forcefully unlock the file.
Upvotes: 6