private void FsInfo_Query_FileFsObjectIdInformation_IsObjectIdSupported(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 FileFsObjectIdInformation long byteCount; byte[] outputBuffer = new byte[0]; FileFsObjectIdInformation fsObjectIdInfo = new FileFsObjectIdInformation(); fsObjectIdInfo.ObjectId = Guid.NewGuid(); fsObjectIdInfo.ExtendedInfo = new byte[48]; uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileFsObjectIdInformation>(fsObjectIdInfo).Length; BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query FileFsObjectIdInformation"); status = this.fsaAdapter.QueryFileSystemInformation(FileSystemInfoClass.File_FsObjectId_Information, outputBufferSize, out byteCount, out outputBuffer); //Step 3: Verify test result BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTStatus code."); if (this.fsaAdapter.IsObjectIDsSupported == false) { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_PARAMETER, status, "If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_PARAMETER."); } else { if (status == MessageStatus.OBJECT_NAME_NOT_FOUND) { BaseTestSite.Log.Add(LogEntryKind.Debug, "If Open.File.Volume.VolumeId is empty, the operation MUST be failed with STATUS_OBJECT_NAME_NOT_FOUND."); } else { this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "Status set to STATUS_SUCCESS."); } } }
/// <summary> /// Verify data type FileFsObjectIdInformation /// </summary> /// <param name="fileFsObjectIdInformation"> FileFsObjectIdInformation type data </param> /// <param name="isNoExInfoWritten"> If no extended information has been written for this file system volume </param> public void VerifyDataTypeFileFsObjectIdInformation( FileFsObjectIdInformation fileFsObjectIdInformation, bool isNoExInfoWritten) { Site.DefaultProtocolDocShortName = "MS-FSCC"; // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1780"); // // Verify requirement 1780 // Site.CaptureRequirementIfAreEqual<Type>( typeof(FileFsObjectIdInformation), fileFsObjectIdInformation.GetType(), 1780, @"The message[FileFsObjectIdInformation] contains a FILE_FS_OBJECTID_INFORMATION data element."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1782 Actual ObjectId is : {0}", fileFsObjectIdInformation.ObjectId); // // Verify requirement 1782 // // Verify the type and the size of the ObjectId // As the ObjectId is defined by users, so it's unable for us to check if the id // really identifies the file system volume on the disk Site.CaptureRequirementIfAreEqual<Type>( typeof(Guid), fileFsObjectIdInformation.ObjectId.GetType(), 1782, @"[In FILE_FS_OBJECTID_INFORMATION]ObjectId (16 bytes): A 16-byte GUID that identifies the file system volume on the disk."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1784 Actual ExtendedInfo is : {0}", fileFsObjectIdInformation.ExtendedInfo); // // Verify requirement 1784 // // As the extended information on the file system volume is not clear in this rs // We only verify the size of the ExtendedInfo here Site.CaptureRequirementIfAreEqual<int>( 48, fileFsObjectIdInformation.ExtendedInfo.Length, 1784, @"[In FILE_FS_OBJECTID_INFORMATION]ExtendedInfo (48 bytes): A 48-byte value containing extended information on the file system volume."); // If no extended information has been written for this file system volume if (isNoExInfoWritten) { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1785 Actual size of ExtendedInfo: {0}, Expected size of ExtendedInfo: {1}.", fileFsObjectIdInformation.ExtendedInfo.Length, 48); // // Verify requirement 1785 // // Verify the value of the ExtendedInfo, when no extended information has been written for this file // system volume bool isVerifyR1785 = true; for (int i = 0; i < fileFsObjectIdInformation.ExtendedInfo.Length; ++i) { if (fileFsObjectIdInformation.ExtendedInfo[i] != 0x00) { isVerifyR1785 = false; break; } } Site.CaptureRequirementIfIsTrue( isVerifyR1785, 1785, @"[In FILE_FS_OBJECTID_INFORMATION]ExtendedInfo (48 bytes): If no extended information has been written for this file system volume, the server MUST return 48 bytes of 0x00 in this field.<88>"); } // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1783 Actual type of ObjectId: {0}", BytesToString(fileFsObjectIdInformation.ObjectId.ToByteArray())); // // Verify requirement 1783 // // Since the ObjectId is not required to be unique on the system. // We only verify the size of the obejctId Site.CaptureRequirementIfAreEqual<int>( 16, Marshal.SizeOf(fileFsObjectIdInformation.ObjectId), 1783, @"[In FILE_FS_OBJECTID_INFORMATION]ObjectId (16 bytes): This value is not required to be unique on the system."); Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }
/// <summary> /// Verify the return of the FileFsObjectIdInformation query /// </summary> /// <param name="info"> the instance of FileFsObjectIdInformation</param> /// <param name="returnedStatusCode">the returned status code</param> /// <param name="typeOfFileSystem">the type of file system: NTFS, FAT, exFAT or others</param> public void VerifyResponseForFileFsObjectIdInformationQuery(FileFsObjectIdInformation info, uint returnedStatusCode, string typeOfFileSystem) { Site.DefaultProtocolDocShortName = "MS-FSCC"; if (bool.Parse(Site.Properties["SUT.Platform.OS.isWindows"])) { if (typeOfFileSystem == "FAT") { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1982"); // // Verify MS-FSCC requirement: MS-FSCC_R1982 // // STATUS_INVALID_DEVICE_REQUEST 0xC0000010, as specified in [MS-ERREF] section 2.3 Site.CaptureRequirementIfAreEqual<uint>( 0xC0000010, returnedStatusCode, 1982, @"<87> Section 2.5.6: The Microsoft FAT file system does not support the use of object IDs, and returns a status code of STATUS_INVALID_DEVICE_REQUEST."); } // // Verify MS-FSCC requirement: MS-FSCC_R1983 // bool isVerifyR1983 = true; // the length of ExtendedInfo is fixed 48 bytes if (info.ExtendedInfo.Length != 48) { isVerifyR1983 = false; // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1983. The length of ExtendedInfo: {0}", info.ExtendedInfo.Length); } else { // not write information means 48 bytes of 0x00 in this field for (int i = 0; i < 48; i++) { if (info.ExtendedInfo[i] != 0x00) { // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1983. ExtendedInfo[{0}] : {1}", i, info.ExtendedInfo[i]); isVerifyR1983 = false; break; } } } Site.CaptureRequirementIfIsTrue( isVerifyR1983, 1983, @"<88> Section 2.5.6: Windows does not write information into the ExtendedInfo field for file systems."); } Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }