Delete on Close
When a caller specifies the FILE_DELETE_ON_CLOSE option, it is necessary for the file system check to ensure that the caller has delete permission on the file or delete child permission on the parent directory. Either permission is sufficient to allow a file to be deleted. This is an important case for file systems to handle. The semantics of the operation, which delete the file when it is closed, are not enforced by the I/O manager but by the file system.
The file system may also need to check that the volume is not write protected and that this operation does not apply to a directory where this operation is not allowed. For example, the FASTFAT file system code does checks for a write-protected volume and does not allow the root directory to be deleted using FILE_DELETE_ON_CLOSE. An example of these checks can be found in the FatCommonCreate function in the Create.c source file from the fastfat sample that the WDK contains.