private void FsInfo_Query_FileFsSizeInformation_SectorsPerAllocationUnit(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 FileFsSizeInformation long byteCount; byte[] outputBuffer = new byte[0]; FileFsSizeInformation fsSizeInfo = new FileFsSizeInformation(); uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileFsSizeInformation>(fsSizeInfo).Length; BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query FileFsSizeInformation"); status = this.fsaAdapter.QueryFileSystemInformation(FileSystemInfoClass.File_FsSizeInformation, outputBufferSize, out byteCount, out outputBuffer); //Step 3: Verify test result BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify OutputBuffer.SectorsPerAllocationUnit"); fsSizeInfo = TypeMarshal.ToStruct<FileFsSizeInformation>(outputBuffer); uint expectedSectorsPerAllocationUnit = this.fsaAdapter.ClusterSizeInKB * 1024 / fsSizeInfo.BytesPerSector; uint actualSectorsPerAllocationUnit = fsSizeInfo.SectorsPerAllocationUnit; BaseTestSite.Log.Add(LogEntryKind.Debug, "ClusterSize is " + this.fsaAdapter.ClusterSizeInKB + " KB."); BaseTestSite.Log.Add(LogEntryKind.Debug, "BytesPerSector is " + fsSizeInfo.BytesPerSector + " bytes."); this.fsaAdapter.AssertAreEqual(this.Manager, expectedSectorsPerAllocationUnit, actualSectorsPerAllocationUnit, "OutputBuffer.SectorsPerAllocationUnit set to Open.File.Volume.ClusterSize / Open.File.Volume.LogicalBytesPerSector."); }
/// <summary> /// Verify the fields of structure FileFsSizeInformation /// </summary> /// <param name="info">the instance of FILE_FS_SIZE_INFORMATION</param> /// <param name="isPerUserQuotasUsed">FILE_VOLUME_QUOTAS in FileSystemAttributes indicate that the file system /// supports per-user quotas.</param> /// <param name="expectedTotalFreeAllocationUnits">the the total number of free allocation units on the disk</param> public void VerifyDataTypeFileFsSizeInformationField(FileFsSizeInformation info, bool isPerUserQuotasUsed, uint expectedTotalFreeAllocationUnits) { Site.DefaultProtocolDocShortName = "MS-FSCC"; string ServerOS = Site.Properties["ServerOSPlatform"]; if (ServerOS == "Win2k" || ServerOS == "WinXP" || ServerOS == "Win2k3" || ServerOS == "WinVista" || ServerOS == "Win2k8") { if (isPerUserQuotasUsed) { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1985. ActualAvailableAllocationUnits: {0}", info.ActualAvailableAllocationUnits); // // Verify MS-FSCC requirement: MS-FSCC_R1985 // bool isVerifyR1985 = (info.ActualAvailableAllocationUnits < expectedTotalFreeAllocationUnits); Site.CaptureRequirementIfIsTrue( isVerifyR1985, 1985, @"<90> Section 2.5.7: In Windows 2000, Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008, if per-user quotas are in use, this value[ActualAvailableAllocationUnits] may be less than the total number of free allocation units on the disk."); } } Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }
/// <summary> /// Verify data type FileFsSizeInformation /// </summary> /// <param name="fileFsSizeInformation"> FileFsSizeInformation data type </param> /// <param name="sectorsPerAllocationUnit"> A 32-bit unsigned integer that contains the number of sectors in each allocation unit. </param> /// <param name="bytesPerSector"> A 32-bit unsigned integer that contains the number of bytes in each sector. </param> public void VerifyDataTypeFileFsSizeInformation( FileFsSizeInformation fileFsSizeInformation, uint sectorsPerAllocationUnit, uint bytesPerSector) { Site.DefaultProtocolDocShortName = "MS-FSCC"; // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1787"); // // Verify requirement 1787 // Site.CaptureRequirementIfAreEqual<Type>( typeof(FileFsSizeInformation), fileFsSizeInformation.GetType(), 1787, @"The message[FileFsSizeInformation] contains a FILE_FS_SIZE_INFORMATION data element."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1789 "); // // Verify requirement 1789 // Site.CaptureRequirementIfAreEqual<Type>( typeof(Int64), fileFsSizeInformation.TotalAllocationUnits.GetType(), 1789, @"[In FILE_FS_SIZE_INFORMATION]TotalAllocationUnits (8 bytes): A 64-bit signed integer that contains the total number of allocation units on the volume that are available to the user associated with the calling thread."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1790 Actual TotalAllocationUnits: {0}", fileFsSizeInformation.TotalAllocationUnits); // // Verify requirement 1790 // Site.CaptureRequirementIfIsTrue( fileFsSizeInformation.TotalAllocationUnits >= 0, 1790, @"[In FILE_FS_SIZE_INFORMATION]TotalAllocationUnits (8 bytes): This value MUST be greater than or equal to 0.<89>"); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1791"); // // Verify requirement 1791 // Site.CaptureRequirementIfAreEqual<Type>( typeof(Int64), fileFsSizeInformation.ActualAvailableAllocationUnits.GetType(), 1791, @"[In FILE_FS_SIZE_INFORMATION]ActualAvailableAllocationUnits (8 bytes): A 64-bit signed integer that contains the total number of free allocation units on the volume that are available to the user associated with the calling thread."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1792 Actual ActualAvailableAllocationUnits: {0}", fileFsSizeInformation.ActualAvailableAllocationUnits); // // Verify requirement 1792 // Site.CaptureRequirementIfIsTrue( fileFsSizeInformation.ActualAvailableAllocationUnits >= 0, 1792, @"[In FILE_FS_SIZE_INFORMATION]ActualAvailableAllocationUnits (8 bytes): This value MUST be greater than or equal to 0.<90>"); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1793 Actual SectorsPerAllocationUnit: {0}, Expected SectorsPerAllocationUnit: {1}.", fileFsSizeInformation.SectorsPerAllocationUnit, sectorsPerAllocationUnit); // // Verify requirement 1793 // // Verify type and value of SectorsPerAllocationUnit bool isVerifyR1793 = ( fileFsSizeInformation.SectorsPerAllocationUnit.GetType() == typeof(UInt32) && fileFsSizeInformation.SectorsPerAllocationUnit == sectorsPerAllocationUnit); Site.CaptureRequirementIfIsTrue( isVerifyR1793, 1793, @"[In FILE_FS_SIZE_INFORMATION]SectorsPerAllocationUnit (4 bytes): A 32-bit unsigned integer that contains the number of sectors in each allocation unit."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1794 Actual BytesPerSector: {0}, Expected BytesPerSector: {1}.", fileFsSizeInformation.BytesPerSector, bytesPerSector); // // Verify requirement 1794 // // Verify type and value of BytesPerSector bool isVerifyR1794 = ( fileFsSizeInformation.BytesPerSector.GetType() == typeof(UInt32) && fileFsSizeInformation.BytesPerSector == bytesPerSector); Site.CaptureRequirementIfIsTrue( isVerifyR1794, 1794, @"[In FILE_FS_SIZE_INFORMATION]BytesPerSector (4 bytes): A 32-bit unsigned integer that contains the number of bytes in each sector."); Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }