Stopping A File From Being Deleted

J

Jay

Hey There,
Is there a way to write code that will protect a file such that
when a user tries to delete it, it will be protected with the "Cannot
delete 'xyz': Access is denied. Make sure the disk is not full or
write-protected and that the file is not currently in use.". Also, how
would you programatically do the reverse? Have a code remove what
protection there is from a file that has that set?

Thank you for the prompt response,
Jay
(patelj27b at gmail dot com)


P.S. I just want to thank all the people out there that have been
prompt in answering my previous questions. It is great to know that
there is always a source out there that can help me gain a better
insight into Windows C++ programming.
 
G

Guest

Jay said:
Hey There,
Is there a way to write code that will protect a file such that
when a user tries to delete it, it will be protected with the "Cannot
delete 'xyz': Access is denied. Make sure the disk is not full or
write-protected and that the file is not currently in use.". Also, how
would you programatically do the reverse? Have a code remove what
protection there is from a file that has that set?

There's actually about 5 or 6 different ways to do this, depending on how
much control you need to have and what programming model you are using
(Win32, MFC, COM, C++/CLI).

Here's the link to the start of one of the relevant MSDN Library sections:

http://msdn.microsoft.com/library/d...cauthz/security/access_control.asp?frame=true

It's not terribly difficult once you learn the terminology and concepts, but
it can be pretty overwhelming at first.

Sean
 
J

Jay

Sean,
Thanks for the link, it helped me get something running that I
wanted, but I have two questions:
1). When I reboot the machine, the Access Rights go back to the
previous settings, how do I get the modified Access Rights to stick
across reboots?
2). Also, is this information kept in the registry? If so, where in
the registry is it kept?

Thanks,
Jay
(patelj27b at gmail dot com)
 

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