|
-
May 28th, 1999, 08:06 PM
#1
Make a file that can not be deleted
Is it possible to change a file so that the user cannot delete using normal delete command?
-
June 13th, 1999, 10:08 PM
#2
Re: Make a file that can not be deleted
Use SetFileAttributes(...) API. Uset GetFleAttributes first to get the attributes, and then OR the attributes with FILE_ATTRIBUTE_READONLY attribute. Then use SetFileAttributes(...). You can also make a file a system file or hide it with the same API.
Hope this helps.
Vali
-
June 14th, 1999, 08:05 AM
#3
Re: Make a file that can not be deleted
setting the systemfile and hidden attribute won't stop the user from delitng the file if he/she really tries to delete the thing
Don't know if you are running NT or not
if you are running NT try to alter the security descriptor of the file so that only a certain type of user can delete it.
-
June 14th, 1999, 09:11 AM
#4
Re: Make a file that can not be deleted
Please give some coding samples to stop user deleting file in NT.
Thank you.
-
June 16th, 1999, 08:24 PM
#5
Re: Make a file that can not be deleted
There is a really interesting trick in DOS where you make a file start with the ascii character 0255, by holding down alt and typing 0255. The command would look like this:
rename original.cpp <alt+0225 here>original.cpp
When windows sees this file, in say explorer(it will look like _original.cpp), but attempting to delete it is basically impossible. The only problem I see is that it may also be difficult for your program, which also runs in windows, to access this filel. I don't know, but I hope this helps.
The only way to delete said file is throgh DOS again. If you have any questions about this or DOS, feel free to email me or reply to this post.
~G²
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|