2.1.5.10.42 FSCTL_WRITE_USN_CLOSE_RECORD

The server provides:

  • Open: An Open of a DataStream or DirectoryStream.

  • OutputBufferSize: The maximum number of bytes to return in OutputBuffer.

On completion, the object store MUST return:

  • Status: An NTSTATUS code that specifies the result.

  • OutputBuffer: An array of bytes that will return a Usn structure representing the current USN of the file, as specified in [MS-FSCC] section 2.3.93.

  • BytesReturned: The number of bytes returned in OutputBuffer.

Support for this operation is optional. If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<148>

Pseudocode for the operation is as follows:

  • If Open.File.Volume.IsReadOnly is TRUE, the operation MUST be failed with STATUS_MEDIA_WRITE_PROTECTED.

  • If OutputBufferSize is less than sizeof(Usn), the operation MUST be failed with STATUS_INVALID_PARAMETER.

  • If Open.File.Volume.IsUsnJournalActive is FALSE, the operation MUST be failed with STATUS_JOURNAL_NOT_ACTIVE.

  • The object store MUST post a USN change as specified in section 2.1.4.11 with File equal to File, Reason equal to USN_REASON_CLOSE, and FileName equal to Open.Link.Name.

  • The object store MUST populate the fields of OutputBuffer as follows:

    • OutputBuffer.Usn set to Open.File.Usn.

  • Upon successful completion of the operation, the object store MUST return:

    • BytesReturned set to sizeof(Usn).

    • Status set to STATUS_SUCCESS.