2.1.5.15.13 FileShortNameInformation

InputBuffer is of type FILE_NAME_INFORMATION, as described in [MS-FSCC] section 2.4.44.<188>

Pseudocode for the algorithm is as follows:

  • If InputBufferSize is less than the size, in bytes, of the FILE_NAME_INFORMATION structure, the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.

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

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

    • If InputBuffer.FileName starts with '\'.

    • If Open.File is equal to Open.File.Volume.RootDirectory.

    • If Open.Stream.StreamType is DataStream and Open.Stream.Name is not empty.

    • If InputBuffer.FileName is not a valid 8.3 name as described in [MS-FSCC] section 2.1.5.2.1.

    • If Open.IsCaseInsensitive is FALSE.

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

    • If Open.GrantedAccess contains neither FILE_WRITE_DATA nor FILE_WRITE_ATTRIBUTES as defined in [MS-SMB2] section 2.2.13.1.

    • If Open.Link.IsDeleted is TRUE.

    • If Open.Mode.FILE_DELETE_ON_CLOSE is TRUE.

  • If Open.HasRestoreAccess is FALSE, the operation MUST be failed with STATUS_PRIVILEGE_NOT_HELD.

  • If Open.File.Volume.GenerateShortNames is FALSE, the operation MUST be failed with STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME.

  • If Open.File.FileType is DirectoryFile, determine whether Open.File contains open files as specified in section 2.1.4.2, with input values as follows:

    • File equal to Open.File.

    • Open equal to this operation's Open.

    • Operation equal to "SET_INFORMATION".

    • OpParams containing a member FileInformationClass containing FileShortNameInformation.

  • If Open.File contains open files as specified in section 2.1.4.2, the operation MUST be failed with STATUS_ACCESS_DENIED.

  • If Open.File.FileType is DirectoryFile:

    • FilterMatch = FILE_NOTIFY_CHANGE_DIR_NAME

  • Else

    • FilterMatch =FILE_NOTIFY_CHANGE_FILE_NAME

  • EndIf

  • If InputBuffer.FileName is empty:

    • If Open.Link.ShortName is not empty:

      • OldShortName = Open.Link.ShortName.

      • Set Open.Link.ShortName to empty.

      • Send directory change notification as specified in section 2.1.4.1, with Volume equal to Open.File.Volume, Action equal to FILE_ACTION_REMOVED, and FileName set to OldShortName with a FilterMatch of FilterMatch.

    • EndIf

    • Return STATUS_SUCCESS.

  • EndIf

  • If InputBuffer.FileName equals Open.Link.ShortName, return STATUS_SUCCESS.

  • For each Link in Open.File.LinkList:

    • If Link is not equal to Open.Link and Link.ShortName is not empty, the operation MUST fail with STATUS_OBJECT_NAME_COLLISION.

  • EndFor

  • For each Link in Open.Link.ParentFile.DirectoryList:

    • If Link is not equal to Open.Link and InputBuffer.FileName matches Link.Name or Link.ShortName, the operation MUST be failed with STATUS_OBJECT_NAME_COLLISION.

  • EndFor

  • If Open.Link.ShortName is not empty:

    • Send directory change notification as specified in section 2.1.4.1, with Volume equal to Open.File.Volume, Action equal to FILE_ACTION_RENAMED_OLD_NAME, and FileName set to Open.Link.ShortName with a FilterMatch of FilterMatch.

  • EndIf

  • 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 FileShortNameInformation

    • Flags equal to "PARENT_OBJECT"

  • Send directory change notification as specified in section 2.1.4.1, with Volume equal to Open.File.Volume, Action equal to FILE_ACTION_RENAMED_NEW_NAME, and FileName set to InputBuffer.FileName with a FilterMatch of FilterMatch.

  • Set Open.Link.ShortName to InputBuffer.FileName.

  • The object store MUST update Open.Link.ParentFile.LastModificationTime, Open.Link.ParentFile.LastAccessTime, and Open.Link.ParentFile.LastChangeTime to the current time.

  • If Open.UserSetChangeTime is FALSE, the object store MUST update Open.File.LastChangeTime to the current time.

  • If Open.File.FileType is DataFile, the object store MUST set Open.File.FileAttributes.FILE_ATTRIBUTE_ARCHIVE.

  • Return STATUS_SUCCESS.