简体   繁体   中英

File deletion detect from any folder of my operating system and prevent the deletion by c# or win32 api

i know we can monitor a particular folder with FileSystemWatcher. with the help of FileSystemWatcher we can save the log which file was deleted. suppose i have windows service which will run all the time and if any user try to delete any file from my OS with specific extension then control then my windows service will show a messge box to user and prevent the user to delete that file. i just want to know can i do this with FileSystemWatcher class. if it is possible with FileSystemWatcher then please discuss here how or if not possible with FileSystemWatcher then how could i make it possible with my win service or normal win apps. would it be possible by win32 api?? . thanks

使用适当的Windows安全措施 - 文件权限以及访问组。

The only way is to have a filesystem filter driver which will track deletion and movement request (movement to recycle bin here) and will cancel such requests. You can write your own filter driver or use our CallbackFilter product. With CallbackFilter the task is trivial - less than a dozen of lines of code in user-mode (possibly in C#).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM