public static MessageStatus QueryFileSystemInfo(
            FileSystemInfoClass fileInfoClass,
            OutputBufferSize outBufSmall,
            out FsInfoByteCount byteCount)
        {
            byteCount = FsInfoByteCount.Zero;

            switch (fileInfoClass)
            {
                #region 3.1.5.12.1    FileFsVolumeInformation

            case (FileSystemInfoClass.File_FsVolumeInformation):
            {
                // If OutputBufferSize is smaller than BlockAlign( FieldOffset( FILE_FS_VOLUME_INFORMATION.VolumeLabel ), 8 )
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Helper.CaptureRequirement(2638, @"[In FileFsVolumeInformation]Pseudocode for the operation is as follows:
                                If OutputBufferSize is smaller than BlockAlign( FieldOffset( FILE_FS_VOLUME_INFORMATION.VolumeLabel ), 8 ), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Requirement.Capture(@"[2.1.5.12.1 FileFsVolumeInformation, Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return: ByteCount set to FieldOffset(FILE_FS_VOLUME_INFORMATION.VolumeLabel) + BytesToCopy.");
                byteCount = FsInfoByteCount.FieldOffset_FILE_FS_VOLUME_INFORMATION_VolumeLabel_Add_BytesToCopy;

                Requirement.Capture(@"[2.1.5.12.1 FileFsVolumeInformation, Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return: Status set to STATUS_BUFFER_OVERFLOW if BytesToCopy < OutputBuffer.VolumeLabelLength else STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }

                #endregion

                #region 3.1.5.12.2    FileFsLabelInformation //3.1.5.12.9    FileFsDriverPathInformation

            case (FileSystemInfoClass.File_FsLabelInformation):
            {
                Helper.CaptureRequirement(2751, @"[MS-FSCC] section 2.5, FileFsLabelInformation is intended for local use only. Query request does not match the usage, STATUS_INVALID_INFO_CLASS is returned.");
                return(MessageStatus.INVALID_INFO_CLASS);
            }

            case (FileSystemInfoClass.File_FsDriverPath_Information):
            {
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Requirement.Capture(@"[2.1.5.12.4   FileFsDeviceInformation, Pseudocode for the operation is as follows:]
                                If OutputBufferSize is smaller than sizeof(FILE_FS_DRIVER_INFORMATION), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Helper.CaptureRequirement(2764, @"[In FileFsDriverPathInformation]This operation MUST be failed with STATUS_NOT_SUPPORTED.");
                return(MessageStatus.NOT_SUPPORTED);
            }

                #endregion

                #region 3.1.5.12.3    FileFsSizeInformation //3.1.5.12.7    FileFsFullSizeInformation

            case (FileSystemInfoClass.File_FsSizeInformation):
            {
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Requirement.Capture(@"[2.1.5.12.3 FileFsSizeInformation] Pseudocode for the operation is as follows:
                                If OutputBufferSize is smaller than sizeof(FILE_FS_SIZE_INFORMATION), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Helper.CaptureRequirement(2672, @"[In FileFsSizeInformation, Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:ByteCount MUST be set to sizeof(FILE_FS_SIZE_INFORMATION).");
                byteCount = FsInfoByteCount.SizeOf_FILE_FS_SIZE_INFORMATION;

                Helper.CaptureRequirement(2673, @"[In FileFsSizeInformation, Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }

            case (FileSystemInfoClass.File_FsFullSize_Information):
            {
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Requirement.Capture(@"[2.1.5.12.7 FileFsFullSizeInformation] Pseudocode for the operation is as follows:
                                If OutputBufferSize is smaller than sizeof(FILE_FS_FULL_SIZE_INFORMATION), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Helper.CaptureRequirement(2729, @"[In FileFsFullSizeInformation,Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:ByteCount set to sizeof( FILE_FS_FULL_SIZE_INFORMATION ).");
                byteCount = FsInfoByteCount.SizeOf_FILE_FS_FULL_SIZE_INFORMATION;

                Helper.CaptureRequirement(2730, @"[In FileFsFullSizeInformation,Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }

                #endregion

                #region 3.1.5.12.4    FileFsDeviceInformation

            case (FileSystemInfoClass.File_FsDevice_Information):
            {
                // If OutputBufferSize is smaller than sizeof( FILE_FS_DEVICE_INFORMATION )
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Requirement.Capture(@"[2.1.5.12.4 FileFsDeviceInformation] Pseudocode for the operation is as follows: 
                                If OutputBufferSize is smaller than sizeof(FILE_FS_DEVICE_INFORMATION), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Helper.CaptureRequirement(2753, @"[In FileFsDeviceInformation,Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:ByteCount set to sizeof( FILE_FS_DEVICE_INFORMATION ).");
                byteCount = FsInfoByteCount.SizeOf_FILE_FS_DEVICE_INFORMATION;

                Helper.CaptureRequirement(2680, @"[In FileFsDeviceInformation,Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }

                #endregion

                #region 3.1.5.12.5    FileFsAttributeInformation
            case (FileSystemInfoClass.File_FsAttribute_Information):
            {
                //If OutputBufferSize is smaller than BlockAlign( FieldOffset( FILE_FS_ATTRIBUTE_INFORMATION.FileSystemName ), 4 )
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Helper.CaptureRequirement(2691, @"[In FileFsAttributeInformation]Pseudocode for the operation is as follows:
                                If OutputBufferSize is smaller than BlockAlign( FieldOffset( FILE_FS_ATTRIBUTE_INFORMATION.FileSystemName ), 4 ), 
                                the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Requirement.Capture(@"[2.1.5.12.5 FileFsAttributeInformation], Pseudocode for the operation is as follows:
                            Upon successful completion of the operation, the object store MUST return: ByteCount set to FieldOffset(FILE_FS_ATTRIBUTE_INFORMATION.FileSystemName) + BytesToCopy.");
                byteCount = FsInfoByteCount.FieldOffset_FILE_FS_ATTRIBUTE_INFORMATION_FileSystemName_Add_BytesToCopy;

                Requirement.Capture(@"[2.1.5.12.5 FileFsAttributeInformation], Pseudocode for the operation is as follows:
                            Upon successful completion of the operation, the object store MUST return: Status set to STATUS_BUFFER_OVERFLOW if BytesToCopy < OutputBuffer.FileSystemNameLength else STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }
                #endregion

                #region 3.1.5.12.6    FileFsControlInformation

            case (FileSystemInfoClass.File_FsControlInformation):
            {
                // If OutputBufferSize is smaller than BlockAlign( sizeof( FILE_FS_CONTROL_INFORMATION ), 8 )
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Helper.CaptureRequirement(2707, @"[In FileFsControlInformation] Pseudocode for the operation is as follows: 
                                If OutputBufferSize is smaller than BlockAlign( sizeof( FILE_FS_CONTROL_INFORMATION ), 8 ) the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                if (!gIsImplementQueryFileFsControlInformation)
                {
                    Helper.CaptureRequirement(7802, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] 
                                If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                    return(MessageStatus.INVALID_PARAMETER);
                }

                if (!gisQuotasSupported)
                {
                    Helper.CaptureRequirement(7803, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] 
                                If Open.File.Volume.IsQuotasSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED");
                    return(MessageStatus.VOLUME_NOT_UPGRADED);
                }

                Helper.CaptureRequirement(2715, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:] 
                            Upon successful completion of the operation, the object store MUST return:ByteCount set to sizeof(FILE_FS_CONTROL_INFORMATION).");
                byteCount = FsInfoByteCount.SizeOf_FILE_FS_CONTROL_INFORMATION;

                Helper.CaptureRequirement(2716, @"[In FileFsControlInformation,Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }

                #endregion

                #region 3.1.5.12.8    FileFsObjectIdInformation

            case (FileSystemInfoClass.File_FsObjectId_Information):
            {
                // If OutputBufferSize is less than the size of FILE_FS_OBJECTID_INFORMATION
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Helper.CaptureRequirement(2755, @"[In FileFsObjectIdInformation]Pseudocode for the operation is as follows:
                                If OutputBufferSize is less than sizeof( FILE_FS_OBJECTID_INFORMATION ), 
                                the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH.");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                if (!gIsImplementQueryFileFsObjectIdInformation)
                {
                    Helper.CaptureRequirement(4811, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] 
                                If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                    return(MessageStatus.INVALID_PARAMETER);
                }

                if (!gisObjectIDsSupported)
                {
                    Helper.CaptureRequirement(4812, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:] 
                                If Open.File.Volume.IsObjectIDsSupported is FALSE, the operation MUST be failed with STATUS_VOLUME_NOT_UPGRADED.");
                    return(MessageStatus.VOLUME_NOT_UPGRADED);
                }

                Helper.CaptureRequirement(2761, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:ByteCount set to sizeof( FILE_FS_OBJECTID_INFORMATION ).");
                byteCount = FsInfoByteCount.SizeOf_FILE_FS_OBJECTID_INFORMATION;

                Helper.CaptureRequirement(2762, @"[In FileFsObjectIdInformation,Pseudocode for the operation is as follows:]
                            Upon successful completion of the operation, the object store MUST return:Status set to STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }

                #endregion

                #region 2.1.5.12.10   FileFsSectorSizeInformation

            case (FileSystemInfoClass.File_FsSectorSizeInformation):
            {
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Requirement.Capture(@"[2.1.5.12.10 FileFsSectorSizeInformation], Pseudocode for the operation is as follows:
                                If OutputBufferSize is smaller than sizeof(FILE_FS_SECTOR_SIZE_INFORMATION), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Requirement.Capture(@"[2.1.5.12.10 FileFsSectorSizeInformation], Pseudocode for the operation is as follows:
                            Upon successful completion of the operation, the object store MUST return: ByteCount set to the size of the FILE_FS_SECTOR_SIZE_INFORMATION structure.");
                byteCount = FsInfoByteCount.SizeOf_FILE_FS_SECTOR_SIZE_INFORMATION;

                Requirement.Capture(@"[2.1.5.12.10 FileFsSectorSizeInformation], Pseudocode for the operation is as follows:
                            Upon successful completion of the operation, the object store MUST return: Status set to STATUS_SUCCESS.");
                return(MessageStatus.SUCCESS);
            }

                #endregion

                #region Information Class which is not defined in MS-FSCC
            case FileSystemInfoClass.Zero:
            {
                Requirement.Capture(@"[MS-FSCC 2.5 File System Information Classes] If an Information Class is specified that does not match the usage in the above table, STATUS_INVALID_INFO_CLASS MUST be returned.");
                return(MessageStatus.INVALID_INFO_CLASS);
            }

            case FileSystemInfoClass.NOT_DEFINED_IN_FSCC:
            {
                if (outBufSmall == OutputBufferSize.LessThan)
                {
                    Requirement.Capture(@"Negative test with artificial FileSystemInfoClass.NOT_DEFINED_IN_FSCC:
                                If OutputBufferSize is smaller than sizeof(NOT_DEFINED_IN_FSCC), the operation MUST be failed with STATUS_INFO_LENGTH_MISMATCH");
                    return(MessageStatus.INFO_LENGTH_MISMATCH);
                }

                Requirement.Capture(@"[MS-SMB2 section 3.3.5.20.2 Handling SMB2_0_INFO_FILESYSTEM] If the store does not support the data requested, the server MUST fail the request with STATUS_NOT_SUPPORTED.");
                return(MessageStatus.NOT_SUPPORTED);
            }
                #endregion

            default:
                break;
            }

            Helper.CaptureRequirement(2630, @"[In Application Requests a Query of File System Information]On completion, the object store MUST return:
                [Status,OutputBuffer,ByteCount].");
            return(MessageStatus.SUCCESS);
        }
        public static MessageStatus ByteRangeLock(
            long FileOffset,
            long Length,
            bool ExclusiveLock,
            bool failImmediately,
            bool isOpenNotEqual
            )
        {
            if (gStreamType == StreamType.DirectoryStream)
            {
                Helper.CaptureRequirement(904, @"[In Server Requests a Byte-Range Lock]Pseudocode for the operation is as follows:
                    If Open.Stream.StreamType is DirectoryStream, return STATUS_INVALID_PARAMETER, as byte range locks are not permitted on directories.");
                return(MessageStatus.INVALID_PARAMETER);
            }

            if (gLockOffset >= 0 &&
                gLockLength > 0 &&
                FileOffset > gLockOffset &&
                (FileOffset + Length) > (gLockOffset + gLockLength) && // Lock range conflict
                gLockIsExclusive &&
                !isOpenNotEqual)
            {
                if (failImmediately)
                {
                    Requirement.Capture(@"[2.1.5.7 Server Requests a Byte-Range Lock, Pseudocode for the operation is as follows:]
                        The object store MUST check for byte range lock conflicts by using the algorithm described in section 2.1.4.10, 
                        with ByteOffset set to FileOffset, Length set to Length, IsExclusive set to ExclusiveLock, LockIntent set to TRUE, and Open set to Open. 
                        If a conflict is detected, then:
                            If a conflict is detected, then:If FailImmediately is TRUE, the operation MUST be failed with STATUS_LOCK_NOT_GRANTED.");
                    return(MessageStatus.LOCK_NOT_GRANTED);
                }
                else
                {
                    //call 3.1.5.19
                    if (!sequenceIORequest.Contains(IORequest.ByteRangeLock))
                    {
                        sequenceIORequest.Add(IORequest.ByteRangeLock);
                        CancelinganOperation(IORequest.ByteRangeLock);
                    }
                }
            }

            //Initialize a new ByteRangeLock
            ByteRangeLock byteRangeLock = new ByteRangeLock();

            byteRangeLock.IsExclusive = ExclusiveLock;
            byteRangeLock.LockLength  = Length;
            byteRangeLock.LockOffset  = FileOffset;

            gLockIsExclusive = ExclusiveLock;
            gLockOffset      = FileOffset;
            gLockLength      = Length;

            ByteRangeLockList.Add(byteRangeLock);

            Helper.CaptureRequirement(903, @"[In Server Requests a Byte-Range Lock]On completion, the object store MUST return:Status:
                An NTSTATUS code that specifies the result.");
            Helper.CaptureRequirement(919, @"[In Server Requests a Byte-Range Lock,,Pseudocode for the operation is as follows:
                if the operation succeeds]Complete this operation with STATUS_SUCCESS.");
            return(MessageStatus.SUCCESS);
        }