Beispiel #1
0
        // Query a directory and get output buffer information
        private FileBothDirectoryInformation[] Query_Directory_Information(string dirName)
        {
            MessageStatus status;
            uint          treeId = 0;
            FILEID        fileId;
            ulong         sessionId = 0;

            byte[] outputBuffer;
            BaseTestSite.Log.Add(LogEntryKind.TestStep, $"Query directory with name {dirName}");

            status = this.fsaAdapter.CreateFile(
                dirName,
                FileAttribute.DIRECTORY,
                CreateOptions.DIRECTORY_FILE,
                (FileAccess.GENERIC_READ | FileAccess.GENERIC_WRITE),
                (ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE),
                CreateDisposition.OPEN_IF,
                out fileId,
                out treeId,
                out sessionId);

            this.fsaAdapter.QueryDirectory(fileId, treeId, sessionId, "*", FileInfoClass.FILE_BOTH_DIR_INFORMATION,
                                           false, true, out outputBuffer);
            FileBothDirectoryInformation[] directoryInformation = FsaUtility.UnmarshalFileInformationArray <FileBothDirectoryInformation>(outputBuffer);
            BaseTestSite.Log.Add(LogEntryKind.TestStep, $"Dirctory query result returns  status {status}");

            Site.Assert.AreEqual(".", Encoding.Unicode.GetString(directoryInformation[0].FileName), "FileName of the first entry should be \".\".");
            Site.Assert.AreEqual("..", Encoding.Unicode.GetString(directoryInformation[1].FileName), "FileName of the second entry should be \"..\".");
            Site.Assert.IsTrue(IsChangeTimeValid(directoryInformation), "This value MUST be greater than or equal to 0");
            Site.Assert.IsTrue(IsLastAccessTimeValid(directoryInformation), "This value MUST be greater than or equal to 0");
            Site.Assert.IsTrue(IsLastWriteTimeValid(directoryInformation), "This value MUST be greater than or equal to 0");

            return(directoryInformation);
        }
        public void BVT_QueryDirectoryBySearchPattern <T>(
            T[] FileInformation,
            FileInfoClass FileInformationClass,
            string WildCard,
            int FilesInDirectoryCount,
            int ExpectedFilesReturnedLength
            )
            where T : struct
        {
            byte[]        outputBuffer;
            List <string> fileNames;

            int filesCount; // Count files returned from the query, that exist in the FileNames list

            fileNames    = CreateRandomFileNames(FilesInDirectoryCount);
            outputBuffer = QueryByWildCardAndFileInfoClass(WildCard, FileInformationClass, fileNames);

            FileInformation = FsaUtility.UnmarshalFileInformationArray <T>(outputBuffer);
            dynamic dynamicFileInformationObject = FileInformation;

            filesCount = fileNames.Intersect(GetListFileInformation <T>(FileInformation)).ToList().Count();

            Site.Assert.AreEqual(ExpectedFilesReturnedLength, FileInformation.Length, $"The returned Buffer should contain {ExpectedFilesReturnedLength} entries of FileInformation.");
            Site.Assert.AreEqual(".", Encoding.Unicode.GetString(dynamicFileInformationObject[0].FileName), "FileName of the first entry should be \".\".");
            Site.Assert.AreEqual("..", Encoding.Unicode.GetString(dynamicFileInformationObject[1].FileName), "FileName of the second entry should be \"..\".");
            Site.Assert.AreEqual(FilesInDirectoryCount, filesCount, $"Number of files created should be equal to the number of files returned: {FilesInDirectoryCount}.");
        }
Beispiel #3
0
        private void FsCtl_Get_IntegrityInformation_OutputValue_Common(FileType fileType)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
            MessageStatus status;

            //Step 1: Create file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
            status = this.fsaAdapter.CreateFile(fileType);

            //Step 2: FSCTL Request with FSCTL_GET_INTEGRITY_INFORMATION
            FSCTL_GET_INTEGRITY_INFORMATION_BUFFER integrityInfo = new FSCTL_GET_INTEGRITY_INFORMATION_BUFFER();
            uint outputBufferSize = (uint)TypeMarshal.ToBytes <FSCTL_GET_INTEGRITY_INFORMATION_BUFFER>(integrityInfo).Length;

            long bytesReturned;

            byte[] outputBuffer = new byte[0];
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. FSCTL Request with FSCTL_GET_INTEGRITY_INFORMATION.");
            status = this.fsaAdapter.FsCtlGetIntegrityInfo(outputBufferSize, out bytesReturned, out outputBuffer);

            //Step 3: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify test result.");
            // Check if Integrity is supported
            if (!IsCurrentTransportSupportIntegrity(status))
            {
                return;
            }

            if (this.fsaAdapter.IsIntegritySupported == false)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status, "If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
                return;
            }

            // Check output result
            integrityInfo = TypeMarshal.ToStruct <FSCTL_GET_INTEGRITY_INFORMATION_BUFFER>(outputBuffer);

            BaseTestSite.Log.Add(LogEntryKind.Debug, "3.1. Verify OutputBuffer.CheckSumAlgorithm.");
            bool isCheckSumAlgorithmCorrect = FsaUtility.IsOneOfExpectedChecksumAlgorithm(integrityInfo.ChecksumAlgorithm);

            this.fsaAdapter.AssertAreEqual(this.Manager, true, isCheckSumAlgorithmCorrect,
                                           "The object store MUST set OutputBuffer.CheckSumAlgorithm to one of the values for ChecksumAlgorithm.");

            BaseTestSite.Log.Add(LogEntryKind.Debug, "3.2. Verify OutputBuffer.ClusterSizeInBytes.");
            BaseTestSite.Log.Add(LogEntryKind.Debug, "Expected ClusterSizeInBytes: " + (this.fsaAdapter.ClusterSizeInKB * 1024));
            BaseTestSite.Log.Add(LogEntryKind.Debug, "Actual ClusterSizeInBytes: " + integrityInfo.ClusterSizeInBytes);
            string comment = string.Format("The default clusterSize for {0} is {1} KB.", this.fsaAdapter.FileSystem.ToString(), this.fsaAdapter.ClusterSizeInKB.ToString());

            this.fsaAdapter.AssertAreEqual(this.Manager, this.fsaAdapter.ClusterSizeInKB * 1024, integrityInfo.ClusterSizeInBytes, comment);

            BaseTestSite.Log.Add(LogEntryKind.Debug, "3.3. Verify CHECKSUM_ENFORCEMENT_OFF flag.");
            bool isChecksumEnforcementSet = ((integrityInfo.Flags & FSCTL_GET_INTEGRITY_INFORMATION_BUFFER_FLAGS.FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF) != FSCTL_GET_INTEGRITY_INFORMATION_BUFFER_FLAGS.FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF);

            this.fsaAdapter.AssertAreEqual(this.Manager, true, isChecksumEnforcementSet,
                                           "If Open.Stream.StreamType is not data stream, the object store should not set OutputBuffer.Flags to CHECKSUM_ENFORCEMENT_OFF.");
        }
        public void BVT_QueryDirectory_FileBothDirectoryInformation()
        {
            byte[] outputBuffer;
            string fileName;
            FILEID dirFileId;

            PrepareAndQueryDirectory(FileInfoClass.FILE_BOTH_DIR_INFORMATION, out outputBuffer, out fileName, out dirFileId);

            Site.Log.Add(LogEntryKind.Debug, "Start to verify the Query Directory response.");
            FileBothDirectoryInformation[] directoryInformation = FsaUtility.UnmarshalFileInformationArray <FileBothDirectoryInformation>(outputBuffer);
            Site.Assert.AreEqual(3, directoryInformation.Length, "The returned Buffer should contain 3 entries of FileBothDirectoryInformation.");
            VerifyFileInformation(directoryInformation[0], 1, ".", FileAttribute.DIRECTORY, 0, 0, 0, "");
            VerifyFileInformation(directoryInformation[1], 2, "..", FileAttribute.DIRECTORY, 0, 0, 0, "", false);
            VerifyFileInformation(directoryInformation[2], 3, fileName, FileAttribute.ARCHIVE, BytesToWrite, this.fsaAdapter.ClusterSizeInKB * 1024, 0, GetShortName(fileName));
        }
        public void BVT_QueryDirectory_FileNamesInformation()
        {
            byte[] outputBuffer;
            string fileName;
            FILEID dirFileId;

            PrepareAndQueryDirectory(FileInfoClass.FILE_NAMES_INFORMATION, out outputBuffer, out fileName, out dirFileId);

            Site.Log.Add(LogEntryKind.Debug, "Start to verify the Query Directory response.");
            FileNamesInformation[] namesInformation = FsaUtility.UnmarshalFileInformationArray <FileNamesInformation>(outputBuffer);
            Site.Assert.AreEqual(3, namesInformation.Length, "The returned Buffer should contain two entries of FileNamesInformation.");
            Site.Assert.AreEqual(".", Encoding.Unicode.GetString(namesInformation[0].FileName), "FileName of the first entry should be \".\".");
            Site.Assert.AreEqual("..", Encoding.Unicode.GetString(namesInformation[1].FileName), "FileName of the second entry should be \"..\".");
            Site.Assert.AreEqual(fileName, Encoding.Unicode.GetString(namesInformation[2].FileName), $"FileName of the third entry should be {fileName}.");
        }
        private void QueryFileIdGlobalTxDirectoryInformationTimestamp(
            byte[] informationBuffer, int expectedEntryCount,
            out long changeTime, out long creationTime,
            out long lastAccessTime, out long lastWriteTime)
        {
            string fileName = ".";

            FileIdGlobalTxDirectoryInformation[] directoryInformation = FsaUtility.UnmarshalFileInformationArray <FileIdGlobalTxDirectoryInformation>(informationBuffer);

            Site.Assert.AreEqual(expectedEntryCount, directoryInformation.Length, $"The buffer should contain {expectedEntryCount} entries of FileIdGlobalTxDirectoryInformation.");
            Site.Assert.AreEqual(fileName, Encoding.Unicode.GetString(directoryInformation[0].FileName), $"FileName should be {fileName}.");

            changeTime     = FileTimeToLong(directoryInformation[0].FileCommonDirectoryInformation.ChangeTime);
            creationTime   = FileTimeToLong(directoryInformation[0].FileCommonDirectoryInformation.CreationTime);
            lastAccessTime = FileTimeToLong(directoryInformation[0].FileCommonDirectoryInformation.LastAccessTime);
            lastWriteTime  = FileTimeToLong(directoryInformation[0].FileCommonDirectoryInformation.LastWriteTime);
        }
        public void BVT_QueryDirectory_FileIdBothDirectoryInformation()
        {
            byte[] outputBuffer;
            string fileName;
            FILEID dirFileId;

            PrepareAndQueryDirectory(FileInfoClass.FILE_ID_BOTH_DIR_INFORMATION, out outputBuffer, out fileName, out dirFileId);

            Site.Log.Add(LogEntryKind.Debug, "Start to verify the Query Directory response.");
            FileIdBothDirectoryInformation[] directoryInformation = FsaUtility.UnmarshalFileInformationArray <FileIdBothDirectoryInformation>(outputBuffer);
            Site.Assert.AreEqual(3, directoryInformation.Length, "The returned Buffer should contain 3 entries of FileBothDirectoryInformation.");

            VerifyFileInformation(directoryInformation[0], 1, ".", FileAttribute.DIRECTORY, 0, 0, 0, "");
            if (this.fsaAdapter.Is64bitFileIdSupported)
            {
                Site.Assert.AreNotEqual(0, directoryInformation[0].FileId, "FileId of the entry should not be 0.");
            }
            else
            {
                //For file systems that do not support a 64 - bit file ID, this field MUST be set to 0, and MUST be ignored.
                Site.Assert.AreEqual(0, directoryInformation[0].FileId, "FileId of the entry should be 0 if the file system does not support a 64-bit file ID.");
            }

            VerifyFileInformation(directoryInformation[1], 2, "..", FileAttribute.DIRECTORY, 0, 0, 0, "", false);
            //The NTFS, ReFS, FAT, and exFAT file systems return a FileId value of 0 for the entry named ".." in directory query operations.
            if (this.fsaAdapter.FileSystem == FileSystem.NTFS || this.fsaAdapter.FileSystem == FileSystem.REFS || this.fsaAdapter.FileSystem == FileSystem.FAT ||
                this.fsaAdapter.FileSystem == FileSystem.EXFAT)
            {
                Site.Assert.AreEqual(0, directoryInformation[1].FileId, "FileId of the entry should be 0.");
            }

            VerifyFileInformation(directoryInformation[2], 3, fileName, FileAttribute.ARCHIVE, BytesToWrite, this.fsaAdapter.ClusterSizeInKB * 1024, 0, GetShortName(fileName));
            if (this.fsaAdapter.Is64bitFileIdSupported)
            {
                Site.Assert.AreNotEqual(0, directoryInformation[2].FileId, "FileId of the entry should not be 0.");
            }
            else
            {
                //For file systems that do not support a 64 - bit file ID, this field MUST be set to 0, and MUST be ignored.
                Site.Assert.AreEqual(0, directoryInformation[2].FileId, "FileId of the entry should be 0 if the file system does not support a 64-bit file ID.");
            }
        }
        public void BVT_QueryDirectoryBySearchPattern <T>(
            T[] FileInformation,
            FileInfoClass FileInformationClass,
            List <string> FileNames,
            string WildCard,
            int ExpectedFilesReturnedLength
            )
            where T : struct
        {
            byte[] outputBuffer;

            int filesCount; // Count files returned from the query, that exist in the FileNames list

            outputBuffer    = QueryByWildCardAndFileInfoClass(WildCard, FileInformationClass, FileNames);
            FileInformation = FsaUtility.UnmarshalFileInformationArray <T>(outputBuffer);
            dynamic dynamicFileInformationObject = FileInformation;

            filesCount = FileNames.Intersect(GetListFileInformation <T>(FileInformation)).ToList().Count();

            Site.Assert.AreEqual(ExpectedFilesReturnedLength, FileInformation.Length, $"The returned Buffer should contain {ExpectedFilesReturnedLength} entries of FileInformation.");
            Site.Assert.AreEqual(ExpectedFilesReturnedLength, filesCount, $"Number of files returned should match the number of files that match the pattern: {ExpectedFilesReturnedLength}.");
        }
        private void FsInfo_Query_FileFsSectorSizeInformation_OutputValue_Common(FileType fileType)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
            MessageStatus status;

            //Step 1: Create file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
            status = this.fsaAdapter.CreateFile(fileType);

            //Step 2: Query File_FsSectorSizeInformation
            FILE_FS_SECTOR_SIZE_INFORMATION fileFsSectorSizeInfo = new FILE_FS_SECTOR_SIZE_INFORMATION();
            uint outputBufferSize = (uint)TypeMarshal.ToBytes <FILE_FS_SECTOR_SIZE_INFORMATION>(fileFsSectorSizeInfo).Length;
            long byteCount;

            byte[] OutputBuffer = new byte[0];

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query File_FsSectorSizeInformation.");
            status = this.fsaAdapter.QueryFileSystemInformation(FileSystemInfoClass.File_FsSectorSizeInformation, outputBufferSize, out byteCount, out OutputBuffer);

            //Step 3: Print some output values
            fileFsSectorSizeInfo = TypeMarshal.ToStruct <FILE_FS_SECTOR_SIZE_INFORMATION>(OutputBuffer);
            uint systemPageSize = (this.fsaAdapter.SystemPageSizeInKB * 1024);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Print some output values");
            BaseTestSite.Log.Add(LogEntryKind.Debug, "SystemPageSize: " + systemPageSize);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "LogicalBytesPerSector: " + fileFsSectorSizeInfo.LogicalBytesPerSector);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "PhysicalBytesPerSectorForAtomicity: " + fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "PhysicalBytesPerSectorForPerformance: " + fileFsSectorSizeInfo.PhysicalBytesPerSectorForPerformance);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "FileSystemEffectivePhysicalBytesPerSectorForAtomicity: " + fileFsSectorSizeInfo.FileSystemEffectivePhysicalBytesPerSectorForAtomicity);

            //Step 4: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Verify server response.");
            //4.1. Verify LogicalBytesPerSector
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.1. Verify LogicalBytesPerSector.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "OutputBuffer.LogicalBytesPerSector set to Open.Volume.LogicalBytesPerSector.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "LogicalBytesPerSector MUST be a power of two and MUST be greater than or equal to 512 and less than or equal to Volume.SystemPageSize.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "According to above info, LogicalBytesPerSector will be set as following:");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, FsaUtility.IsPowerOfTwo(fileFsSectorSizeInfo.LogicalBytesPerSector), "It MUST be a power of two.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.LogicalBytesPerSector >= 512, "It MUST be greater than or equal to 512.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.LogicalBytesPerSector <= systemPageSize, "It MUST be less than or equal to Volume.SystemPageSize.");

            //4.2. Verify PhysicalBytesPerSectorForAtomicity
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.2. Verify PhysicalBytesPerSectorForAtomicity.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "Set OutputBuffer.PhysicalBytesPerSectorForAtomicity to the physical sector size reported from the storage device underlying the object store.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "PhysicalBytesPerSector MUST be a power of two, MUST be greater than or equal to 512 and less than or equal to Volume.SystemPageSize, and MUST be greater than or equal to Volume.LogicalBytesPerSector. ");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "According to above info, PhysicalBytesPerSectorForAtomicity will be set as following:");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, FsaUtility.IsPowerOfTwo(fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity), "It MUST be a power of two.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity >= 512, "It MUST be greater than or equal to 512.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity <= systemPageSize, "It MUST be less than or equal to Volume.SystemPageSize.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity >= fileFsSectorSizeInfo.LogicalBytesPerSector, "It MUST be greater than or equal to Volume.LogicalBytesPerSector.");

            //4.3. Verify PhysicalBytesPerSectorForPerformance
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.3. Verify PhysicalBytesPerSectorForPerformance.");
            this.fsaAdapter.AssertAreEqual(this.Manager, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity, fileFsSectorSizeInfo.PhysicalBytesPerSectorForPerformance,
                                           "OutputBuffer.PhysicalBytesPerSectorForPerformance is set to OutputBuffer.PhysicalBytesPerSectorForAtomicity.");

            //4.4. Verify FileSystemEffectivePhysicalBytesPerSectorForAtomicity
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.4. Verify FileSystemEffectivePhysicalBytesPerSectorForAtomicity.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "PhysicalBytesPerSectorForAtomicity: " + fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity);

            if (fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity > systemPageSize)
            {
                BaseTestSite.Log.Add(LogEntryKind.Comment, "If OutputBuffer.PhysicalBytesPerSectorForAtomicity is greater than Open.Volume.SystemPageSize:");
                BaseTestSite.Log.Add(LogEntryKind.Comment, "Set OutputBuffer.FileSystemEffectivePhysicalBytesPerSectorForAtomicity to Open.Volume.SystemPageSize.");
                this.fsaAdapter.AssertAreEqual(this.Manager, systemPageSize, fileFsSectorSizeInfo.FileSystemEffectivePhysicalBytesPerSectorForAtomicity, "");
            }
            else
            {
                BaseTestSite.Log.Add(LogEntryKind.Comment, "If OutputBuffer.PhysicalBytesPerSectorForAtomicity is less than or equal to Open.Volume.SystemPageSize:");
                BaseTestSite.Log.Add(LogEntryKind.Comment, "Set OutputBuffer.FileSystemEffectivePhysicalBytesPerSectorForAtomicity to OutputBuffer.PhysicalBytesPerSectorForAtomicity.");
                this.fsaAdapter.AssertAreEqual(this.Manager, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity, fileFsSectorSizeInfo.FileSystemEffectivePhysicalBytesPerSectorForAtomicity, "");
            }
        }
Beispiel #10
0
        public void QuotaInfo_Set_QuotaInformation_IsQuotaInfoSupported()
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
            MessageStatus status;

            //Step 1: Open Quota file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Open Quota file " + this.fsaAdapter.QuotaFile);
            status = this.fsaAdapter.CreateFile(
                this.fsaAdapter.QuotaFile,
                FileAttribute.NORMAL,
                CreateOptions.SYNCHRONOUS_IO_NONALERT,
                FileAccess.FILE_READ_DATA | FileAccess.FILE_WRITE_DATA |
                FileAccess.FILE_READ_ATTRIBUTES | FileAccess.FILE_WRITE_ATTRIBUTES | FileAccess.SYNCHRONIZE,
                ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE,
                CreateDisposition.OPEN);

            if (this.fsaAdapter.IsQuotaSupported == false)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, true,
                                               (status == MessageStatus.OBJECT_PATH_NOT_FOUND || status == MessageStatus.OBJECT_NAME_NOT_FOUND),
                                               "Quota file is not supported and expected to fail.");
                return;
            }

            //Step 2: Query Quota Information
            long byteCount;

            byte[] outputBuffer;
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query Quota Information.");
            if (this.fsaAdapter.Transport == Transport.SMB)
            {
                SMB_QUERY_QUOTA_INFO smbQueryQuotaInfo = new SMB_QUERY_QUOTA_INFO();
                smbQueryQuotaInfo.ReturnSingleEntry = 0;
                smbQueryQuotaInfo.RestartScan       = 1;
                smbQueryQuotaInfo.SidListLength     = 0;
                smbQueryQuotaInfo.StartSidLength    = 0;
                smbQueryQuotaInfo.StartSidOffset    = 0;


                status = this.fsaAdapter.QueryFileQuotaInformation(smbQueryQuotaInfo, 2048, out byteCount, out outputBuffer);
            }
            else
            {
                SMB2_QUERY_QUOTA_INFO smb2QueryQuotaInfo = new SMB2_QUERY_QUOTA_INFO();
                smb2QueryQuotaInfo.ReturnSingle   = 0;
                smb2QueryQuotaInfo.RestartScan    = 1;
                smb2QueryQuotaInfo.Reserved       = 0;
                smb2QueryQuotaInfo.SidListLength  = 0;
                smb2QueryQuotaInfo.StartSidLength = 0;
                smb2QueryQuotaInfo.StartSidOffset = 0;

                status = this.fsaAdapter.QueryFileQuotaInformation(smb2QueryQuotaInfo, 2048, out byteCount, out outputBuffer);
            }

            //Step 3: Set Quota Information
            FILE_QUOTA_INFORMATION[] fileQuotaInformationEntries = FsaUtility.UnmarshalFileInformationArray <FILE_QUOTA_INFORMATION>(outputBuffer);
            if (fileQuotaInformationEntries.Length > 0)
            {
                FILE_QUOTA_INFORMATION quotaEntry    = fileQuotaInformationEntries[0];
                FILE_QUOTA_INFORMATION fileQuotaInfo = new FILE_QUOTA_INFORMATION();
                fileQuotaInfo.NextEntryOffset = 0;
                fileQuotaInfo.SidLength       = (uint)quotaEntry.Sid.Length;
                fileQuotaInfo.ChangeTime      = new _FILETIME();
                fileQuotaInfo.QuotaUsed       = 0;
                fileQuotaInfo.QuotaThreshold  = 1024 * 1024; //Set warning Level 1MB
                fileQuotaInfo.QuotaLimit      = -1;
                fileQuotaInfo.Sid             = quotaEntry.Sid;

                BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Set Quota Information.");
                status = this.fsaAdapter.SetFileQuotaInformation(fileQuotaInfo);

                //Step 4: Verify test result
                BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify returned NTStatus code.");
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
                                               "Quota is supported, status set to STATUS_SUCCESS.");
            }
        }