コード例 #1
0
        /// <summary>
        ///  Verify data type FileFsVolumeInformation
        /// </summary>
        /// <param name="fileFsVolumeInformation"> FileFsVolumeInformation type data </param>
        /// <param name="volumeSerialNumber"> A 32-bit unsigned integer that contains the serial number of the volume. </param>
        /// <param name="isSupportsOOFileSysObj"> If the file system supports object-oriented file system objects. </param>
        /// <param name="volumeLabel"> A variable-length Unicode field containing the name of the volume. </param>
        public void VerifyDataTypeFileFsVolumeInformationForOld(
            FileFsVolumeInformation fileFsVolumeInformation,
            uint volumeSerialNumber,
            bool isSupportsOOFileSysObj)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1796");
            //
            // Verify requirement 1796
            //
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(FileFsVolumeInformation),
                fileFsVolumeInformation.GetType(),
                1796,
                @"The message[FileFsVolumeInformation] contains a FILE_FS_VOLUME_INFORMATION data element.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1798 Actual VolumeCreationTime: {0}",
                fileFsVolumeInformation.VolumeCreationTime.ToString());
            //
            // Verify requirement 1798
            //
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(long),
                fileFsVolumeInformation.VolumeCreationTime.GetType(),
                1798,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeCreationTime (8 bytes):
                A 64-bit signed integer that contains the time when the volume was created in the format of a FILETIME structure.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1799 Actual VolumeCreationTime: {0}",
                fileFsVolumeInformation.VolumeCreationTime);
            //
            // Verify requirement 1799
            //
            Site.CaptureRequirementIfIsTrue(
                fileFsVolumeInformation.VolumeCreationTime >= 0,
                1799,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeCreationTime (8 bytes):
                The value of this field MUST be greater than or equal to 0.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1800 Actual VolumeSerialNumber: {0}, Expected VolumeSerialNumber: {1}.",
                fileFsVolumeInformation.VolumeSerialNumber, volumeSerialNumber);
            //
            // Verify requirement 1800
            //
            bool isVerifyR1800 = (
                fileFsVolumeInformation.VolumeSerialNumber.GetType() == typeof(UInt32) &&
                Marshal.SizeOf(fileFsVolumeInformation.VolumeSerialNumber) == 4);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1800,
                1800,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeSerialNumber (4 bytes):
                A 32-bit unsigned integer that contains the serial number of the volume.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1801");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1802 Actual VolumeSerialNumber: {0}",
                fileFsVolumeInformation.VolumeSerialNumber);
            //
            // Verify requirement 1802
            //
            // As no specific format or content of this field is required for protocol interoperation.
            // We only verify the size of the VolumeSerialNumber
            Site.CaptureRequirementIfAreEqual<int>(
                4,
                Marshal.SizeOf(fileFsVolumeInformation.VolumeSerialNumber),
                1802,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeSerialNumber (4 bytes):
                No specific format or content of this field is required for protocol interoperation.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1803 Actual VolumeSerialNumber: {0}",
                fileFsVolumeInformation.VolumeSerialNumber);
            //
            // Verify requirement 1803
            //
            // As this value is not required to be unique, alsp no specific format or content.
            // That means the value of volumeSerialNumber can be any value, we only the verify the size of it
            Site.CaptureRequirementIfAreEqual<int>(
                4,
                Marshal.SizeOf(fileFsVolumeInformation.VolumeSerialNumber),
                1803,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeSerialNumber (4 bytes):
                This value is not required to be unique.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1804 Actual VolumeLabelLength: {0}, Expected VolumeLabelLength: {1}.",
                fileFsVolumeInformation.VolumeLabelLength, fileFsVolumeInformation.VolumeLabel.Length);
            //
            // Verify requirement 1804
            //
            // Verify type and the value of the VolumeLabelLength
            bool isVerifyR1804 = (
                fileFsVolumeInformation.VolumeLabelLength.GetType() == typeof(UInt32) &&
                fileFsVolumeInformation.VolumeLabelLength == fileFsVolumeInformation.VolumeLabel.Length);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1804,
                1804,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeLabelLength (4 bytes):
                A 32-bit unsigned integer that contains the length, in bytes, including the trailing NULL,
                if present, of the name of the volume.");

            // If the file system supports object-oriented file system objects.
            if (isSupportsOOFileSysObj)
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug,
                    "Verify MS-FSCC_R1805 Actual SupportsObjects: {0}, Expected SupportsObjects: {1}.",
                    fileFsVolumeInformation.SupportsObjects, SupportsObjects_Values.V1);
                //
                // Verify requirement 1805
                //
                // Verify type and value of the SupportsObjects
                bool isVerifyR1805 = (
                    fileFsVolumeInformation.SupportsObjects.GetType() == typeof(SupportsObjects_Values) &&
                    fileFsVolumeInformation.SupportsObjects == SupportsObjects_Values.V1);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1805,
                    1805,
                    @"[In FILE_FS_VOLUME_INFORMATION]SupportsObjects (1 byte):  A 1-byte Boolean (unsigned char) that is TRUE (0x01)
                    if the file system supports object-oriented file system objects.");
            }

            // if the file system does not support object-oriented file system objects
            else
            {

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug,
                    "Verify MS-FSCC_R1806 Actual SupportsObjects: {0}, Expected SupportsObjects: {1}.",
                    fileFsVolumeInformation.SupportsObjects, SupportsObjects_Values.V2);
                //
                // Verify requirement 1806
                //
                // Verify type and value of the SupportsObjects
                bool isVerifyR1806 = (
                    fileFsVolumeInformation.SupportsObjects.GetType() == typeof(Byte) &&
                    fileFsVolumeInformation.SupportsObjects == SupportsObjects_Values.V2);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1806,
                    1806,
                    @"[In FILE_FS_VOLUME_INFORMATION]SupportsObjects (1 byte):
                    otherwise[if the file system does not support object-oriented file system objects], [it is] FALSE (0x00).<91>");
            }
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1808 Actual VolumeLabel : {0}",
                fileFsVolumeInformation.VolumeLabel.ToString());
            //
            // Verify requirement 1808
            //
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(Byte[]),
                fileFsVolumeInformation.VolumeLabel.GetType(),
                1808,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeLabel (variable):
                A variable-length Unicode field containing the name of the volume.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1809");

            //
            // Verify requirement 1809
            //
            Site.CaptureRequirementIfAreEqual<int>(
                fileFsVolumeInformation.VolumeLabel.Length,
                (int)fileFsVolumeInformation.VolumeLabelLength,
                1809,
                @"[In FILE_FS_VOLUME_INFORMATION]VolumeLabel (variable):
                The content of this field can be a NULL-terminated string or can be a string padded with the
                space character to be VolumeLabelLength bytes long.");

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }
コード例 #2
0
        /// <summary>
        /// Verify the FileFsVolumeInformation fields
        /// </summary>
        /// <param name="info">the instance of FileFsVolumeInformation</param>
        /// <param name="typeOfFileSystem">the type of file system: NTFS, FAT, exFAT or others</param>
        public void VerifyDataTypeFileFsVolumeInformation(FileFsVolumeInformation info,
            string typeOfFileSystem)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            if (isWindows)
            {
                if (typeOfFileSystem == "NTFS")
                {
                    //
                    // Add the debug information
                    //
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1986");

                    //
                    // Verify MS-FSCC requirement: MS-FSCC_R1986
                    //
                    // 0x01 for TRUE
                    Site.CaptureRequirementIfAreEqual<byte>(
                        0x01,
                        (byte)info.SupportsObjects,
                        1986,
                        @"<91> Section 2.5.8: This value[SupportsObjects] is TRUE for NTFS.");
                }
                else
                {

                    //
                    // Add the debug information
                    //
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1987");

                    //
                    // Verify MS-FSCC requirement: MS-FSCC_R1987
                    //
                    // 0x00 for FALSE
                    Site.CaptureRequirementIfAreEqual<byte>(
                        0x00,
                        (byte)info.SupportsObjects,
                        1987,
                        @"<91> Section 2.5.8: This value[SupportsObjects] is FALSE for other file systems[except NTFS]
                        implemented by Windows.");
                }
            }

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }