Partager via


2.1.5.15.2 FileBasicInformation

InputBuffer is of type FILE_BASIC_INFORMATION as described in [MS-FSCC] section 2.4.7.

Pseudocode for the operation is as follows:

  • If InputBufferSize is less than sizeof(FILE_BASIC_INFORMATION), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.

  • The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:

    • If InputBuffer.CreationTime is less than -2.

    • If InputBuffer.LastAccessTime is less than -2.

    • If InputBuffer.LastWriteTime is less than -2.

    • If InputBuffer.ChangeTime is less than -2.<179>

    • If InputBuffer.FileAttributes.FILE_ATTRIBUTE_DIRECTORY is TRUE and Open.Stream.StreamType is DataStream.

    • If InputBuffer.FileAttributes.FILE_ATTRIBUTE_TEMPORARY is TRUE and Open.File.FileType is DirectoryFile.

  • The object store MUST initialize local variables as follows:

    • CurrentTime to the current system time.

    • OriginalFileAttributes to Open.File.FileAttributes.

    • Initialize UsnReason to zero.

    • ValidSetAttributes to (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)

    • BreakParentOplock to FALSE.

  • If InputBuffer.FileAttributes != 0:

    • If Open.File is equal to Open.File.Volume.RootDirectory, the object store MUST NOT allow the application to change the hidden or system attributes:

      • ValidSetAttributes &= ~(FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)

    • EndIf

    • Open.File.FileAttributes &= ~ValidSetAttributes

    • Open.File.FileAttributes |= (InputBuffer.FileAttributes & ValidSetAttributes)

    • If Open.File.FileAttributes is not equal to OriginalFileAttributes:

      • Set BreakParentOplock to TRUE.

      • The object store MUST set Open.File.PendingNotifications.FILE_NOTIFY_CHANGE_ATTRIBUTES to TRUE.

      • If InputBuffer.FileAttributes.FILE_ATTRIBUTE_TEMPORARY is TRUE, the object store MUST set Open.Stream.IsTemporary to TRUE; otherwise it MUST be set to FALSE.

      • If Open.UserSetChangeTime is FALSE and InputBuffer.ChangeTime != -1, the object store MUST set Open.File.LastChangeTime to CurrentTime.

      • If Open.File.FileAttributes is not equal to OriginalFileAttributes, the object store MUST set UsnReason.USN_REASON_BASIC_INFO_CHANGE to TRUE.

      • If Open.File.FileAttributes. FILE_ATTRIBUTE_NOT_CONTENT_INDEXED is not equal to OriginalFileAttributes.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, the object store MUST set UsnReason.USN_REASON_INDEXABLE_CHANGE to TRUE.

      • The object store MUST update the duplicated information as specified in section 2.1.4.18 with Link equal to Open.Link.

    • EndIf

  • EndIf

  • If InputBuffer.ChangeTime != 0:

    • If InputBuffer.ChangeTime != -2:

      • The object store MUST set Open.UserSetChangeTime to TRUE.

      • If InputBuffer.ChangeTime != -1:

        • Set BreakParentOplock to TRUE.

        • If InputBuffer.ChangeTime !=Open.File.LastChangeTime, the object store MUST set UsnReason.USN_REASON_BASIC_INFO_CHANGE to TRUE.

        • The object store MUST set Open.File.LastChangeTime to InputBuffer.ChangeTime.

      • EndIf

    • Else

      • The object store MUST set Open.UserSetChangeTime to FALSE.

    • EndIf

  • EndIf

  • If InputBuffer.CreationTime != 0 and InputBuffer.CreationTime != -1 and InputBuffer.CreationTime != -2:

    • Set BreakParentOplock to TRUE.

    • If InputBuffer.CreationTime != Open.File.CreationTime, the object store MUST set UsnReason.USN_REASON_BASIC_INFO_CHANGE to TRUE.

    • The object store MUST set Open.File.CreationTime to InputBuffer.CreationTime.

    • The object store MUST set Open.File.PendingNotifications.FILE_NOTIFY_CHANGE_CREATION to TRUE.

    • If Open.UserSetChangeTime is FALSE and InputBuffer.ChangeTime != -1, the object store MUST set Open.File.LastChangeTime to CurrentTime.

  • EndIf

  • If InputBuffer.LastAccessTime != 0:

    • If InputBuffer.LastAccessTime != -2:

      • The object store MUST set Open.UserSetAccessTime to TRUE.

      • If InputBuffer.LastAccessTime != -1:

        • Set BreakParentOplock to TRUE.

        • If InputBuffer. LastAccessTime != Open.File.LastAccessTime, the object store MUST set UsnReason.USN_REASON_BASIC_INFO_CHANGE to TRUE.

        • The object store MUST set Open.File.LastAccessTime to InputBuffer. LastAccessTime.

        • The object store MUST set Open.File.PendingNotifications.FILE_NOTIFY_CHANGE_LAST_ACCESS to TRUE.

        • If Open.UserSetChangeTime is FALSE and InputBuffer.ChangeTime != -1, the object store MUST set Open.File.LastChangeTime to CurrentTime.

      • EndIf

    • Else:

      • The object store MUST set Open.UserSetAccessTime to FALSE.

    • EndIf

  • EndIf

  • If InputBuffer.LastWriteTime != 0:

    • If InputBuffer.LastWriteTime != -2:

      • The object store MUST set Open.UserSetModificationTime to TRUE.

      • If InputBuffer.LastWriteTime != -1:

        • Set BreakParentOplock to TRUE.

        • If InputBuffer. LastWriteTime != Open.File.LastModificationTime, the object store MUST set UsnReason.USN_REASON_BASIC_INFO_CHANGE to TRUE.

        • The object store MUST set Open.File.LastModificationTime to InputBuffer. LastWriteTime.

        • The object store MUST set Open.File.PendingNotifications.FILE_NOTIFY_CHANGE_LAST_WRITE to TRUE.

        • If Open.UserSetChangeTime is FALSE and InputBuffer.ChangeTime != -1, the object store MUST set Open.File.LastChangeTime to CurrentTime.

      • EndIf

    • Else:

      • The object store MUST set Open.UserSetModificationTime to FALSE.

    • EndIf

  • EndIf

  • If BreakParentOplock is TRUE:

    • If the Oplock member of the DirectoryStream in Open.Link.ParentFile.StreamList (hereinafter referred to as ParentOplock) is not empty, the object store MUST check for an oplock break on the parent according to the algorithm in section 2.1.4.12, with input values as follows:

      • Open equal to this operation's Open.

      • Oplock equal to ParentOplock.

      • Operation equal to "SET_INFORMATION"

      • OpParams containing a member FileInformationClass containing FileBasicInformation

      • Flags equal to "PARENT_OBJECT"

  • EndIf

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

  • The operation returns STATUS_SUCCESS.