开发者

How to read data using ReadFile when file has disabled sharing on read

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开发者_StackOverflow中文版 probably "code" solution will be better for this problem if this can be done by code.

Can anyone help me?


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...


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:

a backup application must have access to the system-level access control settings, the ACCESS_SYSTEM_SECURITY flag must be specified in the dwDesiredAccess parameter value passed to CreateFile.value passed to CreateFile.

parameter value passed to CreateFile.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜