コード例 #1
0
        /// <summary>
        /// TRANS2_SET_FS_INFORMATION Request.
        /// </summary>
        /// <param name="messageId">This is used to associate a response with a request.</param>
        /// <param name="sessionId">
        /// Set this value to 0 to request a new session setup, or set this value to a previously established session 
        /// identifier to request reauthenticate to an existing session.
        /// </param>
        /// <param name="treeId">
        /// This field identifies the subdirectory (or tree) (also referred as a share in this document) on the 
        /// server that the client is accessing.
        /// </param>
        /// <param name="isSigned">
        /// Indicate whether the SUT has message signing enabled or required.
        /// </param>
        /// <param name="isUsePassthrough">
        /// Indicate whether adding SMB_INFO_PASSTHROUGH in InformationLevel field of the request.
        /// </param>
        /// <param name="isRequireDisconnectTreeFlags">Indicate whether flags set to Disconnect_TID.</param>
        /// <param name="isRequireNoResponseFlags">Indicate whether flags set to NO_RESPONSE.</param>
        /// <param name="informationLevel">This can be used to query information from the server.</param>
        /// <param name="fid">The file identifier.</param>
        /// <param name="otherBits">If it contains other bits.</param>
        /// <param name="reserved">The reserved int value.</param>
        public void Trans2SetFsInfoRequest(
            int messageId,
            int sessionId,
            int treeId,
            bool isSigned,
            bool isUsePassthrough,
            bool isRequireDisconnectTreeFlags,
            bool isRequireNoResponseFlags,
            InformationLevel informationLevel,
            int fid,
            bool otherBits,
            int reserved)
        {
            #region Create Packet

            SmbTrans2SetFsInformationRequestPacket smbPacket = new SmbTrans2SetFsInformationRequestPacket();
            ushort uid = (ushort)this.uId[(uint)sessionId];
            ushort fileId = (ushort)this.fId[(uint)fid];

            NamespaceCifs.Trans2SmbParametersFlags transactOptions = NamespaceCifs.Trans2SmbParametersFlags.NONE;

            if (isRequireDisconnectTreeFlags && isRequireNoResponseFlags)
            {
                transactOptions = NamespaceCifs.Trans2SmbParametersFlags.DISCONNECT_TID
                    | NamespaceCifs.Trans2SmbParametersFlags.NO_RESPONSE;
            }

            if (isRequireDisconnectTreeFlags && !isRequireNoResponseFlags)
            {
                transactOptions = NamespaceCifs.Trans2SmbParametersFlags.DISCONNECT_TID;
            }

            if (!isRequireDisconnectTreeFlags && isRequireNoResponseFlags)
            {
                transactOptions = NamespaceCifs.Trans2SmbParametersFlags.NO_RESPONSE;
            }

            if (!isRequireDisconnectTreeFlags && !isRequireNoResponseFlags)
            {
                transactOptions = NamespaceCifs.Trans2SmbParametersFlags.NONE;
            }

            ushort level = this.informationLevelBytes[(ushort)informationLevel];
            if (isUsePassthrough)
            {
                level += InformationLevelPathThrouth;
            }
            // FILE_FS_CONTROL_INFORMATION data
            NamespaceFscc.FileFsControlInformation fileFsControlInformation =
                new NamespaceFscc.FileFsControlInformation();

            fileFsControlInformation.DefaultQuotaLimit = uint.MinValue;
            fileFsControlInformation.DefaultQuotaThreshold = uint.MinValue;

            fileFsControlInformation.FileSystemControlFlags =
                NamespaceFscc.FileSystemControlFlags_Values.FILE_VC_LOG_QUOTA_LIMIT;

            fileFsControlInformation.FreeSpaceStartFiltering = uint.MinValue;
            fileFsControlInformation.FreeSpaceStopFiltering = uint.MinValue;
            fileFsControlInformation.FreeSpaceThreshold = uint.MinValue;

            NamespaceFscc.FsccFileFsControlInformationRequestPacket fsControlPacket
                = new NamespaceFscc.FsccFileFsControlInformationRequestPacket();

            fsControlPacket.Payload = fileFsControlInformation;

            byte[] data = new byte[DataCount];
            data = fsControlPacket.ToBytes();

            smbPacket = this.smbClientStack.CreateTrans2SetFileSystemInformationRequest(
                fileId,
                transactOptions,
                (NamespaceCifs.QueryFSInformationLevel)level,
                data);

            NamespaceCifs.SMB_COM_TRANSACTION2_Request_SMB_Parameters smbParameters = smbPacket.SmbParameters;
            smbParameters.DataCount = DataCount;
            smbPacket.SmbParameters = smbParameters;

            if (isSigned)
            {
                NamespaceCifs.CifsClientPerConnection connection =
                    this.smbClientStack.Context.GetConnection(ConnectionId);

                NamespaceCifs.CifsClientPerSession session =
                    this.smbClientStack.Context.GetSession(ConnectionId, uid);

                smbPacket.Sign(connection.ClientNextSendSequenceNumber, session.SessionKey);
            }

            #endregion

            #region Send and Receive ExpectPacket

            this.smbClientStack.SendPacket(smbPacket);
            StackPacket response = this.smbClientStack.ExpectPacket(this.timeout);

            NamespaceCifs.SmbPacket smbPacketResponse = (NamespaceCifs.SmbPacket)response;

            this.QueryUidTable(smbPacketResponse);
            this.QueryTidTable(smbPacketResponse);

            VerifyTransport(smbPacketResponse);
            VerifyCommonMessageSyntax(smbPacketResponse);

            if (response.GetType() == typeof(SmbErrorResponsePacket))
            {
                SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket;
                NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader;

                if (smbErrorHeader.Status == (uint)MessageStatus.StatusInvalidInfoClass)
                {
                    smbErrorHeader.Status = (uint)MessageStatus.NotSupported;
                }

                //Workaround temp code (SetFsInfo Unknown Error TDQ)
                if (informationLevel == InformationLevel.FileFsControlInformaiton &&
                    !bool.Parse(Site.Properties["IsTDQ33016Fixed"]))
                {
                    this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, MessageStatus.AccessDenied);
                }
                else
                {
                    this.ErrorResponse(smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status);
                }
            }
            else
            {
                SmbTrans2SetFsInformationResponsePacket smbTrans2SetFsInformationPacket
                    = response as SmbTrans2SetFsInformationResponsePacket;

                NamespaceCifs.SmbHeader trans2SetFsInformationResponseHeader =
                    smbTrans2SetFsInformationPacket.SmbHeader;

                if (this.Trans2SetFsInfoResponse != null)
                {
                    this.Trans2SetFsInfoResponse(
                        trans2SetFsInformationResponseHeader.Mid + this.addMidMark,
                        this.QueryUidTable(smbPacketResponse),
                        this.QueryTidTable(smbPacketResponse),
                        (smbPacketResponse).IsSignRequired,
                        (MessageStatus)trans2SetFsInformationResponseHeader.Status);
                }
                else
                {
                    this.Trans2SetFsInfoResponseAdditional(
                        trans2SetFsInformationResponseHeader.Mid + this.addMidMark,
                        this.QueryUidTable(smbPacketResponse),
                        this.QueryTidTable(smbPacketResponse),
                        (smbPacketResponse).IsSignRequired,
                        (MessageStatus)trans2SetFsInformationResponseHeader.Status);
                }
            }

            #endregion
        }
コード例 #2
0
        /// <summary>
        /// Verify data type FileFsControlInformation
        /// </summary>
        /// <param name="fileFsControlInformation"> FileFsControlInformation type data </param>
        /// <param name="freeSpaceThreshold"> A 64-bit signed integer that contains the minimum amount of free disk space in bytes that is required for the indexing service to continue to filter documents and merge word lists. </param>
        /// <param name="freeSpaceStopFiltering"> A 64-bit signed integer that contains the minimum amount of free disk space in bytes that is required for the content indexing service to continue filtering. </param>
        /// <param name="defaultQuotaLimit"> A 64-bit signed integer that contains the default per-user disk quota limit in bytes for the volume. </param>
        public void VerifyDataTypeFileFsControlInformationForOld(
            FileFsControlInformation fileFsControlInformation,
            // long freeSpaceThreshold,
            long defaultQuotaLimit)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1720 ");
            //
            // Verify requirement 1720
            //
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(FileFsControlInformation),
                fileFsControlInformation.GetType(),
                1720,
                @"The message[FileFsControlInformation] contains a FILE_FS_CONTROL_INFORMATION data element.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1734 Actual DefaultQuotaLimit: {0}, Expected DefaultQuotaLimit: {1}.",
                fileFsControlInformation.DefaultQuotaLimit, defaultQuotaLimit);
            //
            // Verify requirement 1734
            //
            // Verify the type and the value of the DefaultQuotaLimit
            bool isVerifyR1734 = (
                fileFsControlInformation.DefaultQuotaLimit.GetType() == typeof(Int64) &&
                fileFsControlInformation.DefaultQuotaLimit == (ulong)defaultQuotaLimit);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1734,
                1734,
                @"[In FILE_FS_CONTROL_INFORMATION]DefaultQuotaLimit (8 bytes):  A 64-bit signed integer that contains
                the default per-user disk quota limit in bytes for the volume.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1736 actual FileSystemControlFlags is : {0}",
                fileFsControlInformation.FileSystemControlFlags);
            //
            // Verify requirement 1736
            //
            // Verify the type of FileSystemControlFlags
            // And for the value of it, we'll verify in the next rs
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(FileSystemControlFlags_Values),
                fileFsControlInformation.FileSystemControlFlags.GetType(),
                1736,
                @"[In FILE_FS_CONTROL_INFORMATION]FileSystemControlFlags (4 bytes):
                A 32-bit unsigned integer that contains a bitmask of flags that control quota enforcement and
                logging of user-related quota events on the volume.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1737 Actual FileSystemControlFlags: {0}.",
                fileFsControlInformation.FileSystemControlFlags);
            //
            // Verify requirement 1737
            //
            // As the type of the FileSystemControlFlags is verified above, we didn't here again
            // Verify the valid value of FileSystemControlFlags
            const uint FileSystemControlFlagsBitUsed = (
                0x00000008 | 0x00000020 | 0x00000010 | 0x00000080 | 0x00000040 | 0x00000002 |
                0x00000001 | 0x00000100 | 0x00000200);

            // FileSystemControlFlagsBitUnUsed contains the bit that FileSystemControlFlags unused
            const uint fileSystemControlFlagsBitUnUsed = ~FileSystemControlFlagsBitUsed;

            bool isVerifyR1737 = (
                ((uint)fileFsControlInformation.FileSystemControlFlags & fileSystemControlFlagsBitUnUsed) == 0x00000000);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1737,
                1737,
                @"[In FILE_FS_CONTROL_INFORMATION]FileSystemControlFlags (4 bytes):  The following bit flags
                [FILE_VC_CONTENT_INDEX_DISABLED 0x00000008, FILE_VC_LOG_QUOTA_LIMIT 0x00000020,
                FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010, FILE_VC_LOG_VOLUME_LIMIT 0x00000080,
                FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040, FILE_VC_QUOTA_ENFORCE 0x00000002,
                FILE_VC_QUOTA_TRACK 0x00000001, FILE_VC_QUOTAS_INCOMPLETE 0x00000100,
                FILE_VC_QUOTAS_REBUILDING 0x00000200] are valid in any combination.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1739 the FileSystemControlFlags is {0}",
                fileFsControlInformation.FileSystemControlFlags);
            //
            // Verify requirement 1739
            //
            const uint bitUsed_r1739 =
                (uint)FileSystemControlFlags_Values.FILE_VC_CONTENT_INDEX_DISABLED |
                (uint)FileSystemControlFlags_Values.FILE_VC_LOG_QUOTA_LIMIT |
                (uint)FileSystemControlFlags_Values.FILE_VC_LOG_QUOTA_THRESHOLD |
                (uint)FileSystemControlFlags_Values.FILE_VC_LOG_VOLUME_LIMIT |
                (uint)FileSystemControlFlags_Values.FILE_VC_LOG_VOLUME_THRESHOLD |
                (uint)FileSystemControlFlags_Values.FILE_VC_QUOTA_ENFORCE |
                (uint)FileSystemControlFlags_Values.FILE_VC_QUOTA_TRACK |
                (uint)FileSystemControlFlags_Values.FILE_VC_QUOTAS_INCOMPLETE |
                (uint)FileSystemControlFlags_Values.FILE_VC_QUOTAS_REBUILDING;

            const uint bitUnUsed_r1739 = ~bitUsed_r1739;

            Site.CaptureRequirementIfAreEqual<uint>(
                0x00000000,
                bitUnUsed_r1739 & (uint)fileFsControlInformation.FileSystemControlFlags,
                1739,
                @"[In FILE_FS_CONTROL_INFORMATION]FileSystemControlFlags (4 bytes):  Bits not defined in the
                following table[FILE_VC_CONTENT_INDEX_DISABLED 0x00000008, FILE_VC_LOG_QUOTA_LIMIT 0x00000020,
                FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010, FILE_VC_LOG_VOLUME_LIMIT 0x00000080,
                FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040, FILE_VC_QUOTA_ENFORCE 0x00000002, FILE_VC_QUOTA_TRACK
                0x00000001, FILE_VC_QUOTAS_INCOMPLETE 0x00000100, FILE_VC_QUOTAS_REBUILDING 0x00000200] MUST be
                ignored.<83><84>");

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }
コード例 #3
0
        /// <summary>
        /// Verify the message syntax in  FILE_FS_CONTROL_INFORMATION
        /// </summary>
        /// <param name="fileFsControlInformation">A FileFsControlInformation type structure.</param>
        /// <param name="defaultPerUserDiskQuatoLimit">The default per-user disk quota limit in bytes for the volume.</param>
        /// <param name="deaultPerUserDiskQuotaWarningThreshold">the default per-user disk quota warning threshold 
        /// in bytes for the volume</param>
        /// <param name="minAmountOfFreeDiskSpaceForStartFiltering">minimum amount of free disk space in bytes that is 
        /// required for the operating system's content indexing service to begin document filtering.</param>
        /// <param name="minAmountOfFreeDiskSpaceForStopFiltering">the minimum amount of free disk space in bytes that 
        /// is required for the content indexing service to continue filtering</param>
        /// <param name="minAmountOfFreeDiskSpaceForThreshold">the minimum amount of free disk space in bytes that is 
        /// required for the indexing service to continue to filter documents and merge word lists.</param>
        public void VerifyMessageSyntaxFileFsControlInformation(
            FileFsControlInformation fileFsControlInformation,
            long deaultPerUserDiskQuotaWarningThreshold,
            long minAmountOfFreeDiskSpaceForStartFiltering,
            long minAmountOfFreeDiskSpaceForStopFiltering,
            long minAmountOfFreeDiskSpaceForThreshold)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1720");

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1720
            //
            // If FILE_FS_CONTROL_INFORMATION is not null in the message then means the message contains it,
            // so can capture this requirement just by verifying this field is not null
            Site.CaptureRequirementIfIsNotNull(
                fileFsControlInformation,
                1720,
                @"The message[FileFsControlInformation] contains a FILE_FS_CONTROL_INFORMATION data element.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1735,the value of DefaultQuotaLimit is {0}",
                fileFsControlInformation.DefaultQuotaLimit);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1735
            //
            bool isVerifyR1735 = (Marshal.SizeOf(fileFsControlInformation.DefaultQuotaLimit) == 8) &&
                ((fileFsControlInformation.DefaultQuotaLimit >= 0) ||
                (fileFsControlInformation.DefaultQuotaLimit == 0xFFFFFFFFFFFFFFFF));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1735,
                1735,
                @"[In FILE_FS_CONTROL_INFORMATION]DefaultQuotaLimit (8 bytes):  This field MUST be set to a 64-bit integer value greater than or equal to 0 to set a default disk quota limit per user for this volume, or to (-1) to specify that no default quota limit per user is set.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1732,the value of DefaultQuotaThreshold is {0}",
                fileFsControlInformation.DefaultQuotaThreshold);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1732
            //
            bool isVerifyR1732 =
                (Marshal.SizeOf(fileFsControlInformation.DefaultQuotaThreshold) == 8) &&
                (fileFsControlInformation.DefaultQuotaThreshold == (ulong)deaultPerUserDiskQuotaWarningThreshold);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1732,
                1732,
                @"[In FILE_FS_CONTROL_INFORMATION]DefaultQuotaThreshold (8 bytes):  A 64-bit signed integer that contains the default per-user disk quota warning threshold in bytes for the volume.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1733,the value of DefaultQuotaThreshold is {0}",
                fileFsControlInformation.DefaultQuotaThreshold);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1733
            //
            bool isVerifyR1733 = (Marshal.SizeOf(fileFsControlInformation.DefaultQuotaThreshold) == 8) &&
                (fileFsControlInformation.DefaultQuotaThreshold >= 0 ||
                fileFsControlInformation.DefaultQuotaThreshold == 0xFFFFFFFFFFFFFFFF);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1733,
                1733,
                @"[In FILE_FS_CONTROL_INFORMATION]DefaultQuotaThreshold (8 bytes): This field MUST be set to a 64-bit integer value greater than or equal to 0 to set a default quota warning threshold per user for this volume, or to (-1) to specify that no default quota warning threshold per user is set.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1723,the value of FreeSpaceStartFiltering is {0}",
                fileFsControlInformation.FreeSpaceStartFiltering);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1723
            //
            bool isVerifyR1723 =
                (Marshal.SizeOf(fileFsControlInformation.FreeSpaceStartFiltering) == 8) &&
                (fileFsControlInformation.FreeSpaceStartFiltering == minAmountOfFreeDiskSpaceForStartFiltering);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1723,
                1723,
                @"[In FILE_FS_CONTROL_INFORMATION]FreeSpaceStartFiltering (8 bytes):  A 64-bit signed integer that contains the minimum amount of free disk space in bytes that is required for the operating system's content indexing service to begin document filtering.");

            //
            // Verify requirement MS-FSCC_R1724 and MS-FSCC_R1975
            //
            string isR1724Implementated = Site.Properties.Get("SHOULDMAY.IsR1724Implementated");
            bool isR1975Satisfied = (fileFsControlInformation.FreeSpaceStartFiltering == 0);

            if (isWindows)
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1975,the value of FreeSpaceStartFiltering is {0}", fileFsControlInformation.FreeSpaceStartFiltering);
                //
                // Verify MS-FSCC requirement: MS-FSCC_R1975
                //
                Site.CaptureRequirementIfIsTrue(
                    isR1975Satisfied,
                    1975,
                    @"<80> Section 2.5.2: Windows sets this value[FreeSpaceStartFiltering] to 0.");

                if (null == isR1724Implementated)
                {
                    Site.Properties.Add("SHOULDMAY.IsR1724Implementated", Boolean.TrueString);
                    isR1724Implementated = Boolean.TrueString;
                }
            }

            if (null != isR1724Implementated)
            {
                bool implement = Boolean.Parse(isR1724Implementated);
                bool isSatisfied = isR1975Satisfied;

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1724,the value of FreeSpaceStartFiltering is {0}", fileFsControlInformation.FreeSpaceStartFiltering);
                //
                // Verify MS-FSCC requirement: MS-FSCC_R1724
                //
                Site.CaptureRequirementIfAreEqual<Boolean>(
                    implement,
                    isSatisfied,
                    1724,
                    String.Format(@"[In FILE_FS_CONTROL_INFORMATION]FreeSpaceStartFiltering (8 bytes):  This value SHOULD be set to 0.<80> This requirement is {0} implement", implement ? "" : "not"));
            }

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1729,the value of FreeSpaceStopFiltering is {0}", fileFsControlInformation.FreeSpaceStopFiltering);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1729
            //
            bool isVerifyR1729 =
                (Marshal.SizeOf(fileFsControlInformation.FreeSpaceStopFiltering) == 8) &&
                (fileFsControlInformation.FreeSpaceStopFiltering == minAmountOfFreeDiskSpaceForStopFiltering);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1729,
                1729,
                @"[In FILE_FS_CONTROL_INFORMATION]FreeSpaceStopFiltering (8 bytes):  A 64-bit signed integer that contains the minimum amount of free disk space in bytes that is required for the content indexing service to continue filtering.");

            //
            // Verify requirement MS-FSCC_R1730 and MS-FSCC_R1977
            //
            string isR1730Implementated = Site.Properties.Get("SHOULDMAY.IsR1730Implementated");
            bool isR1977Satisfied = (fileFsControlInformation.FreeSpaceStopFiltering == 0);

            if (isWindows)
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1977,the value of FreeSpaceStopFiltering is{0}", fileFsControlInformation.FreeSpaceStopFiltering);
                //
                // Verify MS-FSCC requirement: MS-FSCC_R1977
                //
                Site.CaptureRequirementIfIsTrue(
                    isR1977Satisfied,
                    1977,
                    @"<82> Section 2.5.2: Windows sets this value[FreeSpaceStopFiltering] to 0.");

                if (null == isR1730Implementated)
                {
                    Site.Properties.Add("SHOULDMAY.IsR1730Implementated", Boolean.TrueString);
                    isR1730Implementated = Boolean.TrueString;
                }
            }

            if (null != isR1730Implementated)
            {
                bool implement = Boolean.Parse(isR1730Implementated);
                bool isSatisfied = isR1977Satisfied;

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1730,the value of FreeSpaceStopFiltering is{0}", fileFsControlInformation.FreeSpaceStopFiltering);
                //
                // Verify MS-FSCC requirement: MS-FSCC_R1730
                //
                Site.CaptureRequirementIfAreEqual<Boolean>(
                    implement,
                    isSatisfied,
                    1730,
                    String.Format(@"[In FILE_FS_CONTROL_INFORMATION]FreeSpaceStopFiltering (8 bytes): This value SHOULD be set to 0.<82> This requirement is {0} implement", implement ? "" : "not"));
            }

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1726,the value of FreeSpaceThreshold is {0}", fileFsControlInformation.FreeSpaceThreshold);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1726
            //
            bool isVerifyR1726 =
                (Marshal.SizeOf(fileFsControlInformation.FreeSpaceThreshold) == 8) &&
                (fileFsControlInformation.FreeSpaceThreshold == minAmountOfFreeDiskSpaceForThreshold);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1726,
                1726,
                @"[In FILE_FS_CONTROL_INFORMATION]FreeSpaceThreshold (8 bytes):  A 64-bit signed integer that contains the minimum amount of free disk space in bytes that is required for the indexing service to continue to filter documents and merge word lists.");

            //
            // Verify requirement MS-FSCC_R1727 and MS-FSCC_R1976
            //
            string isR1727Implementated = Site.Properties.Get("SHOULDMAY.IsR1727Implementated");
            bool isR1976Satisfied = (fileFsControlInformation.FreeSpaceThreshold == 0);

            if (isWindows)
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1976,the value of FreeSpaceThreshold is {0}", fileFsControlInformation.FreeSpaceThreshold);
                //
                // Verify MS-FSCC requirement: MS-FSCC_R1976
                //
                Site.CaptureRequirementIfIsTrue(
                    isR1976Satisfied,
                    1976,
                    @"<81> Section 2.5.2: Windows sets this value[FreeSpaceThreshold] to 0.");

                if (null == isR1727Implementated)
                {
                    Site.Properties.Add("SHOULDMAY.IsR1727Implementated", Boolean.TrueString);
                    isR1727Implementated = Boolean.TrueString;
                }
            }

            if (null != isR1727Implementated)
            {
                bool implement = Boolean.Parse(isR1727Implementated);
                bool isSatisfied = isR1976Satisfied;

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1727,the value of FreeSpaceThreshold is {0}", fileFsControlInformation.FreeSpaceThreshold);
                //
                // Verify MS-FSCC requirement: MS-FSCC_R1727
                //
                Site.CaptureRequirementIfAreEqual<Boolean>(
                    implement,
                    isSatisfied,
                    1727,
                    String.Format(@"[In FILE_FS_CONTROL_INFORMATION]FreeSpaceThreshold (8 bytes):  This value SHOULD be set to 0.<81> This requirement is {0} implement", implement ? "" : "not"));
            }

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }
コード例 #4
0
        /// <summary>
        /// Verify the FileFsControlInformation fields
        /// </summary>
        /// <param name="info">the instance of FileFsControlInformation</param>
        public void VerifyDataTypeFileFsControlInformation(FileFsControlInformation info)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            if (bool.Parse(Site.Properties["SUT.Platform.OS.isWindows"]))
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1976");

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1976
                //
                Site.CaptureRequirementIfAreEqual<long>(
                    0,
                    info.FreeSpaceThreshold,
                    1976,
                    @"<81> Section 2.5.2: Windows sets this value[FreeSpaceThreshold] to 0.");

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

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1977
                //
                Site.CaptureRequirementIfAreEqual<long>(
                    0,
                    info.FreeSpaceStopFiltering,
                    1977,
                    @"<82> Section 2.5.2: Windows sets this value[FreeSpaceStopFiltering] to 0.");

                // the bit flags combination
                uint bitsCombination = ((uint)FileSystemControlFlags_Values.FILE_VC_CONTENT_INDEX_DISABLED |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_LOG_QUOTA_LIMIT |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_LOG_QUOTA_THRESHOLD |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_LOG_VOLUME_LIMIT |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_LOG_VOLUME_THRESHOLD |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_QUOTA_ENFORCE |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_QUOTA_TRACK |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_QUOTAS_INCOMPLETE |
                                        (uint)FileSystemControlFlags_Values.FILE_VC_QUOTAS_REBUILDING);
                // FileSystemControlFlags is set to any other bit except all above
                if (((uint)info.FileSystemControlFlags & ~bitsCombination) == 0)
                {

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

                    //
                    // Verify MS-FSCC requirement: MS-FSCC_R1978
                    //
                    Site.CaptureRequirementIfAreEqual<uint>(
                        0,
                        (uint)info.FileSystemControlFlags,
                        1978,
                        @"<83> Section 2.5.2: Windows sets flags not defined below[[FILE_VC_CONTENT_INDEX_DISABLED
                        0x00000008, FILE_VC_LOG_QUOTA_LIMIT 0x00000020, FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010,
                        FILE_VC_LOG_VOLUME_LIMIT 0x00000080, FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040,
                        FILE_VC_QUOTA_ENFORCE 0x00000002, FILE_VC_QUOTA_TRACK 0x00000001, FILE_VC_QUOTAS_INCOMPLETE
                        0x00000100, FILE_VC_QUOTAS_REBUILDING 0x00000200] to zero.");
                }
            }

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