Done: Allow for custom file sharing modes

Wishlists for new functionality and features.
Post Reply
DieOberzicke
Posts: 1
Joined: 14 Apr 2014 00:57

Done: Allow for custom file sharing modes

Post by DieOberzicke »

I have a file which I have opened in another process. Although my process should allow other processes to open the file with read access, HxD is unable to open the file, and presents me with the "The process cannot access the file because it is being used by another process" message box.

I believe this is due to the way that HxD is calling CreateFile. This page, states the following:
If you specify an access or sharing mode that conflicts with the modes specified in the previous call, CreateFile fails.
In my process, I am calling CreateFile using (GENERIC_READ | GENERIC_WRITE), FILE_SHARE_READ. According to the table on the aforementioned page, HxD would need to call CreateFile using GENERIC_READ, (FILE_SHARE_READ | FILE_SHARE_WRITE), rather than its current GENERIC_READ, FILE_SHARE_READ.

Seeing as the parameters HxD would need to use fully rely on those which were supplied to the initial CreateFile call, the best solution would be to add an option which would allow users to specify a custom dwDesiredAccess and dwShareMode with which to open the file.

Thanks.

Related threads:
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Allow for custom file sharing modes

Post by Maël »

The reason is that HxD denies write access temporarily to be sure that the read data is not changed during reading. This is to ensure invariants and avoid spurious/random behavior. So FILE_SHARE_WRITE is not granted on purpose, and having an option would not really solve this issue, unfortunately.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Allow for custom file sharing modes

Post by Maël »

As mentioned in the second link in the original post, this has been relaxed to the most possible degree, with lots of internal changes to use caching and reduce locking to a minimum whenever possible.
Post Reply