我怎么能prevent使用一个窗口服务正在创建一个文件夹? [英] How could I prevent a folder from being created using a windows service?

查看:201
本文介绍了我怎么能prevent使用一个窗口服务正在创建一个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web服务器上的用户和进程。我期待写一个窗口服务,它能够拦截调用创建在一个特定的子目录中的文件夹。我发现几个来源那里为被动追赶已创建一个文件夹,但我想创建一个Windows服务,将主动拦截和pre-防范任何不可接受的调用创建文件夹。

I have users and processes on a web server. I'm looking to write a windows service that is capable of intercepting calls to create folders within a specific sub-directory. I've found several sources out there for reactively catching that a folder was created, but I want to create a windows service that will proactively intercept and pre-empt any unacceptable calls to create the folder.

让我pre-空的为什么-ers。不要打扰问为什么。我只想说我一直在问要做到这一点,我试图找到最简单的完成任务以自动的方式方法。我已经决定如何完成它,如果我让该文件夹获得创建那么就跟随我的Windows服务和事后删除它(和它的内容)。我真的想一个事件,我可以有服务听取和pre制止。

Let me pre-empty the "why"-ers. Don't bother asking why. Suffice it to say I've been asked to do this, and I'm trying to find the simplest method of accomplishing the task in an automated way. I've already determined how to accomplish it if I let the folder get created then just follow along with my windows service and delete it (and its contents) after the fact. I really would like an event I could have the service listen to and pre-empt.

推荐答案

不幸的是,我不知道这附近的任何地方不足有关的如何的帮助你,但我相当肯定,你会需要写或获得文件系统过滤驱动可以与沟通您的Windows服务来告诉它有人的尝试的创建一个目录/文件,使得你的服务可以做出决定吧。当有人/一些试图创建,这不是让他们可以返回访问被拒绝或文件或文件夹这样的另一个Win32错误您所选择的。

Unfortunately I don't know anywhere near enough about the how to help you, but I'm fairly sure that you'll need to either write or obtain a File System Filter Driver that can communicate with your windows service to tell it that someone has attempted to create a directory/file so that your service can make a decision for it. This way when someone/something attempts to create a file or folder that's not allowed they could be returned "Access Denied" or another Win32 error of your choice.

如果你没下去使用驱动程序的路径,我想它会仍然是最好的做决定的服务,如果在创建/修改的繁重的,即外内核模式。

If you did go down the route of using a driver, I'd guess it'd still be best to do the heavy lifting of deciding if the creation/modification in the service, i.e. outside of Kernel mode.

这篇关于我怎么能prevent使用一个窗口服务正在创建一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆