Incompatibility in Kernel32
klightspeed at netspace.net.au
Thu Jun 21 09:35:01 CDT 2012
On 21/06/2012 7:11 PM, Dmitry Timoshkov wrote:
> Hans Leidekker <hans at codeweavers.com> wrote:
>>> Is there any reason that you call DeleteFile() on a still being opened file?
>> That's the whole point of this test. The observed behavior is that you can pass a
>> filename to MsiRecordSetStream, successfully delete the file, and keep on using the
>> We currently implement MsiRecordSetStream by creating an in-memory copy of the
>> stream. As Robert noticed, this will fail if the stream is too large.
>> The idea is to move to an implementation on top of a file handle, but it should
>> still allow DeleteFile to succeed while the file is in use.
> Thanks, I see. Removing GENERIC_WRITE from flags passed to NtCreateFile by
> DeleteFile makes the test I just sent for that behaviour pass (and that's
> most like a correct fix), but that leads to some other test failures.
> This needs further investigation.
server/fd.c:open_fd() doesn't check that the read-only bit is unset
(i.e. the file is writable) when the DELETE access flag is set. Thus
DeleteFile() succeeding when the tests expect it to fail.
IT Support Bowen, Collinsville and Proserpine Catholic schools
-------------- next part --------------
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 18ed188..f69b778 100644
@@ -1486,7 +1486,7 @@ BOOL WINAPI DeleteFileW( LPCWSTR path )
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- status = NtCreateFile(&hFile, GENERIC_READ | GENERIC_WRITE | DELETE,
+ status = NtCreateFile(&hFile, DELETE,
&attr, &io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN, FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE, NULL, 0);
diff --git a/server/fd.c b/server/fd.c
index f3e42bd..ee99e8f 100644
@@ -1776,7 +1776,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
- if ((access & FILE_UNIX_WRITE_ACCESS) && !(options & FILE_DIRECTORY_FILE))
+ if (((access & FILE_UNIX_WRITE_ACCESS) || (access & DELETE)) && !(options & FILE_DIRECTORY_FILE))
if (access & FILE_UNIX_READ_ACCESS) rw_mode = O_RDWR;
else rw_mode = O_WRONLY;
More information about the wine-devel