有什么方法可以读取以独占访问方式打开的文件,即 FILE_SHARE_NONE [英] Is there any way to get READ access to a file opened in exclusive access ie FILE_SHARE_NONE
问题描述
如果不采取肮脏和讨厌的方式,我相信即使使用 SE_BACKUP_NAME,这也是用户模式所不允许的.
Without doing dirty and nasty ways, I believe this to be not allowable from user mode, even with SE_BACKUP_NAME.
我认为肮脏和讨厌的事情:
Things I consider dirty and nasty:
- 找出哪个进程拥有句柄并编写代码以在该进程中运行并关闭句柄.
- 读取/解析 MFT/FAT 表
- 使用内核驱动程序
推荐答案
是的,有一种方法,虽然它可能不适合您的需求;它既不脏也不讨厌,但它很重,也就是说,编写代码并不简单,如果您只是尝试读取单个文件,它会产生不成比例的系统负载.
Yes, there is a way, although it may not suit your needs; it isn't dirty or nasty, but it's heavy, i.e., it is not straightforward to code and it creates a disproportionate amount of system load if you're just trying to read a single file.
但是,如果您需要这样做,这是我所知道的唯一合理且安全的解决方案:请参阅 卷影复制服务.
However, if you need to do this, this is the only reasonable and safe solution I'm aware of: see the MSDN documentation on the Volume Shadow Copy Service.
现在大多数备份软件都使用 VSS.
Most backup software uses VSS nowadays.
这篇关于有什么方法可以读取以独占访问方式打开的文件,即 FILE_SHARE_NONE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!