当文件禁用读取共享时如何使用 ReadFile 读取数据
我有一个问题,我有一个文件打开了其他进程,并且该进程在 CreateFile
非文件共享中定义,然后我有其他应用程序,我想从中读取数据 同时归档,但怎么办。
我无法在第一个应用程序中更改文件共享。 我可以到达计算机管理员权限,我可以在系统中进行更改,但如果可以通过代码来完成,“代码”解决方案可能会更好地解决这个问题。
谁能帮助我吗?
I have a problem, i have a file who opened other process and this process defined in CreateFile
non file sharing, then i have other application and i want read data from this
file in same time, but how to do.
I can't change file sharing in first application.
I can reach computer administrator right's, i can do changes in system, but probably "code" solution will be better for this problem if this can be done by code.
Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如何使用 EasyHook 并将 API 挂钩到 CreateFile 例程,实际上,您的代码将拦截 API 并可能更改
dwShareMode
参数使其成为FILE_SHARE_READ按位或FILE_SHARE_WRITE即(FILE_SHARE_READ|FILE_SHARE_WRITE)并调用原始钩子以允许CreateFile正常工作...How about using EasyHook and hook in the API to the CreateFile routine, in effect, your code will intercept the API and possibly change the
dwShareMode
parameter to make it FILE_SHARE_READ bitwise or FILE_SHARE_WRITE i.e. (FILE_SHARE_READ|FILE_SHARE_WRITE) and call the original hook to allow the CreateFile to work normally...如果您有足够的权限,请使用备份 API。否则,请注意这些标志的存在是有原因的。如果有人禁用共享,它就会被禁用。
您想要调用
BackupRead
,MSDN 注释如下:传递给 CreateFile 的参数值。
Use the backup API if you have sufficient privilege. Otherwise, note that these flags exist for a reason. If someone disabled sharing, it's disabled.
You want to call
BackupRead
, and MSDN notes the following:parameter value passed to CreateFile.
其中一种选择是使用我们的 RawDisk 产品,它可以让您绕过系统安全限制并打开文件,已以独占方式打开或您无权访问的内容。注意,安装RawDisk本身需要管理员权限,因此RawDisk不能用于入侵他人的计算机。
另一种选择是使用备份 API,即上面提到的 BackupRead() Windows API 函数。 google 搜索 BackupAPI 不仅会给您提供此功能的说明,还会提供一些注释用户关于使用此备份 API 所涉及的内容的信息
One of the options is to use our RawDisk product, which lets you bypass system security restrictions and open files, which have been opened exclusively or the ones for which you don't have access rights. Note, that installing RawDisk itself requires admin rights, so RawDisk can't be used for intrusion to other's computer.
Another option is to use backup API, i.e. above mentioned BackupRead() Windows API function. Doing google search for BackupAPI will give you not just description of this function, but also several comments from users about what's involved in using this backup API