使用C#阻止对目录的访问
作者:互联网
我正在尝试创建一个类似于Folder Lock的程序,它阻止用户访问特定文件夹.我尝试使用DirectorySecurity类和AccessRules来更改文件夹的AccessControl.
但是,通过转到“安全选项卡”并更改权限,可以轻松更改我分配的设置.
有没有安全的方法来阻止访问目录?
解决方法:
我想my answer这个问题:“How could I prevent a folder from being created using a windows service?”可能是你需要做的,以实现你想要的:
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 07002 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.
标签:c,directory,access-control 来源: https://codeday.me/bug/20190621/1259029.html