Incompatibility in Kernel32

robert.van.herk at robert.van.herk at
Fri Jun 22 04:23:58 CDT 2012

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

I think DeleteFile on a opened file is officially allowed in Windows. Although the MS documentation is vague:

The DeleteFile function fails if an application attempts to delete a file that is open for normal I/O or as a memory-mapped file.

The DeleteFile function marks a file for deletion on close. Therefore, the file deletion does not occur until the last handle to the file is closed. Subsequent calls to CreateFile to open the file fail with ERROR_ACCESS_DENIED.

These statements seem to be a bit contradictive to me, so that's why I though I'd write a test to see how Windows actually behaves, and then I found this incompatibility.


More information about the wine-devel mailing list