CreateFile access/sharing problem
billmedland at mercuryspeed.com
Mon Oct 3 15:35:36 CDT 2005
On October 3, 2005 11:20 am, Michael Ost wrote:
> Any suggestions for how to handle a difference in file access
> and sharing handling between Wine (20050830) and WinXP? A
> program demonstrating the problem is attached below.
> A 3rd party installer program for a VST plugin is calling
> CreateFile with dwDesiredAccess = 0x1f01ff and dwSharedMode =
> FILE_SHARE_WRITE. It then calls ReadFile, which fails in Wine
> (error 5) but succeeds in WinXP.
> The "access" and "sharing" parameters to CreateFile are making
> me feel stupid. I read and read and read the docs at
>us/fileio/fs/createfile.asp and still can't really figure out
> what they are supposed to do! I am pretty sure that my hack
> wouldn't stand and would love to hear the right way to fix
> this problem.
> Thanks... mo
I think that maybe you/we are getting confused as a result of
Microsoft trying to simplify the language and actually making it
worse. I think the problem is with the FILE_SHARE_...
descriptions. (There seems to be a disconnect between the
designers and the linguists, especially when negatives become
In the old days the description was possibly worse:
"FILE_SHARE_READ - Subsequent open operations on the object will
succeed only if read access is requested".
I think that the linguists are trying to put a positive spin on
what is actually a negative construct.
As far as I am concerned this is what is meant.
"FILE_SHARE_READ - Enables subsequent open operations on an
object to request read access. If this flag is not specified
then any subsequent open operations specifying read access will
fail. If this flag is specified then any subsequent operations
specifying read access may succeed or fail, depening on other
Basically it all dates back to the old days of DOS. The sharing
was to control how a file was shared; the first opening of the
file is constraining what else may be done. By specifying
FILE_SHARE_READ the caller is permitting other calls to open the
file for reading.
We could (INCORRECTLY) read the bad current text to mean "During
this call if the file is opened for reading but the
FILE_SHARE_READ is not set then the call will fail."
Anyway, I'll have a quick look.
mailto:billmedland at mercuryspeed.com
More information about the wine-devel