CreateFile access/sharing problem

Dmitry Timoshkov dmitry at baikal.ru
Mon Oct 3 23:08:24 CDT 2005


"Michael Ost" <most at museresearch.com> wrote:

> 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.
> 
> My "solution" (polite term) was to force GENERIC_READ|GENERIC_WRITE
> access in ntdll/NtCreateFile if the sharing type is FILE_SHARE_WRITE.

Most likely sharing mode has nothing to do with access rights. The problem is
that the app doesn't specify neither of GENERIC_xxxx flags. But it does specify
STANDARD_RIGHTS_ALL == (DELETE|READ_CONTROL|WRITE_DAC|WRITE_OWNER|SYNCHRONIZE).
It appears that Windows treats GENERIC_xxxx rights as an addition to the
STANDARD_RIGHTS_xxx flags, and missing GENERIC_xxxx rights are normally ignored.

> I have not been able to figure out from the header files what named
> constants the program used for dwDesiredAccess, so I hard coded it with
> the values the program used in my example. 
> 
> But I did notice that FILE_ALL_ACCESS is a different value in Wine and
> my VC98 headers from DevStudio 6. In Wine it is:
> (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
> In VC98:
> (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
> Is this a Wine bug?

Please send a patch for this.

Your test app needs to be extended to verify who is responsible for handling
the dwDesiredAccess: CreateFileW ot NtCreateFile (I think it's the latter one,
but it needs to be tested).

-- 
Dmitry.




More information about the wine-devel mailing list