/// <summary> /// Verify the message syntax in FileNameInformation /// </summary> /// <param name="fileNameInformation">A FileNameInformation type structure.</param> public void VerifyMessageSyntaxFileNameInformation( FileNameInformation fileNameInformation) { Site.DefaultProtocolDocShortName = "MS-FSCC"; // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1618,the length of FileName is {0}", fileNameInformation.FileName.Length); // // Verify MS-FSCC requirement: MS-FSCC_R1618 // // Eack unicode character occupy 2 bit, so the length must be an even number bool isVerifyR1618 = true; for (int index = 0; index < fileNameInformation.FileName.Length - 1; index++) { if (index % 2 != 0) { if (fileNameInformation.FileName[index] != 0) { isVerifyR1618 = false; break; } } } Site.CaptureRequirementIfIsTrue( isVerifyR1618, 1618, @"[In FILE_NAME_INFORMATION]FileName (variable): A sequence of Unicode characters containing the file name."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1674"); // // Verify MS-FSCC requirement: MS-FSCC_R1674 // Site.CaptureRequirementIfAreEqual<uint>( fileNameInformation.FileNameLength, (uint)fileNameInformation.FileName.Length, 1674, @"[In FILE_NAME_INFORMATION]FileName (variable): This field MUST be handled as a sequence of FileNameLength bytes."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1617,the value of FileNameLength is {0}", fileNameInformation.FileNameLength); // // Verify MS-FSCC requirement: MS-FSCC_R1617 // // 32 bits equal 4 bytes bool isVerifyR1617 = (Marshal.SizeOf(fileNameInformation.FileNameLength) == 4) && (fileNameInformation.FileNameLength == (uint)fileNameInformation.FileName.Length); Site.CaptureRequirementIfIsTrue( isVerifyR1617, 1617, @"[In FILE_NAME_INFORMATION]FileNameLength (4 bytes): A 32-bit unsigned integer that contains the length, in bytes, of the FileName field."); Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }
/// <summary> /// Verify the data type FileNameInformation /// </summary> /// <param name="fileNameInformation"> FileNameInformation type data </param> public void VerifyDataTypeFileNameInformation( FileNameInformation fileNameInformation) { Site.DefaultProtocolDocShortName = "MS-FSCC"; // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1413 Actual FileNameLength: {0}, Expected file name length: {1};", fileNameInformation.FileNameLength, fileNameInformation.FileName.Length); // // Verify MS-FSCC requirement 1413 // // Verify the type of the filenamelength and its content bool isVerifyR1413 = ((uint)fileNameInformation.FileName.Length == fileNameInformation.FileNameLength && fileNameInformation.FileNameLength.GetType() == typeof(UInt32)); Site.CaptureRequirementIfIsTrue( isVerifyR1413, 1413, @"[In FILE_NAME_INFORMATION]FileNameLength (4 bytes): A 32-bit unsigned integer that contains the length, in bytes, of the FileName field."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1414 Actual FileName: {0}", fileNameInformation.FileName); // // Verify MS-FSCC requirement 1414 // bool isVerifyR1414 = true; for (int index = 0; index < fileNameInformation.FileName.Length - 1; index++) { if (index % 2 != 0) { if (fileNameInformation.FileName[index] != 0) { isVerifyR1414 = false; break; } } } Site.CaptureRequirementIfIsTrue( isVerifyR1414, 1414, @"[In FILE_NAME_INFORMATION]FileName (variable): A sequence of Unicode characters containing the file name."); // // Add the debug information // Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1428 "); // // Verify MS-FSCC requirement 1428 // // We only verify the FileName contains FileNameLength bytes Site.CaptureRequirementIfAreEqual<int>( fileNameInformation.FileName.Length, (int)fileNameInformation.FileNameLength, 1428, @"[In FILE_NAME_INFORMATION]FileName (variable): This field MUST be handled as a sequence of FileNameLength bytes."); // As all the elements in the FILE_NAME_INFORMATION are verified above, // This rs will be captured directly Site.CaptureRequirement( 1412, @"[In FileNameInformation]The FILE_NAME_INFORMATION data element is as follows:[FileNameLength, FileName (variable)]."); Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"]; }