File open by file id and File delete on close

Gentlefolk

For some reason I decided to find out how the file system etc would behave
when I opened a file by file identifier with FILE_DELETE_ON_CLOSE set in the
CreateOptions parameter of ZwCreateFile. The code snippet is below.(status
tests removed). So I ran this code on XP/NTFS. It runs just fine in that
none of the calls croak. The file however is not
deleted.

It appears that the FILE_DELETE_ON_CLOSE is not honoured, it is just
ignored, without warning. Is this the expected
behaviour of the system?

I note here that if I open without FILE_DELETE_ON_CLOSE and attempt to set
the FileDispositionInformation with DeleteFile TRUE (the other delete) then
the ZwSetInformationFile call is failed with STATUS_INVALID_PARAMETER
despite that I seem to have been able to open with DELETE access.

Cheers
Lyndon

UnicodeString.Buffer = (PWCHAR)(&FileIdentifier);
UnicodeString.Length = 8;
UnicodeString.MaximumLength = 8;

InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
OBJ_CASE_INSENSITIVE,
RootHandle,
NULL);

NtStatus = ZwCreateFile(&Handle,
SYNCHRONIZE | DELETE,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_DELETE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE | FILE_DELETE_ON_CLOSE |
FILE_OPEN_BY_FILE_ID,
NULL,
0);

NtStatus = ZwClose(Handle);