internal static MessageStatus WorkArondSetFileShortNameInfo(InputBufferFileName inputBufferFileName, MessageStatus returnedstatus, ITestSite site)
 {
     if (inputBufferFileName == InputBufferFileName.StartWithBackSlash)
     {
         returnedstatus = FsaUtility.TransferExpectedResult <MessageStatus>(3173, MessageStatus.INVALID_PARAMETER, returnedstatus, site);
     }
     else if (inputBufferFileName == InputBufferFileName.NotValid)
     {
         returnedstatus = FsaUtility.TransferExpectedResult <MessageStatus>(3176, MessageStatus.INVALID_PARAMETER, returnedstatus, site);
     }
     return(returnedstatus);
 }
 internal static MessageStatus WorkaroundStreamRename(FileSystem fileSystem, InputBufferFileName NewStreamName, InputBufferFileName StreamTypeName, bool ReplaceIfExists, MessageStatus returnedStatus, ITestSite site)
 {
     if (fileSystem == FileSystem.REFS || fileSystem == FileSystem.FAT32)
     {
         returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3146, MessageStatus.NOT_SUPPORTED, returnedStatus, site);
     }
     else if (NewStreamName == InputBufferFileName.ContainsWildcard)
     {
         returnedStatus = FsaUtility.TransferExpectedResult <MessageStatus>(3146, MessageStatus.INVALID_PARAMETER, returnedStatus, site);
     }
     return(returnedStatus);
 }
 internal static MessageStatus WorkaroundStreamRename(FileSystem fileSystem, InputBufferFileName NewStreamName, InputBufferFileName StreamTypeName, bool ReplaceIfExists, MessageStatus returnedStatus, ITestSite site)
 {
     if (fileSystem == FileSystem.REFS)
     {
         returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3146, MessageStatus.NOT_SUPPORTED, returnedStatus, site);
     }
     else if (NewStreamName == InputBufferFileName.ContainsWildcard)
     {
         returnedStatus = FsaUtility.TransferExpectedResult<MessageStatus>(3146, MessageStatus.INVALID_PARAMETER, returnedStatus, site);
     }
     return returnedStatus;
 }
        internal static MessageStatus WorkaroundSetFileShortNameInfo(InputBufferFileName inputBufferFileName, MessageStatus returnedstatus, ITestSite site)
        {
            if (inputBufferFileName == InputBufferFileName.StartWithBackSlash)
            {
                returnedstatus = FsaUtility.TransferExpectedResult<MessageStatus>(3173, MessageStatus.INVALID_PARAMETER, returnedstatus, site);
            }
            else if (inputBufferFileName == InputBufferFileName.NotValid)
            {
                returnedstatus = FsaUtility.TransferExpectedResult<MessageStatus>(3176, MessageStatus.INVALID_PARAMETER, returnedstatus, site);
            }
            else if (inputBufferFileName == InputBufferFileName.Empty)
            {
                returnedstatus = FsaUtility.TransferExpectedResult<MessageStatus>(3180, MessageStatus.ACCESS_DENIED, returnedstatus, site);
            }

            return returnedstatus;
        }
        public static MessageStatus StreamRename(
            InputBufferFileName newStreamNameFormat,
            InputBufferFileName streamTypeNameFormat,
            ReplacementType replacementType)
        {
            if (!IsStreamRenameSupported)
            {
                Requirement.Capture("[TestInfo] If stream rename is not supported by the object store, it SHOULD return STATUS_NOT_SUPPORTED.");
                return MessageStatus.NOT_SUPPORTED;
            }

            if (newStreamNameFormat == InputBufferFileName.EndWithColon)
            {
                Helper.CaptureRequirement(3136, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:The last character of NewStreamName is \"":"".");
                return MessageStatus.INVALID_PARAMETER;
            }

            if (newStreamNameFormat == InputBufferFileName.ColonOccurMoreThanThreeTimes)
            {
                Helper.CaptureRequirement(3137, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    The character \"":"" occurs more than three times in NewStreamName.");
                return MessageStatus.INVALID_PARAMETER;
            }

            if (newStreamNameFormat == InputBufferFileName.ContainsInvalid)
            {
                Helper.CaptureRequirement(3265, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:If StreamName contains any characters invalid for a streamname as specified in [MS-FSCC] section 2.1.5  .");
                return MessageStatus.INVALID_PARAMETER;
            }

            if (newStreamNameFormat == InputBufferFileName.ContainsWildcard)
            {
                Helper.CaptureRequirement(3266, @"[In Algorithm for Performing Stream Rename]The operation MUST be failed with STATUS_INVALID_PARAMETER
                    under any of the following conditions:If StreamName contains  any wildcard characters as defined in section 3.1.4.3  .");
                return MessageStatus.INVALID_PARAMETER;
            }

            //if (streamNameZeroLength && StreamTypeNameZeroLength)
            if ((newStreamNameFormat == InputBufferFileName.LengthZero) && (streamTypeNameFormat == InputBufferFileName.LengthZero))
            {
                Helper.CaptureRequirement(3140, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:Both StreamName and StreamTypeName are zero-length.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //if (streamNameIsMore255Unicode)
            if (newStreamNameFormat == InputBufferFileName.IsMore255Unicode)
            {
                Helper.CaptureRequirement(3141, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:StreamName is more than 255 Unicode characters in length.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //if (streamType == StreamType.DataStream && StreamTypeNameisData)
            if ((gStreamType == StreamType.DataStream && streamTypeNameFormat == InputBufferFileName.isData) ||
                (newStreamNameFormat == InputBufferFileName.LengthZero && streamTypeNameFormat == InputBufferFileName.isIndexAllocation))
            {
                Helper.CaptureRequirement(3143, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_OBJECT_TYPE_MISMATCH if either of the following conditions are true:
                    Open.Stream.StreamType is DataStream and StreamTypeName is not the Unicode string \""$DATA"".");
                return MessageStatus.OBJECT_TYPE_MISMATCH;
            }

            //if (streamType == StreamType.DirectoryStream && StreamTypeNameisIndexAllocation)
            if ((gStreamType == StreamType.DirectoryStream) && (streamTypeNameFormat == InputBufferFileName.isIndexAllocation))
            {
                Helper.CaptureRequirement(3144, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_OBJECT_TYPE_MISMATCH if either of the following conditions are true:Open.Stream.StreamType
                    is DirectoryStream and StreamTypeName is not the Unicode string \""$INDEX_ALLOCATION"".");
                return MessageStatus.OBJECT_TYPE_MISMATCH;
            }

            //If Open.Stream.StreamType is DirectoryStream
            if (gStreamType == StreamType.DirectoryStream)
            {
                Helper.CaptureRequirement(3145, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    If Open.Stream.StreamType is DirectoryStream, the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //If StreamName is a case-insensitive match with Open.Stream.Name
            if (newStreamNameFormat == InputBufferFileName.IsCaseInsensitiveMatch && streamTypeNameFormat == InputBufferFileName.isData)
            {
                Helper.CaptureRequirement(3146, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    If StreamName is a case-insensitive match with Open.Stream.Name, the operation MUST immediately return STATUS_SUCCESS.");
                return MessageStatus.SUCCESS;
            }

            //If TargetStream is found
            if (gIsTargetStreamFound)
            {
                if (replacementType != ReplacementType.ReplaceIfExists)
                {
                    Helper.CaptureRequirement(3148, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                        If TargetStream is found:If ReplaceIfExists is FALSE, the operation MUST be failed with STATUS_OBJECT_NAME_COLLISION.");
                    return MessageStatus.OBJECT_NAME_COLLISION;
                }
                //If TargetStream.File.OpenList contains any Opens to TargetStream
                if (gIsOpenListContains)
                {
                    Helper.CaptureRequirement(3149, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:
                        If TargetStream is found:]If TargetStream.File.OpenList contains any Opens to TargetStream,
                        the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                    return MessageStatus.INVALID_PARAMETER;
                }
                //if (TargetStreamSizeNotZero)
                if (gIsTargetStreamSizeNotZero)
                {
                    Helper.CaptureRequirement(3150, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:
                        If TargetStream is found:]If TargetStream.Size is not 0, the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                    return MessageStatus.INVALID_PARAMETER;
                }
            }
            return MessageStatus.SUCCESS;
        }
        public static MessageStatus SetFileShortNameInfo(InputBufferFileName inputBufferFileName)
        {
            // If Open.FileName is not "\$Extend\$Quota" and SecurityContext does not have the SE_MANAGE_VOLUME_ACCESS privilege
            if (inputBufferFileName == InputBufferFileName.StartWithBackSlash)
            {
                Helper.CaptureRequirement(3173, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:If InputBuffer.FileName starts with '\'.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //inputFileName == "InvalidName": If InputBuffer.FileName is not a valid 8.3 name as described in [MS-FSCC] section
            if (inputBufferFileName == InputBufferFileName.NotValid)
            {
                Helper.CaptureRequirement(3176, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:If InputBuffer.FileName is not a valid 8.3 name as described in [MS-FSCC] section 2.1.5.2.1.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //If Open.GrantedAccess contains neither FILE_WRITE_DATA nor FILE_WRITE_ATTRIBUTES as defined in [MS-SMB2] section 2.2.13.1.
            if ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & (FileAccess.FILE_WRITE_DATA | FileAccess.FILE_WRITE_ATTRIBUTES)) == 0)
            {
                Helper.CaptureRequirement(3178, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    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.");
                return MessageStatus.ACCESS_DENIED;
            }
            if ((gOpenMode & CreateOptions.DELETE_ON_CLOSE) != 0)
            {
                Helper.CaptureRequirement(3180, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_ACCESS_DENIED under any of the following conditions:If Open.Mode.FILE_DELETE_ON_CLOSE is TRUE.");
                return MessageStatus.ACCESS_DENIED;
            }
            // If Open.HasRestorePrivilege is FALSE
            if (!openHasRestoreAcces)
            {
                Helper.CaptureRequirement(3181, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    If Open.HasRestoreAccess is FALSE, the operation MUST be failed with STATUS_PRIVILEGE_NOT_HELD.");
                return MessageStatus.PRIVILEGE_NOT_HELD;
            }
            // If Open.File.Volume.GenerateShortNames is FALSE
            if (!gOpenGenerateShortNames)
            {
                Helper.CaptureRequirement(3182, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    If Open.File.Volume.GenerateShortNames is FALSE, the operation MUST be failed with STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME.");
                return MessageStatus.SHORT_NAMES_NOT_ENABLED_ON_VOLUME;
            }
            // If Open.File contains open files as per section 3.1.4.2
            if (gIsOpenListContains)
            {
                Helper.CaptureRequirement(3183, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    If Open.File contains open files, the operation MUST be failed with STATUS_ACCESS_DENIED.");
                return MessageStatus.ACCESS_DENIED;
            }

            //If InputBuffer.FileName is empty:
            if (inputBufferFileName == InputBufferFileName.Empty)
            {
                Helper.CaptureRequirement(3189, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:,
                    If InputBuffer.FileName is empty:]Return STATUS_SUCCESS.");
                Helper.CaptureRequirement(3200, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:] Return STATUS_SUCCESS.");
                return MessageStatus.SUCCESS;
            }

            //if (inputFileName == linkShortName)
            if (inputBufferFileName == InputBufferFileName.EqualLinkShortName)
            {
                Helper.CaptureRequirement(3190, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:]
                    If InputBuffer.FileName equals Open.Link.ShortName, return STATUS_SUCCESS.");
                Helper.CaptureRequirement(3200, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:] Return STATUS_SUCCESS.");
                return MessageStatus.SUCCESS;
            }
            Helper.CaptureRequirement(3200, @"[In FileShortNameInformation,Pseudocode for the algorithm is as follows:] Return STATUS_SUCCESS.");
            return MessageStatus.SUCCESS;
        }
        public static MessageStatus SetFileRenameInfo(
            InputBufferFileNameLength inputBufferFileNameLength,
            InputBufferFileName inputBufferFileName,
            DirectoryVolumeType directoryVolumeType,
            DestinationDirectoryType destinationDirectoryType,
            NewLinkNameFormatType newLinkNameFormatType,
            NewLinkNameMatchType newLinkNameMatchType,
            ReplacementType replacementType,
            TargetLinkDeleteType targetLinkDeleteType,
            OplockBreakStatusType oplockBreakStatusType,
            TargetLinkFileOpenListType targetLinkFileOpenListType
            )
        {
            bool RemoveTargetLink = false;
            bool TargetExistsSameFile = false;

            //Boolean values (initialized to true): ActivelyRemoveSourceLink, RemoveSourceLink, AddTargetLink
            bool AddTargetLink = true;
            //If InputBuffer.FileNameLength is equal to zero.
            if (inputBufferFileNameLength == InputBufferFileNameLength.EqualTo_Zero)
            {
                Helper.CaptureRequirement(3023, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    If InputBuffer.FileNameLength is equal to zero.");
                return MessageStatus.INVALID_PARAMETER;
            }

            // inputNameLengthValidate == 1:If InputBuffer.FileNameLength is an odd number
            if (inputBufferFileNameLength == InputBufferFileNameLength.OddNumber)
            {
                Helper.CaptureRequirement(3024, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    If InputBuffer.FileNameLength is an odd number.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //If InputBuffer.FileNameLength is greater than
            //InputBufferLength minus the byte offset into the FILE_RENAME_INFORMATION InputBuffer
            //of the InputBuffer.FileName field (that is, the total length of InputBuffer as given
            //in InputBufferLength is insufficient to contain the fixed-size fields of InputBuffer
            //plus the length of InputBuffer.FileName)
            if (inputBufferFileNameLength == InputBufferFileNameLength.Greater)
            {
                Helper.CaptureRequirement(3025, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    If InputBuffer.FileNameLength is greater than InputBufferLength minus the byte offset into the FILE_RENAME_INFORMATION InputBuffer
                    of the InputBuffer.FileName field (that is, the total length of InputBuffer as given in InputBufferLength
            is insufficient to contain the fixed-size fields of InputBuffer plus the length of InputBuffer.FileName).");
                return MessageStatus.MEDIA_WRITE_PROTECTED;
            }

            //If Open.GrantedAccess does not contain DELETE, as defined in [MS-SMB2] section 2.2.13.1
            if ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.DELETE) == 0)
            {
                Helper.CaptureRequirement(3026, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    If Open.GrantedAccess does not contain DELETE, as defined in [MS-SMB2] section 2.2.13.1,
                    the operation MUST be failed with STATUS_ACCESS_DENIED.");
                return MessageStatus.ACCESS_DENIED;
            }

            // If the first character of InputBuffer.FileName is '\'
            if (inputBufferFileName == InputBufferFileName.StartWithBackSlash)
            {

                //if DestinationDirectory.Volume is not equal to Open.File.Volume
                if (directoryVolumeType == DirectoryVolumeType.DestDirVolumeNotEqualToOpenFileVolume)
                {
                    Helper.CaptureRequirement(3034, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                        If the first character of InputBuffer.FileName is '\']Else if DestinationDirectory.Volume is not equal
                        to Open.File.Volume:The operation MUST be failed with STATUS_NOT_SAME_DEVICE.");
                    return MessageStatus.NOT_SAME_DEVICE;
                }
            }

            // If the first character of InputBuffer.FileName is ':'
            if (inputBufferFileName == InputBufferFileName.StartWithColon)
            {
                Helper.CaptureRequirement(3042, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                    If the first character of InputBuffer.FileName is ':']The operation immediately returns STATUS_SUCCESS.");
                return MessageStatus.SUCCESS;
            }

            //If Open.File contains open files, the operation MUST be failed with STATUS_ACCESS_DENIED
            //if (isOpenFileContain)
            if (gIsOpenListContains)
            {
                Helper.CaptureRequirement(3044, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    If Open.File contains open files, the operation MUST be failed with STATUS_ACCESS_DENIED.");
                return MessageStatus.ACCESS_DENIED;
            }

            //If InputBuffer.FileName is not valid as specified in [MS-FSCC] section 2.1.5
            if (inputBufferFileName == InputBufferFileName.NotValid)
            {
                Helper.CaptureRequirement(3045, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    If InputBuffer.FileName is not valid as specified in [MS-FSCC] section 2.1.5,
                    the operation MUST be failed with STATUS_OBJECT_NAME_INVALID.");
                return MessageStatus.OBJECT_NAME_INVALID;
            }

            //If DestinationDirectory is the same as Open.Link.ParentFile:
            if (destinationDirectoryType == DestinationDirectoryType.DestDirIsSameAsOpenLinkParentFile)
            {
                //If NewLinkName is a case-sensitive exact match with Open.Link.Name
                if (newLinkNameFormatType == NewLinkNameFormatType.NewLinkNameIsCaseSensitive)
                {
                    Helper.CaptureRequirement(3046, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                        If DestinationDirectory is the same as Open.Link.ParentFile:If NewLinkName is a case-sensitive exact match with Open.Link.Name,
                        the operation MUST immediately return STATUS_SUCCESS.");
                    return MessageStatus.SUCCESS;
                }
            }

            //If NewLinkName matches the Name or ShortName of any Link in DestinationDirectory.
            //DirectoryList using case-sensitivity according to Open.IsCaseInsensitive:
            if (newLinkNameMatchType == NewLinkNameMatchType.NewLinkNameMatchTargetLinkShortName)
            {
                //Set FoundLink to true.
                //Set TargetLink to the existing Link found in DestinationDirectory.DirectoryList. Because the name may have been found using a case-insensitive search (if Open.IsCaseInsensitive is true), this preserves the case of the found name.
                //If NewLinkName matched TargetLink.ShortName, set MatchedShortName to true.
                //Set RemoveTargetLink to true.
                RemoveTargetLink = true;
                //If TargetLink.File.FileID equals Open.File.FileID, set TargetExistsSameFile to true. This detects a rename to another existing link to the same file.

                //If (TargetLink.Name is a case-sensitive exact match with NewLinkName) or MatchedShortName is true and TargetLink.ShortName is a case-sensitive exact match with NewLinkName):
                //Set ExactCaseMatch to true.

                //If RemoveTargetLink is true:
                if (RemoveTargetLink)
                {
                    //If TargetExistsSameFile is FALSE and InputBuffer.ReplaceIfExists is FALSE
                    if (!TargetExistsSameFile && replacementType == ReplacementType.NotReplaceIfExists)
                    {
                        Helper.CaptureRequirement(3067, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                            If RemoveTargetLink is TRUE:If TargetExistsSameFile is FALSE and InputBuffer.ReplaceIfExists is FALSE,
                            the operation MUST be failed with STATUS_OBJECT_NAME_COLLISION.");
                        return MessageStatus.OBJECT_NAME_COLLISION;
                    }

                    //If TargetExistsSameFile is FALSE
                    if (!TargetExistsSameFile)
                    {
                        if (gfileTypeToOpen == FileType.DirectoryFile)
                        {
                            Helper.CaptureRequirement(3069, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                If RemoveTargetLink is TRUE:] If TargetExistsSameFile is FALSE:The operation MUST be failed with TATUS_ACCESS_DENIED
                                under any of the following conditions: If TargetLink.File.FileType is DirectoryFile.");
                            return MessageStatus.ACCESS_DENIED;
                        }

                        if ((gFileAttribute & FileAttribute.READONLY) != 0)
                        {
                            Helper.CaptureRequirement(3071, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                If RemoveTargetLink is TRUE: If TargetExistsSameFile is FALSE:The operation MUST be failed with TATUS_ACCESS_DENIED
                                under any of the following conditions:]If TargetLink.File.FileAttributes.FILE_ATTRIBUTE_READONLY is TRUE.");
                            return MessageStatus.ACCESS_DENIED;
                        }

                        //If TargetLink.IsDeleted is true
                        if (targetLinkDeleteType == TargetLinkDeleteType.TargetLinkIsDeleted)
                        {
                            Helper.CaptureRequirement(3072, @"[In FileRenameInformation,Pseudocode for the operation is as follows:If RemoveTargetLink is TRUE:
                                If TargetExistsSameFile is FALSE: ]If TargetLink.IsDeleted is TRUE, the operation MUST be failed with STATUS_DELETE_PENDING.");
                            return MessageStatus.DELETE_PENDING;
                        }

                        //If the caller does not have DELETE access to TargetLink.File
                        if ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.DELETE) == 0)
                        {
                            //If the caller does not have FILE_DELETE_CHILD access to DestinationDirectory
                            if ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.FILE_DELETE_CHILD) == 0)
                            {
                                Helper.CaptureRequirement(3073, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                    If RemoveTargetLink is TRUE: If TargetExistsSameFile is FALSE:] If the caller does not have DELETE access to
                                    TargetLink.File:If the caller does not have FILE_DELETE_CHILD access to DestinationDirectory:
                                    The operation MUST be failed with STATUS_ACCESS_DENIED.");
                                return MessageStatus.ACCESS_DENIED;
                            }
                        }

                        //If there was not an oplock to be broken and TargetLink.File.OpenList contains
                        //an Open with a Stream matching the current Stream
                        if (oplockBreakStatusType == OplockBreakStatusType.HasNoOplockBreak &&
                            targetLinkFileOpenListType == TargetLinkFileOpenListType.TargetLinkFileOpenListContainMatchedOpen)
                        {
                            Helper.CaptureRequirement(3075, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                If RemoveTargetLink is TRUE: If TargetExistsSameFile is FALSE: For each Stream on TargetLink.File ]
                                If there was not an oplock to be broken and TargetLink.File.OpenList contains an Open with a Stream matching the current Stream,
                                the operation MUST be failed with STATUS_ACCESS_DENIED.");
                            return MessageStatus.ACCESS_DENIED;
                        }
                    }
                }
            }

            //If AddTargetLink is true:
            if (AddTargetLink)
            {
                //The operation must be failed with STATUS_ACCESS_DENIED
                //if either of the following conditions are true: Open.File.FileType is DirectoryFile
                //and the caller does not have FILE_ADD_SUBDIRECTORY access on DestinationDirectory.
                if ((gfileTypeToOpen == FileType.DirectoryFile) && ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.FILE_ADD_SUBDIRECTORY) == 0))
                {
                    Helper.CaptureRequirement(3086, @"[In FileRenameInformation,Pseudocode for the operation is as follows:] If AddTargetLink is TRUE:
                        The operation must be failed with STATUS_ACCESS_DENIED if either of the following conditions are true:
                        Open.File.FileType is DirectoryFile and the caller does not have FILE_ADD_SUBDIRECTORY access on DestinationDirectory.");
                    return MessageStatus.ACCESS_DENIED;
                }

                //The operation MUST be failed with STATUS_ACCESS_DENIED if either of the following conditions are true: ]
                //Open.File.FileType is DataFile and the caller does not have FILE_ADD_FILE access on DestinationDirectory.
                if (gfileTypeToOpen == FileType.DataFile && ((gOpenGrantedAccess & FileAccess.FILE_ADD_FILE) == 0))
                {
                    Helper.CaptureRequirement(3087, @"[In FileRenameInformation,Pseudocode for the operation is as follows: If AddTargetLink is TRUE:
                        The operation MUST be failed with STATUS_ACCESS_DENIED if either of the following conditions are true: ]Open.File.FileType is DataFile
                        and the caller does not have FILE_ADD_FILE access on DestinationDirectory.");
                    return MessageStatus.ACCESS_DENIED;
                }
            }
            Helper.CaptureRequirement(3126, @"[In FileRenameInformation,Pseudocode for the operation is as follows:] The operation returns STATUS_SUCCESS.");
            return MessageStatus.SUCCESS;
        }